fidl_fuchsia_virtualization_hardware__common/
fidl_fuchsia_virtualization_hardware__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// Set a flag to inspect configs on the next interrupt.
12pub const EVENT_SET_CONFIG: u32 = 1;
13
14/// If a flag is set, send an interrupt to the device.
15pub const EVENT_SET_INTERRUPT: u32 = 2;
16
17/// Set a flag to inspect queues on the next interrupt.
18pub const EVENT_SET_QUEUE: u32 = 0;
19
20pub const VIRTIO_WAYLAND_INVALID_VFD_ID: u32 = 0;
21
22/// Sufficient to contain the opaque image info.
23pub const VIRTIO_WAYLAND_MAX_IMAGE_INFO_SIZE: u32 = 128;
24
25/// Contains the details of a device trap.
26#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27#[repr(C)]
28pub struct Trap {
29    /// The address of the device trap. This must be page-aligned.
30    pub addr: u64,
31    /// The size of the device trap. This must be a multiple of the page size.
32    pub size: u64,
33}
34
35impl fidl::Persistable for Trap {}
36
37#[derive(Clone, Debug, PartialEq)]
38pub struct VirtioBalloonGetMemStatsResponse {
39    pub status: i32,
40    pub mem_stats: Option<Vec<fidl_fuchsia_virtualization__common::MemStat>>,
41}
42
43impl fidl::Persistable for VirtioBalloonGetMemStatsResponse {}
44
45#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
46#[repr(C)]
47pub struct VirtioBlockStartResponse {
48    pub capacity: u64,
49    pub block_size: u32,
50}
51
52impl fidl::Persistable for VirtioBlockStartResponse {}
53
54#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
55#[repr(C)]
56pub struct VirtioDeviceConfigureQueueRequest {
57    pub queue: u16,
58    pub size: u16,
59    pub desc: u64,
60    pub avail: u64,
61    pub used: u64,
62}
63
64impl fidl::Persistable for VirtioDeviceConfigureQueueRequest {}
65
66#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
67#[repr(C)]
68pub struct VirtioDeviceNotifyQueueRequest {
69    pub queue: u16,
70}
71
72impl fidl::Persistable for VirtioDeviceNotifyQueueRequest {}
73
74#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
75#[repr(C)]
76pub struct VirtioDeviceReadyRequest {
77    pub negotiated_features: u32,
78}
79
80impl fidl::Persistable for VirtioDeviceReadyRequest {}
81
82#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
83#[repr(C)]
84pub struct VirtioMagmaStartResponse {
85    pub status: i32,
86}
87
88impl fidl::Persistable for VirtioMagmaStartResponse {}
89
90#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
91#[repr(C)]
92pub struct VirtioMemOnConfigChangedRequest {
93    pub plugged_size: u64,
94}
95
96impl fidl::Persistable for VirtioMemOnConfigChangedRequest {}
97
98#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
99#[repr(C)]
100pub struct VirtioSoundStartResponse {
101    pub features: u32,
102    pub jacks: u32,
103    pub streams: u32,
104    pub chmaps: u32,
105}
106
107impl fidl::Persistable for VirtioSoundStartResponse {}
108
109#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
110#[repr(C)]
111pub struct VirtioWaylandImporterExportImageRequest {
112    pub vfd_id: u32,
113}
114
115impl fidl::Persistable for VirtioWaylandImporterExportImageRequest {}
116
117#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
118#[repr(C)]
119pub struct VirtioWaylandImporterImportImageResponse {
120    pub vfd_id: u32,
121}
122
123impl fidl::Persistable for VirtioWaylandImporterImportImageResponse {}
124
125mod internal {
126    use super::*;
127
128    impl fidl::encoding::ValueTypeMarker for Trap {
129        type Borrowed<'a> = &'a Self;
130        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
131            value
132        }
133    }
134
135    unsafe impl fidl::encoding::TypeMarker for Trap {
136        type Owned = Self;
137
138        #[inline(always)]
139        fn inline_align(_context: fidl::encoding::Context) -> usize {
140            8
141        }
142
143        #[inline(always)]
144        fn inline_size(_context: fidl::encoding::Context) -> usize {
145            16
146        }
147        #[inline(always)]
148        fn encode_is_copy() -> bool {
149            true
150        }
151
152        #[inline(always)]
153        fn decode_is_copy() -> bool {
154            true
155        }
156    }
157
158    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Trap, D> for &Trap {
159        #[inline]
160        unsafe fn encode(
161            self,
162            encoder: &mut fidl::encoding::Encoder<'_, D>,
163            offset: usize,
164            _depth: fidl::encoding::Depth,
165        ) -> fidl::Result<()> {
166            encoder.debug_check_bounds::<Trap>(offset);
167            unsafe {
168                // Copy the object into the buffer.
169                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
170                (buf_ptr as *mut Trap).write_unaligned((self as *const Trap).read());
171                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
172                // done second because the memcpy will write garbage to these bytes.
173            }
174            Ok(())
175        }
176    }
177    unsafe impl<
178            D: fidl::encoding::ResourceDialect,
179            T0: fidl::encoding::Encode<u64, D>,
180            T1: fidl::encoding::Encode<u64, D>,
181        > fidl::encoding::Encode<Trap, D> for (T0, T1)
182    {
183        #[inline]
184        unsafe fn encode(
185            self,
186            encoder: &mut fidl::encoding::Encoder<'_, D>,
187            offset: usize,
188            depth: fidl::encoding::Depth,
189        ) -> fidl::Result<()> {
190            encoder.debug_check_bounds::<Trap>(offset);
191            // Zero out padding regions. There's no need to apply masks
192            // because the unmasked parts will be overwritten by fields.
193            // Write the fields.
194            self.0.encode(encoder, offset + 0, depth)?;
195            self.1.encode(encoder, offset + 8, depth)?;
196            Ok(())
197        }
198    }
199
200    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Trap {
201        #[inline(always)]
202        fn new_empty() -> Self {
203            Self { addr: fidl::new_empty!(u64, D), size: fidl::new_empty!(u64, D) }
204        }
205
206        #[inline]
207        unsafe fn decode(
208            &mut self,
209            decoder: &mut fidl::encoding::Decoder<'_, D>,
210            offset: usize,
211            _depth: fidl::encoding::Depth,
212        ) -> fidl::Result<()> {
213            decoder.debug_check_bounds::<Self>(offset);
214            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
215            // Verify that padding bytes are zero.
216            // Copy from the buffer into the object.
217            unsafe {
218                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
219            }
220            Ok(())
221        }
222    }
223
224    impl fidl::encoding::ValueTypeMarker for VirtioBalloonGetMemStatsResponse {
225        type Borrowed<'a> = &'a Self;
226        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
227            value
228        }
229    }
230
231    unsafe impl fidl::encoding::TypeMarker for VirtioBalloonGetMemStatsResponse {
232        type Owned = Self;
233
234        #[inline(always)]
235        fn inline_align(_context: fidl::encoding::Context) -> usize {
236            8
237        }
238
239        #[inline(always)]
240        fn inline_size(_context: fidl::encoding::Context) -> usize {
241            24
242        }
243    }
244
245    unsafe impl<D: fidl::encoding::ResourceDialect>
246        fidl::encoding::Encode<VirtioBalloonGetMemStatsResponse, D>
247        for &VirtioBalloonGetMemStatsResponse
248    {
249        #[inline]
250        unsafe fn encode(
251            self,
252            encoder: &mut fidl::encoding::Encoder<'_, D>,
253            offset: usize,
254            _depth: fidl::encoding::Depth,
255        ) -> fidl::Result<()> {
256            encoder.debug_check_bounds::<VirtioBalloonGetMemStatsResponse>(offset);
257            // Delegate to tuple encoding.
258            fidl::encoding::Encode::<VirtioBalloonGetMemStatsResponse, D>::encode(
259                (
260                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
261                    <fidl::encoding::Optional<
262                        fidl::encoding::UnboundedVector<
263                            fidl_fuchsia_virtualization__common::MemStat,
264                        >,
265                    > as fidl::encoding::ValueTypeMarker>::borrow(
266                        &self.mem_stats
267                    ),
268                ),
269                encoder,
270                offset,
271                _depth,
272            )
273        }
274    }
275    unsafe impl<
276            D: fidl::encoding::ResourceDialect,
277            T0: fidl::encoding::Encode<i32, D>,
278            T1: fidl::encoding::Encode<
279                fidl::encoding::Optional<
280                    fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization__common::MemStat>,
281                >,
282                D,
283            >,
284        > fidl::encoding::Encode<VirtioBalloonGetMemStatsResponse, D> for (T0, T1)
285    {
286        #[inline]
287        unsafe fn encode(
288            self,
289            encoder: &mut fidl::encoding::Encoder<'_, D>,
290            offset: usize,
291            depth: fidl::encoding::Depth,
292        ) -> fidl::Result<()> {
293            encoder.debug_check_bounds::<VirtioBalloonGetMemStatsResponse>(offset);
294            // Zero out padding regions. There's no need to apply masks
295            // because the unmasked parts will be overwritten by fields.
296            unsafe {
297                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
298                (ptr as *mut u64).write_unaligned(0);
299            }
300            // Write the fields.
301            self.0.encode(encoder, offset + 0, depth)?;
302            self.1.encode(encoder, offset + 8, depth)?;
303            Ok(())
304        }
305    }
306
307    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
308        for VirtioBalloonGetMemStatsResponse
309    {
310        #[inline(always)]
311        fn new_empty() -> Self {
312            Self {
313                status: fidl::new_empty!(i32, D),
314                mem_stats: fidl::new_empty!(
315                    fidl::encoding::Optional<
316                        fidl::encoding::UnboundedVector<
317                            fidl_fuchsia_virtualization__common::MemStat,
318                        >,
319                    >,
320                    D
321                ),
322            }
323        }
324
325        #[inline]
326        unsafe fn decode(
327            &mut self,
328            decoder: &mut fidl::encoding::Decoder<'_, D>,
329            offset: usize,
330            _depth: fidl::encoding::Depth,
331        ) -> fidl::Result<()> {
332            decoder.debug_check_bounds::<Self>(offset);
333            // Verify that padding bytes are zero.
334            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
335            let padval = unsafe { (ptr as *const u64).read_unaligned() };
336            let mask = 0xffffffff00000000u64;
337            let maskedval = padval & mask;
338            if maskedval != 0 {
339                return Err(fidl::Error::NonZeroPadding {
340                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
341                });
342            }
343            fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
344            fidl::decode!(
345                fidl::encoding::Optional<
346                    fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization__common::MemStat>,
347                >,
348                D,
349                &mut self.mem_stats,
350                decoder,
351                offset + 8,
352                _depth
353            )?;
354            Ok(())
355        }
356    }
357
358    impl fidl::encoding::ValueTypeMarker for VirtioBlockStartResponse {
359        type Borrowed<'a> = &'a Self;
360        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
361            value
362        }
363    }
364
365    unsafe impl fidl::encoding::TypeMarker for VirtioBlockStartResponse {
366        type Owned = Self;
367
368        #[inline(always)]
369        fn inline_align(_context: fidl::encoding::Context) -> usize {
370            8
371        }
372
373        #[inline(always)]
374        fn inline_size(_context: fidl::encoding::Context) -> usize {
375            16
376        }
377    }
378
379    unsafe impl<D: fidl::encoding::ResourceDialect>
380        fidl::encoding::Encode<VirtioBlockStartResponse, D> for &VirtioBlockStartResponse
381    {
382        #[inline]
383        unsafe fn encode(
384            self,
385            encoder: &mut fidl::encoding::Encoder<'_, D>,
386            offset: usize,
387            _depth: fidl::encoding::Depth,
388        ) -> fidl::Result<()> {
389            encoder.debug_check_bounds::<VirtioBlockStartResponse>(offset);
390            unsafe {
391                // Copy the object into the buffer.
392                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
393                (buf_ptr as *mut VirtioBlockStartResponse)
394                    .write_unaligned((self as *const VirtioBlockStartResponse).read());
395                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
396                // done second because the memcpy will write garbage to these bytes.
397                let padding_ptr = buf_ptr.offset(8) as *mut u64;
398                let padding_mask = 0xffffffff00000000u64;
399                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
400            }
401            Ok(())
402        }
403    }
404    unsafe impl<
405            D: fidl::encoding::ResourceDialect,
406            T0: fidl::encoding::Encode<u64, D>,
407            T1: fidl::encoding::Encode<u32, D>,
408        > fidl::encoding::Encode<VirtioBlockStartResponse, D> for (T0, T1)
409    {
410        #[inline]
411        unsafe fn encode(
412            self,
413            encoder: &mut fidl::encoding::Encoder<'_, D>,
414            offset: usize,
415            depth: fidl::encoding::Depth,
416        ) -> fidl::Result<()> {
417            encoder.debug_check_bounds::<VirtioBlockStartResponse>(offset);
418            // Zero out padding regions. There's no need to apply masks
419            // because the unmasked parts will be overwritten by fields.
420            unsafe {
421                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
422                (ptr as *mut u64).write_unaligned(0);
423            }
424            // Write the fields.
425            self.0.encode(encoder, offset + 0, depth)?;
426            self.1.encode(encoder, offset + 8, depth)?;
427            Ok(())
428        }
429    }
430
431    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
432        for VirtioBlockStartResponse
433    {
434        #[inline(always)]
435        fn new_empty() -> Self {
436            Self { capacity: fidl::new_empty!(u64, D), block_size: fidl::new_empty!(u32, D) }
437        }
438
439        #[inline]
440        unsafe fn decode(
441            &mut self,
442            decoder: &mut fidl::encoding::Decoder<'_, D>,
443            offset: usize,
444            _depth: fidl::encoding::Depth,
445        ) -> fidl::Result<()> {
446            decoder.debug_check_bounds::<Self>(offset);
447            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
448            // Verify that padding bytes are zero.
449            let ptr = unsafe { buf_ptr.offset(8) };
450            let padval = unsafe { (ptr as *const u64).read_unaligned() };
451            let mask = 0xffffffff00000000u64;
452            let maskedval = padval & mask;
453            if maskedval != 0 {
454                return Err(fidl::Error::NonZeroPadding {
455                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
456                });
457            }
458            // Copy from the buffer into the object.
459            unsafe {
460                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
461            }
462            Ok(())
463        }
464    }
465
466    impl fidl::encoding::ValueTypeMarker for VirtioDeviceConfigureQueueRequest {
467        type Borrowed<'a> = &'a Self;
468        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
469            value
470        }
471    }
472
473    unsafe impl fidl::encoding::TypeMarker for VirtioDeviceConfigureQueueRequest {
474        type Owned = Self;
475
476        #[inline(always)]
477        fn inline_align(_context: fidl::encoding::Context) -> usize {
478            8
479        }
480
481        #[inline(always)]
482        fn inline_size(_context: fidl::encoding::Context) -> usize {
483            32
484        }
485    }
486
487    unsafe impl<D: fidl::encoding::ResourceDialect>
488        fidl::encoding::Encode<VirtioDeviceConfigureQueueRequest, D>
489        for &VirtioDeviceConfigureQueueRequest
490    {
491        #[inline]
492        unsafe fn encode(
493            self,
494            encoder: &mut fidl::encoding::Encoder<'_, D>,
495            offset: usize,
496            _depth: fidl::encoding::Depth,
497        ) -> fidl::Result<()> {
498            encoder.debug_check_bounds::<VirtioDeviceConfigureQueueRequest>(offset);
499            unsafe {
500                // Copy the object into the buffer.
501                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
502                (buf_ptr as *mut VirtioDeviceConfigureQueueRequest)
503                    .write_unaligned((self as *const VirtioDeviceConfigureQueueRequest).read());
504                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
505                // done second because the memcpy will write garbage to these bytes.
506                let padding_ptr = buf_ptr.offset(0) as *mut u64;
507                let padding_mask = 0xffffffff00000000u64;
508                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
509            }
510            Ok(())
511        }
512    }
513    unsafe impl<
514            D: fidl::encoding::ResourceDialect,
515            T0: fidl::encoding::Encode<u16, D>,
516            T1: fidl::encoding::Encode<u16, D>,
517            T2: fidl::encoding::Encode<u64, D>,
518            T3: fidl::encoding::Encode<u64, D>,
519            T4: fidl::encoding::Encode<u64, D>,
520        > fidl::encoding::Encode<VirtioDeviceConfigureQueueRequest, D> for (T0, T1, T2, T3, T4)
521    {
522        #[inline]
523        unsafe fn encode(
524            self,
525            encoder: &mut fidl::encoding::Encoder<'_, D>,
526            offset: usize,
527            depth: fidl::encoding::Depth,
528        ) -> fidl::Result<()> {
529            encoder.debug_check_bounds::<VirtioDeviceConfigureQueueRequest>(offset);
530            // Zero out padding regions. There's no need to apply masks
531            // because the unmasked parts will be overwritten by fields.
532            unsafe {
533                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
534                (ptr as *mut u64).write_unaligned(0);
535            }
536            // Write the fields.
537            self.0.encode(encoder, offset + 0, depth)?;
538            self.1.encode(encoder, offset + 2, depth)?;
539            self.2.encode(encoder, offset + 8, depth)?;
540            self.3.encode(encoder, offset + 16, depth)?;
541            self.4.encode(encoder, offset + 24, depth)?;
542            Ok(())
543        }
544    }
545
546    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
547        for VirtioDeviceConfigureQueueRequest
548    {
549        #[inline(always)]
550        fn new_empty() -> Self {
551            Self {
552                queue: fidl::new_empty!(u16, D),
553                size: fidl::new_empty!(u16, D),
554                desc: fidl::new_empty!(u64, D),
555                avail: fidl::new_empty!(u64, D),
556                used: fidl::new_empty!(u64, D),
557            }
558        }
559
560        #[inline]
561        unsafe fn decode(
562            &mut self,
563            decoder: &mut fidl::encoding::Decoder<'_, D>,
564            offset: usize,
565            _depth: fidl::encoding::Depth,
566        ) -> fidl::Result<()> {
567            decoder.debug_check_bounds::<Self>(offset);
568            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
569            // Verify that padding bytes are zero.
570            let ptr = unsafe { buf_ptr.offset(0) };
571            let padval = unsafe { (ptr as *const u64).read_unaligned() };
572            let mask = 0xffffffff00000000u64;
573            let maskedval = padval & mask;
574            if maskedval != 0 {
575                return Err(fidl::Error::NonZeroPadding {
576                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
577                });
578            }
579            // Copy from the buffer into the object.
580            unsafe {
581                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
582            }
583            Ok(())
584        }
585    }
586
587    impl fidl::encoding::ValueTypeMarker for VirtioDeviceNotifyQueueRequest {
588        type Borrowed<'a> = &'a Self;
589        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
590            value
591        }
592    }
593
594    unsafe impl fidl::encoding::TypeMarker for VirtioDeviceNotifyQueueRequest {
595        type Owned = Self;
596
597        #[inline(always)]
598        fn inline_align(_context: fidl::encoding::Context) -> usize {
599            2
600        }
601
602        #[inline(always)]
603        fn inline_size(_context: fidl::encoding::Context) -> usize {
604            2
605        }
606        #[inline(always)]
607        fn encode_is_copy() -> bool {
608            true
609        }
610
611        #[inline(always)]
612        fn decode_is_copy() -> bool {
613            true
614        }
615    }
616
617    unsafe impl<D: fidl::encoding::ResourceDialect>
618        fidl::encoding::Encode<VirtioDeviceNotifyQueueRequest, D>
619        for &VirtioDeviceNotifyQueueRequest
620    {
621        #[inline]
622        unsafe fn encode(
623            self,
624            encoder: &mut fidl::encoding::Encoder<'_, D>,
625            offset: usize,
626            _depth: fidl::encoding::Depth,
627        ) -> fidl::Result<()> {
628            encoder.debug_check_bounds::<VirtioDeviceNotifyQueueRequest>(offset);
629            unsafe {
630                // Copy the object into the buffer.
631                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
632                (buf_ptr as *mut VirtioDeviceNotifyQueueRequest)
633                    .write_unaligned((self as *const VirtioDeviceNotifyQueueRequest).read());
634                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
635                // done second because the memcpy will write garbage to these bytes.
636            }
637            Ok(())
638        }
639    }
640    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
641        fidl::encoding::Encode<VirtioDeviceNotifyQueueRequest, D> for (T0,)
642    {
643        #[inline]
644        unsafe fn encode(
645            self,
646            encoder: &mut fidl::encoding::Encoder<'_, D>,
647            offset: usize,
648            depth: fidl::encoding::Depth,
649        ) -> fidl::Result<()> {
650            encoder.debug_check_bounds::<VirtioDeviceNotifyQueueRequest>(offset);
651            // Zero out padding regions. There's no need to apply masks
652            // because the unmasked parts will be overwritten by fields.
653            // Write the fields.
654            self.0.encode(encoder, offset + 0, depth)?;
655            Ok(())
656        }
657    }
658
659    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
660        for VirtioDeviceNotifyQueueRequest
661    {
662        #[inline(always)]
663        fn new_empty() -> Self {
664            Self { queue: fidl::new_empty!(u16, D) }
665        }
666
667        #[inline]
668        unsafe fn decode(
669            &mut self,
670            decoder: &mut fidl::encoding::Decoder<'_, D>,
671            offset: usize,
672            _depth: fidl::encoding::Depth,
673        ) -> fidl::Result<()> {
674            decoder.debug_check_bounds::<Self>(offset);
675            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
676            // Verify that padding bytes are zero.
677            // Copy from the buffer into the object.
678            unsafe {
679                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
680            }
681            Ok(())
682        }
683    }
684
685    impl fidl::encoding::ValueTypeMarker for VirtioDeviceReadyRequest {
686        type Borrowed<'a> = &'a Self;
687        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
688            value
689        }
690    }
691
692    unsafe impl fidl::encoding::TypeMarker for VirtioDeviceReadyRequest {
693        type Owned = Self;
694
695        #[inline(always)]
696        fn inline_align(_context: fidl::encoding::Context) -> usize {
697            4
698        }
699
700        #[inline(always)]
701        fn inline_size(_context: fidl::encoding::Context) -> usize {
702            4
703        }
704        #[inline(always)]
705        fn encode_is_copy() -> bool {
706            true
707        }
708
709        #[inline(always)]
710        fn decode_is_copy() -> bool {
711            true
712        }
713    }
714
715    unsafe impl<D: fidl::encoding::ResourceDialect>
716        fidl::encoding::Encode<VirtioDeviceReadyRequest, D> for &VirtioDeviceReadyRequest
717    {
718        #[inline]
719        unsafe fn encode(
720            self,
721            encoder: &mut fidl::encoding::Encoder<'_, D>,
722            offset: usize,
723            _depth: fidl::encoding::Depth,
724        ) -> fidl::Result<()> {
725            encoder.debug_check_bounds::<VirtioDeviceReadyRequest>(offset);
726            unsafe {
727                // Copy the object into the buffer.
728                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
729                (buf_ptr as *mut VirtioDeviceReadyRequest)
730                    .write_unaligned((self as *const VirtioDeviceReadyRequest).read());
731                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
732                // done second because the memcpy will write garbage to these bytes.
733            }
734            Ok(())
735        }
736    }
737    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
738        fidl::encoding::Encode<VirtioDeviceReadyRequest, D> for (T0,)
739    {
740        #[inline]
741        unsafe fn encode(
742            self,
743            encoder: &mut fidl::encoding::Encoder<'_, D>,
744            offset: usize,
745            depth: fidl::encoding::Depth,
746        ) -> fidl::Result<()> {
747            encoder.debug_check_bounds::<VirtioDeviceReadyRequest>(offset);
748            // Zero out padding regions. There's no need to apply masks
749            // because the unmasked parts will be overwritten by fields.
750            // Write the fields.
751            self.0.encode(encoder, offset + 0, depth)?;
752            Ok(())
753        }
754    }
755
756    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
757        for VirtioDeviceReadyRequest
758    {
759        #[inline(always)]
760        fn new_empty() -> Self {
761            Self { negotiated_features: fidl::new_empty!(u32, D) }
762        }
763
764        #[inline]
765        unsafe fn decode(
766            &mut self,
767            decoder: &mut fidl::encoding::Decoder<'_, D>,
768            offset: usize,
769            _depth: fidl::encoding::Depth,
770        ) -> fidl::Result<()> {
771            decoder.debug_check_bounds::<Self>(offset);
772            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
773            // Verify that padding bytes are zero.
774            // Copy from the buffer into the object.
775            unsafe {
776                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
777            }
778            Ok(())
779        }
780    }
781
782    impl fidl::encoding::ValueTypeMarker for VirtioMagmaStartResponse {
783        type Borrowed<'a> = &'a Self;
784        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
785            value
786        }
787    }
788
789    unsafe impl fidl::encoding::TypeMarker for VirtioMagmaStartResponse {
790        type Owned = Self;
791
792        #[inline(always)]
793        fn inline_align(_context: fidl::encoding::Context) -> usize {
794            4
795        }
796
797        #[inline(always)]
798        fn inline_size(_context: fidl::encoding::Context) -> usize {
799            4
800        }
801        #[inline(always)]
802        fn encode_is_copy() -> bool {
803            true
804        }
805
806        #[inline(always)]
807        fn decode_is_copy() -> bool {
808            true
809        }
810    }
811
812    unsafe impl<D: fidl::encoding::ResourceDialect>
813        fidl::encoding::Encode<VirtioMagmaStartResponse, D> for &VirtioMagmaStartResponse
814    {
815        #[inline]
816        unsafe fn encode(
817            self,
818            encoder: &mut fidl::encoding::Encoder<'_, D>,
819            offset: usize,
820            _depth: fidl::encoding::Depth,
821        ) -> fidl::Result<()> {
822            encoder.debug_check_bounds::<VirtioMagmaStartResponse>(offset);
823            unsafe {
824                // Copy the object into the buffer.
825                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
826                (buf_ptr as *mut VirtioMagmaStartResponse)
827                    .write_unaligned((self as *const VirtioMagmaStartResponse).read());
828                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
829                // done second because the memcpy will write garbage to these bytes.
830            }
831            Ok(())
832        }
833    }
834    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
835        fidl::encoding::Encode<VirtioMagmaStartResponse, D> for (T0,)
836    {
837        #[inline]
838        unsafe fn encode(
839            self,
840            encoder: &mut fidl::encoding::Encoder<'_, D>,
841            offset: usize,
842            depth: fidl::encoding::Depth,
843        ) -> fidl::Result<()> {
844            encoder.debug_check_bounds::<VirtioMagmaStartResponse>(offset);
845            // Zero out padding regions. There's no need to apply masks
846            // because the unmasked parts will be overwritten by fields.
847            // Write the fields.
848            self.0.encode(encoder, offset + 0, depth)?;
849            Ok(())
850        }
851    }
852
853    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
854        for VirtioMagmaStartResponse
855    {
856        #[inline(always)]
857        fn new_empty() -> Self {
858            Self { status: fidl::new_empty!(i32, D) }
859        }
860
861        #[inline]
862        unsafe fn decode(
863            &mut self,
864            decoder: &mut fidl::encoding::Decoder<'_, D>,
865            offset: usize,
866            _depth: fidl::encoding::Depth,
867        ) -> fidl::Result<()> {
868            decoder.debug_check_bounds::<Self>(offset);
869            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
870            // Verify that padding bytes are zero.
871            // Copy from the buffer into the object.
872            unsafe {
873                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
874            }
875            Ok(())
876        }
877    }
878
879    impl fidl::encoding::ValueTypeMarker for VirtioMemOnConfigChangedRequest {
880        type Borrowed<'a> = &'a Self;
881        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
882            value
883        }
884    }
885
886    unsafe impl fidl::encoding::TypeMarker for VirtioMemOnConfigChangedRequest {
887        type Owned = Self;
888
889        #[inline(always)]
890        fn inline_align(_context: fidl::encoding::Context) -> usize {
891            8
892        }
893
894        #[inline(always)]
895        fn inline_size(_context: fidl::encoding::Context) -> usize {
896            8
897        }
898        #[inline(always)]
899        fn encode_is_copy() -> bool {
900            true
901        }
902
903        #[inline(always)]
904        fn decode_is_copy() -> bool {
905            true
906        }
907    }
908
909    unsafe impl<D: fidl::encoding::ResourceDialect>
910        fidl::encoding::Encode<VirtioMemOnConfigChangedRequest, D>
911        for &VirtioMemOnConfigChangedRequest
912    {
913        #[inline]
914        unsafe fn encode(
915            self,
916            encoder: &mut fidl::encoding::Encoder<'_, D>,
917            offset: usize,
918            _depth: fidl::encoding::Depth,
919        ) -> fidl::Result<()> {
920            encoder.debug_check_bounds::<VirtioMemOnConfigChangedRequest>(offset);
921            unsafe {
922                // Copy the object into the buffer.
923                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
924                (buf_ptr as *mut VirtioMemOnConfigChangedRequest)
925                    .write_unaligned((self as *const VirtioMemOnConfigChangedRequest).read());
926                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
927                // done second because the memcpy will write garbage to these bytes.
928            }
929            Ok(())
930        }
931    }
932    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
933        fidl::encoding::Encode<VirtioMemOnConfigChangedRequest, D> for (T0,)
934    {
935        #[inline]
936        unsafe fn encode(
937            self,
938            encoder: &mut fidl::encoding::Encoder<'_, D>,
939            offset: usize,
940            depth: fidl::encoding::Depth,
941        ) -> fidl::Result<()> {
942            encoder.debug_check_bounds::<VirtioMemOnConfigChangedRequest>(offset);
943            // Zero out padding regions. There's no need to apply masks
944            // because the unmasked parts will be overwritten by fields.
945            // Write the fields.
946            self.0.encode(encoder, offset + 0, depth)?;
947            Ok(())
948        }
949    }
950
951    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
952        for VirtioMemOnConfigChangedRequest
953    {
954        #[inline(always)]
955        fn new_empty() -> Self {
956            Self { plugged_size: fidl::new_empty!(u64, D) }
957        }
958
959        #[inline]
960        unsafe fn decode(
961            &mut self,
962            decoder: &mut fidl::encoding::Decoder<'_, D>,
963            offset: usize,
964            _depth: fidl::encoding::Depth,
965        ) -> fidl::Result<()> {
966            decoder.debug_check_bounds::<Self>(offset);
967            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
968            // Verify that padding bytes are zero.
969            // Copy from the buffer into the object.
970            unsafe {
971                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
972            }
973            Ok(())
974        }
975    }
976
977    impl fidl::encoding::ValueTypeMarker for VirtioSoundStartResponse {
978        type Borrowed<'a> = &'a Self;
979        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
980            value
981        }
982    }
983
984    unsafe impl fidl::encoding::TypeMarker for VirtioSoundStartResponse {
985        type Owned = Self;
986
987        #[inline(always)]
988        fn inline_align(_context: fidl::encoding::Context) -> usize {
989            4
990        }
991
992        #[inline(always)]
993        fn inline_size(_context: fidl::encoding::Context) -> usize {
994            16
995        }
996        #[inline(always)]
997        fn encode_is_copy() -> bool {
998            true
999        }
1000
1001        #[inline(always)]
1002        fn decode_is_copy() -> bool {
1003            true
1004        }
1005    }
1006
1007    unsafe impl<D: fidl::encoding::ResourceDialect>
1008        fidl::encoding::Encode<VirtioSoundStartResponse, D> for &VirtioSoundStartResponse
1009    {
1010        #[inline]
1011        unsafe fn encode(
1012            self,
1013            encoder: &mut fidl::encoding::Encoder<'_, D>,
1014            offset: usize,
1015            _depth: fidl::encoding::Depth,
1016        ) -> fidl::Result<()> {
1017            encoder.debug_check_bounds::<VirtioSoundStartResponse>(offset);
1018            unsafe {
1019                // Copy the object into the buffer.
1020                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1021                (buf_ptr as *mut VirtioSoundStartResponse)
1022                    .write_unaligned((self as *const VirtioSoundStartResponse).read());
1023                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1024                // done second because the memcpy will write garbage to these bytes.
1025            }
1026            Ok(())
1027        }
1028    }
1029    unsafe impl<
1030            D: fidl::encoding::ResourceDialect,
1031            T0: fidl::encoding::Encode<u32, D>,
1032            T1: fidl::encoding::Encode<u32, D>,
1033            T2: fidl::encoding::Encode<u32, D>,
1034            T3: fidl::encoding::Encode<u32, D>,
1035        > fidl::encoding::Encode<VirtioSoundStartResponse, D> for (T0, T1, T2, T3)
1036    {
1037        #[inline]
1038        unsafe fn encode(
1039            self,
1040            encoder: &mut fidl::encoding::Encoder<'_, D>,
1041            offset: usize,
1042            depth: fidl::encoding::Depth,
1043        ) -> fidl::Result<()> {
1044            encoder.debug_check_bounds::<VirtioSoundStartResponse>(offset);
1045            // Zero out padding regions. There's no need to apply masks
1046            // because the unmasked parts will be overwritten by fields.
1047            // Write the fields.
1048            self.0.encode(encoder, offset + 0, depth)?;
1049            self.1.encode(encoder, offset + 4, depth)?;
1050            self.2.encode(encoder, offset + 8, depth)?;
1051            self.3.encode(encoder, offset + 12, depth)?;
1052            Ok(())
1053        }
1054    }
1055
1056    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1057        for VirtioSoundStartResponse
1058    {
1059        #[inline(always)]
1060        fn new_empty() -> Self {
1061            Self {
1062                features: fidl::new_empty!(u32, D),
1063                jacks: fidl::new_empty!(u32, D),
1064                streams: fidl::new_empty!(u32, D),
1065                chmaps: fidl::new_empty!(u32, D),
1066            }
1067        }
1068
1069        #[inline]
1070        unsafe fn decode(
1071            &mut self,
1072            decoder: &mut fidl::encoding::Decoder<'_, D>,
1073            offset: usize,
1074            _depth: fidl::encoding::Depth,
1075        ) -> fidl::Result<()> {
1076            decoder.debug_check_bounds::<Self>(offset);
1077            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1078            // Verify that padding bytes are zero.
1079            // Copy from the buffer into the object.
1080            unsafe {
1081                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1082            }
1083            Ok(())
1084        }
1085    }
1086
1087    impl fidl::encoding::ValueTypeMarker for VirtioWaylandImporterExportImageRequest {
1088        type Borrowed<'a> = &'a Self;
1089        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1090            value
1091        }
1092    }
1093
1094    unsafe impl fidl::encoding::TypeMarker for VirtioWaylandImporterExportImageRequest {
1095        type Owned = Self;
1096
1097        #[inline(always)]
1098        fn inline_align(_context: fidl::encoding::Context) -> usize {
1099            4
1100        }
1101
1102        #[inline(always)]
1103        fn inline_size(_context: fidl::encoding::Context) -> usize {
1104            4
1105        }
1106        #[inline(always)]
1107        fn encode_is_copy() -> bool {
1108            true
1109        }
1110
1111        #[inline(always)]
1112        fn decode_is_copy() -> bool {
1113            true
1114        }
1115    }
1116
1117    unsafe impl<D: fidl::encoding::ResourceDialect>
1118        fidl::encoding::Encode<VirtioWaylandImporterExportImageRequest, D>
1119        for &VirtioWaylandImporterExportImageRequest
1120    {
1121        #[inline]
1122        unsafe fn encode(
1123            self,
1124            encoder: &mut fidl::encoding::Encoder<'_, D>,
1125            offset: usize,
1126            _depth: fidl::encoding::Depth,
1127        ) -> fidl::Result<()> {
1128            encoder.debug_check_bounds::<VirtioWaylandImporterExportImageRequest>(offset);
1129            unsafe {
1130                // Copy the object into the buffer.
1131                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1132                (buf_ptr as *mut VirtioWaylandImporterExportImageRequest).write_unaligned(
1133                    (self as *const VirtioWaylandImporterExportImageRequest).read(),
1134                );
1135                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1136                // done second because the memcpy will write garbage to these bytes.
1137            }
1138            Ok(())
1139        }
1140    }
1141    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1142        fidl::encoding::Encode<VirtioWaylandImporterExportImageRequest, D> for (T0,)
1143    {
1144        #[inline]
1145        unsafe fn encode(
1146            self,
1147            encoder: &mut fidl::encoding::Encoder<'_, D>,
1148            offset: usize,
1149            depth: fidl::encoding::Depth,
1150        ) -> fidl::Result<()> {
1151            encoder.debug_check_bounds::<VirtioWaylandImporterExportImageRequest>(offset);
1152            // Zero out padding regions. There's no need to apply masks
1153            // because the unmasked parts will be overwritten by fields.
1154            // Write the fields.
1155            self.0.encode(encoder, offset + 0, depth)?;
1156            Ok(())
1157        }
1158    }
1159
1160    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1161        for VirtioWaylandImporterExportImageRequest
1162    {
1163        #[inline(always)]
1164        fn new_empty() -> Self {
1165            Self { vfd_id: fidl::new_empty!(u32, D) }
1166        }
1167
1168        #[inline]
1169        unsafe fn decode(
1170            &mut self,
1171            decoder: &mut fidl::encoding::Decoder<'_, D>,
1172            offset: usize,
1173            _depth: fidl::encoding::Depth,
1174        ) -> fidl::Result<()> {
1175            decoder.debug_check_bounds::<Self>(offset);
1176            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1177            // Verify that padding bytes are zero.
1178            // Copy from the buffer into the object.
1179            unsafe {
1180                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1181            }
1182            Ok(())
1183        }
1184    }
1185
1186    impl fidl::encoding::ValueTypeMarker for VirtioWaylandImporterImportImageResponse {
1187        type Borrowed<'a> = &'a Self;
1188        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1189            value
1190        }
1191    }
1192
1193    unsafe impl fidl::encoding::TypeMarker for VirtioWaylandImporterImportImageResponse {
1194        type Owned = Self;
1195
1196        #[inline(always)]
1197        fn inline_align(_context: fidl::encoding::Context) -> usize {
1198            4
1199        }
1200
1201        #[inline(always)]
1202        fn inline_size(_context: fidl::encoding::Context) -> usize {
1203            4
1204        }
1205        #[inline(always)]
1206        fn encode_is_copy() -> bool {
1207            true
1208        }
1209
1210        #[inline(always)]
1211        fn decode_is_copy() -> bool {
1212            true
1213        }
1214    }
1215
1216    unsafe impl<D: fidl::encoding::ResourceDialect>
1217        fidl::encoding::Encode<VirtioWaylandImporterImportImageResponse, D>
1218        for &VirtioWaylandImporterImportImageResponse
1219    {
1220        #[inline]
1221        unsafe fn encode(
1222            self,
1223            encoder: &mut fidl::encoding::Encoder<'_, D>,
1224            offset: usize,
1225            _depth: fidl::encoding::Depth,
1226        ) -> fidl::Result<()> {
1227            encoder.debug_check_bounds::<VirtioWaylandImporterImportImageResponse>(offset);
1228            unsafe {
1229                // Copy the object into the buffer.
1230                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1231                (buf_ptr as *mut VirtioWaylandImporterImportImageResponse).write_unaligned(
1232                    (self as *const VirtioWaylandImporterImportImageResponse).read(),
1233                );
1234                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1235                // done second because the memcpy will write garbage to these bytes.
1236            }
1237            Ok(())
1238        }
1239    }
1240    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1241        fidl::encoding::Encode<VirtioWaylandImporterImportImageResponse, D> for (T0,)
1242    {
1243        #[inline]
1244        unsafe fn encode(
1245            self,
1246            encoder: &mut fidl::encoding::Encoder<'_, D>,
1247            offset: usize,
1248            depth: fidl::encoding::Depth,
1249        ) -> fidl::Result<()> {
1250            encoder.debug_check_bounds::<VirtioWaylandImporterImportImageResponse>(offset);
1251            // Zero out padding regions. There's no need to apply masks
1252            // because the unmasked parts will be overwritten by fields.
1253            // Write the fields.
1254            self.0.encode(encoder, offset + 0, depth)?;
1255            Ok(())
1256        }
1257    }
1258
1259    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1260        for VirtioWaylandImporterImportImageResponse
1261    {
1262        #[inline(always)]
1263        fn new_empty() -> Self {
1264            Self { vfd_id: fidl::new_empty!(u32, D) }
1265        }
1266
1267        #[inline]
1268        unsafe fn decode(
1269            &mut self,
1270            decoder: &mut fidl::encoding::Decoder<'_, D>,
1271            offset: usize,
1272            _depth: fidl::encoding::Depth,
1273        ) -> fidl::Result<()> {
1274            decoder.debug_check_bounds::<Self>(offset);
1275            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1276            // Verify that padding bytes are zero.
1277            // Copy from the buffer into the object.
1278            unsafe {
1279                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1280            }
1281            Ok(())
1282        }
1283    }
1284}