Skip to main content

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