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