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