Skip to main content

fidl_fuchsia_power_system_common/
fidl_fuchsia_power_system_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_ELEMENT_NAME_LEN: u8 = 64;
12
13/// Errors returned by `ActivityGovernor/AcquireWakeLease` and `AcquireWakeLease2`.
14#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub enum AcquireWakeLeaseError {
16    /// The service encountered an error while attempting to issue a wake lease.
17    Internal,
18    /// The name for the wake lease is empty or invalid.
19    InvalidName,
20    /// The required `server_token` argument was not provided.
21    ServerTokenRequired,
22    /// The `previous_client_token` argument is invalid (for example, it refers
23    /// to the same token pair as `server_token`).
24    InvalidPreviousToken,
25    #[doc(hidden)]
26    __SourceBreaking { unknown_ordinal: u32 },
27}
28
29/// Pattern that matches an unknown `AcquireWakeLeaseError` member.
30#[macro_export]
31macro_rules! AcquireWakeLeaseErrorUnknown {
32    () => {
33        _
34    };
35}
36
37impl AcquireWakeLeaseError {
38    #[inline]
39    pub fn from_primitive(prim: u32) -> Option<Self> {
40        match prim {
41            1 => Some(Self::Internal),
42            2 => Some(Self::InvalidName),
43            3 => Some(Self::ServerTokenRequired),
44            4 => Some(Self::InvalidPreviousToken),
45            _ => None,
46        }
47    }
48
49    #[inline]
50    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
51        match prim {
52            1 => Self::Internal,
53            2 => Self::InvalidName,
54            3 => Self::ServerTokenRequired,
55            4 => Self::InvalidPreviousToken,
56            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
57        }
58    }
59
60    #[inline]
61    pub fn unknown() -> Self {
62        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
63    }
64
65    #[inline]
66    pub const fn into_primitive(self) -> u32 {
67        match self {
68            Self::Internal => 1,
69            Self::InvalidName => 2,
70            Self::ServerTokenRequired => 3,
71            Self::InvalidPreviousToken => 4,
72            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
73        }
74    }
75
76    #[inline]
77    pub fn is_unknown(&self) -> bool {
78        match self {
79            Self::__SourceBreaking { unknown_ordinal: _ } => true,
80            _ => false,
81        }
82    }
83}
84
85/// Error codes for responses from `AddApplicationActivityDependency` in
86/// [`fuchsia.power.system/ActivityGovernor`].
87#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
88pub enum AddApplicationActivityDependencyError {
89    /// The dependency already exists.
90    AlreadyExists,
91    /// Required arguments are either not given or are not valid.
92    Invalid,
93    /// The service encountered an error while attempting to add the dependency.
94    Internal,
95    #[doc(hidden)]
96    __SourceBreaking { unknown_ordinal: u32 },
97}
98
99/// Pattern that matches an unknown `AddApplicationActivityDependencyError` member.
100#[macro_export]
101macro_rules! AddApplicationActivityDependencyErrorUnknown {
102    () => {
103        _
104    };
105}
106
107impl AddApplicationActivityDependencyError {
108    #[inline]
109    pub fn from_primitive(prim: u32) -> Option<Self> {
110        match prim {
111            1 => Some(Self::AlreadyExists),
112            2 => Some(Self::Invalid),
113            3 => Some(Self::Internal),
114            _ => None,
115        }
116    }
117
118    #[inline]
119    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
120        match prim {
121            1 => Self::AlreadyExists,
122            2 => Self::Invalid,
123            3 => Self::Internal,
124            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
125        }
126    }
127
128    #[inline]
129    pub fn unknown() -> Self {
130        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
131    }
132
133    #[inline]
134    pub const fn into_primitive(self) -> u32 {
135        match self {
136            Self::AlreadyExists => 1,
137            Self::Invalid => 2,
138            Self::Internal => 3,
139            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
140        }
141    }
142
143    #[inline]
144    pub fn is_unknown(&self) -> bool {
145        match self {
146            Self::__SourceBreaking { unknown_ordinal: _ } => true,
147            _ => false,
148        }
149    }
150}
151
152/// Error codes for responses from `AddExecutionStateDependency` in
153/// [`fuchsia.power.system/CpuElementManager`].
154#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
155pub enum AddExecutionStateDependencyError {
156    /// Required arguments are either not given or are not valid.
157    InvalidArgs,
158    /// The server is not in a state to handle the request.
159    BadState,
160    #[doc(hidden)]
161    __SourceBreaking { unknown_ordinal: u32 },
162}
163
164/// Pattern that matches an unknown `AddExecutionStateDependencyError` member.
165#[macro_export]
166macro_rules! AddExecutionStateDependencyErrorUnknown {
167    () => {
168        _
169    };
170}
171
172impl AddExecutionStateDependencyError {
173    #[inline]
174    pub fn from_primitive(prim: u32) -> Option<Self> {
175        match prim {
176            1 => Some(Self::InvalidArgs),
177            2 => Some(Self::BadState),
178            _ => None,
179        }
180    }
181
182    #[inline]
183    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
184        match prim {
185            1 => Self::InvalidArgs,
186            2 => Self::BadState,
187            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
188        }
189    }
190
191    #[inline]
192    pub fn unknown() -> Self {
193        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
194    }
195
196    #[inline]
197    pub const fn into_primitive(self) -> u32 {
198        match self {
199            Self::InvalidArgs => 1,
200            Self::BadState => 2,
201            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
202        }
203    }
204
205    #[inline]
206    pub fn is_unknown(&self) -> bool {
207        match self {
208            Self::__SourceBreaking { unknown_ordinal: _ } => true,
209            _ => false,
210        }
211    }
212}
213
214/// Application activity power levels
215///
216/// Elements that need to keep the system from suspending should take an assertive
217/// dependency on `ApplicationActivityLevel::ACTIVE`. When these components are
218/// performing work, they should request a lease to ensure the system remains
219/// active, and drop the lease when they are done.
220#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
221pub enum ApplicationActivityLevel {
222    Inactive,
223    Active,
224    #[doc(hidden)]
225    __SourceBreaking {
226        unknown_ordinal: u8,
227    },
228}
229
230/// Pattern that matches an unknown `ApplicationActivityLevel` member.
231#[macro_export]
232macro_rules! ApplicationActivityLevelUnknown {
233    () => {
234        _
235    };
236}
237
238impl ApplicationActivityLevel {
239    #[inline]
240    pub fn from_primitive(prim: u8) -> Option<Self> {
241        match prim {
242            0 => Some(Self::Inactive),
243            1 => Some(Self::Active),
244            _ => None,
245        }
246    }
247
248    #[inline]
249    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
250        match prim {
251            0 => Self::Inactive,
252            1 => Self::Active,
253            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
254        }
255    }
256
257    #[inline]
258    pub fn unknown() -> Self {
259        Self::__SourceBreaking { unknown_ordinal: 0xff }
260    }
261
262    #[inline]
263    pub const fn into_primitive(self) -> u8 {
264        match self {
265            Self::Inactive => 0,
266            Self::Active => 1,
267            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
268        }
269    }
270
271    #[inline]
272    pub fn is_unknown(&self) -> bool {
273        match self {
274            Self::__SourceBreaking { unknown_ordinal: _ } => true,
275            _ => false,
276        }
277    }
278}
279
280/// CPU power levels
281///
282/// Elements should take an assertive dependency on `CpuLevel::ACTIVE`
283/// to ensure that the element will be suspended before the CPU suspends.
284#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
285pub enum CpuLevel {
286    Inactive,
287    Active,
288    #[doc(hidden)]
289    __SourceBreaking {
290        unknown_ordinal: u8,
291    },
292}
293
294/// Pattern that matches an unknown `CpuLevel` member.
295#[macro_export]
296macro_rules! CpuLevelUnknown {
297    () => {
298        _
299    };
300}
301
302impl CpuLevel {
303    #[inline]
304    pub fn from_primitive(prim: u8) -> Option<Self> {
305        match prim {
306            0 => Some(Self::Inactive),
307            1 => Some(Self::Active),
308            _ => None,
309        }
310    }
311
312    #[inline]
313    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
314        match prim {
315            0 => Self::Inactive,
316            1 => 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::Active => 1,
331            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
332        }
333    }
334
335    #[inline]
336    pub fn is_unknown(&self) -> bool {
337        match self {
338            Self::__SourceBreaking { unknown_ordinal: _ } => true,
339            _ => false,
340        }
341    }
342}
343
344/// Execution state power levels
345#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
346pub enum ExecutionStateLevel {
347    Inactive,
348    Suspending,
349    Active,
350    #[doc(hidden)]
351    __SourceBreaking {
352        unknown_ordinal: u8,
353    },
354}
355
356/// Pattern that matches an unknown `ExecutionStateLevel` member.
357#[macro_export]
358macro_rules! ExecutionStateLevelUnknown {
359    () => {
360        _
361    };
362}
363
364impl ExecutionStateLevel {
365    #[inline]
366    pub fn from_primitive(prim: u8) -> Option<Self> {
367        match prim {
368            0 => Some(Self::Inactive),
369            1 => Some(Self::Suspending),
370            2 => Some(Self::Active),
371            _ => None,
372        }
373    }
374
375    #[inline]
376    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
377        match prim {
378            0 => Self::Inactive,
379            1 => Self::Suspending,
380            2 => Self::Active,
381            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
382        }
383    }
384
385    #[inline]
386    pub fn unknown() -> Self {
387        Self::__SourceBreaking { unknown_ordinal: 0xff }
388    }
389
390    #[inline]
391    pub const fn into_primitive(self) -> u8 {
392        match self {
393            Self::Inactive => 0,
394            Self::Suspending => 1,
395            Self::Active => 2,
396            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
397        }
398    }
399
400    #[inline]
401    pub fn is_unknown(&self) -> bool {
402        match self {
403            Self::__SourceBreaking { unknown_ordinal: _ } => true,
404            _ => false,
405        }
406    }
407}
408
409/// Error codes for responses from `RegisterSuspendBlocker` in
410/// [`fuchsia.power.system/ActivityGovernor`].
411#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
412pub enum RegisterSuspendBlockerError {
413    /// The service encountered an error while attempting to issue a wake lease.
414    Internal,
415    /// Required arguments are either not given or are not valid.
416    InvalidArgs,
417    #[doc(hidden)]
418    __SourceBreaking { unknown_ordinal: u32 },
419}
420
421/// Pattern that matches an unknown `RegisterSuspendBlockerError` member.
422#[macro_export]
423macro_rules! RegisterSuspendBlockerErrorUnknown {
424    () => {
425        _
426    };
427}
428
429impl RegisterSuspendBlockerError {
430    #[inline]
431    pub fn from_primitive(prim: u32) -> Option<Self> {
432        match prim {
433            1 => Some(Self::Internal),
434            2 => Some(Self::InvalidArgs),
435            _ => None,
436        }
437    }
438
439    #[inline]
440    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
441        match prim {
442            1 => Self::Internal,
443            2 => Self::InvalidArgs,
444            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
445        }
446    }
447
448    #[inline]
449    pub fn unknown() -> Self {
450        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
451    }
452
453    #[inline]
454    pub const fn into_primitive(self) -> u32 {
455        match self {
456            Self::Internal => 1,
457            Self::InvalidArgs => 2,
458            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
459        }
460    }
461
462    #[inline]
463    pub fn is_unknown(&self) -> bool {
464        match self {
465            Self::__SourceBreaking { unknown_ordinal: _ } => true,
466            _ => false,
467        }
468    }
469}
470
471#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
472pub struct ActivityGovernorAcquireUnmonitoredWakeLeaseRequest {
473    /// The name of the lease.
474    ///
475    /// The name cannot be empty but is not required to be globally unique.
476    pub name: String,
477}
478
479impl fidl::Persistable for ActivityGovernorAcquireUnmonitoredWakeLeaseRequest {}
480
481#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
482pub struct ActivityGovernorAcquireWakeLeaseRequest {
483    /// The name of the lease.
484    ///
485    /// The name cannot be empty but is not required to be globally unique.
486    pub name: String,
487}
488
489impl fidl::Persistable for ActivityGovernorAcquireWakeLeaseRequest {}
490
491#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
492pub struct ActivityGovernorTakeApplicationActivityLeaseRequest {
493    /// The name of the lease.
494    ///
495    /// The name is not required to be globally unique.
496    pub name: String,
497}
498
499impl fidl::Persistable for ActivityGovernorTakeApplicationActivityLeaseRequest {}
500
501pub mod activity_governor_ordinals {
502    pub const GET_POWER_ELEMENTS: u64 = 0x798003259dfb5672;
503    pub const ACQUIRE_WAKE_LEASE: u64 = 0x2de25abd8fa7c103;
504    pub const ACQUIRE_UNMONITORED_WAKE_LEASE: u64 = 0x5f7007d6b0786da9;
505    pub const ACQUIRE_WAKE_LEASE_WITH_TOKEN: u64 = 0x1cdd2ea3bee46f51;
506    pub const ACQUIRE_WAKE_LEASE2: u64 = 0x6eb55a86b09ee23;
507    pub const TAKE_APPLICATION_ACTIVITY_LEASE: u64 = 0x37cd5364de7ada14;
508    pub const REGISTER_SUSPEND_BLOCKER: u64 = 0x34ef55b180feef01;
509}
510
511pub mod boot_control_ordinals {
512    pub const SET_BOOT_COMPLETE: u64 = 0x3c9b9f24ad3ca2b5;
513}
514
515pub mod cpu_element_manager_ordinals {
516    pub const GET_CPU_DEPENDENCY_TOKEN: u64 = 0x2c43645ed70344ba;
517    pub const ADD_EXECUTION_STATE_DEPENDENCY: u64 = 0xdf2f5ea2af76234;
518}
519
520pub mod execution_state_manager_ordinals {
521    pub const GET_EXECUTION_STATE_DEPENDENCY_TOKEN: u64 = 0x71e8ddeb7f737710;
522    pub const ADD_APPLICATION_ACTIVITY_DEPENDENCY: u64 = 0x39959f51c557e1d9;
523}
524
525pub mod suspend_blocker_ordinals {
526    pub const BEFORE_SUSPEND: u64 = 0x6b569393a01a6d80;
527    pub const AFTER_RESUME: u64 = 0x6a329cfcc73f2dea;
528}
529
530mod internal {
531    use super::*;
532    unsafe impl fidl::encoding::TypeMarker for AcquireWakeLeaseError {
533        type Owned = Self;
534
535        #[inline(always)]
536        fn inline_align(_context: fidl::encoding::Context) -> usize {
537            std::mem::align_of::<u32>()
538        }
539
540        #[inline(always)]
541        fn inline_size(_context: fidl::encoding::Context) -> usize {
542            std::mem::size_of::<u32>()
543        }
544
545        #[inline(always)]
546        fn encode_is_copy() -> bool {
547            false
548        }
549
550        #[inline(always)]
551        fn decode_is_copy() -> bool {
552            false
553        }
554    }
555
556    impl fidl::encoding::ValueTypeMarker for AcquireWakeLeaseError {
557        type Borrowed<'a> = Self;
558        #[inline(always)]
559        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
560            *value
561        }
562    }
563
564    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
565        for AcquireWakeLeaseError
566    {
567        #[inline]
568        unsafe fn encode(
569            self,
570            encoder: &mut fidl::encoding::Encoder<'_, D>,
571            offset: usize,
572            _depth: fidl::encoding::Depth,
573        ) -> fidl::Result<()> {
574            encoder.debug_check_bounds::<Self>(offset);
575            encoder.write_num(self.into_primitive(), offset);
576            Ok(())
577        }
578    }
579
580    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AcquireWakeLeaseError {
581        #[inline(always)]
582        fn new_empty() -> Self {
583            Self::unknown()
584        }
585
586        #[inline]
587        unsafe fn decode(
588            &mut self,
589            decoder: &mut fidl::encoding::Decoder<'_, D>,
590            offset: usize,
591            _depth: fidl::encoding::Depth,
592        ) -> fidl::Result<()> {
593            decoder.debug_check_bounds::<Self>(offset);
594            let prim = decoder.read_num::<u32>(offset);
595
596            *self = Self::from_primitive_allow_unknown(prim);
597            Ok(())
598        }
599    }
600    unsafe impl fidl::encoding::TypeMarker for AddApplicationActivityDependencyError {
601        type Owned = Self;
602
603        #[inline(always)]
604        fn inline_align(_context: fidl::encoding::Context) -> usize {
605            std::mem::align_of::<u32>()
606        }
607
608        #[inline(always)]
609        fn inline_size(_context: fidl::encoding::Context) -> usize {
610            std::mem::size_of::<u32>()
611        }
612
613        #[inline(always)]
614        fn encode_is_copy() -> bool {
615            false
616        }
617
618        #[inline(always)]
619        fn decode_is_copy() -> bool {
620            false
621        }
622    }
623
624    impl fidl::encoding::ValueTypeMarker for AddApplicationActivityDependencyError {
625        type Borrowed<'a> = Self;
626        #[inline(always)]
627        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
628            *value
629        }
630    }
631
632    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
633        for AddApplicationActivityDependencyError
634    {
635        #[inline]
636        unsafe fn encode(
637            self,
638            encoder: &mut fidl::encoding::Encoder<'_, D>,
639            offset: usize,
640            _depth: fidl::encoding::Depth,
641        ) -> fidl::Result<()> {
642            encoder.debug_check_bounds::<Self>(offset);
643            encoder.write_num(self.into_primitive(), offset);
644            Ok(())
645        }
646    }
647
648    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
649        for AddApplicationActivityDependencyError
650    {
651        #[inline(always)]
652        fn new_empty() -> Self {
653            Self::unknown()
654        }
655
656        #[inline]
657        unsafe fn decode(
658            &mut self,
659            decoder: &mut fidl::encoding::Decoder<'_, D>,
660            offset: usize,
661            _depth: fidl::encoding::Depth,
662        ) -> fidl::Result<()> {
663            decoder.debug_check_bounds::<Self>(offset);
664            let prim = decoder.read_num::<u32>(offset);
665
666            *self = Self::from_primitive_allow_unknown(prim);
667            Ok(())
668        }
669    }
670    unsafe impl fidl::encoding::TypeMarker for AddExecutionStateDependencyError {
671        type Owned = Self;
672
673        #[inline(always)]
674        fn inline_align(_context: fidl::encoding::Context) -> usize {
675            std::mem::align_of::<u32>()
676        }
677
678        #[inline(always)]
679        fn inline_size(_context: fidl::encoding::Context) -> usize {
680            std::mem::size_of::<u32>()
681        }
682
683        #[inline(always)]
684        fn encode_is_copy() -> bool {
685            false
686        }
687
688        #[inline(always)]
689        fn decode_is_copy() -> bool {
690            false
691        }
692    }
693
694    impl fidl::encoding::ValueTypeMarker for AddExecutionStateDependencyError {
695        type Borrowed<'a> = Self;
696        #[inline(always)]
697        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
698            *value
699        }
700    }
701
702    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
703        for AddExecutionStateDependencyError
704    {
705        #[inline]
706        unsafe fn encode(
707            self,
708            encoder: &mut fidl::encoding::Encoder<'_, D>,
709            offset: usize,
710            _depth: fidl::encoding::Depth,
711        ) -> fidl::Result<()> {
712            encoder.debug_check_bounds::<Self>(offset);
713            encoder.write_num(self.into_primitive(), offset);
714            Ok(())
715        }
716    }
717
718    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
719        for AddExecutionStateDependencyError
720    {
721        #[inline(always)]
722        fn new_empty() -> Self {
723            Self::unknown()
724        }
725
726        #[inline]
727        unsafe fn decode(
728            &mut self,
729            decoder: &mut fidl::encoding::Decoder<'_, D>,
730            offset: usize,
731            _depth: fidl::encoding::Depth,
732        ) -> fidl::Result<()> {
733            decoder.debug_check_bounds::<Self>(offset);
734            let prim = decoder.read_num::<u32>(offset);
735
736            *self = Self::from_primitive_allow_unknown(prim);
737            Ok(())
738        }
739    }
740    unsafe impl fidl::encoding::TypeMarker for ApplicationActivityLevel {
741        type Owned = Self;
742
743        #[inline(always)]
744        fn inline_align(_context: fidl::encoding::Context) -> usize {
745            std::mem::align_of::<u8>()
746        }
747
748        #[inline(always)]
749        fn inline_size(_context: fidl::encoding::Context) -> usize {
750            std::mem::size_of::<u8>()
751        }
752
753        #[inline(always)]
754        fn encode_is_copy() -> bool {
755            false
756        }
757
758        #[inline(always)]
759        fn decode_is_copy() -> bool {
760            false
761        }
762    }
763
764    impl fidl::encoding::ValueTypeMarker for ApplicationActivityLevel {
765        type Borrowed<'a> = Self;
766        #[inline(always)]
767        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
768            *value
769        }
770    }
771
772    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
773        for ApplicationActivityLevel
774    {
775        #[inline]
776        unsafe fn encode(
777            self,
778            encoder: &mut fidl::encoding::Encoder<'_, D>,
779            offset: usize,
780            _depth: fidl::encoding::Depth,
781        ) -> fidl::Result<()> {
782            encoder.debug_check_bounds::<Self>(offset);
783            encoder.write_num(self.into_primitive(), offset);
784            Ok(())
785        }
786    }
787
788    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
789        for ApplicationActivityLevel
790    {
791        #[inline(always)]
792        fn new_empty() -> Self {
793            Self::unknown()
794        }
795
796        #[inline]
797        unsafe fn decode(
798            &mut self,
799            decoder: &mut fidl::encoding::Decoder<'_, D>,
800            offset: usize,
801            _depth: fidl::encoding::Depth,
802        ) -> fidl::Result<()> {
803            decoder.debug_check_bounds::<Self>(offset);
804            let prim = decoder.read_num::<u8>(offset);
805
806            *self = Self::from_primitive_allow_unknown(prim);
807            Ok(())
808        }
809    }
810    unsafe impl fidl::encoding::TypeMarker for CpuLevel {
811        type Owned = Self;
812
813        #[inline(always)]
814        fn inline_align(_context: fidl::encoding::Context) -> usize {
815            std::mem::align_of::<u8>()
816        }
817
818        #[inline(always)]
819        fn inline_size(_context: fidl::encoding::Context) -> usize {
820            std::mem::size_of::<u8>()
821        }
822
823        #[inline(always)]
824        fn encode_is_copy() -> bool {
825            false
826        }
827
828        #[inline(always)]
829        fn decode_is_copy() -> bool {
830            false
831        }
832    }
833
834    impl fidl::encoding::ValueTypeMarker for CpuLevel {
835        type Borrowed<'a> = Self;
836        #[inline(always)]
837        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
838            *value
839        }
840    }
841
842    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CpuLevel {
843        #[inline]
844        unsafe fn encode(
845            self,
846            encoder: &mut fidl::encoding::Encoder<'_, D>,
847            offset: usize,
848            _depth: fidl::encoding::Depth,
849        ) -> fidl::Result<()> {
850            encoder.debug_check_bounds::<Self>(offset);
851            encoder.write_num(self.into_primitive(), offset);
852            Ok(())
853        }
854    }
855
856    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CpuLevel {
857        #[inline(always)]
858        fn new_empty() -> Self {
859            Self::unknown()
860        }
861
862        #[inline]
863        unsafe fn decode(
864            &mut self,
865            decoder: &mut fidl::encoding::Decoder<'_, D>,
866            offset: usize,
867            _depth: fidl::encoding::Depth,
868        ) -> fidl::Result<()> {
869            decoder.debug_check_bounds::<Self>(offset);
870            let prim = decoder.read_num::<u8>(offset);
871
872            *self = Self::from_primitive_allow_unknown(prim);
873            Ok(())
874        }
875    }
876    unsafe impl fidl::encoding::TypeMarker for ExecutionStateLevel {
877        type Owned = Self;
878
879        #[inline(always)]
880        fn inline_align(_context: fidl::encoding::Context) -> usize {
881            std::mem::align_of::<u8>()
882        }
883
884        #[inline(always)]
885        fn inline_size(_context: fidl::encoding::Context) -> usize {
886            std::mem::size_of::<u8>()
887        }
888
889        #[inline(always)]
890        fn encode_is_copy() -> bool {
891            false
892        }
893
894        #[inline(always)]
895        fn decode_is_copy() -> bool {
896            false
897        }
898    }
899
900    impl fidl::encoding::ValueTypeMarker for ExecutionStateLevel {
901        type Borrowed<'a> = Self;
902        #[inline(always)]
903        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
904            *value
905        }
906    }
907
908    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
909        for ExecutionStateLevel
910    {
911        #[inline]
912        unsafe fn encode(
913            self,
914            encoder: &mut fidl::encoding::Encoder<'_, D>,
915            offset: usize,
916            _depth: fidl::encoding::Depth,
917        ) -> fidl::Result<()> {
918            encoder.debug_check_bounds::<Self>(offset);
919            encoder.write_num(self.into_primitive(), offset);
920            Ok(())
921        }
922    }
923
924    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExecutionStateLevel {
925        #[inline(always)]
926        fn new_empty() -> Self {
927            Self::unknown()
928        }
929
930        #[inline]
931        unsafe fn decode(
932            &mut self,
933            decoder: &mut fidl::encoding::Decoder<'_, D>,
934            offset: usize,
935            _depth: fidl::encoding::Depth,
936        ) -> fidl::Result<()> {
937            decoder.debug_check_bounds::<Self>(offset);
938            let prim = decoder.read_num::<u8>(offset);
939
940            *self = Self::from_primitive_allow_unknown(prim);
941            Ok(())
942        }
943    }
944    unsafe impl fidl::encoding::TypeMarker for RegisterSuspendBlockerError {
945        type Owned = Self;
946
947        #[inline(always)]
948        fn inline_align(_context: fidl::encoding::Context) -> usize {
949            std::mem::align_of::<u32>()
950        }
951
952        #[inline(always)]
953        fn inline_size(_context: fidl::encoding::Context) -> usize {
954            std::mem::size_of::<u32>()
955        }
956
957        #[inline(always)]
958        fn encode_is_copy() -> bool {
959            false
960        }
961
962        #[inline(always)]
963        fn decode_is_copy() -> bool {
964            false
965        }
966    }
967
968    impl fidl::encoding::ValueTypeMarker for RegisterSuspendBlockerError {
969        type Borrowed<'a> = Self;
970        #[inline(always)]
971        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
972            *value
973        }
974    }
975
976    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
977        for RegisterSuspendBlockerError
978    {
979        #[inline]
980        unsafe fn encode(
981            self,
982            encoder: &mut fidl::encoding::Encoder<'_, D>,
983            offset: usize,
984            _depth: fidl::encoding::Depth,
985        ) -> fidl::Result<()> {
986            encoder.debug_check_bounds::<Self>(offset);
987            encoder.write_num(self.into_primitive(), offset);
988            Ok(())
989        }
990    }
991
992    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
993        for RegisterSuspendBlockerError
994    {
995        #[inline(always)]
996        fn new_empty() -> Self {
997            Self::unknown()
998        }
999
1000        #[inline]
1001        unsafe fn decode(
1002            &mut self,
1003            decoder: &mut fidl::encoding::Decoder<'_, D>,
1004            offset: usize,
1005            _depth: fidl::encoding::Depth,
1006        ) -> fidl::Result<()> {
1007            decoder.debug_check_bounds::<Self>(offset);
1008            let prim = decoder.read_num::<u32>(offset);
1009
1010            *self = Self::from_primitive_allow_unknown(prim);
1011            Ok(())
1012        }
1013    }
1014
1015    impl fidl::encoding::ValueTypeMarker for ActivityGovernorAcquireUnmonitoredWakeLeaseRequest {
1016        type Borrowed<'a> = &'a Self;
1017        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1018            value
1019        }
1020    }
1021
1022    unsafe impl fidl::encoding::TypeMarker for ActivityGovernorAcquireUnmonitoredWakeLeaseRequest {
1023        type Owned = Self;
1024
1025        #[inline(always)]
1026        fn inline_align(_context: fidl::encoding::Context) -> usize {
1027            8
1028        }
1029
1030        #[inline(always)]
1031        fn inline_size(_context: fidl::encoding::Context) -> usize {
1032            16
1033        }
1034    }
1035
1036    unsafe impl<D: fidl::encoding::ResourceDialect>
1037        fidl::encoding::Encode<ActivityGovernorAcquireUnmonitoredWakeLeaseRequest, D>
1038        for &ActivityGovernorAcquireUnmonitoredWakeLeaseRequest
1039    {
1040        #[inline]
1041        unsafe fn encode(
1042            self,
1043            encoder: &mut fidl::encoding::Encoder<'_, D>,
1044            offset: usize,
1045            _depth: fidl::encoding::Depth,
1046        ) -> fidl::Result<()> {
1047            encoder
1048                .debug_check_bounds::<ActivityGovernorAcquireUnmonitoredWakeLeaseRequest>(offset);
1049            // Delegate to tuple encoding.
1050            fidl::encoding::Encode::<ActivityGovernorAcquireUnmonitoredWakeLeaseRequest, D>::encode(
1051                (<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
1052                    &self.name,
1053                ),),
1054                encoder,
1055                offset,
1056                _depth,
1057            )
1058        }
1059    }
1060    unsafe impl<
1061        D: fidl::encoding::ResourceDialect,
1062        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
1063    > fidl::encoding::Encode<ActivityGovernorAcquireUnmonitoredWakeLeaseRequest, D> for (T0,)
1064    {
1065        #[inline]
1066        unsafe fn encode(
1067            self,
1068            encoder: &mut fidl::encoding::Encoder<'_, D>,
1069            offset: usize,
1070            depth: fidl::encoding::Depth,
1071        ) -> fidl::Result<()> {
1072            encoder
1073                .debug_check_bounds::<ActivityGovernorAcquireUnmonitoredWakeLeaseRequest>(offset);
1074            // Zero out padding regions. There's no need to apply masks
1075            // because the unmasked parts will be overwritten by fields.
1076            // Write the fields.
1077            self.0.encode(encoder, offset + 0, depth)?;
1078            Ok(())
1079        }
1080    }
1081
1082    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1083        for ActivityGovernorAcquireUnmonitoredWakeLeaseRequest
1084    {
1085        #[inline(always)]
1086        fn new_empty() -> Self {
1087            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
1088        }
1089
1090        #[inline]
1091        unsafe fn decode(
1092            &mut self,
1093            decoder: &mut fidl::encoding::Decoder<'_, D>,
1094            offset: usize,
1095            _depth: fidl::encoding::Depth,
1096        ) -> fidl::Result<()> {
1097            decoder.debug_check_bounds::<Self>(offset);
1098            // Verify that padding bytes are zero.
1099            fidl::decode!(
1100                fidl::encoding::BoundedString<64>,
1101                D,
1102                &mut self.name,
1103                decoder,
1104                offset + 0,
1105                _depth
1106            )?;
1107            Ok(())
1108        }
1109    }
1110
1111    impl fidl::encoding::ValueTypeMarker for ActivityGovernorAcquireWakeLeaseRequest {
1112        type Borrowed<'a> = &'a Self;
1113        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1114            value
1115        }
1116    }
1117
1118    unsafe impl fidl::encoding::TypeMarker for ActivityGovernorAcquireWakeLeaseRequest {
1119        type Owned = Self;
1120
1121        #[inline(always)]
1122        fn inline_align(_context: fidl::encoding::Context) -> usize {
1123            8
1124        }
1125
1126        #[inline(always)]
1127        fn inline_size(_context: fidl::encoding::Context) -> usize {
1128            16
1129        }
1130    }
1131
1132    unsafe impl<D: fidl::encoding::ResourceDialect>
1133        fidl::encoding::Encode<ActivityGovernorAcquireWakeLeaseRequest, D>
1134        for &ActivityGovernorAcquireWakeLeaseRequest
1135    {
1136        #[inline]
1137        unsafe fn encode(
1138            self,
1139            encoder: &mut fidl::encoding::Encoder<'_, D>,
1140            offset: usize,
1141            _depth: fidl::encoding::Depth,
1142        ) -> fidl::Result<()> {
1143            encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseRequest>(offset);
1144            // Delegate to tuple encoding.
1145            fidl::encoding::Encode::<ActivityGovernorAcquireWakeLeaseRequest, D>::encode(
1146                (<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
1147                    &self.name,
1148                ),),
1149                encoder,
1150                offset,
1151                _depth,
1152            )
1153        }
1154    }
1155    unsafe impl<
1156        D: fidl::encoding::ResourceDialect,
1157        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
1158    > fidl::encoding::Encode<ActivityGovernorAcquireWakeLeaseRequest, D> for (T0,)
1159    {
1160        #[inline]
1161        unsafe fn encode(
1162            self,
1163            encoder: &mut fidl::encoding::Encoder<'_, D>,
1164            offset: usize,
1165            depth: fidl::encoding::Depth,
1166        ) -> fidl::Result<()> {
1167            encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseRequest>(offset);
1168            // Zero out padding regions. There's no need to apply masks
1169            // because the unmasked parts will be overwritten by fields.
1170            // Write the fields.
1171            self.0.encode(encoder, offset + 0, depth)?;
1172            Ok(())
1173        }
1174    }
1175
1176    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1177        for ActivityGovernorAcquireWakeLeaseRequest
1178    {
1179        #[inline(always)]
1180        fn new_empty() -> Self {
1181            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
1182        }
1183
1184        #[inline]
1185        unsafe fn decode(
1186            &mut self,
1187            decoder: &mut fidl::encoding::Decoder<'_, D>,
1188            offset: usize,
1189            _depth: fidl::encoding::Depth,
1190        ) -> fidl::Result<()> {
1191            decoder.debug_check_bounds::<Self>(offset);
1192            // Verify that padding bytes are zero.
1193            fidl::decode!(
1194                fidl::encoding::BoundedString<64>,
1195                D,
1196                &mut self.name,
1197                decoder,
1198                offset + 0,
1199                _depth
1200            )?;
1201            Ok(())
1202        }
1203    }
1204
1205    impl fidl::encoding::ValueTypeMarker for ActivityGovernorTakeApplicationActivityLeaseRequest {
1206        type Borrowed<'a> = &'a Self;
1207        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1208            value
1209        }
1210    }
1211
1212    unsafe impl fidl::encoding::TypeMarker for ActivityGovernorTakeApplicationActivityLeaseRequest {
1213        type Owned = Self;
1214
1215        #[inline(always)]
1216        fn inline_align(_context: fidl::encoding::Context) -> usize {
1217            8
1218        }
1219
1220        #[inline(always)]
1221        fn inline_size(_context: fidl::encoding::Context) -> usize {
1222            16
1223        }
1224    }
1225
1226    unsafe impl<D: fidl::encoding::ResourceDialect>
1227        fidl::encoding::Encode<ActivityGovernorTakeApplicationActivityLeaseRequest, D>
1228        for &ActivityGovernorTakeApplicationActivityLeaseRequest
1229    {
1230        #[inline]
1231        unsafe fn encode(
1232            self,
1233            encoder: &mut fidl::encoding::Encoder<'_, D>,
1234            offset: usize,
1235            _depth: fidl::encoding::Depth,
1236        ) -> fidl::Result<()> {
1237            encoder
1238                .debug_check_bounds::<ActivityGovernorTakeApplicationActivityLeaseRequest>(offset);
1239            // Delegate to tuple encoding.
1240            fidl::encoding::Encode::<ActivityGovernorTakeApplicationActivityLeaseRequest, D>::encode(
1241                (<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
1242                    &self.name,
1243                ),),
1244                encoder,
1245                offset,
1246                _depth,
1247            )
1248        }
1249    }
1250    unsafe impl<
1251        D: fidl::encoding::ResourceDialect,
1252        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
1253    > fidl::encoding::Encode<ActivityGovernorTakeApplicationActivityLeaseRequest, D> for (T0,)
1254    {
1255        #[inline]
1256        unsafe fn encode(
1257            self,
1258            encoder: &mut fidl::encoding::Encoder<'_, D>,
1259            offset: usize,
1260            depth: fidl::encoding::Depth,
1261        ) -> fidl::Result<()> {
1262            encoder
1263                .debug_check_bounds::<ActivityGovernorTakeApplicationActivityLeaseRequest>(offset);
1264            // Zero out padding regions. There's no need to apply masks
1265            // because the unmasked parts will be overwritten by fields.
1266            // Write the fields.
1267            self.0.encode(encoder, offset + 0, depth)?;
1268            Ok(())
1269        }
1270    }
1271
1272    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1273        for ActivityGovernorTakeApplicationActivityLeaseRequest
1274    {
1275        #[inline(always)]
1276        fn new_empty() -> Self {
1277            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
1278        }
1279
1280        #[inline]
1281        unsafe fn decode(
1282            &mut self,
1283            decoder: &mut fidl::encoding::Decoder<'_, D>,
1284            offset: usize,
1285            _depth: fidl::encoding::Depth,
1286        ) -> fidl::Result<()> {
1287            decoder.debug_check_bounds::<Self>(offset);
1288            // Verify that padding bytes are zero.
1289            fidl::decode!(
1290                fidl::encoding::BoundedString<64>,
1291                D,
1292                &mut self.name,
1293                decoder,
1294                offset + 0,
1295                _depth
1296            )?;
1297            Ok(())
1298        }
1299    }
1300}