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