Skip to main content

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