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