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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13pub type LeaseToken = fidl::EventPair;
14
15pub const MAX_ELEMENT_NAME_LEN: u8 = 64;
16
17#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
19pub enum AcquireWakeLeaseError {
20 Internal,
22 InvalidName,
24 #[doc(hidden)]
25 __SourceBreaking { unknown_ordinal: u32 },
26}
27
28#[macro_export]
30macro_rules! AcquireWakeLeaseErrorUnknown {
31 () => {
32 _
33 };
34}
35
36impl AcquireWakeLeaseError {
37 #[inline]
38 pub fn from_primitive(prim: u32) -> Option<Self> {
39 match prim {
40 1 => Some(Self::Internal),
41 2 => Some(Self::InvalidName),
42 _ => None,
43 }
44 }
45
46 #[inline]
47 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
48 match prim {
49 1 => Self::Internal,
50 2 => Self::InvalidName,
51 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
52 }
53 }
54
55 #[inline]
56 pub fn unknown() -> Self {
57 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
58 }
59
60 #[inline]
61 pub const fn into_primitive(self) -> u32 {
62 match self {
63 Self::Internal => 1,
64 Self::InvalidName => 2,
65 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
66 }
67 }
68
69 #[inline]
70 pub fn is_unknown(&self) -> bool {
71 match self {
72 Self::__SourceBreaking { unknown_ordinal: _ } => true,
73 _ => false,
74 }
75 }
76}
77
78#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
81pub enum AddExecutionStateDependencyError {
82 InvalidArgs,
84 BadState,
86 #[doc(hidden)]
87 __SourceBreaking { unknown_ordinal: u32 },
88}
89
90#[macro_export]
92macro_rules! AddExecutionStateDependencyErrorUnknown {
93 () => {
94 _
95 };
96}
97
98impl AddExecutionStateDependencyError {
99 #[inline]
100 pub fn from_primitive(prim: u32) -> Option<Self> {
101 match prim {
102 1 => Some(Self::InvalidArgs),
103 2 => Some(Self::BadState),
104 _ => None,
105 }
106 }
107
108 #[inline]
109 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
110 match prim {
111 1 => Self::InvalidArgs,
112 2 => Self::BadState,
113 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
114 }
115 }
116
117 #[inline]
118 pub fn unknown() -> Self {
119 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
120 }
121
122 #[inline]
123 pub const fn into_primitive(self) -> u32 {
124 match self {
125 Self::InvalidArgs => 1,
126 Self::BadState => 2,
127 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
128 }
129 }
130
131 #[inline]
132 pub fn is_unknown(&self) -> bool {
133 match self {
134 Self::__SourceBreaking { unknown_ordinal: _ } => true,
135 _ => false,
136 }
137 }
138}
139
140#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
147pub enum ApplicationActivityLevel {
148 Inactive,
149 Active,
150 #[doc(hidden)]
151 __SourceBreaking {
152 unknown_ordinal: u8,
153 },
154}
155
156#[macro_export]
158macro_rules! ApplicationActivityLevelUnknown {
159 () => {
160 _
161 };
162}
163
164impl ApplicationActivityLevel {
165 #[inline]
166 pub fn from_primitive(prim: u8) -> Option<Self> {
167 match prim {
168 0 => Some(Self::Inactive),
169 1 => Some(Self::Active),
170 _ => None,
171 }
172 }
173
174 #[inline]
175 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
176 match prim {
177 0 => Self::Inactive,
178 1 => Self::Active,
179 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
180 }
181 }
182
183 #[inline]
184 pub fn unknown() -> Self {
185 Self::__SourceBreaking { unknown_ordinal: 0xff }
186 }
187
188 #[inline]
189 pub const fn into_primitive(self) -> u8 {
190 match self {
191 Self::Inactive => 0,
192 Self::Active => 1,
193 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
194 }
195 }
196
197 #[inline]
198 pub fn is_unknown(&self) -> bool {
199 match self {
200 Self::__SourceBreaking { unknown_ordinal: _ } => true,
201 _ => false,
202 }
203 }
204}
205
206#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
211pub enum CpuLevel {
212 Inactive,
213 Active,
214 #[doc(hidden)]
215 __SourceBreaking {
216 unknown_ordinal: u8,
217 },
218}
219
220#[macro_export]
222macro_rules! CpuLevelUnknown {
223 () => {
224 _
225 };
226}
227
228impl CpuLevel {
229 #[inline]
230 pub fn from_primitive(prim: u8) -> Option<Self> {
231 match prim {
232 0 => Some(Self::Inactive),
233 1 => Some(Self::Active),
234 _ => None,
235 }
236 }
237
238 #[inline]
239 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
240 match prim {
241 0 => Self::Inactive,
242 1 => Self::Active,
243 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
244 }
245 }
246
247 #[inline]
248 pub fn unknown() -> Self {
249 Self::__SourceBreaking { unknown_ordinal: 0xff }
250 }
251
252 #[inline]
253 pub const fn into_primitive(self) -> u8 {
254 match self {
255 Self::Inactive => 0,
256 Self::Active => 1,
257 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
258 }
259 }
260
261 #[inline]
262 pub fn is_unknown(&self) -> bool {
263 match self {
264 Self::__SourceBreaking { unknown_ordinal: _ } => true,
265 _ => false,
266 }
267 }
268}
269
270#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
282pub enum ExecutionStateLevel {
283 Inactive,
284 Suspending,
285 Active,
286 #[doc(hidden)]
287 __SourceBreaking {
288 unknown_ordinal: u8,
289 },
290}
291
292#[macro_export]
294macro_rules! ExecutionStateLevelUnknown {
295 () => {
296 _
297 };
298}
299
300impl ExecutionStateLevel {
301 #[inline]
302 pub fn from_primitive(prim: u8) -> Option<Self> {
303 match prim {
304 0 => Some(Self::Inactive),
305 1 => Some(Self::Suspending),
306 2 => Some(Self::Active),
307 _ => None,
308 }
309 }
310
311 #[inline]
312 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
313 match prim {
314 0 => Self::Inactive,
315 1 => Self::Suspending,
316 2 => Self::Active,
317 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
318 }
319 }
320
321 #[inline]
322 pub fn unknown() -> Self {
323 Self::__SourceBreaking { unknown_ordinal: 0xff }
324 }
325
326 #[inline]
327 pub const fn into_primitive(self) -> u8 {
328 match self {
329 Self::Inactive => 0,
330 Self::Suspending => 1,
331 Self::Active => 2,
332 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
333 }
334 }
335
336 #[inline]
337 pub fn is_unknown(&self) -> bool {
338 match self {
339 Self::__SourceBreaking { unknown_ordinal: _ } => true,
340 _ => false,
341 }
342 }
343}
344
345#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
346pub struct ActivityGovernorAcquireWakeLeaseRequest {
347 pub name: String,
351}
352
353impl fidl::Persistable for ActivityGovernorAcquireWakeLeaseRequest {}
354
355#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
356pub struct ActivityGovernorTakeApplicationActivityLeaseRequest {
357 pub name: String,
361}
362
363impl fidl::Persistable for ActivityGovernorTakeApplicationActivityLeaseRequest {}
364
365#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
366pub struct ActivityGovernorTakeWakeLeaseRequest {
367 pub name: String,
371}
372
373impl fidl::Persistable for ActivityGovernorTakeWakeLeaseRequest {}
374
375#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
376pub struct ActivityGovernorAcquireWakeLeaseResponse {
377 pub token: fidl::EventPair,
379}
380
381impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
382 for ActivityGovernorAcquireWakeLeaseResponse
383{
384}
385
386#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
387pub struct ActivityGovernorTakeApplicationActivityLeaseResponse {
388 pub token: fidl::EventPair,
391}
392
393impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
394 for ActivityGovernorTakeApplicationActivityLeaseResponse
395{
396}
397
398#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
399pub struct ActivityGovernorTakeWakeLeaseResponse {
400 pub token: fidl::EventPair,
402}
403
404impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
405 for ActivityGovernorTakeWakeLeaseResponse
406{
407}
408
409#[derive(Debug, Default, PartialEq)]
410pub struct ActivityGovernorRegisterListenerRequest {
411 pub listener: Option<fidl::endpoints::ClientEnd<ActivityGovernorListenerMarker>>,
415 #[doc(hidden)]
416 pub __source_breaking: fidl::marker::SourceBreaking,
417}
418
419impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
420 for ActivityGovernorRegisterListenerRequest
421{
422}
423
424#[derive(Debug, Default, PartialEq)]
428pub struct ApplicationActivity {
429 pub assertive_dependency_token: Option<fidl::Event>,
430 #[doc(hidden)]
431 pub __source_breaking: fidl::marker::SourceBreaking,
432}
433
434impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ApplicationActivity {}
435
436#[derive(Debug, Default, PartialEq)]
440pub struct Cpu {
441 pub assertive_dependency_token: Option<fidl::Event>,
442 #[doc(hidden)]
443 pub __source_breaking: fidl::marker::SourceBreaking,
444}
445
446impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Cpu {}
447
448#[derive(Debug, Default, PartialEq)]
449pub struct CpuElementManagerAddExecutionStateDependencyRequest {
450 pub dependency_token: Option<fidl::Event>,
454 pub power_level: Option<u8>,
457 #[doc(hidden)]
458 pub __source_breaking: fidl::marker::SourceBreaking,
459}
460
461impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
462 for CpuElementManagerAddExecutionStateDependencyRequest
463{
464}
465
466#[derive(Debug, Default, PartialEq)]
475pub struct ExecutionState {
476 pub opportunistic_dependency_token: Option<fidl::Event>,
477 #[doc(hidden)]
478 pub __source_breaking: fidl::marker::SourceBreaking,
479}
480
481impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ExecutionState {}
482
483#[derive(Debug, Default, PartialEq)]
485pub struct PowerElements {
486 pub execution_state: Option<ExecutionState>,
487 pub application_activity: Option<ApplicationActivity>,
488 #[doc(hidden)]
489 pub __source_breaking: fidl::marker::SourceBreaking,
490}
491
492impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PowerElements {}
493
494#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
495pub struct ActivityGovernorMarker;
496
497impl fidl::endpoints::ProtocolMarker for ActivityGovernorMarker {
498 type Proxy = ActivityGovernorProxy;
499 type RequestStream = ActivityGovernorRequestStream;
500 #[cfg(target_os = "fuchsia")]
501 type SynchronousProxy = ActivityGovernorSynchronousProxy;
502
503 const DEBUG_NAME: &'static str = "fuchsia.power.system.ActivityGovernor";
504}
505impl fidl::endpoints::DiscoverableProtocolMarker for ActivityGovernorMarker {}
506pub type ActivityGovernorAcquireWakeLeaseResult = Result<fidl::EventPair, AcquireWakeLeaseError>;
507
508pub trait ActivityGovernorProxyInterface: Send + Sync {
509 type GetPowerElementsResponseFut: std::future::Future<Output = Result<PowerElements, fidl::Error>>
510 + Send;
511 fn r#get_power_elements(&self) -> Self::GetPowerElementsResponseFut;
512 type TakeWakeLeaseResponseFut: std::future::Future<Output = Result<fidl::EventPair, fidl::Error>>
513 + Send;
514 fn r#take_wake_lease(&self, name: &str) -> Self::TakeWakeLeaseResponseFut;
515 type AcquireWakeLeaseResponseFut: std::future::Future<Output = Result<ActivityGovernorAcquireWakeLeaseResult, fidl::Error>>
516 + Send;
517 fn r#acquire_wake_lease(&self, name: &str) -> Self::AcquireWakeLeaseResponseFut;
518 type TakeApplicationActivityLeaseResponseFut: std::future::Future<Output = Result<fidl::EventPair, fidl::Error>>
519 + Send;
520 fn r#take_application_activity_lease(
521 &self,
522 name: &str,
523 ) -> Self::TakeApplicationActivityLeaseResponseFut;
524 type RegisterListenerResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
525 fn r#register_listener(
526 &self,
527 payload: ActivityGovernorRegisterListenerRequest,
528 ) -> Self::RegisterListenerResponseFut;
529}
530#[derive(Debug)]
531#[cfg(target_os = "fuchsia")]
532pub struct ActivityGovernorSynchronousProxy {
533 client: fidl::client::sync::Client,
534}
535
536#[cfg(target_os = "fuchsia")]
537impl fidl::endpoints::SynchronousProxy for ActivityGovernorSynchronousProxy {
538 type Proxy = ActivityGovernorProxy;
539 type Protocol = ActivityGovernorMarker;
540
541 fn from_channel(inner: fidl::Channel) -> Self {
542 Self::new(inner)
543 }
544
545 fn into_channel(self) -> fidl::Channel {
546 self.client.into_channel()
547 }
548
549 fn as_channel(&self) -> &fidl::Channel {
550 self.client.as_channel()
551 }
552}
553
554#[cfg(target_os = "fuchsia")]
555impl ActivityGovernorSynchronousProxy {
556 pub fn new(channel: fidl::Channel) -> Self {
557 let protocol_name = <ActivityGovernorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
558 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
559 }
560
561 pub fn into_channel(self) -> fidl::Channel {
562 self.client.into_channel()
563 }
564
565 pub fn wait_for_event(
568 &self,
569 deadline: zx::MonotonicInstant,
570 ) -> Result<ActivityGovernorEvent, fidl::Error> {
571 ActivityGovernorEvent::decode(self.client.wait_for_event(deadline)?)
572 }
573
574 pub fn r#get_power_elements(
581 &self,
582 ___deadline: zx::MonotonicInstant,
583 ) -> Result<PowerElements, fidl::Error> {
584 let _response = self.client.send_query::<
585 fidl::encoding::EmptyPayload,
586 fidl::encoding::FlexibleType<PowerElements>,
587 >(
588 (),
589 0x798003259dfb5672,
590 fidl::encoding::DynamicFlags::FLEXIBLE,
591 ___deadline,
592 )?
593 .into_result::<ActivityGovernorMarker>("get_power_elements")?;
594 Ok(_response)
595 }
596
597 pub fn r#take_wake_lease(
606 &self,
607 mut name: &str,
608 ___deadline: zx::MonotonicInstant,
609 ) -> Result<fidl::EventPair, fidl::Error> {
610 let _response = self.client.send_query::<
611 ActivityGovernorTakeWakeLeaseRequest,
612 fidl::encoding::FlexibleType<ActivityGovernorTakeWakeLeaseResponse>,
613 >(
614 (name,),
615 0x291cfb42b2d3bf69,
616 fidl::encoding::DynamicFlags::FLEXIBLE,
617 ___deadline,
618 )?
619 .into_result::<ActivityGovernorMarker>("take_wake_lease")?;
620 Ok(_response.token)
621 }
622
623 pub fn r#acquire_wake_lease(
628 &self,
629 mut name: &str,
630 ___deadline: zx::MonotonicInstant,
631 ) -> Result<ActivityGovernorAcquireWakeLeaseResult, fidl::Error> {
632 let _response = self.client.send_query::<
633 ActivityGovernorAcquireWakeLeaseRequest,
634 fidl::encoding::FlexibleResultType<ActivityGovernorAcquireWakeLeaseResponse, AcquireWakeLeaseError>,
635 >(
636 (name,),
637 0x2de25abd8fa7c103,
638 fidl::encoding::DynamicFlags::FLEXIBLE,
639 ___deadline,
640 )?
641 .into_result::<ActivityGovernorMarker>("acquire_wake_lease")?;
642 Ok(_response.map(|x| x.token))
643 }
644
645 pub fn r#take_application_activity_lease(
656 &self,
657 mut name: &str,
658 ___deadline: zx::MonotonicInstant,
659 ) -> Result<fidl::EventPair, fidl::Error> {
660 let _response = self.client.send_query::<
661 ActivityGovernorTakeApplicationActivityLeaseRequest,
662 fidl::encoding::FlexibleType<ActivityGovernorTakeApplicationActivityLeaseResponse>,
663 >(
664 (name,),
665 0x37cd5364de7ada14,
666 fidl::encoding::DynamicFlags::FLEXIBLE,
667 ___deadline,
668 )?
669 .into_result::<ActivityGovernorMarker>("take_application_activity_lease")?;
670 Ok(_response.token)
671 }
672
673 pub fn r#register_listener(
681 &self,
682 mut payload: ActivityGovernorRegisterListenerRequest,
683 ___deadline: zx::MonotonicInstant,
684 ) -> Result<(), fidl::Error> {
685 let _response = self.client.send_query::<
686 ActivityGovernorRegisterListenerRequest,
687 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
688 >(
689 &mut payload,
690 0x836144d0722e5c1,
691 fidl::encoding::DynamicFlags::FLEXIBLE,
692 ___deadline,
693 )?
694 .into_result::<ActivityGovernorMarker>("register_listener")?;
695 Ok(_response)
696 }
697}
698
699#[derive(Debug, Clone)]
700pub struct ActivityGovernorProxy {
701 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
702}
703
704impl fidl::endpoints::Proxy for ActivityGovernorProxy {
705 type Protocol = ActivityGovernorMarker;
706
707 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
708 Self::new(inner)
709 }
710
711 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
712 self.client.into_channel().map_err(|client| Self { client })
713 }
714
715 fn as_channel(&self) -> &::fidl::AsyncChannel {
716 self.client.as_channel()
717 }
718}
719
720impl ActivityGovernorProxy {
721 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
723 let protocol_name = <ActivityGovernorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
724 Self { client: fidl::client::Client::new(channel, protocol_name) }
725 }
726
727 pub fn take_event_stream(&self) -> ActivityGovernorEventStream {
733 ActivityGovernorEventStream { event_receiver: self.client.take_event_receiver() }
734 }
735
736 pub fn r#get_power_elements(
743 &self,
744 ) -> fidl::client::QueryResponseFut<PowerElements, fidl::encoding::DefaultFuchsiaResourceDialect>
745 {
746 ActivityGovernorProxyInterface::r#get_power_elements(self)
747 }
748
749 pub fn r#take_wake_lease(
758 &self,
759 mut name: &str,
760 ) -> fidl::client::QueryResponseFut<
761 fidl::EventPair,
762 fidl::encoding::DefaultFuchsiaResourceDialect,
763 > {
764 ActivityGovernorProxyInterface::r#take_wake_lease(self, name)
765 }
766
767 pub fn r#acquire_wake_lease(
772 &self,
773 mut name: &str,
774 ) -> fidl::client::QueryResponseFut<
775 ActivityGovernorAcquireWakeLeaseResult,
776 fidl::encoding::DefaultFuchsiaResourceDialect,
777 > {
778 ActivityGovernorProxyInterface::r#acquire_wake_lease(self, name)
779 }
780
781 pub fn r#take_application_activity_lease(
792 &self,
793 mut name: &str,
794 ) -> fidl::client::QueryResponseFut<
795 fidl::EventPair,
796 fidl::encoding::DefaultFuchsiaResourceDialect,
797 > {
798 ActivityGovernorProxyInterface::r#take_application_activity_lease(self, name)
799 }
800
801 pub fn r#register_listener(
809 &self,
810 mut payload: ActivityGovernorRegisterListenerRequest,
811 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
812 ActivityGovernorProxyInterface::r#register_listener(self, payload)
813 }
814}
815
816impl ActivityGovernorProxyInterface for ActivityGovernorProxy {
817 type GetPowerElementsResponseFut = fidl::client::QueryResponseFut<
818 PowerElements,
819 fidl::encoding::DefaultFuchsiaResourceDialect,
820 >;
821 fn r#get_power_elements(&self) -> Self::GetPowerElementsResponseFut {
822 fn _decode(
823 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
824 ) -> Result<PowerElements, fidl::Error> {
825 let _response = fidl::client::decode_transaction_body::<
826 fidl::encoding::FlexibleType<PowerElements>,
827 fidl::encoding::DefaultFuchsiaResourceDialect,
828 0x798003259dfb5672,
829 >(_buf?)?
830 .into_result::<ActivityGovernorMarker>("get_power_elements")?;
831 Ok(_response)
832 }
833 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PowerElements>(
834 (),
835 0x798003259dfb5672,
836 fidl::encoding::DynamicFlags::FLEXIBLE,
837 _decode,
838 )
839 }
840
841 type TakeWakeLeaseResponseFut = fidl::client::QueryResponseFut<
842 fidl::EventPair,
843 fidl::encoding::DefaultFuchsiaResourceDialect,
844 >;
845 fn r#take_wake_lease(&self, mut name: &str) -> Self::TakeWakeLeaseResponseFut {
846 fn _decode(
847 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
848 ) -> Result<fidl::EventPair, fidl::Error> {
849 let _response = fidl::client::decode_transaction_body::<
850 fidl::encoding::FlexibleType<ActivityGovernorTakeWakeLeaseResponse>,
851 fidl::encoding::DefaultFuchsiaResourceDialect,
852 0x291cfb42b2d3bf69,
853 >(_buf?)?
854 .into_result::<ActivityGovernorMarker>("take_wake_lease")?;
855 Ok(_response.token)
856 }
857 self.client.send_query_and_decode::<ActivityGovernorTakeWakeLeaseRequest, fidl::EventPair>(
858 (name,),
859 0x291cfb42b2d3bf69,
860 fidl::encoding::DynamicFlags::FLEXIBLE,
861 _decode,
862 )
863 }
864
865 type AcquireWakeLeaseResponseFut = fidl::client::QueryResponseFut<
866 ActivityGovernorAcquireWakeLeaseResult,
867 fidl::encoding::DefaultFuchsiaResourceDialect,
868 >;
869 fn r#acquire_wake_lease(&self, mut name: &str) -> Self::AcquireWakeLeaseResponseFut {
870 fn _decode(
871 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
872 ) -> Result<ActivityGovernorAcquireWakeLeaseResult, fidl::Error> {
873 let _response = fidl::client::decode_transaction_body::<
874 fidl::encoding::FlexibleResultType<
875 ActivityGovernorAcquireWakeLeaseResponse,
876 AcquireWakeLeaseError,
877 >,
878 fidl::encoding::DefaultFuchsiaResourceDialect,
879 0x2de25abd8fa7c103,
880 >(_buf?)?
881 .into_result::<ActivityGovernorMarker>("acquire_wake_lease")?;
882 Ok(_response.map(|x| x.token))
883 }
884 self.client.send_query_and_decode::<
885 ActivityGovernorAcquireWakeLeaseRequest,
886 ActivityGovernorAcquireWakeLeaseResult,
887 >(
888 (name,),
889 0x2de25abd8fa7c103,
890 fidl::encoding::DynamicFlags::FLEXIBLE,
891 _decode,
892 )
893 }
894
895 type TakeApplicationActivityLeaseResponseFut = fidl::client::QueryResponseFut<
896 fidl::EventPair,
897 fidl::encoding::DefaultFuchsiaResourceDialect,
898 >;
899 fn r#take_application_activity_lease(
900 &self,
901 mut name: &str,
902 ) -> Self::TakeApplicationActivityLeaseResponseFut {
903 fn _decode(
904 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
905 ) -> Result<fidl::EventPair, fidl::Error> {
906 let _response = fidl::client::decode_transaction_body::<
907 fidl::encoding::FlexibleType<ActivityGovernorTakeApplicationActivityLeaseResponse>,
908 fidl::encoding::DefaultFuchsiaResourceDialect,
909 0x37cd5364de7ada14,
910 >(_buf?)?
911 .into_result::<ActivityGovernorMarker>("take_application_activity_lease")?;
912 Ok(_response.token)
913 }
914 self.client.send_query_and_decode::<
915 ActivityGovernorTakeApplicationActivityLeaseRequest,
916 fidl::EventPair,
917 >(
918 (name,),
919 0x37cd5364de7ada14,
920 fidl::encoding::DynamicFlags::FLEXIBLE,
921 _decode,
922 )
923 }
924
925 type RegisterListenerResponseFut =
926 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
927 fn r#register_listener(
928 &self,
929 mut payload: ActivityGovernorRegisterListenerRequest,
930 ) -> Self::RegisterListenerResponseFut {
931 fn _decode(
932 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
933 ) -> Result<(), fidl::Error> {
934 let _response = fidl::client::decode_transaction_body::<
935 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
936 fidl::encoding::DefaultFuchsiaResourceDialect,
937 0x836144d0722e5c1,
938 >(_buf?)?
939 .into_result::<ActivityGovernorMarker>("register_listener")?;
940 Ok(_response)
941 }
942 self.client.send_query_and_decode::<ActivityGovernorRegisterListenerRequest, ()>(
943 &mut payload,
944 0x836144d0722e5c1,
945 fidl::encoding::DynamicFlags::FLEXIBLE,
946 _decode,
947 )
948 }
949}
950
951pub struct ActivityGovernorEventStream {
952 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
953}
954
955impl std::marker::Unpin for ActivityGovernorEventStream {}
956
957impl futures::stream::FusedStream for ActivityGovernorEventStream {
958 fn is_terminated(&self) -> bool {
959 self.event_receiver.is_terminated()
960 }
961}
962
963impl futures::Stream for ActivityGovernorEventStream {
964 type Item = Result<ActivityGovernorEvent, fidl::Error>;
965
966 fn poll_next(
967 mut self: std::pin::Pin<&mut Self>,
968 cx: &mut std::task::Context<'_>,
969 ) -> std::task::Poll<Option<Self::Item>> {
970 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
971 &mut self.event_receiver,
972 cx
973 )?) {
974 Some(buf) => std::task::Poll::Ready(Some(ActivityGovernorEvent::decode(buf))),
975 None => std::task::Poll::Ready(None),
976 }
977 }
978}
979
980#[derive(Debug)]
981pub enum ActivityGovernorEvent {
982 #[non_exhaustive]
983 _UnknownEvent {
984 ordinal: u64,
986 },
987}
988
989impl ActivityGovernorEvent {
990 fn decode(
992 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
993 ) -> Result<ActivityGovernorEvent, fidl::Error> {
994 let (bytes, _handles) = buf.split_mut();
995 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
996 debug_assert_eq!(tx_header.tx_id, 0);
997 match tx_header.ordinal {
998 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
999 Ok(ActivityGovernorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1000 }
1001 _ => Err(fidl::Error::UnknownOrdinal {
1002 ordinal: tx_header.ordinal,
1003 protocol_name:
1004 <ActivityGovernorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1005 }),
1006 }
1007 }
1008}
1009
1010pub struct ActivityGovernorRequestStream {
1012 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1013 is_terminated: bool,
1014}
1015
1016impl std::marker::Unpin for ActivityGovernorRequestStream {}
1017
1018impl futures::stream::FusedStream for ActivityGovernorRequestStream {
1019 fn is_terminated(&self) -> bool {
1020 self.is_terminated
1021 }
1022}
1023
1024impl fidl::endpoints::RequestStream for ActivityGovernorRequestStream {
1025 type Protocol = ActivityGovernorMarker;
1026 type ControlHandle = ActivityGovernorControlHandle;
1027
1028 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1029 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1030 }
1031
1032 fn control_handle(&self) -> Self::ControlHandle {
1033 ActivityGovernorControlHandle { inner: self.inner.clone() }
1034 }
1035
1036 fn into_inner(
1037 self,
1038 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1039 {
1040 (self.inner, self.is_terminated)
1041 }
1042
1043 fn from_inner(
1044 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1045 is_terminated: bool,
1046 ) -> Self {
1047 Self { inner, is_terminated }
1048 }
1049}
1050
1051impl futures::Stream for ActivityGovernorRequestStream {
1052 type Item = Result<ActivityGovernorRequest, fidl::Error>;
1053
1054 fn poll_next(
1055 mut self: std::pin::Pin<&mut Self>,
1056 cx: &mut std::task::Context<'_>,
1057 ) -> std::task::Poll<Option<Self::Item>> {
1058 let this = &mut *self;
1059 if this.inner.check_shutdown(cx) {
1060 this.is_terminated = true;
1061 return std::task::Poll::Ready(None);
1062 }
1063 if this.is_terminated {
1064 panic!("polled ActivityGovernorRequestStream after completion");
1065 }
1066 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1067 |bytes, handles| {
1068 match this.inner.channel().read_etc(cx, bytes, handles) {
1069 std::task::Poll::Ready(Ok(())) => {}
1070 std::task::Poll::Pending => return std::task::Poll::Pending,
1071 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1072 this.is_terminated = true;
1073 return std::task::Poll::Ready(None);
1074 }
1075 std::task::Poll::Ready(Err(e)) => {
1076 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1077 e.into(),
1078 ))))
1079 }
1080 }
1081
1082 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1084
1085 std::task::Poll::Ready(Some(match header.ordinal {
1086 0x798003259dfb5672 => {
1087 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1088 let mut req = fidl::new_empty!(
1089 fidl::encoding::EmptyPayload,
1090 fidl::encoding::DefaultFuchsiaResourceDialect
1091 );
1092 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1093 let control_handle =
1094 ActivityGovernorControlHandle { inner: this.inner.clone() };
1095 Ok(ActivityGovernorRequest::GetPowerElements {
1096 responder: ActivityGovernorGetPowerElementsResponder {
1097 control_handle: std::mem::ManuallyDrop::new(control_handle),
1098 tx_id: header.tx_id,
1099 },
1100 })
1101 }
1102 0x291cfb42b2d3bf69 => {
1103 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1104 let mut req = fidl::new_empty!(
1105 ActivityGovernorTakeWakeLeaseRequest,
1106 fidl::encoding::DefaultFuchsiaResourceDialect
1107 );
1108 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorTakeWakeLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
1109 let control_handle =
1110 ActivityGovernorControlHandle { inner: this.inner.clone() };
1111 Ok(ActivityGovernorRequest::TakeWakeLease {
1112 name: req.name,
1113
1114 responder: ActivityGovernorTakeWakeLeaseResponder {
1115 control_handle: std::mem::ManuallyDrop::new(control_handle),
1116 tx_id: header.tx_id,
1117 },
1118 })
1119 }
1120 0x2de25abd8fa7c103 => {
1121 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1122 let mut req = fidl::new_empty!(
1123 ActivityGovernorAcquireWakeLeaseRequest,
1124 fidl::encoding::DefaultFuchsiaResourceDialect
1125 );
1126 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorAcquireWakeLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
1127 let control_handle =
1128 ActivityGovernorControlHandle { inner: this.inner.clone() };
1129 Ok(ActivityGovernorRequest::AcquireWakeLease {
1130 name: req.name,
1131
1132 responder: ActivityGovernorAcquireWakeLeaseResponder {
1133 control_handle: std::mem::ManuallyDrop::new(control_handle),
1134 tx_id: header.tx_id,
1135 },
1136 })
1137 }
1138 0x37cd5364de7ada14 => {
1139 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1140 let mut req = fidl::new_empty!(
1141 ActivityGovernorTakeApplicationActivityLeaseRequest,
1142 fidl::encoding::DefaultFuchsiaResourceDialect
1143 );
1144 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorTakeApplicationActivityLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
1145 let control_handle =
1146 ActivityGovernorControlHandle { inner: this.inner.clone() };
1147 Ok(ActivityGovernorRequest::TakeApplicationActivityLease {
1148 name: req.name,
1149
1150 responder: ActivityGovernorTakeApplicationActivityLeaseResponder {
1151 control_handle: std::mem::ManuallyDrop::new(control_handle),
1152 tx_id: header.tx_id,
1153 },
1154 })
1155 }
1156 0x836144d0722e5c1 => {
1157 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1158 let mut req = fidl::new_empty!(
1159 ActivityGovernorRegisterListenerRequest,
1160 fidl::encoding::DefaultFuchsiaResourceDialect
1161 );
1162 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActivityGovernorRegisterListenerRequest>(&header, _body_bytes, handles, &mut req)?;
1163 let control_handle =
1164 ActivityGovernorControlHandle { inner: this.inner.clone() };
1165 Ok(ActivityGovernorRequest::RegisterListener {
1166 payload: req,
1167 responder: ActivityGovernorRegisterListenerResponder {
1168 control_handle: std::mem::ManuallyDrop::new(control_handle),
1169 tx_id: header.tx_id,
1170 },
1171 })
1172 }
1173 _ if header.tx_id == 0
1174 && header
1175 .dynamic_flags()
1176 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1177 {
1178 Ok(ActivityGovernorRequest::_UnknownMethod {
1179 ordinal: header.ordinal,
1180 control_handle: ActivityGovernorControlHandle {
1181 inner: this.inner.clone(),
1182 },
1183 method_type: fidl::MethodType::OneWay,
1184 })
1185 }
1186 _ if header
1187 .dynamic_flags()
1188 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1189 {
1190 this.inner.send_framework_err(
1191 fidl::encoding::FrameworkErr::UnknownMethod,
1192 header.tx_id,
1193 header.ordinal,
1194 header.dynamic_flags(),
1195 (bytes, handles),
1196 )?;
1197 Ok(ActivityGovernorRequest::_UnknownMethod {
1198 ordinal: header.ordinal,
1199 control_handle: ActivityGovernorControlHandle {
1200 inner: this.inner.clone(),
1201 },
1202 method_type: fidl::MethodType::TwoWay,
1203 })
1204 }
1205 _ => Err(fidl::Error::UnknownOrdinal {
1206 ordinal: header.ordinal,
1207 protocol_name:
1208 <ActivityGovernorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1209 }),
1210 }))
1211 },
1212 )
1213 }
1214}
1215
1216#[derive(Debug)]
1225pub enum ActivityGovernorRequest {
1226 GetPowerElements { responder: ActivityGovernorGetPowerElementsResponder },
1233 TakeWakeLease { name: String, responder: ActivityGovernorTakeWakeLeaseResponder },
1242 AcquireWakeLease { name: String, responder: ActivityGovernorAcquireWakeLeaseResponder },
1247 TakeApplicationActivityLease {
1258 name: String,
1259 responder: ActivityGovernorTakeApplicationActivityLeaseResponder,
1260 },
1261 RegisterListener {
1269 payload: ActivityGovernorRegisterListenerRequest,
1270 responder: ActivityGovernorRegisterListenerResponder,
1271 },
1272 #[non_exhaustive]
1274 _UnknownMethod {
1275 ordinal: u64,
1277 control_handle: ActivityGovernorControlHandle,
1278 method_type: fidl::MethodType,
1279 },
1280}
1281
1282impl ActivityGovernorRequest {
1283 #[allow(irrefutable_let_patterns)]
1284 pub fn into_get_power_elements(self) -> Option<(ActivityGovernorGetPowerElementsResponder)> {
1285 if let ActivityGovernorRequest::GetPowerElements { responder } = self {
1286 Some((responder))
1287 } else {
1288 None
1289 }
1290 }
1291
1292 #[allow(irrefutable_let_patterns)]
1293 pub fn into_take_wake_lease(self) -> Option<(String, ActivityGovernorTakeWakeLeaseResponder)> {
1294 if let ActivityGovernorRequest::TakeWakeLease { name, responder } = self {
1295 Some((name, responder))
1296 } else {
1297 None
1298 }
1299 }
1300
1301 #[allow(irrefutable_let_patterns)]
1302 pub fn into_acquire_wake_lease(
1303 self,
1304 ) -> Option<(String, ActivityGovernorAcquireWakeLeaseResponder)> {
1305 if let ActivityGovernorRequest::AcquireWakeLease { name, responder } = self {
1306 Some((name, responder))
1307 } else {
1308 None
1309 }
1310 }
1311
1312 #[allow(irrefutable_let_patterns)]
1313 pub fn into_take_application_activity_lease(
1314 self,
1315 ) -> Option<(String, ActivityGovernorTakeApplicationActivityLeaseResponder)> {
1316 if let ActivityGovernorRequest::TakeApplicationActivityLease { name, responder } = self {
1317 Some((name, responder))
1318 } else {
1319 None
1320 }
1321 }
1322
1323 #[allow(irrefutable_let_patterns)]
1324 pub fn into_register_listener(
1325 self,
1326 ) -> Option<(ActivityGovernorRegisterListenerRequest, ActivityGovernorRegisterListenerResponder)>
1327 {
1328 if let ActivityGovernorRequest::RegisterListener { payload, responder } = self {
1329 Some((payload, responder))
1330 } else {
1331 None
1332 }
1333 }
1334
1335 pub fn method_name(&self) -> &'static str {
1337 match *self {
1338 ActivityGovernorRequest::GetPowerElements { .. } => "get_power_elements",
1339 ActivityGovernorRequest::TakeWakeLease { .. } => "take_wake_lease",
1340 ActivityGovernorRequest::AcquireWakeLease { .. } => "acquire_wake_lease",
1341 ActivityGovernorRequest::TakeApplicationActivityLease { .. } => {
1342 "take_application_activity_lease"
1343 }
1344 ActivityGovernorRequest::RegisterListener { .. } => "register_listener",
1345 ActivityGovernorRequest::_UnknownMethod {
1346 method_type: fidl::MethodType::OneWay,
1347 ..
1348 } => "unknown one-way method",
1349 ActivityGovernorRequest::_UnknownMethod {
1350 method_type: fidl::MethodType::TwoWay,
1351 ..
1352 } => "unknown two-way method",
1353 }
1354 }
1355}
1356
1357#[derive(Debug, Clone)]
1358pub struct ActivityGovernorControlHandle {
1359 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1360}
1361
1362impl fidl::endpoints::ControlHandle for ActivityGovernorControlHandle {
1363 fn shutdown(&self) {
1364 self.inner.shutdown()
1365 }
1366 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1367 self.inner.shutdown_with_epitaph(status)
1368 }
1369
1370 fn is_closed(&self) -> bool {
1371 self.inner.channel().is_closed()
1372 }
1373 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1374 self.inner.channel().on_closed()
1375 }
1376
1377 #[cfg(target_os = "fuchsia")]
1378 fn signal_peer(
1379 &self,
1380 clear_mask: zx::Signals,
1381 set_mask: zx::Signals,
1382 ) -> Result<(), zx_status::Status> {
1383 use fidl::Peered;
1384 self.inner.channel().signal_peer(clear_mask, set_mask)
1385 }
1386}
1387
1388impl ActivityGovernorControlHandle {}
1389
1390#[must_use = "FIDL methods require a response to be sent"]
1391#[derive(Debug)]
1392pub struct ActivityGovernorGetPowerElementsResponder {
1393 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1394 tx_id: u32,
1395}
1396
1397impl std::ops::Drop for ActivityGovernorGetPowerElementsResponder {
1401 fn drop(&mut self) {
1402 self.control_handle.shutdown();
1403 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1405 }
1406}
1407
1408impl fidl::endpoints::Responder for ActivityGovernorGetPowerElementsResponder {
1409 type ControlHandle = ActivityGovernorControlHandle;
1410
1411 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1412 &self.control_handle
1413 }
1414
1415 fn drop_without_shutdown(mut self) {
1416 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1418 std::mem::forget(self);
1420 }
1421}
1422
1423impl ActivityGovernorGetPowerElementsResponder {
1424 pub fn send(self, mut payload: PowerElements) -> Result<(), fidl::Error> {
1428 let _result = self.send_raw(payload);
1429 if _result.is_err() {
1430 self.control_handle.shutdown();
1431 }
1432 self.drop_without_shutdown();
1433 _result
1434 }
1435
1436 pub fn send_no_shutdown_on_err(self, mut payload: PowerElements) -> Result<(), fidl::Error> {
1438 let _result = self.send_raw(payload);
1439 self.drop_without_shutdown();
1440 _result
1441 }
1442
1443 fn send_raw(&self, mut payload: PowerElements) -> Result<(), fidl::Error> {
1444 self.control_handle.inner.send::<fidl::encoding::FlexibleType<PowerElements>>(
1445 fidl::encoding::Flexible::new(&mut payload),
1446 self.tx_id,
1447 0x798003259dfb5672,
1448 fidl::encoding::DynamicFlags::FLEXIBLE,
1449 )
1450 }
1451}
1452
1453#[must_use = "FIDL methods require a response to be sent"]
1454#[derive(Debug)]
1455pub struct ActivityGovernorTakeWakeLeaseResponder {
1456 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1457 tx_id: u32,
1458}
1459
1460impl std::ops::Drop for ActivityGovernorTakeWakeLeaseResponder {
1464 fn drop(&mut self) {
1465 self.control_handle.shutdown();
1466 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1468 }
1469}
1470
1471impl fidl::endpoints::Responder for ActivityGovernorTakeWakeLeaseResponder {
1472 type ControlHandle = ActivityGovernorControlHandle;
1473
1474 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1475 &self.control_handle
1476 }
1477
1478 fn drop_without_shutdown(mut self) {
1479 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1481 std::mem::forget(self);
1483 }
1484}
1485
1486impl ActivityGovernorTakeWakeLeaseResponder {
1487 pub fn send(self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1491 let _result = self.send_raw(token);
1492 if _result.is_err() {
1493 self.control_handle.shutdown();
1494 }
1495 self.drop_without_shutdown();
1496 _result
1497 }
1498
1499 pub fn send_no_shutdown_on_err(self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1501 let _result = self.send_raw(token);
1502 self.drop_without_shutdown();
1503 _result
1504 }
1505
1506 fn send_raw(&self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1507 self.control_handle
1508 .inner
1509 .send::<fidl::encoding::FlexibleType<ActivityGovernorTakeWakeLeaseResponse>>(
1510 fidl::encoding::Flexible::new((token,)),
1511 self.tx_id,
1512 0x291cfb42b2d3bf69,
1513 fidl::encoding::DynamicFlags::FLEXIBLE,
1514 )
1515 }
1516}
1517
1518#[must_use = "FIDL methods require a response to be sent"]
1519#[derive(Debug)]
1520pub struct ActivityGovernorAcquireWakeLeaseResponder {
1521 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1522 tx_id: u32,
1523}
1524
1525impl std::ops::Drop for ActivityGovernorAcquireWakeLeaseResponder {
1529 fn drop(&mut self) {
1530 self.control_handle.shutdown();
1531 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1533 }
1534}
1535
1536impl fidl::endpoints::Responder for ActivityGovernorAcquireWakeLeaseResponder {
1537 type ControlHandle = ActivityGovernorControlHandle;
1538
1539 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1540 &self.control_handle
1541 }
1542
1543 fn drop_without_shutdown(mut self) {
1544 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1546 std::mem::forget(self);
1548 }
1549}
1550
1551impl ActivityGovernorAcquireWakeLeaseResponder {
1552 pub fn send(
1556 self,
1557 mut result: Result<fidl::EventPair, AcquireWakeLeaseError>,
1558 ) -> Result<(), fidl::Error> {
1559 let _result = self.send_raw(result);
1560 if _result.is_err() {
1561 self.control_handle.shutdown();
1562 }
1563 self.drop_without_shutdown();
1564 _result
1565 }
1566
1567 pub fn send_no_shutdown_on_err(
1569 self,
1570 mut result: Result<fidl::EventPair, AcquireWakeLeaseError>,
1571 ) -> Result<(), fidl::Error> {
1572 let _result = self.send_raw(result);
1573 self.drop_without_shutdown();
1574 _result
1575 }
1576
1577 fn send_raw(
1578 &self,
1579 mut result: Result<fidl::EventPair, AcquireWakeLeaseError>,
1580 ) -> Result<(), fidl::Error> {
1581 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1582 ActivityGovernorAcquireWakeLeaseResponse,
1583 AcquireWakeLeaseError,
1584 >>(
1585 fidl::encoding::FlexibleResult::new(result.map(|token| (token,))),
1586 self.tx_id,
1587 0x2de25abd8fa7c103,
1588 fidl::encoding::DynamicFlags::FLEXIBLE,
1589 )
1590 }
1591}
1592
1593#[must_use = "FIDL methods require a response to be sent"]
1594#[derive(Debug)]
1595pub struct ActivityGovernorTakeApplicationActivityLeaseResponder {
1596 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1597 tx_id: u32,
1598}
1599
1600impl std::ops::Drop for ActivityGovernorTakeApplicationActivityLeaseResponder {
1604 fn drop(&mut self) {
1605 self.control_handle.shutdown();
1606 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1608 }
1609}
1610
1611impl fidl::endpoints::Responder for ActivityGovernorTakeApplicationActivityLeaseResponder {
1612 type ControlHandle = ActivityGovernorControlHandle;
1613
1614 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1615 &self.control_handle
1616 }
1617
1618 fn drop_without_shutdown(mut self) {
1619 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1621 std::mem::forget(self);
1623 }
1624}
1625
1626impl ActivityGovernorTakeApplicationActivityLeaseResponder {
1627 pub fn send(self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1631 let _result = self.send_raw(token);
1632 if _result.is_err() {
1633 self.control_handle.shutdown();
1634 }
1635 self.drop_without_shutdown();
1636 _result
1637 }
1638
1639 pub fn send_no_shutdown_on_err(self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1641 let _result = self.send_raw(token);
1642 self.drop_without_shutdown();
1643 _result
1644 }
1645
1646 fn send_raw(&self, mut token: fidl::EventPair) -> Result<(), fidl::Error> {
1647 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
1648 ActivityGovernorTakeApplicationActivityLeaseResponse,
1649 >>(
1650 fidl::encoding::Flexible::new((token,)),
1651 self.tx_id,
1652 0x37cd5364de7ada14,
1653 fidl::encoding::DynamicFlags::FLEXIBLE,
1654 )
1655 }
1656}
1657
1658#[must_use = "FIDL methods require a response to be sent"]
1659#[derive(Debug)]
1660pub struct ActivityGovernorRegisterListenerResponder {
1661 control_handle: std::mem::ManuallyDrop<ActivityGovernorControlHandle>,
1662 tx_id: u32,
1663}
1664
1665impl std::ops::Drop for ActivityGovernorRegisterListenerResponder {
1669 fn drop(&mut self) {
1670 self.control_handle.shutdown();
1671 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1673 }
1674}
1675
1676impl fidl::endpoints::Responder for ActivityGovernorRegisterListenerResponder {
1677 type ControlHandle = ActivityGovernorControlHandle;
1678
1679 fn control_handle(&self) -> &ActivityGovernorControlHandle {
1680 &self.control_handle
1681 }
1682
1683 fn drop_without_shutdown(mut self) {
1684 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1686 std::mem::forget(self);
1688 }
1689}
1690
1691impl ActivityGovernorRegisterListenerResponder {
1692 pub fn send(self) -> Result<(), fidl::Error> {
1696 let _result = self.send_raw();
1697 if _result.is_err() {
1698 self.control_handle.shutdown();
1699 }
1700 self.drop_without_shutdown();
1701 _result
1702 }
1703
1704 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1706 let _result = self.send_raw();
1707 self.drop_without_shutdown();
1708 _result
1709 }
1710
1711 fn send_raw(&self) -> Result<(), fidl::Error> {
1712 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1713 fidl::encoding::Flexible::new(()),
1714 self.tx_id,
1715 0x836144d0722e5c1,
1716 fidl::encoding::DynamicFlags::FLEXIBLE,
1717 )
1718 }
1719}
1720
1721#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1722pub struct ActivityGovernorListenerMarker;
1723
1724impl fidl::endpoints::ProtocolMarker for ActivityGovernorListenerMarker {
1725 type Proxy = ActivityGovernorListenerProxy;
1726 type RequestStream = ActivityGovernorListenerRequestStream;
1727 #[cfg(target_os = "fuchsia")]
1728 type SynchronousProxy = ActivityGovernorListenerSynchronousProxy;
1729
1730 const DEBUG_NAME: &'static str = "(anonymous) ActivityGovernorListener";
1731}
1732
1733pub trait ActivityGovernorListenerProxyInterface: Send + Sync {
1734 type OnResumeResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1735 fn r#on_resume(&self) -> Self::OnResumeResponseFut;
1736 type OnSuspendStartedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1737 fn r#on_suspend_started(&self) -> Self::OnSuspendStartedResponseFut;
1738}
1739#[derive(Debug)]
1740#[cfg(target_os = "fuchsia")]
1741pub struct ActivityGovernorListenerSynchronousProxy {
1742 client: fidl::client::sync::Client,
1743}
1744
1745#[cfg(target_os = "fuchsia")]
1746impl fidl::endpoints::SynchronousProxy for ActivityGovernorListenerSynchronousProxy {
1747 type Proxy = ActivityGovernorListenerProxy;
1748 type Protocol = ActivityGovernorListenerMarker;
1749
1750 fn from_channel(inner: fidl::Channel) -> Self {
1751 Self::new(inner)
1752 }
1753
1754 fn into_channel(self) -> fidl::Channel {
1755 self.client.into_channel()
1756 }
1757
1758 fn as_channel(&self) -> &fidl::Channel {
1759 self.client.as_channel()
1760 }
1761}
1762
1763#[cfg(target_os = "fuchsia")]
1764impl ActivityGovernorListenerSynchronousProxy {
1765 pub fn new(channel: fidl::Channel) -> Self {
1766 let protocol_name =
1767 <ActivityGovernorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1768 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1769 }
1770
1771 pub fn into_channel(self) -> fidl::Channel {
1772 self.client.into_channel()
1773 }
1774
1775 pub fn wait_for_event(
1778 &self,
1779 deadline: zx::MonotonicInstant,
1780 ) -> Result<ActivityGovernorListenerEvent, fidl::Error> {
1781 ActivityGovernorListenerEvent::decode(self.client.wait_for_event(deadline)?)
1782 }
1783
1784 pub fn r#on_resume(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
1796 let _response =
1797 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
1798 (),
1799 0x5b48f847154cfd48,
1800 fidl::encoding::DynamicFlags::empty(),
1801 ___deadline,
1802 )?;
1803 Ok(_response)
1804 }
1805
1806 pub fn r#on_suspend_started(
1820 &self,
1821 ___deadline: zx::MonotonicInstant,
1822 ) -> Result<(), fidl::Error> {
1823 let _response = self.client.send_query::<
1824 fidl::encoding::EmptyPayload,
1825 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1826 >(
1827 (),
1828 0x5858cc3412a8eabf,
1829 fidl::encoding::DynamicFlags::FLEXIBLE,
1830 ___deadline,
1831 )?
1832 .into_result::<ActivityGovernorListenerMarker>("on_suspend_started")?;
1833 Ok(_response)
1834 }
1835}
1836
1837#[derive(Debug, Clone)]
1838pub struct ActivityGovernorListenerProxy {
1839 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1840}
1841
1842impl fidl::endpoints::Proxy for ActivityGovernorListenerProxy {
1843 type Protocol = ActivityGovernorListenerMarker;
1844
1845 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1846 Self::new(inner)
1847 }
1848
1849 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1850 self.client.into_channel().map_err(|client| Self { client })
1851 }
1852
1853 fn as_channel(&self) -> &::fidl::AsyncChannel {
1854 self.client.as_channel()
1855 }
1856}
1857
1858impl ActivityGovernorListenerProxy {
1859 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1861 let protocol_name =
1862 <ActivityGovernorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1863 Self { client: fidl::client::Client::new(channel, protocol_name) }
1864 }
1865
1866 pub fn take_event_stream(&self) -> ActivityGovernorListenerEventStream {
1872 ActivityGovernorListenerEventStream { event_receiver: self.client.take_event_receiver() }
1873 }
1874
1875 pub fn r#on_resume(
1887 &self,
1888 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1889 ActivityGovernorListenerProxyInterface::r#on_resume(self)
1890 }
1891
1892 pub fn r#on_suspend_started(
1906 &self,
1907 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1908 ActivityGovernorListenerProxyInterface::r#on_suspend_started(self)
1909 }
1910}
1911
1912impl ActivityGovernorListenerProxyInterface for ActivityGovernorListenerProxy {
1913 type OnResumeResponseFut =
1914 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1915 fn r#on_resume(&self) -> Self::OnResumeResponseFut {
1916 fn _decode(
1917 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1918 ) -> Result<(), fidl::Error> {
1919 let _response = fidl::client::decode_transaction_body::<
1920 fidl::encoding::EmptyPayload,
1921 fidl::encoding::DefaultFuchsiaResourceDialect,
1922 0x5b48f847154cfd48,
1923 >(_buf?)?;
1924 Ok(_response)
1925 }
1926 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1927 (),
1928 0x5b48f847154cfd48,
1929 fidl::encoding::DynamicFlags::empty(),
1930 _decode,
1931 )
1932 }
1933
1934 type OnSuspendStartedResponseFut =
1935 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1936 fn r#on_suspend_started(&self) -> Self::OnSuspendStartedResponseFut {
1937 fn _decode(
1938 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1939 ) -> Result<(), fidl::Error> {
1940 let _response = fidl::client::decode_transaction_body::<
1941 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1942 fidl::encoding::DefaultFuchsiaResourceDialect,
1943 0x5858cc3412a8eabf,
1944 >(_buf?)?
1945 .into_result::<ActivityGovernorListenerMarker>("on_suspend_started")?;
1946 Ok(_response)
1947 }
1948 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1949 (),
1950 0x5858cc3412a8eabf,
1951 fidl::encoding::DynamicFlags::FLEXIBLE,
1952 _decode,
1953 )
1954 }
1955}
1956
1957pub struct ActivityGovernorListenerEventStream {
1958 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1959}
1960
1961impl std::marker::Unpin for ActivityGovernorListenerEventStream {}
1962
1963impl futures::stream::FusedStream for ActivityGovernorListenerEventStream {
1964 fn is_terminated(&self) -> bool {
1965 self.event_receiver.is_terminated()
1966 }
1967}
1968
1969impl futures::Stream for ActivityGovernorListenerEventStream {
1970 type Item = Result<ActivityGovernorListenerEvent, fidl::Error>;
1971
1972 fn poll_next(
1973 mut self: std::pin::Pin<&mut Self>,
1974 cx: &mut std::task::Context<'_>,
1975 ) -> std::task::Poll<Option<Self::Item>> {
1976 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1977 &mut self.event_receiver,
1978 cx
1979 )?) {
1980 Some(buf) => std::task::Poll::Ready(Some(ActivityGovernorListenerEvent::decode(buf))),
1981 None => std::task::Poll::Ready(None),
1982 }
1983 }
1984}
1985
1986#[derive(Debug)]
1987pub enum ActivityGovernorListenerEvent {
1988 #[non_exhaustive]
1989 _UnknownEvent {
1990 ordinal: u64,
1992 },
1993}
1994
1995impl ActivityGovernorListenerEvent {
1996 fn decode(
1998 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1999 ) -> Result<ActivityGovernorListenerEvent, fidl::Error> {
2000 let (bytes, _handles) = buf.split_mut();
2001 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2002 debug_assert_eq!(tx_header.tx_id, 0);
2003 match tx_header.ordinal {
2004 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2005 Ok(ActivityGovernorListenerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2006 }
2007 _ => Err(fidl::Error::UnknownOrdinal {
2008 ordinal: tx_header.ordinal,
2009 protocol_name:
2010 <ActivityGovernorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2011 }),
2012 }
2013 }
2014}
2015
2016pub struct ActivityGovernorListenerRequestStream {
2018 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2019 is_terminated: bool,
2020}
2021
2022impl std::marker::Unpin for ActivityGovernorListenerRequestStream {}
2023
2024impl futures::stream::FusedStream for ActivityGovernorListenerRequestStream {
2025 fn is_terminated(&self) -> bool {
2026 self.is_terminated
2027 }
2028}
2029
2030impl fidl::endpoints::RequestStream for ActivityGovernorListenerRequestStream {
2031 type Protocol = ActivityGovernorListenerMarker;
2032 type ControlHandle = ActivityGovernorListenerControlHandle;
2033
2034 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2035 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2036 }
2037
2038 fn control_handle(&self) -> Self::ControlHandle {
2039 ActivityGovernorListenerControlHandle { inner: self.inner.clone() }
2040 }
2041
2042 fn into_inner(
2043 self,
2044 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2045 {
2046 (self.inner, self.is_terminated)
2047 }
2048
2049 fn from_inner(
2050 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2051 is_terminated: bool,
2052 ) -> Self {
2053 Self { inner, is_terminated }
2054 }
2055}
2056
2057impl futures::Stream for ActivityGovernorListenerRequestStream {
2058 type Item = Result<ActivityGovernorListenerRequest, fidl::Error>;
2059
2060 fn poll_next(
2061 mut self: std::pin::Pin<&mut Self>,
2062 cx: &mut std::task::Context<'_>,
2063 ) -> std::task::Poll<Option<Self::Item>> {
2064 let this = &mut *self;
2065 if this.inner.check_shutdown(cx) {
2066 this.is_terminated = true;
2067 return std::task::Poll::Ready(None);
2068 }
2069 if this.is_terminated {
2070 panic!("polled ActivityGovernorListenerRequestStream after completion");
2071 }
2072 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2073 |bytes, handles| {
2074 match this.inner.channel().read_etc(cx, bytes, handles) {
2075 std::task::Poll::Ready(Ok(())) => {}
2076 std::task::Poll::Pending => return std::task::Poll::Pending,
2077 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2078 this.is_terminated = true;
2079 return std::task::Poll::Ready(None);
2080 }
2081 std::task::Poll::Ready(Err(e)) => {
2082 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2083 e.into(),
2084 ))))
2085 }
2086 }
2087
2088 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2090
2091 std::task::Poll::Ready(Some(match header.ordinal {
2092 0x5b48f847154cfd48 => {
2093 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2094 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2095 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2096 let control_handle = ActivityGovernorListenerControlHandle {
2097 inner: this.inner.clone(),
2098 };
2099 Ok(ActivityGovernorListenerRequest::OnResume {
2100 responder: ActivityGovernorListenerOnResumeResponder {
2101 control_handle: std::mem::ManuallyDrop::new(control_handle),
2102 tx_id: header.tx_id,
2103 },
2104 })
2105 }
2106 0x5858cc3412a8eabf => {
2107 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2108 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2109 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2110 let control_handle = ActivityGovernorListenerControlHandle {
2111 inner: this.inner.clone(),
2112 };
2113 Ok(ActivityGovernorListenerRequest::OnSuspendStarted {
2114 responder: ActivityGovernorListenerOnSuspendStartedResponder {
2115 control_handle: std::mem::ManuallyDrop::new(control_handle),
2116 tx_id: header.tx_id,
2117 },
2118 })
2119 }
2120 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2121 Ok(ActivityGovernorListenerRequest::_UnknownMethod {
2122 ordinal: header.ordinal,
2123 control_handle: ActivityGovernorListenerControlHandle { inner: this.inner.clone() },
2124 method_type: fidl::MethodType::OneWay,
2125 })
2126 }
2127 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2128 this.inner.send_framework_err(
2129 fidl::encoding::FrameworkErr::UnknownMethod,
2130 header.tx_id,
2131 header.ordinal,
2132 header.dynamic_flags(),
2133 (bytes, handles),
2134 )?;
2135 Ok(ActivityGovernorListenerRequest::_UnknownMethod {
2136 ordinal: header.ordinal,
2137 control_handle: ActivityGovernorListenerControlHandle { inner: this.inner.clone() },
2138 method_type: fidl::MethodType::TwoWay,
2139 })
2140 }
2141 _ => Err(fidl::Error::UnknownOrdinal {
2142 ordinal: header.ordinal,
2143 protocol_name: <ActivityGovernorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2144 }),
2145 }))
2146 },
2147 )
2148 }
2149}
2150
2151#[derive(Debug)]
2153pub enum ActivityGovernorListenerRequest {
2154 OnResume { responder: ActivityGovernorListenerOnResumeResponder },
2166 OnSuspendStarted { responder: ActivityGovernorListenerOnSuspendStartedResponder },
2180 #[non_exhaustive]
2182 _UnknownMethod {
2183 ordinal: u64,
2185 control_handle: ActivityGovernorListenerControlHandle,
2186 method_type: fidl::MethodType,
2187 },
2188}
2189
2190impl ActivityGovernorListenerRequest {
2191 #[allow(irrefutable_let_patterns)]
2192 pub fn into_on_resume(self) -> Option<(ActivityGovernorListenerOnResumeResponder)> {
2193 if let ActivityGovernorListenerRequest::OnResume { responder } = self {
2194 Some((responder))
2195 } else {
2196 None
2197 }
2198 }
2199
2200 #[allow(irrefutable_let_patterns)]
2201 pub fn into_on_suspend_started(
2202 self,
2203 ) -> Option<(ActivityGovernorListenerOnSuspendStartedResponder)> {
2204 if let ActivityGovernorListenerRequest::OnSuspendStarted { responder } = self {
2205 Some((responder))
2206 } else {
2207 None
2208 }
2209 }
2210
2211 pub fn method_name(&self) -> &'static str {
2213 match *self {
2214 ActivityGovernorListenerRequest::OnResume { .. } => "on_resume",
2215 ActivityGovernorListenerRequest::OnSuspendStarted { .. } => "on_suspend_started",
2216 ActivityGovernorListenerRequest::_UnknownMethod {
2217 method_type: fidl::MethodType::OneWay,
2218 ..
2219 } => "unknown one-way method",
2220 ActivityGovernorListenerRequest::_UnknownMethod {
2221 method_type: fidl::MethodType::TwoWay,
2222 ..
2223 } => "unknown two-way method",
2224 }
2225 }
2226}
2227
2228#[derive(Debug, Clone)]
2229pub struct ActivityGovernorListenerControlHandle {
2230 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2231}
2232
2233impl fidl::endpoints::ControlHandle for ActivityGovernorListenerControlHandle {
2234 fn shutdown(&self) {
2235 self.inner.shutdown()
2236 }
2237 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2238 self.inner.shutdown_with_epitaph(status)
2239 }
2240
2241 fn is_closed(&self) -> bool {
2242 self.inner.channel().is_closed()
2243 }
2244 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2245 self.inner.channel().on_closed()
2246 }
2247
2248 #[cfg(target_os = "fuchsia")]
2249 fn signal_peer(
2250 &self,
2251 clear_mask: zx::Signals,
2252 set_mask: zx::Signals,
2253 ) -> Result<(), zx_status::Status> {
2254 use fidl::Peered;
2255 self.inner.channel().signal_peer(clear_mask, set_mask)
2256 }
2257}
2258
2259impl ActivityGovernorListenerControlHandle {}
2260
2261#[must_use = "FIDL methods require a response to be sent"]
2262#[derive(Debug)]
2263pub struct ActivityGovernorListenerOnResumeResponder {
2264 control_handle: std::mem::ManuallyDrop<ActivityGovernorListenerControlHandle>,
2265 tx_id: u32,
2266}
2267
2268impl std::ops::Drop for ActivityGovernorListenerOnResumeResponder {
2272 fn drop(&mut self) {
2273 self.control_handle.shutdown();
2274 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2276 }
2277}
2278
2279impl fidl::endpoints::Responder for ActivityGovernorListenerOnResumeResponder {
2280 type ControlHandle = ActivityGovernorListenerControlHandle;
2281
2282 fn control_handle(&self) -> &ActivityGovernorListenerControlHandle {
2283 &self.control_handle
2284 }
2285
2286 fn drop_without_shutdown(mut self) {
2287 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2289 std::mem::forget(self);
2291 }
2292}
2293
2294impl ActivityGovernorListenerOnResumeResponder {
2295 pub fn send(self) -> Result<(), fidl::Error> {
2299 let _result = self.send_raw();
2300 if _result.is_err() {
2301 self.control_handle.shutdown();
2302 }
2303 self.drop_without_shutdown();
2304 _result
2305 }
2306
2307 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2309 let _result = self.send_raw();
2310 self.drop_without_shutdown();
2311 _result
2312 }
2313
2314 fn send_raw(&self) -> Result<(), fidl::Error> {
2315 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2316 (),
2317 self.tx_id,
2318 0x5b48f847154cfd48,
2319 fidl::encoding::DynamicFlags::empty(),
2320 )
2321 }
2322}
2323
2324#[must_use = "FIDL methods require a response to be sent"]
2325#[derive(Debug)]
2326pub struct ActivityGovernorListenerOnSuspendStartedResponder {
2327 control_handle: std::mem::ManuallyDrop<ActivityGovernorListenerControlHandle>,
2328 tx_id: u32,
2329}
2330
2331impl std::ops::Drop for ActivityGovernorListenerOnSuspendStartedResponder {
2335 fn drop(&mut self) {
2336 self.control_handle.shutdown();
2337 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2339 }
2340}
2341
2342impl fidl::endpoints::Responder for ActivityGovernorListenerOnSuspendStartedResponder {
2343 type ControlHandle = ActivityGovernorListenerControlHandle;
2344
2345 fn control_handle(&self) -> &ActivityGovernorListenerControlHandle {
2346 &self.control_handle
2347 }
2348
2349 fn drop_without_shutdown(mut self) {
2350 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2352 std::mem::forget(self);
2354 }
2355}
2356
2357impl ActivityGovernorListenerOnSuspendStartedResponder {
2358 pub fn send(self) -> Result<(), fidl::Error> {
2362 let _result = self.send_raw();
2363 if _result.is_err() {
2364 self.control_handle.shutdown();
2365 }
2366 self.drop_without_shutdown();
2367 _result
2368 }
2369
2370 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2372 let _result = self.send_raw();
2373 self.drop_without_shutdown();
2374 _result
2375 }
2376
2377 fn send_raw(&self) -> Result<(), fidl::Error> {
2378 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2379 fidl::encoding::Flexible::new(()),
2380 self.tx_id,
2381 0x5858cc3412a8eabf,
2382 fidl::encoding::DynamicFlags::FLEXIBLE,
2383 )
2384 }
2385}
2386
2387#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2388pub struct BootControlMarker;
2389
2390impl fidl::endpoints::ProtocolMarker for BootControlMarker {
2391 type Proxy = BootControlProxy;
2392 type RequestStream = BootControlRequestStream;
2393 #[cfg(target_os = "fuchsia")]
2394 type SynchronousProxy = BootControlSynchronousProxy;
2395
2396 const DEBUG_NAME: &'static str = "fuchsia.power.system.BootControl";
2397}
2398impl fidl::endpoints::DiscoverableProtocolMarker for BootControlMarker {}
2399
2400pub trait BootControlProxyInterface: Send + Sync {
2401 type SetBootCompleteResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2402 fn r#set_boot_complete(&self) -> Self::SetBootCompleteResponseFut;
2403}
2404#[derive(Debug)]
2405#[cfg(target_os = "fuchsia")]
2406pub struct BootControlSynchronousProxy {
2407 client: fidl::client::sync::Client,
2408}
2409
2410#[cfg(target_os = "fuchsia")]
2411impl fidl::endpoints::SynchronousProxy for BootControlSynchronousProxy {
2412 type Proxy = BootControlProxy;
2413 type Protocol = BootControlMarker;
2414
2415 fn from_channel(inner: fidl::Channel) -> Self {
2416 Self::new(inner)
2417 }
2418
2419 fn into_channel(self) -> fidl::Channel {
2420 self.client.into_channel()
2421 }
2422
2423 fn as_channel(&self) -> &fidl::Channel {
2424 self.client.as_channel()
2425 }
2426}
2427
2428#[cfg(target_os = "fuchsia")]
2429impl BootControlSynchronousProxy {
2430 pub fn new(channel: fidl::Channel) -> Self {
2431 let protocol_name = <BootControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2432 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2433 }
2434
2435 pub fn into_channel(self) -> fidl::Channel {
2436 self.client.into_channel()
2437 }
2438
2439 pub fn wait_for_event(
2442 &self,
2443 deadline: zx::MonotonicInstant,
2444 ) -> Result<BootControlEvent, fidl::Error> {
2445 BootControlEvent::decode(self.client.wait_for_event(deadline)?)
2446 }
2447
2448 pub fn r#set_boot_complete(
2451 &self,
2452 ___deadline: zx::MonotonicInstant,
2453 ) -> Result<(), fidl::Error> {
2454 let _response = self.client.send_query::<
2455 fidl::encoding::EmptyPayload,
2456 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2457 >(
2458 (),
2459 0x3c9b9f24ad3ca2b5,
2460 fidl::encoding::DynamicFlags::FLEXIBLE,
2461 ___deadline,
2462 )?
2463 .into_result::<BootControlMarker>("set_boot_complete")?;
2464 Ok(_response)
2465 }
2466}
2467
2468#[derive(Debug, Clone)]
2469pub struct BootControlProxy {
2470 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2471}
2472
2473impl fidl::endpoints::Proxy for BootControlProxy {
2474 type Protocol = BootControlMarker;
2475
2476 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2477 Self::new(inner)
2478 }
2479
2480 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2481 self.client.into_channel().map_err(|client| Self { client })
2482 }
2483
2484 fn as_channel(&self) -> &::fidl::AsyncChannel {
2485 self.client.as_channel()
2486 }
2487}
2488
2489impl BootControlProxy {
2490 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2492 let protocol_name = <BootControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2493 Self { client: fidl::client::Client::new(channel, protocol_name) }
2494 }
2495
2496 pub fn take_event_stream(&self) -> BootControlEventStream {
2502 BootControlEventStream { event_receiver: self.client.take_event_receiver() }
2503 }
2504
2505 pub fn r#set_boot_complete(
2508 &self,
2509 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2510 BootControlProxyInterface::r#set_boot_complete(self)
2511 }
2512}
2513
2514impl BootControlProxyInterface for BootControlProxy {
2515 type SetBootCompleteResponseFut =
2516 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2517 fn r#set_boot_complete(&self) -> Self::SetBootCompleteResponseFut {
2518 fn _decode(
2519 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2520 ) -> Result<(), fidl::Error> {
2521 let _response = fidl::client::decode_transaction_body::<
2522 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2523 fidl::encoding::DefaultFuchsiaResourceDialect,
2524 0x3c9b9f24ad3ca2b5,
2525 >(_buf?)?
2526 .into_result::<BootControlMarker>("set_boot_complete")?;
2527 Ok(_response)
2528 }
2529 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2530 (),
2531 0x3c9b9f24ad3ca2b5,
2532 fidl::encoding::DynamicFlags::FLEXIBLE,
2533 _decode,
2534 )
2535 }
2536}
2537
2538pub struct BootControlEventStream {
2539 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2540}
2541
2542impl std::marker::Unpin for BootControlEventStream {}
2543
2544impl futures::stream::FusedStream for BootControlEventStream {
2545 fn is_terminated(&self) -> bool {
2546 self.event_receiver.is_terminated()
2547 }
2548}
2549
2550impl futures::Stream for BootControlEventStream {
2551 type Item = Result<BootControlEvent, fidl::Error>;
2552
2553 fn poll_next(
2554 mut self: std::pin::Pin<&mut Self>,
2555 cx: &mut std::task::Context<'_>,
2556 ) -> std::task::Poll<Option<Self::Item>> {
2557 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2558 &mut self.event_receiver,
2559 cx
2560 )?) {
2561 Some(buf) => std::task::Poll::Ready(Some(BootControlEvent::decode(buf))),
2562 None => std::task::Poll::Ready(None),
2563 }
2564 }
2565}
2566
2567#[derive(Debug)]
2568pub enum BootControlEvent {
2569 #[non_exhaustive]
2570 _UnknownEvent {
2571 ordinal: u64,
2573 },
2574}
2575
2576impl BootControlEvent {
2577 fn decode(
2579 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2580 ) -> Result<BootControlEvent, fidl::Error> {
2581 let (bytes, _handles) = buf.split_mut();
2582 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2583 debug_assert_eq!(tx_header.tx_id, 0);
2584 match tx_header.ordinal {
2585 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2586 Ok(BootControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2587 }
2588 _ => Err(fidl::Error::UnknownOrdinal {
2589 ordinal: tx_header.ordinal,
2590 protocol_name: <BootControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2591 }),
2592 }
2593 }
2594}
2595
2596pub struct BootControlRequestStream {
2598 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2599 is_terminated: bool,
2600}
2601
2602impl std::marker::Unpin for BootControlRequestStream {}
2603
2604impl futures::stream::FusedStream for BootControlRequestStream {
2605 fn is_terminated(&self) -> bool {
2606 self.is_terminated
2607 }
2608}
2609
2610impl fidl::endpoints::RequestStream for BootControlRequestStream {
2611 type Protocol = BootControlMarker;
2612 type ControlHandle = BootControlControlHandle;
2613
2614 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2615 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2616 }
2617
2618 fn control_handle(&self) -> Self::ControlHandle {
2619 BootControlControlHandle { inner: self.inner.clone() }
2620 }
2621
2622 fn into_inner(
2623 self,
2624 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2625 {
2626 (self.inner, self.is_terminated)
2627 }
2628
2629 fn from_inner(
2630 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2631 is_terminated: bool,
2632 ) -> Self {
2633 Self { inner, is_terminated }
2634 }
2635}
2636
2637impl futures::Stream for BootControlRequestStream {
2638 type Item = Result<BootControlRequest, fidl::Error>;
2639
2640 fn poll_next(
2641 mut self: std::pin::Pin<&mut Self>,
2642 cx: &mut std::task::Context<'_>,
2643 ) -> std::task::Poll<Option<Self::Item>> {
2644 let this = &mut *self;
2645 if this.inner.check_shutdown(cx) {
2646 this.is_terminated = true;
2647 return std::task::Poll::Ready(None);
2648 }
2649 if this.is_terminated {
2650 panic!("polled BootControlRequestStream after completion");
2651 }
2652 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2653 |bytes, handles| {
2654 match this.inner.channel().read_etc(cx, bytes, handles) {
2655 std::task::Poll::Ready(Ok(())) => {}
2656 std::task::Poll::Pending => return std::task::Poll::Pending,
2657 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2658 this.is_terminated = true;
2659 return std::task::Poll::Ready(None);
2660 }
2661 std::task::Poll::Ready(Err(e)) => {
2662 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2663 e.into(),
2664 ))))
2665 }
2666 }
2667
2668 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2670
2671 std::task::Poll::Ready(Some(match header.ordinal {
2672 0x3c9b9f24ad3ca2b5 => {
2673 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2674 let mut req = fidl::new_empty!(
2675 fidl::encoding::EmptyPayload,
2676 fidl::encoding::DefaultFuchsiaResourceDialect
2677 );
2678 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2679 let control_handle = BootControlControlHandle { inner: this.inner.clone() };
2680 Ok(BootControlRequest::SetBootComplete {
2681 responder: BootControlSetBootCompleteResponder {
2682 control_handle: std::mem::ManuallyDrop::new(control_handle),
2683 tx_id: header.tx_id,
2684 },
2685 })
2686 }
2687 _ if header.tx_id == 0
2688 && header
2689 .dynamic_flags()
2690 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2691 {
2692 Ok(BootControlRequest::_UnknownMethod {
2693 ordinal: header.ordinal,
2694 control_handle: BootControlControlHandle { inner: this.inner.clone() },
2695 method_type: fidl::MethodType::OneWay,
2696 })
2697 }
2698 _ if header
2699 .dynamic_flags()
2700 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2701 {
2702 this.inner.send_framework_err(
2703 fidl::encoding::FrameworkErr::UnknownMethod,
2704 header.tx_id,
2705 header.ordinal,
2706 header.dynamic_flags(),
2707 (bytes, handles),
2708 )?;
2709 Ok(BootControlRequest::_UnknownMethod {
2710 ordinal: header.ordinal,
2711 control_handle: BootControlControlHandle { inner: this.inner.clone() },
2712 method_type: fidl::MethodType::TwoWay,
2713 })
2714 }
2715 _ => Err(fidl::Error::UnknownOrdinal {
2716 ordinal: header.ordinal,
2717 protocol_name:
2718 <BootControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2719 }),
2720 }))
2721 },
2722 )
2723 }
2724}
2725
2726#[derive(Debug)]
2728pub enum BootControlRequest {
2729 SetBootComplete { responder: BootControlSetBootCompleteResponder },
2732 #[non_exhaustive]
2734 _UnknownMethod {
2735 ordinal: u64,
2737 control_handle: BootControlControlHandle,
2738 method_type: fidl::MethodType,
2739 },
2740}
2741
2742impl BootControlRequest {
2743 #[allow(irrefutable_let_patterns)]
2744 pub fn into_set_boot_complete(self) -> Option<(BootControlSetBootCompleteResponder)> {
2745 if let BootControlRequest::SetBootComplete { responder } = self {
2746 Some((responder))
2747 } else {
2748 None
2749 }
2750 }
2751
2752 pub fn method_name(&self) -> &'static str {
2754 match *self {
2755 BootControlRequest::SetBootComplete { .. } => "set_boot_complete",
2756 BootControlRequest::_UnknownMethod {
2757 method_type: fidl::MethodType::OneWay, ..
2758 } => "unknown one-way method",
2759 BootControlRequest::_UnknownMethod {
2760 method_type: fidl::MethodType::TwoWay, ..
2761 } => "unknown two-way method",
2762 }
2763 }
2764}
2765
2766#[derive(Debug, Clone)]
2767pub struct BootControlControlHandle {
2768 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2769}
2770
2771impl fidl::endpoints::ControlHandle for BootControlControlHandle {
2772 fn shutdown(&self) {
2773 self.inner.shutdown()
2774 }
2775 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2776 self.inner.shutdown_with_epitaph(status)
2777 }
2778
2779 fn is_closed(&self) -> bool {
2780 self.inner.channel().is_closed()
2781 }
2782 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2783 self.inner.channel().on_closed()
2784 }
2785
2786 #[cfg(target_os = "fuchsia")]
2787 fn signal_peer(
2788 &self,
2789 clear_mask: zx::Signals,
2790 set_mask: zx::Signals,
2791 ) -> Result<(), zx_status::Status> {
2792 use fidl::Peered;
2793 self.inner.channel().signal_peer(clear_mask, set_mask)
2794 }
2795}
2796
2797impl BootControlControlHandle {}
2798
2799#[must_use = "FIDL methods require a response to be sent"]
2800#[derive(Debug)]
2801pub struct BootControlSetBootCompleteResponder {
2802 control_handle: std::mem::ManuallyDrop<BootControlControlHandle>,
2803 tx_id: u32,
2804}
2805
2806impl std::ops::Drop for BootControlSetBootCompleteResponder {
2810 fn drop(&mut self) {
2811 self.control_handle.shutdown();
2812 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2814 }
2815}
2816
2817impl fidl::endpoints::Responder for BootControlSetBootCompleteResponder {
2818 type ControlHandle = BootControlControlHandle;
2819
2820 fn control_handle(&self) -> &BootControlControlHandle {
2821 &self.control_handle
2822 }
2823
2824 fn drop_without_shutdown(mut self) {
2825 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2827 std::mem::forget(self);
2829 }
2830}
2831
2832impl BootControlSetBootCompleteResponder {
2833 pub fn send(self) -> Result<(), fidl::Error> {
2837 let _result = self.send_raw();
2838 if _result.is_err() {
2839 self.control_handle.shutdown();
2840 }
2841 self.drop_without_shutdown();
2842 _result
2843 }
2844
2845 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2847 let _result = self.send_raw();
2848 self.drop_without_shutdown();
2849 _result
2850 }
2851
2852 fn send_raw(&self) -> Result<(), fidl::Error> {
2853 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2854 fidl::encoding::Flexible::new(()),
2855 self.tx_id,
2856 0x3c9b9f24ad3ca2b5,
2857 fidl::encoding::DynamicFlags::FLEXIBLE,
2858 )
2859 }
2860}
2861
2862#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2863pub struct CpuElementManagerMarker;
2864
2865impl fidl::endpoints::ProtocolMarker for CpuElementManagerMarker {
2866 type Proxy = CpuElementManagerProxy;
2867 type RequestStream = CpuElementManagerRequestStream;
2868 #[cfg(target_os = "fuchsia")]
2869 type SynchronousProxy = CpuElementManagerSynchronousProxy;
2870
2871 const DEBUG_NAME: &'static str = "fuchsia.power.system.CpuElementManager";
2872}
2873impl fidl::endpoints::DiscoverableProtocolMarker for CpuElementManagerMarker {}
2874pub type CpuElementManagerAddExecutionStateDependencyResult =
2875 Result<(), AddExecutionStateDependencyError>;
2876
2877pub trait CpuElementManagerProxyInterface: Send + Sync {
2878 type GetCpuDependencyTokenResponseFut: std::future::Future<Output = Result<Cpu, fidl::Error>>
2879 + Send;
2880 fn r#get_cpu_dependency_token(&self) -> Self::GetCpuDependencyTokenResponseFut;
2881 type AddExecutionStateDependencyResponseFut: std::future::Future<
2882 Output = Result<CpuElementManagerAddExecutionStateDependencyResult, fidl::Error>,
2883 > + Send;
2884 fn r#add_execution_state_dependency(
2885 &self,
2886 payload: CpuElementManagerAddExecutionStateDependencyRequest,
2887 ) -> Self::AddExecutionStateDependencyResponseFut;
2888}
2889#[derive(Debug)]
2890#[cfg(target_os = "fuchsia")]
2891pub struct CpuElementManagerSynchronousProxy {
2892 client: fidl::client::sync::Client,
2893}
2894
2895#[cfg(target_os = "fuchsia")]
2896impl fidl::endpoints::SynchronousProxy for CpuElementManagerSynchronousProxy {
2897 type Proxy = CpuElementManagerProxy;
2898 type Protocol = CpuElementManagerMarker;
2899
2900 fn from_channel(inner: fidl::Channel) -> Self {
2901 Self::new(inner)
2902 }
2903
2904 fn into_channel(self) -> fidl::Channel {
2905 self.client.into_channel()
2906 }
2907
2908 fn as_channel(&self) -> &fidl::Channel {
2909 self.client.as_channel()
2910 }
2911}
2912
2913#[cfg(target_os = "fuchsia")]
2914impl CpuElementManagerSynchronousProxy {
2915 pub fn new(channel: fidl::Channel) -> Self {
2916 let protocol_name =
2917 <CpuElementManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2918 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2919 }
2920
2921 pub fn into_channel(self) -> fidl::Channel {
2922 self.client.into_channel()
2923 }
2924
2925 pub fn wait_for_event(
2928 &self,
2929 deadline: zx::MonotonicInstant,
2930 ) -> Result<CpuElementManagerEvent, fidl::Error> {
2931 CpuElementManagerEvent::decode(self.client.wait_for_event(deadline)?)
2932 }
2933
2934 pub fn r#get_cpu_dependency_token(
2936 &self,
2937 ___deadline: zx::MonotonicInstant,
2938 ) -> Result<Cpu, fidl::Error> {
2939 let _response = self
2940 .client
2941 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleType<Cpu>>(
2942 (),
2943 0x2c43645ed70344ba,
2944 fidl::encoding::DynamicFlags::FLEXIBLE,
2945 ___deadline,
2946 )?
2947 .into_result::<CpuElementManagerMarker>("get_cpu_dependency_token")?;
2948 Ok(_response)
2949 }
2950
2951 pub fn r#add_execution_state_dependency(
2961 &self,
2962 mut payload: CpuElementManagerAddExecutionStateDependencyRequest,
2963 ___deadline: zx::MonotonicInstant,
2964 ) -> Result<CpuElementManagerAddExecutionStateDependencyResult, fidl::Error> {
2965 let _response = self.client.send_query::<
2966 CpuElementManagerAddExecutionStateDependencyRequest,
2967 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, AddExecutionStateDependencyError>,
2968 >(
2969 &mut payload,
2970 0xdf2f5ea2af76234,
2971 fidl::encoding::DynamicFlags::FLEXIBLE,
2972 ___deadline,
2973 )?
2974 .into_result::<CpuElementManagerMarker>("add_execution_state_dependency")?;
2975 Ok(_response.map(|x| x))
2976 }
2977}
2978
2979#[derive(Debug, Clone)]
2980pub struct CpuElementManagerProxy {
2981 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2982}
2983
2984impl fidl::endpoints::Proxy for CpuElementManagerProxy {
2985 type Protocol = CpuElementManagerMarker;
2986
2987 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2988 Self::new(inner)
2989 }
2990
2991 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2992 self.client.into_channel().map_err(|client| Self { client })
2993 }
2994
2995 fn as_channel(&self) -> &::fidl::AsyncChannel {
2996 self.client.as_channel()
2997 }
2998}
2999
3000impl CpuElementManagerProxy {
3001 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3003 let protocol_name =
3004 <CpuElementManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3005 Self { client: fidl::client::Client::new(channel, protocol_name) }
3006 }
3007
3008 pub fn take_event_stream(&self) -> CpuElementManagerEventStream {
3014 CpuElementManagerEventStream { event_receiver: self.client.take_event_receiver() }
3015 }
3016
3017 pub fn r#get_cpu_dependency_token(
3019 &self,
3020 ) -> fidl::client::QueryResponseFut<Cpu, fidl::encoding::DefaultFuchsiaResourceDialect> {
3021 CpuElementManagerProxyInterface::r#get_cpu_dependency_token(self)
3022 }
3023
3024 pub fn r#add_execution_state_dependency(
3034 &self,
3035 mut payload: CpuElementManagerAddExecutionStateDependencyRequest,
3036 ) -> fidl::client::QueryResponseFut<
3037 CpuElementManagerAddExecutionStateDependencyResult,
3038 fidl::encoding::DefaultFuchsiaResourceDialect,
3039 > {
3040 CpuElementManagerProxyInterface::r#add_execution_state_dependency(self, payload)
3041 }
3042}
3043
3044impl CpuElementManagerProxyInterface for CpuElementManagerProxy {
3045 type GetCpuDependencyTokenResponseFut =
3046 fidl::client::QueryResponseFut<Cpu, fidl::encoding::DefaultFuchsiaResourceDialect>;
3047 fn r#get_cpu_dependency_token(&self) -> Self::GetCpuDependencyTokenResponseFut {
3048 fn _decode(
3049 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3050 ) -> Result<Cpu, fidl::Error> {
3051 let _response = fidl::client::decode_transaction_body::<
3052 fidl::encoding::FlexibleType<Cpu>,
3053 fidl::encoding::DefaultFuchsiaResourceDialect,
3054 0x2c43645ed70344ba,
3055 >(_buf?)?
3056 .into_result::<CpuElementManagerMarker>("get_cpu_dependency_token")?;
3057 Ok(_response)
3058 }
3059 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Cpu>(
3060 (),
3061 0x2c43645ed70344ba,
3062 fidl::encoding::DynamicFlags::FLEXIBLE,
3063 _decode,
3064 )
3065 }
3066
3067 type AddExecutionStateDependencyResponseFut = fidl::client::QueryResponseFut<
3068 CpuElementManagerAddExecutionStateDependencyResult,
3069 fidl::encoding::DefaultFuchsiaResourceDialect,
3070 >;
3071 fn r#add_execution_state_dependency(
3072 &self,
3073 mut payload: CpuElementManagerAddExecutionStateDependencyRequest,
3074 ) -> Self::AddExecutionStateDependencyResponseFut {
3075 fn _decode(
3076 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3077 ) -> Result<CpuElementManagerAddExecutionStateDependencyResult, fidl::Error> {
3078 let _response = fidl::client::decode_transaction_body::<
3079 fidl::encoding::FlexibleResultType<
3080 fidl::encoding::EmptyStruct,
3081 AddExecutionStateDependencyError,
3082 >,
3083 fidl::encoding::DefaultFuchsiaResourceDialect,
3084 0xdf2f5ea2af76234,
3085 >(_buf?)?
3086 .into_result::<CpuElementManagerMarker>("add_execution_state_dependency")?;
3087 Ok(_response.map(|x| x))
3088 }
3089 self.client.send_query_and_decode::<
3090 CpuElementManagerAddExecutionStateDependencyRequest,
3091 CpuElementManagerAddExecutionStateDependencyResult,
3092 >(
3093 &mut payload,
3094 0xdf2f5ea2af76234,
3095 fidl::encoding::DynamicFlags::FLEXIBLE,
3096 _decode,
3097 )
3098 }
3099}
3100
3101pub struct CpuElementManagerEventStream {
3102 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3103}
3104
3105impl std::marker::Unpin for CpuElementManagerEventStream {}
3106
3107impl futures::stream::FusedStream for CpuElementManagerEventStream {
3108 fn is_terminated(&self) -> bool {
3109 self.event_receiver.is_terminated()
3110 }
3111}
3112
3113impl futures::Stream for CpuElementManagerEventStream {
3114 type Item = Result<CpuElementManagerEvent, fidl::Error>;
3115
3116 fn poll_next(
3117 mut self: std::pin::Pin<&mut Self>,
3118 cx: &mut std::task::Context<'_>,
3119 ) -> std::task::Poll<Option<Self::Item>> {
3120 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3121 &mut self.event_receiver,
3122 cx
3123 )?) {
3124 Some(buf) => std::task::Poll::Ready(Some(CpuElementManagerEvent::decode(buf))),
3125 None => std::task::Poll::Ready(None),
3126 }
3127 }
3128}
3129
3130#[derive(Debug)]
3131pub enum CpuElementManagerEvent {
3132 #[non_exhaustive]
3133 _UnknownEvent {
3134 ordinal: u64,
3136 },
3137}
3138
3139impl CpuElementManagerEvent {
3140 fn decode(
3142 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3143 ) -> Result<CpuElementManagerEvent, fidl::Error> {
3144 let (bytes, _handles) = buf.split_mut();
3145 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3146 debug_assert_eq!(tx_header.tx_id, 0);
3147 match tx_header.ordinal {
3148 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3149 Ok(CpuElementManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3150 }
3151 _ => Err(fidl::Error::UnknownOrdinal {
3152 ordinal: tx_header.ordinal,
3153 protocol_name:
3154 <CpuElementManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3155 }),
3156 }
3157 }
3158}
3159
3160pub struct CpuElementManagerRequestStream {
3162 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3163 is_terminated: bool,
3164}
3165
3166impl std::marker::Unpin for CpuElementManagerRequestStream {}
3167
3168impl futures::stream::FusedStream for CpuElementManagerRequestStream {
3169 fn is_terminated(&self) -> bool {
3170 self.is_terminated
3171 }
3172}
3173
3174impl fidl::endpoints::RequestStream for CpuElementManagerRequestStream {
3175 type Protocol = CpuElementManagerMarker;
3176 type ControlHandle = CpuElementManagerControlHandle;
3177
3178 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3179 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3180 }
3181
3182 fn control_handle(&self) -> Self::ControlHandle {
3183 CpuElementManagerControlHandle { inner: self.inner.clone() }
3184 }
3185
3186 fn into_inner(
3187 self,
3188 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3189 {
3190 (self.inner, self.is_terminated)
3191 }
3192
3193 fn from_inner(
3194 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3195 is_terminated: bool,
3196 ) -> Self {
3197 Self { inner, is_terminated }
3198 }
3199}
3200
3201impl futures::Stream for CpuElementManagerRequestStream {
3202 type Item = Result<CpuElementManagerRequest, fidl::Error>;
3203
3204 fn poll_next(
3205 mut self: std::pin::Pin<&mut Self>,
3206 cx: &mut std::task::Context<'_>,
3207 ) -> std::task::Poll<Option<Self::Item>> {
3208 let this = &mut *self;
3209 if this.inner.check_shutdown(cx) {
3210 this.is_terminated = true;
3211 return std::task::Poll::Ready(None);
3212 }
3213 if this.is_terminated {
3214 panic!("polled CpuElementManagerRequestStream after completion");
3215 }
3216 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3217 |bytes, handles| {
3218 match this.inner.channel().read_etc(cx, bytes, handles) {
3219 std::task::Poll::Ready(Ok(())) => {}
3220 std::task::Poll::Pending => return std::task::Poll::Pending,
3221 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3222 this.is_terminated = true;
3223 return std::task::Poll::Ready(None);
3224 }
3225 std::task::Poll::Ready(Err(e)) => {
3226 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3227 e.into(),
3228 ))))
3229 }
3230 }
3231
3232 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3234
3235 std::task::Poll::Ready(Some(match header.ordinal {
3236 0x2c43645ed70344ba => {
3237 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3238 let mut req = fidl::new_empty!(
3239 fidl::encoding::EmptyPayload,
3240 fidl::encoding::DefaultFuchsiaResourceDialect
3241 );
3242 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3243 let control_handle =
3244 CpuElementManagerControlHandle { inner: this.inner.clone() };
3245 Ok(CpuElementManagerRequest::GetCpuDependencyToken {
3246 responder: CpuElementManagerGetCpuDependencyTokenResponder {
3247 control_handle: std::mem::ManuallyDrop::new(control_handle),
3248 tx_id: header.tx_id,
3249 },
3250 })
3251 }
3252 0xdf2f5ea2af76234 => {
3253 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3254 let mut req = fidl::new_empty!(
3255 CpuElementManagerAddExecutionStateDependencyRequest,
3256 fidl::encoding::DefaultFuchsiaResourceDialect
3257 );
3258 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CpuElementManagerAddExecutionStateDependencyRequest>(&header, _body_bytes, handles, &mut req)?;
3259 let control_handle =
3260 CpuElementManagerControlHandle { inner: this.inner.clone() };
3261 Ok(CpuElementManagerRequest::AddExecutionStateDependency {
3262 payload: req,
3263 responder: CpuElementManagerAddExecutionStateDependencyResponder {
3264 control_handle: std::mem::ManuallyDrop::new(control_handle),
3265 tx_id: header.tx_id,
3266 },
3267 })
3268 }
3269 _ if header.tx_id == 0
3270 && header
3271 .dynamic_flags()
3272 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3273 {
3274 Ok(CpuElementManagerRequest::_UnknownMethod {
3275 ordinal: header.ordinal,
3276 control_handle: CpuElementManagerControlHandle {
3277 inner: this.inner.clone(),
3278 },
3279 method_type: fidl::MethodType::OneWay,
3280 })
3281 }
3282 _ if header
3283 .dynamic_flags()
3284 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3285 {
3286 this.inner.send_framework_err(
3287 fidl::encoding::FrameworkErr::UnknownMethod,
3288 header.tx_id,
3289 header.ordinal,
3290 header.dynamic_flags(),
3291 (bytes, handles),
3292 )?;
3293 Ok(CpuElementManagerRequest::_UnknownMethod {
3294 ordinal: header.ordinal,
3295 control_handle: CpuElementManagerControlHandle {
3296 inner: this.inner.clone(),
3297 },
3298 method_type: fidl::MethodType::TwoWay,
3299 })
3300 }
3301 _ => Err(fidl::Error::UnknownOrdinal {
3302 ordinal: header.ordinal,
3303 protocol_name:
3304 <CpuElementManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3305 }),
3306 }))
3307 },
3308 )
3309 }
3310}
3311
3312#[derive(Debug)]
3314pub enum CpuElementManagerRequest {
3315 GetCpuDependencyToken { responder: CpuElementManagerGetCpuDependencyTokenResponder },
3317 AddExecutionStateDependency {
3327 payload: CpuElementManagerAddExecutionStateDependencyRequest,
3328 responder: CpuElementManagerAddExecutionStateDependencyResponder,
3329 },
3330 #[non_exhaustive]
3332 _UnknownMethod {
3333 ordinal: u64,
3335 control_handle: CpuElementManagerControlHandle,
3336 method_type: fidl::MethodType,
3337 },
3338}
3339
3340impl CpuElementManagerRequest {
3341 #[allow(irrefutable_let_patterns)]
3342 pub fn into_get_cpu_dependency_token(
3343 self,
3344 ) -> Option<(CpuElementManagerGetCpuDependencyTokenResponder)> {
3345 if let CpuElementManagerRequest::GetCpuDependencyToken { responder } = self {
3346 Some((responder))
3347 } else {
3348 None
3349 }
3350 }
3351
3352 #[allow(irrefutable_let_patterns)]
3353 pub fn into_add_execution_state_dependency(
3354 self,
3355 ) -> Option<(
3356 CpuElementManagerAddExecutionStateDependencyRequest,
3357 CpuElementManagerAddExecutionStateDependencyResponder,
3358 )> {
3359 if let CpuElementManagerRequest::AddExecutionStateDependency { payload, responder } = self {
3360 Some((payload, responder))
3361 } else {
3362 None
3363 }
3364 }
3365
3366 pub fn method_name(&self) -> &'static str {
3368 match *self {
3369 CpuElementManagerRequest::GetCpuDependencyToken { .. } => "get_cpu_dependency_token",
3370 CpuElementManagerRequest::AddExecutionStateDependency { .. } => {
3371 "add_execution_state_dependency"
3372 }
3373 CpuElementManagerRequest::_UnknownMethod {
3374 method_type: fidl::MethodType::OneWay,
3375 ..
3376 } => "unknown one-way method",
3377 CpuElementManagerRequest::_UnknownMethod {
3378 method_type: fidl::MethodType::TwoWay,
3379 ..
3380 } => "unknown two-way method",
3381 }
3382 }
3383}
3384
3385#[derive(Debug, Clone)]
3386pub struct CpuElementManagerControlHandle {
3387 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3388}
3389
3390impl fidl::endpoints::ControlHandle for CpuElementManagerControlHandle {
3391 fn shutdown(&self) {
3392 self.inner.shutdown()
3393 }
3394 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3395 self.inner.shutdown_with_epitaph(status)
3396 }
3397
3398 fn is_closed(&self) -> bool {
3399 self.inner.channel().is_closed()
3400 }
3401 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3402 self.inner.channel().on_closed()
3403 }
3404
3405 #[cfg(target_os = "fuchsia")]
3406 fn signal_peer(
3407 &self,
3408 clear_mask: zx::Signals,
3409 set_mask: zx::Signals,
3410 ) -> Result<(), zx_status::Status> {
3411 use fidl::Peered;
3412 self.inner.channel().signal_peer(clear_mask, set_mask)
3413 }
3414}
3415
3416impl CpuElementManagerControlHandle {}
3417
3418#[must_use = "FIDL methods require a response to be sent"]
3419#[derive(Debug)]
3420pub struct CpuElementManagerGetCpuDependencyTokenResponder {
3421 control_handle: std::mem::ManuallyDrop<CpuElementManagerControlHandle>,
3422 tx_id: u32,
3423}
3424
3425impl std::ops::Drop for CpuElementManagerGetCpuDependencyTokenResponder {
3429 fn drop(&mut self) {
3430 self.control_handle.shutdown();
3431 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3433 }
3434}
3435
3436impl fidl::endpoints::Responder for CpuElementManagerGetCpuDependencyTokenResponder {
3437 type ControlHandle = CpuElementManagerControlHandle;
3438
3439 fn control_handle(&self) -> &CpuElementManagerControlHandle {
3440 &self.control_handle
3441 }
3442
3443 fn drop_without_shutdown(mut self) {
3444 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3446 std::mem::forget(self);
3448 }
3449}
3450
3451impl CpuElementManagerGetCpuDependencyTokenResponder {
3452 pub fn send(self, mut payload: Cpu) -> Result<(), fidl::Error> {
3456 let _result = self.send_raw(payload);
3457 if _result.is_err() {
3458 self.control_handle.shutdown();
3459 }
3460 self.drop_without_shutdown();
3461 _result
3462 }
3463
3464 pub fn send_no_shutdown_on_err(self, mut payload: Cpu) -> Result<(), fidl::Error> {
3466 let _result = self.send_raw(payload);
3467 self.drop_without_shutdown();
3468 _result
3469 }
3470
3471 fn send_raw(&self, mut payload: Cpu) -> Result<(), fidl::Error> {
3472 self.control_handle.inner.send::<fidl::encoding::FlexibleType<Cpu>>(
3473 fidl::encoding::Flexible::new(&mut payload),
3474 self.tx_id,
3475 0x2c43645ed70344ba,
3476 fidl::encoding::DynamicFlags::FLEXIBLE,
3477 )
3478 }
3479}
3480
3481#[must_use = "FIDL methods require a response to be sent"]
3482#[derive(Debug)]
3483pub struct CpuElementManagerAddExecutionStateDependencyResponder {
3484 control_handle: std::mem::ManuallyDrop<CpuElementManagerControlHandle>,
3485 tx_id: u32,
3486}
3487
3488impl std::ops::Drop for CpuElementManagerAddExecutionStateDependencyResponder {
3492 fn drop(&mut self) {
3493 self.control_handle.shutdown();
3494 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3496 }
3497}
3498
3499impl fidl::endpoints::Responder for CpuElementManagerAddExecutionStateDependencyResponder {
3500 type ControlHandle = CpuElementManagerControlHandle;
3501
3502 fn control_handle(&self) -> &CpuElementManagerControlHandle {
3503 &self.control_handle
3504 }
3505
3506 fn drop_without_shutdown(mut self) {
3507 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3509 std::mem::forget(self);
3511 }
3512}
3513
3514impl CpuElementManagerAddExecutionStateDependencyResponder {
3515 pub fn send(
3519 self,
3520 mut result: Result<(), AddExecutionStateDependencyError>,
3521 ) -> Result<(), fidl::Error> {
3522 let _result = self.send_raw(result);
3523 if _result.is_err() {
3524 self.control_handle.shutdown();
3525 }
3526 self.drop_without_shutdown();
3527 _result
3528 }
3529
3530 pub fn send_no_shutdown_on_err(
3532 self,
3533 mut result: Result<(), AddExecutionStateDependencyError>,
3534 ) -> Result<(), fidl::Error> {
3535 let _result = self.send_raw(result);
3536 self.drop_without_shutdown();
3537 _result
3538 }
3539
3540 fn send_raw(
3541 &self,
3542 mut result: Result<(), AddExecutionStateDependencyError>,
3543 ) -> Result<(), fidl::Error> {
3544 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3545 fidl::encoding::EmptyStruct,
3546 AddExecutionStateDependencyError,
3547 >>(
3548 fidl::encoding::FlexibleResult::new(result),
3549 self.tx_id,
3550 0xdf2f5ea2af76234,
3551 fidl::encoding::DynamicFlags::FLEXIBLE,
3552 )
3553 }
3554}
3555
3556mod internal {
3557 use super::*;
3558 unsafe impl fidl::encoding::TypeMarker for AcquireWakeLeaseError {
3559 type Owned = Self;
3560
3561 #[inline(always)]
3562 fn inline_align(_context: fidl::encoding::Context) -> usize {
3563 std::mem::align_of::<u32>()
3564 }
3565
3566 #[inline(always)]
3567 fn inline_size(_context: fidl::encoding::Context) -> usize {
3568 std::mem::size_of::<u32>()
3569 }
3570
3571 #[inline(always)]
3572 fn encode_is_copy() -> bool {
3573 false
3574 }
3575
3576 #[inline(always)]
3577 fn decode_is_copy() -> bool {
3578 false
3579 }
3580 }
3581
3582 impl fidl::encoding::ValueTypeMarker for AcquireWakeLeaseError {
3583 type Borrowed<'a> = Self;
3584 #[inline(always)]
3585 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3586 *value
3587 }
3588 }
3589
3590 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3591 for AcquireWakeLeaseError
3592 {
3593 #[inline]
3594 unsafe fn encode(
3595 self,
3596 encoder: &mut fidl::encoding::Encoder<'_, D>,
3597 offset: usize,
3598 _depth: fidl::encoding::Depth,
3599 ) -> fidl::Result<()> {
3600 encoder.debug_check_bounds::<Self>(offset);
3601 encoder.write_num(self.into_primitive(), offset);
3602 Ok(())
3603 }
3604 }
3605
3606 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AcquireWakeLeaseError {
3607 #[inline(always)]
3608 fn new_empty() -> Self {
3609 Self::unknown()
3610 }
3611
3612 #[inline]
3613 unsafe fn decode(
3614 &mut self,
3615 decoder: &mut fidl::encoding::Decoder<'_, D>,
3616 offset: usize,
3617 _depth: fidl::encoding::Depth,
3618 ) -> fidl::Result<()> {
3619 decoder.debug_check_bounds::<Self>(offset);
3620 let prim = decoder.read_num::<u32>(offset);
3621
3622 *self = Self::from_primitive_allow_unknown(prim);
3623 Ok(())
3624 }
3625 }
3626 unsafe impl fidl::encoding::TypeMarker for AddExecutionStateDependencyError {
3627 type Owned = Self;
3628
3629 #[inline(always)]
3630 fn inline_align(_context: fidl::encoding::Context) -> usize {
3631 std::mem::align_of::<u32>()
3632 }
3633
3634 #[inline(always)]
3635 fn inline_size(_context: fidl::encoding::Context) -> usize {
3636 std::mem::size_of::<u32>()
3637 }
3638
3639 #[inline(always)]
3640 fn encode_is_copy() -> bool {
3641 false
3642 }
3643
3644 #[inline(always)]
3645 fn decode_is_copy() -> bool {
3646 false
3647 }
3648 }
3649
3650 impl fidl::encoding::ValueTypeMarker for AddExecutionStateDependencyError {
3651 type Borrowed<'a> = Self;
3652 #[inline(always)]
3653 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3654 *value
3655 }
3656 }
3657
3658 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3659 for AddExecutionStateDependencyError
3660 {
3661 #[inline]
3662 unsafe fn encode(
3663 self,
3664 encoder: &mut fidl::encoding::Encoder<'_, D>,
3665 offset: usize,
3666 _depth: fidl::encoding::Depth,
3667 ) -> fidl::Result<()> {
3668 encoder.debug_check_bounds::<Self>(offset);
3669 encoder.write_num(self.into_primitive(), offset);
3670 Ok(())
3671 }
3672 }
3673
3674 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3675 for AddExecutionStateDependencyError
3676 {
3677 #[inline(always)]
3678 fn new_empty() -> Self {
3679 Self::unknown()
3680 }
3681
3682 #[inline]
3683 unsafe fn decode(
3684 &mut self,
3685 decoder: &mut fidl::encoding::Decoder<'_, D>,
3686 offset: usize,
3687 _depth: fidl::encoding::Depth,
3688 ) -> fidl::Result<()> {
3689 decoder.debug_check_bounds::<Self>(offset);
3690 let prim = decoder.read_num::<u32>(offset);
3691
3692 *self = Self::from_primitive_allow_unknown(prim);
3693 Ok(())
3694 }
3695 }
3696 unsafe impl fidl::encoding::TypeMarker for ApplicationActivityLevel {
3697 type Owned = Self;
3698
3699 #[inline(always)]
3700 fn inline_align(_context: fidl::encoding::Context) -> usize {
3701 std::mem::align_of::<u8>()
3702 }
3703
3704 #[inline(always)]
3705 fn inline_size(_context: fidl::encoding::Context) -> usize {
3706 std::mem::size_of::<u8>()
3707 }
3708
3709 #[inline(always)]
3710 fn encode_is_copy() -> bool {
3711 false
3712 }
3713
3714 #[inline(always)]
3715 fn decode_is_copy() -> bool {
3716 false
3717 }
3718 }
3719
3720 impl fidl::encoding::ValueTypeMarker for ApplicationActivityLevel {
3721 type Borrowed<'a> = Self;
3722 #[inline(always)]
3723 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3724 *value
3725 }
3726 }
3727
3728 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3729 for ApplicationActivityLevel
3730 {
3731 #[inline]
3732 unsafe fn encode(
3733 self,
3734 encoder: &mut fidl::encoding::Encoder<'_, D>,
3735 offset: usize,
3736 _depth: fidl::encoding::Depth,
3737 ) -> fidl::Result<()> {
3738 encoder.debug_check_bounds::<Self>(offset);
3739 encoder.write_num(self.into_primitive(), offset);
3740 Ok(())
3741 }
3742 }
3743
3744 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3745 for ApplicationActivityLevel
3746 {
3747 #[inline(always)]
3748 fn new_empty() -> Self {
3749 Self::unknown()
3750 }
3751
3752 #[inline]
3753 unsafe fn decode(
3754 &mut self,
3755 decoder: &mut fidl::encoding::Decoder<'_, D>,
3756 offset: usize,
3757 _depth: fidl::encoding::Depth,
3758 ) -> fidl::Result<()> {
3759 decoder.debug_check_bounds::<Self>(offset);
3760 let prim = decoder.read_num::<u8>(offset);
3761
3762 *self = Self::from_primitive_allow_unknown(prim);
3763 Ok(())
3764 }
3765 }
3766 unsafe impl fidl::encoding::TypeMarker for CpuLevel {
3767 type Owned = Self;
3768
3769 #[inline(always)]
3770 fn inline_align(_context: fidl::encoding::Context) -> usize {
3771 std::mem::align_of::<u8>()
3772 }
3773
3774 #[inline(always)]
3775 fn inline_size(_context: fidl::encoding::Context) -> usize {
3776 std::mem::size_of::<u8>()
3777 }
3778
3779 #[inline(always)]
3780 fn encode_is_copy() -> bool {
3781 false
3782 }
3783
3784 #[inline(always)]
3785 fn decode_is_copy() -> bool {
3786 false
3787 }
3788 }
3789
3790 impl fidl::encoding::ValueTypeMarker for CpuLevel {
3791 type Borrowed<'a> = Self;
3792 #[inline(always)]
3793 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3794 *value
3795 }
3796 }
3797
3798 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CpuLevel {
3799 #[inline]
3800 unsafe fn encode(
3801 self,
3802 encoder: &mut fidl::encoding::Encoder<'_, D>,
3803 offset: usize,
3804 _depth: fidl::encoding::Depth,
3805 ) -> fidl::Result<()> {
3806 encoder.debug_check_bounds::<Self>(offset);
3807 encoder.write_num(self.into_primitive(), offset);
3808 Ok(())
3809 }
3810 }
3811
3812 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CpuLevel {
3813 #[inline(always)]
3814 fn new_empty() -> Self {
3815 Self::unknown()
3816 }
3817
3818 #[inline]
3819 unsafe fn decode(
3820 &mut self,
3821 decoder: &mut fidl::encoding::Decoder<'_, D>,
3822 offset: usize,
3823 _depth: fidl::encoding::Depth,
3824 ) -> fidl::Result<()> {
3825 decoder.debug_check_bounds::<Self>(offset);
3826 let prim = decoder.read_num::<u8>(offset);
3827
3828 *self = Self::from_primitive_allow_unknown(prim);
3829 Ok(())
3830 }
3831 }
3832 unsafe impl fidl::encoding::TypeMarker for ExecutionStateLevel {
3833 type Owned = Self;
3834
3835 #[inline(always)]
3836 fn inline_align(_context: fidl::encoding::Context) -> usize {
3837 std::mem::align_of::<u8>()
3838 }
3839
3840 #[inline(always)]
3841 fn inline_size(_context: fidl::encoding::Context) -> usize {
3842 std::mem::size_of::<u8>()
3843 }
3844
3845 #[inline(always)]
3846 fn encode_is_copy() -> bool {
3847 false
3848 }
3849
3850 #[inline(always)]
3851 fn decode_is_copy() -> bool {
3852 false
3853 }
3854 }
3855
3856 impl fidl::encoding::ValueTypeMarker for ExecutionStateLevel {
3857 type Borrowed<'a> = Self;
3858 #[inline(always)]
3859 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3860 *value
3861 }
3862 }
3863
3864 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3865 for ExecutionStateLevel
3866 {
3867 #[inline]
3868 unsafe fn encode(
3869 self,
3870 encoder: &mut fidl::encoding::Encoder<'_, D>,
3871 offset: usize,
3872 _depth: fidl::encoding::Depth,
3873 ) -> fidl::Result<()> {
3874 encoder.debug_check_bounds::<Self>(offset);
3875 encoder.write_num(self.into_primitive(), offset);
3876 Ok(())
3877 }
3878 }
3879
3880 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExecutionStateLevel {
3881 #[inline(always)]
3882 fn new_empty() -> Self {
3883 Self::unknown()
3884 }
3885
3886 #[inline]
3887 unsafe fn decode(
3888 &mut self,
3889 decoder: &mut fidl::encoding::Decoder<'_, D>,
3890 offset: usize,
3891 _depth: fidl::encoding::Depth,
3892 ) -> fidl::Result<()> {
3893 decoder.debug_check_bounds::<Self>(offset);
3894 let prim = decoder.read_num::<u8>(offset);
3895
3896 *self = Self::from_primitive_allow_unknown(prim);
3897 Ok(())
3898 }
3899 }
3900
3901 impl fidl::encoding::ValueTypeMarker for ActivityGovernorAcquireWakeLeaseRequest {
3902 type Borrowed<'a> = &'a Self;
3903 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3904 value
3905 }
3906 }
3907
3908 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorAcquireWakeLeaseRequest {
3909 type Owned = Self;
3910
3911 #[inline(always)]
3912 fn inline_align(_context: fidl::encoding::Context) -> usize {
3913 8
3914 }
3915
3916 #[inline(always)]
3917 fn inline_size(_context: fidl::encoding::Context) -> usize {
3918 16
3919 }
3920 }
3921
3922 unsafe impl<D: fidl::encoding::ResourceDialect>
3923 fidl::encoding::Encode<ActivityGovernorAcquireWakeLeaseRequest, D>
3924 for &ActivityGovernorAcquireWakeLeaseRequest
3925 {
3926 #[inline]
3927 unsafe fn encode(
3928 self,
3929 encoder: &mut fidl::encoding::Encoder<'_, D>,
3930 offset: usize,
3931 _depth: fidl::encoding::Depth,
3932 ) -> fidl::Result<()> {
3933 encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseRequest>(offset);
3934 fidl::encoding::Encode::<ActivityGovernorAcquireWakeLeaseRequest, D>::encode(
3936 (<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
3937 &self.name,
3938 ),),
3939 encoder,
3940 offset,
3941 _depth,
3942 )
3943 }
3944 }
3945 unsafe impl<
3946 D: fidl::encoding::ResourceDialect,
3947 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
3948 > fidl::encoding::Encode<ActivityGovernorAcquireWakeLeaseRequest, D> for (T0,)
3949 {
3950 #[inline]
3951 unsafe fn encode(
3952 self,
3953 encoder: &mut fidl::encoding::Encoder<'_, D>,
3954 offset: usize,
3955 depth: fidl::encoding::Depth,
3956 ) -> fidl::Result<()> {
3957 encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseRequest>(offset);
3958 self.0.encode(encoder, offset + 0, depth)?;
3962 Ok(())
3963 }
3964 }
3965
3966 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3967 for ActivityGovernorAcquireWakeLeaseRequest
3968 {
3969 #[inline(always)]
3970 fn new_empty() -> Self {
3971 Self { name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
3972 }
3973
3974 #[inline]
3975 unsafe fn decode(
3976 &mut self,
3977 decoder: &mut fidl::encoding::Decoder<'_, D>,
3978 offset: usize,
3979 _depth: fidl::encoding::Depth,
3980 ) -> fidl::Result<()> {
3981 decoder.debug_check_bounds::<Self>(offset);
3982 fidl::decode!(
3984 fidl::encoding::BoundedString<64>,
3985 D,
3986 &mut self.name,
3987 decoder,
3988 offset + 0,
3989 _depth
3990 )?;
3991 Ok(())
3992 }
3993 }
3994
3995 impl fidl::encoding::ValueTypeMarker for ActivityGovernorTakeApplicationActivityLeaseRequest {
3996 type Borrowed<'a> = &'a Self;
3997 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3998 value
3999 }
4000 }
4001
4002 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorTakeApplicationActivityLeaseRequest {
4003 type Owned = Self;
4004
4005 #[inline(always)]
4006 fn inline_align(_context: fidl::encoding::Context) -> usize {
4007 8
4008 }
4009
4010 #[inline(always)]
4011 fn inline_size(_context: fidl::encoding::Context) -> usize {
4012 16
4013 }
4014 }
4015
4016 unsafe impl<D: fidl::encoding::ResourceDialect>
4017 fidl::encoding::Encode<ActivityGovernorTakeApplicationActivityLeaseRequest, D>
4018 for &ActivityGovernorTakeApplicationActivityLeaseRequest
4019 {
4020 #[inline]
4021 unsafe fn encode(
4022 self,
4023 encoder: &mut fidl::encoding::Encoder<'_, D>,
4024 offset: usize,
4025 _depth: fidl::encoding::Depth,
4026 ) -> fidl::Result<()> {
4027 encoder
4028 .debug_check_bounds::<ActivityGovernorTakeApplicationActivityLeaseRequest>(offset);
4029 fidl::encoding::Encode::<ActivityGovernorTakeApplicationActivityLeaseRequest, D>::encode(
4031 (<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
4032 &self.name,
4033 ),),
4034 encoder,
4035 offset,
4036 _depth,
4037 )
4038 }
4039 }
4040 unsafe impl<
4041 D: fidl::encoding::ResourceDialect,
4042 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
4043 > fidl::encoding::Encode<ActivityGovernorTakeApplicationActivityLeaseRequest, D> for (T0,)
4044 {
4045 #[inline]
4046 unsafe fn encode(
4047 self,
4048 encoder: &mut fidl::encoding::Encoder<'_, D>,
4049 offset: usize,
4050 depth: fidl::encoding::Depth,
4051 ) -> fidl::Result<()> {
4052 encoder
4053 .debug_check_bounds::<ActivityGovernorTakeApplicationActivityLeaseRequest>(offset);
4054 self.0.encode(encoder, offset + 0, depth)?;
4058 Ok(())
4059 }
4060 }
4061
4062 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4063 for ActivityGovernorTakeApplicationActivityLeaseRequest
4064 {
4065 #[inline(always)]
4066 fn new_empty() -> Self {
4067 Self { name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
4068 }
4069
4070 #[inline]
4071 unsafe fn decode(
4072 &mut self,
4073 decoder: &mut fidl::encoding::Decoder<'_, D>,
4074 offset: usize,
4075 _depth: fidl::encoding::Depth,
4076 ) -> fidl::Result<()> {
4077 decoder.debug_check_bounds::<Self>(offset);
4078 fidl::decode!(
4080 fidl::encoding::BoundedString<64>,
4081 D,
4082 &mut self.name,
4083 decoder,
4084 offset + 0,
4085 _depth
4086 )?;
4087 Ok(())
4088 }
4089 }
4090
4091 impl fidl::encoding::ValueTypeMarker for ActivityGovernorTakeWakeLeaseRequest {
4092 type Borrowed<'a> = &'a Self;
4093 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4094 value
4095 }
4096 }
4097
4098 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorTakeWakeLeaseRequest {
4099 type Owned = Self;
4100
4101 #[inline(always)]
4102 fn inline_align(_context: fidl::encoding::Context) -> usize {
4103 8
4104 }
4105
4106 #[inline(always)]
4107 fn inline_size(_context: fidl::encoding::Context) -> usize {
4108 16
4109 }
4110 }
4111
4112 unsafe impl<D: fidl::encoding::ResourceDialect>
4113 fidl::encoding::Encode<ActivityGovernorTakeWakeLeaseRequest, D>
4114 for &ActivityGovernorTakeWakeLeaseRequest
4115 {
4116 #[inline]
4117 unsafe fn encode(
4118 self,
4119 encoder: &mut fidl::encoding::Encoder<'_, D>,
4120 offset: usize,
4121 _depth: fidl::encoding::Depth,
4122 ) -> fidl::Result<()> {
4123 encoder.debug_check_bounds::<ActivityGovernorTakeWakeLeaseRequest>(offset);
4124 fidl::encoding::Encode::<ActivityGovernorTakeWakeLeaseRequest, D>::encode(
4126 (<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
4127 &self.name,
4128 ),),
4129 encoder,
4130 offset,
4131 _depth,
4132 )
4133 }
4134 }
4135 unsafe impl<
4136 D: fidl::encoding::ResourceDialect,
4137 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
4138 > fidl::encoding::Encode<ActivityGovernorTakeWakeLeaseRequest, D> for (T0,)
4139 {
4140 #[inline]
4141 unsafe fn encode(
4142 self,
4143 encoder: &mut fidl::encoding::Encoder<'_, D>,
4144 offset: usize,
4145 depth: fidl::encoding::Depth,
4146 ) -> fidl::Result<()> {
4147 encoder.debug_check_bounds::<ActivityGovernorTakeWakeLeaseRequest>(offset);
4148 self.0.encode(encoder, offset + 0, depth)?;
4152 Ok(())
4153 }
4154 }
4155
4156 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4157 for ActivityGovernorTakeWakeLeaseRequest
4158 {
4159 #[inline(always)]
4160 fn new_empty() -> Self {
4161 Self { name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
4162 }
4163
4164 #[inline]
4165 unsafe fn decode(
4166 &mut self,
4167 decoder: &mut fidl::encoding::Decoder<'_, D>,
4168 offset: usize,
4169 _depth: fidl::encoding::Depth,
4170 ) -> fidl::Result<()> {
4171 decoder.debug_check_bounds::<Self>(offset);
4172 fidl::decode!(
4174 fidl::encoding::BoundedString<64>,
4175 D,
4176 &mut self.name,
4177 decoder,
4178 offset + 0,
4179 _depth
4180 )?;
4181 Ok(())
4182 }
4183 }
4184
4185 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorAcquireWakeLeaseResponse {
4186 type Borrowed<'a> = &'a mut Self;
4187 fn take_or_borrow<'a>(
4188 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4189 ) -> Self::Borrowed<'a> {
4190 value
4191 }
4192 }
4193
4194 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorAcquireWakeLeaseResponse {
4195 type Owned = Self;
4196
4197 #[inline(always)]
4198 fn inline_align(_context: fidl::encoding::Context) -> usize {
4199 4
4200 }
4201
4202 #[inline(always)]
4203 fn inline_size(_context: fidl::encoding::Context) -> usize {
4204 4
4205 }
4206 }
4207
4208 unsafe impl
4209 fidl::encoding::Encode<
4210 ActivityGovernorAcquireWakeLeaseResponse,
4211 fidl::encoding::DefaultFuchsiaResourceDialect,
4212 > for &mut ActivityGovernorAcquireWakeLeaseResponse
4213 {
4214 #[inline]
4215 unsafe fn encode(
4216 self,
4217 encoder: &mut fidl::encoding::Encoder<
4218 '_,
4219 fidl::encoding::DefaultFuchsiaResourceDialect,
4220 >,
4221 offset: usize,
4222 _depth: fidl::encoding::Depth,
4223 ) -> fidl::Result<()> {
4224 encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseResponse>(offset);
4225 fidl::encoding::Encode::<
4227 ActivityGovernorAcquireWakeLeaseResponse,
4228 fidl::encoding::DefaultFuchsiaResourceDialect,
4229 >::encode(
4230 (<fidl::encoding::HandleType<
4231 fidl::EventPair,
4232 { fidl::ObjectType::EVENTPAIR.into_raw() },
4233 16387,
4234 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4235 &mut self.token
4236 ),),
4237 encoder,
4238 offset,
4239 _depth,
4240 )
4241 }
4242 }
4243 unsafe impl<
4244 T0: fidl::encoding::Encode<
4245 fidl::encoding::HandleType<
4246 fidl::EventPair,
4247 { fidl::ObjectType::EVENTPAIR.into_raw() },
4248 16387,
4249 >,
4250 fidl::encoding::DefaultFuchsiaResourceDialect,
4251 >,
4252 >
4253 fidl::encoding::Encode<
4254 ActivityGovernorAcquireWakeLeaseResponse,
4255 fidl::encoding::DefaultFuchsiaResourceDialect,
4256 > for (T0,)
4257 {
4258 #[inline]
4259 unsafe fn encode(
4260 self,
4261 encoder: &mut fidl::encoding::Encoder<
4262 '_,
4263 fidl::encoding::DefaultFuchsiaResourceDialect,
4264 >,
4265 offset: usize,
4266 depth: fidl::encoding::Depth,
4267 ) -> fidl::Result<()> {
4268 encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseResponse>(offset);
4269 self.0.encode(encoder, offset + 0, depth)?;
4273 Ok(())
4274 }
4275 }
4276
4277 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4278 for ActivityGovernorAcquireWakeLeaseResponse
4279 {
4280 #[inline(always)]
4281 fn new_empty() -> Self {
4282 Self {
4283 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
4284 }
4285 }
4286
4287 #[inline]
4288 unsafe fn decode(
4289 &mut self,
4290 decoder: &mut fidl::encoding::Decoder<
4291 '_,
4292 fidl::encoding::DefaultFuchsiaResourceDialect,
4293 >,
4294 offset: usize,
4295 _depth: fidl::encoding::Depth,
4296 ) -> fidl::Result<()> {
4297 decoder.debug_check_bounds::<Self>(offset);
4298 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4300 Ok(())
4301 }
4302 }
4303
4304 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorTakeApplicationActivityLeaseResponse {
4305 type Borrowed<'a> = &'a mut Self;
4306 fn take_or_borrow<'a>(
4307 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4308 ) -> Self::Borrowed<'a> {
4309 value
4310 }
4311 }
4312
4313 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorTakeApplicationActivityLeaseResponse {
4314 type Owned = Self;
4315
4316 #[inline(always)]
4317 fn inline_align(_context: fidl::encoding::Context) -> usize {
4318 4
4319 }
4320
4321 #[inline(always)]
4322 fn inline_size(_context: fidl::encoding::Context) -> usize {
4323 4
4324 }
4325 }
4326
4327 unsafe impl
4328 fidl::encoding::Encode<
4329 ActivityGovernorTakeApplicationActivityLeaseResponse,
4330 fidl::encoding::DefaultFuchsiaResourceDialect,
4331 > for &mut ActivityGovernorTakeApplicationActivityLeaseResponse
4332 {
4333 #[inline]
4334 unsafe fn encode(
4335 self,
4336 encoder: &mut fidl::encoding::Encoder<
4337 '_,
4338 fidl::encoding::DefaultFuchsiaResourceDialect,
4339 >,
4340 offset: usize,
4341 _depth: fidl::encoding::Depth,
4342 ) -> fidl::Result<()> {
4343 encoder
4344 .debug_check_bounds::<ActivityGovernorTakeApplicationActivityLeaseResponse>(offset);
4345 fidl::encoding::Encode::<
4347 ActivityGovernorTakeApplicationActivityLeaseResponse,
4348 fidl::encoding::DefaultFuchsiaResourceDialect,
4349 >::encode(
4350 (<fidl::encoding::HandleType<
4351 fidl::EventPair,
4352 { fidl::ObjectType::EVENTPAIR.into_raw() },
4353 16387,
4354 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4355 &mut self.token
4356 ),),
4357 encoder,
4358 offset,
4359 _depth,
4360 )
4361 }
4362 }
4363 unsafe impl<
4364 T0: fidl::encoding::Encode<
4365 fidl::encoding::HandleType<
4366 fidl::EventPair,
4367 { fidl::ObjectType::EVENTPAIR.into_raw() },
4368 16387,
4369 >,
4370 fidl::encoding::DefaultFuchsiaResourceDialect,
4371 >,
4372 >
4373 fidl::encoding::Encode<
4374 ActivityGovernorTakeApplicationActivityLeaseResponse,
4375 fidl::encoding::DefaultFuchsiaResourceDialect,
4376 > for (T0,)
4377 {
4378 #[inline]
4379 unsafe fn encode(
4380 self,
4381 encoder: &mut fidl::encoding::Encoder<
4382 '_,
4383 fidl::encoding::DefaultFuchsiaResourceDialect,
4384 >,
4385 offset: usize,
4386 depth: fidl::encoding::Depth,
4387 ) -> fidl::Result<()> {
4388 encoder
4389 .debug_check_bounds::<ActivityGovernorTakeApplicationActivityLeaseResponse>(offset);
4390 self.0.encode(encoder, offset + 0, depth)?;
4394 Ok(())
4395 }
4396 }
4397
4398 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4399 for ActivityGovernorTakeApplicationActivityLeaseResponse
4400 {
4401 #[inline(always)]
4402 fn new_empty() -> Self {
4403 Self {
4404 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
4405 }
4406 }
4407
4408 #[inline]
4409 unsafe fn decode(
4410 &mut self,
4411 decoder: &mut fidl::encoding::Decoder<
4412 '_,
4413 fidl::encoding::DefaultFuchsiaResourceDialect,
4414 >,
4415 offset: usize,
4416 _depth: fidl::encoding::Depth,
4417 ) -> fidl::Result<()> {
4418 decoder.debug_check_bounds::<Self>(offset);
4419 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4421 Ok(())
4422 }
4423 }
4424
4425 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorTakeWakeLeaseResponse {
4426 type Borrowed<'a> = &'a mut Self;
4427 fn take_or_borrow<'a>(
4428 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4429 ) -> Self::Borrowed<'a> {
4430 value
4431 }
4432 }
4433
4434 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorTakeWakeLeaseResponse {
4435 type Owned = Self;
4436
4437 #[inline(always)]
4438 fn inline_align(_context: fidl::encoding::Context) -> usize {
4439 4
4440 }
4441
4442 #[inline(always)]
4443 fn inline_size(_context: fidl::encoding::Context) -> usize {
4444 4
4445 }
4446 }
4447
4448 unsafe impl
4449 fidl::encoding::Encode<
4450 ActivityGovernorTakeWakeLeaseResponse,
4451 fidl::encoding::DefaultFuchsiaResourceDialect,
4452 > for &mut ActivityGovernorTakeWakeLeaseResponse
4453 {
4454 #[inline]
4455 unsafe fn encode(
4456 self,
4457 encoder: &mut fidl::encoding::Encoder<
4458 '_,
4459 fidl::encoding::DefaultFuchsiaResourceDialect,
4460 >,
4461 offset: usize,
4462 _depth: fidl::encoding::Depth,
4463 ) -> fidl::Result<()> {
4464 encoder.debug_check_bounds::<ActivityGovernorTakeWakeLeaseResponse>(offset);
4465 fidl::encoding::Encode::<
4467 ActivityGovernorTakeWakeLeaseResponse,
4468 fidl::encoding::DefaultFuchsiaResourceDialect,
4469 >::encode(
4470 (<fidl::encoding::HandleType<
4471 fidl::EventPair,
4472 { fidl::ObjectType::EVENTPAIR.into_raw() },
4473 16387,
4474 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4475 &mut self.token
4476 ),),
4477 encoder,
4478 offset,
4479 _depth,
4480 )
4481 }
4482 }
4483 unsafe impl<
4484 T0: fidl::encoding::Encode<
4485 fidl::encoding::HandleType<
4486 fidl::EventPair,
4487 { fidl::ObjectType::EVENTPAIR.into_raw() },
4488 16387,
4489 >,
4490 fidl::encoding::DefaultFuchsiaResourceDialect,
4491 >,
4492 >
4493 fidl::encoding::Encode<
4494 ActivityGovernorTakeWakeLeaseResponse,
4495 fidl::encoding::DefaultFuchsiaResourceDialect,
4496 > for (T0,)
4497 {
4498 #[inline]
4499 unsafe fn encode(
4500 self,
4501 encoder: &mut fidl::encoding::Encoder<
4502 '_,
4503 fidl::encoding::DefaultFuchsiaResourceDialect,
4504 >,
4505 offset: usize,
4506 depth: fidl::encoding::Depth,
4507 ) -> fidl::Result<()> {
4508 encoder.debug_check_bounds::<ActivityGovernorTakeWakeLeaseResponse>(offset);
4509 self.0.encode(encoder, offset + 0, depth)?;
4513 Ok(())
4514 }
4515 }
4516
4517 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4518 for ActivityGovernorTakeWakeLeaseResponse
4519 {
4520 #[inline(always)]
4521 fn new_empty() -> Self {
4522 Self {
4523 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
4524 }
4525 }
4526
4527 #[inline]
4528 unsafe fn decode(
4529 &mut self,
4530 decoder: &mut fidl::encoding::Decoder<
4531 '_,
4532 fidl::encoding::DefaultFuchsiaResourceDialect,
4533 >,
4534 offset: usize,
4535 _depth: fidl::encoding::Depth,
4536 ) -> fidl::Result<()> {
4537 decoder.debug_check_bounds::<Self>(offset);
4538 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4540 Ok(())
4541 }
4542 }
4543
4544 impl ActivityGovernorRegisterListenerRequest {
4545 #[inline(always)]
4546 fn max_ordinal_present(&self) -> u64 {
4547 if let Some(_) = self.listener {
4548 return 1;
4549 }
4550 0
4551 }
4552 }
4553
4554 impl fidl::encoding::ResourceTypeMarker for ActivityGovernorRegisterListenerRequest {
4555 type Borrowed<'a> = &'a mut Self;
4556 fn take_or_borrow<'a>(
4557 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4558 ) -> Self::Borrowed<'a> {
4559 value
4560 }
4561 }
4562
4563 unsafe impl fidl::encoding::TypeMarker for ActivityGovernorRegisterListenerRequest {
4564 type Owned = Self;
4565
4566 #[inline(always)]
4567 fn inline_align(_context: fidl::encoding::Context) -> usize {
4568 8
4569 }
4570
4571 #[inline(always)]
4572 fn inline_size(_context: fidl::encoding::Context) -> usize {
4573 16
4574 }
4575 }
4576
4577 unsafe impl
4578 fidl::encoding::Encode<
4579 ActivityGovernorRegisterListenerRequest,
4580 fidl::encoding::DefaultFuchsiaResourceDialect,
4581 > for &mut ActivityGovernorRegisterListenerRequest
4582 {
4583 unsafe fn encode(
4584 self,
4585 encoder: &mut fidl::encoding::Encoder<
4586 '_,
4587 fidl::encoding::DefaultFuchsiaResourceDialect,
4588 >,
4589 offset: usize,
4590 mut depth: fidl::encoding::Depth,
4591 ) -> fidl::Result<()> {
4592 encoder.debug_check_bounds::<ActivityGovernorRegisterListenerRequest>(offset);
4593 let max_ordinal: u64 = self.max_ordinal_present();
4595 encoder.write_num(max_ordinal, offset);
4596 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4597 if max_ordinal == 0 {
4599 return Ok(());
4600 }
4601 depth.increment()?;
4602 let envelope_size = 8;
4603 let bytes_len = max_ordinal as usize * envelope_size;
4604 #[allow(unused_variables)]
4605 let offset = encoder.out_of_line_offset(bytes_len);
4606 let mut _prev_end_offset: usize = 0;
4607 if 1 > max_ordinal {
4608 return Ok(());
4609 }
4610
4611 let cur_offset: usize = (1 - 1) * envelope_size;
4614
4615 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4617
4618 fidl::encoding::encode_in_envelope_optional::<
4623 fidl::encoding::Endpoint<
4624 fidl::endpoints::ClientEnd<ActivityGovernorListenerMarker>,
4625 >,
4626 fidl::encoding::DefaultFuchsiaResourceDialect,
4627 >(
4628 self.listener.as_mut().map(
4629 <fidl::encoding::Endpoint<
4630 fidl::endpoints::ClientEnd<ActivityGovernorListenerMarker>,
4631 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4632 ),
4633 encoder,
4634 offset + cur_offset,
4635 depth,
4636 )?;
4637
4638 _prev_end_offset = cur_offset + envelope_size;
4639
4640 Ok(())
4641 }
4642 }
4643
4644 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4645 for ActivityGovernorRegisterListenerRequest
4646 {
4647 #[inline(always)]
4648 fn new_empty() -> Self {
4649 Self::default()
4650 }
4651
4652 unsafe fn decode(
4653 &mut self,
4654 decoder: &mut fidl::encoding::Decoder<
4655 '_,
4656 fidl::encoding::DefaultFuchsiaResourceDialect,
4657 >,
4658 offset: usize,
4659 mut depth: fidl::encoding::Depth,
4660 ) -> fidl::Result<()> {
4661 decoder.debug_check_bounds::<Self>(offset);
4662 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4663 None => return Err(fidl::Error::NotNullable),
4664 Some(len) => len,
4665 };
4666 if len == 0 {
4668 return Ok(());
4669 };
4670 depth.increment()?;
4671 let envelope_size = 8;
4672 let bytes_len = len * envelope_size;
4673 let offset = decoder.out_of_line_offset(bytes_len)?;
4674 let mut _next_ordinal_to_read = 0;
4676 let mut next_offset = offset;
4677 let end_offset = offset + bytes_len;
4678 _next_ordinal_to_read += 1;
4679 if next_offset >= end_offset {
4680 return Ok(());
4681 }
4682
4683 while _next_ordinal_to_read < 1 {
4685 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4686 _next_ordinal_to_read += 1;
4687 next_offset += envelope_size;
4688 }
4689
4690 let next_out_of_line = decoder.next_out_of_line();
4691 let handles_before = decoder.remaining_handles();
4692 if let Some((inlined, num_bytes, num_handles)) =
4693 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4694 {
4695 let member_inline_size = <fidl::encoding::Endpoint<
4696 fidl::endpoints::ClientEnd<ActivityGovernorListenerMarker>,
4697 > as fidl::encoding::TypeMarker>::inline_size(
4698 decoder.context
4699 );
4700 if inlined != (member_inline_size <= 4) {
4701 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4702 }
4703 let inner_offset;
4704 let mut inner_depth = depth.clone();
4705 if inlined {
4706 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4707 inner_offset = next_offset;
4708 } else {
4709 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4710 inner_depth.increment()?;
4711 }
4712 let val_ref = self.listener.get_or_insert_with(|| {
4713 fidl::new_empty!(
4714 fidl::encoding::Endpoint<
4715 fidl::endpoints::ClientEnd<ActivityGovernorListenerMarker>,
4716 >,
4717 fidl::encoding::DefaultFuchsiaResourceDialect
4718 )
4719 });
4720 fidl::decode!(
4721 fidl::encoding::Endpoint<
4722 fidl::endpoints::ClientEnd<ActivityGovernorListenerMarker>,
4723 >,
4724 fidl::encoding::DefaultFuchsiaResourceDialect,
4725 val_ref,
4726 decoder,
4727 inner_offset,
4728 inner_depth
4729 )?;
4730 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4731 {
4732 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4733 }
4734 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4735 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4736 }
4737 }
4738
4739 next_offset += envelope_size;
4740
4741 while next_offset < end_offset {
4743 _next_ordinal_to_read += 1;
4744 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4745 next_offset += envelope_size;
4746 }
4747
4748 Ok(())
4749 }
4750 }
4751
4752 impl ApplicationActivity {
4753 #[inline(always)]
4754 fn max_ordinal_present(&self) -> u64 {
4755 if let Some(_) = self.assertive_dependency_token {
4756 return 1;
4757 }
4758 0
4759 }
4760 }
4761
4762 impl fidl::encoding::ResourceTypeMarker for ApplicationActivity {
4763 type Borrowed<'a> = &'a mut Self;
4764 fn take_or_borrow<'a>(
4765 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4766 ) -> Self::Borrowed<'a> {
4767 value
4768 }
4769 }
4770
4771 unsafe impl fidl::encoding::TypeMarker for ApplicationActivity {
4772 type Owned = Self;
4773
4774 #[inline(always)]
4775 fn inline_align(_context: fidl::encoding::Context) -> usize {
4776 8
4777 }
4778
4779 #[inline(always)]
4780 fn inline_size(_context: fidl::encoding::Context) -> usize {
4781 16
4782 }
4783 }
4784
4785 unsafe impl
4786 fidl::encoding::Encode<ApplicationActivity, fidl::encoding::DefaultFuchsiaResourceDialect>
4787 for &mut ApplicationActivity
4788 {
4789 unsafe fn encode(
4790 self,
4791 encoder: &mut fidl::encoding::Encoder<
4792 '_,
4793 fidl::encoding::DefaultFuchsiaResourceDialect,
4794 >,
4795 offset: usize,
4796 mut depth: fidl::encoding::Depth,
4797 ) -> fidl::Result<()> {
4798 encoder.debug_check_bounds::<ApplicationActivity>(offset);
4799 let max_ordinal: u64 = self.max_ordinal_present();
4801 encoder.write_num(max_ordinal, offset);
4802 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4803 if max_ordinal == 0 {
4805 return Ok(());
4806 }
4807 depth.increment()?;
4808 let envelope_size = 8;
4809 let bytes_len = max_ordinal as usize * envelope_size;
4810 #[allow(unused_variables)]
4811 let offset = encoder.out_of_line_offset(bytes_len);
4812 let mut _prev_end_offset: usize = 0;
4813 if 1 > max_ordinal {
4814 return Ok(());
4815 }
4816
4817 let cur_offset: usize = (1 - 1) * envelope_size;
4820
4821 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4823
4824 fidl::encoding::encode_in_envelope_optional::<
4829 fidl::encoding::HandleType<
4830 fidl::Event,
4831 { fidl::ObjectType::EVENT.into_raw() },
4832 2147483648,
4833 >,
4834 fidl::encoding::DefaultFuchsiaResourceDialect,
4835 >(
4836 self.assertive_dependency_token.as_mut().map(
4837 <fidl::encoding::HandleType<
4838 fidl::Event,
4839 { fidl::ObjectType::EVENT.into_raw() },
4840 2147483648,
4841 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4842 ),
4843 encoder,
4844 offset + cur_offset,
4845 depth,
4846 )?;
4847
4848 _prev_end_offset = cur_offset + envelope_size;
4849
4850 Ok(())
4851 }
4852 }
4853
4854 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4855 for ApplicationActivity
4856 {
4857 #[inline(always)]
4858 fn new_empty() -> Self {
4859 Self::default()
4860 }
4861
4862 unsafe fn decode(
4863 &mut self,
4864 decoder: &mut fidl::encoding::Decoder<
4865 '_,
4866 fidl::encoding::DefaultFuchsiaResourceDialect,
4867 >,
4868 offset: usize,
4869 mut depth: fidl::encoding::Depth,
4870 ) -> fidl::Result<()> {
4871 decoder.debug_check_bounds::<Self>(offset);
4872 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4873 None => return Err(fidl::Error::NotNullable),
4874 Some(len) => len,
4875 };
4876 if len == 0 {
4878 return Ok(());
4879 };
4880 depth.increment()?;
4881 let envelope_size = 8;
4882 let bytes_len = len * envelope_size;
4883 let offset = decoder.out_of_line_offset(bytes_len)?;
4884 let mut _next_ordinal_to_read = 0;
4886 let mut next_offset = offset;
4887 let end_offset = offset + bytes_len;
4888 _next_ordinal_to_read += 1;
4889 if next_offset >= end_offset {
4890 return Ok(());
4891 }
4892
4893 while _next_ordinal_to_read < 1 {
4895 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4896 _next_ordinal_to_read += 1;
4897 next_offset += envelope_size;
4898 }
4899
4900 let next_out_of_line = decoder.next_out_of_line();
4901 let handles_before = decoder.remaining_handles();
4902 if let Some((inlined, num_bytes, num_handles)) =
4903 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4904 {
4905 let member_inline_size = <fidl::encoding::HandleType<
4906 fidl::Event,
4907 { fidl::ObjectType::EVENT.into_raw() },
4908 2147483648,
4909 > as fidl::encoding::TypeMarker>::inline_size(
4910 decoder.context
4911 );
4912 if inlined != (member_inline_size <= 4) {
4913 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4914 }
4915 let inner_offset;
4916 let mut inner_depth = depth.clone();
4917 if inlined {
4918 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4919 inner_offset = next_offset;
4920 } else {
4921 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4922 inner_depth.increment()?;
4923 }
4924 let val_ref =
4925 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));
4926 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4927 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4928 {
4929 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4930 }
4931 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4932 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4933 }
4934 }
4935
4936 next_offset += envelope_size;
4937
4938 while next_offset < end_offset {
4940 _next_ordinal_to_read += 1;
4941 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4942 next_offset += envelope_size;
4943 }
4944
4945 Ok(())
4946 }
4947 }
4948
4949 impl Cpu {
4950 #[inline(always)]
4951 fn max_ordinal_present(&self) -> u64 {
4952 if let Some(_) = self.assertive_dependency_token {
4953 return 1;
4954 }
4955 0
4956 }
4957 }
4958
4959 impl fidl::encoding::ResourceTypeMarker for Cpu {
4960 type Borrowed<'a> = &'a mut Self;
4961 fn take_or_borrow<'a>(
4962 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4963 ) -> Self::Borrowed<'a> {
4964 value
4965 }
4966 }
4967
4968 unsafe impl fidl::encoding::TypeMarker for Cpu {
4969 type Owned = Self;
4970
4971 #[inline(always)]
4972 fn inline_align(_context: fidl::encoding::Context) -> usize {
4973 8
4974 }
4975
4976 #[inline(always)]
4977 fn inline_size(_context: fidl::encoding::Context) -> usize {
4978 16
4979 }
4980 }
4981
4982 unsafe impl fidl::encoding::Encode<Cpu, fidl::encoding::DefaultFuchsiaResourceDialect>
4983 for &mut Cpu
4984 {
4985 unsafe fn encode(
4986 self,
4987 encoder: &mut fidl::encoding::Encoder<
4988 '_,
4989 fidl::encoding::DefaultFuchsiaResourceDialect,
4990 >,
4991 offset: usize,
4992 mut depth: fidl::encoding::Depth,
4993 ) -> fidl::Result<()> {
4994 encoder.debug_check_bounds::<Cpu>(offset);
4995 let max_ordinal: u64 = self.max_ordinal_present();
4997 encoder.write_num(max_ordinal, offset);
4998 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4999 if max_ordinal == 0 {
5001 return Ok(());
5002 }
5003 depth.increment()?;
5004 let envelope_size = 8;
5005 let bytes_len = max_ordinal as usize * envelope_size;
5006 #[allow(unused_variables)]
5007 let offset = encoder.out_of_line_offset(bytes_len);
5008 let mut _prev_end_offset: usize = 0;
5009 if 1 > max_ordinal {
5010 return Ok(());
5011 }
5012
5013 let cur_offset: usize = (1 - 1) * envelope_size;
5016
5017 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5019
5020 fidl::encoding::encode_in_envelope_optional::<
5025 fidl::encoding::HandleType<
5026 fidl::Event,
5027 { fidl::ObjectType::EVENT.into_raw() },
5028 2147483648,
5029 >,
5030 fidl::encoding::DefaultFuchsiaResourceDialect,
5031 >(
5032 self.assertive_dependency_token.as_mut().map(
5033 <fidl::encoding::HandleType<
5034 fidl::Event,
5035 { fidl::ObjectType::EVENT.into_raw() },
5036 2147483648,
5037 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5038 ),
5039 encoder,
5040 offset + cur_offset,
5041 depth,
5042 )?;
5043
5044 _prev_end_offset = cur_offset + envelope_size;
5045
5046 Ok(())
5047 }
5048 }
5049
5050 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Cpu {
5051 #[inline(always)]
5052 fn new_empty() -> Self {
5053 Self::default()
5054 }
5055
5056 unsafe fn decode(
5057 &mut self,
5058 decoder: &mut fidl::encoding::Decoder<
5059 '_,
5060 fidl::encoding::DefaultFuchsiaResourceDialect,
5061 >,
5062 offset: usize,
5063 mut depth: fidl::encoding::Depth,
5064 ) -> fidl::Result<()> {
5065 decoder.debug_check_bounds::<Self>(offset);
5066 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5067 None => return Err(fidl::Error::NotNullable),
5068 Some(len) => len,
5069 };
5070 if len == 0 {
5072 return Ok(());
5073 };
5074 depth.increment()?;
5075 let envelope_size = 8;
5076 let bytes_len = len * envelope_size;
5077 let offset = decoder.out_of_line_offset(bytes_len)?;
5078 let mut _next_ordinal_to_read = 0;
5080 let mut next_offset = offset;
5081 let end_offset = offset + bytes_len;
5082 _next_ordinal_to_read += 1;
5083 if next_offset >= end_offset {
5084 return Ok(());
5085 }
5086
5087 while _next_ordinal_to_read < 1 {
5089 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5090 _next_ordinal_to_read += 1;
5091 next_offset += envelope_size;
5092 }
5093
5094 let next_out_of_line = decoder.next_out_of_line();
5095 let handles_before = decoder.remaining_handles();
5096 if let Some((inlined, num_bytes, num_handles)) =
5097 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5098 {
5099 let member_inline_size = <fidl::encoding::HandleType<
5100 fidl::Event,
5101 { fidl::ObjectType::EVENT.into_raw() },
5102 2147483648,
5103 > as fidl::encoding::TypeMarker>::inline_size(
5104 decoder.context
5105 );
5106 if inlined != (member_inline_size <= 4) {
5107 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5108 }
5109 let inner_offset;
5110 let mut inner_depth = depth.clone();
5111 if inlined {
5112 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5113 inner_offset = next_offset;
5114 } else {
5115 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5116 inner_depth.increment()?;
5117 }
5118 let val_ref =
5119 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));
5120 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5121 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5122 {
5123 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5124 }
5125 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5126 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5127 }
5128 }
5129
5130 next_offset += envelope_size;
5131
5132 while next_offset < end_offset {
5134 _next_ordinal_to_read += 1;
5135 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5136 next_offset += envelope_size;
5137 }
5138
5139 Ok(())
5140 }
5141 }
5142
5143 impl CpuElementManagerAddExecutionStateDependencyRequest {
5144 #[inline(always)]
5145 fn max_ordinal_present(&self) -> u64 {
5146 if let Some(_) = self.power_level {
5147 return 2;
5148 }
5149 if let Some(_) = self.dependency_token {
5150 return 1;
5151 }
5152 0
5153 }
5154 }
5155
5156 impl fidl::encoding::ResourceTypeMarker for CpuElementManagerAddExecutionStateDependencyRequest {
5157 type Borrowed<'a> = &'a mut Self;
5158 fn take_or_borrow<'a>(
5159 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5160 ) -> Self::Borrowed<'a> {
5161 value
5162 }
5163 }
5164
5165 unsafe impl fidl::encoding::TypeMarker for CpuElementManagerAddExecutionStateDependencyRequest {
5166 type Owned = Self;
5167
5168 #[inline(always)]
5169 fn inline_align(_context: fidl::encoding::Context) -> usize {
5170 8
5171 }
5172
5173 #[inline(always)]
5174 fn inline_size(_context: fidl::encoding::Context) -> usize {
5175 16
5176 }
5177 }
5178
5179 unsafe impl
5180 fidl::encoding::Encode<
5181 CpuElementManagerAddExecutionStateDependencyRequest,
5182 fidl::encoding::DefaultFuchsiaResourceDialect,
5183 > for &mut CpuElementManagerAddExecutionStateDependencyRequest
5184 {
5185 unsafe fn encode(
5186 self,
5187 encoder: &mut fidl::encoding::Encoder<
5188 '_,
5189 fidl::encoding::DefaultFuchsiaResourceDialect,
5190 >,
5191 offset: usize,
5192 mut depth: fidl::encoding::Depth,
5193 ) -> fidl::Result<()> {
5194 encoder
5195 .debug_check_bounds::<CpuElementManagerAddExecutionStateDependencyRequest>(offset);
5196 let max_ordinal: u64 = self.max_ordinal_present();
5198 encoder.write_num(max_ordinal, offset);
5199 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5200 if max_ordinal == 0 {
5202 return Ok(());
5203 }
5204 depth.increment()?;
5205 let envelope_size = 8;
5206 let bytes_len = max_ordinal as usize * envelope_size;
5207 #[allow(unused_variables)]
5208 let offset = encoder.out_of_line_offset(bytes_len);
5209 let mut _prev_end_offset: usize = 0;
5210 if 1 > max_ordinal {
5211 return Ok(());
5212 }
5213
5214 let cur_offset: usize = (1 - 1) * envelope_size;
5217
5218 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5220
5221 fidl::encoding::encode_in_envelope_optional::<
5226 fidl::encoding::HandleType<
5227 fidl::Event,
5228 { fidl::ObjectType::EVENT.into_raw() },
5229 2147483648,
5230 >,
5231 fidl::encoding::DefaultFuchsiaResourceDialect,
5232 >(
5233 self.dependency_token.as_mut().map(
5234 <fidl::encoding::HandleType<
5235 fidl::Event,
5236 { fidl::ObjectType::EVENT.into_raw() },
5237 2147483648,
5238 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5239 ),
5240 encoder,
5241 offset + cur_offset,
5242 depth,
5243 )?;
5244
5245 _prev_end_offset = cur_offset + envelope_size;
5246 if 2 > max_ordinal {
5247 return Ok(());
5248 }
5249
5250 let cur_offset: usize = (2 - 1) * envelope_size;
5253
5254 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5256
5257 fidl::encoding::encode_in_envelope_optional::<
5262 u8,
5263 fidl::encoding::DefaultFuchsiaResourceDialect,
5264 >(
5265 self.power_level.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
5266 encoder,
5267 offset + cur_offset,
5268 depth,
5269 )?;
5270
5271 _prev_end_offset = cur_offset + envelope_size;
5272
5273 Ok(())
5274 }
5275 }
5276
5277 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5278 for CpuElementManagerAddExecutionStateDependencyRequest
5279 {
5280 #[inline(always)]
5281 fn new_empty() -> Self {
5282 Self::default()
5283 }
5284
5285 unsafe fn decode(
5286 &mut self,
5287 decoder: &mut fidl::encoding::Decoder<
5288 '_,
5289 fidl::encoding::DefaultFuchsiaResourceDialect,
5290 >,
5291 offset: usize,
5292 mut depth: fidl::encoding::Depth,
5293 ) -> fidl::Result<()> {
5294 decoder.debug_check_bounds::<Self>(offset);
5295 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5296 None => return Err(fidl::Error::NotNullable),
5297 Some(len) => len,
5298 };
5299 if len == 0 {
5301 return Ok(());
5302 };
5303 depth.increment()?;
5304 let envelope_size = 8;
5305 let bytes_len = len * envelope_size;
5306 let offset = decoder.out_of_line_offset(bytes_len)?;
5307 let mut _next_ordinal_to_read = 0;
5309 let mut next_offset = offset;
5310 let end_offset = offset + bytes_len;
5311 _next_ordinal_to_read += 1;
5312 if next_offset >= end_offset {
5313 return Ok(());
5314 }
5315
5316 while _next_ordinal_to_read < 1 {
5318 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5319 _next_ordinal_to_read += 1;
5320 next_offset += envelope_size;
5321 }
5322
5323 let next_out_of_line = decoder.next_out_of_line();
5324 let handles_before = decoder.remaining_handles();
5325 if let Some((inlined, num_bytes, num_handles)) =
5326 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5327 {
5328 let member_inline_size = <fidl::encoding::HandleType<
5329 fidl::Event,
5330 { fidl::ObjectType::EVENT.into_raw() },
5331 2147483648,
5332 > as fidl::encoding::TypeMarker>::inline_size(
5333 decoder.context
5334 );
5335 if inlined != (member_inline_size <= 4) {
5336 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5337 }
5338 let inner_offset;
5339 let mut inner_depth = depth.clone();
5340 if inlined {
5341 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5342 inner_offset = next_offset;
5343 } else {
5344 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5345 inner_depth.increment()?;
5346 }
5347 let val_ref =
5348 self.dependency_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
5349 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5350 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5351 {
5352 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5353 }
5354 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5355 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5356 }
5357 }
5358
5359 next_offset += envelope_size;
5360 _next_ordinal_to_read += 1;
5361 if next_offset >= end_offset {
5362 return Ok(());
5363 }
5364
5365 while _next_ordinal_to_read < 2 {
5367 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5368 _next_ordinal_to_read += 1;
5369 next_offset += envelope_size;
5370 }
5371
5372 let next_out_of_line = decoder.next_out_of_line();
5373 let handles_before = decoder.remaining_handles();
5374 if let Some((inlined, num_bytes, num_handles)) =
5375 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5376 {
5377 let member_inline_size =
5378 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
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.power_level.get_or_insert_with(|| {
5392 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
5393 });
5394 fidl::decode!(
5395 u8,
5396 fidl::encoding::DefaultFuchsiaResourceDialect,
5397 val_ref,
5398 decoder,
5399 inner_offset,
5400 inner_depth
5401 )?;
5402 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5403 {
5404 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5405 }
5406 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5407 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5408 }
5409 }
5410
5411 next_offset += envelope_size;
5412
5413 while next_offset < end_offset {
5415 _next_ordinal_to_read += 1;
5416 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5417 next_offset += envelope_size;
5418 }
5419
5420 Ok(())
5421 }
5422 }
5423
5424 impl ExecutionState {
5425 #[inline(always)]
5426 fn max_ordinal_present(&self) -> u64 {
5427 if let Some(_) = self.opportunistic_dependency_token {
5428 return 1;
5429 }
5430 0
5431 }
5432 }
5433
5434 impl fidl::encoding::ResourceTypeMarker for ExecutionState {
5435 type Borrowed<'a> = &'a mut Self;
5436 fn take_or_borrow<'a>(
5437 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5438 ) -> Self::Borrowed<'a> {
5439 value
5440 }
5441 }
5442
5443 unsafe impl fidl::encoding::TypeMarker for ExecutionState {
5444 type Owned = Self;
5445
5446 #[inline(always)]
5447 fn inline_align(_context: fidl::encoding::Context) -> usize {
5448 8
5449 }
5450
5451 #[inline(always)]
5452 fn inline_size(_context: fidl::encoding::Context) -> usize {
5453 16
5454 }
5455 }
5456
5457 unsafe impl
5458 fidl::encoding::Encode<ExecutionState, fidl::encoding::DefaultFuchsiaResourceDialect>
5459 for &mut ExecutionState
5460 {
5461 unsafe fn encode(
5462 self,
5463 encoder: &mut fidl::encoding::Encoder<
5464 '_,
5465 fidl::encoding::DefaultFuchsiaResourceDialect,
5466 >,
5467 offset: usize,
5468 mut depth: fidl::encoding::Depth,
5469 ) -> fidl::Result<()> {
5470 encoder.debug_check_bounds::<ExecutionState>(offset);
5471 let max_ordinal: u64 = self.max_ordinal_present();
5473 encoder.write_num(max_ordinal, offset);
5474 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5475 if max_ordinal == 0 {
5477 return Ok(());
5478 }
5479 depth.increment()?;
5480 let envelope_size = 8;
5481 let bytes_len = max_ordinal as usize * envelope_size;
5482 #[allow(unused_variables)]
5483 let offset = encoder.out_of_line_offset(bytes_len);
5484 let mut _prev_end_offset: usize = 0;
5485 if 1 > max_ordinal {
5486 return Ok(());
5487 }
5488
5489 let cur_offset: usize = (1 - 1) * envelope_size;
5492
5493 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5495
5496 fidl::encoding::encode_in_envelope_optional::<
5501 fidl::encoding::HandleType<
5502 fidl::Event,
5503 { fidl::ObjectType::EVENT.into_raw() },
5504 2147483648,
5505 >,
5506 fidl::encoding::DefaultFuchsiaResourceDialect,
5507 >(
5508 self.opportunistic_dependency_token.as_mut().map(
5509 <fidl::encoding::HandleType<
5510 fidl::Event,
5511 { fidl::ObjectType::EVENT.into_raw() },
5512 2147483648,
5513 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5514 ),
5515 encoder,
5516 offset + cur_offset,
5517 depth,
5518 )?;
5519
5520 _prev_end_offset = cur_offset + envelope_size;
5521
5522 Ok(())
5523 }
5524 }
5525
5526 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5527 for ExecutionState
5528 {
5529 #[inline(always)]
5530 fn new_empty() -> Self {
5531 Self::default()
5532 }
5533
5534 unsafe fn decode(
5535 &mut self,
5536 decoder: &mut fidl::encoding::Decoder<
5537 '_,
5538 fidl::encoding::DefaultFuchsiaResourceDialect,
5539 >,
5540 offset: usize,
5541 mut depth: fidl::encoding::Depth,
5542 ) -> fidl::Result<()> {
5543 decoder.debug_check_bounds::<Self>(offset);
5544 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5545 None => return Err(fidl::Error::NotNullable),
5546 Some(len) => len,
5547 };
5548 if len == 0 {
5550 return Ok(());
5551 };
5552 depth.increment()?;
5553 let envelope_size = 8;
5554 let bytes_len = len * envelope_size;
5555 let offset = decoder.out_of_line_offset(bytes_len)?;
5556 let mut _next_ordinal_to_read = 0;
5558 let mut next_offset = offset;
5559 let end_offset = offset + bytes_len;
5560 _next_ordinal_to_read += 1;
5561 if next_offset >= end_offset {
5562 return Ok(());
5563 }
5564
5565 while _next_ordinal_to_read < 1 {
5567 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5568 _next_ordinal_to_read += 1;
5569 next_offset += envelope_size;
5570 }
5571
5572 let next_out_of_line = decoder.next_out_of_line();
5573 let handles_before = decoder.remaining_handles();
5574 if let Some((inlined, num_bytes, num_handles)) =
5575 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5576 {
5577 let member_inline_size = <fidl::encoding::HandleType<
5578 fidl::Event,
5579 { fidl::ObjectType::EVENT.into_raw() },
5580 2147483648,
5581 > as fidl::encoding::TypeMarker>::inline_size(
5582 decoder.context
5583 );
5584 if inlined != (member_inline_size <= 4) {
5585 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5586 }
5587 let inner_offset;
5588 let mut inner_depth = depth.clone();
5589 if inlined {
5590 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5591 inner_offset = next_offset;
5592 } else {
5593 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5594 inner_depth.increment()?;
5595 }
5596 let val_ref =
5597 self.opportunistic_dependency_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
5598 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5599 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5600 {
5601 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5602 }
5603 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5604 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5605 }
5606 }
5607
5608 next_offset += envelope_size;
5609
5610 while next_offset < end_offset {
5612 _next_ordinal_to_read += 1;
5613 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5614 next_offset += envelope_size;
5615 }
5616
5617 Ok(())
5618 }
5619 }
5620
5621 impl PowerElements {
5622 #[inline(always)]
5623 fn max_ordinal_present(&self) -> u64 {
5624 if let Some(_) = self.application_activity {
5625 return 3;
5626 }
5627 if let Some(_) = self.execution_state {
5628 return 1;
5629 }
5630 0
5631 }
5632 }
5633
5634 impl fidl::encoding::ResourceTypeMarker for PowerElements {
5635 type Borrowed<'a> = &'a mut Self;
5636 fn take_or_borrow<'a>(
5637 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5638 ) -> Self::Borrowed<'a> {
5639 value
5640 }
5641 }
5642
5643 unsafe impl fidl::encoding::TypeMarker for PowerElements {
5644 type Owned = Self;
5645
5646 #[inline(always)]
5647 fn inline_align(_context: fidl::encoding::Context) -> usize {
5648 8
5649 }
5650
5651 #[inline(always)]
5652 fn inline_size(_context: fidl::encoding::Context) -> usize {
5653 16
5654 }
5655 }
5656
5657 unsafe impl fidl::encoding::Encode<PowerElements, fidl::encoding::DefaultFuchsiaResourceDialect>
5658 for &mut PowerElements
5659 {
5660 unsafe fn encode(
5661 self,
5662 encoder: &mut fidl::encoding::Encoder<
5663 '_,
5664 fidl::encoding::DefaultFuchsiaResourceDialect,
5665 >,
5666 offset: usize,
5667 mut depth: fidl::encoding::Depth,
5668 ) -> fidl::Result<()> {
5669 encoder.debug_check_bounds::<PowerElements>(offset);
5670 let max_ordinal: u64 = self.max_ordinal_present();
5672 encoder.write_num(max_ordinal, offset);
5673 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5674 if max_ordinal == 0 {
5676 return Ok(());
5677 }
5678 depth.increment()?;
5679 let envelope_size = 8;
5680 let bytes_len = max_ordinal as usize * envelope_size;
5681 #[allow(unused_variables)]
5682 let offset = encoder.out_of_line_offset(bytes_len);
5683 let mut _prev_end_offset: usize = 0;
5684 if 1 > max_ordinal {
5685 return Ok(());
5686 }
5687
5688 let cur_offset: usize = (1 - 1) * envelope_size;
5691
5692 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5694
5695 fidl::encoding::encode_in_envelope_optional::<
5700 ExecutionState,
5701 fidl::encoding::DefaultFuchsiaResourceDialect,
5702 >(
5703 self.execution_state
5704 .as_mut()
5705 .map(<ExecutionState as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5706 encoder,
5707 offset + cur_offset,
5708 depth,
5709 )?;
5710
5711 _prev_end_offset = cur_offset + envelope_size;
5712 if 3 > max_ordinal {
5713 return Ok(());
5714 }
5715
5716 let cur_offset: usize = (3 - 1) * envelope_size;
5719
5720 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5722
5723 fidl::encoding::encode_in_envelope_optional::<
5728 ApplicationActivity,
5729 fidl::encoding::DefaultFuchsiaResourceDialect,
5730 >(
5731 self.application_activity.as_mut().map(
5732 <ApplicationActivity as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5733 ),
5734 encoder,
5735 offset + cur_offset,
5736 depth,
5737 )?;
5738
5739 _prev_end_offset = cur_offset + envelope_size;
5740
5741 Ok(())
5742 }
5743 }
5744
5745 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PowerElements {
5746 #[inline(always)]
5747 fn new_empty() -> Self {
5748 Self::default()
5749 }
5750
5751 unsafe fn decode(
5752 &mut self,
5753 decoder: &mut fidl::encoding::Decoder<
5754 '_,
5755 fidl::encoding::DefaultFuchsiaResourceDialect,
5756 >,
5757 offset: usize,
5758 mut depth: fidl::encoding::Depth,
5759 ) -> fidl::Result<()> {
5760 decoder.debug_check_bounds::<Self>(offset);
5761 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5762 None => return Err(fidl::Error::NotNullable),
5763 Some(len) => len,
5764 };
5765 if len == 0 {
5767 return Ok(());
5768 };
5769 depth.increment()?;
5770 let envelope_size = 8;
5771 let bytes_len = len * envelope_size;
5772 let offset = decoder.out_of_line_offset(bytes_len)?;
5773 let mut _next_ordinal_to_read = 0;
5775 let mut next_offset = offset;
5776 let end_offset = offset + bytes_len;
5777 _next_ordinal_to_read += 1;
5778 if next_offset >= end_offset {
5779 return Ok(());
5780 }
5781
5782 while _next_ordinal_to_read < 1 {
5784 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5785 _next_ordinal_to_read += 1;
5786 next_offset += envelope_size;
5787 }
5788
5789 let next_out_of_line = decoder.next_out_of_line();
5790 let handles_before = decoder.remaining_handles();
5791 if let Some((inlined, num_bytes, num_handles)) =
5792 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5793 {
5794 let member_inline_size =
5795 <ExecutionState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5796 if inlined != (member_inline_size <= 4) {
5797 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5798 }
5799 let inner_offset;
5800 let mut inner_depth = depth.clone();
5801 if inlined {
5802 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5803 inner_offset = next_offset;
5804 } else {
5805 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5806 inner_depth.increment()?;
5807 }
5808 let val_ref = self.execution_state.get_or_insert_with(|| {
5809 fidl::new_empty!(ExecutionState, fidl::encoding::DefaultFuchsiaResourceDialect)
5810 });
5811 fidl::decode!(
5812 ExecutionState,
5813 fidl::encoding::DefaultFuchsiaResourceDialect,
5814 val_ref,
5815 decoder,
5816 inner_offset,
5817 inner_depth
5818 )?;
5819 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5820 {
5821 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5822 }
5823 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5824 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5825 }
5826 }
5827
5828 next_offset += envelope_size;
5829 _next_ordinal_to_read += 1;
5830 if next_offset >= end_offset {
5831 return Ok(());
5832 }
5833
5834 while _next_ordinal_to_read < 3 {
5836 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5837 _next_ordinal_to_read += 1;
5838 next_offset += envelope_size;
5839 }
5840
5841 let next_out_of_line = decoder.next_out_of_line();
5842 let handles_before = decoder.remaining_handles();
5843 if let Some((inlined, num_bytes, num_handles)) =
5844 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5845 {
5846 let member_inline_size =
5847 <ApplicationActivity as fidl::encoding::TypeMarker>::inline_size(
5848 decoder.context,
5849 );
5850 if inlined != (member_inline_size <= 4) {
5851 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5852 }
5853 let inner_offset;
5854 let mut inner_depth = depth.clone();
5855 if inlined {
5856 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5857 inner_offset = next_offset;
5858 } else {
5859 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5860 inner_depth.increment()?;
5861 }
5862 let val_ref = self.application_activity.get_or_insert_with(|| {
5863 fidl::new_empty!(
5864 ApplicationActivity,
5865 fidl::encoding::DefaultFuchsiaResourceDialect
5866 )
5867 });
5868 fidl::decode!(
5869 ApplicationActivity,
5870 fidl::encoding::DefaultFuchsiaResourceDialect,
5871 val_ref,
5872 decoder,
5873 inner_offset,
5874 inner_depth
5875 )?;
5876 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5877 {
5878 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5879 }
5880 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5881 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5882 }
5883 }
5884
5885 next_offset += envelope_size;
5886
5887 while next_offset < end_offset {
5889 _next_ordinal_to_read += 1;
5890 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5891 next_offset += envelope_size;
5892 }
5893
5894 Ok(())
5895 }
5896 }
5897}