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 const DEFAULT_GUEST_CID: u32 = 3;
13
14pub const HOST_CID: u32 = 2;
16
17pub const MAX_BLOCK_DEVICES: u8 = 32;
18
19pub const MAX_BLOCK_DEVICE_ID: u8 = 20;
20
21pub const MAX_MEMORY: u8 = 32;
22
23pub const MAX_NET_DEVICES: u8 = 32;
24
25#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
26#[repr(u32)]
27pub enum BlockMode {
28 ReadWrite = 0,
30 ReadOnly = 1,
32 VolatileWrite = 2,
34}
35
36impl BlockMode {
37 #[inline]
38 pub fn from_primitive(prim: u32) -> Option<Self> {
39 match prim {
40 0 => Some(Self::ReadWrite),
41 1 => Some(Self::ReadOnly),
42 2 => Some(Self::VolatileWrite),
43 _ => None,
44 }
45 }
46
47 #[inline]
48 pub const fn into_primitive(self) -> u32 {
49 self as u32
50 }
51
52 #[deprecated = "Strict enums should not use `is_unknown`"]
53 #[inline]
54 pub fn is_unknown(&self) -> bool {
55 false
56 }
57}
58
59#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
61#[repr(u32)]
62pub enum ContainerStatus {
63 Transient = 1,
64 LaunchingGuest = 2,
65 StartingVm = 3,
66 Downloading = 4,
67 Extracting = 5,
68 Starting = 6,
69 Ready = 7,
70 Failed = 8,
71}
72
73impl ContainerStatus {
74 #[inline]
75 pub fn from_primitive(prim: u32) -> Option<Self> {
76 match prim {
77 1 => Some(Self::Transient),
78 2 => Some(Self::LaunchingGuest),
79 3 => Some(Self::StartingVm),
80 4 => Some(Self::Downloading),
81 5 => Some(Self::Extracting),
82 6 => Some(Self::Starting),
83 7 => Some(Self::Ready),
84 8 => Some(Self::Failed),
85 _ => None,
86 }
87 }
88
89 #[inline]
90 pub const fn into_primitive(self) -> u32 {
91 self as u32
92 }
93
94 #[deprecated = "Strict enums should not use `is_unknown`"]
95 #[inline]
96 pub fn is_unknown(&self) -> bool {
97 false
98 }
99}
100
101#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
102#[repr(u32)]
103pub enum GuestError {
104 InternalError = 1,
106 DeviceNotPresent = 2,
108 BadConfig = 3,
110 GuestInitializationFailure = 4,
113 DeviceInitializationFailure = 5,
115 DeviceStartFailure = 6,
117 DeviceMemoryOverlap = 7,
119 FailedServiceConnect = 8,
121 DuplicatePublicServices = 9,
123 KernelLoadFailure = 10,
125 VcpuStartFailure = 11,
127 VcpuRuntimeFailure = 12,
129 NotCreated = 13,
131 AlreadyRunning = 14,
134 ControllerForcedHalt = 15,
136}
137
138impl GuestError {
139 #[inline]
140 pub fn from_primitive(prim: u32) -> Option<Self> {
141 match prim {
142 1 => Some(Self::InternalError),
143 2 => Some(Self::DeviceNotPresent),
144 3 => Some(Self::BadConfig),
145 4 => Some(Self::GuestInitializationFailure),
146 5 => Some(Self::DeviceInitializationFailure),
147 6 => Some(Self::DeviceStartFailure),
148 7 => Some(Self::DeviceMemoryOverlap),
149 8 => Some(Self::FailedServiceConnect),
150 9 => Some(Self::DuplicatePublicServices),
151 10 => Some(Self::KernelLoadFailure),
152 11 => Some(Self::VcpuStartFailure),
153 12 => Some(Self::VcpuRuntimeFailure),
154 13 => Some(Self::NotCreated),
155 14 => Some(Self::AlreadyRunning),
156 15 => Some(Self::ControllerForcedHalt),
157 _ => None,
158 }
159 }
160
161 #[inline]
162 pub const fn into_primitive(self) -> u32 {
163 self as u32
164 }
165
166 #[deprecated = "Strict enums should not use `is_unknown`"]
167 #[inline]
168 pub fn is_unknown(&self) -> bool {
169 false
170 }
171}
172
173#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
174#[repr(u32)]
175pub enum GuestManagerError {
176 BadConfig = 1,
179 AlreadyRunning = 2,
181 NotRunning = 3,
183 StartFailure = 4,
185 NoStorage = 5,
188}
189
190impl GuestManagerError {
191 #[inline]
192 pub fn from_primitive(prim: u32) -> Option<Self> {
193 match prim {
194 1 => Some(Self::BadConfig),
195 2 => Some(Self::AlreadyRunning),
196 3 => Some(Self::NotRunning),
197 4 => Some(Self::StartFailure),
198 5 => Some(Self::NoStorage),
199 _ => None,
200 }
201 }
202
203 #[inline]
204 pub const fn into_primitive(self) -> u32 {
205 self as u32
206 }
207
208 #[deprecated = "Strict enums should not use `is_unknown`"]
209 #[inline]
210 pub fn is_unknown(&self) -> bool {
211 false
212 }
213}
214
215#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
216#[repr(u32)]
217pub enum GuestStatus {
218 NotStarted = 1,
220 Starting = 2,
222 Running = 3,
224 Stopping = 4,
227 Stopped = 5,
230 VmmUnexpectedTermination = 6,
233}
234
235impl GuestStatus {
236 #[inline]
237 pub fn from_primitive(prim: u32) -> Option<Self> {
238 match prim {
239 1 => Some(Self::NotStarted),
240 2 => Some(Self::Starting),
241 3 => Some(Self::Running),
242 4 => Some(Self::Stopping),
243 5 => Some(Self::Stopped),
244 6 => Some(Self::VmmUnexpectedTermination),
245 _ => None,
246 }
247 }
248
249 #[inline]
250 pub const fn into_primitive(self) -> u32 {
251 self as u32
252 }
253
254 #[deprecated = "Strict enums should not use `is_unknown`"]
255 #[inline]
256 pub fn is_unknown(&self) -> bool {
257 false
258 }
259}
260
261#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
263#[repr(u32)]
264pub enum KernelType {
265 Zircon = 0,
266 Linux = 1,
267}
268
269impl KernelType {
270 #[inline]
271 pub fn from_primitive(prim: u32) -> Option<Self> {
272 match prim {
273 0 => Some(Self::Zircon),
274 1 => Some(Self::Linux),
275 _ => None,
276 }
277 }
278
279 #[inline]
280 pub const fn into_primitive(self) -> u32 {
281 self as u32
282 }
283
284 #[deprecated = "Strict enums should not use `is_unknown`"]
285 #[inline]
286 pub fn is_unknown(&self) -> bool {
287 false
288 }
289}
290
291#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
292#[repr(C)]
293pub struct BalloonControllerGetBalloonSizeResponse {
294 pub current_num_pages: u32,
295 pub requested_num_pages: u32,
296}
297
298impl fidl::Persistable for BalloonControllerGetBalloonSizeResponse {}
299
300#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
301pub struct BalloonControllerGetMemStatsResponse {
302 pub status: i32,
303 pub mem_stats: Option<Vec<MemStat>>,
304}
305
306impl fidl::Persistable for BalloonControllerGetMemStatsResponse {}
307
308#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
309#[repr(C)]
310pub struct BalloonControllerRequestNumPagesRequest {
311 pub requested_num_pages: u32,
312}
313
314impl fidl::Persistable for BalloonControllerRequestNumPagesRequest {}
315
316#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
317#[repr(C)]
318pub struct HostVsockAcceptorAcceptRequest {
319 pub src_cid: u32,
320 pub src_port: u32,
321 pub port: u32,
322}
323
324impl fidl::Persistable for HostVsockAcceptorAcceptRequest {}
325
326#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
327#[repr(C)]
328pub struct HostVsockEndpointConnectRequest {
329 pub guest_port: u32,
330}
331
332impl fidl::Persistable for HostVsockEndpointConnectRequest {}
333
334#[derive(Clone, Debug, PartialEq)]
335pub struct LinuxManagerOnGuestInfoChangedRequest {
336 pub label: String,
337 pub info: LinuxGuestInfo,
338}
339
340impl fidl::Persistable for LinuxManagerOnGuestInfoChangedRequest {}
341
342#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
343pub struct LinuxManagerStartAndGetLinuxGuestInfoRequest {
344 pub label: String,
345}
346
347impl fidl::Persistable for LinuxManagerStartAndGetLinuxGuestInfoRequest {}
348
349#[derive(Clone, Debug, PartialEq)]
350pub struct LinuxManagerStartAndGetLinuxGuestInfoResponse {
351 pub info: LinuxGuestInfo,
352}
353
354impl fidl::Persistable for LinuxManagerStartAndGetLinuxGuestInfoResponse {}
355
356#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
358#[repr(C)]
359pub struct MagmaDevice {
360 pub memory: u64,
365}
366
367impl fidl::Persistable for MagmaDevice {}
368
369#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
370#[repr(C)]
371pub struct MemControllerGetMemSizeResponse {
372 pub block_size: u64,
373 pub region_size: u64,
374 pub usable_region_size: u64,
375 pub plugged_size: u64,
376 pub requested_size: u64,
377}
378
379impl fidl::Persistable for MemControllerGetMemSizeResponse {}
380
381#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
382#[repr(C)]
383pub struct MemControllerRequestSizeRequest {
384 pub requested_size: u64,
385}
386
387impl fidl::Persistable for MemControllerRequestSizeRequest {}
388
389#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
391#[repr(C)]
392pub struct MemStat {
393 pub tag: u16,
394 pub val: u64,
395}
396
397impl fidl::Persistable for MemStat {}
398
399#[derive(Clone, Debug, PartialEq)]
401pub struct NetSpec {
402 pub mac_address: fidl_fuchsia_net::MacAddress,
404 pub enable_bridge: bool,
406}
407
408impl fidl::Persistable for NetSpec {}
409
410#[derive(Clone, Debug, Default, PartialEq)]
413pub struct GuestDescriptor {
414 pub num_cpus: Option<u8>,
416 pub guest_memory: Option<u64>,
418 pub wayland: Option<bool>,
420 pub magma: Option<bool>,
421 pub balloon: Option<bool>,
422 pub console: Option<bool>,
423 pub gpu: Option<bool>,
424 pub rng: Option<bool>,
425 pub vsock: Option<bool>,
426 pub sound: Option<bool>,
427 pub networks: Option<Vec<NetSpec>>,
430 pub mem: Option<bool>,
431 #[doc(hidden)]
432 pub __source_breaking: fidl::marker::SourceBreaking,
433}
434
435impl fidl::Persistable for GuestDescriptor {}
436
437#[derive(Clone, Debug, Default, PartialEq)]
438pub struct GuestInfo {
439 pub guest_status: Option<GuestStatus>,
441 pub uptime: Option<i64>,
443 pub guest_descriptor: Option<GuestDescriptor>,
445 pub stop_error: Option<GuestError>,
447 pub detected_problems: Option<Vec<String>>,
453 #[doc(hidden)]
454 pub __source_breaking: fidl::marker::SourceBreaking,
455}
456
457impl fidl::Persistable for GuestInfo {}
458
459#[derive(Clone, Debug, Default, PartialEq)]
461pub struct LinuxGuestInfo {
462 pub cid: Option<u32>,
464 pub container_status: Option<ContainerStatus>,
466 pub download_percent: Option<i32>,
469 pub failure_reason: Option<String>,
472 #[doc(hidden)]
473 pub __source_breaking: fidl::marker::SourceBreaking,
474}
475
476impl fidl::Persistable for LinuxGuestInfo {}
477
478mod internal {
479 use super::*;
480 unsafe impl fidl::encoding::TypeMarker for BlockMode {
481 type Owned = Self;
482
483 #[inline(always)]
484 fn inline_align(_context: fidl::encoding::Context) -> usize {
485 std::mem::align_of::<u32>()
486 }
487
488 #[inline(always)]
489 fn inline_size(_context: fidl::encoding::Context) -> usize {
490 std::mem::size_of::<u32>()
491 }
492
493 #[inline(always)]
494 fn encode_is_copy() -> bool {
495 true
496 }
497
498 #[inline(always)]
499 fn decode_is_copy() -> bool {
500 false
501 }
502 }
503
504 impl fidl::encoding::ValueTypeMarker for BlockMode {
505 type Borrowed<'a> = Self;
506 #[inline(always)]
507 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
508 *value
509 }
510 }
511
512 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BlockMode {
513 #[inline]
514 unsafe fn encode(
515 self,
516 encoder: &mut fidl::encoding::Encoder<'_, D>,
517 offset: usize,
518 _depth: fidl::encoding::Depth,
519 ) -> fidl::Result<()> {
520 encoder.debug_check_bounds::<Self>(offset);
521 encoder.write_num(self.into_primitive(), offset);
522 Ok(())
523 }
524 }
525
526 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockMode {
527 #[inline(always)]
528 fn new_empty() -> Self {
529 Self::ReadWrite
530 }
531
532 #[inline]
533 unsafe fn decode(
534 &mut self,
535 decoder: &mut fidl::encoding::Decoder<'_, D>,
536 offset: usize,
537 _depth: fidl::encoding::Depth,
538 ) -> fidl::Result<()> {
539 decoder.debug_check_bounds::<Self>(offset);
540 let prim = decoder.read_num::<u32>(offset);
541
542 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
543 Ok(())
544 }
545 }
546 unsafe impl fidl::encoding::TypeMarker for ContainerStatus {
547 type Owned = Self;
548
549 #[inline(always)]
550 fn inline_align(_context: fidl::encoding::Context) -> usize {
551 std::mem::align_of::<u32>()
552 }
553
554 #[inline(always)]
555 fn inline_size(_context: fidl::encoding::Context) -> usize {
556 std::mem::size_of::<u32>()
557 }
558
559 #[inline(always)]
560 fn encode_is_copy() -> bool {
561 true
562 }
563
564 #[inline(always)]
565 fn decode_is_copy() -> bool {
566 false
567 }
568 }
569
570 impl fidl::encoding::ValueTypeMarker for ContainerStatus {
571 type Borrowed<'a> = Self;
572 #[inline(always)]
573 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
574 *value
575 }
576 }
577
578 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
579 for ContainerStatus
580 {
581 #[inline]
582 unsafe fn encode(
583 self,
584 encoder: &mut fidl::encoding::Encoder<'_, D>,
585 offset: usize,
586 _depth: fidl::encoding::Depth,
587 ) -> fidl::Result<()> {
588 encoder.debug_check_bounds::<Self>(offset);
589 encoder.write_num(self.into_primitive(), offset);
590 Ok(())
591 }
592 }
593
594 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContainerStatus {
595 #[inline(always)]
596 fn new_empty() -> Self {
597 Self::Transient
598 }
599
600 #[inline]
601 unsafe fn decode(
602 &mut self,
603 decoder: &mut fidl::encoding::Decoder<'_, D>,
604 offset: usize,
605 _depth: fidl::encoding::Depth,
606 ) -> fidl::Result<()> {
607 decoder.debug_check_bounds::<Self>(offset);
608 let prim = decoder.read_num::<u32>(offset);
609
610 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
611 Ok(())
612 }
613 }
614 unsafe impl fidl::encoding::TypeMarker for GuestError {
615 type Owned = Self;
616
617 #[inline(always)]
618 fn inline_align(_context: fidl::encoding::Context) -> usize {
619 std::mem::align_of::<u32>()
620 }
621
622 #[inline(always)]
623 fn inline_size(_context: fidl::encoding::Context) -> usize {
624 std::mem::size_of::<u32>()
625 }
626
627 #[inline(always)]
628 fn encode_is_copy() -> bool {
629 true
630 }
631
632 #[inline(always)]
633 fn decode_is_copy() -> bool {
634 false
635 }
636 }
637
638 impl fidl::encoding::ValueTypeMarker for GuestError {
639 type Borrowed<'a> = Self;
640 #[inline(always)]
641 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
642 *value
643 }
644 }
645
646 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for GuestError {
647 #[inline]
648 unsafe fn encode(
649 self,
650 encoder: &mut fidl::encoding::Encoder<'_, D>,
651 offset: usize,
652 _depth: fidl::encoding::Depth,
653 ) -> fidl::Result<()> {
654 encoder.debug_check_bounds::<Self>(offset);
655 encoder.write_num(self.into_primitive(), offset);
656 Ok(())
657 }
658 }
659
660 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GuestError {
661 #[inline(always)]
662 fn new_empty() -> Self {
663 Self::InternalError
664 }
665
666 #[inline]
667 unsafe fn decode(
668 &mut self,
669 decoder: &mut fidl::encoding::Decoder<'_, D>,
670 offset: usize,
671 _depth: fidl::encoding::Depth,
672 ) -> fidl::Result<()> {
673 decoder.debug_check_bounds::<Self>(offset);
674 let prim = decoder.read_num::<u32>(offset);
675
676 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
677 Ok(())
678 }
679 }
680 unsafe impl fidl::encoding::TypeMarker for GuestManagerError {
681 type Owned = Self;
682
683 #[inline(always)]
684 fn inline_align(_context: fidl::encoding::Context) -> usize {
685 std::mem::align_of::<u32>()
686 }
687
688 #[inline(always)]
689 fn inline_size(_context: fidl::encoding::Context) -> usize {
690 std::mem::size_of::<u32>()
691 }
692
693 #[inline(always)]
694 fn encode_is_copy() -> bool {
695 true
696 }
697
698 #[inline(always)]
699 fn decode_is_copy() -> bool {
700 false
701 }
702 }
703
704 impl fidl::encoding::ValueTypeMarker for GuestManagerError {
705 type Borrowed<'a> = Self;
706 #[inline(always)]
707 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
708 *value
709 }
710 }
711
712 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
713 for GuestManagerError
714 {
715 #[inline]
716 unsafe fn encode(
717 self,
718 encoder: &mut fidl::encoding::Encoder<'_, D>,
719 offset: usize,
720 _depth: fidl::encoding::Depth,
721 ) -> fidl::Result<()> {
722 encoder.debug_check_bounds::<Self>(offset);
723 encoder.write_num(self.into_primitive(), offset);
724 Ok(())
725 }
726 }
727
728 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GuestManagerError {
729 #[inline(always)]
730 fn new_empty() -> Self {
731 Self::BadConfig
732 }
733
734 #[inline]
735 unsafe fn decode(
736 &mut self,
737 decoder: &mut fidl::encoding::Decoder<'_, D>,
738 offset: usize,
739 _depth: fidl::encoding::Depth,
740 ) -> fidl::Result<()> {
741 decoder.debug_check_bounds::<Self>(offset);
742 let prim = decoder.read_num::<u32>(offset);
743
744 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
745 Ok(())
746 }
747 }
748 unsafe impl fidl::encoding::TypeMarker for GuestStatus {
749 type Owned = Self;
750
751 #[inline(always)]
752 fn inline_align(_context: fidl::encoding::Context) -> usize {
753 std::mem::align_of::<u32>()
754 }
755
756 #[inline(always)]
757 fn inline_size(_context: fidl::encoding::Context) -> usize {
758 std::mem::size_of::<u32>()
759 }
760
761 #[inline(always)]
762 fn encode_is_copy() -> bool {
763 true
764 }
765
766 #[inline(always)]
767 fn decode_is_copy() -> bool {
768 false
769 }
770 }
771
772 impl fidl::encoding::ValueTypeMarker for GuestStatus {
773 type Borrowed<'a> = Self;
774 #[inline(always)]
775 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
776 *value
777 }
778 }
779
780 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for GuestStatus {
781 #[inline]
782 unsafe fn encode(
783 self,
784 encoder: &mut fidl::encoding::Encoder<'_, D>,
785 offset: usize,
786 _depth: fidl::encoding::Depth,
787 ) -> fidl::Result<()> {
788 encoder.debug_check_bounds::<Self>(offset);
789 encoder.write_num(self.into_primitive(), offset);
790 Ok(())
791 }
792 }
793
794 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GuestStatus {
795 #[inline(always)]
796 fn new_empty() -> Self {
797 Self::NotStarted
798 }
799
800 #[inline]
801 unsafe fn decode(
802 &mut self,
803 decoder: &mut fidl::encoding::Decoder<'_, D>,
804 offset: usize,
805 _depth: fidl::encoding::Depth,
806 ) -> fidl::Result<()> {
807 decoder.debug_check_bounds::<Self>(offset);
808 let prim = decoder.read_num::<u32>(offset);
809
810 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
811 Ok(())
812 }
813 }
814 unsafe impl fidl::encoding::TypeMarker for KernelType {
815 type Owned = Self;
816
817 #[inline(always)]
818 fn inline_align(_context: fidl::encoding::Context) -> usize {
819 std::mem::align_of::<u32>()
820 }
821
822 #[inline(always)]
823 fn inline_size(_context: fidl::encoding::Context) -> usize {
824 std::mem::size_of::<u32>()
825 }
826
827 #[inline(always)]
828 fn encode_is_copy() -> bool {
829 true
830 }
831
832 #[inline(always)]
833 fn decode_is_copy() -> bool {
834 false
835 }
836 }
837
838 impl fidl::encoding::ValueTypeMarker for KernelType {
839 type Borrowed<'a> = Self;
840 #[inline(always)]
841 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
842 *value
843 }
844 }
845
846 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KernelType {
847 #[inline]
848 unsafe fn encode(
849 self,
850 encoder: &mut fidl::encoding::Encoder<'_, D>,
851 offset: usize,
852 _depth: fidl::encoding::Depth,
853 ) -> fidl::Result<()> {
854 encoder.debug_check_bounds::<Self>(offset);
855 encoder.write_num(self.into_primitive(), offset);
856 Ok(())
857 }
858 }
859
860 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KernelType {
861 #[inline(always)]
862 fn new_empty() -> Self {
863 Self::Zircon
864 }
865
866 #[inline]
867 unsafe fn decode(
868 &mut self,
869 decoder: &mut fidl::encoding::Decoder<'_, D>,
870 offset: usize,
871 _depth: fidl::encoding::Depth,
872 ) -> fidl::Result<()> {
873 decoder.debug_check_bounds::<Self>(offset);
874 let prim = decoder.read_num::<u32>(offset);
875
876 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
877 Ok(())
878 }
879 }
880
881 impl fidl::encoding::ValueTypeMarker for BalloonControllerGetBalloonSizeResponse {
882 type Borrowed<'a> = &'a Self;
883 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
884 value
885 }
886 }
887
888 unsafe impl fidl::encoding::TypeMarker for BalloonControllerGetBalloonSizeResponse {
889 type Owned = Self;
890
891 #[inline(always)]
892 fn inline_align(_context: fidl::encoding::Context) -> usize {
893 4
894 }
895
896 #[inline(always)]
897 fn inline_size(_context: fidl::encoding::Context) -> usize {
898 8
899 }
900 #[inline(always)]
901 fn encode_is_copy() -> bool {
902 true
903 }
904
905 #[inline(always)]
906 fn decode_is_copy() -> bool {
907 true
908 }
909 }
910
911 unsafe impl<D: fidl::encoding::ResourceDialect>
912 fidl::encoding::Encode<BalloonControllerGetBalloonSizeResponse, D>
913 for &BalloonControllerGetBalloonSizeResponse
914 {
915 #[inline]
916 unsafe fn encode(
917 self,
918 encoder: &mut fidl::encoding::Encoder<'_, D>,
919 offset: usize,
920 _depth: fidl::encoding::Depth,
921 ) -> fidl::Result<()> {
922 encoder.debug_check_bounds::<BalloonControllerGetBalloonSizeResponse>(offset);
923 unsafe {
924 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
926 (buf_ptr as *mut BalloonControllerGetBalloonSizeResponse).write_unaligned(
927 (self as *const BalloonControllerGetBalloonSizeResponse).read(),
928 );
929 }
932 Ok(())
933 }
934 }
935 unsafe impl<
936 D: fidl::encoding::ResourceDialect,
937 T0: fidl::encoding::Encode<u32, D>,
938 T1: fidl::encoding::Encode<u32, D>,
939 > fidl::encoding::Encode<BalloonControllerGetBalloonSizeResponse, D> for (T0, T1)
940 {
941 #[inline]
942 unsafe fn encode(
943 self,
944 encoder: &mut fidl::encoding::Encoder<'_, D>,
945 offset: usize,
946 depth: fidl::encoding::Depth,
947 ) -> fidl::Result<()> {
948 encoder.debug_check_bounds::<BalloonControllerGetBalloonSizeResponse>(offset);
949 self.0.encode(encoder, offset + 0, depth)?;
953 self.1.encode(encoder, offset + 4, depth)?;
954 Ok(())
955 }
956 }
957
958 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
959 for BalloonControllerGetBalloonSizeResponse
960 {
961 #[inline(always)]
962 fn new_empty() -> Self {
963 Self {
964 current_num_pages: fidl::new_empty!(u32, D),
965 requested_num_pages: fidl::new_empty!(u32, D),
966 }
967 }
968
969 #[inline]
970 unsafe fn decode(
971 &mut self,
972 decoder: &mut fidl::encoding::Decoder<'_, D>,
973 offset: usize,
974 _depth: fidl::encoding::Depth,
975 ) -> fidl::Result<()> {
976 decoder.debug_check_bounds::<Self>(offset);
977 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
978 unsafe {
981 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
982 }
983 Ok(())
984 }
985 }
986
987 impl fidl::encoding::ValueTypeMarker for BalloonControllerGetMemStatsResponse {
988 type Borrowed<'a> = &'a Self;
989 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
990 value
991 }
992 }
993
994 unsafe impl fidl::encoding::TypeMarker for BalloonControllerGetMemStatsResponse {
995 type Owned = Self;
996
997 #[inline(always)]
998 fn inline_align(_context: fidl::encoding::Context) -> usize {
999 8
1000 }
1001
1002 #[inline(always)]
1003 fn inline_size(_context: fidl::encoding::Context) -> usize {
1004 24
1005 }
1006 }
1007
1008 unsafe impl<D: fidl::encoding::ResourceDialect>
1009 fidl::encoding::Encode<BalloonControllerGetMemStatsResponse, D>
1010 for &BalloonControllerGetMemStatsResponse
1011 {
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::<BalloonControllerGetMemStatsResponse>(offset);
1020 fidl::encoding::Encode::<BalloonControllerGetMemStatsResponse, D>::encode(
1022 (
1023 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
1024 <fidl::encoding::Optional<fidl::encoding::UnboundedVector<MemStat>> as fidl::encoding::ValueTypeMarker>::borrow(&self.mem_stats),
1025 ),
1026 encoder, offset, _depth
1027 )
1028 }
1029 }
1030 unsafe impl<
1031 D: fidl::encoding::ResourceDialect,
1032 T0: fidl::encoding::Encode<i32, D>,
1033 T1: fidl::encoding::Encode<
1034 fidl::encoding::Optional<fidl::encoding::UnboundedVector<MemStat>>,
1035 D,
1036 >,
1037 > fidl::encoding::Encode<BalloonControllerGetMemStatsResponse, D> for (T0, T1)
1038 {
1039 #[inline]
1040 unsafe fn encode(
1041 self,
1042 encoder: &mut fidl::encoding::Encoder<'_, D>,
1043 offset: usize,
1044 depth: fidl::encoding::Depth,
1045 ) -> fidl::Result<()> {
1046 encoder.debug_check_bounds::<BalloonControllerGetMemStatsResponse>(offset);
1047 unsafe {
1050 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1051 (ptr as *mut u64).write_unaligned(0);
1052 }
1053 self.0.encode(encoder, offset + 0, depth)?;
1055 self.1.encode(encoder, offset + 8, depth)?;
1056 Ok(())
1057 }
1058 }
1059
1060 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1061 for BalloonControllerGetMemStatsResponse
1062 {
1063 #[inline(always)]
1064 fn new_empty() -> Self {
1065 Self {
1066 status: fidl::new_empty!(i32, D),
1067 mem_stats: fidl::new_empty!(
1068 fidl::encoding::Optional<fidl::encoding::UnboundedVector<MemStat>>,
1069 D
1070 ),
1071 }
1072 }
1073
1074 #[inline]
1075 unsafe fn decode(
1076 &mut self,
1077 decoder: &mut fidl::encoding::Decoder<'_, D>,
1078 offset: usize,
1079 _depth: fidl::encoding::Depth,
1080 ) -> fidl::Result<()> {
1081 decoder.debug_check_bounds::<Self>(offset);
1082 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1084 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1085 let mask = 0xffffffff00000000u64;
1086 let maskedval = padval & mask;
1087 if maskedval != 0 {
1088 return Err(fidl::Error::NonZeroPadding {
1089 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1090 });
1091 }
1092 fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
1093 fidl::decode!(
1094 fidl::encoding::Optional<fidl::encoding::UnboundedVector<MemStat>>,
1095 D,
1096 &mut self.mem_stats,
1097 decoder,
1098 offset + 8,
1099 _depth
1100 )?;
1101 Ok(())
1102 }
1103 }
1104
1105 impl fidl::encoding::ValueTypeMarker for BalloonControllerRequestNumPagesRequest {
1106 type Borrowed<'a> = &'a Self;
1107 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1108 value
1109 }
1110 }
1111
1112 unsafe impl fidl::encoding::TypeMarker for BalloonControllerRequestNumPagesRequest {
1113 type Owned = Self;
1114
1115 #[inline(always)]
1116 fn inline_align(_context: fidl::encoding::Context) -> usize {
1117 4
1118 }
1119
1120 #[inline(always)]
1121 fn inline_size(_context: fidl::encoding::Context) -> usize {
1122 4
1123 }
1124 #[inline(always)]
1125 fn encode_is_copy() -> bool {
1126 true
1127 }
1128
1129 #[inline(always)]
1130 fn decode_is_copy() -> bool {
1131 true
1132 }
1133 }
1134
1135 unsafe impl<D: fidl::encoding::ResourceDialect>
1136 fidl::encoding::Encode<BalloonControllerRequestNumPagesRequest, D>
1137 for &BalloonControllerRequestNumPagesRequest
1138 {
1139 #[inline]
1140 unsafe fn encode(
1141 self,
1142 encoder: &mut fidl::encoding::Encoder<'_, D>,
1143 offset: usize,
1144 _depth: fidl::encoding::Depth,
1145 ) -> fidl::Result<()> {
1146 encoder.debug_check_bounds::<BalloonControllerRequestNumPagesRequest>(offset);
1147 unsafe {
1148 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1150 (buf_ptr as *mut BalloonControllerRequestNumPagesRequest).write_unaligned(
1151 (self as *const BalloonControllerRequestNumPagesRequest).read(),
1152 );
1153 }
1156 Ok(())
1157 }
1158 }
1159 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1160 fidl::encoding::Encode<BalloonControllerRequestNumPagesRequest, D> for (T0,)
1161 {
1162 #[inline]
1163 unsafe fn encode(
1164 self,
1165 encoder: &mut fidl::encoding::Encoder<'_, D>,
1166 offset: usize,
1167 depth: fidl::encoding::Depth,
1168 ) -> fidl::Result<()> {
1169 encoder.debug_check_bounds::<BalloonControllerRequestNumPagesRequest>(offset);
1170 self.0.encode(encoder, offset + 0, depth)?;
1174 Ok(())
1175 }
1176 }
1177
1178 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1179 for BalloonControllerRequestNumPagesRequest
1180 {
1181 #[inline(always)]
1182 fn new_empty() -> Self {
1183 Self { requested_num_pages: fidl::new_empty!(u32, D) }
1184 }
1185
1186 #[inline]
1187 unsafe fn decode(
1188 &mut self,
1189 decoder: &mut fidl::encoding::Decoder<'_, D>,
1190 offset: usize,
1191 _depth: fidl::encoding::Depth,
1192 ) -> fidl::Result<()> {
1193 decoder.debug_check_bounds::<Self>(offset);
1194 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1195 unsafe {
1198 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1199 }
1200 Ok(())
1201 }
1202 }
1203
1204 impl fidl::encoding::ValueTypeMarker for HostVsockAcceptorAcceptRequest {
1205 type Borrowed<'a> = &'a Self;
1206 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1207 value
1208 }
1209 }
1210
1211 unsafe impl fidl::encoding::TypeMarker for HostVsockAcceptorAcceptRequest {
1212 type Owned = Self;
1213
1214 #[inline(always)]
1215 fn inline_align(_context: fidl::encoding::Context) -> usize {
1216 4
1217 }
1218
1219 #[inline(always)]
1220 fn inline_size(_context: fidl::encoding::Context) -> usize {
1221 12
1222 }
1223 #[inline(always)]
1224 fn encode_is_copy() -> bool {
1225 true
1226 }
1227
1228 #[inline(always)]
1229 fn decode_is_copy() -> bool {
1230 true
1231 }
1232 }
1233
1234 unsafe impl<D: fidl::encoding::ResourceDialect>
1235 fidl::encoding::Encode<HostVsockAcceptorAcceptRequest, D>
1236 for &HostVsockAcceptorAcceptRequest
1237 {
1238 #[inline]
1239 unsafe fn encode(
1240 self,
1241 encoder: &mut fidl::encoding::Encoder<'_, D>,
1242 offset: usize,
1243 _depth: fidl::encoding::Depth,
1244 ) -> fidl::Result<()> {
1245 encoder.debug_check_bounds::<HostVsockAcceptorAcceptRequest>(offset);
1246 unsafe {
1247 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1249 (buf_ptr as *mut HostVsockAcceptorAcceptRequest)
1250 .write_unaligned((self as *const HostVsockAcceptorAcceptRequest).read());
1251 }
1254 Ok(())
1255 }
1256 }
1257 unsafe impl<
1258 D: fidl::encoding::ResourceDialect,
1259 T0: fidl::encoding::Encode<u32, D>,
1260 T1: fidl::encoding::Encode<u32, D>,
1261 T2: fidl::encoding::Encode<u32, D>,
1262 > fidl::encoding::Encode<HostVsockAcceptorAcceptRequest, D> for (T0, T1, T2)
1263 {
1264 #[inline]
1265 unsafe fn encode(
1266 self,
1267 encoder: &mut fidl::encoding::Encoder<'_, D>,
1268 offset: usize,
1269 depth: fidl::encoding::Depth,
1270 ) -> fidl::Result<()> {
1271 encoder.debug_check_bounds::<HostVsockAcceptorAcceptRequest>(offset);
1272 self.0.encode(encoder, offset + 0, depth)?;
1276 self.1.encode(encoder, offset + 4, depth)?;
1277 self.2.encode(encoder, offset + 8, depth)?;
1278 Ok(())
1279 }
1280 }
1281
1282 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1283 for HostVsockAcceptorAcceptRequest
1284 {
1285 #[inline(always)]
1286 fn new_empty() -> Self {
1287 Self {
1288 src_cid: fidl::new_empty!(u32, D),
1289 src_port: fidl::new_empty!(u32, D),
1290 port: fidl::new_empty!(u32, D),
1291 }
1292 }
1293
1294 #[inline]
1295 unsafe fn decode(
1296 &mut self,
1297 decoder: &mut fidl::encoding::Decoder<'_, D>,
1298 offset: usize,
1299 _depth: fidl::encoding::Depth,
1300 ) -> fidl::Result<()> {
1301 decoder.debug_check_bounds::<Self>(offset);
1302 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1303 unsafe {
1306 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
1307 }
1308 Ok(())
1309 }
1310 }
1311
1312 impl fidl::encoding::ValueTypeMarker for HostVsockEndpointConnectRequest {
1313 type Borrowed<'a> = &'a Self;
1314 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1315 value
1316 }
1317 }
1318
1319 unsafe impl fidl::encoding::TypeMarker for HostVsockEndpointConnectRequest {
1320 type Owned = Self;
1321
1322 #[inline(always)]
1323 fn inline_align(_context: fidl::encoding::Context) -> usize {
1324 4
1325 }
1326
1327 #[inline(always)]
1328 fn inline_size(_context: fidl::encoding::Context) -> usize {
1329 4
1330 }
1331 #[inline(always)]
1332 fn encode_is_copy() -> bool {
1333 true
1334 }
1335
1336 #[inline(always)]
1337 fn decode_is_copy() -> bool {
1338 true
1339 }
1340 }
1341
1342 unsafe impl<D: fidl::encoding::ResourceDialect>
1343 fidl::encoding::Encode<HostVsockEndpointConnectRequest, D>
1344 for &HostVsockEndpointConnectRequest
1345 {
1346 #[inline]
1347 unsafe fn encode(
1348 self,
1349 encoder: &mut fidl::encoding::Encoder<'_, D>,
1350 offset: usize,
1351 _depth: fidl::encoding::Depth,
1352 ) -> fidl::Result<()> {
1353 encoder.debug_check_bounds::<HostVsockEndpointConnectRequest>(offset);
1354 unsafe {
1355 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1357 (buf_ptr as *mut HostVsockEndpointConnectRequest)
1358 .write_unaligned((self as *const HostVsockEndpointConnectRequest).read());
1359 }
1362 Ok(())
1363 }
1364 }
1365 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1366 fidl::encoding::Encode<HostVsockEndpointConnectRequest, D> for (T0,)
1367 {
1368 #[inline]
1369 unsafe fn encode(
1370 self,
1371 encoder: &mut fidl::encoding::Encoder<'_, D>,
1372 offset: usize,
1373 depth: fidl::encoding::Depth,
1374 ) -> fidl::Result<()> {
1375 encoder.debug_check_bounds::<HostVsockEndpointConnectRequest>(offset);
1376 self.0.encode(encoder, offset + 0, depth)?;
1380 Ok(())
1381 }
1382 }
1383
1384 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1385 for HostVsockEndpointConnectRequest
1386 {
1387 #[inline(always)]
1388 fn new_empty() -> Self {
1389 Self { guest_port: fidl::new_empty!(u32, D) }
1390 }
1391
1392 #[inline]
1393 unsafe fn decode(
1394 &mut self,
1395 decoder: &mut fidl::encoding::Decoder<'_, D>,
1396 offset: usize,
1397 _depth: fidl::encoding::Depth,
1398 ) -> fidl::Result<()> {
1399 decoder.debug_check_bounds::<Self>(offset);
1400 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1401 unsafe {
1404 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1405 }
1406 Ok(())
1407 }
1408 }
1409
1410 impl fidl::encoding::ValueTypeMarker for LinuxManagerOnGuestInfoChangedRequest {
1411 type Borrowed<'a> = &'a Self;
1412 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1413 value
1414 }
1415 }
1416
1417 unsafe impl fidl::encoding::TypeMarker for LinuxManagerOnGuestInfoChangedRequest {
1418 type Owned = Self;
1419
1420 #[inline(always)]
1421 fn inline_align(_context: fidl::encoding::Context) -> usize {
1422 8
1423 }
1424
1425 #[inline(always)]
1426 fn inline_size(_context: fidl::encoding::Context) -> usize {
1427 32
1428 }
1429 }
1430
1431 unsafe impl<D: fidl::encoding::ResourceDialect>
1432 fidl::encoding::Encode<LinuxManagerOnGuestInfoChangedRequest, D>
1433 for &LinuxManagerOnGuestInfoChangedRequest
1434 {
1435 #[inline]
1436 unsafe fn encode(
1437 self,
1438 encoder: &mut fidl::encoding::Encoder<'_, D>,
1439 offset: usize,
1440 _depth: fidl::encoding::Depth,
1441 ) -> fidl::Result<()> {
1442 encoder.debug_check_bounds::<LinuxManagerOnGuestInfoChangedRequest>(offset);
1443 fidl::encoding::Encode::<LinuxManagerOnGuestInfoChangedRequest, D>::encode(
1445 (
1446 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1447 &self.label,
1448 ),
1449 <LinuxGuestInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
1450 ),
1451 encoder,
1452 offset,
1453 _depth,
1454 )
1455 }
1456 }
1457 unsafe impl<
1458 D: fidl::encoding::ResourceDialect,
1459 T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1460 T1: fidl::encoding::Encode<LinuxGuestInfo, D>,
1461 > fidl::encoding::Encode<LinuxManagerOnGuestInfoChangedRequest, D> for (T0, T1)
1462 {
1463 #[inline]
1464 unsafe fn encode(
1465 self,
1466 encoder: &mut fidl::encoding::Encoder<'_, D>,
1467 offset: usize,
1468 depth: fidl::encoding::Depth,
1469 ) -> fidl::Result<()> {
1470 encoder.debug_check_bounds::<LinuxManagerOnGuestInfoChangedRequest>(offset);
1471 self.0.encode(encoder, offset + 0, depth)?;
1475 self.1.encode(encoder, offset + 16, depth)?;
1476 Ok(())
1477 }
1478 }
1479
1480 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1481 for LinuxManagerOnGuestInfoChangedRequest
1482 {
1483 #[inline(always)]
1484 fn new_empty() -> Self {
1485 Self {
1486 label: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1487 info: fidl::new_empty!(LinuxGuestInfo, D),
1488 }
1489 }
1490
1491 #[inline]
1492 unsafe fn decode(
1493 &mut self,
1494 decoder: &mut fidl::encoding::Decoder<'_, D>,
1495 offset: usize,
1496 _depth: fidl::encoding::Depth,
1497 ) -> fidl::Result<()> {
1498 decoder.debug_check_bounds::<Self>(offset);
1499 fidl::decode!(
1501 fidl::encoding::UnboundedString,
1502 D,
1503 &mut self.label,
1504 decoder,
1505 offset + 0,
1506 _depth
1507 )?;
1508 fidl::decode!(LinuxGuestInfo, D, &mut self.info, decoder, offset + 16, _depth)?;
1509 Ok(())
1510 }
1511 }
1512
1513 impl fidl::encoding::ValueTypeMarker for LinuxManagerStartAndGetLinuxGuestInfoRequest {
1514 type Borrowed<'a> = &'a Self;
1515 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1516 value
1517 }
1518 }
1519
1520 unsafe impl fidl::encoding::TypeMarker for LinuxManagerStartAndGetLinuxGuestInfoRequest {
1521 type Owned = Self;
1522
1523 #[inline(always)]
1524 fn inline_align(_context: fidl::encoding::Context) -> usize {
1525 8
1526 }
1527
1528 #[inline(always)]
1529 fn inline_size(_context: fidl::encoding::Context) -> usize {
1530 16
1531 }
1532 }
1533
1534 unsafe impl<D: fidl::encoding::ResourceDialect>
1535 fidl::encoding::Encode<LinuxManagerStartAndGetLinuxGuestInfoRequest, D>
1536 for &LinuxManagerStartAndGetLinuxGuestInfoRequest
1537 {
1538 #[inline]
1539 unsafe fn encode(
1540 self,
1541 encoder: &mut fidl::encoding::Encoder<'_, D>,
1542 offset: usize,
1543 _depth: fidl::encoding::Depth,
1544 ) -> fidl::Result<()> {
1545 encoder.debug_check_bounds::<LinuxManagerStartAndGetLinuxGuestInfoRequest>(offset);
1546 fidl::encoding::Encode::<LinuxManagerStartAndGetLinuxGuestInfoRequest, D>::encode(
1548 (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1549 &self.label,
1550 ),),
1551 encoder,
1552 offset,
1553 _depth,
1554 )
1555 }
1556 }
1557 unsafe impl<
1558 D: fidl::encoding::ResourceDialect,
1559 T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1560 > fidl::encoding::Encode<LinuxManagerStartAndGetLinuxGuestInfoRequest, D> for (T0,)
1561 {
1562 #[inline]
1563 unsafe fn encode(
1564 self,
1565 encoder: &mut fidl::encoding::Encoder<'_, D>,
1566 offset: usize,
1567 depth: fidl::encoding::Depth,
1568 ) -> fidl::Result<()> {
1569 encoder.debug_check_bounds::<LinuxManagerStartAndGetLinuxGuestInfoRequest>(offset);
1570 self.0.encode(encoder, offset + 0, depth)?;
1574 Ok(())
1575 }
1576 }
1577
1578 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1579 for LinuxManagerStartAndGetLinuxGuestInfoRequest
1580 {
1581 #[inline(always)]
1582 fn new_empty() -> Self {
1583 Self { label: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
1584 }
1585
1586 #[inline]
1587 unsafe fn decode(
1588 &mut self,
1589 decoder: &mut fidl::encoding::Decoder<'_, D>,
1590 offset: usize,
1591 _depth: fidl::encoding::Depth,
1592 ) -> fidl::Result<()> {
1593 decoder.debug_check_bounds::<Self>(offset);
1594 fidl::decode!(
1596 fidl::encoding::UnboundedString,
1597 D,
1598 &mut self.label,
1599 decoder,
1600 offset + 0,
1601 _depth
1602 )?;
1603 Ok(())
1604 }
1605 }
1606
1607 impl fidl::encoding::ValueTypeMarker for LinuxManagerStartAndGetLinuxGuestInfoResponse {
1608 type Borrowed<'a> = &'a Self;
1609 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1610 value
1611 }
1612 }
1613
1614 unsafe impl fidl::encoding::TypeMarker for LinuxManagerStartAndGetLinuxGuestInfoResponse {
1615 type Owned = Self;
1616
1617 #[inline(always)]
1618 fn inline_align(_context: fidl::encoding::Context) -> usize {
1619 8
1620 }
1621
1622 #[inline(always)]
1623 fn inline_size(_context: fidl::encoding::Context) -> usize {
1624 16
1625 }
1626 }
1627
1628 unsafe impl<D: fidl::encoding::ResourceDialect>
1629 fidl::encoding::Encode<LinuxManagerStartAndGetLinuxGuestInfoResponse, D>
1630 for &LinuxManagerStartAndGetLinuxGuestInfoResponse
1631 {
1632 #[inline]
1633 unsafe fn encode(
1634 self,
1635 encoder: &mut fidl::encoding::Encoder<'_, D>,
1636 offset: usize,
1637 _depth: fidl::encoding::Depth,
1638 ) -> fidl::Result<()> {
1639 encoder.debug_check_bounds::<LinuxManagerStartAndGetLinuxGuestInfoResponse>(offset);
1640 fidl::encoding::Encode::<LinuxManagerStartAndGetLinuxGuestInfoResponse, D>::encode(
1642 (<LinuxGuestInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
1643 encoder,
1644 offset,
1645 _depth,
1646 )
1647 }
1648 }
1649 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<LinuxGuestInfo, D>>
1650 fidl::encoding::Encode<LinuxManagerStartAndGetLinuxGuestInfoResponse, D> for (T0,)
1651 {
1652 #[inline]
1653 unsafe fn encode(
1654 self,
1655 encoder: &mut fidl::encoding::Encoder<'_, D>,
1656 offset: usize,
1657 depth: fidl::encoding::Depth,
1658 ) -> fidl::Result<()> {
1659 encoder.debug_check_bounds::<LinuxManagerStartAndGetLinuxGuestInfoResponse>(offset);
1660 self.0.encode(encoder, offset + 0, depth)?;
1664 Ok(())
1665 }
1666 }
1667
1668 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1669 for LinuxManagerStartAndGetLinuxGuestInfoResponse
1670 {
1671 #[inline(always)]
1672 fn new_empty() -> Self {
1673 Self { info: fidl::new_empty!(LinuxGuestInfo, D) }
1674 }
1675
1676 #[inline]
1677 unsafe fn decode(
1678 &mut self,
1679 decoder: &mut fidl::encoding::Decoder<'_, D>,
1680 offset: usize,
1681 _depth: fidl::encoding::Depth,
1682 ) -> fidl::Result<()> {
1683 decoder.debug_check_bounds::<Self>(offset);
1684 fidl::decode!(LinuxGuestInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
1686 Ok(())
1687 }
1688 }
1689
1690 impl fidl::encoding::ValueTypeMarker for MagmaDevice {
1691 type Borrowed<'a> = &'a Self;
1692 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1693 value
1694 }
1695 }
1696
1697 unsafe impl fidl::encoding::TypeMarker for MagmaDevice {
1698 type Owned = Self;
1699
1700 #[inline(always)]
1701 fn inline_align(_context: fidl::encoding::Context) -> usize {
1702 8
1703 }
1704
1705 #[inline(always)]
1706 fn inline_size(_context: fidl::encoding::Context) -> usize {
1707 8
1708 }
1709 #[inline(always)]
1710 fn encode_is_copy() -> bool {
1711 true
1712 }
1713
1714 #[inline(always)]
1715 fn decode_is_copy() -> bool {
1716 true
1717 }
1718 }
1719
1720 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MagmaDevice, D>
1721 for &MagmaDevice
1722 {
1723 #[inline]
1724 unsafe fn encode(
1725 self,
1726 encoder: &mut fidl::encoding::Encoder<'_, D>,
1727 offset: usize,
1728 _depth: fidl::encoding::Depth,
1729 ) -> fidl::Result<()> {
1730 encoder.debug_check_bounds::<MagmaDevice>(offset);
1731 unsafe {
1732 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1734 (buf_ptr as *mut MagmaDevice).write_unaligned((self as *const MagmaDevice).read());
1735 }
1738 Ok(())
1739 }
1740 }
1741 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1742 fidl::encoding::Encode<MagmaDevice, D> for (T0,)
1743 {
1744 #[inline]
1745 unsafe fn encode(
1746 self,
1747 encoder: &mut fidl::encoding::Encoder<'_, D>,
1748 offset: usize,
1749 depth: fidl::encoding::Depth,
1750 ) -> fidl::Result<()> {
1751 encoder.debug_check_bounds::<MagmaDevice>(offset);
1752 self.0.encode(encoder, offset + 0, depth)?;
1756 Ok(())
1757 }
1758 }
1759
1760 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MagmaDevice {
1761 #[inline(always)]
1762 fn new_empty() -> Self {
1763 Self { memory: fidl::new_empty!(u64, D) }
1764 }
1765
1766 #[inline]
1767 unsafe fn decode(
1768 &mut self,
1769 decoder: &mut fidl::encoding::Decoder<'_, D>,
1770 offset: usize,
1771 _depth: fidl::encoding::Depth,
1772 ) -> fidl::Result<()> {
1773 decoder.debug_check_bounds::<Self>(offset);
1774 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1775 unsafe {
1778 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1779 }
1780 Ok(())
1781 }
1782 }
1783
1784 impl fidl::encoding::ValueTypeMarker for MemControllerGetMemSizeResponse {
1785 type Borrowed<'a> = &'a Self;
1786 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1787 value
1788 }
1789 }
1790
1791 unsafe impl fidl::encoding::TypeMarker for MemControllerGetMemSizeResponse {
1792 type Owned = Self;
1793
1794 #[inline(always)]
1795 fn inline_align(_context: fidl::encoding::Context) -> usize {
1796 8
1797 }
1798
1799 #[inline(always)]
1800 fn inline_size(_context: fidl::encoding::Context) -> usize {
1801 40
1802 }
1803 #[inline(always)]
1804 fn encode_is_copy() -> bool {
1805 true
1806 }
1807
1808 #[inline(always)]
1809 fn decode_is_copy() -> bool {
1810 true
1811 }
1812 }
1813
1814 unsafe impl<D: fidl::encoding::ResourceDialect>
1815 fidl::encoding::Encode<MemControllerGetMemSizeResponse, D>
1816 for &MemControllerGetMemSizeResponse
1817 {
1818 #[inline]
1819 unsafe fn encode(
1820 self,
1821 encoder: &mut fidl::encoding::Encoder<'_, D>,
1822 offset: usize,
1823 _depth: fidl::encoding::Depth,
1824 ) -> fidl::Result<()> {
1825 encoder.debug_check_bounds::<MemControllerGetMemSizeResponse>(offset);
1826 unsafe {
1827 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1829 (buf_ptr as *mut MemControllerGetMemSizeResponse)
1830 .write_unaligned((self as *const MemControllerGetMemSizeResponse).read());
1831 }
1834 Ok(())
1835 }
1836 }
1837 unsafe impl<
1838 D: fidl::encoding::ResourceDialect,
1839 T0: fidl::encoding::Encode<u64, D>,
1840 T1: fidl::encoding::Encode<u64, D>,
1841 T2: fidl::encoding::Encode<u64, D>,
1842 T3: fidl::encoding::Encode<u64, D>,
1843 T4: fidl::encoding::Encode<u64, D>,
1844 > fidl::encoding::Encode<MemControllerGetMemSizeResponse, D> for (T0, T1, T2, T3, T4)
1845 {
1846 #[inline]
1847 unsafe fn encode(
1848 self,
1849 encoder: &mut fidl::encoding::Encoder<'_, D>,
1850 offset: usize,
1851 depth: fidl::encoding::Depth,
1852 ) -> fidl::Result<()> {
1853 encoder.debug_check_bounds::<MemControllerGetMemSizeResponse>(offset);
1854 self.0.encode(encoder, offset + 0, depth)?;
1858 self.1.encode(encoder, offset + 8, depth)?;
1859 self.2.encode(encoder, offset + 16, depth)?;
1860 self.3.encode(encoder, offset + 24, depth)?;
1861 self.4.encode(encoder, offset + 32, depth)?;
1862 Ok(())
1863 }
1864 }
1865
1866 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1867 for MemControllerGetMemSizeResponse
1868 {
1869 #[inline(always)]
1870 fn new_empty() -> Self {
1871 Self {
1872 block_size: fidl::new_empty!(u64, D),
1873 region_size: fidl::new_empty!(u64, D),
1874 usable_region_size: fidl::new_empty!(u64, D),
1875 plugged_size: fidl::new_empty!(u64, D),
1876 requested_size: fidl::new_empty!(u64, D),
1877 }
1878 }
1879
1880 #[inline]
1881 unsafe fn decode(
1882 &mut self,
1883 decoder: &mut fidl::encoding::Decoder<'_, D>,
1884 offset: usize,
1885 _depth: fidl::encoding::Depth,
1886 ) -> fidl::Result<()> {
1887 decoder.debug_check_bounds::<Self>(offset);
1888 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1889 unsafe {
1892 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 40);
1893 }
1894 Ok(())
1895 }
1896 }
1897
1898 impl fidl::encoding::ValueTypeMarker for MemControllerRequestSizeRequest {
1899 type Borrowed<'a> = &'a Self;
1900 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1901 value
1902 }
1903 }
1904
1905 unsafe impl fidl::encoding::TypeMarker for MemControllerRequestSizeRequest {
1906 type Owned = Self;
1907
1908 #[inline(always)]
1909 fn inline_align(_context: fidl::encoding::Context) -> usize {
1910 8
1911 }
1912
1913 #[inline(always)]
1914 fn inline_size(_context: fidl::encoding::Context) -> usize {
1915 8
1916 }
1917 #[inline(always)]
1918 fn encode_is_copy() -> bool {
1919 true
1920 }
1921
1922 #[inline(always)]
1923 fn decode_is_copy() -> bool {
1924 true
1925 }
1926 }
1927
1928 unsafe impl<D: fidl::encoding::ResourceDialect>
1929 fidl::encoding::Encode<MemControllerRequestSizeRequest, D>
1930 for &MemControllerRequestSizeRequest
1931 {
1932 #[inline]
1933 unsafe fn encode(
1934 self,
1935 encoder: &mut fidl::encoding::Encoder<'_, D>,
1936 offset: usize,
1937 _depth: fidl::encoding::Depth,
1938 ) -> fidl::Result<()> {
1939 encoder.debug_check_bounds::<MemControllerRequestSizeRequest>(offset);
1940 unsafe {
1941 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1943 (buf_ptr as *mut MemControllerRequestSizeRequest)
1944 .write_unaligned((self as *const MemControllerRequestSizeRequest).read());
1945 }
1948 Ok(())
1949 }
1950 }
1951 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1952 fidl::encoding::Encode<MemControllerRequestSizeRequest, D> for (T0,)
1953 {
1954 #[inline]
1955 unsafe fn encode(
1956 self,
1957 encoder: &mut fidl::encoding::Encoder<'_, D>,
1958 offset: usize,
1959 depth: fidl::encoding::Depth,
1960 ) -> fidl::Result<()> {
1961 encoder.debug_check_bounds::<MemControllerRequestSizeRequest>(offset);
1962 self.0.encode(encoder, offset + 0, depth)?;
1966 Ok(())
1967 }
1968 }
1969
1970 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1971 for MemControllerRequestSizeRequest
1972 {
1973 #[inline(always)]
1974 fn new_empty() -> Self {
1975 Self { requested_size: fidl::new_empty!(u64, D) }
1976 }
1977
1978 #[inline]
1979 unsafe fn decode(
1980 &mut self,
1981 decoder: &mut fidl::encoding::Decoder<'_, D>,
1982 offset: usize,
1983 _depth: fidl::encoding::Depth,
1984 ) -> fidl::Result<()> {
1985 decoder.debug_check_bounds::<Self>(offset);
1986 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1987 unsafe {
1990 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1991 }
1992 Ok(())
1993 }
1994 }
1995
1996 impl fidl::encoding::ValueTypeMarker for MemStat {
1997 type Borrowed<'a> = &'a Self;
1998 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1999 value
2000 }
2001 }
2002
2003 unsafe impl fidl::encoding::TypeMarker for MemStat {
2004 type Owned = Self;
2005
2006 #[inline(always)]
2007 fn inline_align(_context: fidl::encoding::Context) -> usize {
2008 8
2009 }
2010
2011 #[inline(always)]
2012 fn inline_size(_context: fidl::encoding::Context) -> usize {
2013 16
2014 }
2015 }
2016
2017 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MemStat, D> for &MemStat {
2018 #[inline]
2019 unsafe fn encode(
2020 self,
2021 encoder: &mut fidl::encoding::Encoder<'_, D>,
2022 offset: usize,
2023 _depth: fidl::encoding::Depth,
2024 ) -> fidl::Result<()> {
2025 encoder.debug_check_bounds::<MemStat>(offset);
2026 unsafe {
2027 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2029 (buf_ptr as *mut MemStat).write_unaligned((self as *const MemStat).read());
2030 let padding_ptr = buf_ptr.offset(0) as *mut u64;
2033 let padding_mask = 0xffffffffffff0000u64;
2034 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
2035 }
2036 Ok(())
2037 }
2038 }
2039 unsafe impl<
2040 D: fidl::encoding::ResourceDialect,
2041 T0: fidl::encoding::Encode<u16, D>,
2042 T1: fidl::encoding::Encode<u64, D>,
2043 > fidl::encoding::Encode<MemStat, D> for (T0, T1)
2044 {
2045 #[inline]
2046 unsafe fn encode(
2047 self,
2048 encoder: &mut fidl::encoding::Encoder<'_, D>,
2049 offset: usize,
2050 depth: fidl::encoding::Depth,
2051 ) -> fidl::Result<()> {
2052 encoder.debug_check_bounds::<MemStat>(offset);
2053 unsafe {
2056 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2057 (ptr as *mut u64).write_unaligned(0);
2058 }
2059 self.0.encode(encoder, offset + 0, depth)?;
2061 self.1.encode(encoder, offset + 8, depth)?;
2062 Ok(())
2063 }
2064 }
2065
2066 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MemStat {
2067 #[inline(always)]
2068 fn new_empty() -> Self {
2069 Self { tag: fidl::new_empty!(u16, D), val: fidl::new_empty!(u64, D) }
2070 }
2071
2072 #[inline]
2073 unsafe fn decode(
2074 &mut self,
2075 decoder: &mut fidl::encoding::Decoder<'_, D>,
2076 offset: usize,
2077 _depth: fidl::encoding::Depth,
2078 ) -> fidl::Result<()> {
2079 decoder.debug_check_bounds::<Self>(offset);
2080 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2081 let ptr = unsafe { buf_ptr.offset(0) };
2083 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2084 let mask = 0xffffffffffff0000u64;
2085 let maskedval = padval & mask;
2086 if maskedval != 0 {
2087 return Err(fidl::Error::NonZeroPadding {
2088 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2089 });
2090 }
2091 unsafe {
2093 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2094 }
2095 Ok(())
2096 }
2097 }
2098
2099 impl fidl::encoding::ValueTypeMarker for NetSpec {
2100 type Borrowed<'a> = &'a Self;
2101 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2102 value
2103 }
2104 }
2105
2106 unsafe impl fidl::encoding::TypeMarker for NetSpec {
2107 type Owned = Self;
2108
2109 #[inline(always)]
2110 fn inline_align(_context: fidl::encoding::Context) -> usize {
2111 1
2112 }
2113
2114 #[inline(always)]
2115 fn inline_size(_context: fidl::encoding::Context) -> usize {
2116 7
2117 }
2118 }
2119
2120 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetSpec, D> for &NetSpec {
2121 #[inline]
2122 unsafe fn encode(
2123 self,
2124 encoder: &mut fidl::encoding::Encoder<'_, D>,
2125 offset: usize,
2126 _depth: fidl::encoding::Depth,
2127 ) -> fidl::Result<()> {
2128 encoder.debug_check_bounds::<NetSpec>(offset);
2129 fidl::encoding::Encode::<NetSpec, D>::encode(
2131 (
2132 <fidl_fuchsia_net::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(
2133 &self.mac_address,
2134 ),
2135 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_bridge),
2136 ),
2137 encoder,
2138 offset,
2139 _depth,
2140 )
2141 }
2142 }
2143 unsafe impl<
2144 D: fidl::encoding::ResourceDialect,
2145 T0: fidl::encoding::Encode<fidl_fuchsia_net::MacAddress, D>,
2146 T1: fidl::encoding::Encode<bool, D>,
2147 > fidl::encoding::Encode<NetSpec, D> for (T0, T1)
2148 {
2149 #[inline]
2150 unsafe fn encode(
2151 self,
2152 encoder: &mut fidl::encoding::Encoder<'_, D>,
2153 offset: usize,
2154 depth: fidl::encoding::Depth,
2155 ) -> fidl::Result<()> {
2156 encoder.debug_check_bounds::<NetSpec>(offset);
2157 self.0.encode(encoder, offset + 0, depth)?;
2161 self.1.encode(encoder, offset + 6, depth)?;
2162 Ok(())
2163 }
2164 }
2165
2166 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetSpec {
2167 #[inline(always)]
2168 fn new_empty() -> Self {
2169 Self {
2170 mac_address: fidl::new_empty!(fidl_fuchsia_net::MacAddress, D),
2171 enable_bridge: fidl::new_empty!(bool, D),
2172 }
2173 }
2174
2175 #[inline]
2176 unsafe fn decode(
2177 &mut self,
2178 decoder: &mut fidl::encoding::Decoder<'_, D>,
2179 offset: usize,
2180 _depth: fidl::encoding::Depth,
2181 ) -> fidl::Result<()> {
2182 decoder.debug_check_bounds::<Self>(offset);
2183 fidl::decode!(
2185 fidl_fuchsia_net::MacAddress,
2186 D,
2187 &mut self.mac_address,
2188 decoder,
2189 offset + 0,
2190 _depth
2191 )?;
2192 fidl::decode!(bool, D, &mut self.enable_bridge, decoder, offset + 6, _depth)?;
2193 Ok(())
2194 }
2195 }
2196
2197 impl GuestDescriptor {
2198 #[inline(always)]
2199 fn max_ordinal_present(&self) -> u64 {
2200 if let Some(_) = self.mem {
2201 return 12;
2202 }
2203 if let Some(_) = self.networks {
2204 return 11;
2205 }
2206 if let Some(_) = self.sound {
2207 return 10;
2208 }
2209 if let Some(_) = self.vsock {
2210 return 9;
2211 }
2212 if let Some(_) = self.rng {
2213 return 8;
2214 }
2215 if let Some(_) = self.gpu {
2216 return 7;
2217 }
2218 if let Some(_) = self.console {
2219 return 6;
2220 }
2221 if let Some(_) = self.balloon {
2222 return 5;
2223 }
2224 if let Some(_) = self.magma {
2225 return 4;
2226 }
2227 if let Some(_) = self.wayland {
2228 return 3;
2229 }
2230 if let Some(_) = self.guest_memory {
2231 return 2;
2232 }
2233 if let Some(_) = self.num_cpus {
2234 return 1;
2235 }
2236 0
2237 }
2238 }
2239
2240 impl fidl::encoding::ValueTypeMarker for GuestDescriptor {
2241 type Borrowed<'a> = &'a Self;
2242 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2243 value
2244 }
2245 }
2246
2247 unsafe impl fidl::encoding::TypeMarker for GuestDescriptor {
2248 type Owned = Self;
2249
2250 #[inline(always)]
2251 fn inline_align(_context: fidl::encoding::Context) -> usize {
2252 8
2253 }
2254
2255 #[inline(always)]
2256 fn inline_size(_context: fidl::encoding::Context) -> usize {
2257 16
2258 }
2259 }
2260
2261 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<GuestDescriptor, D>
2262 for &GuestDescriptor
2263 {
2264 unsafe fn encode(
2265 self,
2266 encoder: &mut fidl::encoding::Encoder<'_, D>,
2267 offset: usize,
2268 mut depth: fidl::encoding::Depth,
2269 ) -> fidl::Result<()> {
2270 encoder.debug_check_bounds::<GuestDescriptor>(offset);
2271 let max_ordinal: u64 = self.max_ordinal_present();
2273 encoder.write_num(max_ordinal, offset);
2274 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2275 if max_ordinal == 0 {
2277 return Ok(());
2278 }
2279 depth.increment()?;
2280 let envelope_size = 8;
2281 let bytes_len = max_ordinal as usize * envelope_size;
2282 #[allow(unused_variables)]
2283 let offset = encoder.out_of_line_offset(bytes_len);
2284 let mut _prev_end_offset: usize = 0;
2285 if 1 > max_ordinal {
2286 return Ok(());
2287 }
2288
2289 let cur_offset: usize = (1 - 1) * envelope_size;
2292
2293 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2295
2296 fidl::encoding::encode_in_envelope_optional::<u8, D>(
2301 self.num_cpus.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
2302 encoder,
2303 offset + cur_offset,
2304 depth,
2305 )?;
2306
2307 _prev_end_offset = cur_offset + envelope_size;
2308 if 2 > max_ordinal {
2309 return Ok(());
2310 }
2311
2312 let cur_offset: usize = (2 - 1) * envelope_size;
2315
2316 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2318
2319 fidl::encoding::encode_in_envelope_optional::<u64, D>(
2324 self.guest_memory.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2325 encoder,
2326 offset + cur_offset,
2327 depth,
2328 )?;
2329
2330 _prev_end_offset = cur_offset + envelope_size;
2331 if 3 > max_ordinal {
2332 return Ok(());
2333 }
2334
2335 let cur_offset: usize = (3 - 1) * envelope_size;
2338
2339 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2341
2342 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2347 self.wayland.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2348 encoder,
2349 offset + cur_offset,
2350 depth,
2351 )?;
2352
2353 _prev_end_offset = cur_offset + envelope_size;
2354 if 4 > max_ordinal {
2355 return Ok(());
2356 }
2357
2358 let cur_offset: usize = (4 - 1) * envelope_size;
2361
2362 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2364
2365 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2370 self.magma.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2371 encoder,
2372 offset + cur_offset,
2373 depth,
2374 )?;
2375
2376 _prev_end_offset = cur_offset + envelope_size;
2377 if 5 > max_ordinal {
2378 return Ok(());
2379 }
2380
2381 let cur_offset: usize = (5 - 1) * envelope_size;
2384
2385 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2387
2388 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2393 self.balloon.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2394 encoder,
2395 offset + cur_offset,
2396 depth,
2397 )?;
2398
2399 _prev_end_offset = cur_offset + envelope_size;
2400 if 6 > max_ordinal {
2401 return Ok(());
2402 }
2403
2404 let cur_offset: usize = (6 - 1) * envelope_size;
2407
2408 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2410
2411 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2416 self.console.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2417 encoder,
2418 offset + cur_offset,
2419 depth,
2420 )?;
2421
2422 _prev_end_offset = cur_offset + envelope_size;
2423 if 7 > max_ordinal {
2424 return Ok(());
2425 }
2426
2427 let cur_offset: usize = (7 - 1) * envelope_size;
2430
2431 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2433
2434 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2439 self.gpu.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2440 encoder,
2441 offset + cur_offset,
2442 depth,
2443 )?;
2444
2445 _prev_end_offset = cur_offset + envelope_size;
2446 if 8 > max_ordinal {
2447 return Ok(());
2448 }
2449
2450 let cur_offset: usize = (8 - 1) * envelope_size;
2453
2454 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2456
2457 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2462 self.rng.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2463 encoder,
2464 offset + cur_offset,
2465 depth,
2466 )?;
2467
2468 _prev_end_offset = cur_offset + envelope_size;
2469 if 9 > max_ordinal {
2470 return Ok(());
2471 }
2472
2473 let cur_offset: usize = (9 - 1) * envelope_size;
2476
2477 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2479
2480 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2485 self.vsock.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2486 encoder,
2487 offset + cur_offset,
2488 depth,
2489 )?;
2490
2491 _prev_end_offset = cur_offset + envelope_size;
2492 if 10 > max_ordinal {
2493 return Ok(());
2494 }
2495
2496 let cur_offset: usize = (10 - 1) * envelope_size;
2499
2500 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2502
2503 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2508 self.sound.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2509 encoder,
2510 offset + cur_offset,
2511 depth,
2512 )?;
2513
2514 _prev_end_offset = cur_offset + envelope_size;
2515 if 11 > max_ordinal {
2516 return Ok(());
2517 }
2518
2519 let cur_offset: usize = (11 - 1) * envelope_size;
2522
2523 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2525
2526 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NetSpec, 32>, D>(
2531 self.networks.as_ref().map(<fidl::encoding::Vector<NetSpec, 32> as fidl::encoding::ValueTypeMarker>::borrow),
2532 encoder, offset + cur_offset, depth
2533 )?;
2534
2535 _prev_end_offset = cur_offset + envelope_size;
2536 if 12 > max_ordinal {
2537 return Ok(());
2538 }
2539
2540 let cur_offset: usize = (12 - 1) * envelope_size;
2543
2544 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2546
2547 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2552 self.mem.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2553 encoder,
2554 offset + cur_offset,
2555 depth,
2556 )?;
2557
2558 _prev_end_offset = cur_offset + envelope_size;
2559
2560 Ok(())
2561 }
2562 }
2563
2564 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GuestDescriptor {
2565 #[inline(always)]
2566 fn new_empty() -> Self {
2567 Self::default()
2568 }
2569
2570 unsafe fn decode(
2571 &mut self,
2572 decoder: &mut fidl::encoding::Decoder<'_, D>,
2573 offset: usize,
2574 mut depth: fidl::encoding::Depth,
2575 ) -> fidl::Result<()> {
2576 decoder.debug_check_bounds::<Self>(offset);
2577 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2578 None => return Err(fidl::Error::NotNullable),
2579 Some(len) => len,
2580 };
2581 if len == 0 {
2583 return Ok(());
2584 };
2585 depth.increment()?;
2586 let envelope_size = 8;
2587 let bytes_len = len * envelope_size;
2588 let offset = decoder.out_of_line_offset(bytes_len)?;
2589 let mut _next_ordinal_to_read = 0;
2591 let mut next_offset = offset;
2592 let end_offset = offset + bytes_len;
2593 _next_ordinal_to_read += 1;
2594 if next_offset >= end_offset {
2595 return Ok(());
2596 }
2597
2598 while _next_ordinal_to_read < 1 {
2600 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2601 _next_ordinal_to_read += 1;
2602 next_offset += envelope_size;
2603 }
2604
2605 let next_out_of_line = decoder.next_out_of_line();
2606 let handles_before = decoder.remaining_handles();
2607 if let Some((inlined, num_bytes, num_handles)) =
2608 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2609 {
2610 let member_inline_size =
2611 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2612 if inlined != (member_inline_size <= 4) {
2613 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2614 }
2615 let inner_offset;
2616 let mut inner_depth = depth.clone();
2617 if inlined {
2618 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2619 inner_offset = next_offset;
2620 } else {
2621 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2622 inner_depth.increment()?;
2623 }
2624 let val_ref = self.num_cpus.get_or_insert_with(|| fidl::new_empty!(u8, D));
2625 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
2626 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2627 {
2628 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2629 }
2630 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2631 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2632 }
2633 }
2634
2635 next_offset += envelope_size;
2636 _next_ordinal_to_read += 1;
2637 if next_offset >= end_offset {
2638 return Ok(());
2639 }
2640
2641 while _next_ordinal_to_read < 2 {
2643 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2644 _next_ordinal_to_read += 1;
2645 next_offset += envelope_size;
2646 }
2647
2648 let next_out_of_line = decoder.next_out_of_line();
2649 let handles_before = decoder.remaining_handles();
2650 if let Some((inlined, num_bytes, num_handles)) =
2651 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2652 {
2653 let member_inline_size =
2654 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2655 if inlined != (member_inline_size <= 4) {
2656 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2657 }
2658 let inner_offset;
2659 let mut inner_depth = depth.clone();
2660 if inlined {
2661 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2662 inner_offset = next_offset;
2663 } else {
2664 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2665 inner_depth.increment()?;
2666 }
2667 let val_ref = self.guest_memory.get_or_insert_with(|| fidl::new_empty!(u64, D));
2668 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2669 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2670 {
2671 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2672 }
2673 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2674 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2675 }
2676 }
2677
2678 next_offset += envelope_size;
2679 _next_ordinal_to_read += 1;
2680 if next_offset >= end_offset {
2681 return Ok(());
2682 }
2683
2684 while _next_ordinal_to_read < 3 {
2686 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2687 _next_ordinal_to_read += 1;
2688 next_offset += envelope_size;
2689 }
2690
2691 let next_out_of_line = decoder.next_out_of_line();
2692 let handles_before = decoder.remaining_handles();
2693 if let Some((inlined, num_bytes, num_handles)) =
2694 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2695 {
2696 let member_inline_size =
2697 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2698 if inlined != (member_inline_size <= 4) {
2699 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2700 }
2701 let inner_offset;
2702 let mut inner_depth = depth.clone();
2703 if inlined {
2704 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2705 inner_offset = next_offset;
2706 } else {
2707 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2708 inner_depth.increment()?;
2709 }
2710 let val_ref = self.wayland.get_or_insert_with(|| fidl::new_empty!(bool, D));
2711 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2712 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2713 {
2714 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2715 }
2716 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2717 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2718 }
2719 }
2720
2721 next_offset += envelope_size;
2722 _next_ordinal_to_read += 1;
2723 if next_offset >= end_offset {
2724 return Ok(());
2725 }
2726
2727 while _next_ordinal_to_read < 4 {
2729 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2730 _next_ordinal_to_read += 1;
2731 next_offset += envelope_size;
2732 }
2733
2734 let next_out_of_line = decoder.next_out_of_line();
2735 let handles_before = decoder.remaining_handles();
2736 if let Some((inlined, num_bytes, num_handles)) =
2737 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2738 {
2739 let member_inline_size =
2740 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2741 if inlined != (member_inline_size <= 4) {
2742 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2743 }
2744 let inner_offset;
2745 let mut inner_depth = depth.clone();
2746 if inlined {
2747 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2748 inner_offset = next_offset;
2749 } else {
2750 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2751 inner_depth.increment()?;
2752 }
2753 let val_ref = self.magma.get_or_insert_with(|| fidl::new_empty!(bool, D));
2754 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2755 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2756 {
2757 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2758 }
2759 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2760 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2761 }
2762 }
2763
2764 next_offset += envelope_size;
2765 _next_ordinal_to_read += 1;
2766 if next_offset >= end_offset {
2767 return Ok(());
2768 }
2769
2770 while _next_ordinal_to_read < 5 {
2772 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2773 _next_ordinal_to_read += 1;
2774 next_offset += envelope_size;
2775 }
2776
2777 let next_out_of_line = decoder.next_out_of_line();
2778 let handles_before = decoder.remaining_handles();
2779 if let Some((inlined, num_bytes, num_handles)) =
2780 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2781 {
2782 let member_inline_size =
2783 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2784 if inlined != (member_inline_size <= 4) {
2785 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2786 }
2787 let inner_offset;
2788 let mut inner_depth = depth.clone();
2789 if inlined {
2790 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2791 inner_offset = next_offset;
2792 } else {
2793 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2794 inner_depth.increment()?;
2795 }
2796 let val_ref = self.balloon.get_or_insert_with(|| fidl::new_empty!(bool, D));
2797 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2798 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2799 {
2800 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2801 }
2802 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2803 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2804 }
2805 }
2806
2807 next_offset += envelope_size;
2808 _next_ordinal_to_read += 1;
2809 if next_offset >= end_offset {
2810 return Ok(());
2811 }
2812
2813 while _next_ordinal_to_read < 6 {
2815 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2816 _next_ordinal_to_read += 1;
2817 next_offset += envelope_size;
2818 }
2819
2820 let next_out_of_line = decoder.next_out_of_line();
2821 let handles_before = decoder.remaining_handles();
2822 if let Some((inlined, num_bytes, num_handles)) =
2823 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2824 {
2825 let member_inline_size =
2826 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2827 if inlined != (member_inline_size <= 4) {
2828 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2829 }
2830 let inner_offset;
2831 let mut inner_depth = depth.clone();
2832 if inlined {
2833 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2834 inner_offset = next_offset;
2835 } else {
2836 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2837 inner_depth.increment()?;
2838 }
2839 let val_ref = self.console.get_or_insert_with(|| fidl::new_empty!(bool, D));
2840 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2841 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2842 {
2843 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2844 }
2845 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2846 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2847 }
2848 }
2849
2850 next_offset += envelope_size;
2851 _next_ordinal_to_read += 1;
2852 if next_offset >= end_offset {
2853 return Ok(());
2854 }
2855
2856 while _next_ordinal_to_read < 7 {
2858 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2859 _next_ordinal_to_read += 1;
2860 next_offset += envelope_size;
2861 }
2862
2863 let next_out_of_line = decoder.next_out_of_line();
2864 let handles_before = decoder.remaining_handles();
2865 if let Some((inlined, num_bytes, num_handles)) =
2866 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2867 {
2868 let member_inline_size =
2869 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2870 if inlined != (member_inline_size <= 4) {
2871 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2872 }
2873 let inner_offset;
2874 let mut inner_depth = depth.clone();
2875 if inlined {
2876 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2877 inner_offset = next_offset;
2878 } else {
2879 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2880 inner_depth.increment()?;
2881 }
2882 let val_ref = self.gpu.get_or_insert_with(|| fidl::new_empty!(bool, D));
2883 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2884 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2885 {
2886 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2887 }
2888 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2889 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2890 }
2891 }
2892
2893 next_offset += envelope_size;
2894 _next_ordinal_to_read += 1;
2895 if next_offset >= end_offset {
2896 return Ok(());
2897 }
2898
2899 while _next_ordinal_to_read < 8 {
2901 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2902 _next_ordinal_to_read += 1;
2903 next_offset += envelope_size;
2904 }
2905
2906 let next_out_of_line = decoder.next_out_of_line();
2907 let handles_before = decoder.remaining_handles();
2908 if let Some((inlined, num_bytes, num_handles)) =
2909 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2910 {
2911 let member_inline_size =
2912 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2913 if inlined != (member_inline_size <= 4) {
2914 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2915 }
2916 let inner_offset;
2917 let mut inner_depth = depth.clone();
2918 if inlined {
2919 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2920 inner_offset = next_offset;
2921 } else {
2922 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2923 inner_depth.increment()?;
2924 }
2925 let val_ref = self.rng.get_or_insert_with(|| fidl::new_empty!(bool, D));
2926 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2927 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2928 {
2929 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2930 }
2931 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2932 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2933 }
2934 }
2935
2936 next_offset += envelope_size;
2937 _next_ordinal_to_read += 1;
2938 if next_offset >= end_offset {
2939 return Ok(());
2940 }
2941
2942 while _next_ordinal_to_read < 9 {
2944 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2945 _next_ordinal_to_read += 1;
2946 next_offset += envelope_size;
2947 }
2948
2949 let next_out_of_line = decoder.next_out_of_line();
2950 let handles_before = decoder.remaining_handles();
2951 if let Some((inlined, num_bytes, num_handles)) =
2952 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2953 {
2954 let member_inline_size =
2955 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2956 if inlined != (member_inline_size <= 4) {
2957 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2958 }
2959 let inner_offset;
2960 let mut inner_depth = depth.clone();
2961 if inlined {
2962 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2963 inner_offset = next_offset;
2964 } else {
2965 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2966 inner_depth.increment()?;
2967 }
2968 let val_ref = self.vsock.get_or_insert_with(|| fidl::new_empty!(bool, D));
2969 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2970 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2971 {
2972 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2973 }
2974 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2975 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2976 }
2977 }
2978
2979 next_offset += envelope_size;
2980 _next_ordinal_to_read += 1;
2981 if next_offset >= end_offset {
2982 return Ok(());
2983 }
2984
2985 while _next_ordinal_to_read < 10 {
2987 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2988 _next_ordinal_to_read += 1;
2989 next_offset += envelope_size;
2990 }
2991
2992 let next_out_of_line = decoder.next_out_of_line();
2993 let handles_before = decoder.remaining_handles();
2994 if let Some((inlined, num_bytes, num_handles)) =
2995 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2996 {
2997 let member_inline_size =
2998 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2999 if inlined != (member_inline_size <= 4) {
3000 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3001 }
3002 let inner_offset;
3003 let mut inner_depth = depth.clone();
3004 if inlined {
3005 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3006 inner_offset = next_offset;
3007 } else {
3008 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3009 inner_depth.increment()?;
3010 }
3011 let val_ref = self.sound.get_or_insert_with(|| fidl::new_empty!(bool, D));
3012 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3013 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3014 {
3015 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3016 }
3017 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3018 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3019 }
3020 }
3021
3022 next_offset += envelope_size;
3023 _next_ordinal_to_read += 1;
3024 if next_offset >= end_offset {
3025 return Ok(());
3026 }
3027
3028 while _next_ordinal_to_read < 11 {
3030 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3031 _next_ordinal_to_read += 1;
3032 next_offset += envelope_size;
3033 }
3034
3035 let next_out_of_line = decoder.next_out_of_line();
3036 let handles_before = decoder.remaining_handles();
3037 if let Some((inlined, num_bytes, num_handles)) =
3038 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3039 {
3040 let member_inline_size = <fidl::encoding::Vector<NetSpec, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3041 if inlined != (member_inline_size <= 4) {
3042 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3043 }
3044 let inner_offset;
3045 let mut inner_depth = depth.clone();
3046 if inlined {
3047 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3048 inner_offset = next_offset;
3049 } else {
3050 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3051 inner_depth.increment()?;
3052 }
3053 let val_ref = self.networks.get_or_insert_with(
3054 || fidl::new_empty!(fidl::encoding::Vector<NetSpec, 32>, D),
3055 );
3056 fidl::decode!(fidl::encoding::Vector<NetSpec, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
3057 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3058 {
3059 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3060 }
3061 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3062 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3063 }
3064 }
3065
3066 next_offset += envelope_size;
3067 _next_ordinal_to_read += 1;
3068 if next_offset >= end_offset {
3069 return Ok(());
3070 }
3071
3072 while _next_ordinal_to_read < 12 {
3074 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3075 _next_ordinal_to_read += 1;
3076 next_offset += envelope_size;
3077 }
3078
3079 let next_out_of_line = decoder.next_out_of_line();
3080 let handles_before = decoder.remaining_handles();
3081 if let Some((inlined, num_bytes, num_handles)) =
3082 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3083 {
3084 let member_inline_size =
3085 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3086 if inlined != (member_inline_size <= 4) {
3087 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3088 }
3089 let inner_offset;
3090 let mut inner_depth = depth.clone();
3091 if inlined {
3092 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3093 inner_offset = next_offset;
3094 } else {
3095 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3096 inner_depth.increment()?;
3097 }
3098 let val_ref = self.mem.get_or_insert_with(|| fidl::new_empty!(bool, D));
3099 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3100 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3101 {
3102 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3103 }
3104 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3105 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3106 }
3107 }
3108
3109 next_offset += envelope_size;
3110
3111 while next_offset < end_offset {
3113 _next_ordinal_to_read += 1;
3114 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3115 next_offset += envelope_size;
3116 }
3117
3118 Ok(())
3119 }
3120 }
3121
3122 impl GuestInfo {
3123 #[inline(always)]
3124 fn max_ordinal_present(&self) -> u64 {
3125 if let Some(_) = self.detected_problems {
3126 return 5;
3127 }
3128 if let Some(_) = self.stop_error {
3129 return 4;
3130 }
3131 if let Some(_) = self.guest_descriptor {
3132 return 3;
3133 }
3134 if let Some(_) = self.uptime {
3135 return 2;
3136 }
3137 if let Some(_) = self.guest_status {
3138 return 1;
3139 }
3140 0
3141 }
3142 }
3143
3144 impl fidl::encoding::ValueTypeMarker for GuestInfo {
3145 type Borrowed<'a> = &'a Self;
3146 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3147 value
3148 }
3149 }
3150
3151 unsafe impl fidl::encoding::TypeMarker for GuestInfo {
3152 type Owned = Self;
3153
3154 #[inline(always)]
3155 fn inline_align(_context: fidl::encoding::Context) -> usize {
3156 8
3157 }
3158
3159 #[inline(always)]
3160 fn inline_size(_context: fidl::encoding::Context) -> usize {
3161 16
3162 }
3163 }
3164
3165 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<GuestInfo, D>
3166 for &GuestInfo
3167 {
3168 unsafe fn encode(
3169 self,
3170 encoder: &mut fidl::encoding::Encoder<'_, D>,
3171 offset: usize,
3172 mut depth: fidl::encoding::Depth,
3173 ) -> fidl::Result<()> {
3174 encoder.debug_check_bounds::<GuestInfo>(offset);
3175 let max_ordinal: u64 = self.max_ordinal_present();
3177 encoder.write_num(max_ordinal, offset);
3178 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3179 if max_ordinal == 0 {
3181 return Ok(());
3182 }
3183 depth.increment()?;
3184 let envelope_size = 8;
3185 let bytes_len = max_ordinal as usize * envelope_size;
3186 #[allow(unused_variables)]
3187 let offset = encoder.out_of_line_offset(bytes_len);
3188 let mut _prev_end_offset: usize = 0;
3189 if 1 > max_ordinal {
3190 return Ok(());
3191 }
3192
3193 let cur_offset: usize = (1 - 1) * envelope_size;
3196
3197 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3199
3200 fidl::encoding::encode_in_envelope_optional::<GuestStatus, D>(
3205 self.guest_status
3206 .as_ref()
3207 .map(<GuestStatus as fidl::encoding::ValueTypeMarker>::borrow),
3208 encoder,
3209 offset + cur_offset,
3210 depth,
3211 )?;
3212
3213 _prev_end_offset = cur_offset + envelope_size;
3214 if 2 > max_ordinal {
3215 return Ok(());
3216 }
3217
3218 let cur_offset: usize = (2 - 1) * envelope_size;
3221
3222 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3224
3225 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3230 self.uptime.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3231 encoder,
3232 offset + cur_offset,
3233 depth,
3234 )?;
3235
3236 _prev_end_offset = cur_offset + envelope_size;
3237 if 3 > max_ordinal {
3238 return Ok(());
3239 }
3240
3241 let cur_offset: usize = (3 - 1) * envelope_size;
3244
3245 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3247
3248 fidl::encoding::encode_in_envelope_optional::<GuestDescriptor, D>(
3253 self.guest_descriptor
3254 .as_ref()
3255 .map(<GuestDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
3256 encoder,
3257 offset + cur_offset,
3258 depth,
3259 )?;
3260
3261 _prev_end_offset = cur_offset + envelope_size;
3262 if 4 > max_ordinal {
3263 return Ok(());
3264 }
3265
3266 let cur_offset: usize = (4 - 1) * envelope_size;
3269
3270 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3272
3273 fidl::encoding::encode_in_envelope_optional::<GuestError, D>(
3278 self.stop_error
3279 .as_ref()
3280 .map(<GuestError as fidl::encoding::ValueTypeMarker>::borrow),
3281 encoder,
3282 offset + cur_offset,
3283 depth,
3284 )?;
3285
3286 _prev_end_offset = cur_offset + envelope_size;
3287 if 5 > max_ordinal {
3288 return Ok(());
3289 }
3290
3291 let cur_offset: usize = (5 - 1) * envelope_size;
3294
3295 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3297
3298 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::UnboundedString, 8>, D>(
3303 self.detected_problems.as_ref().map(<fidl::encoding::Vector<fidl::encoding::UnboundedString, 8> as fidl::encoding::ValueTypeMarker>::borrow),
3304 encoder, offset + cur_offset, depth
3305 )?;
3306
3307 _prev_end_offset = cur_offset + envelope_size;
3308
3309 Ok(())
3310 }
3311 }
3312
3313 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GuestInfo {
3314 #[inline(always)]
3315 fn new_empty() -> Self {
3316 Self::default()
3317 }
3318
3319 unsafe fn decode(
3320 &mut self,
3321 decoder: &mut fidl::encoding::Decoder<'_, D>,
3322 offset: usize,
3323 mut depth: fidl::encoding::Depth,
3324 ) -> fidl::Result<()> {
3325 decoder.debug_check_bounds::<Self>(offset);
3326 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3327 None => return Err(fidl::Error::NotNullable),
3328 Some(len) => len,
3329 };
3330 if len == 0 {
3332 return Ok(());
3333 };
3334 depth.increment()?;
3335 let envelope_size = 8;
3336 let bytes_len = len * envelope_size;
3337 let offset = decoder.out_of_line_offset(bytes_len)?;
3338 let mut _next_ordinal_to_read = 0;
3340 let mut next_offset = offset;
3341 let end_offset = offset + bytes_len;
3342 _next_ordinal_to_read += 1;
3343 if next_offset >= end_offset {
3344 return Ok(());
3345 }
3346
3347 while _next_ordinal_to_read < 1 {
3349 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3350 _next_ordinal_to_read += 1;
3351 next_offset += envelope_size;
3352 }
3353
3354 let next_out_of_line = decoder.next_out_of_line();
3355 let handles_before = decoder.remaining_handles();
3356 if let Some((inlined, num_bytes, num_handles)) =
3357 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3358 {
3359 let member_inline_size =
3360 <GuestStatus as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3361 if inlined != (member_inline_size <= 4) {
3362 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3363 }
3364 let inner_offset;
3365 let mut inner_depth = depth.clone();
3366 if inlined {
3367 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3368 inner_offset = next_offset;
3369 } else {
3370 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3371 inner_depth.increment()?;
3372 }
3373 let val_ref =
3374 self.guest_status.get_or_insert_with(|| fidl::new_empty!(GuestStatus, D));
3375 fidl::decode!(GuestStatus, D, val_ref, decoder, inner_offset, inner_depth)?;
3376 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3377 {
3378 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3379 }
3380 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3381 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3382 }
3383 }
3384
3385 next_offset += envelope_size;
3386 _next_ordinal_to_read += 1;
3387 if next_offset >= end_offset {
3388 return Ok(());
3389 }
3390
3391 while _next_ordinal_to_read < 2 {
3393 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3394 _next_ordinal_to_read += 1;
3395 next_offset += envelope_size;
3396 }
3397
3398 let next_out_of_line = decoder.next_out_of_line();
3399 let handles_before = decoder.remaining_handles();
3400 if let Some((inlined, num_bytes, num_handles)) =
3401 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3402 {
3403 let member_inline_size =
3404 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3405 if inlined != (member_inline_size <= 4) {
3406 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3407 }
3408 let inner_offset;
3409 let mut inner_depth = depth.clone();
3410 if inlined {
3411 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3412 inner_offset = next_offset;
3413 } else {
3414 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3415 inner_depth.increment()?;
3416 }
3417 let val_ref = self.uptime.get_or_insert_with(|| fidl::new_empty!(i64, D));
3418 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3419 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3420 {
3421 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3422 }
3423 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3424 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3425 }
3426 }
3427
3428 next_offset += envelope_size;
3429 _next_ordinal_to_read += 1;
3430 if next_offset >= end_offset {
3431 return Ok(());
3432 }
3433
3434 while _next_ordinal_to_read < 3 {
3436 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3437 _next_ordinal_to_read += 1;
3438 next_offset += envelope_size;
3439 }
3440
3441 let next_out_of_line = decoder.next_out_of_line();
3442 let handles_before = decoder.remaining_handles();
3443 if let Some((inlined, num_bytes, num_handles)) =
3444 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3445 {
3446 let member_inline_size =
3447 <GuestDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3448 if inlined != (member_inline_size <= 4) {
3449 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3450 }
3451 let inner_offset;
3452 let mut inner_depth = depth.clone();
3453 if inlined {
3454 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3455 inner_offset = next_offset;
3456 } else {
3457 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3458 inner_depth.increment()?;
3459 }
3460 let val_ref = self
3461 .guest_descriptor
3462 .get_or_insert_with(|| fidl::new_empty!(GuestDescriptor, D));
3463 fidl::decode!(GuestDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
3464 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3465 {
3466 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3467 }
3468 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3469 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3470 }
3471 }
3472
3473 next_offset += envelope_size;
3474 _next_ordinal_to_read += 1;
3475 if next_offset >= end_offset {
3476 return Ok(());
3477 }
3478
3479 while _next_ordinal_to_read < 4 {
3481 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3482 _next_ordinal_to_read += 1;
3483 next_offset += envelope_size;
3484 }
3485
3486 let next_out_of_line = decoder.next_out_of_line();
3487 let handles_before = decoder.remaining_handles();
3488 if let Some((inlined, num_bytes, num_handles)) =
3489 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3490 {
3491 let member_inline_size =
3492 <GuestError as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3493 if inlined != (member_inline_size <= 4) {
3494 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3495 }
3496 let inner_offset;
3497 let mut inner_depth = depth.clone();
3498 if inlined {
3499 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3500 inner_offset = next_offset;
3501 } else {
3502 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3503 inner_depth.increment()?;
3504 }
3505 let val_ref =
3506 self.stop_error.get_or_insert_with(|| fidl::new_empty!(GuestError, D));
3507 fidl::decode!(GuestError, D, val_ref, decoder, inner_offset, inner_depth)?;
3508 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3509 {
3510 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3511 }
3512 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3513 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3514 }
3515 }
3516
3517 next_offset += envelope_size;
3518 _next_ordinal_to_read += 1;
3519 if next_offset >= end_offset {
3520 return Ok(());
3521 }
3522
3523 while _next_ordinal_to_read < 5 {
3525 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3526 _next_ordinal_to_read += 1;
3527 next_offset += envelope_size;
3528 }
3529
3530 let next_out_of_line = decoder.next_out_of_line();
3531 let handles_before = decoder.remaining_handles();
3532 if let Some((inlined, num_bytes, num_handles)) =
3533 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3534 {
3535 let member_inline_size = <fidl::encoding::Vector<fidl::encoding::UnboundedString, 8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3536 if inlined != (member_inline_size <= 4) {
3537 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3538 }
3539 let inner_offset;
3540 let mut inner_depth = depth.clone();
3541 if inlined {
3542 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3543 inner_offset = next_offset;
3544 } else {
3545 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3546 inner_depth.increment()?;
3547 }
3548 let val_ref =
3549 self.detected_problems.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl::encoding::UnboundedString, 8>, D));
3550 fidl::decode!(fidl::encoding::Vector<fidl::encoding::UnboundedString, 8>, D, val_ref, decoder, inner_offset, inner_depth)?;
3551 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3552 {
3553 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3554 }
3555 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3556 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3557 }
3558 }
3559
3560 next_offset += envelope_size;
3561
3562 while next_offset < end_offset {
3564 _next_ordinal_to_read += 1;
3565 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3566 next_offset += envelope_size;
3567 }
3568
3569 Ok(())
3570 }
3571 }
3572
3573 impl LinuxGuestInfo {
3574 #[inline(always)]
3575 fn max_ordinal_present(&self) -> u64 {
3576 if let Some(_) = self.failure_reason {
3577 return 4;
3578 }
3579 if let Some(_) = self.download_percent {
3580 return 3;
3581 }
3582 if let Some(_) = self.container_status {
3583 return 2;
3584 }
3585 if let Some(_) = self.cid {
3586 return 1;
3587 }
3588 0
3589 }
3590 }
3591
3592 impl fidl::encoding::ValueTypeMarker for LinuxGuestInfo {
3593 type Borrowed<'a> = &'a Self;
3594 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3595 value
3596 }
3597 }
3598
3599 unsafe impl fidl::encoding::TypeMarker for LinuxGuestInfo {
3600 type Owned = Self;
3601
3602 #[inline(always)]
3603 fn inline_align(_context: fidl::encoding::Context) -> usize {
3604 8
3605 }
3606
3607 #[inline(always)]
3608 fn inline_size(_context: fidl::encoding::Context) -> usize {
3609 16
3610 }
3611 }
3612
3613 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LinuxGuestInfo, D>
3614 for &LinuxGuestInfo
3615 {
3616 unsafe fn encode(
3617 self,
3618 encoder: &mut fidl::encoding::Encoder<'_, D>,
3619 offset: usize,
3620 mut depth: fidl::encoding::Depth,
3621 ) -> fidl::Result<()> {
3622 encoder.debug_check_bounds::<LinuxGuestInfo>(offset);
3623 let max_ordinal: u64 = self.max_ordinal_present();
3625 encoder.write_num(max_ordinal, offset);
3626 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3627 if max_ordinal == 0 {
3629 return Ok(());
3630 }
3631 depth.increment()?;
3632 let envelope_size = 8;
3633 let bytes_len = max_ordinal as usize * envelope_size;
3634 #[allow(unused_variables)]
3635 let offset = encoder.out_of_line_offset(bytes_len);
3636 let mut _prev_end_offset: usize = 0;
3637 if 1 > max_ordinal {
3638 return Ok(());
3639 }
3640
3641 let cur_offset: usize = (1 - 1) * envelope_size;
3644
3645 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3647
3648 fidl::encoding::encode_in_envelope_optional::<u32, D>(
3653 self.cid.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3654 encoder,
3655 offset + cur_offset,
3656 depth,
3657 )?;
3658
3659 _prev_end_offset = cur_offset + envelope_size;
3660 if 2 > max_ordinal {
3661 return Ok(());
3662 }
3663
3664 let cur_offset: usize = (2 - 1) * envelope_size;
3667
3668 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3670
3671 fidl::encoding::encode_in_envelope_optional::<ContainerStatus, D>(
3676 self.container_status
3677 .as_ref()
3678 .map(<ContainerStatus as fidl::encoding::ValueTypeMarker>::borrow),
3679 encoder,
3680 offset + cur_offset,
3681 depth,
3682 )?;
3683
3684 _prev_end_offset = cur_offset + envelope_size;
3685 if 3 > max_ordinal {
3686 return Ok(());
3687 }
3688
3689 let cur_offset: usize = (3 - 1) * envelope_size;
3692
3693 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3695
3696 fidl::encoding::encode_in_envelope_optional::<i32, D>(
3701 self.download_percent
3702 .as_ref()
3703 .map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
3704 encoder,
3705 offset + cur_offset,
3706 depth,
3707 )?;
3708
3709 _prev_end_offset = cur_offset + envelope_size;
3710 if 4 > max_ordinal {
3711 return Ok(());
3712 }
3713
3714 let cur_offset: usize = (4 - 1) * envelope_size;
3717
3718 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3720
3721 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
3726 self.failure_reason.as_ref().map(
3727 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
3728 ),
3729 encoder,
3730 offset + cur_offset,
3731 depth,
3732 )?;
3733
3734 _prev_end_offset = cur_offset + envelope_size;
3735
3736 Ok(())
3737 }
3738 }
3739
3740 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LinuxGuestInfo {
3741 #[inline(always)]
3742 fn new_empty() -> Self {
3743 Self::default()
3744 }
3745
3746 unsafe fn decode(
3747 &mut self,
3748 decoder: &mut fidl::encoding::Decoder<'_, D>,
3749 offset: usize,
3750 mut depth: fidl::encoding::Depth,
3751 ) -> fidl::Result<()> {
3752 decoder.debug_check_bounds::<Self>(offset);
3753 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3754 None => return Err(fidl::Error::NotNullable),
3755 Some(len) => len,
3756 };
3757 if len == 0 {
3759 return Ok(());
3760 };
3761 depth.increment()?;
3762 let envelope_size = 8;
3763 let bytes_len = len * envelope_size;
3764 let offset = decoder.out_of_line_offset(bytes_len)?;
3765 let mut _next_ordinal_to_read = 0;
3767 let mut next_offset = offset;
3768 let end_offset = offset + bytes_len;
3769 _next_ordinal_to_read += 1;
3770 if next_offset >= end_offset {
3771 return Ok(());
3772 }
3773
3774 while _next_ordinal_to_read < 1 {
3776 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3777 _next_ordinal_to_read += 1;
3778 next_offset += envelope_size;
3779 }
3780
3781 let next_out_of_line = decoder.next_out_of_line();
3782 let handles_before = decoder.remaining_handles();
3783 if let Some((inlined, num_bytes, num_handles)) =
3784 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3785 {
3786 let member_inline_size =
3787 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3788 if inlined != (member_inline_size <= 4) {
3789 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3790 }
3791 let inner_offset;
3792 let mut inner_depth = depth.clone();
3793 if inlined {
3794 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3795 inner_offset = next_offset;
3796 } else {
3797 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3798 inner_depth.increment()?;
3799 }
3800 let val_ref = self.cid.get_or_insert_with(|| fidl::new_empty!(u32, D));
3801 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3802 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3803 {
3804 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3805 }
3806 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3807 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3808 }
3809 }
3810
3811 next_offset += envelope_size;
3812 _next_ordinal_to_read += 1;
3813 if next_offset >= end_offset {
3814 return Ok(());
3815 }
3816
3817 while _next_ordinal_to_read < 2 {
3819 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3820 _next_ordinal_to_read += 1;
3821 next_offset += envelope_size;
3822 }
3823
3824 let next_out_of_line = decoder.next_out_of_line();
3825 let handles_before = decoder.remaining_handles();
3826 if let Some((inlined, num_bytes, num_handles)) =
3827 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3828 {
3829 let member_inline_size =
3830 <ContainerStatus as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3831 if inlined != (member_inline_size <= 4) {
3832 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3833 }
3834 let inner_offset;
3835 let mut inner_depth = depth.clone();
3836 if inlined {
3837 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3838 inner_offset = next_offset;
3839 } else {
3840 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3841 inner_depth.increment()?;
3842 }
3843 let val_ref = self
3844 .container_status
3845 .get_or_insert_with(|| fidl::new_empty!(ContainerStatus, D));
3846 fidl::decode!(ContainerStatus, D, val_ref, decoder, inner_offset, inner_depth)?;
3847 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3848 {
3849 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3850 }
3851 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3852 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3853 }
3854 }
3855
3856 next_offset += envelope_size;
3857 _next_ordinal_to_read += 1;
3858 if next_offset >= end_offset {
3859 return Ok(());
3860 }
3861
3862 while _next_ordinal_to_read < 3 {
3864 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3865 _next_ordinal_to_read += 1;
3866 next_offset += envelope_size;
3867 }
3868
3869 let next_out_of_line = decoder.next_out_of_line();
3870 let handles_before = decoder.remaining_handles();
3871 if let Some((inlined, num_bytes, num_handles)) =
3872 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3873 {
3874 let member_inline_size =
3875 <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3876 if inlined != (member_inline_size <= 4) {
3877 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3878 }
3879 let inner_offset;
3880 let mut inner_depth = depth.clone();
3881 if inlined {
3882 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3883 inner_offset = next_offset;
3884 } else {
3885 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3886 inner_depth.increment()?;
3887 }
3888 let val_ref = self.download_percent.get_or_insert_with(|| fidl::new_empty!(i32, D));
3889 fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
3890 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3891 {
3892 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3893 }
3894 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3895 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3896 }
3897 }
3898
3899 next_offset += envelope_size;
3900 _next_ordinal_to_read += 1;
3901 if next_offset >= end_offset {
3902 return Ok(());
3903 }
3904
3905 while _next_ordinal_to_read < 4 {
3907 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3908 _next_ordinal_to_read += 1;
3909 next_offset += envelope_size;
3910 }
3911
3912 let next_out_of_line = decoder.next_out_of_line();
3913 let handles_before = decoder.remaining_handles();
3914 if let Some((inlined, num_bytes, num_handles)) =
3915 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3916 {
3917 let member_inline_size =
3918 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
3919 decoder.context,
3920 );
3921 if inlined != (member_inline_size <= 4) {
3922 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3923 }
3924 let inner_offset;
3925 let mut inner_depth = depth.clone();
3926 if inlined {
3927 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3928 inner_offset = next_offset;
3929 } else {
3930 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3931 inner_depth.increment()?;
3932 }
3933 let val_ref = self
3934 .failure_reason
3935 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
3936 fidl::decode!(
3937 fidl::encoding::UnboundedString,
3938 D,
3939 val_ref,
3940 decoder,
3941 inner_offset,
3942 inner_depth
3943 )?;
3944 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3945 {
3946 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3947 }
3948 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3949 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3950 }
3951 }
3952
3953 next_offset += envelope_size;
3954
3955 while next_offset < end_offset {
3957 _next_ordinal_to_read += 1;
3958 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3959 next_offset += envelope_size;
3960 }
3961
3962 Ok(())
3963 }
3964 }
3965}