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_power_system__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14pub type LeaseToken = fidl::EventPair;
15
16#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
17pub struct ActivityGovernorAcquireWakeLeaseWithTokenRequest {
18 pub name: String,
22 pub server_token: fidl::EventPair,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
29 for ActivityGovernorAcquireWakeLeaseWithTokenRequest
30{
31}
32
33#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
34pub struct ActivityGovernorAcquireWakeLeaseResponse {
35 pub token: fidl::EventPair,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40 for ActivityGovernorAcquireWakeLeaseResponse
41{
42}
43
44#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
45pub struct ActivityGovernorRegisterSuspendBlockerResponse {
46 pub token: fidl::EventPair,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
51 for ActivityGovernorRegisterSuspendBlockerResponse
52{
53}
54
55#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56pub struct ActivityGovernorTakeApplicationActivityLeaseResponse {
57 pub token: fidl::EventPair,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
63 for ActivityGovernorTakeApplicationActivityLeaseResponse
64{
65}
66
67#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
68pub struct ActivityGovernorTakeWakeLeaseResponse {
69 pub token: fidl::EventPair,
71}
72
73impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
74 for ActivityGovernorTakeWakeLeaseResponse
75{
76}
77
78#[derive(Debug, Default, PartialEq)]
79pub struct ActivityGovernorRegisterSuspendBlockerRequest {
80 pub suspend_blocker: Option<fidl::endpoints::ClientEnd<SuspendBlockerMarker>>,
84 pub name: Option<String>,
90 #[doc(hidden)]
91 pub __source_breaking: fidl::marker::SourceBreaking,
92}
93
94impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
95 for ActivityGovernorRegisterSuspendBlockerRequest
96{
97}
98
99#[derive(Debug, Default, PartialEq)]
103pub struct ApplicationActivity {
104 pub assertive_dependency_token: Option<fidl::Event>,
105 #[doc(hidden)]
106 pub __source_breaking: fidl::marker::SourceBreaking,
107}
108
109impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ApplicationActivity {}
110
111#[derive(Debug, Default, PartialEq)]
115pub struct Cpu {
116 pub assertive_dependency_token: Option<fidl::Event>,
117 #[doc(hidden)]
118 pub __source_breaking: fidl::marker::SourceBreaking,
119}
120
121impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Cpu {}
122
123#[derive(Debug, Default, PartialEq)]
124pub struct CpuElementManagerAddExecutionStateDependencyRequest {
125 pub dependency_token: Option<fidl::Event>,
129 pub power_level: Option<u8>,
132 #[doc(hidden)]
133 pub __source_breaking: fidl::marker::SourceBreaking,
134}
135
136impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
137 for CpuElementManagerAddExecutionStateDependencyRequest
138{
139}
140
141#[derive(Debug, Default, PartialEq)]
143pub struct PowerElements {
144 pub application_activity: Option<ApplicationActivity>,
145 #[doc(hidden)]
146 pub __source_breaking: fidl::marker::SourceBreaking,
147}
148
149impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PowerElements {}
150
151#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
152pub struct ActivityGovernorMarker;
153
154impl fidl::endpoints::ProtocolMarker for ActivityGovernorMarker {
155 type Proxy = ActivityGovernorProxy;
156 type RequestStream = ActivityGovernorRequestStream;
157 #[cfg(target_os = "fuchsia")]
158 type SynchronousProxy = ActivityGovernorSynchronousProxy;
159
160 const DEBUG_NAME: &'static str = "fuchsia.power.system.ActivityGovernor";
161}
162impl fidl::endpoints::DiscoverableProtocolMarker for ActivityGovernorMarker {}
163pub type ActivityGovernorAcquireWakeLeaseResult = Result<fidl::EventPair, AcquireWakeLeaseError>;
164pub type ActivityGovernorAcquireWakeLeaseWithTokenResult = Result<(), AcquireWakeLeaseError>;
165pub type ActivityGovernorRegisterSuspendBlockerResult =
166 Result<fidl::EventPair, RegisterSuspendBlockerError>;
167
168pub trait ActivityGovernorProxyInterface: Send + Sync {
169 type GetPowerElementsResponseFut: std::future::Future<Output = Result<PowerElements, fidl::Error>>
170 + Send;
171 fn r#get_power_elements(&self) -> Self::GetPowerElementsResponseFut;
172 type TakeWakeLeaseResponseFut: std::future::Future<Output = Result<fidl::EventPair, fidl::Error>>
173 + Send;
174 fn r#take_wake_lease(&self, name: &str) -> Self::TakeWakeLeaseResponseFut;
175 type AcquireWakeLeaseResponseFut: std::future::Future<Output = Result<ActivityGovernorAcquireWakeLeaseResult, fidl::Error>>
176 + Send;
177 fn r#acquire_wake_lease(&self, name: &str) -> Self::AcquireWakeLeaseResponseFut;
178 type AcquireWakeLeaseWithTokenResponseFut: std::future::Future<
179 Output = Result<ActivityGovernorAcquireWakeLeaseWithTokenResult, fidl::Error>,
180 > + Send;
181 fn r#acquire_wake_lease_with_token(
182 &self,
183 name: &str,
184 server_token: fidl::EventPair,
185 ) -> Self::AcquireWakeLeaseWithTokenResponseFut;
186 type TakeApplicationActivityLeaseResponseFut: std::future::Future<Output = Result<fidl::EventPair, fidl::Error>>
187 + Send;
188 fn r#take_application_activity_lease(
189 &self,
190 name: &str,
191 ) -> Self::TakeApplicationActivityLeaseResponseFut;
192 type RegisterSuspendBlockerResponseFut: std::future::Future<
193 Output = Result<ActivityGovernorRegisterSuspendBlockerResult, fidl::Error>,
194 > + Send;
195 fn r#register_suspend_blocker(
196 &self,
197 payload: ActivityGovernorRegisterSuspendBlockerRequest,
198 ) -> Self::RegisterSuspendBlockerResponseFut;
199}
200#[derive(Debug)]
201#[cfg(target_os = "fuchsia")]
202pub struct ActivityGovernorSynchronousProxy {
203 client: fidl::client::sync::Client,
204}
205
206#[cfg(target_os = "fuchsia")]
207impl fidl::endpoints::SynchronousProxy for ActivityGovernorSynchronousProxy {
208 type Proxy = ActivityGovernorProxy;
209 type Protocol = ActivityGovernorMarker;
210
211 fn from_channel(inner: fidl::Channel) -> Self {
212 Self::new(inner)
213 }
214
215 fn into_channel(self) -> fidl::Channel {
216 self.client.into_channel()
217 }
218
219 fn as_channel(&self) -> &fidl::Channel {
220 self.client.as_channel()
221 }
222}
223
224#[cfg(target_os = "fuchsia")]
225impl ActivityGovernorSynchronousProxy {
226 pub fn new(channel: fidl::Channel) -> Self {
227 Self { client: fidl::client::sync::Client::new(channel) }
228 }
229
230 pub fn into_channel(self) -> fidl::Channel {
231 self.client.into_channel()
232 }
233
234 pub fn wait_for_event(
237 &self,
238 deadline: zx::MonotonicInstant,
239 ) -> Result<ActivityGovernorEvent, fidl::Error> {
240 ActivityGovernorEvent::decode(
241 self.client.wait_for_event::<ActivityGovernorMarker>(deadline)?,
242 )
243 }
244
245 pub fn r#get_power_elements(
252 &self,
253 ___deadline: zx::MonotonicInstant,
254 ) -> Result<PowerElements, fidl::Error> {
255 let _response = self.client.send_query::<
256 fidl::encoding::EmptyPayload,
257 fidl::encoding::FlexibleType<PowerElements>,
258 ActivityGovernorMarker,
259 >(
260 (),
261 0x798003259dfb5672,
262 fidl::encoding::DynamicFlags::FLEXIBLE,
263 ___deadline,
264 )?
265 .into_result::<ActivityGovernorMarker>("get_power_elements")?;
266 Ok(_response)
267 }
268
269 pub fn r#take_wake_lease(
278 &self,
279 mut name: &str,
280 ___deadline: zx::MonotonicInstant,
281 ) -> Result<fidl::EventPair, fidl::Error> {
282 let _response = self.client.send_query::<
283 ActivityGovernorTakeWakeLeaseRequest,
284 fidl::encoding::FlexibleType<ActivityGovernorTakeWakeLeaseResponse>,
285 ActivityGovernorMarker,
286 >(
287 (name,),
288 0x291cfb42b2d3bf69,
289 fidl::encoding::DynamicFlags::FLEXIBLE,
290 ___deadline,
291 )?
292 .into_result::<ActivityGovernorMarker>("take_wake_lease")?;
293 Ok(_response.token)
294 }
295
296 pub fn r#acquire_wake_lease(
301 &self,
302 mut name: &str,
303 ___deadline: zx::MonotonicInstant,
304 ) -> Result<ActivityGovernorAcquireWakeLeaseResult, fidl::Error> {
305 let _response = self.client.send_query::<
306 ActivityGovernorAcquireWakeLeaseRequest,
307 fidl::encoding::FlexibleResultType<ActivityGovernorAcquireWakeLeaseResponse, AcquireWakeLeaseError>,
308 ActivityGovernorMarker,
309 >(
310 (name,),
311 0x2de25abd8fa7c103,
312 fidl::encoding::DynamicFlags::FLEXIBLE,
313 ___deadline,
314 )?
315 .into_result::<ActivityGovernorMarker>("acquire_wake_lease")?;
316 Ok(_response.map(|x| x.token))
317 }
318
319 pub fn r#acquire_wake_lease_with_token(
329 &self,
330 mut name: &str,
331 mut server_token: fidl::EventPair,
332 ___deadline: zx::MonotonicInstant,
333 ) -> Result<ActivityGovernorAcquireWakeLeaseWithTokenResult, fidl::Error> {
334 let _response = self.client.send_query::<
335 ActivityGovernorAcquireWakeLeaseWithTokenRequest,
336 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, AcquireWakeLeaseError>,
337 ActivityGovernorMarker,
338 >(
339 (name, server_token,),
340 0x1cdd2ea3bee46f51,
341 fidl::encoding::DynamicFlags::FLEXIBLE,
342 ___deadline,
343 )?
344 .into_result::<ActivityGovernorMarker>("acquire_wake_lease_with_token")?;
345 Ok(_response.map(|x| x))
346 }
347
348 pub fn r#take_application_activity_lease(
358 &self,
359 mut name: &str,
360 ___deadline: zx::MonotonicInstant,
361 ) -> Result<fidl::EventPair, fidl::Error> {
362 let _response = self.client.send_query::<
363 ActivityGovernorTakeApplicationActivityLeaseRequest,
364 fidl::encoding::FlexibleType<ActivityGovernorTakeApplicationActivityLeaseResponse>,
365 ActivityGovernorMarker,
366 >(
367 (name,),
368 0x37cd5364de7ada14,
369 fidl::encoding::DynamicFlags::FLEXIBLE,
370 ___deadline,
371 )?
372 .into_result::<ActivityGovernorMarker>("take_application_activity_lease")?;
373 Ok(_response.token)
374 }
375
376 pub fn r#register_suspend_blocker(
392 &self,
393 mut payload: ActivityGovernorRegisterSuspendBlockerRequest,
394 ___deadline: zx::MonotonicInstant,
395 ) -> Result<ActivityGovernorRegisterSuspendBlockerResult, fidl::Error> {
396 let _response = self.client.send_query::<
397 ActivityGovernorRegisterSuspendBlockerRequest,
398 fidl::encoding::FlexibleResultType<ActivityGovernorRegisterSuspendBlockerResponse, RegisterSuspendBlockerError>,
399 ActivityGovernorMarker,
400 >(
401 &mut payload,
402 0x34ef55b180feef01,
403 fidl::encoding::DynamicFlags::FLEXIBLE,
404 ___deadline,
405 )?
406 .into_result::<ActivityGovernorMarker>("register_suspend_blocker")?;
407 Ok(_response.map(|x| x.token))
408 }
409}
410
411#[cfg(target_os = "fuchsia")]
412impl From<ActivityGovernorSynchronousProxy> for zx::NullableHandle {
413 fn from(value: ActivityGovernorSynchronousProxy) -> Self {
414 value.into_channel().into()
415 }
416}
417
418#[cfg(target_os = "fuchsia")]
419impl From<fidl::Channel> for ActivityGovernorSynchronousProxy {
420 fn from(value: fidl::Channel) -> Self {
421 Self::new(value)
422 }
423}
424
425#[cfg(target_os = "fuchsia")]
426impl fidl::endpoints::FromClient for ActivityGovernorSynchronousProxy {
427 type Protocol = ActivityGovernorMarker;
428
429 fn from_client(value: fidl::endpoints::ClientEnd<ActivityGovernorMarker>) -> Self {
430 Self::new(value.into_channel())
431 }
432}
433
434#[derive(Debug, Clone)]
435pub struct ActivityGovernorProxy {
436 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
437}
438
439impl fidl::endpoints::Proxy for ActivityGovernorProxy {
440 type Protocol = ActivityGovernorMarker;
441
442 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
443 Self::new(inner)
444 }
445
446 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
447 self.client.into_channel().map_err(|client| Self { client })
448 }
449
450 fn as_channel(&self) -> &::fidl::AsyncChannel {
451 self.client.as_channel()
452 }
453}
454
455impl ActivityGovernorProxy {
456 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
458 let protocol_name = <ActivityGovernorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
459 Self { client: fidl::client::Client::new(channel, protocol_name) }
460 }
461
462 pub fn take_event_stream(&self) -> ActivityGovernorEventStream {
468 ActivityGovernorEventStream { event_receiver: self.client.take_event_receiver() }
469 }
470
471 pub fn r#get_power_elements(
478 &self,
479 ) -> fidl::client::QueryResponseFut<PowerElements, fidl::encoding::DefaultFuchsiaResourceDialect>
480 {
481 ActivityGovernorProxyInterface::r#get_power_elements(self)
482 }
483
484 pub fn r#take_wake_lease(
493 &self,
494 mut name: &str,
495 ) -> fidl::client::QueryResponseFut<
496 fidl::EventPair,
497 fidl::encoding::DefaultFuchsiaResourceDialect,
498 > {
499 ActivityGovernorProxyInterface::r#take_wake_lease(self, name)
500 }
501
502 pub fn r#acquire_wake_lease(
507 &self,
508 mut name: &str,
509 ) -> fidl::client::QueryResponseFut<
510 ActivityGovernorAcquireWakeLeaseResult,
511 fidl::encoding::DefaultFuchsiaResourceDialect,
512 > {
513 ActivityGovernorProxyInterface::r#acquire_wake_lease(self, name)
514 }
515
516 pub fn r#acquire_wake_lease_with_token(
526 &self,
527 mut name: &str,
528 mut server_token: fidl::EventPair,
529 ) -> fidl::client::QueryResponseFut<
530 ActivityGovernorAcquireWakeLeaseWithTokenResult,
531 fidl::encoding::DefaultFuchsiaResourceDialect,
532 > {
533 ActivityGovernorProxyInterface::r#acquire_wake_lease_with_token(self, name, server_token)
534 }
535
536 pub fn r#take_application_activity_lease(
546 &self,
547 mut name: &str,
548 ) -> fidl::client::QueryResponseFut<
549 fidl::EventPair,
550 fidl::encoding::DefaultFuchsiaResourceDialect,
551 > {
552 ActivityGovernorProxyInterface::r#take_application_activity_lease(self, name)
553 }
554
555 pub fn r#register_suspend_blocker(
571 &self,
572 mut payload: ActivityGovernorRegisterSuspendBlockerRequest,
573 ) -> fidl::client::QueryResponseFut<
574 ActivityGovernorRegisterSuspendBlockerResult,
575 fidl::encoding::DefaultFuchsiaResourceDialect,
576 > {
577 ActivityGovernorProxyInterface::r#register_suspend_blocker(self, payload)
578 }
579}
580
581impl ActivityGovernorProxyInterface for ActivityGovernorProxy {
582 type GetPowerElementsResponseFut = fidl::client::QueryResponseFut<
583 PowerElements,
584 fidl::encoding::DefaultFuchsiaResourceDialect,
585 >;
586 fn r#get_power_elements(&self) -> Self::GetPowerElementsResponseFut {
587 fn _decode(
588 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
589 ) -> Result<PowerElements, fidl::Error> {
590 let _response = fidl::client::decode_transaction_body::<
591 fidl::encoding::FlexibleType<PowerElements>,
592 fidl::encoding::DefaultFuchsiaResourceDialect,
593 0x798003259dfb5672,
594 >(_buf?)?
595 .into_result::<ActivityGovernorMarker>("get_power_elements")?;
596 Ok(_response)
597 }
598 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PowerElements>(
599 (),
600 0x798003259dfb5672,
601 fidl::encoding::DynamicFlags::FLEXIBLE,
602 _decode,
603 )
604 }
605
606 type TakeWakeLeaseResponseFut = fidl::client::QueryResponseFut<
607 fidl::EventPair,
608 fidl::encoding::DefaultFuchsiaResourceDialect,
609 >;
610 fn r#take_wake_lease(&self, mut name: &str) -> Self::TakeWakeLeaseResponseFut {
611 fn _decode(
612 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
613 ) -> Result<fidl::EventPair, fidl::Error> {
614 let _response = fidl::client::decode_transaction_body::<
615 fidl::encoding::FlexibleType<ActivityGovernorTakeWakeLeaseResponse>,
616 fidl::encoding::DefaultFuchsiaResourceDialect,
617 0x291cfb42b2d3bf69,
618 >(_buf?)?
619 .into_result::<ActivityGovernorMarker>("take_wake_lease")?;
620 Ok(_response.token)
621 }
622 self.client.send_query_and_decode::<ActivityGovernorTakeWakeLeaseRequest, fidl::EventPair>(
623 (name,),
624 0x291cfb42b2d3bf69,
625 fidl::encoding::DynamicFlags::FLEXIBLE,
626 _decode,
627 )
628 }
629
630 type AcquireWakeLeaseResponseFut = fidl::client::QueryResponseFut<
631 ActivityGovernorAcquireWakeLeaseResult,
632 fidl::encoding::DefaultFuchsiaResourceDialect,
633 >;
634 fn r#acquire_wake_lease(&self, mut name: &str) -> Self::AcquireWakeLeaseResponseFut {
635 fn _decode(
636 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
637 ) -> Result<ActivityGovernorAcquireWakeLeaseResult, fidl::Error> {
638 let _response = fidl::client::decode_transaction_body::<
639 fidl::encoding::FlexibleResultType<
640 ActivityGovernorAcquireWakeLeaseResponse,
641 AcquireWakeLeaseError,
642 >,
643 fidl::encoding::DefaultFuchsiaResourceDialect,
644 0x2de25abd8fa7c103,
645 >(_buf?)?
646 .into_result::<ActivityGovernorMarker>("acquire_wake_lease")?;
647 Ok(_response.map(|x| x.token))
648 }
649 self.client.send_query_and_decode::<
650 ActivityGovernorAcquireWakeLeaseRequest,
651 ActivityGovernorAcquireWakeLeaseResult,
652 >(
653 (name,),
654 0x2de25abd8fa7c103,
655 fidl::encoding::DynamicFlags::FLEXIBLE,
656 _decode,
657 )
658 }
659
660 type AcquireWakeLeaseWithTokenResponseFut = fidl::client::QueryResponseFut<
661 ActivityGovernorAcquireWakeLeaseWithTokenResult,
662 fidl::encoding::DefaultFuchsiaResourceDialect,
663 >;
664 fn r#acquire_wake_lease_with_token(
665 &self,
666 mut name: &str,
667 mut server_token: fidl::EventPair,
668 ) -> Self::AcquireWakeLeaseWithTokenResponseFut {
669 fn _decode(
670 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
671 ) -> Result<ActivityGovernorAcquireWakeLeaseWithTokenResult, fidl::Error> {
672 let _response = fidl::client::decode_transaction_body::<
673 fidl::encoding::FlexibleResultType<
674 fidl::encoding::EmptyStruct,
675 AcquireWakeLeaseError,
676 >,
677 fidl::encoding::DefaultFuchsiaResourceDialect,
678 0x1cdd2ea3bee46f51,
679 >(_buf?)?
680 .into_result::<ActivityGovernorMarker>("acquire_wake_lease_with_token")?;
681 Ok(_response.map(|x| x))
682 }
683 self.client.send_query_and_decode::<
684 ActivityGovernorAcquireWakeLeaseWithTokenRequest,
685 ActivityGovernorAcquireWakeLeaseWithTokenResult,
686 >(
687 (name, server_token,),
688 0x1cdd2ea3bee46f51,
689 fidl::encoding::DynamicFlags::FLEXIBLE,
690 _decode,
691 )
692 }
693
694 type TakeApplicationActivityLeaseResponseFut = fidl::client::QueryResponseFut<
695 fidl::EventPair,
696 fidl::encoding::DefaultFuchsiaResourceDialect,
697 >;
698 fn r#take_application_activity_lease(
699 &self,
700 mut name: &str,
701 ) -> Self::TakeApplicationActivityLeaseResponseFut {
702 fn _decode(
703 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
704 ) -> Result<fidl::EventPair, fidl::Error> {
705 let _response = fidl::client::decode_transaction_body::<
706 fidl::encoding::FlexibleType<ActivityGovernorTakeApplicationActivityLeaseResponse>,
707 fidl::encoding::DefaultFuchsiaResourceDialect,
708 0x37cd5364de7ada14,
709 >(_buf?)?
710 .into_result::<ActivityGovernorMarker>("take_application_activity_lease")?;
711 Ok(_response.token)
712 }
713 self.client.send_query_and_decode::<
714 ActivityGovernorTakeApplicationActivityLeaseRequest,
715 fidl::EventPair,
716 >(
717 (name,),
718 0x37cd5364de7ada14,
719 fidl::encoding::DynamicFlags::FLEXIBLE,
720 _decode,
721 )
722 }
723
724 type RegisterSuspendBlockerResponseFut = fidl::client::QueryResponseFut<
725 ActivityGovernorRegisterSuspendBlockerResult,
726 fidl::encoding::DefaultFuchsiaResourceDialect,
727 >;
728 fn r#register_suspend_blocker(
729 &self,
730 mut payload: ActivityGovernorRegisterSuspendBlockerRequest,
731 ) -> Self::RegisterSuspendBlockerResponseFut {
732 fn _decode(
733 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
734 ) -> Result<ActivityGovernorRegisterSuspendBlockerResult, fidl::Error> {
735 let _response = fidl::client::decode_transaction_body::<
736 fidl::encoding::FlexibleResultType<
737 ActivityGovernorRegisterSuspendBlockerResponse,
738 RegisterSuspendBlockerError,
739 >,
740 fidl::encoding::DefaultFuchsiaResourceDialect,
741 0x34ef55b180feef01,
742 >(_buf?)?
743 .into_result::<ActivityGovernorMarker>("register_suspend_blocker")?;
744 Ok(_response.map(|x| x.token))
745 }
746 self.client.send_query_and_decode::<
747 ActivityGovernorRegisterSuspendBlockerRequest,
748 ActivityGovernorRegisterSuspendBlockerResult,
749 >(
750 &mut payload,
751 0x34ef55b180feef01,
752 fidl::encoding::DynamicFlags::FLEXIBLE,
753 _decode,
754 )
755 }
756}
757
758pub struct ActivityGovernorEventStream {
759 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
760}
761
762impl std::marker::Unpin for ActivityGovernorEventStream {}
763
764impl futures::stream::FusedStream for ActivityGovernorEventStream {
765 fn is_terminated(&self) -> bool {
766 self.event_receiver.is_terminated()
767 }
768}
769
770impl futures::Stream for ActivityGovernorEventStream {
771 type Item = Result<ActivityGovernorEvent, fidl::Error>;
772
773 fn poll_next(
774 mut self: std::pin::Pin<&mut Self>,
775 cx: &mut std::task::Context<'_>,
776 ) -> std::task::Poll<Option<Self::Item>> {
777 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
778 &mut self.event_receiver,
779 cx
780 )?) {
781 Some(buf) => std::task::Poll::Ready(Some(ActivityGovernorEvent::decode(buf))),
782 None => std::task::Poll::Ready(None),
783 }
784 }
785}
786
787#[derive(Debug)]
788pub enum ActivityGovernorEvent {
789 #[non_exhaustive]
790 _UnknownEvent {
791 ordinal: u64,
793 },
794}
795
796impl ActivityGovernorEvent {
797 fn decode(
799 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
800 ) -> Result<ActivityGovernorEvent, fidl::Error> {
801 let (bytes, _handles) = buf.split_mut();
802 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
803 debug_assert_eq!(tx_header.tx_id, 0);
804 match tx_header.ordinal {
805 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
806 Ok(ActivityGovernorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
807 }
808 _ => Err(fidl::Error::UnknownOrdinal {
809 ordinal: tx_header.ordinal,
810 protocol_name:
811 <ActivityGovernorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
812 }),
813 }
814 }
815}
816
817pub struct ActivityGovernorRequestStream {
819 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
820 is_terminated: bool,
821}
822
823impl std::marker::Unpin for ActivityGovernorRequestStream {}
824
825impl futures::stream::FusedStream for ActivityGovernorRequestStream {
826 fn is_terminated(&self) -> bool {
827 self.is_terminated
828 }
829}
830
831impl fidl::endpoints::RequestStream for ActivityGovernorRequestStream {
832 type Protocol = ActivityGovernorMarker;
833 type ControlHandle = ActivityGovernorControlHandle;
834
835 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
836 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
837 }
838
839 fn control_handle(&self) -> Self::ControlHandle {
840 ActivityGovernorControlHandle { inner: self.inner.clone() }
841 }
842
843 fn into_inner(
844 self,
845 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
846 {
847 (self.inner, self.is_terminated)
848 }
849
850 fn from_inner(
851 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
852 is_terminated: bool,
853 ) -> Self {
854 Self { inner, is_terminated }
855 }
856}
857
858impl futures::Stream for ActivityGovernorRequestStream {
859 type Item = Result<ActivityGovernorRequest, fidl::Error>;
860
861 fn poll_next(
862 mut self: std::pin::Pin<&mut Self>,
863 cx: &mut std::task::Context<'_>,
864 ) -> std::task::Poll<Option<Self::Item>> {
865 let this = &mut *self;
866 if this.inner.check_shutdown(cx) {
867 this.is_terminated = true;
868 return std::task::Poll::Ready(None);
869 }
870 if this.is_terminated {
871 panic!("polled ActivityGovernorRequestStream after completion");
872 }
873 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
874 |bytes, handles| {
875 match this.inner.channel().read_etc(cx, bytes, handles) {
876 std::task::Poll::Ready(Ok(())) => {}
877 std::task::Poll::Pending => return std::task::Poll::Pending,
878 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
879 this.is_terminated = true;
880 return std::task::Poll::Ready(None);
881 }
882 std::task::Poll::Ready(Err(e)) => {
883 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
884 e.into(),
885 ))));
886 }
887 }
888
889 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
891
892 std::task::Poll::Ready(Some(match header.ordinal {
893 0x798003259dfb5672 => {
894 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
895 let mut req = fidl::new_empty!(
896 fidl::encoding::EmptyPayload,
897 fidl::encoding::DefaultFuchsiaResourceDialect
898 );
899 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
900 let control_handle =
901 ActivityGovernorControlHandle { inner: this.inner.clone() };
902 Ok(ActivityGovernorRequest::GetPowerElements {
903 responder: ActivityGovernorGetPowerElementsResponder {
904 control_handle: std::mem::ManuallyDrop::new(control_handle),
905 tx_id: header.tx_id,
906 },
907 })
908 }
909 0x291cfb42b2d3bf69 => {
910 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
911 let mut req = fidl::new_empty!(
912 ActivityGovernorTakeWakeLeaseRequest,
913 fidl::encoding::DefaultFuchsiaResourceDialect
914 );
915 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorTakeWakeLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
916 let control_handle =
917 ActivityGovernorControlHandle { inner: this.inner.clone() };
918 Ok(ActivityGovernorRequest::TakeWakeLease {
919 name: req.name,
920
921 responder: ActivityGovernorTakeWakeLeaseResponder {
922 control_handle: std::mem::ManuallyDrop::new(control_handle),
923 tx_id: header.tx_id,
924 },
925 })
926 }
927 0x2de25abd8fa7c103 => {
928 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
929 let mut req = fidl::new_empty!(
930 ActivityGovernorAcquireWakeLeaseRequest,
931 fidl::encoding::DefaultFuchsiaResourceDialect
932 );
933 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorAcquireWakeLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
934 let control_handle =
935 ActivityGovernorControlHandle { inner: this.inner.clone() };
936 Ok(ActivityGovernorRequest::AcquireWakeLease {
937 name: req.name,
938
939 responder: ActivityGovernorAcquireWakeLeaseResponder {
940 control_handle: std::mem::ManuallyDrop::new(control_handle),
941 tx_id: header.tx_id,
942 },
943 })
944 }
945 0x1cdd2ea3bee46f51 => {
946 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
947 let mut req = fidl::new_empty!(
948 ActivityGovernorAcquireWakeLeaseWithTokenRequest,
949 fidl::encoding::DefaultFuchsiaResourceDialect
950 );
951 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorAcquireWakeLeaseWithTokenRequest>(&header, _body_bytes, handles, &mut req)?;
952 let control_handle =
953 ActivityGovernorControlHandle { inner: this.inner.clone() };
954 Ok(ActivityGovernorRequest::AcquireWakeLeaseWithToken {
955 name: req.name,
956 server_token: req.server_token,
957
958 responder: ActivityGovernorAcquireWakeLeaseWithTokenResponder {
959 control_handle: std::mem::ManuallyDrop::new(control_handle),
960 tx_id: header.tx_id,
961 },
962 })
963 }
964 0x37cd5364de7ada14 => {
965 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
966 let mut req = fidl::new_empty!(
967 ActivityGovernorTakeApplicationActivityLeaseRequest,
968 fidl::encoding::DefaultFuchsiaResourceDialect
969 );
970 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorTakeApplicationActivityLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
971 let control_handle =
972 ActivityGovernorControlHandle { inner: this.inner.clone() };
973 Ok(ActivityGovernorRequest::TakeApplicationActivityLease {
974 name: req.name,
975
976 responder: ActivityGovernorTakeApplicationActivityLeaseResponder {
977 control_handle: std::mem::ManuallyDrop::new(control_handle),
978 tx_id: header.tx_id,
979 },
980 })
981 }
982 0x34ef55b180feef01 => {
983 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
984 let mut req = fidl::new_empty!(
985 ActivityGovernorRegisterSuspendBlockerRequest,
986 fidl::encoding::DefaultFuchsiaResourceDialect
987 );
988 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorRegisterSuspendBlockerRequest>(&header, _body_bytes, handles, &mut req)?;
989 let control_handle =
990 ActivityGovernorControlHandle { inner: this.inner.clone() };
991 Ok(ActivityGovernorRequest::RegisterSuspendBlocker {
992 payload: req,
993 responder: ActivityGovernorRegisterSuspendBlockerResponder {
994 control_handle: std::mem::ManuallyDrop::new(control_handle),
995 tx_id: header.tx_id,
996 },
997 })
998 }
999 _ if header.tx_id == 0
1000 && header
1001 .dynamic_flags()
1002 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1003 {
1004 Ok(ActivityGovernorRequest::_UnknownMethod {
1005 ordinal: header.ordinal,
1006 control_handle: ActivityGovernorControlHandle {
1007 inner: this.inner.clone(),
1008 },
1009 method_type: fidl::MethodType::OneWay,
1010 })
1011 }
1012 _ if header
1013 .dynamic_flags()
1014 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1015 {
1016 this.inner.send_framework_err(
1017 fidl::encoding::FrameworkErr::UnknownMethod,
1018 header.tx_id,
1019 header.ordinal,
1020 header.dynamic_flags(),
1021 (bytes, handles),
1022 )?;
1023 Ok(ActivityGovernorRequest::_UnknownMethod {
1024 ordinal: header.ordinal,
1025 control_handle: ActivityGovernorControlHandle {
1026 inner: this.inner.clone(),
1027 },
1028 method_type: fidl::MethodType::TwoWay,
1029 })
1030 }
1031 _ => Err(fidl::Error::UnknownOrdinal {
1032 ordinal: header.ordinal,
1033 protocol_name:
1034 <ActivityGovernorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1035 }),
1036 }))
1037 },
1038 )
1039 }
1040}
1041
1042#[derive(Debug)]
1051pub enum ActivityGovernorRequest {
1052 GetPowerElements { responder: ActivityGovernorGetPowerElementsResponder },
1059 TakeWakeLease { name: String, responder: ActivityGovernorTakeWakeLeaseResponder },
1068 AcquireWakeLease { name: String, responder: ActivityGovernorAcquireWakeLeaseResponder },
1073 AcquireWakeLeaseWithToken {
1083 name: String,
1084 server_token: fidl::EventPair,
1085 responder: ActivityGovernorAcquireWakeLeaseWithTokenResponder,
1086 },
1087 TakeApplicationActivityLease {
1097 name: String,
1098 responder: ActivityGovernorTakeApplicationActivityLeaseResponder,
1099 },
1100 RegisterSuspendBlocker {
1116 payload: ActivityGovernorRegisterSuspendBlockerRequest,
1117 responder: ActivityGovernorRegisterSuspendBlockerResponder,
1118 },
1119 #[non_exhaustive]
1121 _UnknownMethod {
1122 ordinal: u64,
1124 control_handle: ActivityGovernorControlHandle,
1125 method_type: fidl::MethodType,
1126 },
1127}
1128
1129impl ActivityGovernorRequest {
1130 #[allow(irrefutable_let_patterns)]
1131 pub fn into_get_power_elements(self) -> Option<(ActivityGovernorGetPowerElementsResponder)> {
1132 if let ActivityGovernorRequest::GetPowerElements { responder } = self {
1133 Some((responder))
1134 } else {
1135 None
1136 }
1137 }
1138
1139 #[allow(irrefutable_let_patterns)]
1140 pub fn into_take_wake_lease(self) -> Option<(String, ActivityGovernorTakeWakeLeaseResponder)> {
1141 if let ActivityGovernorRequest::TakeWakeLease { name, responder } = self {
1142 Some((name, responder))
1143 } else {
1144 None
1145 }
1146 }
1147
1148 #[allow(irrefutable_let_patterns)]
1149 pub fn into_acquire_wake_lease(
1150 self,
1151 ) -> Option<(String, ActivityGovernorAcquireWakeLeaseResponder)> {
1152 if let ActivityGovernorRequest::AcquireWakeLease { name, responder } = self {
1153 Some((name, responder))
1154 } else {
1155 None
1156 }
1157 }
1158
1159 #[allow(irrefutable_let_patterns)]
1160 pub fn into_acquire_wake_lease_with_token(
1161 self,
1162 ) -> Option<(String, fidl::EventPair, ActivityGovernorAcquireWakeLeaseWithTokenResponder)> {
1163 if let ActivityGovernorRequest::AcquireWakeLeaseWithToken {
1164 name,
1165 server_token,
1166 responder,
1167 } = self
1168 {
1169 Some((name, server_token, responder))
1170 } else {
1171 None
1172 }
1173 }
1174
1175 #[allow(irrefutable_let_patterns)]
1176 pub fn into_take_application_activity_lease(
1177 self,
1178 ) -> Option<(String, ActivityGovernorTakeApplicationActivityLeaseResponder)> {
1179 if let ActivityGovernorRequest::TakeApplicationActivityLease { name, responder } = self {
1180 Some((name, responder))
1181 } else {
1182 None
1183 }
1184 }
1185
1186 #[allow(irrefutable_let_patterns)]
1187 pub fn into_register_suspend_blocker(
1188 self,
1189 ) -> Option<(
1190 ActivityGovernorRegisterSuspendBlockerRequest,
1191 ActivityGovernorRegisterSuspendBlockerResponder,
1192 )> {
1193 if let ActivityGovernorRequest::RegisterSuspendBlocker { payload, responder } = self {
1194 Some((payload, responder))
1195 } else {
1196 None
1197 }
1198 }
1199
1200 pub fn method_name(&self) -> &'static str {
1202 match *self {
1203 ActivityGovernorRequest::GetPowerElements { .. } => "get_power_elements",
1204 ActivityGovernorRequest::TakeWakeLease { .. } => "take_wake_lease",
1205 ActivityGovernorRequest::AcquireWakeLease { .. } => "acquire_wake_lease",
1206 ActivityGovernorRequest::AcquireWakeLeaseWithToken { .. } => {
1207 "acquire_wake_lease_with_token"
1208 }
1209 ActivityGovernorRequest::TakeApplicationActivityLease { .. } => {
1210 "take_application_activity_lease"
1211 }
1212 ActivityGovernorRequest::RegisterSuspendBlocker { .. } => "register_suspend_blocker",
1213 ActivityGovernorRequest::_UnknownMethod {
1214 method_type: fidl::MethodType::OneWay,
1215 ..
1216 } => "unknown one-way method",
1217 ActivityGovernorRequest::_UnknownMethod {
1218 method_type: fidl::MethodType::TwoWay,
1219 ..
1220 } => "unknown two-way method",
1221 }
1222 }
1223}
1224
1225#[derive(Debug, Clone)]
1226pub struct ActivityGovernorControlHandle {
1227 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1228}
1229
1230impl fidl::endpoints::ControlHandle for ActivityGovernorControlHandle {
1231 fn shutdown(&self) {
1232 self.inner.shutdown()
1233 }
1234
1235 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1236 self.inner.shutdown_with_epitaph(status)
1237 }
1238
1239 fn is_closed(&self) -> bool {
1240 self.inner.channel().is_closed()
1241 }
1242 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1243 self.inner.channel().on_closed()
1244 }
1245
1246 #[cfg(target_os = "fuchsia")]
1247 fn signal_peer(
1248 &self,
1249 clear_mask: zx::Signals,
1250 set_mask: zx::Signals,
1251 ) -> Result<(), zx_status::Status> {
1252 use fidl::Peered;
1253 self.inner.channel().signal_peer(clear_mask, set_mask)
1254 }
1255}
1256
1257impl ActivityGovernorControlHandle {}
1258
1259#[must_use = "FIDL methods require a response to be sent"]
1260#[derive(Debug)]
1261pub struct ActivityGovernorGetPowerElementsResponder {
1262 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1263 tx_id: u32,
1264}
1265
1266impl std::ops::Drop for ActivityGovernorGetPowerElementsResponder {
1270 fn drop(&mut self) {
1271 self.control_handle.shutdown();
1272 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1274 }
1275}
1276
1277impl fidl::endpoints::Responder for ActivityGovernorGetPowerElementsResponder {
1278 type ControlHandle = ActivityGovernorControlHandle;
1279
1280 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1281 &self.control_handle
1282 }
1283
1284 fn drop_without_shutdown(mut self) {
1285 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1287 std::mem::forget(self);
1289 }
1290}
1291
1292impl ActivityGovernorGetPowerElementsResponder {
1293 pub fn send(self, mut payload: PowerElements) -> Result<(), fidl::Error> {
1297 let _result = self.send_raw(payload);
1298 if _result.is_err() {
1299 self.control_handle.shutdown();
1300 }
1301 self.drop_without_shutdown();
1302 _result
1303 }
1304
1305 pub fn send_no_shutdown_on_err(self, mut payload: PowerElements) -> Result<(), fidl::Error> {
1307 let _result = self.send_raw(payload);
1308 self.drop_without_shutdown();
1309 _result
1310 }
1311
1312 fn send_raw(&self, mut payload: PowerElements) -> Result<(), fidl::Error> {
1313 self.control_handle.inner.send::<fidl::encoding::FlexibleType<PowerElements>>(
1314 fidl::encoding::Flexible::new(&mut payload),
1315 self.tx_id,
1316 0x798003259dfb5672,
1317 fidl::encoding::DynamicFlags::FLEXIBLE,
1318 )
1319 }
1320}
1321
1322#[must_use = "FIDL methods require a response to be sent"]
1323#[derive(Debug)]
1324pub struct ActivityGovernorTakeWakeLeaseResponder {
1325 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1326 tx_id: u32,
1327}
1328
1329impl std::ops::Drop for ActivityGovernorTakeWakeLeaseResponder {
1333 fn drop(&mut self) {
1334 self.control_handle.shutdown();
1335 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1337 }
1338}
1339
1340impl fidl::endpoints::Responder for ActivityGovernorTakeWakeLeaseResponder {
1341 type ControlHandle = ActivityGovernorControlHandle;
1342
1343 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1344 &self.control_handle
1345 }
1346
1347 fn drop_without_shutdown(mut self) {
1348 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1350 std::mem::forget(self);
1352 }
1353}
1354
1355impl ActivityGovernorTakeWakeLeaseResponder {
1356 pub fn send(self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1360 let _result = self.send_raw(token);
1361 if _result.is_err() {
1362 self.control_handle.shutdown();
1363 }
1364 self.drop_without_shutdown();
1365 _result
1366 }
1367
1368 pub fn send_no_shutdown_on_err(self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1370 let _result = self.send_raw(token);
1371 self.drop_without_shutdown();
1372 _result
1373 }
1374
1375 fn send_raw(&self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1376 self.control_handle
1377 .inner
1378 .send::<fidl::encoding::FlexibleType<ActivityGovernorTakeWakeLeaseResponse>>(
1379 fidl::encoding::Flexible::new((token,)),
1380 self.tx_id,
1381 0x291cfb42b2d3bf69,
1382 fidl::encoding::DynamicFlags::FLEXIBLE,
1383 )
1384 }
1385}
1386
1387#[must_use = "FIDL methods require a response to be sent"]
1388#[derive(Debug)]
1389pub struct ActivityGovernorAcquireWakeLeaseResponder {
1390 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1391 tx_id: u32,
1392}
1393
1394impl std::ops::Drop for ActivityGovernorAcquireWakeLeaseResponder {
1398 fn drop(&mut self) {
1399 self.control_handle.shutdown();
1400 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1402 }
1403}
1404
1405impl fidl::endpoints::Responder for ActivityGovernorAcquireWakeLeaseResponder {
1406 type ControlHandle = ActivityGovernorControlHandle;
1407
1408 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1409 &self.control_handle
1410 }
1411
1412 fn drop_without_shutdown(mut self) {
1413 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1415 std::mem::forget(self);
1417 }
1418}
1419
1420impl ActivityGovernorAcquireWakeLeaseResponder {
1421 pub fn send(
1425 self,
1426 mut result: Result<fidl::EventPair, AcquireWakeLeaseError>,
1427 ) -> Result<(), fidl::Error> {
1428 let _result = self.send_raw(result);
1429 if _result.is_err() {
1430 self.control_handle.shutdown();
1431 }
1432 self.drop_without_shutdown();
1433 _result
1434 }
1435
1436 pub fn send_no_shutdown_on_err(
1438 self,
1439 mut result: Result<fidl::EventPair, AcquireWakeLeaseError>,
1440 ) -> Result<(), fidl::Error> {
1441 let _result = self.send_raw(result);
1442 self.drop_without_shutdown();
1443 _result
1444 }
1445
1446 fn send_raw(
1447 &self,
1448 mut result: Result<fidl::EventPair, AcquireWakeLeaseError>,
1449 ) -> Result<(), fidl::Error> {
1450 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1451 ActivityGovernorAcquireWakeLeaseResponse,
1452 AcquireWakeLeaseError,
1453 >>(
1454 fidl::encoding::FlexibleResult::new(result.map(|token| (token,))),
1455 self.tx_id,
1456 0x2de25abd8fa7c103,
1457 fidl::encoding::DynamicFlags::FLEXIBLE,
1458 )
1459 }
1460}
1461
1462#[must_use = "FIDL methods require a response to be sent"]
1463#[derive(Debug)]
1464pub struct ActivityGovernorAcquireWakeLeaseWithTokenResponder {
1465 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1466 tx_id: u32,
1467}
1468
1469impl std::ops::Drop for ActivityGovernorAcquireWakeLeaseWithTokenResponder {
1473 fn drop(&mut self) {
1474 self.control_handle.shutdown();
1475 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1477 }
1478}
1479
1480impl fidl::endpoints::Responder for ActivityGovernorAcquireWakeLeaseWithTokenResponder {
1481 type ControlHandle = ActivityGovernorControlHandle;
1482
1483 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1484 &self.control_handle
1485 }
1486
1487 fn drop_without_shutdown(mut self) {
1488 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1490 std::mem::forget(self);
1492 }
1493}
1494
1495impl ActivityGovernorAcquireWakeLeaseWithTokenResponder {
1496 pub fn send(self, mut result: Result<(), AcquireWakeLeaseError>) -> Result<(), fidl::Error> {
1500 let _result = self.send_raw(result);
1501 if _result.is_err() {
1502 self.control_handle.shutdown();
1503 }
1504 self.drop_without_shutdown();
1505 _result
1506 }
1507
1508 pub fn send_no_shutdown_on_err(
1510 self,
1511 mut result: Result<(), AcquireWakeLeaseError>,
1512 ) -> Result<(), fidl::Error> {
1513 let _result = self.send_raw(result);
1514 self.drop_without_shutdown();
1515 _result
1516 }
1517
1518 fn send_raw(&self, mut result: Result<(), AcquireWakeLeaseError>) -> Result<(), fidl::Error> {
1519 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1520 fidl::encoding::EmptyStruct,
1521 AcquireWakeLeaseError,
1522 >>(
1523 fidl::encoding::FlexibleResult::new(result),
1524 self.tx_id,
1525 0x1cdd2ea3bee46f51,
1526 fidl::encoding::DynamicFlags::FLEXIBLE,
1527 )
1528 }
1529}
1530
1531#[must_use = "FIDL methods require a response to be sent"]
1532#[derive(Debug)]
1533pub struct ActivityGovernorTakeApplicationActivityLeaseResponder {
1534 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1535 tx_id: u32,
1536}
1537
1538impl std::ops::Drop for ActivityGovernorTakeApplicationActivityLeaseResponder {
1542 fn drop(&mut self) {
1543 self.control_handle.shutdown();
1544 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1546 }
1547}
1548
1549impl fidl::endpoints::Responder for ActivityGovernorTakeApplicationActivityLeaseResponder {
1550 type ControlHandle = ActivityGovernorControlHandle;
1551
1552 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1553 &self.control_handle
1554 }
1555
1556 fn drop_without_shutdown(mut self) {
1557 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1559 std::mem::forget(self);
1561 }
1562}
1563
1564impl ActivityGovernorTakeApplicationActivityLeaseResponder {
1565 pub fn send(self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1569 let _result = self.send_raw(token);
1570 if _result.is_err() {
1571 self.control_handle.shutdown();
1572 }
1573 self.drop_without_shutdown();
1574 _result
1575 }
1576
1577 pub fn send_no_shutdown_on_err(self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1579 let _result = self.send_raw(token);
1580 self.drop_without_shutdown();
1581 _result
1582 }
1583
1584 fn send_raw(&self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1585 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
1586 ActivityGovernorTakeApplicationActivityLeaseResponse,
1587 >>(
1588 fidl::encoding::Flexible::new((token,)),
1589 self.tx_id,
1590 0x37cd5364de7ada14,
1591 fidl::encoding::DynamicFlags::FLEXIBLE,
1592 )
1593 }
1594}
1595
1596#[must_use = "FIDL methods require a response to be sent"]
1597#[derive(Debug)]
1598pub struct ActivityGovernorRegisterSuspendBlockerResponder {
1599 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1600 tx_id: u32,
1601}
1602
1603impl std::ops::Drop for ActivityGovernorRegisterSuspendBlockerResponder {
1607 fn drop(&mut self) {
1608 self.control_handle.shutdown();
1609 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1611 }
1612}
1613
1614impl fidl::endpoints::Responder for ActivityGovernorRegisterSuspendBlockerResponder {
1615 type ControlHandle = ActivityGovernorControlHandle;
1616
1617 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1618 &self.control_handle
1619 }
1620
1621 fn drop_without_shutdown(mut self) {
1622 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1624 std::mem::forget(self);
1626 }
1627}
1628
1629impl ActivityGovernorRegisterSuspendBlockerResponder {
1630 pub fn send(
1634 self,
1635 mut result: Result<fidl::EventPair, RegisterSuspendBlockerError>,
1636 ) -> Result<(), fidl::Error> {
1637 let _result = self.send_raw(result);
1638 if _result.is_err() {
1639 self.control_handle.shutdown();
1640 }
1641 self.drop_without_shutdown();
1642 _result
1643 }
1644
1645 pub fn send_no_shutdown_on_err(
1647 self,
1648 mut result: Result<fidl::EventPair, RegisterSuspendBlockerError>,
1649 ) -> Result<(), fidl::Error> {
1650 let _result = self.send_raw(result);
1651 self.drop_without_shutdown();
1652 _result
1653 }
1654
1655 fn send_raw(
1656 &self,
1657 mut result: Result<fidl::EventPair, RegisterSuspendBlockerError>,
1658 ) -> Result<(), fidl::Error> {
1659 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1660 ActivityGovernorRegisterSuspendBlockerResponse,
1661 RegisterSuspendBlockerError,
1662 >>(
1663 fidl::encoding::FlexibleResult::new(result.map(|token| (token,))),
1664 self.tx_id,
1665 0x34ef55b180feef01,
1666 fidl::encoding::DynamicFlags::FLEXIBLE,
1667 )
1668 }
1669}
1670
1671#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1672pub struct BootControlMarker;
1673
1674impl fidl::endpoints::ProtocolMarker for BootControlMarker {
1675 type Proxy = BootControlProxy;
1676 type RequestStream = BootControlRequestStream;
1677 #[cfg(target_os = "fuchsia")]
1678 type SynchronousProxy = BootControlSynchronousProxy;
1679
1680 const DEBUG_NAME: &'static str = "fuchsia.power.system.BootControl";
1681}
1682impl fidl::endpoints::DiscoverableProtocolMarker for BootControlMarker {}
1683
1684pub trait BootControlProxyInterface: Send + Sync {
1685 type SetBootCompleteResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1686 fn r#set_boot_complete(&self) -> Self::SetBootCompleteResponseFut;
1687}
1688#[derive(Debug)]
1689#[cfg(target_os = "fuchsia")]
1690pub struct BootControlSynchronousProxy {
1691 client: fidl::client::sync::Client,
1692}
1693
1694#[cfg(target_os = "fuchsia")]
1695impl fidl::endpoints::SynchronousProxy for BootControlSynchronousProxy {
1696 type Proxy = BootControlProxy;
1697 type Protocol = BootControlMarker;
1698
1699 fn from_channel(inner: fidl::Channel) -> Self {
1700 Self::new(inner)
1701 }
1702
1703 fn into_channel(self) -> fidl::Channel {
1704 self.client.into_channel()
1705 }
1706
1707 fn as_channel(&self) -> &fidl::Channel {
1708 self.client.as_channel()
1709 }
1710}
1711
1712#[cfg(target_os = "fuchsia")]
1713impl BootControlSynchronousProxy {
1714 pub fn new(channel: fidl::Channel) -> Self {
1715 Self { client: fidl::client::sync::Client::new(channel) }
1716 }
1717
1718 pub fn into_channel(self) -> fidl::Channel {
1719 self.client.into_channel()
1720 }
1721
1722 pub fn wait_for_event(
1725 &self,
1726 deadline: zx::MonotonicInstant,
1727 ) -> Result<BootControlEvent, fidl::Error> {
1728 BootControlEvent::decode(self.client.wait_for_event::<BootControlMarker>(deadline)?)
1729 }
1730
1731 pub fn r#set_boot_complete(
1734 &self,
1735 ___deadline: zx::MonotonicInstant,
1736 ) -> Result<(), fidl::Error> {
1737 let _response = self.client.send_query::<
1738 fidl::encoding::EmptyPayload,
1739 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1740 BootControlMarker,
1741 >(
1742 (),
1743 0x3c9b9f24ad3ca2b5,
1744 fidl::encoding::DynamicFlags::FLEXIBLE,
1745 ___deadline,
1746 )?
1747 .into_result::<BootControlMarker>("set_boot_complete")?;
1748 Ok(_response)
1749 }
1750}
1751
1752#[cfg(target_os = "fuchsia")]
1753impl From<BootControlSynchronousProxy> for zx::NullableHandle {
1754 fn from(value: BootControlSynchronousProxy) -> Self {
1755 value.into_channel().into()
1756 }
1757}
1758
1759#[cfg(target_os = "fuchsia")]
1760impl From<fidl::Channel> for BootControlSynchronousProxy {
1761 fn from(value: fidl::Channel) -> Self {
1762 Self::new(value)
1763 }
1764}
1765
1766#[cfg(target_os = "fuchsia")]
1767impl fidl::endpoints::FromClient for BootControlSynchronousProxy {
1768 type Protocol = BootControlMarker;
1769
1770 fn from_client(value: fidl::endpoints::ClientEnd<BootControlMarker>) -> Self {
1771 Self::new(value.into_channel())
1772 }
1773}
1774
1775#[derive(Debug, Clone)]
1776pub struct BootControlProxy {
1777 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1778}
1779
1780impl fidl::endpoints::Proxy for BootControlProxy {
1781 type Protocol = BootControlMarker;
1782
1783 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1784 Self::new(inner)
1785 }
1786
1787 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1788 self.client.into_channel().map_err(|client| Self { client })
1789 }
1790
1791 fn as_channel(&self) -> &::fidl::AsyncChannel {
1792 self.client.as_channel()
1793 }
1794}
1795
1796impl BootControlProxy {
1797 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1799 let protocol_name = <BootControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1800 Self { client: fidl::client::Client::new(channel, protocol_name) }
1801 }
1802
1803 pub fn take_event_stream(&self) -> BootControlEventStream {
1809 BootControlEventStream { event_receiver: self.client.take_event_receiver() }
1810 }
1811
1812 pub fn r#set_boot_complete(
1815 &self,
1816 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1817 BootControlProxyInterface::r#set_boot_complete(self)
1818 }
1819}
1820
1821impl BootControlProxyInterface for BootControlProxy {
1822 type SetBootCompleteResponseFut =
1823 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1824 fn r#set_boot_complete(&self) -> Self::SetBootCompleteResponseFut {
1825 fn _decode(
1826 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1827 ) -> Result<(), fidl::Error> {
1828 let _response = fidl::client::decode_transaction_body::<
1829 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1830 fidl::encoding::DefaultFuchsiaResourceDialect,
1831 0x3c9b9f24ad3ca2b5,
1832 >(_buf?)?
1833 .into_result::<BootControlMarker>("set_boot_complete")?;
1834 Ok(_response)
1835 }
1836 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1837 (),
1838 0x3c9b9f24ad3ca2b5,
1839 fidl::encoding::DynamicFlags::FLEXIBLE,
1840 _decode,
1841 )
1842 }
1843}
1844
1845pub struct BootControlEventStream {
1846 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1847}
1848
1849impl std::marker::Unpin for BootControlEventStream {}
1850
1851impl futures::stream::FusedStream for BootControlEventStream {
1852 fn is_terminated(&self) -> bool {
1853 self.event_receiver.is_terminated()
1854 }
1855}
1856
1857impl futures::Stream for BootControlEventStream {
1858 type Item = Result<BootControlEvent, fidl::Error>;
1859
1860 fn poll_next(
1861 mut self: std::pin::Pin<&mut Self>,
1862 cx: &mut std::task::Context<'_>,
1863 ) -> std::task::Poll<Option<Self::Item>> {
1864 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1865 &mut self.event_receiver,
1866 cx
1867 )?) {
1868 Some(buf) => std::task::Poll::Ready(Some(BootControlEvent::decode(buf))),
1869 None => std::task::Poll::Ready(None),
1870 }
1871 }
1872}
1873
1874#[derive(Debug)]
1875pub enum BootControlEvent {
1876 #[non_exhaustive]
1877 _UnknownEvent {
1878 ordinal: u64,
1880 },
1881}
1882
1883impl BootControlEvent {
1884 fn decode(
1886 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1887 ) -> Result<BootControlEvent, fidl::Error> {
1888 let (bytes, _handles) = buf.split_mut();
1889 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1890 debug_assert_eq!(tx_header.tx_id, 0);
1891 match tx_header.ordinal {
1892 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1893 Ok(BootControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1894 }
1895 _ => Err(fidl::Error::UnknownOrdinal {
1896 ordinal: tx_header.ordinal,
1897 protocol_name: <BootControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1898 }),
1899 }
1900 }
1901}
1902
1903pub struct BootControlRequestStream {
1905 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1906 is_terminated: bool,
1907}
1908
1909impl std::marker::Unpin for BootControlRequestStream {}
1910
1911impl futures::stream::FusedStream for BootControlRequestStream {
1912 fn is_terminated(&self) -> bool {
1913 self.is_terminated
1914 }
1915}
1916
1917impl fidl::endpoints::RequestStream for BootControlRequestStream {
1918 type Protocol = BootControlMarker;
1919 type ControlHandle = BootControlControlHandle;
1920
1921 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1922 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1923 }
1924
1925 fn control_handle(&self) -> Self::ControlHandle {
1926 BootControlControlHandle { inner: self.inner.clone() }
1927 }
1928
1929 fn into_inner(
1930 self,
1931 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1932 {
1933 (self.inner, self.is_terminated)
1934 }
1935
1936 fn from_inner(
1937 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1938 is_terminated: bool,
1939 ) -> Self {
1940 Self { inner, is_terminated }
1941 }
1942}
1943
1944impl futures::Stream for BootControlRequestStream {
1945 type Item = Result<BootControlRequest, fidl::Error>;
1946
1947 fn poll_next(
1948 mut self: std::pin::Pin<&mut Self>,
1949 cx: &mut std::task::Context<'_>,
1950 ) -> std::task::Poll<Option<Self::Item>> {
1951 let this = &mut *self;
1952 if this.inner.check_shutdown(cx) {
1953 this.is_terminated = true;
1954 return std::task::Poll::Ready(None);
1955 }
1956 if this.is_terminated {
1957 panic!("polled BootControlRequestStream after completion");
1958 }
1959 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1960 |bytes, handles| {
1961 match this.inner.channel().read_etc(cx, bytes, handles) {
1962 std::task::Poll::Ready(Ok(())) => {}
1963 std::task::Poll::Pending => return std::task::Poll::Pending,
1964 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1965 this.is_terminated = true;
1966 return std::task::Poll::Ready(None);
1967 }
1968 std::task::Poll::Ready(Err(e)) => {
1969 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1970 e.into(),
1971 ))));
1972 }
1973 }
1974
1975 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1977
1978 std::task::Poll::Ready(Some(match header.ordinal {
1979 0x3c9b9f24ad3ca2b5 => {
1980 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1981 let mut req = fidl::new_empty!(
1982 fidl::encoding::EmptyPayload,
1983 fidl::encoding::DefaultFuchsiaResourceDialect
1984 );
1985 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1986 let control_handle = BootControlControlHandle { inner: this.inner.clone() };
1987 Ok(BootControlRequest::SetBootComplete {
1988 responder: BootControlSetBootCompleteResponder {
1989 control_handle: std::mem::ManuallyDrop::new(control_handle),
1990 tx_id: header.tx_id,
1991 },
1992 })
1993 }
1994 _ if header.tx_id == 0
1995 && header
1996 .dynamic_flags()
1997 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1998 {
1999 Ok(BootControlRequest::_UnknownMethod {
2000 ordinal: header.ordinal,
2001 control_handle: BootControlControlHandle { inner: this.inner.clone() },
2002 method_type: fidl::MethodType::OneWay,
2003 })
2004 }
2005 _ if header
2006 .dynamic_flags()
2007 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2008 {
2009 this.inner.send_framework_err(
2010 fidl::encoding::FrameworkErr::UnknownMethod,
2011 header.tx_id,
2012 header.ordinal,
2013 header.dynamic_flags(),
2014 (bytes, handles),
2015 )?;
2016 Ok(BootControlRequest::_UnknownMethod {
2017 ordinal: header.ordinal,
2018 control_handle: BootControlControlHandle { inner: this.inner.clone() },
2019 method_type: fidl::MethodType::TwoWay,
2020 })
2021 }
2022 _ => Err(fidl::Error::UnknownOrdinal {
2023 ordinal: header.ordinal,
2024 protocol_name:
2025 <BootControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2026 }),
2027 }))
2028 },
2029 )
2030 }
2031}
2032
2033#[derive(Debug)]
2035pub enum BootControlRequest {
2036 SetBootComplete { responder: BootControlSetBootCompleteResponder },
2039 #[non_exhaustive]
2041 _UnknownMethod {
2042 ordinal: u64,
2044 control_handle: BootControlControlHandle,
2045 method_type: fidl::MethodType,
2046 },
2047}
2048
2049impl BootControlRequest {
2050 #[allow(irrefutable_let_patterns)]
2051 pub fn into_set_boot_complete(self) -> Option<(BootControlSetBootCompleteResponder)> {
2052 if let BootControlRequest::SetBootComplete { responder } = self {
2053 Some((responder))
2054 } else {
2055 None
2056 }
2057 }
2058
2059 pub fn method_name(&self) -> &'static str {
2061 match *self {
2062 BootControlRequest::SetBootComplete { .. } => "set_boot_complete",
2063 BootControlRequest::_UnknownMethod {
2064 method_type: fidl::MethodType::OneWay, ..
2065 } => "unknown one-way method",
2066 BootControlRequest::_UnknownMethod {
2067 method_type: fidl::MethodType::TwoWay, ..
2068 } => "unknown two-way method",
2069 }
2070 }
2071}
2072
2073#[derive(Debug, Clone)]
2074pub struct BootControlControlHandle {
2075 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2076}
2077
2078impl fidl::endpoints::ControlHandle for BootControlControlHandle {
2079 fn shutdown(&self) {
2080 self.inner.shutdown()
2081 }
2082
2083 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2084 self.inner.shutdown_with_epitaph(status)
2085 }
2086
2087 fn is_closed(&self) -> bool {
2088 self.inner.channel().is_closed()
2089 }
2090 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2091 self.inner.channel().on_closed()
2092 }
2093
2094 #[cfg(target_os = "fuchsia")]
2095 fn signal_peer(
2096 &self,
2097 clear_mask: zx::Signals,
2098 set_mask: zx::Signals,
2099 ) -> Result<(), zx_status::Status> {
2100 use fidl::Peered;
2101 self.inner.channel().signal_peer(clear_mask, set_mask)
2102 }
2103}
2104
2105impl BootControlControlHandle {}
2106
2107#[must_use = "FIDL methods require a response to be sent"]
2108#[derive(Debug)]
2109pub struct BootControlSetBootCompleteResponder {
2110 control_handle: std::mem::ManuallyDrop<BootControlControlHandle>,
2111 tx_id: u32,
2112}
2113
2114impl std::ops::Drop for BootControlSetBootCompleteResponder {
2118 fn drop(&mut self) {
2119 self.control_handle.shutdown();
2120 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2122 }
2123}
2124
2125impl fidl::endpoints::Responder for BootControlSetBootCompleteResponder {
2126 type ControlHandle = BootControlControlHandle;
2127
2128 fn control_handle(&self) -> &BootControlControlHandle {
2129 &self.control_handle
2130 }
2131
2132 fn drop_without_shutdown(mut self) {
2133 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2135 std::mem::forget(self);
2137 }
2138}
2139
2140impl BootControlSetBootCompleteResponder {
2141 pub fn send(self) -> Result<(), fidl::Error> {
2145 let _result = self.send_raw();
2146 if _result.is_err() {
2147 self.control_handle.shutdown();
2148 }
2149 self.drop_without_shutdown();
2150 _result
2151 }
2152
2153 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2155 let _result = self.send_raw();
2156 self.drop_without_shutdown();
2157 _result
2158 }
2159
2160 fn send_raw(&self) -> Result<(), fidl::Error> {
2161 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2162 fidl::encoding::Flexible::new(()),
2163 self.tx_id,
2164 0x3c9b9f24ad3ca2b5,
2165 fidl::encoding::DynamicFlags::FLEXIBLE,
2166 )
2167 }
2168}
2169
2170#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2171pub struct CpuElementManagerMarker;
2172
2173impl fidl::endpoints::ProtocolMarker for CpuElementManagerMarker {
2174 type Proxy = CpuElementManagerProxy;
2175 type RequestStream = CpuElementManagerRequestStream;
2176 #[cfg(target_os = "fuchsia")]
2177 type SynchronousProxy = CpuElementManagerSynchronousProxy;
2178
2179 const DEBUG_NAME: &'static str = "fuchsia.power.system.CpuElementManager";
2180}
2181impl fidl::endpoints::DiscoverableProtocolMarker for CpuElementManagerMarker {}
2182pub type CpuElementManagerAddExecutionStateDependencyResult =
2183 Result<(), AddExecutionStateDependencyError>;
2184
2185pub trait CpuElementManagerProxyInterface: Send + Sync {
2186 type GetCpuDependencyTokenResponseFut: std::future::Future<Output = Result<Cpu, fidl::Error>>
2187 + Send;
2188 fn r#get_cpu_dependency_token(&self) -> Self::GetCpuDependencyTokenResponseFut;
2189 type AddExecutionStateDependencyResponseFut: std::future::Future<
2190 Output = Result<CpuElementManagerAddExecutionStateDependencyResult, fidl::Error>,
2191 > + Send;
2192 fn r#add_execution_state_dependency(
2193 &self,
2194 payload: CpuElementManagerAddExecutionStateDependencyRequest,
2195 ) -> Self::AddExecutionStateDependencyResponseFut;
2196}
2197#[derive(Debug)]
2198#[cfg(target_os = "fuchsia")]
2199pub struct CpuElementManagerSynchronousProxy {
2200 client: fidl::client::sync::Client,
2201}
2202
2203#[cfg(target_os = "fuchsia")]
2204impl fidl::endpoints::SynchronousProxy for CpuElementManagerSynchronousProxy {
2205 type Proxy = CpuElementManagerProxy;
2206 type Protocol = CpuElementManagerMarker;
2207
2208 fn from_channel(inner: fidl::Channel) -> Self {
2209 Self::new(inner)
2210 }
2211
2212 fn into_channel(self) -> fidl::Channel {
2213 self.client.into_channel()
2214 }
2215
2216 fn as_channel(&self) -> &fidl::Channel {
2217 self.client.as_channel()
2218 }
2219}
2220
2221#[cfg(target_os = "fuchsia")]
2222impl CpuElementManagerSynchronousProxy {
2223 pub fn new(channel: fidl::Channel) -> Self {
2224 Self { client: fidl::client::sync::Client::new(channel) }
2225 }
2226
2227 pub fn into_channel(self) -> fidl::Channel {
2228 self.client.into_channel()
2229 }
2230
2231 pub fn wait_for_event(
2234 &self,
2235 deadline: zx::MonotonicInstant,
2236 ) -> Result<CpuElementManagerEvent, fidl::Error> {
2237 CpuElementManagerEvent::decode(
2238 self.client.wait_for_event::<CpuElementManagerMarker>(deadline)?,
2239 )
2240 }
2241
2242 pub fn r#get_cpu_dependency_token(
2244 &self,
2245 ___deadline: zx::MonotonicInstant,
2246 ) -> Result<Cpu, fidl::Error> {
2247 let _response = self.client.send_query::<
2248 fidl::encoding::EmptyPayload,
2249 fidl::encoding::FlexibleType<Cpu>,
2250 CpuElementManagerMarker,
2251 >(
2252 (),
2253 0x2c43645ed70344ba,
2254 fidl::encoding::DynamicFlags::FLEXIBLE,
2255 ___deadline,
2256 )?
2257 .into_result::<CpuElementManagerMarker>("get_cpu_dependency_token")?;
2258 Ok(_response)
2259 }
2260
2261 pub fn r#add_execution_state_dependency(
2271 &self,
2272 mut payload: CpuElementManagerAddExecutionStateDependencyRequest,
2273 ___deadline: zx::MonotonicInstant,
2274 ) -> Result<CpuElementManagerAddExecutionStateDependencyResult, fidl::Error> {
2275 let _response = self.client.send_query::<
2276 CpuElementManagerAddExecutionStateDependencyRequest,
2277 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, AddExecutionStateDependencyError>,
2278 CpuElementManagerMarker,
2279 >(
2280 &mut payload,
2281 0xdf2f5ea2af76234,
2282 fidl::encoding::DynamicFlags::FLEXIBLE,
2283 ___deadline,
2284 )?
2285 .into_result::<CpuElementManagerMarker>("add_execution_state_dependency")?;
2286 Ok(_response.map(|x| x))
2287 }
2288}
2289
2290#[cfg(target_os = "fuchsia")]
2291impl From<CpuElementManagerSynchronousProxy> for zx::NullableHandle {
2292 fn from(value: CpuElementManagerSynchronousProxy) -> Self {
2293 value.into_channel().into()
2294 }
2295}
2296
2297#[cfg(target_os = "fuchsia")]
2298impl From<fidl::Channel> for CpuElementManagerSynchronousProxy {
2299 fn from(value: fidl::Channel) -> Self {
2300 Self::new(value)
2301 }
2302}
2303
2304#[cfg(target_os = "fuchsia")]
2305impl fidl::endpoints::FromClient for CpuElementManagerSynchronousProxy {
2306 type Protocol = CpuElementManagerMarker;
2307
2308 fn from_client(value: fidl::endpoints::ClientEnd<CpuElementManagerMarker>) -> Self {
2309 Self::new(value.into_channel())
2310 }
2311}
2312
2313#[derive(Debug, Clone)]
2314pub struct CpuElementManagerProxy {
2315 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2316}
2317
2318impl fidl::endpoints::Proxy for CpuElementManagerProxy {
2319 type Protocol = CpuElementManagerMarker;
2320
2321 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2322 Self::new(inner)
2323 }
2324
2325 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2326 self.client.into_channel().map_err(|client| Self { client })
2327 }
2328
2329 fn as_channel(&self) -> &::fidl::AsyncChannel {
2330 self.client.as_channel()
2331 }
2332}
2333
2334impl CpuElementManagerProxy {
2335 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2337 let protocol_name =
2338 <CpuElementManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2339 Self { client: fidl::client::Client::new(channel, protocol_name) }
2340 }
2341
2342 pub fn take_event_stream(&self) -> CpuElementManagerEventStream {
2348 CpuElementManagerEventStream { event_receiver: self.client.take_event_receiver() }
2349 }
2350
2351 pub fn r#get_cpu_dependency_token(
2353 &self,
2354 ) -> fidl::client::QueryResponseFut<Cpu, fidl::encoding::DefaultFuchsiaResourceDialect> {
2355 CpuElementManagerProxyInterface::r#get_cpu_dependency_token(self)
2356 }
2357
2358 pub fn r#add_execution_state_dependency(
2368 &self,
2369 mut payload: CpuElementManagerAddExecutionStateDependencyRequest,
2370 ) -> fidl::client::QueryResponseFut<
2371 CpuElementManagerAddExecutionStateDependencyResult,
2372 fidl::encoding::DefaultFuchsiaResourceDialect,
2373 > {
2374 CpuElementManagerProxyInterface::r#add_execution_state_dependency(self, payload)
2375 }
2376}
2377
2378impl CpuElementManagerProxyInterface for CpuElementManagerProxy {
2379 type GetCpuDependencyTokenResponseFut =
2380 fidl::client::QueryResponseFut<Cpu, fidl::encoding::DefaultFuchsiaResourceDialect>;
2381 fn r#get_cpu_dependency_token(&self) -> Self::GetCpuDependencyTokenResponseFut {
2382 fn _decode(
2383 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2384 ) -> Result<Cpu, fidl::Error> {
2385 let _response = fidl::client::decode_transaction_body::<
2386 fidl::encoding::FlexibleType<Cpu>,
2387 fidl::encoding::DefaultFuchsiaResourceDialect,
2388 0x2c43645ed70344ba,
2389 >(_buf?)?
2390 .into_result::<CpuElementManagerMarker>("get_cpu_dependency_token")?;
2391 Ok(_response)
2392 }
2393 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Cpu>(
2394 (),
2395 0x2c43645ed70344ba,
2396 fidl::encoding::DynamicFlags::FLEXIBLE,
2397 _decode,
2398 )
2399 }
2400
2401 type AddExecutionStateDependencyResponseFut = fidl::client::QueryResponseFut<
2402 CpuElementManagerAddExecutionStateDependencyResult,
2403 fidl::encoding::DefaultFuchsiaResourceDialect,
2404 >;
2405 fn r#add_execution_state_dependency(
2406 &self,
2407 mut payload: CpuElementManagerAddExecutionStateDependencyRequest,
2408 ) -> Self::AddExecutionStateDependencyResponseFut {
2409 fn _decode(
2410 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2411 ) -> Result<CpuElementManagerAddExecutionStateDependencyResult, fidl::Error> {
2412 let _response = fidl::client::decode_transaction_body::<
2413 fidl::encoding::FlexibleResultType<
2414 fidl::encoding::EmptyStruct,
2415 AddExecutionStateDependencyError,
2416 >,
2417 fidl::encoding::DefaultFuchsiaResourceDialect,
2418 0xdf2f5ea2af76234,
2419 >(_buf?)?
2420 .into_result::<CpuElementManagerMarker>("add_execution_state_dependency")?;
2421 Ok(_response.map(|x| x))
2422 }
2423 self.client.send_query_and_decode::<
2424 CpuElementManagerAddExecutionStateDependencyRequest,
2425 CpuElementManagerAddExecutionStateDependencyResult,
2426 >(
2427 &mut payload,
2428 0xdf2f5ea2af76234,
2429 fidl::encoding::DynamicFlags::FLEXIBLE,
2430 _decode,
2431 )
2432 }
2433}
2434
2435pub struct CpuElementManagerEventStream {
2436 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2437}
2438
2439impl std::marker::Unpin for CpuElementManagerEventStream {}
2440
2441impl futures::stream::FusedStream for CpuElementManagerEventStream {
2442 fn is_terminated(&self) -> bool {
2443 self.event_receiver.is_terminated()
2444 }
2445}
2446
2447impl futures::Stream for CpuElementManagerEventStream {
2448 type Item = Result<CpuElementManagerEvent, fidl::Error>;
2449
2450 fn poll_next(
2451 mut self: std::pin::Pin<&mut Self>,
2452 cx: &mut std::task::Context<'_>,
2453 ) -> std::task::Poll<Option<Self::Item>> {
2454 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2455 &mut self.event_receiver,
2456 cx
2457 )?) {
2458 Some(buf) => std::task::Poll::Ready(Some(CpuElementManagerEvent::decode(buf))),
2459 None => std::task::Poll::Ready(None),
2460 }
2461 }
2462}
2463
2464#[derive(Debug)]
2465pub enum CpuElementManagerEvent {
2466 #[non_exhaustive]
2467 _UnknownEvent {
2468 ordinal: u64,
2470 },
2471}
2472
2473impl CpuElementManagerEvent {
2474 fn decode(
2476 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2477 ) -> Result<CpuElementManagerEvent, fidl::Error> {
2478 let (bytes, _handles) = buf.split_mut();
2479 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2480 debug_assert_eq!(tx_header.tx_id, 0);
2481 match tx_header.ordinal {
2482 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2483 Ok(CpuElementManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2484 }
2485 _ => Err(fidl::Error::UnknownOrdinal {
2486 ordinal: tx_header.ordinal,
2487 protocol_name:
2488 <CpuElementManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2489 }),
2490 }
2491 }
2492}
2493
2494pub struct CpuElementManagerRequestStream {
2496 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2497 is_terminated: bool,
2498}
2499
2500impl std::marker::Unpin for CpuElementManagerRequestStream {}
2501
2502impl futures::stream::FusedStream for CpuElementManagerRequestStream {
2503 fn is_terminated(&self) -> bool {
2504 self.is_terminated
2505 }
2506}
2507
2508impl fidl::endpoints::RequestStream for CpuElementManagerRequestStream {
2509 type Protocol = CpuElementManagerMarker;
2510 type ControlHandle = CpuElementManagerControlHandle;
2511
2512 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2513 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2514 }
2515
2516 fn control_handle(&self) -> Self::ControlHandle {
2517 CpuElementManagerControlHandle { inner: self.inner.clone() }
2518 }
2519
2520 fn into_inner(
2521 self,
2522 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2523 {
2524 (self.inner, self.is_terminated)
2525 }
2526
2527 fn from_inner(
2528 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2529 is_terminated: bool,
2530 ) -> Self {
2531 Self { inner, is_terminated }
2532 }
2533}
2534
2535impl futures::Stream for CpuElementManagerRequestStream {
2536 type Item = Result<CpuElementManagerRequest, fidl::Error>;
2537
2538 fn poll_next(
2539 mut self: std::pin::Pin<&mut Self>,
2540 cx: &mut std::task::Context<'_>,
2541 ) -> std::task::Poll<Option<Self::Item>> {
2542 let this = &mut *self;
2543 if this.inner.check_shutdown(cx) {
2544 this.is_terminated = true;
2545 return std::task::Poll::Ready(None);
2546 }
2547 if this.is_terminated {
2548 panic!("polled CpuElementManagerRequestStream after completion");
2549 }
2550 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2551 |bytes, handles| {
2552 match this.inner.channel().read_etc(cx, bytes, handles) {
2553 std::task::Poll::Ready(Ok(())) => {}
2554 std::task::Poll::Pending => return std::task::Poll::Pending,
2555 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2556 this.is_terminated = true;
2557 return std::task::Poll::Ready(None);
2558 }
2559 std::task::Poll::Ready(Err(e)) => {
2560 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2561 e.into(),
2562 ))));
2563 }
2564 }
2565
2566 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2568
2569 std::task::Poll::Ready(Some(match header.ordinal {
2570 0x2c43645ed70344ba => {
2571 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2572 let mut req = fidl::new_empty!(
2573 fidl::encoding::EmptyPayload,
2574 fidl::encoding::DefaultFuchsiaResourceDialect
2575 );
2576 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2577 let control_handle =
2578 CpuElementManagerControlHandle { inner: this.inner.clone() };
2579 Ok(CpuElementManagerRequest::GetCpuDependencyToken {
2580 responder: CpuElementManagerGetCpuDependencyTokenResponder {
2581 control_handle: std::mem::ManuallyDrop::new(control_handle),
2582 tx_id: header.tx_id,
2583 },
2584 })
2585 }
2586 0xdf2f5ea2af76234 => {
2587 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2588 let mut req = fidl::new_empty!(
2589 CpuElementManagerAddExecutionStateDependencyRequest,
2590 fidl::encoding::DefaultFuchsiaResourceDialect
2591 );
2592 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CpuElementManagerAddExecutionStateDependencyRequest>(&header, _body_bytes, handles, &mut req)?;
2593 let control_handle =
2594 CpuElementManagerControlHandle { inner: this.inner.clone() };
2595 Ok(CpuElementManagerRequest::AddExecutionStateDependency {
2596 payload: req,
2597 responder: CpuElementManagerAddExecutionStateDependencyResponder {
2598 control_handle: std::mem::ManuallyDrop::new(control_handle),
2599 tx_id: header.tx_id,
2600 },
2601 })
2602 }
2603 _ if header.tx_id == 0
2604 && header
2605 .dynamic_flags()
2606 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2607 {
2608 Ok(CpuElementManagerRequest::_UnknownMethod {
2609 ordinal: header.ordinal,
2610 control_handle: CpuElementManagerControlHandle {
2611 inner: this.inner.clone(),
2612 },
2613 method_type: fidl::MethodType::OneWay,
2614 })
2615 }
2616 _ if header
2617 .dynamic_flags()
2618 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2619 {
2620 this.inner.send_framework_err(
2621 fidl::encoding::FrameworkErr::UnknownMethod,
2622 header.tx_id,
2623 header.ordinal,
2624 header.dynamic_flags(),
2625 (bytes, handles),
2626 )?;
2627 Ok(CpuElementManagerRequest::_UnknownMethod {
2628 ordinal: header.ordinal,
2629 control_handle: CpuElementManagerControlHandle {
2630 inner: this.inner.clone(),
2631 },
2632 method_type: fidl::MethodType::TwoWay,
2633 })
2634 }
2635 _ => Err(fidl::Error::UnknownOrdinal {
2636 ordinal: header.ordinal,
2637 protocol_name:
2638 <CpuElementManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2639 }),
2640 }))
2641 },
2642 )
2643 }
2644}
2645
2646#[derive(Debug)]
2648pub enum CpuElementManagerRequest {
2649 GetCpuDependencyToken { responder: CpuElementManagerGetCpuDependencyTokenResponder },
2651 AddExecutionStateDependency {
2661 payload: CpuElementManagerAddExecutionStateDependencyRequest,
2662 responder: CpuElementManagerAddExecutionStateDependencyResponder,
2663 },
2664 #[non_exhaustive]
2666 _UnknownMethod {
2667 ordinal: u64,
2669 control_handle: CpuElementManagerControlHandle,
2670 method_type: fidl::MethodType,
2671 },
2672}
2673
2674impl CpuElementManagerRequest {
2675 #[allow(irrefutable_let_patterns)]
2676 pub fn into_get_cpu_dependency_token(
2677 self,
2678 ) -> Option<(CpuElementManagerGetCpuDependencyTokenResponder)> {
2679 if let CpuElementManagerRequest::GetCpuDependencyToken { responder } = self {
2680 Some((responder))
2681 } else {
2682 None
2683 }
2684 }
2685
2686 #[allow(irrefutable_let_patterns)]
2687 pub fn into_add_execution_state_dependency(
2688 self,
2689 ) -> Option<(
2690 CpuElementManagerAddExecutionStateDependencyRequest,
2691 CpuElementManagerAddExecutionStateDependencyResponder,
2692 )> {
2693 if let CpuElementManagerRequest::AddExecutionStateDependency { payload, responder } = self {
2694 Some((payload, responder))
2695 } else {
2696 None
2697 }
2698 }
2699
2700 pub fn method_name(&self) -> &'static str {
2702 match *self {
2703 CpuElementManagerRequest::GetCpuDependencyToken { .. } => "get_cpu_dependency_token",
2704 CpuElementManagerRequest::AddExecutionStateDependency { .. } => {
2705 "add_execution_state_dependency"
2706 }
2707 CpuElementManagerRequest::_UnknownMethod {
2708 method_type: fidl::MethodType::OneWay,
2709 ..
2710 } => "unknown one-way method",
2711 CpuElementManagerRequest::_UnknownMethod {
2712 method_type: fidl::MethodType::TwoWay,
2713 ..
2714 } => "unknown two-way method",
2715 }
2716 }
2717}
2718
2719#[derive(Debug, Clone)]
2720pub struct CpuElementManagerControlHandle {
2721 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2722}
2723
2724impl fidl::endpoints::ControlHandle for CpuElementManagerControlHandle {
2725 fn shutdown(&self) {
2726 self.inner.shutdown()
2727 }
2728
2729 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2730 self.inner.shutdown_with_epitaph(status)
2731 }
2732
2733 fn is_closed(&self) -> bool {
2734 self.inner.channel().is_closed()
2735 }
2736 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2737 self.inner.channel().on_closed()
2738 }
2739
2740 #[cfg(target_os = "fuchsia")]
2741 fn signal_peer(
2742 &self,
2743 clear_mask: zx::Signals,
2744 set_mask: zx::Signals,
2745 ) -> Result<(), zx_status::Status> {
2746 use fidl::Peered;
2747 self.inner.channel().signal_peer(clear_mask, set_mask)
2748 }
2749}
2750
2751impl CpuElementManagerControlHandle {}
2752
2753#[must_use = "FIDL methods require a response to be sent"]
2754#[derive(Debug)]
2755pub struct CpuElementManagerGetCpuDependencyTokenResponder {
2756 control_handle: std::mem::ManuallyDrop<CpuElementManagerControlHandle>,
2757 tx_id: u32,
2758}
2759
2760impl std::ops::Drop for CpuElementManagerGetCpuDependencyTokenResponder {
2764 fn drop(&mut self) {
2765 self.control_handle.shutdown();
2766 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2768 }
2769}
2770
2771impl fidl::endpoints::Responder for CpuElementManagerGetCpuDependencyTokenResponder {
2772 type ControlHandle = CpuElementManagerControlHandle;
2773
2774 fn control_handle(&self) -> &CpuElementManagerControlHandle {
2775 &self.control_handle
2776 }
2777
2778 fn drop_without_shutdown(mut self) {
2779 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2781 std::mem::forget(self);
2783 }
2784}
2785
2786impl CpuElementManagerGetCpuDependencyTokenResponder {
2787 pub fn send(self, mut payload: Cpu) -> Result<(), fidl::Error> {
2791 let _result = self.send_raw(payload);
2792 if _result.is_err() {
2793 self.control_handle.shutdown();
2794 }
2795 self.drop_without_shutdown();
2796 _result
2797 }
2798
2799 pub fn send_no_shutdown_on_err(self, mut payload: Cpu) -> Result<(), fidl::Error> {
2801 let _result = self.send_raw(payload);
2802 self.drop_without_shutdown();
2803 _result
2804 }
2805
2806 fn send_raw(&self, mut payload: Cpu) -> Result<(), fidl::Error> {
2807 self.control_handle.inner.send::<fidl::encoding::FlexibleType<Cpu>>(
2808 fidl::encoding::Flexible::new(&mut payload),
2809 self.tx_id,
2810 0x2c43645ed70344ba,
2811 fidl::encoding::DynamicFlags::FLEXIBLE,
2812 )
2813 }
2814}
2815
2816#[must_use = "FIDL methods require a response to be sent"]
2817#[derive(Debug)]
2818pub struct CpuElementManagerAddExecutionStateDependencyResponder {
2819 control_handle: std::mem::ManuallyDrop<CpuElementManagerControlHandle>,
2820 tx_id: u32,
2821}
2822
2823impl std::ops::Drop for CpuElementManagerAddExecutionStateDependencyResponder {
2827 fn drop(&mut self) {
2828 self.control_handle.shutdown();
2829 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2831 }
2832}
2833
2834impl fidl::endpoints::Responder for CpuElementManagerAddExecutionStateDependencyResponder {
2835 type ControlHandle = CpuElementManagerControlHandle;
2836
2837 fn control_handle(&self) -> &CpuElementManagerControlHandle {
2838 &self.control_handle
2839 }
2840
2841 fn drop_without_shutdown(mut self) {
2842 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2844 std::mem::forget(self);
2846 }
2847}
2848
2849impl CpuElementManagerAddExecutionStateDependencyResponder {
2850 pub fn send(
2854 self,
2855 mut result: Result<(), AddExecutionStateDependencyError>,
2856 ) -> Result<(), fidl::Error> {
2857 let _result = self.send_raw(result);
2858 if _result.is_err() {
2859 self.control_handle.shutdown();
2860 }
2861 self.drop_without_shutdown();
2862 _result
2863 }
2864
2865 pub fn send_no_shutdown_on_err(
2867 self,
2868 mut result: Result<(), AddExecutionStateDependencyError>,
2869 ) -> Result<(), fidl::Error> {
2870 let _result = self.send_raw(result);
2871 self.drop_without_shutdown();
2872 _result
2873 }
2874
2875 fn send_raw(
2876 &self,
2877 mut result: Result<(), AddExecutionStateDependencyError>,
2878 ) -> Result<(), fidl::Error> {
2879 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2880 fidl::encoding::EmptyStruct,
2881 AddExecutionStateDependencyError,
2882 >>(
2883 fidl::encoding::FlexibleResult::new(result),
2884 self.tx_id,
2885 0xdf2f5ea2af76234,
2886 fidl::encoding::DynamicFlags::FLEXIBLE,
2887 )
2888 }
2889}
2890
2891#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2892pub struct SuspendBlockerMarker;
2893
2894impl fidl::endpoints::ProtocolMarker for SuspendBlockerMarker {
2895 type Proxy = SuspendBlockerProxy;
2896 type RequestStream = SuspendBlockerRequestStream;
2897 #[cfg(target_os = "fuchsia")]
2898 type SynchronousProxy = SuspendBlockerSynchronousProxy;
2899
2900 const DEBUG_NAME: &'static str = "(anonymous) SuspendBlocker";
2901}
2902
2903pub trait SuspendBlockerProxyInterface: Send + Sync {
2904 type BeforeSuspendResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2905 fn r#before_suspend(&self) -> Self::BeforeSuspendResponseFut;
2906 type AfterResumeResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2907 fn r#after_resume(&self) -> Self::AfterResumeResponseFut;
2908}
2909#[derive(Debug)]
2910#[cfg(target_os = "fuchsia")]
2911pub struct SuspendBlockerSynchronousProxy {
2912 client: fidl::client::sync::Client,
2913}
2914
2915#[cfg(target_os = "fuchsia")]
2916impl fidl::endpoints::SynchronousProxy for SuspendBlockerSynchronousProxy {
2917 type Proxy = SuspendBlockerProxy;
2918 type Protocol = SuspendBlockerMarker;
2919
2920 fn from_channel(inner: fidl::Channel) -> Self {
2921 Self::new(inner)
2922 }
2923
2924 fn into_channel(self) -> fidl::Channel {
2925 self.client.into_channel()
2926 }
2927
2928 fn as_channel(&self) -> &fidl::Channel {
2929 self.client.as_channel()
2930 }
2931}
2932
2933#[cfg(target_os = "fuchsia")]
2934impl SuspendBlockerSynchronousProxy {
2935 pub fn new(channel: fidl::Channel) -> Self {
2936 Self { client: fidl::client::sync::Client::new(channel) }
2937 }
2938
2939 pub fn into_channel(self) -> fidl::Channel {
2940 self.client.into_channel()
2941 }
2942
2943 pub fn wait_for_event(
2946 &self,
2947 deadline: zx::MonotonicInstant,
2948 ) -> Result<SuspendBlockerEvent, fidl::Error> {
2949 SuspendBlockerEvent::decode(self.client.wait_for_event::<SuspendBlockerMarker>(deadline)?)
2950 }
2951
2952 pub fn r#before_suspend(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
2974 let _response = self.client.send_query::<
2975 fidl::encoding::EmptyPayload,
2976 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2977 SuspendBlockerMarker,
2978 >(
2979 (),
2980 0x6b569393a01a6d80,
2981 fidl::encoding::DynamicFlags::FLEXIBLE,
2982 ___deadline,
2983 )?
2984 .into_result::<SuspendBlockerMarker>("before_suspend")?;
2985 Ok(_response)
2986 }
2987
2988 pub fn r#after_resume(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
3001 let _response = self.client.send_query::<
3002 fidl::encoding::EmptyPayload,
3003 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3004 SuspendBlockerMarker,
3005 >(
3006 (),
3007 0x6a329cfcc73f2dea,
3008 fidl::encoding::DynamicFlags::FLEXIBLE,
3009 ___deadline,
3010 )?
3011 .into_result::<SuspendBlockerMarker>("after_resume")?;
3012 Ok(_response)
3013 }
3014}
3015
3016#[cfg(target_os = "fuchsia")]
3017impl From<SuspendBlockerSynchronousProxy> for zx::NullableHandle {
3018 fn from(value: SuspendBlockerSynchronousProxy) -> Self {
3019 value.into_channel().into()
3020 }
3021}
3022
3023#[cfg(target_os = "fuchsia")]
3024impl From<fidl::Channel> for SuspendBlockerSynchronousProxy {
3025 fn from(value: fidl::Channel) -> Self {
3026 Self::new(value)
3027 }
3028}
3029
3030#[cfg(target_os = "fuchsia")]
3031impl fidl::endpoints::FromClient for SuspendBlockerSynchronousProxy {
3032 type Protocol = SuspendBlockerMarker;
3033
3034 fn from_client(value: fidl::endpoints::ClientEnd<SuspendBlockerMarker>) -> Self {
3035 Self::new(value.into_channel())
3036 }
3037}
3038
3039#[derive(Debug, Clone)]
3040pub struct SuspendBlockerProxy {
3041 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3042}
3043
3044impl fidl::endpoints::Proxy for SuspendBlockerProxy {
3045 type Protocol = SuspendBlockerMarker;
3046
3047 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3048 Self::new(inner)
3049 }
3050
3051 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3052 self.client.into_channel().map_err(|client| Self { client })
3053 }
3054
3055 fn as_channel(&self) -> &::fidl::AsyncChannel {
3056 self.client.as_channel()
3057 }
3058}
3059
3060impl SuspendBlockerProxy {
3061 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3063 let protocol_name = <SuspendBlockerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3064 Self { client: fidl::client::Client::new(channel, protocol_name) }
3065 }
3066
3067 pub fn take_event_stream(&self) -> SuspendBlockerEventStream {
3073 SuspendBlockerEventStream { event_receiver: self.client.take_event_receiver() }
3074 }
3075
3076 pub fn r#before_suspend(
3098 &self,
3099 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3100 SuspendBlockerProxyInterface::r#before_suspend(self)
3101 }
3102
3103 pub fn r#after_resume(
3116 &self,
3117 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3118 SuspendBlockerProxyInterface::r#after_resume(self)
3119 }
3120}
3121
3122impl SuspendBlockerProxyInterface for SuspendBlockerProxy {
3123 type BeforeSuspendResponseFut =
3124 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3125 fn r#before_suspend(&self) -> Self::BeforeSuspendResponseFut {
3126 fn _decode(
3127 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3128 ) -> Result<(), fidl::Error> {
3129 let _response = fidl::client::decode_transaction_body::<
3130 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3131 fidl::encoding::DefaultFuchsiaResourceDialect,
3132 0x6b569393a01a6d80,
3133 >(_buf?)?
3134 .into_result::<SuspendBlockerMarker>("before_suspend")?;
3135 Ok(_response)
3136 }
3137 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
3138 (),
3139 0x6b569393a01a6d80,
3140 fidl::encoding::DynamicFlags::FLEXIBLE,
3141 _decode,
3142 )
3143 }
3144
3145 type AfterResumeResponseFut =
3146 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3147 fn r#after_resume(&self) -> Self::AfterResumeResponseFut {
3148 fn _decode(
3149 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3150 ) -> Result<(), fidl::Error> {
3151 let _response = fidl::client::decode_transaction_body::<
3152 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3153 fidl::encoding::DefaultFuchsiaResourceDialect,
3154 0x6a329cfcc73f2dea,
3155 >(_buf?)?
3156 .into_result::<SuspendBlockerMarker>("after_resume")?;
3157 Ok(_response)
3158 }
3159 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
3160 (),
3161 0x6a329cfcc73f2dea,
3162 fidl::encoding::DynamicFlags::FLEXIBLE,
3163 _decode,
3164 )
3165 }
3166}
3167
3168pub struct SuspendBlockerEventStream {
3169 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3170}
3171
3172impl std::marker::Unpin for SuspendBlockerEventStream {}
3173
3174impl futures::stream::FusedStream for SuspendBlockerEventStream {
3175 fn is_terminated(&self) -> bool {
3176 self.event_receiver.is_terminated()
3177 }
3178}
3179
3180impl futures::Stream for SuspendBlockerEventStream {
3181 type Item = Result<SuspendBlockerEvent, fidl::Error>;
3182
3183 fn poll_next(
3184 mut self: std::pin::Pin<&mut Self>,
3185 cx: &mut std::task::Context<'_>,
3186 ) -> std::task::Poll<Option<Self::Item>> {
3187 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3188 &mut self.event_receiver,
3189 cx
3190 )?) {
3191 Some(buf) => std::task::Poll::Ready(Some(SuspendBlockerEvent::decode(buf))),
3192 None => std::task::Poll::Ready(None),
3193 }
3194 }
3195}
3196
3197#[derive(Debug)]
3198pub enum SuspendBlockerEvent {
3199 #[non_exhaustive]
3200 _UnknownEvent {
3201 ordinal: u64,
3203 },
3204}
3205
3206impl SuspendBlockerEvent {
3207 fn decode(
3209 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3210 ) -> Result<SuspendBlockerEvent, fidl::Error> {
3211 let (bytes, _handles) = buf.split_mut();
3212 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3213 debug_assert_eq!(tx_header.tx_id, 0);
3214 match tx_header.ordinal {
3215 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3216 Ok(SuspendBlockerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3217 }
3218 _ => Err(fidl::Error::UnknownOrdinal {
3219 ordinal: tx_header.ordinal,
3220 protocol_name:
3221 <SuspendBlockerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3222 }),
3223 }
3224 }
3225}
3226
3227pub struct SuspendBlockerRequestStream {
3229 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3230 is_terminated: bool,
3231}
3232
3233impl std::marker::Unpin for SuspendBlockerRequestStream {}
3234
3235impl futures::stream::FusedStream for SuspendBlockerRequestStream {
3236 fn is_terminated(&self) -> bool {
3237 self.is_terminated
3238 }
3239}
3240
3241impl fidl::endpoints::RequestStream for SuspendBlockerRequestStream {
3242 type Protocol = SuspendBlockerMarker;
3243 type ControlHandle = SuspendBlockerControlHandle;
3244
3245 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3246 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3247 }
3248
3249 fn control_handle(&self) -> Self::ControlHandle {
3250 SuspendBlockerControlHandle { inner: self.inner.clone() }
3251 }
3252
3253 fn into_inner(
3254 self,
3255 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3256 {
3257 (self.inner, self.is_terminated)
3258 }
3259
3260 fn from_inner(
3261 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3262 is_terminated: bool,
3263 ) -> Self {
3264 Self { inner, is_terminated }
3265 }
3266}
3267
3268impl futures::Stream for SuspendBlockerRequestStream {
3269 type Item = Result<SuspendBlockerRequest, fidl::Error>;
3270
3271 fn poll_next(
3272 mut self: std::pin::Pin<&mut Self>,
3273 cx: &mut std::task::Context<'_>,
3274 ) -> std::task::Poll<Option<Self::Item>> {
3275 let this = &mut *self;
3276 if this.inner.check_shutdown(cx) {
3277 this.is_terminated = true;
3278 return std::task::Poll::Ready(None);
3279 }
3280 if this.is_terminated {
3281 panic!("polled SuspendBlockerRequestStream after completion");
3282 }
3283 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3284 |bytes, handles| {
3285 match this.inner.channel().read_etc(cx, bytes, handles) {
3286 std::task::Poll::Ready(Ok(())) => {}
3287 std::task::Poll::Pending => return std::task::Poll::Pending,
3288 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3289 this.is_terminated = true;
3290 return std::task::Poll::Ready(None);
3291 }
3292 std::task::Poll::Ready(Err(e)) => {
3293 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3294 e.into(),
3295 ))));
3296 }
3297 }
3298
3299 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3301
3302 std::task::Poll::Ready(Some(match header.ordinal {
3303 0x6b569393a01a6d80 => {
3304 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3305 let mut req = fidl::new_empty!(
3306 fidl::encoding::EmptyPayload,
3307 fidl::encoding::DefaultFuchsiaResourceDialect
3308 );
3309 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3310 let control_handle =
3311 SuspendBlockerControlHandle { inner: this.inner.clone() };
3312 Ok(SuspendBlockerRequest::BeforeSuspend {
3313 responder: SuspendBlockerBeforeSuspendResponder {
3314 control_handle: std::mem::ManuallyDrop::new(control_handle),
3315 tx_id: header.tx_id,
3316 },
3317 })
3318 }
3319 0x6a329cfcc73f2dea => {
3320 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3321 let mut req = fidl::new_empty!(
3322 fidl::encoding::EmptyPayload,
3323 fidl::encoding::DefaultFuchsiaResourceDialect
3324 );
3325 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3326 let control_handle =
3327 SuspendBlockerControlHandle { inner: this.inner.clone() };
3328 Ok(SuspendBlockerRequest::AfterResume {
3329 responder: SuspendBlockerAfterResumeResponder {
3330 control_handle: std::mem::ManuallyDrop::new(control_handle),
3331 tx_id: header.tx_id,
3332 },
3333 })
3334 }
3335 _ if header.tx_id == 0
3336 && header
3337 .dynamic_flags()
3338 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3339 {
3340 Ok(SuspendBlockerRequest::_UnknownMethod {
3341 ordinal: header.ordinal,
3342 control_handle: SuspendBlockerControlHandle {
3343 inner: this.inner.clone(),
3344 },
3345 method_type: fidl::MethodType::OneWay,
3346 })
3347 }
3348 _ if header
3349 .dynamic_flags()
3350 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3351 {
3352 this.inner.send_framework_err(
3353 fidl::encoding::FrameworkErr::UnknownMethod,
3354 header.tx_id,
3355 header.ordinal,
3356 header.dynamic_flags(),
3357 (bytes, handles),
3358 )?;
3359 Ok(SuspendBlockerRequest::_UnknownMethod {
3360 ordinal: header.ordinal,
3361 control_handle: SuspendBlockerControlHandle {
3362 inner: this.inner.clone(),
3363 },
3364 method_type: fidl::MethodType::TwoWay,
3365 })
3366 }
3367 _ => Err(fidl::Error::UnknownOrdinal {
3368 ordinal: header.ordinal,
3369 protocol_name:
3370 <SuspendBlockerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3371 }),
3372 }))
3373 },
3374 )
3375 }
3376}
3377
3378#[derive(Debug)]
3381pub enum SuspendBlockerRequest {
3382 BeforeSuspend { responder: SuspendBlockerBeforeSuspendResponder },
3404 AfterResume { responder: SuspendBlockerAfterResumeResponder },
3417 #[non_exhaustive]
3419 _UnknownMethod {
3420 ordinal: u64,
3422 control_handle: SuspendBlockerControlHandle,
3423 method_type: fidl::MethodType,
3424 },
3425}
3426
3427impl SuspendBlockerRequest {
3428 #[allow(irrefutable_let_patterns)]
3429 pub fn into_before_suspend(self) -> Option<(SuspendBlockerBeforeSuspendResponder)> {
3430 if let SuspendBlockerRequest::BeforeSuspend { responder } = self {
3431 Some((responder))
3432 } else {
3433 None
3434 }
3435 }
3436
3437 #[allow(irrefutable_let_patterns)]
3438 pub fn into_after_resume(self) -> Option<(SuspendBlockerAfterResumeResponder)> {
3439 if let SuspendBlockerRequest::AfterResume { responder } = self {
3440 Some((responder))
3441 } else {
3442 None
3443 }
3444 }
3445
3446 pub fn method_name(&self) -> &'static str {
3448 match *self {
3449 SuspendBlockerRequest::BeforeSuspend { .. } => "before_suspend",
3450 SuspendBlockerRequest::AfterResume { .. } => "after_resume",
3451 SuspendBlockerRequest::_UnknownMethod {
3452 method_type: fidl::MethodType::OneWay, ..
3453 } => "unknown one-way method",
3454 SuspendBlockerRequest::_UnknownMethod {
3455 method_type: fidl::MethodType::TwoWay, ..
3456 } => "unknown two-way method",
3457 }
3458 }
3459}
3460
3461#[derive(Debug, Clone)]
3462pub struct SuspendBlockerControlHandle {
3463 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3464}
3465
3466impl fidl::endpoints::ControlHandle for SuspendBlockerControlHandle {
3467 fn shutdown(&self) {
3468 self.inner.shutdown()
3469 }
3470
3471 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3472 self.inner.shutdown_with_epitaph(status)
3473 }
3474
3475 fn is_closed(&self) -> bool {
3476 self.inner.channel().is_closed()
3477 }
3478 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3479 self.inner.channel().on_closed()
3480 }
3481
3482 #[cfg(target_os = "fuchsia")]
3483 fn signal_peer(
3484 &self,
3485 clear_mask: zx::Signals,
3486 set_mask: zx::Signals,
3487 ) -> Result<(), zx_status::Status> {
3488 use fidl::Peered;
3489 self.inner.channel().signal_peer(clear_mask, set_mask)
3490 }
3491}
3492
3493impl SuspendBlockerControlHandle {}
3494
3495#[must_use = "FIDL methods require a response to be sent"]
3496#[derive(Debug)]
3497pub struct SuspendBlockerBeforeSuspendResponder {
3498 control_handle: std::mem::ManuallyDrop<SuspendBlockerControlHandle>,
3499 tx_id: u32,
3500}
3501
3502impl std::ops::Drop for SuspendBlockerBeforeSuspendResponder {
3506 fn drop(&mut self) {
3507 self.control_handle.shutdown();
3508 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3510 }
3511}
3512
3513impl fidl::endpoints::Responder for SuspendBlockerBeforeSuspendResponder {
3514 type ControlHandle = SuspendBlockerControlHandle;
3515
3516 fn control_handle(&self) -> &SuspendBlockerControlHandle {
3517 &self.control_handle
3518 }
3519
3520 fn drop_without_shutdown(mut self) {
3521 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3523 std::mem::forget(self);
3525 }
3526}
3527
3528impl SuspendBlockerBeforeSuspendResponder {
3529 pub fn send(self) -> Result<(), fidl::Error> {
3533 let _result = self.send_raw();
3534 if _result.is_err() {
3535 self.control_handle.shutdown();
3536 }
3537 self.drop_without_shutdown();
3538 _result
3539 }
3540
3541 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3543 let _result = self.send_raw();
3544 self.drop_without_shutdown();
3545 _result
3546 }
3547
3548 fn send_raw(&self) -> Result<(), fidl::Error> {
3549 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3550 fidl::encoding::Flexible::new(()),
3551 self.tx_id,
3552 0x6b569393a01a6d80,
3553 fidl::encoding::DynamicFlags::FLEXIBLE,
3554 )
3555 }
3556}
3557
3558#[must_use = "FIDL methods require a response to be sent"]
3559#[derive(Debug)]
3560pub struct SuspendBlockerAfterResumeResponder {
3561 control_handle: std::mem::ManuallyDrop<SuspendBlockerControlHandle>,
3562 tx_id: u32,
3563}
3564
3565impl std::ops::Drop for SuspendBlockerAfterResumeResponder {
3569 fn drop(&mut self) {
3570 self.control_handle.shutdown();
3571 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3573 }
3574}
3575
3576impl fidl::endpoints::Responder for SuspendBlockerAfterResumeResponder {
3577 type ControlHandle = SuspendBlockerControlHandle;
3578
3579 fn control_handle(&self) -> &SuspendBlockerControlHandle {
3580 &self.control_handle
3581 }
3582
3583 fn drop_without_shutdown(mut self) {
3584 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3586 std::mem::forget(self);
3588 }
3589}
3590
3591impl SuspendBlockerAfterResumeResponder {
3592 pub fn send(self) -> Result<(), fidl::Error> {
3596 let _result = self.send_raw();
3597 if _result.is_err() {
3598 self.control_handle.shutdown();
3599 }
3600 self.drop_without_shutdown();
3601 _result
3602 }
3603
3604 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3606 let _result = self.send_raw();
3607 self.drop_without_shutdown();
3608 _result
3609 }
3610
3611 fn send_raw(&self) -> Result<(), fidl::Error> {
3612 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3613 fidl::encoding::Flexible::new(()),
3614 self.tx_id,
3615 0x6a329cfcc73f2dea,
3616 fidl::encoding::DynamicFlags::FLEXIBLE,
3617 )
3618 }
3619}
3620
3621mod internal {
3622 use super::*;
3623
3624 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorAcquireWakeLeaseWithTokenRequest {
3625 type Borrowed<'a> = &'a mut Self;
3626 fn take_or_borrow<'a>(
3627 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3628 ) -> Self::Borrowed<'a> {
3629 value
3630 }
3631 }
3632
3633 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorAcquireWakeLeaseWithTokenRequest {
3634 type Owned = Self;
3635
3636 #[inline(always)]
3637 fn inline_align(_context: fidl::encoding::Context) -> usize {
3638 8
3639 }
3640
3641 #[inline(always)]
3642 fn inline_size(_context: fidl::encoding::Context) -> usize {
3643 24
3644 }
3645 }
3646
3647 unsafe impl
3648 fidl::encoding::Encode<
3649 ActivityGovernorAcquireWakeLeaseWithTokenRequest,
3650 fidl::encoding::DefaultFuchsiaResourceDialect,
3651 > for &mut ActivityGovernorAcquireWakeLeaseWithTokenRequest
3652 {
3653 #[inline]
3654 unsafe fn encode(
3655 self,
3656 encoder: &mut fidl::encoding::Encoder<
3657 '_,
3658 fidl::encoding::DefaultFuchsiaResourceDialect,
3659 >,
3660 offset: usize,
3661 _depth: fidl::encoding::Depth,
3662 ) -> fidl::Result<()> {
3663 encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseWithTokenRequest>(offset);
3664 fidl::encoding::Encode::<
3666 ActivityGovernorAcquireWakeLeaseWithTokenRequest,
3667 fidl::encoding::DefaultFuchsiaResourceDialect,
3668 >::encode(
3669 (
3670 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
3671 &self.name,
3672 ),
3673 <fidl::encoding::HandleType<
3674 fidl::EventPair,
3675 { fidl::ObjectType::EVENTPAIR.into_raw() },
3676 16387,
3677 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3678 &mut self.server_token,
3679 ),
3680 ),
3681 encoder,
3682 offset,
3683 _depth,
3684 )
3685 }
3686 }
3687 unsafe impl<
3688 T0: fidl::encoding::Encode<
3689 fidl::encoding::BoundedString<64>,
3690 fidl::encoding::DefaultFuchsiaResourceDialect,
3691 >,
3692 T1: fidl::encoding::Encode<
3693 fidl::encoding::HandleType<
3694 fidl::EventPair,
3695 { fidl::ObjectType::EVENTPAIR.into_raw() },
3696 16387,
3697 >,
3698 fidl::encoding::DefaultFuchsiaResourceDialect,
3699 >,
3700 >
3701 fidl::encoding::Encode<
3702 ActivityGovernorAcquireWakeLeaseWithTokenRequest,
3703 fidl::encoding::DefaultFuchsiaResourceDialect,
3704 > for (T0, T1)
3705 {
3706 #[inline]
3707 unsafe fn encode(
3708 self,
3709 encoder: &mut fidl::encoding::Encoder<
3710 '_,
3711 fidl::encoding::DefaultFuchsiaResourceDialect,
3712 >,
3713 offset: usize,
3714 depth: fidl::encoding::Depth,
3715 ) -> fidl::Result<()> {
3716 encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseWithTokenRequest>(offset);
3717 unsafe {
3720 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3721 (ptr as *mut u64).write_unaligned(0);
3722 }
3723 self.0.encode(encoder, offset + 0, depth)?;
3725 self.1.encode(encoder, offset + 16, depth)?;
3726 Ok(())
3727 }
3728 }
3729
3730 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3731 for ActivityGovernorAcquireWakeLeaseWithTokenRequest
3732 {
3733 #[inline(always)]
3734 fn new_empty() -> Self {
3735 Self {
3736 name: fidl::new_empty!(
3737 fidl::encoding::BoundedString<64>,
3738 fidl::encoding::DefaultFuchsiaResourceDialect
3739 ),
3740 server_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
3741 }
3742 }
3743
3744 #[inline]
3745 unsafe fn decode(
3746 &mut self,
3747 decoder: &mut fidl::encoding::Decoder<
3748 '_,
3749 fidl::encoding::DefaultFuchsiaResourceDialect,
3750 >,
3751 offset: usize,
3752 _depth: fidl::encoding::Depth,
3753 ) -> fidl::Result<()> {
3754 decoder.debug_check_bounds::<Self>(offset);
3755 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3757 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3758 let mask = 0xffffffff00000000u64;
3759 let maskedval = padval & mask;
3760 if maskedval != 0 {
3761 return Err(fidl::Error::NonZeroPadding {
3762 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3763 });
3764 }
3765 fidl::decode!(
3766 fidl::encoding::BoundedString<64>,
3767 fidl::encoding::DefaultFuchsiaResourceDialect,
3768 &mut self.name,
3769 decoder,
3770 offset + 0,
3771 _depth
3772 )?;
3773 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server_token, decoder, offset + 16, _depth)?;
3774 Ok(())
3775 }
3776 }
3777
3778 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorAcquireWakeLeaseResponse {
3779 type Borrowed<'a> = &'a mut Self;
3780 fn take_or_borrow<'a>(
3781 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3782 ) -> Self::Borrowed<'a> {
3783 value
3784 }
3785 }
3786
3787 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorAcquireWakeLeaseResponse {
3788 type Owned = Self;
3789
3790 #[inline(always)]
3791 fn inline_align(_context: fidl::encoding::Context) -> usize {
3792 4
3793 }
3794
3795 #[inline(always)]
3796 fn inline_size(_context: fidl::encoding::Context) -> usize {
3797 4
3798 }
3799 }
3800
3801 unsafe impl
3802 fidl::encoding::Encode<
3803 ActivityGovernorAcquireWakeLeaseResponse,
3804 fidl::encoding::DefaultFuchsiaResourceDialect,
3805 > for &mut ActivityGovernorAcquireWakeLeaseResponse
3806 {
3807 #[inline]
3808 unsafe fn encode(
3809 self,
3810 encoder: &mut fidl::encoding::Encoder<
3811 '_,
3812 fidl::encoding::DefaultFuchsiaResourceDialect,
3813 >,
3814 offset: usize,
3815 _depth: fidl::encoding::Depth,
3816 ) -> fidl::Result<()> {
3817 encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseResponse>(offset);
3818 fidl::encoding::Encode::<
3820 ActivityGovernorAcquireWakeLeaseResponse,
3821 fidl::encoding::DefaultFuchsiaResourceDialect,
3822 >::encode(
3823 (<fidl::encoding::HandleType<
3824 fidl::EventPair,
3825 { fidl::ObjectType::EVENTPAIR.into_raw() },
3826 16387,
3827 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3828 &mut self.token
3829 ),),
3830 encoder,
3831 offset,
3832 _depth,
3833 )
3834 }
3835 }
3836 unsafe impl<
3837 T0: fidl::encoding::Encode<
3838 fidl::encoding::HandleType<
3839 fidl::EventPair,
3840 { fidl::ObjectType::EVENTPAIR.into_raw() },
3841 16387,
3842 >,
3843 fidl::encoding::DefaultFuchsiaResourceDialect,
3844 >,
3845 >
3846 fidl::encoding::Encode<
3847 ActivityGovernorAcquireWakeLeaseResponse,
3848 fidl::encoding::DefaultFuchsiaResourceDialect,
3849 > for (T0,)
3850 {
3851 #[inline]
3852 unsafe fn encode(
3853 self,
3854 encoder: &mut fidl::encoding::Encoder<
3855 '_,
3856 fidl::encoding::DefaultFuchsiaResourceDialect,
3857 >,
3858 offset: usize,
3859 depth: fidl::encoding::Depth,
3860 ) -> fidl::Result<()> {
3861 encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseResponse>(offset);
3862 self.0.encode(encoder, offset + 0, depth)?;
3866 Ok(())
3867 }
3868 }
3869
3870 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3871 for ActivityGovernorAcquireWakeLeaseResponse
3872 {
3873 #[inline(always)]
3874 fn new_empty() -> Self {
3875 Self {
3876 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
3877 }
3878 }
3879
3880 #[inline]
3881 unsafe fn decode(
3882 &mut self,
3883 decoder: &mut fidl::encoding::Decoder<
3884 '_,
3885 fidl::encoding::DefaultFuchsiaResourceDialect,
3886 >,
3887 offset: usize,
3888 _depth: fidl::encoding::Depth,
3889 ) -> fidl::Result<()> {
3890 decoder.debug_check_bounds::<Self>(offset);
3891 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
3893 Ok(())
3894 }
3895 }
3896
3897 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorRegisterSuspendBlockerResponse {
3898 type Borrowed<'a> = &'a mut Self;
3899 fn take_or_borrow<'a>(
3900 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3901 ) -> Self::Borrowed<'a> {
3902 value
3903 }
3904 }
3905
3906 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorRegisterSuspendBlockerResponse {
3907 type Owned = Self;
3908
3909 #[inline(always)]
3910 fn inline_align(_context: fidl::encoding::Context) -> usize {
3911 4
3912 }
3913
3914 #[inline(always)]
3915 fn inline_size(_context: fidl::encoding::Context) -> usize {
3916 4
3917 }
3918 }
3919
3920 unsafe impl
3921 fidl::encoding::Encode<
3922 ActivityGovernorRegisterSuspendBlockerResponse,
3923 fidl::encoding::DefaultFuchsiaResourceDialect,
3924 > for &mut ActivityGovernorRegisterSuspendBlockerResponse
3925 {
3926 #[inline]
3927 unsafe fn encode(
3928 self,
3929 encoder: &mut fidl::encoding::Encoder<
3930 '_,
3931 fidl::encoding::DefaultFuchsiaResourceDialect,
3932 >,
3933 offset: usize,
3934 _depth: fidl::encoding::Depth,
3935 ) -> fidl::Result<()> {
3936 encoder.debug_check_bounds::<ActivityGovernorRegisterSuspendBlockerResponse>(offset);
3937 fidl::encoding::Encode::<
3939 ActivityGovernorRegisterSuspendBlockerResponse,
3940 fidl::encoding::DefaultFuchsiaResourceDialect,
3941 >::encode(
3942 (<fidl::encoding::HandleType<
3943 fidl::EventPair,
3944 { fidl::ObjectType::EVENTPAIR.into_raw() },
3945 16387,
3946 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3947 &mut self.token
3948 ),),
3949 encoder,
3950 offset,
3951 _depth,
3952 )
3953 }
3954 }
3955 unsafe impl<
3956 T0: fidl::encoding::Encode<
3957 fidl::encoding::HandleType<
3958 fidl::EventPair,
3959 { fidl::ObjectType::EVENTPAIR.into_raw() },
3960 16387,
3961 >,
3962 fidl::encoding::DefaultFuchsiaResourceDialect,
3963 >,
3964 >
3965 fidl::encoding::Encode<
3966 ActivityGovernorRegisterSuspendBlockerResponse,
3967 fidl::encoding::DefaultFuchsiaResourceDialect,
3968 > for (T0,)
3969 {
3970 #[inline]
3971 unsafe fn encode(
3972 self,
3973 encoder: &mut fidl::encoding::Encoder<
3974 '_,
3975 fidl::encoding::DefaultFuchsiaResourceDialect,
3976 >,
3977 offset: usize,
3978 depth: fidl::encoding::Depth,
3979 ) -> fidl::Result<()> {
3980 encoder.debug_check_bounds::<ActivityGovernorRegisterSuspendBlockerResponse>(offset);
3981 self.0.encode(encoder, offset + 0, depth)?;
3985 Ok(())
3986 }
3987 }
3988
3989 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3990 for ActivityGovernorRegisterSuspendBlockerResponse
3991 {
3992 #[inline(always)]
3993 fn new_empty() -> Self {
3994 Self {
3995 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
3996 }
3997 }
3998
3999 #[inline]
4000 unsafe fn decode(
4001 &mut self,
4002 decoder: &mut fidl::encoding::Decoder<
4003 '_,
4004 fidl::encoding::DefaultFuchsiaResourceDialect,
4005 >,
4006 offset: usize,
4007 _depth: fidl::encoding::Depth,
4008 ) -> fidl::Result<()> {
4009 decoder.debug_check_bounds::<Self>(offset);
4010 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4012 Ok(())
4013 }
4014 }
4015
4016 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorTakeApplicationActivityLeaseResponse {
4017 type Borrowed<'a> = &'a mut Self;
4018 fn take_or_borrow<'a>(
4019 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4020 ) -> Self::Borrowed<'a> {
4021 value
4022 }
4023 }
4024
4025 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorTakeApplicationActivityLeaseResponse {
4026 type Owned = Self;
4027
4028 #[inline(always)]
4029 fn inline_align(_context: fidl::encoding::Context) -> usize {
4030 4
4031 }
4032
4033 #[inline(always)]
4034 fn inline_size(_context: fidl::encoding::Context) -> usize {
4035 4
4036 }
4037 }
4038
4039 unsafe impl
4040 fidl::encoding::Encode<
4041 ActivityGovernorTakeApplicationActivityLeaseResponse,
4042 fidl::encoding::DefaultFuchsiaResourceDialect,
4043 > for &mut ActivityGovernorTakeApplicationActivityLeaseResponse
4044 {
4045 #[inline]
4046 unsafe fn encode(
4047 self,
4048 encoder: &mut fidl::encoding::Encoder<
4049 '_,
4050 fidl::encoding::DefaultFuchsiaResourceDialect,
4051 >,
4052 offset: usize,
4053 _depth: fidl::encoding::Depth,
4054 ) -> fidl::Result<()> {
4055 encoder
4056 .debug_check_bounds::<ActivityGovernorTakeApplicationActivityLeaseResponse>(offset);
4057 fidl::encoding::Encode::<
4059 ActivityGovernorTakeApplicationActivityLeaseResponse,
4060 fidl::encoding::DefaultFuchsiaResourceDialect,
4061 >::encode(
4062 (<fidl::encoding::HandleType<
4063 fidl::EventPair,
4064 { fidl::ObjectType::EVENTPAIR.into_raw() },
4065 16387,
4066 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4067 &mut self.token
4068 ),),
4069 encoder,
4070 offset,
4071 _depth,
4072 )
4073 }
4074 }
4075 unsafe impl<
4076 T0: fidl::encoding::Encode<
4077 fidl::encoding::HandleType<
4078 fidl::EventPair,
4079 { fidl::ObjectType::EVENTPAIR.into_raw() },
4080 16387,
4081 >,
4082 fidl::encoding::DefaultFuchsiaResourceDialect,
4083 >,
4084 >
4085 fidl::encoding::Encode<
4086 ActivityGovernorTakeApplicationActivityLeaseResponse,
4087 fidl::encoding::DefaultFuchsiaResourceDialect,
4088 > for (T0,)
4089 {
4090 #[inline]
4091 unsafe fn encode(
4092 self,
4093 encoder: &mut fidl::encoding::Encoder<
4094 '_,
4095 fidl::encoding::DefaultFuchsiaResourceDialect,
4096 >,
4097 offset: usize,
4098 depth: fidl::encoding::Depth,
4099 ) -> fidl::Result<()> {
4100 encoder
4101 .debug_check_bounds::<ActivityGovernorTakeApplicationActivityLeaseResponse>(offset);
4102 self.0.encode(encoder, offset + 0, depth)?;
4106 Ok(())
4107 }
4108 }
4109
4110 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4111 for ActivityGovernorTakeApplicationActivityLeaseResponse
4112 {
4113 #[inline(always)]
4114 fn new_empty() -> Self {
4115 Self {
4116 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
4117 }
4118 }
4119
4120 #[inline]
4121 unsafe fn decode(
4122 &mut self,
4123 decoder: &mut fidl::encoding::Decoder<
4124 '_,
4125 fidl::encoding::DefaultFuchsiaResourceDialect,
4126 >,
4127 offset: usize,
4128 _depth: fidl::encoding::Depth,
4129 ) -> fidl::Result<()> {
4130 decoder.debug_check_bounds::<Self>(offset);
4131 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4133 Ok(())
4134 }
4135 }
4136
4137 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorTakeWakeLeaseResponse {
4138 type Borrowed<'a> = &'a mut Self;
4139 fn take_or_borrow<'a>(
4140 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4141 ) -> Self::Borrowed<'a> {
4142 value
4143 }
4144 }
4145
4146 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorTakeWakeLeaseResponse {
4147 type Owned = Self;
4148
4149 #[inline(always)]
4150 fn inline_align(_context: fidl::encoding::Context) -> usize {
4151 4
4152 }
4153
4154 #[inline(always)]
4155 fn inline_size(_context: fidl::encoding::Context) -> usize {
4156 4
4157 }
4158 }
4159
4160 unsafe impl
4161 fidl::encoding::Encode<
4162 ActivityGovernorTakeWakeLeaseResponse,
4163 fidl::encoding::DefaultFuchsiaResourceDialect,
4164 > for &mut ActivityGovernorTakeWakeLeaseResponse
4165 {
4166 #[inline]
4167 unsafe fn encode(
4168 self,
4169 encoder: &mut fidl::encoding::Encoder<
4170 '_,
4171 fidl::encoding::DefaultFuchsiaResourceDialect,
4172 >,
4173 offset: usize,
4174 _depth: fidl::encoding::Depth,
4175 ) -> fidl::Result<()> {
4176 encoder.debug_check_bounds::<ActivityGovernorTakeWakeLeaseResponse>(offset);
4177 fidl::encoding::Encode::<
4179 ActivityGovernorTakeWakeLeaseResponse,
4180 fidl::encoding::DefaultFuchsiaResourceDialect,
4181 >::encode(
4182 (<fidl::encoding::HandleType<
4183 fidl::EventPair,
4184 { fidl::ObjectType::EVENTPAIR.into_raw() },
4185 16387,
4186 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4187 &mut self.token
4188 ),),
4189 encoder,
4190 offset,
4191 _depth,
4192 )
4193 }
4194 }
4195 unsafe impl<
4196 T0: fidl::encoding::Encode<
4197 fidl::encoding::HandleType<
4198 fidl::EventPair,
4199 { fidl::ObjectType::EVENTPAIR.into_raw() },
4200 16387,
4201 >,
4202 fidl::encoding::DefaultFuchsiaResourceDialect,
4203 >,
4204 >
4205 fidl::encoding::Encode<
4206 ActivityGovernorTakeWakeLeaseResponse,
4207 fidl::encoding::DefaultFuchsiaResourceDialect,
4208 > for (T0,)
4209 {
4210 #[inline]
4211 unsafe fn encode(
4212 self,
4213 encoder: &mut fidl::encoding::Encoder<
4214 '_,
4215 fidl::encoding::DefaultFuchsiaResourceDialect,
4216 >,
4217 offset: usize,
4218 depth: fidl::encoding::Depth,
4219 ) -> fidl::Result<()> {
4220 encoder.debug_check_bounds::<ActivityGovernorTakeWakeLeaseResponse>(offset);
4221 self.0.encode(encoder, offset + 0, depth)?;
4225 Ok(())
4226 }
4227 }
4228
4229 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4230 for ActivityGovernorTakeWakeLeaseResponse
4231 {
4232 #[inline(always)]
4233 fn new_empty() -> Self {
4234 Self {
4235 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
4236 }
4237 }
4238
4239 #[inline]
4240 unsafe fn decode(
4241 &mut self,
4242 decoder: &mut fidl::encoding::Decoder<
4243 '_,
4244 fidl::encoding::DefaultFuchsiaResourceDialect,
4245 >,
4246 offset: usize,
4247 _depth: fidl::encoding::Depth,
4248 ) -> fidl::Result<()> {
4249 decoder.debug_check_bounds::<Self>(offset);
4250 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4252 Ok(())
4253 }
4254 }
4255
4256 impl ActivityGovernorRegisterSuspendBlockerRequest {
4257 #[inline(always)]
4258 fn max_ordinal_present(&self) -> u64 {
4259 if let Some(_) = self.name {
4260 return 2;
4261 }
4262 if let Some(_) = self.suspend_blocker {
4263 return 1;
4264 }
4265 0
4266 }
4267 }
4268
4269 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorRegisterSuspendBlockerRequest {
4270 type Borrowed<'a> = &'a mut Self;
4271 fn take_or_borrow<'a>(
4272 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4273 ) -> Self::Borrowed<'a> {
4274 value
4275 }
4276 }
4277
4278 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorRegisterSuspendBlockerRequest {
4279 type Owned = Self;
4280
4281 #[inline(always)]
4282 fn inline_align(_context: fidl::encoding::Context) -> usize {
4283 8
4284 }
4285
4286 #[inline(always)]
4287 fn inline_size(_context: fidl::encoding::Context) -> usize {
4288 16
4289 }
4290 }
4291
4292 unsafe impl
4293 fidl::encoding::Encode<
4294 ActivityGovernorRegisterSuspendBlockerRequest,
4295 fidl::encoding::DefaultFuchsiaResourceDialect,
4296 > for &mut ActivityGovernorRegisterSuspendBlockerRequest
4297 {
4298 unsafe fn encode(
4299 self,
4300 encoder: &mut fidl::encoding::Encoder<
4301 '_,
4302 fidl::encoding::DefaultFuchsiaResourceDialect,
4303 >,
4304 offset: usize,
4305 mut depth: fidl::encoding::Depth,
4306 ) -> fidl::Result<()> {
4307 encoder.debug_check_bounds::<ActivityGovernorRegisterSuspendBlockerRequest>(offset);
4308 let max_ordinal: u64 = self.max_ordinal_present();
4310 encoder.write_num(max_ordinal, offset);
4311 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4312 if max_ordinal == 0 {
4314 return Ok(());
4315 }
4316 depth.increment()?;
4317 let envelope_size = 8;
4318 let bytes_len = max_ordinal as usize * envelope_size;
4319 #[allow(unused_variables)]
4320 let offset = encoder.out_of_line_offset(bytes_len);
4321 let mut _prev_end_offset: usize = 0;
4322 if 1 > max_ordinal {
4323 return Ok(());
4324 }
4325
4326 let cur_offset: usize = (1 - 1) * envelope_size;
4329
4330 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4332
4333 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SuspendBlockerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4338 self.suspend_blocker.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SuspendBlockerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
4339 encoder, offset + cur_offset, depth
4340 )?;
4341
4342 _prev_end_offset = cur_offset + envelope_size;
4343 if 2 > max_ordinal {
4344 return Ok(());
4345 }
4346
4347 let cur_offset: usize = (2 - 1) * envelope_size;
4350
4351 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4353
4354 fidl::encoding::encode_in_envelope_optional::<
4359 fidl::encoding::BoundedString<64>,
4360 fidl::encoding::DefaultFuchsiaResourceDialect,
4361 >(
4362 self.name.as_ref().map(
4363 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
4364 ),
4365 encoder,
4366 offset + cur_offset,
4367 depth,
4368 )?;
4369
4370 _prev_end_offset = cur_offset + envelope_size;
4371
4372 Ok(())
4373 }
4374 }
4375
4376 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4377 for ActivityGovernorRegisterSuspendBlockerRequest
4378 {
4379 #[inline(always)]
4380 fn new_empty() -> Self {
4381 Self::default()
4382 }
4383
4384 unsafe fn decode(
4385 &mut self,
4386 decoder: &mut fidl::encoding::Decoder<
4387 '_,
4388 fidl::encoding::DefaultFuchsiaResourceDialect,
4389 >,
4390 offset: usize,
4391 mut depth: fidl::encoding::Depth,
4392 ) -> fidl::Result<()> {
4393 decoder.debug_check_bounds::<Self>(offset);
4394 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4395 None => return Err(fidl::Error::NotNullable),
4396 Some(len) => len,
4397 };
4398 if len == 0 {
4400 return Ok(());
4401 };
4402 depth.increment()?;
4403 let envelope_size = 8;
4404 let bytes_len = len * envelope_size;
4405 let offset = decoder.out_of_line_offset(bytes_len)?;
4406 let mut _next_ordinal_to_read = 0;
4408 let mut next_offset = offset;
4409 let end_offset = offset + bytes_len;
4410 _next_ordinal_to_read += 1;
4411 if next_offset >= end_offset {
4412 return Ok(());
4413 }
4414
4415 while _next_ordinal_to_read < 1 {
4417 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4418 _next_ordinal_to_read += 1;
4419 next_offset += envelope_size;
4420 }
4421
4422 let next_out_of_line = decoder.next_out_of_line();
4423 let handles_before = decoder.remaining_handles();
4424 if let Some((inlined, num_bytes, num_handles)) =
4425 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4426 {
4427 let member_inline_size = <fidl::encoding::Endpoint<
4428 fidl::endpoints::ClientEnd<SuspendBlockerMarker>,
4429 > as fidl::encoding::TypeMarker>::inline_size(
4430 decoder.context
4431 );
4432 if inlined != (member_inline_size <= 4) {
4433 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4434 }
4435 let inner_offset;
4436 let mut inner_depth = depth.clone();
4437 if inlined {
4438 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4439 inner_offset = next_offset;
4440 } else {
4441 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4442 inner_depth.increment()?;
4443 }
4444 let val_ref = self.suspend_blocker.get_or_insert_with(|| {
4445 fidl::new_empty!(
4446 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SuspendBlockerMarker>>,
4447 fidl::encoding::DefaultFuchsiaResourceDialect
4448 )
4449 });
4450 fidl::decode!(
4451 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SuspendBlockerMarker>>,
4452 fidl::encoding::DefaultFuchsiaResourceDialect,
4453 val_ref,
4454 decoder,
4455 inner_offset,
4456 inner_depth
4457 )?;
4458 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4459 {
4460 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4461 }
4462 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4463 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4464 }
4465 }
4466
4467 next_offset += envelope_size;
4468 _next_ordinal_to_read += 1;
4469 if next_offset >= end_offset {
4470 return Ok(());
4471 }
4472
4473 while _next_ordinal_to_read < 2 {
4475 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4476 _next_ordinal_to_read += 1;
4477 next_offset += envelope_size;
4478 }
4479
4480 let next_out_of_line = decoder.next_out_of_line();
4481 let handles_before = decoder.remaining_handles();
4482 if let Some((inlined, num_bytes, num_handles)) =
4483 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4484 {
4485 let member_inline_size =
4486 <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
4487 decoder.context,
4488 );
4489 if inlined != (member_inline_size <= 4) {
4490 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4491 }
4492 let inner_offset;
4493 let mut inner_depth = depth.clone();
4494 if inlined {
4495 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4496 inner_offset = next_offset;
4497 } else {
4498 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4499 inner_depth.increment()?;
4500 }
4501 let val_ref = self.name.get_or_insert_with(|| {
4502 fidl::new_empty!(
4503 fidl::encoding::BoundedString<64>,
4504 fidl::encoding::DefaultFuchsiaResourceDialect
4505 )
4506 });
4507 fidl::decode!(
4508 fidl::encoding::BoundedString<64>,
4509 fidl::encoding::DefaultFuchsiaResourceDialect,
4510 val_ref,
4511 decoder,
4512 inner_offset,
4513 inner_depth
4514 )?;
4515 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4516 {
4517 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4518 }
4519 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4520 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4521 }
4522 }
4523
4524 next_offset += envelope_size;
4525
4526 while next_offset < end_offset {
4528 _next_ordinal_to_read += 1;
4529 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4530 next_offset += envelope_size;
4531 }
4532
4533 Ok(())
4534 }
4535 }
4536
4537 impl ApplicationActivity {
4538 #[inline(always)]
4539 fn max_ordinal_present(&self) -> u64 {
4540 if let Some(_) = self.assertive_dependency_token {
4541 return 1;
4542 }
4543 0
4544 }
4545 }
4546
4547 impl fidl::encoding::ResourceTypeMarker for ApplicationActivity {
4548 type Borrowed<'a> = &'a mut Self;
4549 fn take_or_borrow<'a>(
4550 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4551 ) -> Self::Borrowed<'a> {
4552 value
4553 }
4554 }
4555
4556 unsafe impl fidl::encoding::TypeMarker for ApplicationActivity {
4557 type Owned = Self;
4558
4559 #[inline(always)]
4560 fn inline_align(_context: fidl::encoding::Context) -> usize {
4561 8
4562 }
4563
4564 #[inline(always)]
4565 fn inline_size(_context: fidl::encoding::Context) -> usize {
4566 16
4567 }
4568 }
4569
4570 unsafe impl
4571 fidl::encoding::Encode<ApplicationActivity, fidl::encoding::DefaultFuchsiaResourceDialect>
4572 for &mut ApplicationActivity
4573 {
4574 unsafe fn encode(
4575 self,
4576 encoder: &mut fidl::encoding::Encoder<
4577 '_,
4578 fidl::encoding::DefaultFuchsiaResourceDialect,
4579 >,
4580 offset: usize,
4581 mut depth: fidl::encoding::Depth,
4582 ) -> fidl::Result<()> {
4583 encoder.debug_check_bounds::<ApplicationActivity>(offset);
4584 let max_ordinal: u64 = self.max_ordinal_present();
4586 encoder.write_num(max_ordinal, offset);
4587 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4588 if max_ordinal == 0 {
4590 return Ok(());
4591 }
4592 depth.increment()?;
4593 let envelope_size = 8;
4594 let bytes_len = max_ordinal as usize * envelope_size;
4595 #[allow(unused_variables)]
4596 let offset = encoder.out_of_line_offset(bytes_len);
4597 let mut _prev_end_offset: usize = 0;
4598 if 1 > max_ordinal {
4599 return Ok(());
4600 }
4601
4602 let cur_offset: usize = (1 - 1) * envelope_size;
4605
4606 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4608
4609 fidl::encoding::encode_in_envelope_optional::<
4614 fidl::encoding::HandleType<
4615 fidl::Event,
4616 { fidl::ObjectType::EVENT.into_raw() },
4617 2147483648,
4618 >,
4619 fidl::encoding::DefaultFuchsiaResourceDialect,
4620 >(
4621 self.assertive_dependency_token.as_mut().map(
4622 <fidl::encoding::HandleType<
4623 fidl::Event,
4624 { fidl::ObjectType::EVENT.into_raw() },
4625 2147483648,
4626 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4627 ),
4628 encoder,
4629 offset + cur_offset,
4630 depth,
4631 )?;
4632
4633 _prev_end_offset = cur_offset + envelope_size;
4634
4635 Ok(())
4636 }
4637 }
4638
4639 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4640 for ApplicationActivity
4641 {
4642 #[inline(always)]
4643 fn new_empty() -> Self {
4644 Self::default()
4645 }
4646
4647 unsafe fn decode(
4648 &mut self,
4649 decoder: &mut fidl::encoding::Decoder<
4650 '_,
4651 fidl::encoding::DefaultFuchsiaResourceDialect,
4652 >,
4653 offset: usize,
4654 mut depth: fidl::encoding::Depth,
4655 ) -> fidl::Result<()> {
4656 decoder.debug_check_bounds::<Self>(offset);
4657 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4658 None => return Err(fidl::Error::NotNullable),
4659 Some(len) => len,
4660 };
4661 if len == 0 {
4663 return Ok(());
4664 };
4665 depth.increment()?;
4666 let envelope_size = 8;
4667 let bytes_len = len * envelope_size;
4668 let offset = decoder.out_of_line_offset(bytes_len)?;
4669 let mut _next_ordinal_to_read = 0;
4671 let mut next_offset = offset;
4672 let end_offset = offset + bytes_len;
4673 _next_ordinal_to_read += 1;
4674 if next_offset >= end_offset {
4675 return Ok(());
4676 }
4677
4678 while _next_ordinal_to_read < 1 {
4680 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4681 _next_ordinal_to_read += 1;
4682 next_offset += envelope_size;
4683 }
4684
4685 let next_out_of_line = decoder.next_out_of_line();
4686 let handles_before = decoder.remaining_handles();
4687 if let Some((inlined, num_bytes, num_handles)) =
4688 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4689 {
4690 let member_inline_size = <fidl::encoding::HandleType<
4691 fidl::Event,
4692 { fidl::ObjectType::EVENT.into_raw() },
4693 2147483648,
4694 > as fidl::encoding::TypeMarker>::inline_size(
4695 decoder.context
4696 );
4697 if inlined != (member_inline_size <= 4) {
4698 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4699 }
4700 let inner_offset;
4701 let mut inner_depth = depth.clone();
4702 if inlined {
4703 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4704 inner_offset = next_offset;
4705 } else {
4706 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4707 inner_depth.increment()?;
4708 }
4709 let val_ref =
4710 self.assertive_dependency_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4711 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4712 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4713 {
4714 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4715 }
4716 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4717 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4718 }
4719 }
4720
4721 next_offset += envelope_size;
4722
4723 while next_offset < end_offset {
4725 _next_ordinal_to_read += 1;
4726 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4727 next_offset += envelope_size;
4728 }
4729
4730 Ok(())
4731 }
4732 }
4733
4734 impl Cpu {
4735 #[inline(always)]
4736 fn max_ordinal_present(&self) -> u64 {
4737 if let Some(_) = self.assertive_dependency_token {
4738 return 1;
4739 }
4740 0
4741 }
4742 }
4743
4744 impl fidl::encoding::ResourceTypeMarker for Cpu {
4745 type Borrowed<'a> = &'a mut Self;
4746 fn take_or_borrow<'a>(
4747 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4748 ) -> Self::Borrowed<'a> {
4749 value
4750 }
4751 }
4752
4753 unsafe impl fidl::encoding::TypeMarker for Cpu {
4754 type Owned = Self;
4755
4756 #[inline(always)]
4757 fn inline_align(_context: fidl::encoding::Context) -> usize {
4758 8
4759 }
4760
4761 #[inline(always)]
4762 fn inline_size(_context: fidl::encoding::Context) -> usize {
4763 16
4764 }
4765 }
4766
4767 unsafe impl fidl::encoding::Encode<Cpu, fidl::encoding::DefaultFuchsiaResourceDialect>
4768 for &mut Cpu
4769 {
4770 unsafe fn encode(
4771 self,
4772 encoder: &mut fidl::encoding::Encoder<
4773 '_,
4774 fidl::encoding::DefaultFuchsiaResourceDialect,
4775 >,
4776 offset: usize,
4777 mut depth: fidl::encoding::Depth,
4778 ) -> fidl::Result<()> {
4779 encoder.debug_check_bounds::<Cpu>(offset);
4780 let max_ordinal: u64 = self.max_ordinal_present();
4782 encoder.write_num(max_ordinal, offset);
4783 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4784 if max_ordinal == 0 {
4786 return Ok(());
4787 }
4788 depth.increment()?;
4789 let envelope_size = 8;
4790 let bytes_len = max_ordinal as usize * envelope_size;
4791 #[allow(unused_variables)]
4792 let offset = encoder.out_of_line_offset(bytes_len);
4793 let mut _prev_end_offset: usize = 0;
4794 if 1 > max_ordinal {
4795 return Ok(());
4796 }
4797
4798 let cur_offset: usize = (1 - 1) * envelope_size;
4801
4802 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4804
4805 fidl::encoding::encode_in_envelope_optional::<
4810 fidl::encoding::HandleType<
4811 fidl::Event,
4812 { fidl::ObjectType::EVENT.into_raw() },
4813 2147483648,
4814 >,
4815 fidl::encoding::DefaultFuchsiaResourceDialect,
4816 >(
4817 self.assertive_dependency_token.as_mut().map(
4818 <fidl::encoding::HandleType<
4819 fidl::Event,
4820 { fidl::ObjectType::EVENT.into_raw() },
4821 2147483648,
4822 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4823 ),
4824 encoder,
4825 offset + cur_offset,
4826 depth,
4827 )?;
4828
4829 _prev_end_offset = cur_offset + envelope_size;
4830
4831 Ok(())
4832 }
4833 }
4834
4835 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Cpu {
4836 #[inline(always)]
4837 fn new_empty() -> Self {
4838 Self::default()
4839 }
4840
4841 unsafe fn decode(
4842 &mut self,
4843 decoder: &mut fidl::encoding::Decoder<
4844 '_,
4845 fidl::encoding::DefaultFuchsiaResourceDialect,
4846 >,
4847 offset: usize,
4848 mut depth: fidl::encoding::Depth,
4849 ) -> fidl::Result<()> {
4850 decoder.debug_check_bounds::<Self>(offset);
4851 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4852 None => return Err(fidl::Error::NotNullable),
4853 Some(len) => len,
4854 };
4855 if len == 0 {
4857 return Ok(());
4858 };
4859 depth.increment()?;
4860 let envelope_size = 8;
4861 let bytes_len = len * envelope_size;
4862 let offset = decoder.out_of_line_offset(bytes_len)?;
4863 let mut _next_ordinal_to_read = 0;
4865 let mut next_offset = offset;
4866 let end_offset = offset + bytes_len;
4867 _next_ordinal_to_read += 1;
4868 if next_offset >= end_offset {
4869 return Ok(());
4870 }
4871
4872 while _next_ordinal_to_read < 1 {
4874 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4875 _next_ordinal_to_read += 1;
4876 next_offset += envelope_size;
4877 }
4878
4879 let next_out_of_line = decoder.next_out_of_line();
4880 let handles_before = decoder.remaining_handles();
4881 if let Some((inlined, num_bytes, num_handles)) =
4882 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4883 {
4884 let member_inline_size = <fidl::encoding::HandleType<
4885 fidl::Event,
4886 { fidl::ObjectType::EVENT.into_raw() },
4887 2147483648,
4888 > as fidl::encoding::TypeMarker>::inline_size(
4889 decoder.context
4890 );
4891 if inlined != (member_inline_size <= 4) {
4892 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4893 }
4894 let inner_offset;
4895 let mut inner_depth = depth.clone();
4896 if inlined {
4897 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4898 inner_offset = next_offset;
4899 } else {
4900 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4901 inner_depth.increment()?;
4902 }
4903 let val_ref =
4904 self.assertive_dependency_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4905 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4906 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4907 {
4908 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4909 }
4910 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4911 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4912 }
4913 }
4914
4915 next_offset += envelope_size;
4916
4917 while next_offset < end_offset {
4919 _next_ordinal_to_read += 1;
4920 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4921 next_offset += envelope_size;
4922 }
4923
4924 Ok(())
4925 }
4926 }
4927
4928 impl CpuElementManagerAddExecutionStateDependencyRequest {
4929 #[inline(always)]
4930 fn max_ordinal_present(&self) -> u64 {
4931 if let Some(_) = self.power_level {
4932 return 2;
4933 }
4934 if let Some(_) = self.dependency_token {
4935 return 1;
4936 }
4937 0
4938 }
4939 }
4940
4941 impl fidl::encoding::ResourceTypeMarker for CpuElementManagerAddExecutionStateDependencyRequest {
4942 type Borrowed<'a> = &'a mut Self;
4943 fn take_or_borrow<'a>(
4944 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4945 ) -> Self::Borrowed<'a> {
4946 value
4947 }
4948 }
4949
4950 unsafe impl fidl::encoding::TypeMarker for CpuElementManagerAddExecutionStateDependencyRequest {
4951 type Owned = Self;
4952
4953 #[inline(always)]
4954 fn inline_align(_context: fidl::encoding::Context) -> usize {
4955 8
4956 }
4957
4958 #[inline(always)]
4959 fn inline_size(_context: fidl::encoding::Context) -> usize {
4960 16
4961 }
4962 }
4963
4964 unsafe impl
4965 fidl::encoding::Encode<
4966 CpuElementManagerAddExecutionStateDependencyRequest,
4967 fidl::encoding::DefaultFuchsiaResourceDialect,
4968 > for &mut CpuElementManagerAddExecutionStateDependencyRequest
4969 {
4970 unsafe fn encode(
4971 self,
4972 encoder: &mut fidl::encoding::Encoder<
4973 '_,
4974 fidl::encoding::DefaultFuchsiaResourceDialect,
4975 >,
4976 offset: usize,
4977 mut depth: fidl::encoding::Depth,
4978 ) -> fidl::Result<()> {
4979 encoder
4980 .debug_check_bounds::<CpuElementManagerAddExecutionStateDependencyRequest>(offset);
4981 let max_ordinal: u64 = self.max_ordinal_present();
4983 encoder.write_num(max_ordinal, offset);
4984 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4985 if max_ordinal == 0 {
4987 return Ok(());
4988 }
4989 depth.increment()?;
4990 let envelope_size = 8;
4991 let bytes_len = max_ordinal as usize * envelope_size;
4992 #[allow(unused_variables)]
4993 let offset = encoder.out_of_line_offset(bytes_len);
4994 let mut _prev_end_offset: usize = 0;
4995 if 1 > max_ordinal {
4996 return Ok(());
4997 }
4998
4999 let cur_offset: usize = (1 - 1) * envelope_size;
5002
5003 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5005
5006 fidl::encoding::encode_in_envelope_optional::<
5011 fidl::encoding::HandleType<
5012 fidl::Event,
5013 { fidl::ObjectType::EVENT.into_raw() },
5014 2147483648,
5015 >,
5016 fidl::encoding::DefaultFuchsiaResourceDialect,
5017 >(
5018 self.dependency_token.as_mut().map(
5019 <fidl::encoding::HandleType<
5020 fidl::Event,
5021 { fidl::ObjectType::EVENT.into_raw() },
5022 2147483648,
5023 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5024 ),
5025 encoder,
5026 offset + cur_offset,
5027 depth,
5028 )?;
5029
5030 _prev_end_offset = cur_offset + envelope_size;
5031 if 2 > max_ordinal {
5032 return Ok(());
5033 }
5034
5035 let cur_offset: usize = (2 - 1) * envelope_size;
5038
5039 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5041
5042 fidl::encoding::encode_in_envelope_optional::<
5047 u8,
5048 fidl::encoding::DefaultFuchsiaResourceDialect,
5049 >(
5050 self.power_level.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
5051 encoder,
5052 offset + cur_offset,
5053 depth,
5054 )?;
5055
5056 _prev_end_offset = cur_offset + envelope_size;
5057
5058 Ok(())
5059 }
5060 }
5061
5062 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5063 for CpuElementManagerAddExecutionStateDependencyRequest
5064 {
5065 #[inline(always)]
5066 fn new_empty() -> Self {
5067 Self::default()
5068 }
5069
5070 unsafe fn decode(
5071 &mut self,
5072 decoder: &mut fidl::encoding::Decoder<
5073 '_,
5074 fidl::encoding::DefaultFuchsiaResourceDialect,
5075 >,
5076 offset: usize,
5077 mut depth: fidl::encoding::Depth,
5078 ) -> fidl::Result<()> {
5079 decoder.debug_check_bounds::<Self>(offset);
5080 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5081 None => return Err(fidl::Error::NotNullable),
5082 Some(len) => len,
5083 };
5084 if len == 0 {
5086 return Ok(());
5087 };
5088 depth.increment()?;
5089 let envelope_size = 8;
5090 let bytes_len = len * envelope_size;
5091 let offset = decoder.out_of_line_offset(bytes_len)?;
5092 let mut _next_ordinal_to_read = 0;
5094 let mut next_offset = offset;
5095 let end_offset = offset + bytes_len;
5096 _next_ordinal_to_read += 1;
5097 if next_offset >= end_offset {
5098 return Ok(());
5099 }
5100
5101 while _next_ordinal_to_read < 1 {
5103 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5104 _next_ordinal_to_read += 1;
5105 next_offset += envelope_size;
5106 }
5107
5108 let next_out_of_line = decoder.next_out_of_line();
5109 let handles_before = decoder.remaining_handles();
5110 if let Some((inlined, num_bytes, num_handles)) =
5111 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5112 {
5113 let member_inline_size = <fidl::encoding::HandleType<
5114 fidl::Event,
5115 { fidl::ObjectType::EVENT.into_raw() },
5116 2147483648,
5117 > as fidl::encoding::TypeMarker>::inline_size(
5118 decoder.context
5119 );
5120 if inlined != (member_inline_size <= 4) {
5121 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5122 }
5123 let inner_offset;
5124 let mut inner_depth = depth.clone();
5125 if inlined {
5126 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5127 inner_offset = next_offset;
5128 } else {
5129 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5130 inner_depth.increment()?;
5131 }
5132 let val_ref =
5133 self.dependency_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
5134 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5135 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5136 {
5137 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5138 }
5139 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5140 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5141 }
5142 }
5143
5144 next_offset += envelope_size;
5145 _next_ordinal_to_read += 1;
5146 if next_offset >= end_offset {
5147 return Ok(());
5148 }
5149
5150 while _next_ordinal_to_read < 2 {
5152 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5153 _next_ordinal_to_read += 1;
5154 next_offset += envelope_size;
5155 }
5156
5157 let next_out_of_line = decoder.next_out_of_line();
5158 let handles_before = decoder.remaining_handles();
5159 if let Some((inlined, num_bytes, num_handles)) =
5160 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5161 {
5162 let member_inline_size =
5163 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5164 if inlined != (member_inline_size <= 4) {
5165 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5166 }
5167 let inner_offset;
5168 let mut inner_depth = depth.clone();
5169 if inlined {
5170 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5171 inner_offset = next_offset;
5172 } else {
5173 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5174 inner_depth.increment()?;
5175 }
5176 let val_ref = self.power_level.get_or_insert_with(|| {
5177 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
5178 });
5179 fidl::decode!(
5180 u8,
5181 fidl::encoding::DefaultFuchsiaResourceDialect,
5182 val_ref,
5183 decoder,
5184 inner_offset,
5185 inner_depth
5186 )?;
5187 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5188 {
5189 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5190 }
5191 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5192 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5193 }
5194 }
5195
5196 next_offset += envelope_size;
5197
5198 while next_offset < end_offset {
5200 _next_ordinal_to_read += 1;
5201 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5202 next_offset += envelope_size;
5203 }
5204
5205 Ok(())
5206 }
5207 }
5208
5209 impl PowerElements {
5210 #[inline(always)]
5211 fn max_ordinal_present(&self) -> u64 {
5212 if let Some(_) = self.application_activity {
5213 return 3;
5214 }
5215 0
5216 }
5217 }
5218
5219 impl fidl::encoding::ResourceTypeMarker for PowerElements {
5220 type Borrowed<'a> = &'a mut Self;
5221 fn take_or_borrow<'a>(
5222 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5223 ) -> Self::Borrowed<'a> {
5224 value
5225 }
5226 }
5227
5228 unsafe impl fidl::encoding::TypeMarker for PowerElements {
5229 type Owned = Self;
5230
5231 #[inline(always)]
5232 fn inline_align(_context: fidl::encoding::Context) -> usize {
5233 8
5234 }
5235
5236 #[inline(always)]
5237 fn inline_size(_context: fidl::encoding::Context) -> usize {
5238 16
5239 }
5240 }
5241
5242 unsafe impl fidl::encoding::Encode<PowerElements, fidl::encoding::DefaultFuchsiaResourceDialect>
5243 for &mut PowerElements
5244 {
5245 unsafe fn encode(
5246 self,
5247 encoder: &mut fidl::encoding::Encoder<
5248 '_,
5249 fidl::encoding::DefaultFuchsiaResourceDialect,
5250 >,
5251 offset: usize,
5252 mut depth: fidl::encoding::Depth,
5253 ) -> fidl::Result<()> {
5254 encoder.debug_check_bounds::<PowerElements>(offset);
5255 let max_ordinal: u64 = self.max_ordinal_present();
5257 encoder.write_num(max_ordinal, offset);
5258 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5259 if max_ordinal == 0 {
5261 return Ok(());
5262 }
5263 depth.increment()?;
5264 let envelope_size = 8;
5265 let bytes_len = max_ordinal as usize * envelope_size;
5266 #[allow(unused_variables)]
5267 let offset = encoder.out_of_line_offset(bytes_len);
5268 let mut _prev_end_offset: usize = 0;
5269 if 3 > max_ordinal {
5270 return Ok(());
5271 }
5272
5273 let cur_offset: usize = (3 - 1) * envelope_size;
5276
5277 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5279
5280 fidl::encoding::encode_in_envelope_optional::<
5285 ApplicationActivity,
5286 fidl::encoding::DefaultFuchsiaResourceDialect,
5287 >(
5288 self.application_activity.as_mut().map(
5289 <ApplicationActivity as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5290 ),
5291 encoder,
5292 offset + cur_offset,
5293 depth,
5294 )?;
5295
5296 _prev_end_offset = cur_offset + envelope_size;
5297
5298 Ok(())
5299 }
5300 }
5301
5302 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PowerElements {
5303 #[inline(always)]
5304 fn new_empty() -> Self {
5305 Self::default()
5306 }
5307
5308 unsafe fn decode(
5309 &mut self,
5310 decoder: &mut fidl::encoding::Decoder<
5311 '_,
5312 fidl::encoding::DefaultFuchsiaResourceDialect,
5313 >,
5314 offset: usize,
5315 mut depth: fidl::encoding::Depth,
5316 ) -> fidl::Result<()> {
5317 decoder.debug_check_bounds::<Self>(offset);
5318 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5319 None => return Err(fidl::Error::NotNullable),
5320 Some(len) => len,
5321 };
5322 if len == 0 {
5324 return Ok(());
5325 };
5326 depth.increment()?;
5327 let envelope_size = 8;
5328 let bytes_len = len * envelope_size;
5329 let offset = decoder.out_of_line_offset(bytes_len)?;
5330 let mut _next_ordinal_to_read = 0;
5332 let mut next_offset = offset;
5333 let end_offset = offset + bytes_len;
5334 _next_ordinal_to_read += 1;
5335 if next_offset >= end_offset {
5336 return Ok(());
5337 }
5338
5339 while _next_ordinal_to_read < 3 {
5341 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5342 _next_ordinal_to_read += 1;
5343 next_offset += envelope_size;
5344 }
5345
5346 let next_out_of_line = decoder.next_out_of_line();
5347 let handles_before = decoder.remaining_handles();
5348 if let Some((inlined, num_bytes, num_handles)) =
5349 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5350 {
5351 let member_inline_size =
5352 <ApplicationActivity as fidl::encoding::TypeMarker>::inline_size(
5353 decoder.context,
5354 );
5355 if inlined != (member_inline_size <= 4) {
5356 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5357 }
5358 let inner_offset;
5359 let mut inner_depth = depth.clone();
5360 if inlined {
5361 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5362 inner_offset = next_offset;
5363 } else {
5364 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5365 inner_depth.increment()?;
5366 }
5367 let val_ref = self.application_activity.get_or_insert_with(|| {
5368 fidl::new_empty!(
5369 ApplicationActivity,
5370 fidl::encoding::DefaultFuchsiaResourceDialect
5371 )
5372 });
5373 fidl::decode!(
5374 ApplicationActivity,
5375 fidl::encoding::DefaultFuchsiaResourceDialect,
5376 val_ref,
5377 decoder,
5378 inner_offset,
5379 inner_depth
5380 )?;
5381 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5382 {
5383 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5384 }
5385 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5386 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5387 }
5388 }
5389
5390 next_offset += envelope_size;
5391
5392 while next_offset < end_offset {
5394 _next_ordinal_to_read += 1;
5395 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5396 next_offset += envelope_size;
5397 }
5398
5399 Ok(())
5400 }
5401 }
5402}