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
125pub mod virtio_balloon_ordinals {
126    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
127    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
128    pub const READY: u64 = 0x45707654f5d23c3f;
129    pub const START: u64 = 0x26645282fddf6f46;
130    pub const GET_MEM_STATS: u64 = 0x6641f4c296607e24;
131}
132
133pub mod virtio_block_ordinals {
134    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
135    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
136    pub const READY: u64 = 0x45707654f5d23c3f;
137    pub const START: u64 = 0x5ef6a4b9ce9adcb2;
138}
139
140pub mod virtio_console_ordinals {
141    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
142    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
143    pub const READY: u64 = 0x45707654f5d23c3f;
144    pub const START: u64 = 0x10a6267f2ab7e24c;
145}
146
147pub mod virtio_device_ordinals {
148    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
149    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
150    pub const READY: u64 = 0x45707654f5d23c3f;
151}
152
153pub mod virtio_gpu_ordinals {
154    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
155    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
156    pub const READY: u64 = 0x45707654f5d23c3f;
157    pub const START: u64 = 0x7e81ed410f770c14;
158    pub const ON_CONFIG_CHANGED: u64 = 0x1555f5b7c8444aa0;
159}
160
161pub mod virtio_input_ordinals {
162    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
163    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
164    pub const READY: u64 = 0x45707654f5d23c3f;
165    pub const START: u64 = 0x612743931f7f9249;
166}
167
168pub mod virtio_magma_ordinals {
169    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
170    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
171    pub const READY: u64 = 0x45707654f5d23c3f;
172    pub const START: u64 = 0x6b94e28f73d201e2;
173}
174
175pub mod virtio_mem_ordinals {
176    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
177    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
178    pub const READY: u64 = 0x45707654f5d23c3f;
179    pub const START: u64 = 0x66dd64f17fb5223c;
180    pub const ON_CONFIG_CHANGED: u64 = 0x73b86d7cc80020b9;
181}
182
183pub mod virtio_net_ordinals {
184    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
185    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
186    pub const READY: u64 = 0x45707654f5d23c3f;
187    pub const START: u64 = 0x795c0b3a8461b3ed;
188}
189
190pub mod virtio_rng_ordinals {
191    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
192    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
193    pub const READY: u64 = 0x45707654f5d23c3f;
194    pub const START: u64 = 0x620b3ed254febc0f;
195}
196
197pub mod virtio_sound_ordinals {
198    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
199    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
200    pub const READY: u64 = 0x45707654f5d23c3f;
201    pub const START: u64 = 0x2c3a5528c0b92e2d;
202}
203
204pub mod virtio_vsock_ordinals {
205    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
206    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
207    pub const READY: u64 = 0x45707654f5d23c3f;
208    pub const START: u64 = 0x56433562cf67ae0f;
209}
210
211pub mod virtio_wayland_ordinals {
212    pub const CONFIGURE_QUEUE: u64 = 0x72b44fb963480b11;
213    pub const NOTIFY_QUEUE: u64 = 0x6e3a61d652499244;
214    pub const READY: u64 = 0x45707654f5d23c3f;
215    pub const START: u64 = 0x1f60e084e30deee6;
216    pub const START_WITH_WAYLAND_SERVER_: u64 = 0x3f2e38dfb60077e9;
217    pub const GET_IMPORTER: u64 = 0x49d1b3c94767a541;
218}
219
220pub mod virtio_wayland_importer_ordinals {
221    pub const IMPORT_IMAGE: u64 = 0x3f8f3f75c34de5c;
222    pub const EXPORT_IMAGE: u64 = 0x25a33daa7c0307c4;
223}
224
225mod internal {
226    use super::*;
227
228    impl fidl::encoding::ValueTypeMarker for Trap {
229        type Borrowed<'a> = &'a Self;
230        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
231            value
232        }
233    }
234
235    unsafe impl fidl::encoding::TypeMarker for Trap {
236        type Owned = Self;
237
238        #[inline(always)]
239        fn inline_align(_context: fidl::encoding::Context) -> usize {
240            8
241        }
242
243        #[inline(always)]
244        fn inline_size(_context: fidl::encoding::Context) -> usize {
245            16
246        }
247        #[inline(always)]
248        fn encode_is_copy() -> bool {
249            true
250        }
251
252        #[inline(always)]
253        fn decode_is_copy() -> bool {
254            true
255        }
256    }
257
258    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Trap, D> for &Trap {
259        #[inline]
260        unsafe fn encode(
261            self,
262            encoder: &mut fidl::encoding::Encoder<'_, D>,
263            offset: usize,
264            _depth: fidl::encoding::Depth,
265        ) -> fidl::Result<()> {
266            encoder.debug_check_bounds::<Trap>(offset);
267            unsafe {
268                // Copy the object into the buffer.
269                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
270                (buf_ptr as *mut Trap).write_unaligned((self as *const Trap).read());
271                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
272                // done second because the memcpy will write garbage to these bytes.
273            }
274            Ok(())
275        }
276    }
277    unsafe impl<
278            D: fidl::encoding::ResourceDialect,
279            T0: fidl::encoding::Encode<u64, D>,
280            T1: fidl::encoding::Encode<u64, D>,
281        > fidl::encoding::Encode<Trap, D> for (T0, T1)
282    {
283        #[inline]
284        unsafe fn encode(
285            self,
286            encoder: &mut fidl::encoding::Encoder<'_, D>,
287            offset: usize,
288            depth: fidl::encoding::Depth,
289        ) -> fidl::Result<()> {
290            encoder.debug_check_bounds::<Trap>(offset);
291            // Zero out padding regions. There's no need to apply masks
292            // because the unmasked parts will be overwritten by fields.
293            // Write the fields.
294            self.0.encode(encoder, offset + 0, depth)?;
295            self.1.encode(encoder, offset + 8, depth)?;
296            Ok(())
297        }
298    }
299
300    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Trap {
301        #[inline(always)]
302        fn new_empty() -> Self {
303            Self { addr: fidl::new_empty!(u64, D), size: fidl::new_empty!(u64, D) }
304        }
305
306        #[inline]
307        unsafe fn decode(
308            &mut self,
309            decoder: &mut fidl::encoding::Decoder<'_, D>,
310            offset: usize,
311            _depth: fidl::encoding::Depth,
312        ) -> fidl::Result<()> {
313            decoder.debug_check_bounds::<Self>(offset);
314            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
315            // Verify that padding bytes are zero.
316            // Copy from the buffer into the object.
317            unsafe {
318                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
319            }
320            Ok(())
321        }
322    }
323
324    impl fidl::encoding::ValueTypeMarker for VirtioBalloonGetMemStatsResponse {
325        type Borrowed<'a> = &'a Self;
326        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
327            value
328        }
329    }
330
331    unsafe impl fidl::encoding::TypeMarker for VirtioBalloonGetMemStatsResponse {
332        type Owned = Self;
333
334        #[inline(always)]
335        fn inline_align(_context: fidl::encoding::Context) -> usize {
336            8
337        }
338
339        #[inline(always)]
340        fn inline_size(_context: fidl::encoding::Context) -> usize {
341            24
342        }
343    }
344
345    unsafe impl<D: fidl::encoding::ResourceDialect>
346        fidl::encoding::Encode<VirtioBalloonGetMemStatsResponse, D>
347        for &VirtioBalloonGetMemStatsResponse
348    {
349        #[inline]
350        unsafe fn encode(
351            self,
352            encoder: &mut fidl::encoding::Encoder<'_, D>,
353            offset: usize,
354            _depth: fidl::encoding::Depth,
355        ) -> fidl::Result<()> {
356            encoder.debug_check_bounds::<VirtioBalloonGetMemStatsResponse>(offset);
357            // Delegate to tuple encoding.
358            fidl::encoding::Encode::<VirtioBalloonGetMemStatsResponse, D>::encode(
359                (
360                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
361                    <fidl::encoding::Optional<
362                        fidl::encoding::UnboundedVector<
363                            fidl_fuchsia_virtualization__common::MemStat,
364                        >,
365                    > as fidl::encoding::ValueTypeMarker>::borrow(
366                        &self.mem_stats
367                    ),
368                ),
369                encoder,
370                offset,
371                _depth,
372            )
373        }
374    }
375    unsafe impl<
376            D: fidl::encoding::ResourceDialect,
377            T0: fidl::encoding::Encode<i32, D>,
378            T1: fidl::encoding::Encode<
379                fidl::encoding::Optional<
380                    fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization__common::MemStat>,
381                >,
382                D,
383            >,
384        > fidl::encoding::Encode<VirtioBalloonGetMemStatsResponse, D> for (T0, T1)
385    {
386        #[inline]
387        unsafe fn encode(
388            self,
389            encoder: &mut fidl::encoding::Encoder<'_, D>,
390            offset: usize,
391            depth: fidl::encoding::Depth,
392        ) -> fidl::Result<()> {
393            encoder.debug_check_bounds::<VirtioBalloonGetMemStatsResponse>(offset);
394            // Zero out padding regions. There's no need to apply masks
395            // because the unmasked parts will be overwritten by fields.
396            unsafe {
397                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
398                (ptr as *mut u64).write_unaligned(0);
399            }
400            // Write the fields.
401            self.0.encode(encoder, offset + 0, depth)?;
402            self.1.encode(encoder, offset + 8, depth)?;
403            Ok(())
404        }
405    }
406
407    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
408        for VirtioBalloonGetMemStatsResponse
409    {
410        #[inline(always)]
411        fn new_empty() -> Self {
412            Self {
413                status: fidl::new_empty!(i32, D),
414                mem_stats: fidl::new_empty!(
415                    fidl::encoding::Optional<
416                        fidl::encoding::UnboundedVector<
417                            fidl_fuchsia_virtualization__common::MemStat,
418                        >,
419                    >,
420                    D
421                ),
422            }
423        }
424
425        #[inline]
426        unsafe fn decode(
427            &mut self,
428            decoder: &mut fidl::encoding::Decoder<'_, D>,
429            offset: usize,
430            _depth: fidl::encoding::Depth,
431        ) -> fidl::Result<()> {
432            decoder.debug_check_bounds::<Self>(offset);
433            // Verify that padding bytes are zero.
434            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
435            let padval = unsafe { (ptr as *const u64).read_unaligned() };
436            let mask = 0xffffffff00000000u64;
437            let maskedval = padval & mask;
438            if maskedval != 0 {
439                return Err(fidl::Error::NonZeroPadding {
440                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
441                });
442            }
443            fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
444            fidl::decode!(
445                fidl::encoding::Optional<
446                    fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization__common::MemStat>,
447                >,
448                D,
449                &mut self.mem_stats,
450                decoder,
451                offset + 8,
452                _depth
453            )?;
454            Ok(())
455        }
456    }
457
458    impl fidl::encoding::ValueTypeMarker for VirtioBlockStartResponse {
459        type Borrowed<'a> = &'a Self;
460        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
461            value
462        }
463    }
464
465    unsafe impl fidl::encoding::TypeMarker for VirtioBlockStartResponse {
466        type Owned = Self;
467
468        #[inline(always)]
469        fn inline_align(_context: fidl::encoding::Context) -> usize {
470            8
471        }
472
473        #[inline(always)]
474        fn inline_size(_context: fidl::encoding::Context) -> usize {
475            16
476        }
477    }
478
479    unsafe impl<D: fidl::encoding::ResourceDialect>
480        fidl::encoding::Encode<VirtioBlockStartResponse, D> for &VirtioBlockStartResponse
481    {
482        #[inline]
483        unsafe fn encode(
484            self,
485            encoder: &mut fidl::encoding::Encoder<'_, D>,
486            offset: usize,
487            _depth: fidl::encoding::Depth,
488        ) -> fidl::Result<()> {
489            encoder.debug_check_bounds::<VirtioBlockStartResponse>(offset);
490            unsafe {
491                // Copy the object into the buffer.
492                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
493                (buf_ptr as *mut VirtioBlockStartResponse)
494                    .write_unaligned((self as *const VirtioBlockStartResponse).read());
495                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
496                // done second because the memcpy will write garbage to these bytes.
497                let padding_ptr = buf_ptr.offset(8) as *mut u64;
498                let padding_mask = 0xffffffff00000000u64;
499                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
500            }
501            Ok(())
502        }
503    }
504    unsafe impl<
505            D: fidl::encoding::ResourceDialect,
506            T0: fidl::encoding::Encode<u64, D>,
507            T1: fidl::encoding::Encode<u32, D>,
508        > fidl::encoding::Encode<VirtioBlockStartResponse, D> for (T0, T1)
509    {
510        #[inline]
511        unsafe fn encode(
512            self,
513            encoder: &mut fidl::encoding::Encoder<'_, D>,
514            offset: usize,
515            depth: fidl::encoding::Depth,
516        ) -> fidl::Result<()> {
517            encoder.debug_check_bounds::<VirtioBlockStartResponse>(offset);
518            // Zero out padding regions. There's no need to apply masks
519            // because the unmasked parts will be overwritten by fields.
520            unsafe {
521                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
522                (ptr as *mut u64).write_unaligned(0);
523            }
524            // Write the fields.
525            self.0.encode(encoder, offset + 0, depth)?;
526            self.1.encode(encoder, offset + 8, depth)?;
527            Ok(())
528        }
529    }
530
531    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
532        for VirtioBlockStartResponse
533    {
534        #[inline(always)]
535        fn new_empty() -> Self {
536            Self { capacity: fidl::new_empty!(u64, D), block_size: fidl::new_empty!(u32, D) }
537        }
538
539        #[inline]
540        unsafe fn decode(
541            &mut self,
542            decoder: &mut fidl::encoding::Decoder<'_, D>,
543            offset: usize,
544            _depth: fidl::encoding::Depth,
545        ) -> fidl::Result<()> {
546            decoder.debug_check_bounds::<Self>(offset);
547            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
548            // Verify that padding bytes are zero.
549            let ptr = unsafe { buf_ptr.offset(8) };
550            let padval = unsafe { (ptr as *const u64).read_unaligned() };
551            let mask = 0xffffffff00000000u64;
552            let maskedval = padval & mask;
553            if maskedval != 0 {
554                return Err(fidl::Error::NonZeroPadding {
555                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
556                });
557            }
558            // Copy from the buffer into the object.
559            unsafe {
560                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
561            }
562            Ok(())
563        }
564    }
565
566    impl fidl::encoding::ValueTypeMarker for VirtioDeviceConfigureQueueRequest {
567        type Borrowed<'a> = &'a Self;
568        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
569            value
570        }
571    }
572
573    unsafe impl fidl::encoding::TypeMarker for VirtioDeviceConfigureQueueRequest {
574        type Owned = Self;
575
576        #[inline(always)]
577        fn inline_align(_context: fidl::encoding::Context) -> usize {
578            8
579        }
580
581        #[inline(always)]
582        fn inline_size(_context: fidl::encoding::Context) -> usize {
583            32
584        }
585    }
586
587    unsafe impl<D: fidl::encoding::ResourceDialect>
588        fidl::encoding::Encode<VirtioDeviceConfigureQueueRequest, D>
589        for &VirtioDeviceConfigureQueueRequest
590    {
591        #[inline]
592        unsafe fn encode(
593            self,
594            encoder: &mut fidl::encoding::Encoder<'_, D>,
595            offset: usize,
596            _depth: fidl::encoding::Depth,
597        ) -> fidl::Result<()> {
598            encoder.debug_check_bounds::<VirtioDeviceConfigureQueueRequest>(offset);
599            unsafe {
600                // Copy the object into the buffer.
601                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
602                (buf_ptr as *mut VirtioDeviceConfigureQueueRequest)
603                    .write_unaligned((self as *const VirtioDeviceConfigureQueueRequest).read());
604                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
605                // done second because the memcpy will write garbage to these bytes.
606                let padding_ptr = buf_ptr.offset(0) as *mut u64;
607                let padding_mask = 0xffffffff00000000u64;
608                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
609            }
610            Ok(())
611        }
612    }
613    unsafe impl<
614            D: fidl::encoding::ResourceDialect,
615            T0: fidl::encoding::Encode<u16, D>,
616            T1: fidl::encoding::Encode<u16, D>,
617            T2: fidl::encoding::Encode<u64, D>,
618            T3: fidl::encoding::Encode<u64, D>,
619            T4: fidl::encoding::Encode<u64, D>,
620        > fidl::encoding::Encode<VirtioDeviceConfigureQueueRequest, D> for (T0, T1, T2, T3, T4)
621    {
622        #[inline]
623        unsafe fn encode(
624            self,
625            encoder: &mut fidl::encoding::Encoder<'_, D>,
626            offset: usize,
627            depth: fidl::encoding::Depth,
628        ) -> fidl::Result<()> {
629            encoder.debug_check_bounds::<VirtioDeviceConfigureQueueRequest>(offset);
630            // Zero out padding regions. There's no need to apply masks
631            // because the unmasked parts will be overwritten by fields.
632            unsafe {
633                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
634                (ptr as *mut u64).write_unaligned(0);
635            }
636            // Write the fields.
637            self.0.encode(encoder, offset + 0, depth)?;
638            self.1.encode(encoder, offset + 2, depth)?;
639            self.2.encode(encoder, offset + 8, depth)?;
640            self.3.encode(encoder, offset + 16, depth)?;
641            self.4.encode(encoder, offset + 24, depth)?;
642            Ok(())
643        }
644    }
645
646    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
647        for VirtioDeviceConfigureQueueRequest
648    {
649        #[inline(always)]
650        fn new_empty() -> Self {
651            Self {
652                queue: fidl::new_empty!(u16, D),
653                size: fidl::new_empty!(u16, D),
654                desc: fidl::new_empty!(u64, D),
655                avail: fidl::new_empty!(u64, D),
656                used: fidl::new_empty!(u64, D),
657            }
658        }
659
660        #[inline]
661        unsafe fn decode(
662            &mut self,
663            decoder: &mut fidl::encoding::Decoder<'_, D>,
664            offset: usize,
665            _depth: fidl::encoding::Depth,
666        ) -> fidl::Result<()> {
667            decoder.debug_check_bounds::<Self>(offset);
668            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
669            // Verify that padding bytes are zero.
670            let ptr = unsafe { buf_ptr.offset(0) };
671            let padval = unsafe { (ptr as *const u64).read_unaligned() };
672            let mask = 0xffffffff00000000u64;
673            let maskedval = padval & mask;
674            if maskedval != 0 {
675                return Err(fidl::Error::NonZeroPadding {
676                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
677                });
678            }
679            // Copy from the buffer into the object.
680            unsafe {
681                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
682            }
683            Ok(())
684        }
685    }
686
687    impl fidl::encoding::ValueTypeMarker for VirtioDeviceNotifyQueueRequest {
688        type Borrowed<'a> = &'a Self;
689        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
690            value
691        }
692    }
693
694    unsafe impl fidl::encoding::TypeMarker for VirtioDeviceNotifyQueueRequest {
695        type Owned = Self;
696
697        #[inline(always)]
698        fn inline_align(_context: fidl::encoding::Context) -> usize {
699            2
700        }
701
702        #[inline(always)]
703        fn inline_size(_context: fidl::encoding::Context) -> usize {
704            2
705        }
706        #[inline(always)]
707        fn encode_is_copy() -> bool {
708            true
709        }
710
711        #[inline(always)]
712        fn decode_is_copy() -> bool {
713            true
714        }
715    }
716
717    unsafe impl<D: fidl::encoding::ResourceDialect>
718        fidl::encoding::Encode<VirtioDeviceNotifyQueueRequest, D>
719        for &VirtioDeviceNotifyQueueRequest
720    {
721        #[inline]
722        unsafe fn encode(
723            self,
724            encoder: &mut fidl::encoding::Encoder<'_, D>,
725            offset: usize,
726            _depth: fidl::encoding::Depth,
727        ) -> fidl::Result<()> {
728            encoder.debug_check_bounds::<VirtioDeviceNotifyQueueRequest>(offset);
729            unsafe {
730                // Copy the object into the buffer.
731                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
732                (buf_ptr as *mut VirtioDeviceNotifyQueueRequest)
733                    .write_unaligned((self as *const VirtioDeviceNotifyQueueRequest).read());
734                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
735                // done second because the memcpy will write garbage to these bytes.
736            }
737            Ok(())
738        }
739    }
740    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
741        fidl::encoding::Encode<VirtioDeviceNotifyQueueRequest, D> for (T0,)
742    {
743        #[inline]
744        unsafe fn encode(
745            self,
746            encoder: &mut fidl::encoding::Encoder<'_, D>,
747            offset: usize,
748            depth: fidl::encoding::Depth,
749        ) -> fidl::Result<()> {
750            encoder.debug_check_bounds::<VirtioDeviceNotifyQueueRequest>(offset);
751            // Zero out padding regions. There's no need to apply masks
752            // because the unmasked parts will be overwritten by fields.
753            // Write the fields.
754            self.0.encode(encoder, offset + 0, depth)?;
755            Ok(())
756        }
757    }
758
759    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
760        for VirtioDeviceNotifyQueueRequest
761    {
762        #[inline(always)]
763        fn new_empty() -> Self {
764            Self { queue: fidl::new_empty!(u16, D) }
765        }
766
767        #[inline]
768        unsafe fn decode(
769            &mut self,
770            decoder: &mut fidl::encoding::Decoder<'_, D>,
771            offset: usize,
772            _depth: fidl::encoding::Depth,
773        ) -> fidl::Result<()> {
774            decoder.debug_check_bounds::<Self>(offset);
775            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
776            // Verify that padding bytes are zero.
777            // Copy from the buffer into the object.
778            unsafe {
779                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
780            }
781            Ok(())
782        }
783    }
784
785    impl fidl::encoding::ValueTypeMarker for VirtioDeviceReadyRequest {
786        type Borrowed<'a> = &'a Self;
787        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
788            value
789        }
790    }
791
792    unsafe impl fidl::encoding::TypeMarker for VirtioDeviceReadyRequest {
793        type Owned = Self;
794
795        #[inline(always)]
796        fn inline_align(_context: fidl::encoding::Context) -> usize {
797            4
798        }
799
800        #[inline(always)]
801        fn inline_size(_context: fidl::encoding::Context) -> usize {
802            4
803        }
804        #[inline(always)]
805        fn encode_is_copy() -> bool {
806            true
807        }
808
809        #[inline(always)]
810        fn decode_is_copy() -> bool {
811            true
812        }
813    }
814
815    unsafe impl<D: fidl::encoding::ResourceDialect>
816        fidl::encoding::Encode<VirtioDeviceReadyRequest, D> for &VirtioDeviceReadyRequest
817    {
818        #[inline]
819        unsafe fn encode(
820            self,
821            encoder: &mut fidl::encoding::Encoder<'_, D>,
822            offset: usize,
823            _depth: fidl::encoding::Depth,
824        ) -> fidl::Result<()> {
825            encoder.debug_check_bounds::<VirtioDeviceReadyRequest>(offset);
826            unsafe {
827                // Copy the object into the buffer.
828                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
829                (buf_ptr as *mut VirtioDeviceReadyRequest)
830                    .write_unaligned((self as *const VirtioDeviceReadyRequest).read());
831                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
832                // done second because the memcpy will write garbage to these bytes.
833            }
834            Ok(())
835        }
836    }
837    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
838        fidl::encoding::Encode<VirtioDeviceReadyRequest, D> for (T0,)
839    {
840        #[inline]
841        unsafe fn encode(
842            self,
843            encoder: &mut fidl::encoding::Encoder<'_, D>,
844            offset: usize,
845            depth: fidl::encoding::Depth,
846        ) -> fidl::Result<()> {
847            encoder.debug_check_bounds::<VirtioDeviceReadyRequest>(offset);
848            // Zero out padding regions. There's no need to apply masks
849            // because the unmasked parts will be overwritten by fields.
850            // Write the fields.
851            self.0.encode(encoder, offset + 0, depth)?;
852            Ok(())
853        }
854    }
855
856    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
857        for VirtioDeviceReadyRequest
858    {
859        #[inline(always)]
860        fn new_empty() -> Self {
861            Self { negotiated_features: fidl::new_empty!(u32, D) }
862        }
863
864        #[inline]
865        unsafe fn decode(
866            &mut self,
867            decoder: &mut fidl::encoding::Decoder<'_, D>,
868            offset: usize,
869            _depth: fidl::encoding::Depth,
870        ) -> fidl::Result<()> {
871            decoder.debug_check_bounds::<Self>(offset);
872            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
873            // Verify that padding bytes are zero.
874            // Copy from the buffer into the object.
875            unsafe {
876                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
877            }
878            Ok(())
879        }
880    }
881
882    impl fidl::encoding::ValueTypeMarker for VirtioMagmaStartResponse {
883        type Borrowed<'a> = &'a Self;
884        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
885            value
886        }
887    }
888
889    unsafe impl fidl::encoding::TypeMarker for VirtioMagmaStartResponse {
890        type Owned = Self;
891
892        #[inline(always)]
893        fn inline_align(_context: fidl::encoding::Context) -> usize {
894            4
895        }
896
897        #[inline(always)]
898        fn inline_size(_context: fidl::encoding::Context) -> usize {
899            4
900        }
901        #[inline(always)]
902        fn encode_is_copy() -> bool {
903            true
904        }
905
906        #[inline(always)]
907        fn decode_is_copy() -> bool {
908            true
909        }
910    }
911
912    unsafe impl<D: fidl::encoding::ResourceDialect>
913        fidl::encoding::Encode<VirtioMagmaStartResponse, D> for &VirtioMagmaStartResponse
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::<VirtioMagmaStartResponse>(offset);
923            unsafe {
924                // Copy the object into the buffer.
925                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
926                (buf_ptr as *mut VirtioMagmaStartResponse)
927                    .write_unaligned((self as *const VirtioMagmaStartResponse).read());
928                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
929                // done second because the memcpy will write garbage to these bytes.
930            }
931            Ok(())
932        }
933    }
934    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
935        fidl::encoding::Encode<VirtioMagmaStartResponse, D> for (T0,)
936    {
937        #[inline]
938        unsafe fn encode(
939            self,
940            encoder: &mut fidl::encoding::Encoder<'_, D>,
941            offset: usize,
942            depth: fidl::encoding::Depth,
943        ) -> fidl::Result<()> {
944            encoder.debug_check_bounds::<VirtioMagmaStartResponse>(offset);
945            // Zero out padding regions. There's no need to apply masks
946            // because the unmasked parts will be overwritten by fields.
947            // Write the fields.
948            self.0.encode(encoder, offset + 0, depth)?;
949            Ok(())
950        }
951    }
952
953    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
954        for VirtioMagmaStartResponse
955    {
956        #[inline(always)]
957        fn new_empty() -> Self {
958            Self { status: fidl::new_empty!(i32, D) }
959        }
960
961        #[inline]
962        unsafe fn decode(
963            &mut self,
964            decoder: &mut fidl::encoding::Decoder<'_, D>,
965            offset: usize,
966            _depth: fidl::encoding::Depth,
967        ) -> fidl::Result<()> {
968            decoder.debug_check_bounds::<Self>(offset);
969            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
970            // Verify that padding bytes are zero.
971            // Copy from the buffer into the object.
972            unsafe {
973                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
974            }
975            Ok(())
976        }
977    }
978
979    impl fidl::encoding::ValueTypeMarker for VirtioMemOnConfigChangedRequest {
980        type Borrowed<'a> = &'a Self;
981        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
982            value
983        }
984    }
985
986    unsafe impl fidl::encoding::TypeMarker for VirtioMemOnConfigChangedRequest {
987        type Owned = Self;
988
989        #[inline(always)]
990        fn inline_align(_context: fidl::encoding::Context) -> usize {
991            8
992        }
993
994        #[inline(always)]
995        fn inline_size(_context: fidl::encoding::Context) -> usize {
996            8
997        }
998        #[inline(always)]
999        fn encode_is_copy() -> bool {
1000            true
1001        }
1002
1003        #[inline(always)]
1004        fn decode_is_copy() -> bool {
1005            true
1006        }
1007    }
1008
1009    unsafe impl<D: fidl::encoding::ResourceDialect>
1010        fidl::encoding::Encode<VirtioMemOnConfigChangedRequest, D>
1011        for &VirtioMemOnConfigChangedRequest
1012    {
1013        #[inline]
1014        unsafe fn encode(
1015            self,
1016            encoder: &mut fidl::encoding::Encoder<'_, D>,
1017            offset: usize,
1018            _depth: fidl::encoding::Depth,
1019        ) -> fidl::Result<()> {
1020            encoder.debug_check_bounds::<VirtioMemOnConfigChangedRequest>(offset);
1021            unsafe {
1022                // Copy the object into the buffer.
1023                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1024                (buf_ptr as *mut VirtioMemOnConfigChangedRequest)
1025                    .write_unaligned((self as *const VirtioMemOnConfigChangedRequest).read());
1026                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1027                // done second because the memcpy will write garbage to these bytes.
1028            }
1029            Ok(())
1030        }
1031    }
1032    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1033        fidl::encoding::Encode<VirtioMemOnConfigChangedRequest, D> for (T0,)
1034    {
1035        #[inline]
1036        unsafe fn encode(
1037            self,
1038            encoder: &mut fidl::encoding::Encoder<'_, D>,
1039            offset: usize,
1040            depth: fidl::encoding::Depth,
1041        ) -> fidl::Result<()> {
1042            encoder.debug_check_bounds::<VirtioMemOnConfigChangedRequest>(offset);
1043            // Zero out padding regions. There's no need to apply masks
1044            // because the unmasked parts will be overwritten by fields.
1045            // Write the fields.
1046            self.0.encode(encoder, offset + 0, depth)?;
1047            Ok(())
1048        }
1049    }
1050
1051    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1052        for VirtioMemOnConfigChangedRequest
1053    {
1054        #[inline(always)]
1055        fn new_empty() -> Self {
1056            Self { plugged_size: fidl::new_empty!(u64, D) }
1057        }
1058
1059        #[inline]
1060        unsafe fn decode(
1061            &mut self,
1062            decoder: &mut fidl::encoding::Decoder<'_, D>,
1063            offset: usize,
1064            _depth: fidl::encoding::Depth,
1065        ) -> fidl::Result<()> {
1066            decoder.debug_check_bounds::<Self>(offset);
1067            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1068            // Verify that padding bytes are zero.
1069            // Copy from the buffer into the object.
1070            unsafe {
1071                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1072            }
1073            Ok(())
1074        }
1075    }
1076
1077    impl fidl::encoding::ValueTypeMarker for VirtioSoundStartResponse {
1078        type Borrowed<'a> = &'a Self;
1079        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1080            value
1081        }
1082    }
1083
1084    unsafe impl fidl::encoding::TypeMarker for VirtioSoundStartResponse {
1085        type Owned = Self;
1086
1087        #[inline(always)]
1088        fn inline_align(_context: fidl::encoding::Context) -> usize {
1089            4
1090        }
1091
1092        #[inline(always)]
1093        fn inline_size(_context: fidl::encoding::Context) -> usize {
1094            16
1095        }
1096        #[inline(always)]
1097        fn encode_is_copy() -> bool {
1098            true
1099        }
1100
1101        #[inline(always)]
1102        fn decode_is_copy() -> bool {
1103            true
1104        }
1105    }
1106
1107    unsafe impl<D: fidl::encoding::ResourceDialect>
1108        fidl::encoding::Encode<VirtioSoundStartResponse, D> for &VirtioSoundStartResponse
1109    {
1110        #[inline]
1111        unsafe fn encode(
1112            self,
1113            encoder: &mut fidl::encoding::Encoder<'_, D>,
1114            offset: usize,
1115            _depth: fidl::encoding::Depth,
1116        ) -> fidl::Result<()> {
1117            encoder.debug_check_bounds::<VirtioSoundStartResponse>(offset);
1118            unsafe {
1119                // Copy the object into the buffer.
1120                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1121                (buf_ptr as *mut VirtioSoundStartResponse)
1122                    .write_unaligned((self as *const VirtioSoundStartResponse).read());
1123                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1124                // done second because the memcpy will write garbage to these bytes.
1125            }
1126            Ok(())
1127        }
1128    }
1129    unsafe impl<
1130            D: fidl::encoding::ResourceDialect,
1131            T0: fidl::encoding::Encode<u32, D>,
1132            T1: fidl::encoding::Encode<u32, D>,
1133            T2: fidl::encoding::Encode<u32, D>,
1134            T3: fidl::encoding::Encode<u32, D>,
1135        > fidl::encoding::Encode<VirtioSoundStartResponse, D> for (T0, T1, T2, T3)
1136    {
1137        #[inline]
1138        unsafe fn encode(
1139            self,
1140            encoder: &mut fidl::encoding::Encoder<'_, D>,
1141            offset: usize,
1142            depth: fidl::encoding::Depth,
1143        ) -> fidl::Result<()> {
1144            encoder.debug_check_bounds::<VirtioSoundStartResponse>(offset);
1145            // Zero out padding regions. There's no need to apply masks
1146            // because the unmasked parts will be overwritten by fields.
1147            // Write the fields.
1148            self.0.encode(encoder, offset + 0, depth)?;
1149            self.1.encode(encoder, offset + 4, depth)?;
1150            self.2.encode(encoder, offset + 8, depth)?;
1151            self.3.encode(encoder, offset + 12, depth)?;
1152            Ok(())
1153        }
1154    }
1155
1156    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1157        for VirtioSoundStartResponse
1158    {
1159        #[inline(always)]
1160        fn new_empty() -> Self {
1161            Self {
1162                features: fidl::new_empty!(u32, D),
1163                jacks: fidl::new_empty!(u32, D),
1164                streams: fidl::new_empty!(u32, D),
1165                chmaps: fidl::new_empty!(u32, D),
1166            }
1167        }
1168
1169        #[inline]
1170        unsafe fn decode(
1171            &mut self,
1172            decoder: &mut fidl::encoding::Decoder<'_, D>,
1173            offset: usize,
1174            _depth: fidl::encoding::Depth,
1175        ) -> fidl::Result<()> {
1176            decoder.debug_check_bounds::<Self>(offset);
1177            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1178            // Verify that padding bytes are zero.
1179            // Copy from the buffer into the object.
1180            unsafe {
1181                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1182            }
1183            Ok(())
1184        }
1185    }
1186
1187    impl fidl::encoding::ValueTypeMarker for VirtioWaylandImporterExportImageRequest {
1188        type Borrowed<'a> = &'a Self;
1189        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1190            value
1191        }
1192    }
1193
1194    unsafe impl fidl::encoding::TypeMarker for VirtioWaylandImporterExportImageRequest {
1195        type Owned = Self;
1196
1197        #[inline(always)]
1198        fn inline_align(_context: fidl::encoding::Context) -> usize {
1199            4
1200        }
1201
1202        #[inline(always)]
1203        fn inline_size(_context: fidl::encoding::Context) -> usize {
1204            4
1205        }
1206        #[inline(always)]
1207        fn encode_is_copy() -> bool {
1208            true
1209        }
1210
1211        #[inline(always)]
1212        fn decode_is_copy() -> bool {
1213            true
1214        }
1215    }
1216
1217    unsafe impl<D: fidl::encoding::ResourceDialect>
1218        fidl::encoding::Encode<VirtioWaylandImporterExportImageRequest, D>
1219        for &VirtioWaylandImporterExportImageRequest
1220    {
1221        #[inline]
1222        unsafe fn encode(
1223            self,
1224            encoder: &mut fidl::encoding::Encoder<'_, D>,
1225            offset: usize,
1226            _depth: fidl::encoding::Depth,
1227        ) -> fidl::Result<()> {
1228            encoder.debug_check_bounds::<VirtioWaylandImporterExportImageRequest>(offset);
1229            unsafe {
1230                // Copy the object into the buffer.
1231                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1232                (buf_ptr as *mut VirtioWaylandImporterExportImageRequest).write_unaligned(
1233                    (self as *const VirtioWaylandImporterExportImageRequest).read(),
1234                );
1235                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1236                // done second because the memcpy will write garbage to these bytes.
1237            }
1238            Ok(())
1239        }
1240    }
1241    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1242        fidl::encoding::Encode<VirtioWaylandImporterExportImageRequest, D> for (T0,)
1243    {
1244        #[inline]
1245        unsafe fn encode(
1246            self,
1247            encoder: &mut fidl::encoding::Encoder<'_, D>,
1248            offset: usize,
1249            depth: fidl::encoding::Depth,
1250        ) -> fidl::Result<()> {
1251            encoder.debug_check_bounds::<VirtioWaylandImporterExportImageRequest>(offset);
1252            // Zero out padding regions. There's no need to apply masks
1253            // because the unmasked parts will be overwritten by fields.
1254            // Write the fields.
1255            self.0.encode(encoder, offset + 0, depth)?;
1256            Ok(())
1257        }
1258    }
1259
1260    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1261        for VirtioWaylandImporterExportImageRequest
1262    {
1263        #[inline(always)]
1264        fn new_empty() -> Self {
1265            Self { vfd_id: fidl::new_empty!(u32, D) }
1266        }
1267
1268        #[inline]
1269        unsafe fn decode(
1270            &mut self,
1271            decoder: &mut fidl::encoding::Decoder<'_, D>,
1272            offset: usize,
1273            _depth: fidl::encoding::Depth,
1274        ) -> fidl::Result<()> {
1275            decoder.debug_check_bounds::<Self>(offset);
1276            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1277            // Verify that padding bytes are zero.
1278            // Copy from the buffer into the object.
1279            unsafe {
1280                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1281            }
1282            Ok(())
1283        }
1284    }
1285
1286    impl fidl::encoding::ValueTypeMarker for VirtioWaylandImporterImportImageResponse {
1287        type Borrowed<'a> = &'a Self;
1288        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1289            value
1290        }
1291    }
1292
1293    unsafe impl fidl::encoding::TypeMarker for VirtioWaylandImporterImportImageResponse {
1294        type Owned = Self;
1295
1296        #[inline(always)]
1297        fn inline_align(_context: fidl::encoding::Context) -> usize {
1298            4
1299        }
1300
1301        #[inline(always)]
1302        fn inline_size(_context: fidl::encoding::Context) -> usize {
1303            4
1304        }
1305        #[inline(always)]
1306        fn encode_is_copy() -> bool {
1307            true
1308        }
1309
1310        #[inline(always)]
1311        fn decode_is_copy() -> bool {
1312            true
1313        }
1314    }
1315
1316    unsafe impl<D: fidl::encoding::ResourceDialect>
1317        fidl::encoding::Encode<VirtioWaylandImporterImportImageResponse, D>
1318        for &VirtioWaylandImporterImportImageResponse
1319    {
1320        #[inline]
1321        unsafe fn encode(
1322            self,
1323            encoder: &mut fidl::encoding::Encoder<'_, D>,
1324            offset: usize,
1325            _depth: fidl::encoding::Depth,
1326        ) -> fidl::Result<()> {
1327            encoder.debug_check_bounds::<VirtioWaylandImporterImportImageResponse>(offset);
1328            unsafe {
1329                // Copy the object into the buffer.
1330                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1331                (buf_ptr as *mut VirtioWaylandImporterImportImageResponse).write_unaligned(
1332                    (self as *const VirtioWaylandImporterImportImageResponse).read(),
1333                );
1334                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1335                // done second because the memcpy will write garbage to these bytes.
1336            }
1337            Ok(())
1338        }
1339    }
1340    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1341        fidl::encoding::Encode<VirtioWaylandImporterImportImageResponse, D> for (T0,)
1342    {
1343        #[inline]
1344        unsafe fn encode(
1345            self,
1346            encoder: &mut fidl::encoding::Encoder<'_, D>,
1347            offset: usize,
1348            depth: fidl::encoding::Depth,
1349        ) -> fidl::Result<()> {
1350            encoder.debug_check_bounds::<VirtioWaylandImporterImportImageResponse>(offset);
1351            // Zero out padding regions. There's no need to apply masks
1352            // because the unmasked parts will be overwritten by fields.
1353            // Write the fields.
1354            self.0.encode(encoder, offset + 0, depth)?;
1355            Ok(())
1356        }
1357    }
1358
1359    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1360        for VirtioWaylandImporterImportImageResponse
1361    {
1362        #[inline(always)]
1363        fn new_empty() -> Self {
1364            Self { vfd_id: fidl::new_empty!(u32, D) }
1365        }
1366
1367        #[inline]
1368        unsafe fn decode(
1369            &mut self,
1370            decoder: &mut fidl::encoding::Decoder<'_, D>,
1371            offset: usize,
1372            _depth: fidl::encoding::Depth,
1373        ) -> fidl::Result<()> {
1374            decoder.debug_check_bounds::<Self>(offset);
1375            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1376            // Verify that padding bytes are zero.
1377            // Copy from the buffer into the object.
1378            unsafe {
1379                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1380            }
1381            Ok(())
1382        }
1383    }
1384}