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