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