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 ActivityGovernorAcquireWakeLeaseRequest {
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 ActivityGovernorAcquireWakeLeaseRequest {}
412
413#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
414pub struct ActivityGovernorTakeApplicationActivityLeaseRequest {
415    /// The name of the lease.
416    ///
417    /// The name is not required to be globally unique.
418    pub name: String,
419}
420
421impl fidl::Persistable for ActivityGovernorTakeApplicationActivityLeaseRequest {}
422
423#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
424pub struct ActivityGovernorTakeWakeLeaseRequest {
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 ActivityGovernorTakeWakeLeaseRequest {}
432
433pub mod activity_governor_ordinals {
434    pub const GET_POWER_ELEMENTS: u64 = 0x798003259dfb5672;
435    pub const TAKE_WAKE_LEASE: u64 = 0x291cfb42b2d3bf69;
436    pub const ACQUIRE_WAKE_LEASE: u64 = 0x2de25abd8fa7c103;
437    pub const ACQUIRE_WAKE_LEASE_WITH_TOKEN: u64 = 0x1cdd2ea3bee46f51;
438    pub const TAKE_APPLICATION_ACTIVITY_LEASE: u64 = 0x37cd5364de7ada14;
439    pub const REGISTER_SUSPEND_BLOCKER: u64 = 0x34ef55b180feef01;
440}
441
442pub mod boot_control_ordinals {
443    pub const SET_BOOT_COMPLETE: u64 = 0x3c9b9f24ad3ca2b5;
444}
445
446pub mod cpu_element_manager_ordinals {
447    pub const GET_CPU_DEPENDENCY_TOKEN: u64 = 0x2c43645ed70344ba;
448    pub const ADD_EXECUTION_STATE_DEPENDENCY: u64 = 0xdf2f5ea2af76234;
449}
450
451pub mod suspend_blocker_ordinals {
452    pub const BEFORE_SUSPEND: u64 = 0x6b569393a01a6d80;
453    pub const AFTER_RESUME: u64 = 0x6a329cfcc73f2dea;
454}
455
456mod internal {
457    use super::*;
458    unsafe impl fidl::encoding::TypeMarker for AcquireWakeLeaseError {
459        type Owned = Self;
460
461        #[inline(always)]
462        fn inline_align(_context: fidl::encoding::Context) -> usize {
463            std::mem::align_of::<u32>()
464        }
465
466        #[inline(always)]
467        fn inline_size(_context: fidl::encoding::Context) -> usize {
468            std::mem::size_of::<u32>()
469        }
470
471        #[inline(always)]
472        fn encode_is_copy() -> bool {
473            false
474        }
475
476        #[inline(always)]
477        fn decode_is_copy() -> bool {
478            false
479        }
480    }
481
482    impl fidl::encoding::ValueTypeMarker for AcquireWakeLeaseError {
483        type Borrowed<'a> = Self;
484        #[inline(always)]
485        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
486            *value
487        }
488    }
489
490    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
491        for AcquireWakeLeaseError
492    {
493        #[inline]
494        unsafe fn encode(
495            self,
496            encoder: &mut fidl::encoding::Encoder<'_, D>,
497            offset: usize,
498            _depth: fidl::encoding::Depth,
499        ) -> fidl::Result<()> {
500            encoder.debug_check_bounds::<Self>(offset);
501            encoder.write_num(self.into_primitive(), offset);
502            Ok(())
503        }
504    }
505
506    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AcquireWakeLeaseError {
507        #[inline(always)]
508        fn new_empty() -> Self {
509            Self::unknown()
510        }
511
512        #[inline]
513        unsafe fn decode(
514            &mut self,
515            decoder: &mut fidl::encoding::Decoder<'_, D>,
516            offset: usize,
517            _depth: fidl::encoding::Depth,
518        ) -> fidl::Result<()> {
519            decoder.debug_check_bounds::<Self>(offset);
520            let prim = decoder.read_num::<u32>(offset);
521
522            *self = Self::from_primitive_allow_unknown(prim);
523            Ok(())
524        }
525    }
526    unsafe impl fidl::encoding::TypeMarker for AddExecutionStateDependencyError {
527        type Owned = Self;
528
529        #[inline(always)]
530        fn inline_align(_context: fidl::encoding::Context) -> usize {
531            std::mem::align_of::<u32>()
532        }
533
534        #[inline(always)]
535        fn inline_size(_context: fidl::encoding::Context) -> usize {
536            std::mem::size_of::<u32>()
537        }
538
539        #[inline(always)]
540        fn encode_is_copy() -> bool {
541            false
542        }
543
544        #[inline(always)]
545        fn decode_is_copy() -> bool {
546            false
547        }
548    }
549
550    impl fidl::encoding::ValueTypeMarker for AddExecutionStateDependencyError {
551        type Borrowed<'a> = Self;
552        #[inline(always)]
553        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
554            *value
555        }
556    }
557
558    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
559        for AddExecutionStateDependencyError
560    {
561        #[inline]
562        unsafe fn encode(
563            self,
564            encoder: &mut fidl::encoding::Encoder<'_, D>,
565            offset: usize,
566            _depth: fidl::encoding::Depth,
567        ) -> fidl::Result<()> {
568            encoder.debug_check_bounds::<Self>(offset);
569            encoder.write_num(self.into_primitive(), offset);
570            Ok(())
571        }
572    }
573
574    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
575        for AddExecutionStateDependencyError
576    {
577        #[inline(always)]
578        fn new_empty() -> Self {
579            Self::unknown()
580        }
581
582        #[inline]
583        unsafe fn decode(
584            &mut self,
585            decoder: &mut fidl::encoding::Decoder<'_, D>,
586            offset: usize,
587            _depth: fidl::encoding::Depth,
588        ) -> fidl::Result<()> {
589            decoder.debug_check_bounds::<Self>(offset);
590            let prim = decoder.read_num::<u32>(offset);
591
592            *self = Self::from_primitive_allow_unknown(prim);
593            Ok(())
594        }
595    }
596    unsafe impl fidl::encoding::TypeMarker for ApplicationActivityLevel {
597        type Owned = Self;
598
599        #[inline(always)]
600        fn inline_align(_context: fidl::encoding::Context) -> usize {
601            std::mem::align_of::<u8>()
602        }
603
604        #[inline(always)]
605        fn inline_size(_context: fidl::encoding::Context) -> usize {
606            std::mem::size_of::<u8>()
607        }
608
609        #[inline(always)]
610        fn encode_is_copy() -> bool {
611            false
612        }
613
614        #[inline(always)]
615        fn decode_is_copy() -> bool {
616            false
617        }
618    }
619
620    impl fidl::encoding::ValueTypeMarker for ApplicationActivityLevel {
621        type Borrowed<'a> = Self;
622        #[inline(always)]
623        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
624            *value
625        }
626    }
627
628    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
629        for ApplicationActivityLevel
630    {
631        #[inline]
632        unsafe fn encode(
633            self,
634            encoder: &mut fidl::encoding::Encoder<'_, D>,
635            offset: usize,
636            _depth: fidl::encoding::Depth,
637        ) -> fidl::Result<()> {
638            encoder.debug_check_bounds::<Self>(offset);
639            encoder.write_num(self.into_primitive(), offset);
640            Ok(())
641        }
642    }
643
644    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
645        for ApplicationActivityLevel
646    {
647        #[inline(always)]
648        fn new_empty() -> Self {
649            Self::unknown()
650        }
651
652        #[inline]
653        unsafe fn decode(
654            &mut self,
655            decoder: &mut fidl::encoding::Decoder<'_, D>,
656            offset: usize,
657            _depth: fidl::encoding::Depth,
658        ) -> fidl::Result<()> {
659            decoder.debug_check_bounds::<Self>(offset);
660            let prim = decoder.read_num::<u8>(offset);
661
662            *self = Self::from_primitive_allow_unknown(prim);
663            Ok(())
664        }
665    }
666    unsafe impl fidl::encoding::TypeMarker for CpuLevel {
667        type Owned = Self;
668
669        #[inline(always)]
670        fn inline_align(_context: fidl::encoding::Context) -> usize {
671            std::mem::align_of::<u8>()
672        }
673
674        #[inline(always)]
675        fn inline_size(_context: fidl::encoding::Context) -> usize {
676            std::mem::size_of::<u8>()
677        }
678
679        #[inline(always)]
680        fn encode_is_copy() -> bool {
681            false
682        }
683
684        #[inline(always)]
685        fn decode_is_copy() -> bool {
686            false
687        }
688    }
689
690    impl fidl::encoding::ValueTypeMarker for CpuLevel {
691        type Borrowed<'a> = Self;
692        #[inline(always)]
693        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
694            *value
695        }
696    }
697
698    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CpuLevel {
699        #[inline]
700        unsafe fn encode(
701            self,
702            encoder: &mut fidl::encoding::Encoder<'_, D>,
703            offset: usize,
704            _depth: fidl::encoding::Depth,
705        ) -> fidl::Result<()> {
706            encoder.debug_check_bounds::<Self>(offset);
707            encoder.write_num(self.into_primitive(), offset);
708            Ok(())
709        }
710    }
711
712    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CpuLevel {
713        #[inline(always)]
714        fn new_empty() -> Self {
715            Self::unknown()
716        }
717
718        #[inline]
719        unsafe fn decode(
720            &mut self,
721            decoder: &mut fidl::encoding::Decoder<'_, D>,
722            offset: usize,
723            _depth: fidl::encoding::Depth,
724        ) -> fidl::Result<()> {
725            decoder.debug_check_bounds::<Self>(offset);
726            let prim = decoder.read_num::<u8>(offset);
727
728            *self = Self::from_primitive_allow_unknown(prim);
729            Ok(())
730        }
731    }
732    unsafe impl fidl::encoding::TypeMarker for ExecutionStateLevel {
733        type Owned = Self;
734
735        #[inline(always)]
736        fn inline_align(_context: fidl::encoding::Context) -> usize {
737            std::mem::align_of::<u8>()
738        }
739
740        #[inline(always)]
741        fn inline_size(_context: fidl::encoding::Context) -> usize {
742            std::mem::size_of::<u8>()
743        }
744
745        #[inline(always)]
746        fn encode_is_copy() -> bool {
747            false
748        }
749
750        #[inline(always)]
751        fn decode_is_copy() -> bool {
752            false
753        }
754    }
755
756    impl fidl::encoding::ValueTypeMarker for ExecutionStateLevel {
757        type Borrowed<'a> = Self;
758        #[inline(always)]
759        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
760            *value
761        }
762    }
763
764    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
765        for ExecutionStateLevel
766    {
767        #[inline]
768        unsafe fn encode(
769            self,
770            encoder: &mut fidl::encoding::Encoder<'_, D>,
771            offset: usize,
772            _depth: fidl::encoding::Depth,
773        ) -> fidl::Result<()> {
774            encoder.debug_check_bounds::<Self>(offset);
775            encoder.write_num(self.into_primitive(), offset);
776            Ok(())
777        }
778    }
779
780    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExecutionStateLevel {
781        #[inline(always)]
782        fn new_empty() -> Self {
783            Self::unknown()
784        }
785
786        #[inline]
787        unsafe fn decode(
788            &mut self,
789            decoder: &mut fidl::encoding::Decoder<'_, D>,
790            offset: usize,
791            _depth: fidl::encoding::Depth,
792        ) -> fidl::Result<()> {
793            decoder.debug_check_bounds::<Self>(offset);
794            let prim = decoder.read_num::<u8>(offset);
795
796            *self = Self::from_primitive_allow_unknown(prim);
797            Ok(())
798        }
799    }
800    unsafe impl fidl::encoding::TypeMarker for RegisterSuspendBlockerError {
801        type Owned = Self;
802
803        #[inline(always)]
804        fn inline_align(_context: fidl::encoding::Context) -> usize {
805            std::mem::align_of::<u32>()
806        }
807
808        #[inline(always)]
809        fn inline_size(_context: fidl::encoding::Context) -> usize {
810            std::mem::size_of::<u32>()
811        }
812
813        #[inline(always)]
814        fn encode_is_copy() -> bool {
815            false
816        }
817
818        #[inline(always)]
819        fn decode_is_copy() -> bool {
820            false
821        }
822    }
823
824    impl fidl::encoding::ValueTypeMarker for RegisterSuspendBlockerError {
825        type Borrowed<'a> = Self;
826        #[inline(always)]
827        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
828            *value
829        }
830    }
831
832    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
833        for RegisterSuspendBlockerError
834    {
835        #[inline]
836        unsafe fn encode(
837            self,
838            encoder: &mut fidl::encoding::Encoder<'_, D>,
839            offset: usize,
840            _depth: fidl::encoding::Depth,
841        ) -> fidl::Result<()> {
842            encoder.debug_check_bounds::<Self>(offset);
843            encoder.write_num(self.into_primitive(), offset);
844            Ok(())
845        }
846    }
847
848    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
849        for RegisterSuspendBlockerError
850    {
851        #[inline(always)]
852        fn new_empty() -> Self {
853            Self::unknown()
854        }
855
856        #[inline]
857        unsafe fn decode(
858            &mut self,
859            decoder: &mut fidl::encoding::Decoder<'_, D>,
860            offset: usize,
861            _depth: fidl::encoding::Depth,
862        ) -> fidl::Result<()> {
863            decoder.debug_check_bounds::<Self>(offset);
864            let prim = decoder.read_num::<u32>(offset);
865
866            *self = Self::from_primitive_allow_unknown(prim);
867            Ok(())
868        }
869    }
870
871    impl fidl::encoding::ValueTypeMarker for ActivityGovernorAcquireWakeLeaseRequest {
872        type Borrowed<'a> = &'a Self;
873        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
874            value
875        }
876    }
877
878    unsafe impl fidl::encoding::TypeMarker for ActivityGovernorAcquireWakeLeaseRequest {
879        type Owned = Self;
880
881        #[inline(always)]
882        fn inline_align(_context: fidl::encoding::Context) -> usize {
883            8
884        }
885
886        #[inline(always)]
887        fn inline_size(_context: fidl::encoding::Context) -> usize {
888            16
889        }
890    }
891
892    unsafe impl<D: fidl::encoding::ResourceDialect>
893        fidl::encoding::Encode<ActivityGovernorAcquireWakeLeaseRequest, D>
894        for &ActivityGovernorAcquireWakeLeaseRequest
895    {
896        #[inline]
897        unsafe fn encode(
898            self,
899            encoder: &mut fidl::encoding::Encoder<'_, D>,
900            offset: usize,
901            _depth: fidl::encoding::Depth,
902        ) -> fidl::Result<()> {
903            encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseRequest>(offset);
904            // Delegate to tuple encoding.
905            fidl::encoding::Encode::<ActivityGovernorAcquireWakeLeaseRequest, D>::encode(
906                (<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
907                    &self.name,
908                ),),
909                encoder,
910                offset,
911                _depth,
912            )
913        }
914    }
915    unsafe impl<
916        D: fidl::encoding::ResourceDialect,
917        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
918    > fidl::encoding::Encode<ActivityGovernorAcquireWakeLeaseRequest, D> for (T0,)
919    {
920        #[inline]
921        unsafe fn encode(
922            self,
923            encoder: &mut fidl::encoding::Encoder<'_, D>,
924            offset: usize,
925            depth: fidl::encoding::Depth,
926        ) -> fidl::Result<()> {
927            encoder.debug_check_bounds::<ActivityGovernorAcquireWakeLeaseRequest>(offset);
928            // Zero out padding regions. There's no need to apply masks
929            // because the unmasked parts will be overwritten by fields.
930            // Write the fields.
931            self.0.encode(encoder, offset + 0, depth)?;
932            Ok(())
933        }
934    }
935
936    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
937        for ActivityGovernorAcquireWakeLeaseRequest
938    {
939        #[inline(always)]
940        fn new_empty() -> Self {
941            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
942        }
943
944        #[inline]
945        unsafe fn decode(
946            &mut self,
947            decoder: &mut fidl::encoding::Decoder<'_, D>,
948            offset: usize,
949            _depth: fidl::encoding::Depth,
950        ) -> fidl::Result<()> {
951            decoder.debug_check_bounds::<Self>(offset);
952            // Verify that padding bytes are zero.
953            fidl::decode!(
954                fidl::encoding::BoundedString<64>,
955                D,
956                &mut self.name,
957                decoder,
958                offset + 0,
959                _depth
960            )?;
961            Ok(())
962        }
963    }
964
965    impl fidl::encoding::ValueTypeMarker for ActivityGovernorTakeApplicationActivityLeaseRequest {
966        type Borrowed<'a> = &'a Self;
967        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
968            value
969        }
970    }
971
972    unsafe impl fidl::encoding::TypeMarker for ActivityGovernorTakeApplicationActivityLeaseRequest {
973        type Owned = Self;
974
975        #[inline(always)]
976        fn inline_align(_context: fidl::encoding::Context) -> usize {
977            8
978        }
979
980        #[inline(always)]
981        fn inline_size(_context: fidl::encoding::Context) -> usize {
982            16
983        }
984    }
985
986    unsafe impl<D: fidl::encoding::ResourceDialect>
987        fidl::encoding::Encode<ActivityGovernorTakeApplicationActivityLeaseRequest, D>
988        for &ActivityGovernorTakeApplicationActivityLeaseRequest
989    {
990        #[inline]
991        unsafe fn encode(
992            self,
993            encoder: &mut fidl::encoding::Encoder<'_, D>,
994            offset: usize,
995            _depth: fidl::encoding::Depth,
996        ) -> fidl::Result<()> {
997            encoder
998                .debug_check_bounds::<ActivityGovernorTakeApplicationActivityLeaseRequest>(offset);
999            // Delegate to tuple encoding.
1000            fidl::encoding::Encode::<ActivityGovernorTakeApplicationActivityLeaseRequest, D>::encode(
1001                (<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
1002                    &self.name,
1003                ),),
1004                encoder,
1005                offset,
1006                _depth,
1007            )
1008        }
1009    }
1010    unsafe impl<
1011        D: fidl::encoding::ResourceDialect,
1012        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
1013    > fidl::encoding::Encode<ActivityGovernorTakeApplicationActivityLeaseRequest, D> for (T0,)
1014    {
1015        #[inline]
1016        unsafe fn encode(
1017            self,
1018            encoder: &mut fidl::encoding::Encoder<'_, D>,
1019            offset: usize,
1020            depth: fidl::encoding::Depth,
1021        ) -> fidl::Result<()> {
1022            encoder
1023                .debug_check_bounds::<ActivityGovernorTakeApplicationActivityLeaseRequest>(offset);
1024            // Zero out padding regions. There's no need to apply masks
1025            // because the unmasked parts will be overwritten by fields.
1026            // Write the fields.
1027            self.0.encode(encoder, offset + 0, depth)?;
1028            Ok(())
1029        }
1030    }
1031
1032    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1033        for ActivityGovernorTakeApplicationActivityLeaseRequest
1034    {
1035        #[inline(always)]
1036        fn new_empty() -> Self {
1037            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
1038        }
1039
1040        #[inline]
1041        unsafe fn decode(
1042            &mut self,
1043            decoder: &mut fidl::encoding::Decoder<'_, D>,
1044            offset: usize,
1045            _depth: fidl::encoding::Depth,
1046        ) -> fidl::Result<()> {
1047            decoder.debug_check_bounds::<Self>(offset);
1048            // Verify that padding bytes are zero.
1049            fidl::decode!(
1050                fidl::encoding::BoundedString<64>,
1051                D,
1052                &mut self.name,
1053                decoder,
1054                offset + 0,
1055                _depth
1056            )?;
1057            Ok(())
1058        }
1059    }
1060
1061    impl fidl::encoding::ValueTypeMarker for ActivityGovernorTakeWakeLeaseRequest {
1062        type Borrowed<'a> = &'a Self;
1063        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1064            value
1065        }
1066    }
1067
1068    unsafe impl fidl::encoding::TypeMarker for ActivityGovernorTakeWakeLeaseRequest {
1069        type Owned = Self;
1070
1071        #[inline(always)]
1072        fn inline_align(_context: fidl::encoding::Context) -> usize {
1073            8
1074        }
1075
1076        #[inline(always)]
1077        fn inline_size(_context: fidl::encoding::Context) -> usize {
1078            16
1079        }
1080    }
1081
1082    unsafe impl<D: fidl::encoding::ResourceDialect>
1083        fidl::encoding::Encode<ActivityGovernorTakeWakeLeaseRequest, D>
1084        for &ActivityGovernorTakeWakeLeaseRequest
1085    {
1086        #[inline]
1087        unsafe fn encode(
1088            self,
1089            encoder: &mut fidl::encoding::Encoder<'_, D>,
1090            offset: usize,
1091            _depth: fidl::encoding::Depth,
1092        ) -> fidl::Result<()> {
1093            encoder.debug_check_bounds::<ActivityGovernorTakeWakeLeaseRequest>(offset);
1094            // Delegate to tuple encoding.
1095            fidl::encoding::Encode::<ActivityGovernorTakeWakeLeaseRequest, D>::encode(
1096                (<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
1097                    &self.name,
1098                ),),
1099                encoder,
1100                offset,
1101                _depth,
1102            )
1103        }
1104    }
1105    unsafe impl<
1106        D: fidl::encoding::ResourceDialect,
1107        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
1108    > fidl::encoding::Encode<ActivityGovernorTakeWakeLeaseRequest, D> for (T0,)
1109    {
1110        #[inline]
1111        unsafe fn encode(
1112            self,
1113            encoder: &mut fidl::encoding::Encoder<'_, D>,
1114            offset: usize,
1115            depth: fidl::encoding::Depth,
1116        ) -> fidl::Result<()> {
1117            encoder.debug_check_bounds::<ActivityGovernorTakeWakeLeaseRequest>(offset);
1118            // Zero out padding regions. There's no need to apply masks
1119            // because the unmasked parts will be overwritten by fields.
1120            // Write the fields.
1121            self.0.encode(encoder, offset + 0, depth)?;
1122            Ok(())
1123        }
1124    }
1125
1126    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1127        for ActivityGovernorTakeWakeLeaseRequest
1128    {
1129        #[inline(always)]
1130        fn new_empty() -> Self {
1131            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
1132        }
1133
1134        #[inline]
1135        unsafe fn decode(
1136            &mut self,
1137            decoder: &mut fidl::encoding::Decoder<'_, D>,
1138            offset: usize,
1139            _depth: fidl::encoding::Depth,
1140        ) -> fidl::Result<()> {
1141            decoder.debug_check_bounds::<Self>(offset);
1142            // Verify that padding bytes are zero.
1143            fidl::decode!(
1144                fidl::encoding::BoundedString<64>,
1145                D,
1146                &mut self.name,
1147                decoder,
1148                offset + 0,
1149                _depth
1150            )?;
1151            Ok(())
1152        }
1153    }
1154}