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