fidl_fuchsia_power_broker_common/
fidl_fuchsia_power_broker_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
11/// Used to describe the power level of an element.
12/// Could extend this further to support additional types of power
13/// levels, such as ACPI.
14pub type PowerLevel = u8;
15
16pub const MAX_DEPENDENCIES_IN_ADD_ELEMENT: u16 = 128;
17
18pub const MAX_ELEMENT_NAME_LEN: u8 = 64;
19
20/// PowerLevel name lengths are limited to reduce Inspect space usage
21pub const MAX_LEVEL_NAME_LEN: u16 = 16;
22
23pub const MAX_TOKENS_IN_ADD_ELEMENT: u16 = 128;
24
25pub const MAX_VALID_POWER_LEVELS: u16 = 256;
26
27bitflags! {
28    /// Element Permissions
29    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
30    pub struct Permissions: u32 {
31        const MODIFY_ASSERTIVE_DEPENDENT = 1;
32        const MODIFY_OPPORTUNISTIC_DEPENDENT = 2;
33        const MODIFY_DEPENDENCY = 4;
34    }
35}
36
37impl Permissions {
38    #[deprecated = "Strict bits should not use `has_unknown_bits`"]
39    #[inline(always)]
40    pub fn has_unknown_bits(&self) -> bool {
41        false
42    }
43
44    #[deprecated = "Strict bits should not use `get_unknown_bits`"]
45    #[inline(always)]
46    pub fn get_unknown_bits(&self) -> u32 {
47        0
48    }
49}
50
51#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
52pub enum AddElementError {
53    Invalid,
54    NotAuthorized,
55    #[doc(hidden)]
56    __SourceBreaking {
57        unknown_ordinal: u32,
58    },
59}
60
61/// Pattern that matches an unknown `AddElementError` member.
62#[macro_export]
63macro_rules! AddElementErrorUnknown {
64    () => {
65        _
66    };
67}
68
69impl AddElementError {
70    #[inline]
71    pub fn from_primitive(prim: u32) -> Option<Self> {
72        match prim {
73            1 => Some(Self::Invalid),
74            2 => Some(Self::NotAuthorized),
75            _ => None,
76        }
77    }
78
79    #[inline]
80    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
81        match prim {
82            1 => Self::Invalid,
83            2 => Self::NotAuthorized,
84            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
85        }
86    }
87
88    #[inline]
89    pub fn unknown() -> Self {
90        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
91    }
92
93    #[inline]
94    pub const fn into_primitive(self) -> u32 {
95        match self {
96            Self::Invalid => 1,
97            Self::NotAuthorized => 2,
98            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
99        }
100    }
101
102    #[inline]
103    pub fn is_unknown(&self) -> bool {
104        match self {
105            Self::__SourceBreaking { unknown_ordinal: _ } => true,
106            _ => false,
107        }
108    }
109}
110
111/// BinaryPowerLevel is a well-known set of PowerLevels with only two
112/// states: OFF and ON.
113#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
114#[repr(u8)]
115pub enum BinaryPowerLevel {
116    Off = 0,
117    On = 1,
118}
119
120impl BinaryPowerLevel {
121    #[inline]
122    pub fn from_primitive(prim: u8) -> Option<Self> {
123        match prim {
124            0 => Some(Self::Off),
125            1 => Some(Self::On),
126            _ => None,
127        }
128    }
129
130    #[inline]
131    pub const fn into_primitive(self) -> u8 {
132        self as u8
133    }
134
135    #[deprecated = "Strict enums should not use `is_unknown`"]
136    #[inline]
137    pub fn is_unknown(&self) -> bool {
138        false
139    }
140}
141
142#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
143pub enum CurrentLevelError {
144    NotAuthorized,
145    #[doc(hidden)]
146    __SourceBreaking {
147        unknown_ordinal: u32,
148    },
149}
150
151/// Pattern that matches an unknown `CurrentLevelError` member.
152#[macro_export]
153macro_rules! CurrentLevelErrorUnknown {
154    () => {
155        _
156    };
157}
158
159impl CurrentLevelError {
160    #[inline]
161    pub fn from_primitive(prim: u32) -> Option<Self> {
162        match prim {
163            1 => Some(Self::NotAuthorized),
164            _ => None,
165        }
166    }
167
168    #[inline]
169    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
170        match prim {
171            1 => Self::NotAuthorized,
172            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
173        }
174    }
175
176    #[inline]
177    pub fn unknown() -> Self {
178        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
179    }
180
181    #[inline]
182    pub const fn into_primitive(self) -> u32 {
183        match self {
184            Self::NotAuthorized => 1,
185            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
186        }
187    }
188
189    #[inline]
190    pub fn is_unknown(&self) -> bool {
191        match self {
192            Self::__SourceBreaking { unknown_ordinal: _ } => true,
193            _ => false,
194        }
195    }
196}
197
198/// An assertive dependency is strongly-fulfilled and orderly-on-termination.
199/// An opportunistic dependency is weakly-fulfilled but still orderly-on-termination.
200///
201/// See https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0250_power_topology#dependency_types
202/// for more details on these definitions.
203#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
204pub enum DependencyType {
205    Assertive,
206    Opportunistic,
207    #[doc(hidden)]
208    __SourceBreaking {
209        unknown_ordinal: u32,
210    },
211}
212
213/// Pattern that matches an unknown `DependencyType` member.
214#[macro_export]
215macro_rules! DependencyTypeUnknown {
216    () => {
217        _
218    };
219}
220
221impl DependencyType {
222    #[inline]
223    pub fn from_primitive(prim: u32) -> Option<Self> {
224        match prim {
225            1 => Some(Self::Assertive),
226            2 => Some(Self::Opportunistic),
227            _ => None,
228        }
229    }
230
231    #[inline]
232    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
233        match prim {
234            1 => Self::Assertive,
235            2 => Self::Opportunistic,
236            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
237        }
238    }
239
240    #[inline]
241    pub fn unknown() -> Self {
242        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
243    }
244
245    #[inline]
246    pub const fn into_primitive(self) -> u32 {
247        match self {
248            Self::Assertive => 1,
249            Self::Opportunistic => 2,
250            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
251        }
252    }
253
254    #[inline]
255    pub fn is_unknown(&self) -> bool {
256        match self {
257            Self::__SourceBreaking { unknown_ordinal: _ } => true,
258            _ => false,
259        }
260    }
261}
262
263#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
264pub enum ElementInfoProviderError {
265    Unknown,
266    Failed,
267    #[doc(hidden)]
268    __SourceBreaking {
269        unknown_ordinal: u32,
270    },
271}
272
273/// Pattern that matches an unknown `ElementInfoProviderError` member.
274#[macro_export]
275macro_rules! ElementInfoProviderErrorUnknown {
276    () => {
277        _
278    };
279}
280
281impl ElementInfoProviderError {
282    #[inline]
283    pub fn from_primitive(prim: u32) -> Option<Self> {
284        match prim {
285            0 => Some(Self::Unknown),
286            1 => Some(Self::Failed),
287            _ => None,
288        }
289    }
290
291    #[inline]
292    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
293        match prim {
294            0 => Self::Unknown,
295            1 => Self::Failed,
296            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
297        }
298    }
299
300    #[inline]
301    pub fn unknown() -> Self {
302        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
303    }
304
305    #[inline]
306    pub const fn into_primitive(self) -> u32 {
307        match self {
308            Self::Unknown => 0,
309            Self::Failed => 1,
310            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
311        }
312    }
313
314    #[inline]
315    pub fn is_unknown(&self) -> bool {
316        match self {
317            Self::__SourceBreaking { unknown_ordinal: _ } => true,
318            _ => false,
319        }
320    }
321}
322
323#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
324pub enum LeaseError {
325    Internal,
326    NotAuthorized,
327    InvalidLevel,
328    #[doc(hidden)]
329    __SourceBreaking {
330        unknown_ordinal: u32,
331    },
332}
333
334/// Pattern that matches an unknown `LeaseError` member.
335#[macro_export]
336macro_rules! LeaseErrorUnknown {
337    () => {
338        _
339    };
340}
341
342impl LeaseError {
343    #[inline]
344    pub fn from_primitive(prim: u32) -> Option<Self> {
345        match prim {
346            1 => Some(Self::Internal),
347            2 => Some(Self::NotAuthorized),
348            3 => Some(Self::InvalidLevel),
349            _ => None,
350        }
351    }
352
353    #[inline]
354    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
355        match prim {
356            1 => Self::Internal,
357            2 => Self::NotAuthorized,
358            3 => Self::InvalidLevel,
359            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
360        }
361    }
362
363    #[inline]
364    pub fn unknown() -> Self {
365        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
366    }
367
368    #[inline]
369    pub const fn into_primitive(self) -> u32 {
370        match self {
371            Self::Internal => 1,
372            Self::NotAuthorized => 2,
373            Self::InvalidLevel => 3,
374            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
375        }
376    }
377
378    #[inline]
379    pub fn is_unknown(&self) -> bool {
380        match self {
381            Self::__SourceBreaking { unknown_ordinal: _ } => true,
382            _ => false,
383        }
384    }
385}
386
387#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
388pub enum LeaseStatus {
389    Unknown,
390    /// The dependencies of the leased `PowerLevel` are not at their required
391    /// levels.
392    Pending,
393    /// The `PowerElement` is **not** necessarily at the `PowerLevel` leased,
394    /// but the `PowerElement`s requried by the leased `PowerLevel`' are at
395    /// their required `PowerLevel`s.
396    Satisfied,
397    #[doc(hidden)]
398    __SourceBreaking {
399        unknown_ordinal: u32,
400    },
401}
402
403/// Pattern that matches an unknown `LeaseStatus` member.
404#[macro_export]
405macro_rules! LeaseStatusUnknown {
406    () => {
407        _
408    };
409}
410
411impl LeaseStatus {
412    #[inline]
413    pub fn from_primitive(prim: u32) -> Option<Self> {
414        match prim {
415            0 => Some(Self::Unknown),
416            1 => Some(Self::Pending),
417            2 => Some(Self::Satisfied),
418            _ => None,
419        }
420    }
421
422    #[inline]
423    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
424        match prim {
425            0 => Self::Unknown,
426            1 => Self::Pending,
427            2 => Self::Satisfied,
428            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
429        }
430    }
431
432    #[inline]
433    pub fn unknown() -> Self {
434        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
435    }
436
437    #[inline]
438    pub const fn into_primitive(self) -> u32 {
439        match self {
440            Self::Unknown => 0,
441            Self::Pending => 1,
442            Self::Satisfied => 2,
443            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
444        }
445    }
446
447    #[inline]
448    pub fn is_unknown(&self) -> bool {
449        match self {
450            Self::__SourceBreaking { unknown_ordinal: _ } => true,
451            _ => false,
452        }
453    }
454}
455
456#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
457pub enum ModifyDependencyError {
458    AlreadyExists,
459    Invalid,
460    NotAuthorized,
461    NotFound,
462    #[doc(hidden)]
463    __SourceBreaking {
464        unknown_ordinal: u32,
465    },
466}
467
468/// Pattern that matches an unknown `ModifyDependencyError` member.
469#[macro_export]
470macro_rules! ModifyDependencyErrorUnknown {
471    () => {
472        _
473    };
474}
475
476impl ModifyDependencyError {
477    #[inline]
478    pub fn from_primitive(prim: u32) -> Option<Self> {
479        match prim {
480            1 => Some(Self::AlreadyExists),
481            2 => Some(Self::Invalid),
482            3 => Some(Self::NotAuthorized),
483            4 => Some(Self::NotFound),
484            _ => None,
485        }
486    }
487
488    #[inline]
489    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
490        match prim {
491            1 => Self::AlreadyExists,
492            2 => Self::Invalid,
493            3 => Self::NotAuthorized,
494            4 => Self::NotFound,
495            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
496        }
497    }
498
499    #[inline]
500    pub fn unknown() -> Self {
501        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
502    }
503
504    #[inline]
505    pub const fn into_primitive(self) -> u32 {
506        match self {
507            Self::AlreadyExists => 1,
508            Self::Invalid => 2,
509            Self::NotAuthorized => 3,
510            Self::NotFound => 4,
511            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
512        }
513    }
514
515    #[inline]
516    pub fn is_unknown(&self) -> bool {
517        match self {
518            Self::__SourceBreaking { unknown_ordinal: _ } => true,
519            _ => false,
520        }
521    }
522}
523
524#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
525pub enum RegisterDependencyTokenError {
526    AlreadyInUse,
527    Internal,
528    #[doc(hidden)]
529    __SourceBreaking {
530        unknown_ordinal: u32,
531    },
532}
533
534/// Pattern that matches an unknown `RegisterDependencyTokenError` member.
535#[macro_export]
536macro_rules! RegisterDependencyTokenErrorUnknown {
537    () => {
538        _
539    };
540}
541
542impl RegisterDependencyTokenError {
543    #[inline]
544    pub fn from_primitive(prim: u32) -> Option<Self> {
545        match prim {
546            1 => Some(Self::AlreadyInUse),
547            2 => Some(Self::Internal),
548            _ => None,
549        }
550    }
551
552    #[inline]
553    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
554        match prim {
555            1 => Self::AlreadyInUse,
556            2 => Self::Internal,
557            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
558        }
559    }
560
561    #[inline]
562    pub fn unknown() -> Self {
563        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
564    }
565
566    #[inline]
567    pub const fn into_primitive(self) -> u32 {
568        match self {
569            Self::AlreadyInUse => 1,
570            Self::Internal => 2,
571            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
572        }
573    }
574
575    #[inline]
576    pub fn is_unknown(&self) -> bool {
577        match self {
578            Self::__SourceBreaking { unknown_ordinal: _ } => true,
579            _ => false,
580        }
581    }
582}
583
584#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
585pub enum RequiredLevelError {
586    Internal,
587    NotAuthorized,
588    Unknown,
589    #[doc(hidden)]
590    __SourceBreaking {
591        unknown_ordinal: u32,
592    },
593}
594
595/// Pattern that matches an unknown `RequiredLevelError` member.
596#[macro_export]
597macro_rules! RequiredLevelErrorUnknown {
598    () => {
599        _
600    };
601}
602
603impl RequiredLevelError {
604    #[inline]
605    pub fn from_primitive(prim: u32) -> Option<Self> {
606        match prim {
607            1 => Some(Self::Internal),
608            2 => Some(Self::NotAuthorized),
609            3 => Some(Self::Unknown),
610            _ => None,
611        }
612    }
613
614    #[inline]
615    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
616        match prim {
617            1 => Self::Internal,
618            2 => Self::NotAuthorized,
619            3 => Self::Unknown,
620            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
621        }
622    }
623
624    #[inline]
625    pub fn unknown() -> Self {
626        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
627    }
628
629    #[inline]
630    pub const fn into_primitive(self) -> u32 {
631        match self {
632            Self::Internal => 1,
633            Self::NotAuthorized => 2,
634            Self::Unknown => 3,
635            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
636        }
637    }
638
639    #[inline]
640    pub fn is_unknown(&self) -> bool {
641        match self {
642            Self::__SourceBreaking { unknown_ordinal: _ } => true,
643            _ => false,
644        }
645    }
646}
647
648#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
649pub enum StatusError {
650    Unknown,
651    #[doc(hidden)]
652    __SourceBreaking {
653        unknown_ordinal: u32,
654    },
655}
656
657/// Pattern that matches an unknown `StatusError` member.
658#[macro_export]
659macro_rules! StatusErrorUnknown {
660    () => {
661        _
662    };
663}
664
665impl StatusError {
666    #[inline]
667    pub fn from_primitive(prim: u32) -> Option<Self> {
668        match prim {
669            1 => Some(Self::Unknown),
670            _ => None,
671        }
672    }
673
674    #[inline]
675    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
676        match prim {
677            1 => Self::Unknown,
678            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
679        }
680    }
681
682    #[inline]
683    pub fn unknown() -> Self {
684        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
685    }
686
687    #[inline]
688    pub const fn into_primitive(self) -> u32 {
689        match self {
690            Self::Unknown => 1,
691            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
692        }
693    }
694
695    #[inline]
696    pub fn is_unknown(&self) -> bool {
697        match self {
698            Self::__SourceBreaking { unknown_ordinal: _ } => true,
699            _ => false,
700        }
701    }
702}
703
704#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
705pub enum UnregisterDependencyTokenError {
706    NotAuthorized,
707    NotFound,
708    #[doc(hidden)]
709    __SourceBreaking {
710        unknown_ordinal: u32,
711    },
712}
713
714/// Pattern that matches an unknown `UnregisterDependencyTokenError` member.
715#[macro_export]
716macro_rules! UnregisterDependencyTokenErrorUnknown {
717    () => {
718        _
719    };
720}
721
722impl UnregisterDependencyTokenError {
723    #[inline]
724    pub fn from_primitive(prim: u32) -> Option<Self> {
725        match prim {
726            1 => Some(Self::NotAuthorized),
727            2 => Some(Self::NotFound),
728            _ => None,
729        }
730    }
731
732    #[inline]
733    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
734        match prim {
735            1 => Self::NotAuthorized,
736            2 => Self::NotFound,
737            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
738        }
739    }
740
741    #[inline]
742    pub fn unknown() -> Self {
743        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
744    }
745
746    #[inline]
747    pub const fn into_primitive(self) -> u32 {
748        match self {
749            Self::NotAuthorized => 1,
750            Self::NotFound => 2,
751            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
752        }
753    }
754
755    #[inline]
756    pub fn is_unknown(&self) -> bool {
757        match self {
758            Self::__SourceBreaking { unknown_ordinal: _ } => true,
759            _ => false,
760        }
761    }
762}
763
764#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
765#[repr(C)]
766pub struct ElementRunnerSetLevelRequest {
767    pub level: u8,
768}
769
770impl fidl::Persistable for ElementRunnerSetLevelRequest {}
771
772#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
773pub struct LeaseControlWatchStatusRequest {
774    pub last_status: LeaseStatus,
775}
776
777impl fidl::Persistable for LeaseControlWatchStatusRequest {}
778
779#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
780pub struct LeaseControlWatchStatusResponse {
781    pub status: LeaseStatus,
782}
783
784impl fidl::Persistable for LeaseControlWatchStatusResponse {}
785
786/// Mapping of a vector of [`fuchsia.power.broker/PowerLevelName`] to a Power Element via
787/// its plaintext name. Names are expected to be unique between elements and persistent
788/// across reboots of the same build, but consistency is not guaranteed between different builds.
789#[derive(Clone, Debug, Default, PartialEq)]
790pub struct ElementPowerLevelNames {
791    pub identifier: Option<String>,
792    pub levels: Option<Vec<PowerLevelName>>,
793    #[doc(hidden)]
794    pub __source_breaking: fidl::marker::SourceBreaking,
795}
796
797impl fidl::Persistable for ElementPowerLevelNames {}
798
799/// Mapping of a plaintext name to a PowerLevel. Names are expected to be unique between
800/// elements and persistent across reboots of the same build, but consistency is not
801/// guaranteed between different builds.
802#[derive(Clone, Debug, Default, PartialEq)]
803pub struct PowerLevelName {
804    pub level: Option<u8>,
805    pub name: Option<String>,
806    #[doc(hidden)]
807    pub __source_breaking: fidl::marker::SourceBreaking,
808}
809
810impl fidl::Persistable for PowerLevelName {}
811
812mod internal {
813    use super::*;
814    unsafe impl fidl::encoding::TypeMarker for Permissions {
815        type Owned = Self;
816
817        #[inline(always)]
818        fn inline_align(_context: fidl::encoding::Context) -> usize {
819            4
820        }
821
822        #[inline(always)]
823        fn inline_size(_context: fidl::encoding::Context) -> usize {
824            4
825        }
826    }
827
828    impl fidl::encoding::ValueTypeMarker for Permissions {
829        type Borrowed<'a> = Self;
830        #[inline(always)]
831        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
832            *value
833        }
834    }
835
836    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Permissions {
837        #[inline]
838        unsafe fn encode(
839            self,
840            encoder: &mut fidl::encoding::Encoder<'_, D>,
841            offset: usize,
842            _depth: fidl::encoding::Depth,
843        ) -> fidl::Result<()> {
844            encoder.debug_check_bounds::<Self>(offset);
845            if self.bits() & Self::all().bits() != self.bits() {
846                return Err(fidl::Error::InvalidBitsValue);
847            }
848            encoder.write_num(self.bits(), offset);
849            Ok(())
850        }
851    }
852
853    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Permissions {
854        #[inline(always)]
855        fn new_empty() -> Self {
856            Self::empty()
857        }
858
859        #[inline]
860        unsafe fn decode(
861            &mut self,
862            decoder: &mut fidl::encoding::Decoder<'_, D>,
863            offset: usize,
864            _depth: fidl::encoding::Depth,
865        ) -> fidl::Result<()> {
866            decoder.debug_check_bounds::<Self>(offset);
867            let prim = decoder.read_num::<u32>(offset);
868            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
869            Ok(())
870        }
871    }
872    unsafe impl fidl::encoding::TypeMarker for AddElementError {
873        type Owned = Self;
874
875        #[inline(always)]
876        fn inline_align(_context: fidl::encoding::Context) -> usize {
877            std::mem::align_of::<u32>()
878        }
879
880        #[inline(always)]
881        fn inline_size(_context: fidl::encoding::Context) -> usize {
882            std::mem::size_of::<u32>()
883        }
884
885        #[inline(always)]
886        fn encode_is_copy() -> bool {
887            false
888        }
889
890        #[inline(always)]
891        fn decode_is_copy() -> bool {
892            false
893        }
894    }
895
896    impl fidl::encoding::ValueTypeMarker for AddElementError {
897        type Borrowed<'a> = Self;
898        #[inline(always)]
899        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
900            *value
901        }
902    }
903
904    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
905        for AddElementError
906    {
907        #[inline]
908        unsafe fn encode(
909            self,
910            encoder: &mut fidl::encoding::Encoder<'_, D>,
911            offset: usize,
912            _depth: fidl::encoding::Depth,
913        ) -> fidl::Result<()> {
914            encoder.debug_check_bounds::<Self>(offset);
915            encoder.write_num(self.into_primitive(), offset);
916            Ok(())
917        }
918    }
919
920    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddElementError {
921        #[inline(always)]
922        fn new_empty() -> Self {
923            Self::unknown()
924        }
925
926        #[inline]
927        unsafe fn decode(
928            &mut self,
929            decoder: &mut fidl::encoding::Decoder<'_, D>,
930            offset: usize,
931            _depth: fidl::encoding::Depth,
932        ) -> fidl::Result<()> {
933            decoder.debug_check_bounds::<Self>(offset);
934            let prim = decoder.read_num::<u32>(offset);
935
936            *self = Self::from_primitive_allow_unknown(prim);
937            Ok(())
938        }
939    }
940    unsafe impl fidl::encoding::TypeMarker for BinaryPowerLevel {
941        type Owned = Self;
942
943        #[inline(always)]
944        fn inline_align(_context: fidl::encoding::Context) -> usize {
945            std::mem::align_of::<u8>()
946        }
947
948        #[inline(always)]
949        fn inline_size(_context: fidl::encoding::Context) -> usize {
950            std::mem::size_of::<u8>()
951        }
952
953        #[inline(always)]
954        fn encode_is_copy() -> bool {
955            true
956        }
957
958        #[inline(always)]
959        fn decode_is_copy() -> bool {
960            false
961        }
962    }
963
964    impl fidl::encoding::ValueTypeMarker for BinaryPowerLevel {
965        type Borrowed<'a> = Self;
966        #[inline(always)]
967        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
968            *value
969        }
970    }
971
972    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
973        for BinaryPowerLevel
974    {
975        #[inline]
976        unsafe fn encode(
977            self,
978            encoder: &mut fidl::encoding::Encoder<'_, D>,
979            offset: usize,
980            _depth: fidl::encoding::Depth,
981        ) -> fidl::Result<()> {
982            encoder.debug_check_bounds::<Self>(offset);
983            encoder.write_num(self.into_primitive(), offset);
984            Ok(())
985        }
986    }
987
988    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BinaryPowerLevel {
989        #[inline(always)]
990        fn new_empty() -> Self {
991            Self::Off
992        }
993
994        #[inline]
995        unsafe fn decode(
996            &mut self,
997            decoder: &mut fidl::encoding::Decoder<'_, D>,
998            offset: usize,
999            _depth: fidl::encoding::Depth,
1000        ) -> fidl::Result<()> {
1001            decoder.debug_check_bounds::<Self>(offset);
1002            let prim = decoder.read_num::<u8>(offset);
1003
1004            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1005            Ok(())
1006        }
1007    }
1008    unsafe impl fidl::encoding::TypeMarker for CurrentLevelError {
1009        type Owned = Self;
1010
1011        #[inline(always)]
1012        fn inline_align(_context: fidl::encoding::Context) -> usize {
1013            std::mem::align_of::<u32>()
1014        }
1015
1016        #[inline(always)]
1017        fn inline_size(_context: fidl::encoding::Context) -> usize {
1018            std::mem::size_of::<u32>()
1019        }
1020
1021        #[inline(always)]
1022        fn encode_is_copy() -> bool {
1023            false
1024        }
1025
1026        #[inline(always)]
1027        fn decode_is_copy() -> bool {
1028            false
1029        }
1030    }
1031
1032    impl fidl::encoding::ValueTypeMarker for CurrentLevelError {
1033        type Borrowed<'a> = Self;
1034        #[inline(always)]
1035        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1036            *value
1037        }
1038    }
1039
1040    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1041        for CurrentLevelError
1042    {
1043        #[inline]
1044        unsafe fn encode(
1045            self,
1046            encoder: &mut fidl::encoding::Encoder<'_, D>,
1047            offset: usize,
1048            _depth: fidl::encoding::Depth,
1049        ) -> fidl::Result<()> {
1050            encoder.debug_check_bounds::<Self>(offset);
1051            encoder.write_num(self.into_primitive(), offset);
1052            Ok(())
1053        }
1054    }
1055
1056    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CurrentLevelError {
1057        #[inline(always)]
1058        fn new_empty() -> Self {
1059            Self::unknown()
1060        }
1061
1062        #[inline]
1063        unsafe fn decode(
1064            &mut self,
1065            decoder: &mut fidl::encoding::Decoder<'_, D>,
1066            offset: usize,
1067            _depth: fidl::encoding::Depth,
1068        ) -> fidl::Result<()> {
1069            decoder.debug_check_bounds::<Self>(offset);
1070            let prim = decoder.read_num::<u32>(offset);
1071
1072            *self = Self::from_primitive_allow_unknown(prim);
1073            Ok(())
1074        }
1075    }
1076    unsafe impl fidl::encoding::TypeMarker for DependencyType {
1077        type Owned = Self;
1078
1079        #[inline(always)]
1080        fn inline_align(_context: fidl::encoding::Context) -> usize {
1081            std::mem::align_of::<u32>()
1082        }
1083
1084        #[inline(always)]
1085        fn inline_size(_context: fidl::encoding::Context) -> usize {
1086            std::mem::size_of::<u32>()
1087        }
1088
1089        #[inline(always)]
1090        fn encode_is_copy() -> bool {
1091            false
1092        }
1093
1094        #[inline(always)]
1095        fn decode_is_copy() -> bool {
1096            false
1097        }
1098    }
1099
1100    impl fidl::encoding::ValueTypeMarker for DependencyType {
1101        type Borrowed<'a> = Self;
1102        #[inline(always)]
1103        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1104            *value
1105        }
1106    }
1107
1108    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DependencyType {
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::<Self>(offset);
1117            encoder.write_num(self.into_primitive(), offset);
1118            Ok(())
1119        }
1120    }
1121
1122    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DependencyType {
1123        #[inline(always)]
1124        fn new_empty() -> Self {
1125            Self::unknown()
1126        }
1127
1128        #[inline]
1129        unsafe fn decode(
1130            &mut self,
1131            decoder: &mut fidl::encoding::Decoder<'_, D>,
1132            offset: usize,
1133            _depth: fidl::encoding::Depth,
1134        ) -> fidl::Result<()> {
1135            decoder.debug_check_bounds::<Self>(offset);
1136            let prim = decoder.read_num::<u32>(offset);
1137
1138            *self = Self::from_primitive_allow_unknown(prim);
1139            Ok(())
1140        }
1141    }
1142    unsafe impl fidl::encoding::TypeMarker for ElementInfoProviderError {
1143        type Owned = Self;
1144
1145        #[inline(always)]
1146        fn inline_align(_context: fidl::encoding::Context) -> usize {
1147            std::mem::align_of::<u32>()
1148        }
1149
1150        #[inline(always)]
1151        fn inline_size(_context: fidl::encoding::Context) -> usize {
1152            std::mem::size_of::<u32>()
1153        }
1154
1155        #[inline(always)]
1156        fn encode_is_copy() -> bool {
1157            false
1158        }
1159
1160        #[inline(always)]
1161        fn decode_is_copy() -> bool {
1162            false
1163        }
1164    }
1165
1166    impl fidl::encoding::ValueTypeMarker for ElementInfoProviderError {
1167        type Borrowed<'a> = Self;
1168        #[inline(always)]
1169        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1170            *value
1171        }
1172    }
1173
1174    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1175        for ElementInfoProviderError
1176    {
1177        #[inline]
1178        unsafe fn encode(
1179            self,
1180            encoder: &mut fidl::encoding::Encoder<'_, D>,
1181            offset: usize,
1182            _depth: fidl::encoding::Depth,
1183        ) -> fidl::Result<()> {
1184            encoder.debug_check_bounds::<Self>(offset);
1185            encoder.write_num(self.into_primitive(), offset);
1186            Ok(())
1187        }
1188    }
1189
1190    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1191        for ElementInfoProviderError
1192    {
1193        #[inline(always)]
1194        fn new_empty() -> Self {
1195            Self::unknown()
1196        }
1197
1198        #[inline]
1199        unsafe fn decode(
1200            &mut self,
1201            decoder: &mut fidl::encoding::Decoder<'_, D>,
1202            offset: usize,
1203            _depth: fidl::encoding::Depth,
1204        ) -> fidl::Result<()> {
1205            decoder.debug_check_bounds::<Self>(offset);
1206            let prim = decoder.read_num::<u32>(offset);
1207
1208            *self = Self::from_primitive_allow_unknown(prim);
1209            Ok(())
1210        }
1211    }
1212    unsafe impl fidl::encoding::TypeMarker for LeaseError {
1213        type Owned = Self;
1214
1215        #[inline(always)]
1216        fn inline_align(_context: fidl::encoding::Context) -> usize {
1217            std::mem::align_of::<u32>()
1218        }
1219
1220        #[inline(always)]
1221        fn inline_size(_context: fidl::encoding::Context) -> usize {
1222            std::mem::size_of::<u32>()
1223        }
1224
1225        #[inline(always)]
1226        fn encode_is_copy() -> bool {
1227            false
1228        }
1229
1230        #[inline(always)]
1231        fn decode_is_copy() -> bool {
1232            false
1233        }
1234    }
1235
1236    impl fidl::encoding::ValueTypeMarker for LeaseError {
1237        type Borrowed<'a> = Self;
1238        #[inline(always)]
1239        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1240            *value
1241        }
1242    }
1243
1244    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LeaseError {
1245        #[inline]
1246        unsafe fn encode(
1247            self,
1248            encoder: &mut fidl::encoding::Encoder<'_, D>,
1249            offset: usize,
1250            _depth: fidl::encoding::Depth,
1251        ) -> fidl::Result<()> {
1252            encoder.debug_check_bounds::<Self>(offset);
1253            encoder.write_num(self.into_primitive(), offset);
1254            Ok(())
1255        }
1256    }
1257
1258    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LeaseError {
1259        #[inline(always)]
1260        fn new_empty() -> Self {
1261            Self::unknown()
1262        }
1263
1264        #[inline]
1265        unsafe fn decode(
1266            &mut self,
1267            decoder: &mut fidl::encoding::Decoder<'_, D>,
1268            offset: usize,
1269            _depth: fidl::encoding::Depth,
1270        ) -> fidl::Result<()> {
1271            decoder.debug_check_bounds::<Self>(offset);
1272            let prim = decoder.read_num::<u32>(offset);
1273
1274            *self = Self::from_primitive_allow_unknown(prim);
1275            Ok(())
1276        }
1277    }
1278    unsafe impl fidl::encoding::TypeMarker for LeaseStatus {
1279        type Owned = Self;
1280
1281        #[inline(always)]
1282        fn inline_align(_context: fidl::encoding::Context) -> usize {
1283            std::mem::align_of::<u32>()
1284        }
1285
1286        #[inline(always)]
1287        fn inline_size(_context: fidl::encoding::Context) -> usize {
1288            std::mem::size_of::<u32>()
1289        }
1290
1291        #[inline(always)]
1292        fn encode_is_copy() -> bool {
1293            false
1294        }
1295
1296        #[inline(always)]
1297        fn decode_is_copy() -> bool {
1298            false
1299        }
1300    }
1301
1302    impl fidl::encoding::ValueTypeMarker for LeaseStatus {
1303        type Borrowed<'a> = Self;
1304        #[inline(always)]
1305        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1306            *value
1307        }
1308    }
1309
1310    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LeaseStatus {
1311        #[inline]
1312        unsafe fn encode(
1313            self,
1314            encoder: &mut fidl::encoding::Encoder<'_, D>,
1315            offset: usize,
1316            _depth: fidl::encoding::Depth,
1317        ) -> fidl::Result<()> {
1318            encoder.debug_check_bounds::<Self>(offset);
1319            encoder.write_num(self.into_primitive(), offset);
1320            Ok(())
1321        }
1322    }
1323
1324    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LeaseStatus {
1325        #[inline(always)]
1326        fn new_empty() -> Self {
1327            Self::unknown()
1328        }
1329
1330        #[inline]
1331        unsafe fn decode(
1332            &mut self,
1333            decoder: &mut fidl::encoding::Decoder<'_, D>,
1334            offset: usize,
1335            _depth: fidl::encoding::Depth,
1336        ) -> fidl::Result<()> {
1337            decoder.debug_check_bounds::<Self>(offset);
1338            let prim = decoder.read_num::<u32>(offset);
1339
1340            *self = Self::from_primitive_allow_unknown(prim);
1341            Ok(())
1342        }
1343    }
1344    unsafe impl fidl::encoding::TypeMarker for ModifyDependencyError {
1345        type Owned = Self;
1346
1347        #[inline(always)]
1348        fn inline_align(_context: fidl::encoding::Context) -> usize {
1349            std::mem::align_of::<u32>()
1350        }
1351
1352        #[inline(always)]
1353        fn inline_size(_context: fidl::encoding::Context) -> usize {
1354            std::mem::size_of::<u32>()
1355        }
1356
1357        #[inline(always)]
1358        fn encode_is_copy() -> bool {
1359            false
1360        }
1361
1362        #[inline(always)]
1363        fn decode_is_copy() -> bool {
1364            false
1365        }
1366    }
1367
1368    impl fidl::encoding::ValueTypeMarker for ModifyDependencyError {
1369        type Borrowed<'a> = Self;
1370        #[inline(always)]
1371        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1372            *value
1373        }
1374    }
1375
1376    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1377        for ModifyDependencyError
1378    {
1379        #[inline]
1380        unsafe fn encode(
1381            self,
1382            encoder: &mut fidl::encoding::Encoder<'_, D>,
1383            offset: usize,
1384            _depth: fidl::encoding::Depth,
1385        ) -> fidl::Result<()> {
1386            encoder.debug_check_bounds::<Self>(offset);
1387            encoder.write_num(self.into_primitive(), offset);
1388            Ok(())
1389        }
1390    }
1391
1392    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ModifyDependencyError {
1393        #[inline(always)]
1394        fn new_empty() -> Self {
1395            Self::unknown()
1396        }
1397
1398        #[inline]
1399        unsafe fn decode(
1400            &mut self,
1401            decoder: &mut fidl::encoding::Decoder<'_, D>,
1402            offset: usize,
1403            _depth: fidl::encoding::Depth,
1404        ) -> fidl::Result<()> {
1405            decoder.debug_check_bounds::<Self>(offset);
1406            let prim = decoder.read_num::<u32>(offset);
1407
1408            *self = Self::from_primitive_allow_unknown(prim);
1409            Ok(())
1410        }
1411    }
1412    unsafe impl fidl::encoding::TypeMarker for RegisterDependencyTokenError {
1413        type Owned = Self;
1414
1415        #[inline(always)]
1416        fn inline_align(_context: fidl::encoding::Context) -> usize {
1417            std::mem::align_of::<u32>()
1418        }
1419
1420        #[inline(always)]
1421        fn inline_size(_context: fidl::encoding::Context) -> usize {
1422            std::mem::size_of::<u32>()
1423        }
1424
1425        #[inline(always)]
1426        fn encode_is_copy() -> bool {
1427            false
1428        }
1429
1430        #[inline(always)]
1431        fn decode_is_copy() -> bool {
1432            false
1433        }
1434    }
1435
1436    impl fidl::encoding::ValueTypeMarker for RegisterDependencyTokenError {
1437        type Borrowed<'a> = Self;
1438        #[inline(always)]
1439        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1440            *value
1441        }
1442    }
1443
1444    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1445        for RegisterDependencyTokenError
1446    {
1447        #[inline]
1448        unsafe fn encode(
1449            self,
1450            encoder: &mut fidl::encoding::Encoder<'_, D>,
1451            offset: usize,
1452            _depth: fidl::encoding::Depth,
1453        ) -> fidl::Result<()> {
1454            encoder.debug_check_bounds::<Self>(offset);
1455            encoder.write_num(self.into_primitive(), offset);
1456            Ok(())
1457        }
1458    }
1459
1460    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1461        for RegisterDependencyTokenError
1462    {
1463        #[inline(always)]
1464        fn new_empty() -> Self {
1465            Self::unknown()
1466        }
1467
1468        #[inline]
1469        unsafe fn decode(
1470            &mut self,
1471            decoder: &mut fidl::encoding::Decoder<'_, D>,
1472            offset: usize,
1473            _depth: fidl::encoding::Depth,
1474        ) -> fidl::Result<()> {
1475            decoder.debug_check_bounds::<Self>(offset);
1476            let prim = decoder.read_num::<u32>(offset);
1477
1478            *self = Self::from_primitive_allow_unknown(prim);
1479            Ok(())
1480        }
1481    }
1482    unsafe impl fidl::encoding::TypeMarker for RequiredLevelError {
1483        type Owned = Self;
1484
1485        #[inline(always)]
1486        fn inline_align(_context: fidl::encoding::Context) -> usize {
1487            std::mem::align_of::<u32>()
1488        }
1489
1490        #[inline(always)]
1491        fn inline_size(_context: fidl::encoding::Context) -> usize {
1492            std::mem::size_of::<u32>()
1493        }
1494
1495        #[inline(always)]
1496        fn encode_is_copy() -> bool {
1497            false
1498        }
1499
1500        #[inline(always)]
1501        fn decode_is_copy() -> bool {
1502            false
1503        }
1504    }
1505
1506    impl fidl::encoding::ValueTypeMarker for RequiredLevelError {
1507        type Borrowed<'a> = Self;
1508        #[inline(always)]
1509        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1510            *value
1511        }
1512    }
1513
1514    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1515        for RequiredLevelError
1516    {
1517        #[inline]
1518        unsafe fn encode(
1519            self,
1520            encoder: &mut fidl::encoding::Encoder<'_, D>,
1521            offset: usize,
1522            _depth: fidl::encoding::Depth,
1523        ) -> fidl::Result<()> {
1524            encoder.debug_check_bounds::<Self>(offset);
1525            encoder.write_num(self.into_primitive(), offset);
1526            Ok(())
1527        }
1528    }
1529
1530    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RequiredLevelError {
1531        #[inline(always)]
1532        fn new_empty() -> Self {
1533            Self::unknown()
1534        }
1535
1536        #[inline]
1537        unsafe fn decode(
1538            &mut self,
1539            decoder: &mut fidl::encoding::Decoder<'_, D>,
1540            offset: usize,
1541            _depth: fidl::encoding::Depth,
1542        ) -> fidl::Result<()> {
1543            decoder.debug_check_bounds::<Self>(offset);
1544            let prim = decoder.read_num::<u32>(offset);
1545
1546            *self = Self::from_primitive_allow_unknown(prim);
1547            Ok(())
1548        }
1549    }
1550    unsafe impl fidl::encoding::TypeMarker for StatusError {
1551        type Owned = Self;
1552
1553        #[inline(always)]
1554        fn inline_align(_context: fidl::encoding::Context) -> usize {
1555            std::mem::align_of::<u32>()
1556        }
1557
1558        #[inline(always)]
1559        fn inline_size(_context: fidl::encoding::Context) -> usize {
1560            std::mem::size_of::<u32>()
1561        }
1562
1563        #[inline(always)]
1564        fn encode_is_copy() -> bool {
1565            false
1566        }
1567
1568        #[inline(always)]
1569        fn decode_is_copy() -> bool {
1570            false
1571        }
1572    }
1573
1574    impl fidl::encoding::ValueTypeMarker for StatusError {
1575        type Borrowed<'a> = Self;
1576        #[inline(always)]
1577        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1578            *value
1579        }
1580    }
1581
1582    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StatusError {
1583        #[inline]
1584        unsafe fn encode(
1585            self,
1586            encoder: &mut fidl::encoding::Encoder<'_, D>,
1587            offset: usize,
1588            _depth: fidl::encoding::Depth,
1589        ) -> fidl::Result<()> {
1590            encoder.debug_check_bounds::<Self>(offset);
1591            encoder.write_num(self.into_primitive(), offset);
1592            Ok(())
1593        }
1594    }
1595
1596    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatusError {
1597        #[inline(always)]
1598        fn new_empty() -> Self {
1599            Self::unknown()
1600        }
1601
1602        #[inline]
1603        unsafe fn decode(
1604            &mut self,
1605            decoder: &mut fidl::encoding::Decoder<'_, D>,
1606            offset: usize,
1607            _depth: fidl::encoding::Depth,
1608        ) -> fidl::Result<()> {
1609            decoder.debug_check_bounds::<Self>(offset);
1610            let prim = decoder.read_num::<u32>(offset);
1611
1612            *self = Self::from_primitive_allow_unknown(prim);
1613            Ok(())
1614        }
1615    }
1616    unsafe impl fidl::encoding::TypeMarker for UnregisterDependencyTokenError {
1617        type Owned = Self;
1618
1619        #[inline(always)]
1620        fn inline_align(_context: fidl::encoding::Context) -> usize {
1621            std::mem::align_of::<u32>()
1622        }
1623
1624        #[inline(always)]
1625        fn inline_size(_context: fidl::encoding::Context) -> usize {
1626            std::mem::size_of::<u32>()
1627        }
1628
1629        #[inline(always)]
1630        fn encode_is_copy() -> bool {
1631            false
1632        }
1633
1634        #[inline(always)]
1635        fn decode_is_copy() -> bool {
1636            false
1637        }
1638    }
1639
1640    impl fidl::encoding::ValueTypeMarker for UnregisterDependencyTokenError {
1641        type Borrowed<'a> = Self;
1642        #[inline(always)]
1643        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1644            *value
1645        }
1646    }
1647
1648    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1649        for UnregisterDependencyTokenError
1650    {
1651        #[inline]
1652        unsafe fn encode(
1653            self,
1654            encoder: &mut fidl::encoding::Encoder<'_, D>,
1655            offset: usize,
1656            _depth: fidl::encoding::Depth,
1657        ) -> fidl::Result<()> {
1658            encoder.debug_check_bounds::<Self>(offset);
1659            encoder.write_num(self.into_primitive(), offset);
1660            Ok(())
1661        }
1662    }
1663
1664    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1665        for UnregisterDependencyTokenError
1666    {
1667        #[inline(always)]
1668        fn new_empty() -> Self {
1669            Self::unknown()
1670        }
1671
1672        #[inline]
1673        unsafe fn decode(
1674            &mut self,
1675            decoder: &mut fidl::encoding::Decoder<'_, D>,
1676            offset: usize,
1677            _depth: fidl::encoding::Depth,
1678        ) -> fidl::Result<()> {
1679            decoder.debug_check_bounds::<Self>(offset);
1680            let prim = decoder.read_num::<u32>(offset);
1681
1682            *self = Self::from_primitive_allow_unknown(prim);
1683            Ok(())
1684        }
1685    }
1686
1687    impl fidl::encoding::ValueTypeMarker for ElementRunnerSetLevelRequest {
1688        type Borrowed<'a> = &'a Self;
1689        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1690            value
1691        }
1692    }
1693
1694    unsafe impl fidl::encoding::TypeMarker for ElementRunnerSetLevelRequest {
1695        type Owned = Self;
1696
1697        #[inline(always)]
1698        fn inline_align(_context: fidl::encoding::Context) -> usize {
1699            1
1700        }
1701
1702        #[inline(always)]
1703        fn inline_size(_context: fidl::encoding::Context) -> usize {
1704            1
1705        }
1706        #[inline(always)]
1707        fn encode_is_copy() -> bool {
1708            true
1709        }
1710
1711        #[inline(always)]
1712        fn decode_is_copy() -> bool {
1713            true
1714        }
1715    }
1716
1717    unsafe impl<D: fidl::encoding::ResourceDialect>
1718        fidl::encoding::Encode<ElementRunnerSetLevelRequest, D> for &ElementRunnerSetLevelRequest
1719    {
1720        #[inline]
1721        unsafe fn encode(
1722            self,
1723            encoder: &mut fidl::encoding::Encoder<'_, D>,
1724            offset: usize,
1725            _depth: fidl::encoding::Depth,
1726        ) -> fidl::Result<()> {
1727            encoder.debug_check_bounds::<ElementRunnerSetLevelRequest>(offset);
1728            unsafe {
1729                // Copy the object into the buffer.
1730                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1731                (buf_ptr as *mut ElementRunnerSetLevelRequest)
1732                    .write_unaligned((self as *const ElementRunnerSetLevelRequest).read());
1733                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1734                // done second because the memcpy will write garbage to these bytes.
1735            }
1736            Ok(())
1737        }
1738    }
1739    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
1740        fidl::encoding::Encode<ElementRunnerSetLevelRequest, D> for (T0,)
1741    {
1742        #[inline]
1743        unsafe fn encode(
1744            self,
1745            encoder: &mut fidl::encoding::Encoder<'_, D>,
1746            offset: usize,
1747            depth: fidl::encoding::Depth,
1748        ) -> fidl::Result<()> {
1749            encoder.debug_check_bounds::<ElementRunnerSetLevelRequest>(offset);
1750            // Zero out padding regions. There's no need to apply masks
1751            // because the unmasked parts will be overwritten by fields.
1752            // Write the fields.
1753            self.0.encode(encoder, offset + 0, depth)?;
1754            Ok(())
1755        }
1756    }
1757
1758    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1759        for ElementRunnerSetLevelRequest
1760    {
1761        #[inline(always)]
1762        fn new_empty() -> Self {
1763            Self { level: fidl::new_empty!(u8, D) }
1764        }
1765
1766        #[inline]
1767        unsafe fn decode(
1768            &mut self,
1769            decoder: &mut fidl::encoding::Decoder<'_, D>,
1770            offset: usize,
1771            _depth: fidl::encoding::Depth,
1772        ) -> fidl::Result<()> {
1773            decoder.debug_check_bounds::<Self>(offset);
1774            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1775            // Verify that padding bytes are zero.
1776            // Copy from the buffer into the object.
1777            unsafe {
1778                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
1779            }
1780            Ok(())
1781        }
1782    }
1783
1784    impl fidl::encoding::ValueTypeMarker for LeaseControlWatchStatusRequest {
1785        type Borrowed<'a> = &'a Self;
1786        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1787            value
1788        }
1789    }
1790
1791    unsafe impl fidl::encoding::TypeMarker for LeaseControlWatchStatusRequest {
1792        type Owned = Self;
1793
1794        #[inline(always)]
1795        fn inline_align(_context: fidl::encoding::Context) -> usize {
1796            4
1797        }
1798
1799        #[inline(always)]
1800        fn inline_size(_context: fidl::encoding::Context) -> usize {
1801            4
1802        }
1803    }
1804
1805    unsafe impl<D: fidl::encoding::ResourceDialect>
1806        fidl::encoding::Encode<LeaseControlWatchStatusRequest, D>
1807        for &LeaseControlWatchStatusRequest
1808    {
1809        #[inline]
1810        unsafe fn encode(
1811            self,
1812            encoder: &mut fidl::encoding::Encoder<'_, D>,
1813            offset: usize,
1814            _depth: fidl::encoding::Depth,
1815        ) -> fidl::Result<()> {
1816            encoder.debug_check_bounds::<LeaseControlWatchStatusRequest>(offset);
1817            // Delegate to tuple encoding.
1818            fidl::encoding::Encode::<LeaseControlWatchStatusRequest, D>::encode(
1819                (<LeaseStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.last_status),),
1820                encoder,
1821                offset,
1822                _depth,
1823            )
1824        }
1825    }
1826    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<LeaseStatus, D>>
1827        fidl::encoding::Encode<LeaseControlWatchStatusRequest, D> for (T0,)
1828    {
1829        #[inline]
1830        unsafe fn encode(
1831            self,
1832            encoder: &mut fidl::encoding::Encoder<'_, D>,
1833            offset: usize,
1834            depth: fidl::encoding::Depth,
1835        ) -> fidl::Result<()> {
1836            encoder.debug_check_bounds::<LeaseControlWatchStatusRequest>(offset);
1837            // Zero out padding regions. There's no need to apply masks
1838            // because the unmasked parts will be overwritten by fields.
1839            // Write the fields.
1840            self.0.encode(encoder, offset + 0, depth)?;
1841            Ok(())
1842        }
1843    }
1844
1845    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1846        for LeaseControlWatchStatusRequest
1847    {
1848        #[inline(always)]
1849        fn new_empty() -> Self {
1850            Self { last_status: fidl::new_empty!(LeaseStatus, D) }
1851        }
1852
1853        #[inline]
1854        unsafe fn decode(
1855            &mut self,
1856            decoder: &mut fidl::encoding::Decoder<'_, D>,
1857            offset: usize,
1858            _depth: fidl::encoding::Depth,
1859        ) -> fidl::Result<()> {
1860            decoder.debug_check_bounds::<Self>(offset);
1861            // Verify that padding bytes are zero.
1862            fidl::decode!(LeaseStatus, D, &mut self.last_status, decoder, offset + 0, _depth)?;
1863            Ok(())
1864        }
1865    }
1866
1867    impl fidl::encoding::ValueTypeMarker for LeaseControlWatchStatusResponse {
1868        type Borrowed<'a> = &'a Self;
1869        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1870            value
1871        }
1872    }
1873
1874    unsafe impl fidl::encoding::TypeMarker for LeaseControlWatchStatusResponse {
1875        type Owned = Self;
1876
1877        #[inline(always)]
1878        fn inline_align(_context: fidl::encoding::Context) -> usize {
1879            4
1880        }
1881
1882        #[inline(always)]
1883        fn inline_size(_context: fidl::encoding::Context) -> usize {
1884            4
1885        }
1886    }
1887
1888    unsafe impl<D: fidl::encoding::ResourceDialect>
1889        fidl::encoding::Encode<LeaseControlWatchStatusResponse, D>
1890        for &LeaseControlWatchStatusResponse
1891    {
1892        #[inline]
1893        unsafe fn encode(
1894            self,
1895            encoder: &mut fidl::encoding::Encoder<'_, D>,
1896            offset: usize,
1897            _depth: fidl::encoding::Depth,
1898        ) -> fidl::Result<()> {
1899            encoder.debug_check_bounds::<LeaseControlWatchStatusResponse>(offset);
1900            // Delegate to tuple encoding.
1901            fidl::encoding::Encode::<LeaseControlWatchStatusResponse, D>::encode(
1902                (<LeaseStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
1903                encoder,
1904                offset,
1905                _depth,
1906            )
1907        }
1908    }
1909    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<LeaseStatus, D>>
1910        fidl::encoding::Encode<LeaseControlWatchStatusResponse, D> for (T0,)
1911    {
1912        #[inline]
1913        unsafe fn encode(
1914            self,
1915            encoder: &mut fidl::encoding::Encoder<'_, D>,
1916            offset: usize,
1917            depth: fidl::encoding::Depth,
1918        ) -> fidl::Result<()> {
1919            encoder.debug_check_bounds::<LeaseControlWatchStatusResponse>(offset);
1920            // Zero out padding regions. There's no need to apply masks
1921            // because the unmasked parts will be overwritten by fields.
1922            // Write the fields.
1923            self.0.encode(encoder, offset + 0, depth)?;
1924            Ok(())
1925        }
1926    }
1927
1928    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1929        for LeaseControlWatchStatusResponse
1930    {
1931        #[inline(always)]
1932        fn new_empty() -> Self {
1933            Self { status: fidl::new_empty!(LeaseStatus, D) }
1934        }
1935
1936        #[inline]
1937        unsafe fn decode(
1938            &mut self,
1939            decoder: &mut fidl::encoding::Decoder<'_, D>,
1940            offset: usize,
1941            _depth: fidl::encoding::Depth,
1942        ) -> fidl::Result<()> {
1943            decoder.debug_check_bounds::<Self>(offset);
1944            // Verify that padding bytes are zero.
1945            fidl::decode!(LeaseStatus, D, &mut self.status, decoder, offset + 0, _depth)?;
1946            Ok(())
1947        }
1948    }
1949
1950    impl ElementPowerLevelNames {
1951        #[inline(always)]
1952        fn max_ordinal_present(&self) -> u64 {
1953            if let Some(_) = self.levels {
1954                return 2;
1955            }
1956            if let Some(_) = self.identifier {
1957                return 1;
1958            }
1959            0
1960        }
1961    }
1962
1963    impl fidl::encoding::ValueTypeMarker for ElementPowerLevelNames {
1964        type Borrowed<'a> = &'a Self;
1965        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1966            value
1967        }
1968    }
1969
1970    unsafe impl fidl::encoding::TypeMarker for ElementPowerLevelNames {
1971        type Owned = Self;
1972
1973        #[inline(always)]
1974        fn inline_align(_context: fidl::encoding::Context) -> usize {
1975            8
1976        }
1977
1978        #[inline(always)]
1979        fn inline_size(_context: fidl::encoding::Context) -> usize {
1980            16
1981        }
1982    }
1983
1984    unsafe impl<D: fidl::encoding::ResourceDialect>
1985        fidl::encoding::Encode<ElementPowerLevelNames, D> for &ElementPowerLevelNames
1986    {
1987        unsafe fn encode(
1988            self,
1989            encoder: &mut fidl::encoding::Encoder<'_, D>,
1990            offset: usize,
1991            mut depth: fidl::encoding::Depth,
1992        ) -> fidl::Result<()> {
1993            encoder.debug_check_bounds::<ElementPowerLevelNames>(offset);
1994            // Vector header
1995            let max_ordinal: u64 = self.max_ordinal_present();
1996            encoder.write_num(max_ordinal, offset);
1997            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1998            // Calling encoder.out_of_line_offset(0) is not allowed.
1999            if max_ordinal == 0 {
2000                return Ok(());
2001            }
2002            depth.increment()?;
2003            let envelope_size = 8;
2004            let bytes_len = max_ordinal as usize * envelope_size;
2005            #[allow(unused_variables)]
2006            let offset = encoder.out_of_line_offset(bytes_len);
2007            let mut _prev_end_offset: usize = 0;
2008            if 1 > max_ordinal {
2009                return Ok(());
2010            }
2011
2012            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2013            // are envelope_size bytes.
2014            let cur_offset: usize = (1 - 1) * envelope_size;
2015
2016            // Zero reserved fields.
2017            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2018
2019            // Safety:
2020            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2021            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2022            //   envelope_size bytes, there is always sufficient room.
2023            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<64>, D>(
2024                self.identifier.as_ref().map(
2025                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
2026                ),
2027                encoder,
2028                offset + cur_offset,
2029                depth,
2030            )?;
2031
2032            _prev_end_offset = cur_offset + envelope_size;
2033            if 2 > max_ordinal {
2034                return Ok(());
2035            }
2036
2037            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2038            // are envelope_size bytes.
2039            let cur_offset: usize = (2 - 1) * envelope_size;
2040
2041            // Zero reserved fields.
2042            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2043
2044            // Safety:
2045            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2046            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2047            //   envelope_size bytes, there is always sufficient room.
2048            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<PowerLevelName, 256>, D>(
2049            self.levels.as_ref().map(<fidl::encoding::Vector<PowerLevelName, 256> as fidl::encoding::ValueTypeMarker>::borrow),
2050            encoder, offset + cur_offset, depth
2051        )?;
2052
2053            _prev_end_offset = cur_offset + envelope_size;
2054
2055            Ok(())
2056        }
2057    }
2058
2059    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2060        for ElementPowerLevelNames
2061    {
2062        #[inline(always)]
2063        fn new_empty() -> Self {
2064            Self::default()
2065        }
2066
2067        unsafe fn decode(
2068            &mut self,
2069            decoder: &mut fidl::encoding::Decoder<'_, D>,
2070            offset: usize,
2071            mut depth: fidl::encoding::Depth,
2072        ) -> fidl::Result<()> {
2073            decoder.debug_check_bounds::<Self>(offset);
2074            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2075                None => return Err(fidl::Error::NotNullable),
2076                Some(len) => len,
2077            };
2078            // Calling decoder.out_of_line_offset(0) is not allowed.
2079            if len == 0 {
2080                return Ok(());
2081            };
2082            depth.increment()?;
2083            let envelope_size = 8;
2084            let bytes_len = len * envelope_size;
2085            let offset = decoder.out_of_line_offset(bytes_len)?;
2086            // Decode the envelope for each type.
2087            let mut _next_ordinal_to_read = 0;
2088            let mut next_offset = offset;
2089            let end_offset = offset + bytes_len;
2090            _next_ordinal_to_read += 1;
2091            if next_offset >= end_offset {
2092                return Ok(());
2093            }
2094
2095            // Decode unknown envelopes for gaps in ordinals.
2096            while _next_ordinal_to_read < 1 {
2097                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2098                _next_ordinal_to_read += 1;
2099                next_offset += envelope_size;
2100            }
2101
2102            let next_out_of_line = decoder.next_out_of_line();
2103            let handles_before = decoder.remaining_handles();
2104            if let Some((inlined, num_bytes, num_handles)) =
2105                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2106            {
2107                let member_inline_size =
2108                    <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
2109                        decoder.context,
2110                    );
2111                if inlined != (member_inline_size <= 4) {
2112                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2113                }
2114                let inner_offset;
2115                let mut inner_depth = depth.clone();
2116                if inlined {
2117                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2118                    inner_offset = next_offset;
2119                } else {
2120                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2121                    inner_depth.increment()?;
2122                }
2123                let val_ref = self
2124                    .identifier
2125                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<64>, D));
2126                fidl::decode!(
2127                    fidl::encoding::BoundedString<64>,
2128                    D,
2129                    val_ref,
2130                    decoder,
2131                    inner_offset,
2132                    inner_depth
2133                )?;
2134                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2135                {
2136                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2137                }
2138                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2139                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2140                }
2141            }
2142
2143            next_offset += envelope_size;
2144            _next_ordinal_to_read += 1;
2145            if next_offset >= end_offset {
2146                return Ok(());
2147            }
2148
2149            // Decode unknown envelopes for gaps in ordinals.
2150            while _next_ordinal_to_read < 2 {
2151                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2152                _next_ordinal_to_read += 1;
2153                next_offset += envelope_size;
2154            }
2155
2156            let next_out_of_line = decoder.next_out_of_line();
2157            let handles_before = decoder.remaining_handles();
2158            if let Some((inlined, num_bytes, num_handles)) =
2159                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2160            {
2161                let member_inline_size = <fidl::encoding::Vector<PowerLevelName, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2162                if inlined != (member_inline_size <= 4) {
2163                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2164                }
2165                let inner_offset;
2166                let mut inner_depth = depth.clone();
2167                if inlined {
2168                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2169                    inner_offset = next_offset;
2170                } else {
2171                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2172                    inner_depth.increment()?;
2173                }
2174                let val_ref = self.levels.get_or_insert_with(
2175                    || fidl::new_empty!(fidl::encoding::Vector<PowerLevelName, 256>, D),
2176                );
2177                fidl::decode!(fidl::encoding::Vector<PowerLevelName, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
2178                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2179                {
2180                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2181                }
2182                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2183                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2184                }
2185            }
2186
2187            next_offset += envelope_size;
2188
2189            // Decode the remaining unknown envelopes.
2190            while next_offset < end_offset {
2191                _next_ordinal_to_read += 1;
2192                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2193                next_offset += envelope_size;
2194            }
2195
2196            Ok(())
2197        }
2198    }
2199
2200    impl PowerLevelName {
2201        #[inline(always)]
2202        fn max_ordinal_present(&self) -> u64 {
2203            if let Some(_) = self.name {
2204                return 2;
2205            }
2206            if let Some(_) = self.level {
2207                return 1;
2208            }
2209            0
2210        }
2211    }
2212
2213    impl fidl::encoding::ValueTypeMarker for PowerLevelName {
2214        type Borrowed<'a> = &'a Self;
2215        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2216            value
2217        }
2218    }
2219
2220    unsafe impl fidl::encoding::TypeMarker for PowerLevelName {
2221        type Owned = Self;
2222
2223        #[inline(always)]
2224        fn inline_align(_context: fidl::encoding::Context) -> usize {
2225            8
2226        }
2227
2228        #[inline(always)]
2229        fn inline_size(_context: fidl::encoding::Context) -> usize {
2230            16
2231        }
2232    }
2233
2234    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PowerLevelName, D>
2235        for &PowerLevelName
2236    {
2237        unsafe fn encode(
2238            self,
2239            encoder: &mut fidl::encoding::Encoder<'_, D>,
2240            offset: usize,
2241            mut depth: fidl::encoding::Depth,
2242        ) -> fidl::Result<()> {
2243            encoder.debug_check_bounds::<PowerLevelName>(offset);
2244            // Vector header
2245            let max_ordinal: u64 = self.max_ordinal_present();
2246            encoder.write_num(max_ordinal, offset);
2247            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2248            // Calling encoder.out_of_line_offset(0) is not allowed.
2249            if max_ordinal == 0 {
2250                return Ok(());
2251            }
2252            depth.increment()?;
2253            let envelope_size = 8;
2254            let bytes_len = max_ordinal as usize * envelope_size;
2255            #[allow(unused_variables)]
2256            let offset = encoder.out_of_line_offset(bytes_len);
2257            let mut _prev_end_offset: usize = 0;
2258            if 1 > max_ordinal {
2259                return Ok(());
2260            }
2261
2262            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2263            // are envelope_size bytes.
2264            let cur_offset: usize = (1 - 1) * envelope_size;
2265
2266            // Zero reserved fields.
2267            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2268
2269            // Safety:
2270            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2271            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2272            //   envelope_size bytes, there is always sufficient room.
2273            fidl::encoding::encode_in_envelope_optional::<u8, D>(
2274                self.level.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
2275                encoder,
2276                offset + cur_offset,
2277                depth,
2278            )?;
2279
2280            _prev_end_offset = cur_offset + envelope_size;
2281            if 2 > max_ordinal {
2282                return Ok(());
2283            }
2284
2285            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2286            // are envelope_size bytes.
2287            let cur_offset: usize = (2 - 1) * envelope_size;
2288
2289            // Zero reserved fields.
2290            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2291
2292            // Safety:
2293            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2294            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2295            //   envelope_size bytes, there is always sufficient room.
2296            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<16>, D>(
2297                self.name.as_ref().map(
2298                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow,
2299                ),
2300                encoder,
2301                offset + cur_offset,
2302                depth,
2303            )?;
2304
2305            _prev_end_offset = cur_offset + envelope_size;
2306
2307            Ok(())
2308        }
2309    }
2310
2311    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PowerLevelName {
2312        #[inline(always)]
2313        fn new_empty() -> Self {
2314            Self::default()
2315        }
2316
2317        unsafe fn decode(
2318            &mut self,
2319            decoder: &mut fidl::encoding::Decoder<'_, D>,
2320            offset: usize,
2321            mut depth: fidl::encoding::Depth,
2322        ) -> fidl::Result<()> {
2323            decoder.debug_check_bounds::<Self>(offset);
2324            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2325                None => return Err(fidl::Error::NotNullable),
2326                Some(len) => len,
2327            };
2328            // Calling decoder.out_of_line_offset(0) is not allowed.
2329            if len == 0 {
2330                return Ok(());
2331            };
2332            depth.increment()?;
2333            let envelope_size = 8;
2334            let bytes_len = len * envelope_size;
2335            let offset = decoder.out_of_line_offset(bytes_len)?;
2336            // Decode the envelope for each type.
2337            let mut _next_ordinal_to_read = 0;
2338            let mut next_offset = offset;
2339            let end_offset = offset + bytes_len;
2340            _next_ordinal_to_read += 1;
2341            if next_offset >= end_offset {
2342                return Ok(());
2343            }
2344
2345            // Decode unknown envelopes for gaps in ordinals.
2346            while _next_ordinal_to_read < 1 {
2347                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2348                _next_ordinal_to_read += 1;
2349                next_offset += envelope_size;
2350            }
2351
2352            let next_out_of_line = decoder.next_out_of_line();
2353            let handles_before = decoder.remaining_handles();
2354            if let Some((inlined, num_bytes, num_handles)) =
2355                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2356            {
2357                let member_inline_size =
2358                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2359                if inlined != (member_inline_size <= 4) {
2360                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2361                }
2362                let inner_offset;
2363                let mut inner_depth = depth.clone();
2364                if inlined {
2365                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2366                    inner_offset = next_offset;
2367                } else {
2368                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2369                    inner_depth.increment()?;
2370                }
2371                let val_ref = self.level.get_or_insert_with(|| fidl::new_empty!(u8, D));
2372                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
2373                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2374                {
2375                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2376                }
2377                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2378                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2379                }
2380            }
2381
2382            next_offset += envelope_size;
2383            _next_ordinal_to_read += 1;
2384            if next_offset >= end_offset {
2385                return Ok(());
2386            }
2387
2388            // Decode unknown envelopes for gaps in ordinals.
2389            while _next_ordinal_to_read < 2 {
2390                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2391                _next_ordinal_to_read += 1;
2392                next_offset += envelope_size;
2393            }
2394
2395            let next_out_of_line = decoder.next_out_of_line();
2396            let handles_before = decoder.remaining_handles();
2397            if let Some((inlined, num_bytes, num_handles)) =
2398                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2399            {
2400                let member_inline_size =
2401                    <fidl::encoding::BoundedString<16> as fidl::encoding::TypeMarker>::inline_size(
2402                        decoder.context,
2403                    );
2404                if inlined != (member_inline_size <= 4) {
2405                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2406                }
2407                let inner_offset;
2408                let mut inner_depth = depth.clone();
2409                if inlined {
2410                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2411                    inner_offset = next_offset;
2412                } else {
2413                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2414                    inner_depth.increment()?;
2415                }
2416                let val_ref = self
2417                    .name
2418                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<16>, D));
2419                fidl::decode!(
2420                    fidl::encoding::BoundedString<16>,
2421                    D,
2422                    val_ref,
2423                    decoder,
2424                    inner_offset,
2425                    inner_depth
2426                )?;
2427                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2428                {
2429                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2430                }
2431                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2432                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2433                }
2434            }
2435
2436            next_offset += envelope_size;
2437
2438            // Decode the remaining unknown envelopes.
2439            while next_offset < end_offset {
2440                _next_ordinal_to_read += 1;
2441                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2442                next_offset += envelope_size;
2443            }
2444
2445            Ok(())
2446        }
2447    }
2448}