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