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