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