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