1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const DEVICE_DESC_SIZE: u32 = 18;
13
14pub const MAX_CONFIG_DESC_SIZE: u32 = 65536;
16
17pub const MAX_STRING_DESC_SIZE: u32 = 384;
19
20#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
21#[repr(C)]
22pub struct DeviceGetConfigurationDescriptorRequest {
23 pub config: u8,
24}
25
26impl fidl::Persistable for DeviceGetConfigurationDescriptorRequest {}
27
28#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
29pub struct DeviceGetConfigurationDescriptorResponse {
30 pub s: i32,
31 pub desc: Vec<u8>,
32}
33
34impl fidl::Persistable for DeviceGetConfigurationDescriptorResponse {}
35
36#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
37#[repr(C)]
38pub struct DeviceGetConfigurationDescriptorSizeRequest {
39 pub config: u8,
40}
41
42impl fidl::Persistable for DeviceGetConfigurationDescriptorSizeRequest {}
43
44#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
45#[repr(C)]
46pub struct DeviceGetConfigurationDescriptorSizeResponse {
47 pub s: i32,
48 pub size: u16,
49}
50
51impl fidl::Persistable for DeviceGetConfigurationDescriptorSizeResponse {}
52
53#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
54#[repr(C)]
55pub struct DeviceGetConfigurationResponse {
56 pub configuration: u8,
57}
58
59impl fidl::Persistable for DeviceGetConfigurationResponse {}
60
61#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
62#[repr(C)]
63pub struct DeviceGetDeviceDescriptorResponse {
64 pub desc: [u8; 18],
65}
66
67impl fidl::Persistable for DeviceGetDeviceDescriptorResponse {}
68
69#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70#[repr(C)]
71pub struct DeviceGetDeviceIdResponse {
72 pub device_id: u32,
73}
74
75impl fidl::Persistable for DeviceGetDeviceIdResponse {}
76
77#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
78#[repr(C)]
79pub struct DeviceGetDeviceSpeedResponse {
80 pub speed: u32,
81}
82
83impl fidl::Persistable for DeviceGetDeviceSpeedResponse {}
84
85#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86#[repr(C)]
87pub struct DeviceGetHubDeviceIdResponse {
88 pub hub_device_id: u32,
89}
90
91impl fidl::Persistable for DeviceGetHubDeviceIdResponse {}
92
93#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
94#[repr(C)]
95pub struct DeviceGetStringDescriptorRequest {
96 pub desc_id: u8,
97 pub lang_id: u16,
98}
99
100impl fidl::Persistable for DeviceGetStringDescriptorRequest {}
101
102#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
103pub struct DeviceGetStringDescriptorResponse {
104 pub s: i32,
105 pub desc: String,
106 pub actual_lang_id: u16,
107}
108
109impl fidl::Persistable for DeviceGetStringDescriptorResponse {}
110
111#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
112#[repr(C)]
113pub struct DeviceSetConfigurationRequest {
114 pub configuration: u8,
115}
116
117impl fidl::Persistable for DeviceSetConfigurationRequest {}
118
119#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
120#[repr(C)]
121pub struct DeviceSetConfigurationResponse {
122 pub s: i32,
123}
124
125impl fidl::Persistable for DeviceSetConfigurationResponse {}
126
127#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
128#[repr(C)]
129pub struct DeviceSetInterfaceRequest {
130 pub interface_number: u8,
131 pub alt_setting: u8,
132}
133
134impl fidl::Persistable for DeviceSetInterfaceRequest {}
135
136#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
137#[repr(C)]
138pub struct DeviceSetInterfaceResponse {
139 pub s: i32,
140}
141
142impl fidl::Persistable for DeviceSetInterfaceResponse {}
143
144mod internal {
145 use super::*;
146
147 impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationDescriptorRequest {
148 type Borrowed<'a> = &'a Self;
149 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
150 value
151 }
152 }
153
154 unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationDescriptorRequest {
155 type Owned = Self;
156
157 #[inline(always)]
158 fn inline_align(_context: fidl::encoding::Context) -> usize {
159 1
160 }
161
162 #[inline(always)]
163 fn inline_size(_context: fidl::encoding::Context) -> usize {
164 1
165 }
166 #[inline(always)]
167 fn encode_is_copy() -> bool {
168 true
169 }
170
171 #[inline(always)]
172 fn decode_is_copy() -> bool {
173 true
174 }
175 }
176
177 unsafe impl<D: fidl::encoding::ResourceDialect>
178 fidl::encoding::Encode<DeviceGetConfigurationDescriptorRequest, D>
179 for &DeviceGetConfigurationDescriptorRequest
180 {
181 #[inline]
182 unsafe fn encode(
183 self,
184 encoder: &mut fidl::encoding::Encoder<'_, D>,
185 offset: usize,
186 _depth: fidl::encoding::Depth,
187 ) -> fidl::Result<()> {
188 encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorRequest>(offset);
189 unsafe {
190 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
192 (buf_ptr as *mut DeviceGetConfigurationDescriptorRequest).write_unaligned(
193 (self as *const DeviceGetConfigurationDescriptorRequest).read(),
194 );
195 }
198 Ok(())
199 }
200 }
201 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
202 fidl::encoding::Encode<DeviceGetConfigurationDescriptorRequest, D> for (T0,)
203 {
204 #[inline]
205 unsafe fn encode(
206 self,
207 encoder: &mut fidl::encoding::Encoder<'_, D>,
208 offset: usize,
209 depth: fidl::encoding::Depth,
210 ) -> fidl::Result<()> {
211 encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorRequest>(offset);
212 self.0.encode(encoder, offset + 0, depth)?;
216 Ok(())
217 }
218 }
219
220 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
221 for DeviceGetConfigurationDescriptorRequest
222 {
223 #[inline(always)]
224 fn new_empty() -> Self {
225 Self { config: fidl::new_empty!(u8, D) }
226 }
227
228 #[inline]
229 unsafe fn decode(
230 &mut self,
231 decoder: &mut fidl::encoding::Decoder<'_, D>,
232 offset: usize,
233 _depth: fidl::encoding::Depth,
234 ) -> fidl::Result<()> {
235 decoder.debug_check_bounds::<Self>(offset);
236 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
237 unsafe {
240 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
241 }
242 Ok(())
243 }
244 }
245
246 impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationDescriptorResponse {
247 type Borrowed<'a> = &'a Self;
248 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
249 value
250 }
251 }
252
253 unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationDescriptorResponse {
254 type Owned = Self;
255
256 #[inline(always)]
257 fn inline_align(_context: fidl::encoding::Context) -> usize {
258 8
259 }
260
261 #[inline(always)]
262 fn inline_size(_context: fidl::encoding::Context) -> usize {
263 24
264 }
265 }
266
267 unsafe impl<D: fidl::encoding::ResourceDialect>
268 fidl::encoding::Encode<DeviceGetConfigurationDescriptorResponse, D>
269 for &DeviceGetConfigurationDescriptorResponse
270 {
271 #[inline]
272 unsafe fn encode(
273 self,
274 encoder: &mut fidl::encoding::Encoder<'_, D>,
275 offset: usize,
276 _depth: fidl::encoding::Depth,
277 ) -> fidl::Result<()> {
278 encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorResponse>(offset);
279 fidl::encoding::Encode::<DeviceGetConfigurationDescriptorResponse, D>::encode(
281 (
282 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.s),
283 <fidl::encoding::Vector<u8, 65536> as fidl::encoding::ValueTypeMarker>::borrow(
284 &self.desc,
285 ),
286 ),
287 encoder,
288 offset,
289 _depth,
290 )
291 }
292 }
293 unsafe impl<
294 D: fidl::encoding::ResourceDialect,
295 T0: fidl::encoding::Encode<i32, D>,
296 T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 65536>, D>,
297 > fidl::encoding::Encode<DeviceGetConfigurationDescriptorResponse, D> for (T0, T1)
298 {
299 #[inline]
300 unsafe fn encode(
301 self,
302 encoder: &mut fidl::encoding::Encoder<'_, D>,
303 offset: usize,
304 depth: fidl::encoding::Depth,
305 ) -> fidl::Result<()> {
306 encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorResponse>(offset);
307 unsafe {
310 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
311 (ptr as *mut u64).write_unaligned(0);
312 }
313 self.0.encode(encoder, offset + 0, depth)?;
315 self.1.encode(encoder, offset + 8, depth)?;
316 Ok(())
317 }
318 }
319
320 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
321 for DeviceGetConfigurationDescriptorResponse
322 {
323 #[inline(always)]
324 fn new_empty() -> Self {
325 Self {
326 s: fidl::new_empty!(i32, D),
327 desc: fidl::new_empty!(fidl::encoding::Vector<u8, 65536>, D),
328 }
329 }
330
331 #[inline]
332 unsafe fn decode(
333 &mut self,
334 decoder: &mut fidl::encoding::Decoder<'_, D>,
335 offset: usize,
336 _depth: fidl::encoding::Depth,
337 ) -> fidl::Result<()> {
338 decoder.debug_check_bounds::<Self>(offset);
339 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
341 let padval = unsafe { (ptr as *const u64).read_unaligned() };
342 let mask = 0xffffffff00000000u64;
343 let maskedval = padval & mask;
344 if maskedval != 0 {
345 return Err(fidl::Error::NonZeroPadding {
346 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
347 });
348 }
349 fidl::decode!(i32, D, &mut self.s, decoder, offset + 0, _depth)?;
350 fidl::decode!(fidl::encoding::Vector<u8, 65536>, D, &mut self.desc, decoder, offset + 8, _depth)?;
351 Ok(())
352 }
353 }
354
355 impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationDescriptorSizeRequest {
356 type Borrowed<'a> = &'a Self;
357 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
358 value
359 }
360 }
361
362 unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationDescriptorSizeRequest {
363 type Owned = Self;
364
365 #[inline(always)]
366 fn inline_align(_context: fidl::encoding::Context) -> usize {
367 1
368 }
369
370 #[inline(always)]
371 fn inline_size(_context: fidl::encoding::Context) -> usize {
372 1
373 }
374 #[inline(always)]
375 fn encode_is_copy() -> bool {
376 true
377 }
378
379 #[inline(always)]
380 fn decode_is_copy() -> bool {
381 true
382 }
383 }
384
385 unsafe impl<D: fidl::encoding::ResourceDialect>
386 fidl::encoding::Encode<DeviceGetConfigurationDescriptorSizeRequest, D>
387 for &DeviceGetConfigurationDescriptorSizeRequest
388 {
389 #[inline]
390 unsafe fn encode(
391 self,
392 encoder: &mut fidl::encoding::Encoder<'_, D>,
393 offset: usize,
394 _depth: fidl::encoding::Depth,
395 ) -> fidl::Result<()> {
396 encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorSizeRequest>(offset);
397 unsafe {
398 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
400 (buf_ptr as *mut DeviceGetConfigurationDescriptorSizeRequest).write_unaligned(
401 (self as *const DeviceGetConfigurationDescriptorSizeRequest).read(),
402 );
403 }
406 Ok(())
407 }
408 }
409 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
410 fidl::encoding::Encode<DeviceGetConfigurationDescriptorSizeRequest, D> for (T0,)
411 {
412 #[inline]
413 unsafe fn encode(
414 self,
415 encoder: &mut fidl::encoding::Encoder<'_, D>,
416 offset: usize,
417 depth: fidl::encoding::Depth,
418 ) -> fidl::Result<()> {
419 encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorSizeRequest>(offset);
420 self.0.encode(encoder, offset + 0, depth)?;
424 Ok(())
425 }
426 }
427
428 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
429 for DeviceGetConfigurationDescriptorSizeRequest
430 {
431 #[inline(always)]
432 fn new_empty() -> Self {
433 Self { config: fidl::new_empty!(u8, D) }
434 }
435
436 #[inline]
437 unsafe fn decode(
438 &mut self,
439 decoder: &mut fidl::encoding::Decoder<'_, D>,
440 offset: usize,
441 _depth: fidl::encoding::Depth,
442 ) -> fidl::Result<()> {
443 decoder.debug_check_bounds::<Self>(offset);
444 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
445 unsafe {
448 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
449 }
450 Ok(())
451 }
452 }
453
454 impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationDescriptorSizeResponse {
455 type Borrowed<'a> = &'a Self;
456 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
457 value
458 }
459 }
460
461 unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationDescriptorSizeResponse {
462 type Owned = Self;
463
464 #[inline(always)]
465 fn inline_align(_context: fidl::encoding::Context) -> usize {
466 4
467 }
468
469 #[inline(always)]
470 fn inline_size(_context: fidl::encoding::Context) -> usize {
471 8
472 }
473 }
474
475 unsafe impl<D: fidl::encoding::ResourceDialect>
476 fidl::encoding::Encode<DeviceGetConfigurationDescriptorSizeResponse, D>
477 for &DeviceGetConfigurationDescriptorSizeResponse
478 {
479 #[inline]
480 unsafe fn encode(
481 self,
482 encoder: &mut fidl::encoding::Encoder<'_, D>,
483 offset: usize,
484 _depth: fidl::encoding::Depth,
485 ) -> fidl::Result<()> {
486 encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorSizeResponse>(offset);
487 unsafe {
488 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
490 (buf_ptr as *mut DeviceGetConfigurationDescriptorSizeResponse).write_unaligned(
491 (self as *const DeviceGetConfigurationDescriptorSizeResponse).read(),
492 );
493 let padding_ptr = buf_ptr.offset(4) as *mut u32;
496 let padding_mask = 0xffff0000u32;
497 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
498 }
499 Ok(())
500 }
501 }
502 unsafe impl<
503 D: fidl::encoding::ResourceDialect,
504 T0: fidl::encoding::Encode<i32, D>,
505 T1: fidl::encoding::Encode<u16, D>,
506 > fidl::encoding::Encode<DeviceGetConfigurationDescriptorSizeResponse, D> for (T0, T1)
507 {
508 #[inline]
509 unsafe fn encode(
510 self,
511 encoder: &mut fidl::encoding::Encoder<'_, D>,
512 offset: usize,
513 depth: fidl::encoding::Depth,
514 ) -> fidl::Result<()> {
515 encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorSizeResponse>(offset);
516 unsafe {
519 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
520 (ptr as *mut u32).write_unaligned(0);
521 }
522 self.0.encode(encoder, offset + 0, depth)?;
524 self.1.encode(encoder, offset + 4, depth)?;
525 Ok(())
526 }
527 }
528
529 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
530 for DeviceGetConfigurationDescriptorSizeResponse
531 {
532 #[inline(always)]
533 fn new_empty() -> Self {
534 Self { s: fidl::new_empty!(i32, D), size: fidl::new_empty!(u16, D) }
535 }
536
537 #[inline]
538 unsafe fn decode(
539 &mut self,
540 decoder: &mut fidl::encoding::Decoder<'_, D>,
541 offset: usize,
542 _depth: fidl::encoding::Depth,
543 ) -> fidl::Result<()> {
544 decoder.debug_check_bounds::<Self>(offset);
545 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
546 let ptr = unsafe { buf_ptr.offset(4) };
548 let padval = unsafe { (ptr as *const u32).read_unaligned() };
549 let mask = 0xffff0000u32;
550 let maskedval = padval & mask;
551 if maskedval != 0 {
552 return Err(fidl::Error::NonZeroPadding {
553 padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
554 });
555 }
556 unsafe {
558 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
559 }
560 Ok(())
561 }
562 }
563
564 impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationResponse {
565 type Borrowed<'a> = &'a Self;
566 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
567 value
568 }
569 }
570
571 unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationResponse {
572 type Owned = Self;
573
574 #[inline(always)]
575 fn inline_align(_context: fidl::encoding::Context) -> usize {
576 1
577 }
578
579 #[inline(always)]
580 fn inline_size(_context: fidl::encoding::Context) -> usize {
581 1
582 }
583 #[inline(always)]
584 fn encode_is_copy() -> bool {
585 true
586 }
587
588 #[inline(always)]
589 fn decode_is_copy() -> bool {
590 true
591 }
592 }
593
594 unsafe impl<D: fidl::encoding::ResourceDialect>
595 fidl::encoding::Encode<DeviceGetConfigurationResponse, D>
596 for &DeviceGetConfigurationResponse
597 {
598 #[inline]
599 unsafe fn encode(
600 self,
601 encoder: &mut fidl::encoding::Encoder<'_, D>,
602 offset: usize,
603 _depth: fidl::encoding::Depth,
604 ) -> fidl::Result<()> {
605 encoder.debug_check_bounds::<DeviceGetConfigurationResponse>(offset);
606 unsafe {
607 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
609 (buf_ptr as *mut DeviceGetConfigurationResponse)
610 .write_unaligned((self as *const DeviceGetConfigurationResponse).read());
611 }
614 Ok(())
615 }
616 }
617 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
618 fidl::encoding::Encode<DeviceGetConfigurationResponse, D> for (T0,)
619 {
620 #[inline]
621 unsafe fn encode(
622 self,
623 encoder: &mut fidl::encoding::Encoder<'_, D>,
624 offset: usize,
625 depth: fidl::encoding::Depth,
626 ) -> fidl::Result<()> {
627 encoder.debug_check_bounds::<DeviceGetConfigurationResponse>(offset);
628 self.0.encode(encoder, offset + 0, depth)?;
632 Ok(())
633 }
634 }
635
636 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
637 for DeviceGetConfigurationResponse
638 {
639 #[inline(always)]
640 fn new_empty() -> Self {
641 Self { configuration: fidl::new_empty!(u8, D) }
642 }
643
644 #[inline]
645 unsafe fn decode(
646 &mut self,
647 decoder: &mut fidl::encoding::Decoder<'_, D>,
648 offset: usize,
649 _depth: fidl::encoding::Depth,
650 ) -> fidl::Result<()> {
651 decoder.debug_check_bounds::<Self>(offset);
652 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
653 unsafe {
656 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
657 }
658 Ok(())
659 }
660 }
661
662 impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceDescriptorResponse {
663 type Borrowed<'a> = &'a Self;
664 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
665 value
666 }
667 }
668
669 unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceDescriptorResponse {
670 type Owned = Self;
671
672 #[inline(always)]
673 fn inline_align(_context: fidl::encoding::Context) -> usize {
674 1
675 }
676
677 #[inline(always)]
678 fn inline_size(_context: fidl::encoding::Context) -> usize {
679 18
680 }
681 #[inline(always)]
682 fn encode_is_copy() -> bool {
683 true
684 }
685
686 #[inline(always)]
687 fn decode_is_copy() -> bool {
688 true
689 }
690 }
691
692 unsafe impl<D: fidl::encoding::ResourceDialect>
693 fidl::encoding::Encode<DeviceGetDeviceDescriptorResponse, D>
694 for &DeviceGetDeviceDescriptorResponse
695 {
696 #[inline]
697 unsafe fn encode(
698 self,
699 encoder: &mut fidl::encoding::Encoder<'_, D>,
700 offset: usize,
701 _depth: fidl::encoding::Depth,
702 ) -> fidl::Result<()> {
703 encoder.debug_check_bounds::<DeviceGetDeviceDescriptorResponse>(offset);
704 unsafe {
705 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
707 (buf_ptr as *mut DeviceGetDeviceDescriptorResponse)
708 .write_unaligned((self as *const DeviceGetDeviceDescriptorResponse).read());
709 }
712 Ok(())
713 }
714 }
715 unsafe impl<
716 D: fidl::encoding::ResourceDialect,
717 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 18>, D>,
718 > fidl::encoding::Encode<DeviceGetDeviceDescriptorResponse, D> for (T0,)
719 {
720 #[inline]
721 unsafe fn encode(
722 self,
723 encoder: &mut fidl::encoding::Encoder<'_, D>,
724 offset: usize,
725 depth: fidl::encoding::Depth,
726 ) -> fidl::Result<()> {
727 encoder.debug_check_bounds::<DeviceGetDeviceDescriptorResponse>(offset);
728 self.0.encode(encoder, offset + 0, depth)?;
732 Ok(())
733 }
734 }
735
736 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
737 for DeviceGetDeviceDescriptorResponse
738 {
739 #[inline(always)]
740 fn new_empty() -> Self {
741 Self { desc: fidl::new_empty!(fidl::encoding::Array<u8, 18>, D) }
742 }
743
744 #[inline]
745 unsafe fn decode(
746 &mut self,
747 decoder: &mut fidl::encoding::Decoder<'_, D>,
748 offset: usize,
749 _depth: fidl::encoding::Depth,
750 ) -> fidl::Result<()> {
751 decoder.debug_check_bounds::<Self>(offset);
752 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
753 unsafe {
756 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 18);
757 }
758 Ok(())
759 }
760 }
761
762 impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceIdResponse {
763 type Borrowed<'a> = &'a Self;
764 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
765 value
766 }
767 }
768
769 unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceIdResponse {
770 type Owned = Self;
771
772 #[inline(always)]
773 fn inline_align(_context: fidl::encoding::Context) -> usize {
774 4
775 }
776
777 #[inline(always)]
778 fn inline_size(_context: fidl::encoding::Context) -> usize {
779 4
780 }
781 #[inline(always)]
782 fn encode_is_copy() -> bool {
783 true
784 }
785
786 #[inline(always)]
787 fn decode_is_copy() -> bool {
788 true
789 }
790 }
791
792 unsafe impl<D: fidl::encoding::ResourceDialect>
793 fidl::encoding::Encode<DeviceGetDeviceIdResponse, D> for &DeviceGetDeviceIdResponse
794 {
795 #[inline]
796 unsafe fn encode(
797 self,
798 encoder: &mut fidl::encoding::Encoder<'_, D>,
799 offset: usize,
800 _depth: fidl::encoding::Depth,
801 ) -> fidl::Result<()> {
802 encoder.debug_check_bounds::<DeviceGetDeviceIdResponse>(offset);
803 unsafe {
804 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
806 (buf_ptr as *mut DeviceGetDeviceIdResponse)
807 .write_unaligned((self as *const DeviceGetDeviceIdResponse).read());
808 }
811 Ok(())
812 }
813 }
814 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
815 fidl::encoding::Encode<DeviceGetDeviceIdResponse, D> for (T0,)
816 {
817 #[inline]
818 unsafe fn encode(
819 self,
820 encoder: &mut fidl::encoding::Encoder<'_, D>,
821 offset: usize,
822 depth: fidl::encoding::Depth,
823 ) -> fidl::Result<()> {
824 encoder.debug_check_bounds::<DeviceGetDeviceIdResponse>(offset);
825 self.0.encode(encoder, offset + 0, depth)?;
829 Ok(())
830 }
831 }
832
833 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
834 for DeviceGetDeviceIdResponse
835 {
836 #[inline(always)]
837 fn new_empty() -> Self {
838 Self { device_id: fidl::new_empty!(u32, D) }
839 }
840
841 #[inline]
842 unsafe fn decode(
843 &mut self,
844 decoder: &mut fidl::encoding::Decoder<'_, D>,
845 offset: usize,
846 _depth: fidl::encoding::Depth,
847 ) -> fidl::Result<()> {
848 decoder.debug_check_bounds::<Self>(offset);
849 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
850 unsafe {
853 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
854 }
855 Ok(())
856 }
857 }
858
859 impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceSpeedResponse {
860 type Borrowed<'a> = &'a Self;
861 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
862 value
863 }
864 }
865
866 unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceSpeedResponse {
867 type Owned = Self;
868
869 #[inline(always)]
870 fn inline_align(_context: fidl::encoding::Context) -> usize {
871 4
872 }
873
874 #[inline(always)]
875 fn inline_size(_context: fidl::encoding::Context) -> usize {
876 4
877 }
878 #[inline(always)]
879 fn encode_is_copy() -> bool {
880 true
881 }
882
883 #[inline(always)]
884 fn decode_is_copy() -> bool {
885 true
886 }
887 }
888
889 unsafe impl<D: fidl::encoding::ResourceDialect>
890 fidl::encoding::Encode<DeviceGetDeviceSpeedResponse, D> for &DeviceGetDeviceSpeedResponse
891 {
892 #[inline]
893 unsafe fn encode(
894 self,
895 encoder: &mut fidl::encoding::Encoder<'_, D>,
896 offset: usize,
897 _depth: fidl::encoding::Depth,
898 ) -> fidl::Result<()> {
899 encoder.debug_check_bounds::<DeviceGetDeviceSpeedResponse>(offset);
900 unsafe {
901 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
903 (buf_ptr as *mut DeviceGetDeviceSpeedResponse)
904 .write_unaligned((self as *const DeviceGetDeviceSpeedResponse).read());
905 }
908 Ok(())
909 }
910 }
911 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
912 fidl::encoding::Encode<DeviceGetDeviceSpeedResponse, D> for (T0,)
913 {
914 #[inline]
915 unsafe fn encode(
916 self,
917 encoder: &mut fidl::encoding::Encoder<'_, D>,
918 offset: usize,
919 depth: fidl::encoding::Depth,
920 ) -> fidl::Result<()> {
921 encoder.debug_check_bounds::<DeviceGetDeviceSpeedResponse>(offset);
922 self.0.encode(encoder, offset + 0, depth)?;
926 Ok(())
927 }
928 }
929
930 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
931 for DeviceGetDeviceSpeedResponse
932 {
933 #[inline(always)]
934 fn new_empty() -> Self {
935 Self { speed: fidl::new_empty!(u32, D) }
936 }
937
938 #[inline]
939 unsafe fn decode(
940 &mut self,
941 decoder: &mut fidl::encoding::Decoder<'_, D>,
942 offset: usize,
943 _depth: fidl::encoding::Depth,
944 ) -> fidl::Result<()> {
945 decoder.debug_check_bounds::<Self>(offset);
946 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
947 unsafe {
950 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
951 }
952 Ok(())
953 }
954 }
955
956 impl fidl::encoding::ValueTypeMarker for DeviceGetHubDeviceIdResponse {
957 type Borrowed<'a> = &'a Self;
958 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
959 value
960 }
961 }
962
963 unsafe impl fidl::encoding::TypeMarker for DeviceGetHubDeviceIdResponse {
964 type Owned = Self;
965
966 #[inline(always)]
967 fn inline_align(_context: fidl::encoding::Context) -> usize {
968 4
969 }
970
971 #[inline(always)]
972 fn inline_size(_context: fidl::encoding::Context) -> usize {
973 4
974 }
975 #[inline(always)]
976 fn encode_is_copy() -> bool {
977 true
978 }
979
980 #[inline(always)]
981 fn decode_is_copy() -> bool {
982 true
983 }
984 }
985
986 unsafe impl<D: fidl::encoding::ResourceDialect>
987 fidl::encoding::Encode<DeviceGetHubDeviceIdResponse, D> for &DeviceGetHubDeviceIdResponse
988 {
989 #[inline]
990 unsafe fn encode(
991 self,
992 encoder: &mut fidl::encoding::Encoder<'_, D>,
993 offset: usize,
994 _depth: fidl::encoding::Depth,
995 ) -> fidl::Result<()> {
996 encoder.debug_check_bounds::<DeviceGetHubDeviceIdResponse>(offset);
997 unsafe {
998 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1000 (buf_ptr as *mut DeviceGetHubDeviceIdResponse)
1001 .write_unaligned((self as *const DeviceGetHubDeviceIdResponse).read());
1002 }
1005 Ok(())
1006 }
1007 }
1008 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1009 fidl::encoding::Encode<DeviceGetHubDeviceIdResponse, D> for (T0,)
1010 {
1011 #[inline]
1012 unsafe fn encode(
1013 self,
1014 encoder: &mut fidl::encoding::Encoder<'_, D>,
1015 offset: usize,
1016 depth: fidl::encoding::Depth,
1017 ) -> fidl::Result<()> {
1018 encoder.debug_check_bounds::<DeviceGetHubDeviceIdResponse>(offset);
1019 self.0.encode(encoder, offset + 0, depth)?;
1023 Ok(())
1024 }
1025 }
1026
1027 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1028 for DeviceGetHubDeviceIdResponse
1029 {
1030 #[inline(always)]
1031 fn new_empty() -> Self {
1032 Self { hub_device_id: fidl::new_empty!(u32, D) }
1033 }
1034
1035 #[inline]
1036 unsafe fn decode(
1037 &mut self,
1038 decoder: &mut fidl::encoding::Decoder<'_, D>,
1039 offset: usize,
1040 _depth: fidl::encoding::Depth,
1041 ) -> fidl::Result<()> {
1042 decoder.debug_check_bounds::<Self>(offset);
1043 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1044 unsafe {
1047 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1048 }
1049 Ok(())
1050 }
1051 }
1052
1053 impl fidl::encoding::ValueTypeMarker for DeviceGetStringDescriptorRequest {
1054 type Borrowed<'a> = &'a Self;
1055 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1056 value
1057 }
1058 }
1059
1060 unsafe impl fidl::encoding::TypeMarker for DeviceGetStringDescriptorRequest {
1061 type Owned = Self;
1062
1063 #[inline(always)]
1064 fn inline_align(_context: fidl::encoding::Context) -> usize {
1065 2
1066 }
1067
1068 #[inline(always)]
1069 fn inline_size(_context: fidl::encoding::Context) -> usize {
1070 4
1071 }
1072 }
1073
1074 unsafe impl<D: fidl::encoding::ResourceDialect>
1075 fidl::encoding::Encode<DeviceGetStringDescriptorRequest, D>
1076 for &DeviceGetStringDescriptorRequest
1077 {
1078 #[inline]
1079 unsafe fn encode(
1080 self,
1081 encoder: &mut fidl::encoding::Encoder<'_, D>,
1082 offset: usize,
1083 _depth: fidl::encoding::Depth,
1084 ) -> fidl::Result<()> {
1085 encoder.debug_check_bounds::<DeviceGetStringDescriptorRequest>(offset);
1086 unsafe {
1087 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1089 (buf_ptr as *mut DeviceGetStringDescriptorRequest)
1090 .write_unaligned((self as *const DeviceGetStringDescriptorRequest).read());
1091 let padding_ptr = buf_ptr.offset(0) as *mut u16;
1094 let padding_mask = 0xff00u16;
1095 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1096 }
1097 Ok(())
1098 }
1099 }
1100 unsafe impl<
1101 D: fidl::encoding::ResourceDialect,
1102 T0: fidl::encoding::Encode<u8, D>,
1103 T1: fidl::encoding::Encode<u16, D>,
1104 > fidl::encoding::Encode<DeviceGetStringDescriptorRequest, D> for (T0, T1)
1105 {
1106 #[inline]
1107 unsafe fn encode(
1108 self,
1109 encoder: &mut fidl::encoding::Encoder<'_, D>,
1110 offset: usize,
1111 depth: fidl::encoding::Depth,
1112 ) -> fidl::Result<()> {
1113 encoder.debug_check_bounds::<DeviceGetStringDescriptorRequest>(offset);
1114 unsafe {
1117 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1118 (ptr as *mut u16).write_unaligned(0);
1119 }
1120 self.0.encode(encoder, offset + 0, depth)?;
1122 self.1.encode(encoder, offset + 2, depth)?;
1123 Ok(())
1124 }
1125 }
1126
1127 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1128 for DeviceGetStringDescriptorRequest
1129 {
1130 #[inline(always)]
1131 fn new_empty() -> Self {
1132 Self { desc_id: fidl::new_empty!(u8, D), lang_id: fidl::new_empty!(u16, D) }
1133 }
1134
1135 #[inline]
1136 unsafe fn decode(
1137 &mut self,
1138 decoder: &mut fidl::encoding::Decoder<'_, D>,
1139 offset: usize,
1140 _depth: fidl::encoding::Depth,
1141 ) -> fidl::Result<()> {
1142 decoder.debug_check_bounds::<Self>(offset);
1143 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1144 let ptr = unsafe { buf_ptr.offset(0) };
1146 let padval = unsafe { (ptr as *const u16).read_unaligned() };
1147 let mask = 0xff00u16;
1148 let maskedval = padval & mask;
1149 if maskedval != 0 {
1150 return Err(fidl::Error::NonZeroPadding {
1151 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1152 });
1153 }
1154 unsafe {
1156 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1157 }
1158 Ok(())
1159 }
1160 }
1161
1162 impl fidl::encoding::ValueTypeMarker for DeviceGetStringDescriptorResponse {
1163 type Borrowed<'a> = &'a Self;
1164 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1165 value
1166 }
1167 }
1168
1169 unsafe impl fidl::encoding::TypeMarker for DeviceGetStringDescriptorResponse {
1170 type Owned = Self;
1171
1172 #[inline(always)]
1173 fn inline_align(_context: fidl::encoding::Context) -> usize {
1174 8
1175 }
1176
1177 #[inline(always)]
1178 fn inline_size(_context: fidl::encoding::Context) -> usize {
1179 32
1180 }
1181 }
1182
1183 unsafe impl<D: fidl::encoding::ResourceDialect>
1184 fidl::encoding::Encode<DeviceGetStringDescriptorResponse, D>
1185 for &DeviceGetStringDescriptorResponse
1186 {
1187 #[inline]
1188 unsafe fn encode(
1189 self,
1190 encoder: &mut fidl::encoding::Encoder<'_, D>,
1191 offset: usize,
1192 _depth: fidl::encoding::Depth,
1193 ) -> fidl::Result<()> {
1194 encoder.debug_check_bounds::<DeviceGetStringDescriptorResponse>(offset);
1195 fidl::encoding::Encode::<DeviceGetStringDescriptorResponse, D>::encode(
1197 (
1198 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.s),
1199 <fidl::encoding::BoundedString<384> as fidl::encoding::ValueTypeMarker>::borrow(
1200 &self.desc,
1201 ),
1202 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.actual_lang_id),
1203 ),
1204 encoder,
1205 offset,
1206 _depth,
1207 )
1208 }
1209 }
1210 unsafe impl<
1211 D: fidl::encoding::ResourceDialect,
1212 T0: fidl::encoding::Encode<i32, D>,
1213 T1: fidl::encoding::Encode<fidl::encoding::BoundedString<384>, D>,
1214 T2: fidl::encoding::Encode<u16, D>,
1215 > fidl::encoding::Encode<DeviceGetStringDescriptorResponse, D> for (T0, T1, T2)
1216 {
1217 #[inline]
1218 unsafe fn encode(
1219 self,
1220 encoder: &mut fidl::encoding::Encoder<'_, D>,
1221 offset: usize,
1222 depth: fidl::encoding::Depth,
1223 ) -> fidl::Result<()> {
1224 encoder.debug_check_bounds::<DeviceGetStringDescriptorResponse>(offset);
1225 unsafe {
1228 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1229 (ptr as *mut u64).write_unaligned(0);
1230 }
1231 unsafe {
1232 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
1233 (ptr as *mut u64).write_unaligned(0);
1234 }
1235 self.0.encode(encoder, offset + 0, depth)?;
1237 self.1.encode(encoder, offset + 8, depth)?;
1238 self.2.encode(encoder, offset + 24, depth)?;
1239 Ok(())
1240 }
1241 }
1242
1243 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1244 for DeviceGetStringDescriptorResponse
1245 {
1246 #[inline(always)]
1247 fn new_empty() -> Self {
1248 Self {
1249 s: fidl::new_empty!(i32, D),
1250 desc: fidl::new_empty!(fidl::encoding::BoundedString<384>, D),
1251 actual_lang_id: fidl::new_empty!(u16, D),
1252 }
1253 }
1254
1255 #[inline]
1256 unsafe fn decode(
1257 &mut self,
1258 decoder: &mut fidl::encoding::Decoder<'_, D>,
1259 offset: usize,
1260 _depth: fidl::encoding::Depth,
1261 ) -> fidl::Result<()> {
1262 decoder.debug_check_bounds::<Self>(offset);
1263 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1265 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1266 let mask = 0xffffffff00000000u64;
1267 let maskedval = padval & mask;
1268 if maskedval != 0 {
1269 return Err(fidl::Error::NonZeroPadding {
1270 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1271 });
1272 }
1273 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
1274 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1275 let mask = 0xffffffffffff0000u64;
1276 let maskedval = padval & mask;
1277 if maskedval != 0 {
1278 return Err(fidl::Error::NonZeroPadding {
1279 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
1280 });
1281 }
1282 fidl::decode!(i32, D, &mut self.s, decoder, offset + 0, _depth)?;
1283 fidl::decode!(
1284 fidl::encoding::BoundedString<384>,
1285 D,
1286 &mut self.desc,
1287 decoder,
1288 offset + 8,
1289 _depth
1290 )?;
1291 fidl::decode!(u16, D, &mut self.actual_lang_id, decoder, offset + 24, _depth)?;
1292 Ok(())
1293 }
1294 }
1295
1296 impl fidl::encoding::ValueTypeMarker for DeviceSetConfigurationRequest {
1297 type Borrowed<'a> = &'a Self;
1298 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1299 value
1300 }
1301 }
1302
1303 unsafe impl fidl::encoding::TypeMarker for DeviceSetConfigurationRequest {
1304 type Owned = Self;
1305
1306 #[inline(always)]
1307 fn inline_align(_context: fidl::encoding::Context) -> usize {
1308 1
1309 }
1310
1311 #[inline(always)]
1312 fn inline_size(_context: fidl::encoding::Context) -> usize {
1313 1
1314 }
1315 #[inline(always)]
1316 fn encode_is_copy() -> bool {
1317 true
1318 }
1319
1320 #[inline(always)]
1321 fn decode_is_copy() -> bool {
1322 true
1323 }
1324 }
1325
1326 unsafe impl<D: fidl::encoding::ResourceDialect>
1327 fidl::encoding::Encode<DeviceSetConfigurationRequest, D>
1328 for &DeviceSetConfigurationRequest
1329 {
1330 #[inline]
1331 unsafe fn encode(
1332 self,
1333 encoder: &mut fidl::encoding::Encoder<'_, D>,
1334 offset: usize,
1335 _depth: fidl::encoding::Depth,
1336 ) -> fidl::Result<()> {
1337 encoder.debug_check_bounds::<DeviceSetConfigurationRequest>(offset);
1338 unsafe {
1339 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1341 (buf_ptr as *mut DeviceSetConfigurationRequest)
1342 .write_unaligned((self as *const DeviceSetConfigurationRequest).read());
1343 }
1346 Ok(())
1347 }
1348 }
1349 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
1350 fidl::encoding::Encode<DeviceSetConfigurationRequest, D> for (T0,)
1351 {
1352 #[inline]
1353 unsafe fn encode(
1354 self,
1355 encoder: &mut fidl::encoding::Encoder<'_, D>,
1356 offset: usize,
1357 depth: fidl::encoding::Depth,
1358 ) -> fidl::Result<()> {
1359 encoder.debug_check_bounds::<DeviceSetConfigurationRequest>(offset);
1360 self.0.encode(encoder, offset + 0, depth)?;
1364 Ok(())
1365 }
1366 }
1367
1368 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1369 for DeviceSetConfigurationRequest
1370 {
1371 #[inline(always)]
1372 fn new_empty() -> Self {
1373 Self { configuration: fidl::new_empty!(u8, D) }
1374 }
1375
1376 #[inline]
1377 unsafe fn decode(
1378 &mut self,
1379 decoder: &mut fidl::encoding::Decoder<'_, D>,
1380 offset: usize,
1381 _depth: fidl::encoding::Depth,
1382 ) -> fidl::Result<()> {
1383 decoder.debug_check_bounds::<Self>(offset);
1384 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1385 unsafe {
1388 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
1389 }
1390 Ok(())
1391 }
1392 }
1393
1394 impl fidl::encoding::ValueTypeMarker for DeviceSetConfigurationResponse {
1395 type Borrowed<'a> = &'a Self;
1396 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1397 value
1398 }
1399 }
1400
1401 unsafe impl fidl::encoding::TypeMarker for DeviceSetConfigurationResponse {
1402 type Owned = Self;
1403
1404 #[inline(always)]
1405 fn inline_align(_context: fidl::encoding::Context) -> usize {
1406 4
1407 }
1408
1409 #[inline(always)]
1410 fn inline_size(_context: fidl::encoding::Context) -> usize {
1411 4
1412 }
1413 #[inline(always)]
1414 fn encode_is_copy() -> bool {
1415 true
1416 }
1417
1418 #[inline(always)]
1419 fn decode_is_copy() -> bool {
1420 true
1421 }
1422 }
1423
1424 unsafe impl<D: fidl::encoding::ResourceDialect>
1425 fidl::encoding::Encode<DeviceSetConfigurationResponse, D>
1426 for &DeviceSetConfigurationResponse
1427 {
1428 #[inline]
1429 unsafe fn encode(
1430 self,
1431 encoder: &mut fidl::encoding::Encoder<'_, D>,
1432 offset: usize,
1433 _depth: fidl::encoding::Depth,
1434 ) -> fidl::Result<()> {
1435 encoder.debug_check_bounds::<DeviceSetConfigurationResponse>(offset);
1436 unsafe {
1437 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1439 (buf_ptr as *mut DeviceSetConfigurationResponse)
1440 .write_unaligned((self as *const DeviceSetConfigurationResponse).read());
1441 }
1444 Ok(())
1445 }
1446 }
1447 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
1448 fidl::encoding::Encode<DeviceSetConfigurationResponse, D> for (T0,)
1449 {
1450 #[inline]
1451 unsafe fn encode(
1452 self,
1453 encoder: &mut fidl::encoding::Encoder<'_, D>,
1454 offset: usize,
1455 depth: fidl::encoding::Depth,
1456 ) -> fidl::Result<()> {
1457 encoder.debug_check_bounds::<DeviceSetConfigurationResponse>(offset);
1458 self.0.encode(encoder, offset + 0, depth)?;
1462 Ok(())
1463 }
1464 }
1465
1466 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1467 for DeviceSetConfigurationResponse
1468 {
1469 #[inline(always)]
1470 fn new_empty() -> Self {
1471 Self { s: fidl::new_empty!(i32, D) }
1472 }
1473
1474 #[inline]
1475 unsafe fn decode(
1476 &mut self,
1477 decoder: &mut fidl::encoding::Decoder<'_, D>,
1478 offset: usize,
1479 _depth: fidl::encoding::Depth,
1480 ) -> fidl::Result<()> {
1481 decoder.debug_check_bounds::<Self>(offset);
1482 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1483 unsafe {
1486 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1487 }
1488 Ok(())
1489 }
1490 }
1491
1492 impl fidl::encoding::ValueTypeMarker for DeviceSetInterfaceRequest {
1493 type Borrowed<'a> = &'a Self;
1494 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1495 value
1496 }
1497 }
1498
1499 unsafe impl fidl::encoding::TypeMarker for DeviceSetInterfaceRequest {
1500 type Owned = Self;
1501
1502 #[inline(always)]
1503 fn inline_align(_context: fidl::encoding::Context) -> usize {
1504 1
1505 }
1506
1507 #[inline(always)]
1508 fn inline_size(_context: fidl::encoding::Context) -> usize {
1509 2
1510 }
1511 #[inline(always)]
1512 fn encode_is_copy() -> bool {
1513 true
1514 }
1515
1516 #[inline(always)]
1517 fn decode_is_copy() -> bool {
1518 true
1519 }
1520 }
1521
1522 unsafe impl<D: fidl::encoding::ResourceDialect>
1523 fidl::encoding::Encode<DeviceSetInterfaceRequest, D> for &DeviceSetInterfaceRequest
1524 {
1525 #[inline]
1526 unsafe fn encode(
1527 self,
1528 encoder: &mut fidl::encoding::Encoder<'_, D>,
1529 offset: usize,
1530 _depth: fidl::encoding::Depth,
1531 ) -> fidl::Result<()> {
1532 encoder.debug_check_bounds::<DeviceSetInterfaceRequest>(offset);
1533 unsafe {
1534 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1536 (buf_ptr as *mut DeviceSetInterfaceRequest)
1537 .write_unaligned((self as *const DeviceSetInterfaceRequest).read());
1538 }
1541 Ok(())
1542 }
1543 }
1544 unsafe impl<
1545 D: fidl::encoding::ResourceDialect,
1546 T0: fidl::encoding::Encode<u8, D>,
1547 T1: fidl::encoding::Encode<u8, D>,
1548 > fidl::encoding::Encode<DeviceSetInterfaceRequest, D> for (T0, T1)
1549 {
1550 #[inline]
1551 unsafe fn encode(
1552 self,
1553 encoder: &mut fidl::encoding::Encoder<'_, D>,
1554 offset: usize,
1555 depth: fidl::encoding::Depth,
1556 ) -> fidl::Result<()> {
1557 encoder.debug_check_bounds::<DeviceSetInterfaceRequest>(offset);
1558 self.0.encode(encoder, offset + 0, depth)?;
1562 self.1.encode(encoder, offset + 1, depth)?;
1563 Ok(())
1564 }
1565 }
1566
1567 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1568 for DeviceSetInterfaceRequest
1569 {
1570 #[inline(always)]
1571 fn new_empty() -> Self {
1572 Self { interface_number: fidl::new_empty!(u8, D), alt_setting: fidl::new_empty!(u8, D) }
1573 }
1574
1575 #[inline]
1576 unsafe fn decode(
1577 &mut self,
1578 decoder: &mut fidl::encoding::Decoder<'_, D>,
1579 offset: usize,
1580 _depth: fidl::encoding::Depth,
1581 ) -> fidl::Result<()> {
1582 decoder.debug_check_bounds::<Self>(offset);
1583 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1584 unsafe {
1587 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
1588 }
1589 Ok(())
1590 }
1591 }
1592
1593 impl fidl::encoding::ValueTypeMarker for DeviceSetInterfaceResponse {
1594 type Borrowed<'a> = &'a Self;
1595 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1596 value
1597 }
1598 }
1599
1600 unsafe impl fidl::encoding::TypeMarker for DeviceSetInterfaceResponse {
1601 type Owned = Self;
1602
1603 #[inline(always)]
1604 fn inline_align(_context: fidl::encoding::Context) -> usize {
1605 4
1606 }
1607
1608 #[inline(always)]
1609 fn inline_size(_context: fidl::encoding::Context) -> usize {
1610 4
1611 }
1612 #[inline(always)]
1613 fn encode_is_copy() -> bool {
1614 true
1615 }
1616
1617 #[inline(always)]
1618 fn decode_is_copy() -> bool {
1619 true
1620 }
1621 }
1622
1623 unsafe impl<D: fidl::encoding::ResourceDialect>
1624 fidl::encoding::Encode<DeviceSetInterfaceResponse, D> for &DeviceSetInterfaceResponse
1625 {
1626 #[inline]
1627 unsafe fn encode(
1628 self,
1629 encoder: &mut fidl::encoding::Encoder<'_, D>,
1630 offset: usize,
1631 _depth: fidl::encoding::Depth,
1632 ) -> fidl::Result<()> {
1633 encoder.debug_check_bounds::<DeviceSetInterfaceResponse>(offset);
1634 unsafe {
1635 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1637 (buf_ptr as *mut DeviceSetInterfaceResponse)
1638 .write_unaligned((self as *const DeviceSetInterfaceResponse).read());
1639 }
1642 Ok(())
1643 }
1644 }
1645 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
1646 fidl::encoding::Encode<DeviceSetInterfaceResponse, D> for (T0,)
1647 {
1648 #[inline]
1649 unsafe fn encode(
1650 self,
1651 encoder: &mut fidl::encoding::Encoder<'_, D>,
1652 offset: usize,
1653 depth: fidl::encoding::Depth,
1654 ) -> fidl::Result<()> {
1655 encoder.debug_check_bounds::<DeviceSetInterfaceResponse>(offset);
1656 self.0.encode(encoder, offset + 0, depth)?;
1660 Ok(())
1661 }
1662 }
1663
1664 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1665 for DeviceSetInterfaceResponse
1666 {
1667 #[inline(always)]
1668 fn new_empty() -> Self {
1669 Self { s: fidl::new_empty!(i32, D) }
1670 }
1671
1672 #[inline]
1673 unsafe fn decode(
1674 &mut self,
1675 decoder: &mut fidl::encoding::Decoder<'_, D>,
1676 offset: usize,
1677 _depth: fidl::encoding::Depth,
1678 ) -> fidl::Result<()> {
1679 decoder.debug_check_bounds::<Self>(offset);
1680 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1681 unsafe {
1684 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1685 }
1686 Ok(())
1687 }
1688 }
1689}