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 VMADDR_CID_ANY: u32 = 4294967295;
12
13pub const VMADDR_CID_HOST: u32 = 2;
14
15pub const VMADDR_CID_LOCAL: u32 = 1;
16
17#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
18#[repr(C)]
19pub struct Addr {
20 pub local_port: u32,
21 pub remote_cid: u32,
22 pub remote_port: u32,
23}
24
25impl fidl::Persistable for Addr {}
26
27#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
28#[repr(C)]
29pub struct CallbacksRequestRequest {
30 pub addr: Addr,
31}
32
33impl fidl::Persistable for CallbacksRequestRequest {}
34
35#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36#[repr(C)]
37pub struct CallbacksResponseRequest {
38 pub addr: Addr,
39}
40
41impl fidl::Persistable for CallbacksResponseRequest {}
42
43#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
44#[repr(C)]
45pub struct CallbacksRstRequest {
46 pub addr: Addr,
47}
48
49impl fidl::Persistable for CallbacksRstRequest {}
50
51#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
52#[repr(C)]
53pub struct CallbacksShutdownRequest {
54 pub addr: Addr,
55}
56
57impl fidl::Persistable for CallbacksShutdownRequest {}
58
59#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
60#[repr(C)]
61pub struct CallbacksTransportResetRequest {
62 pub new_cid: u32,
63}
64
65impl fidl::Persistable for CallbacksTransportResetRequest {}
66
67#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
68#[repr(C)]
69pub struct DeviceGetCidResponse {
70 pub local_cid: u32,
71}
72
73impl fidl::Persistable for DeviceGetCidResponse {}
74
75#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
76#[repr(C)]
77pub struct DeviceSendRstRequest {
78 pub addr: Addr,
79}
80
81impl fidl::Persistable for DeviceSendRstRequest {}
82
83#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
84#[repr(C)]
85pub struct DeviceSendShutdownRequest {
86 pub addr: Addr,
87}
88
89impl fidl::Persistable for DeviceSendShutdownRequest {}
90
91mod internal {
92 use super::*;
93
94 impl fidl::encoding::ValueTypeMarker for Addr {
95 type Borrowed<'a> = &'a Self;
96 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
97 value
98 }
99 }
100
101 unsafe impl fidl::encoding::TypeMarker for Addr {
102 type Owned = Self;
103
104 #[inline(always)]
105 fn inline_align(_context: fidl::encoding::Context) -> usize {
106 4
107 }
108
109 #[inline(always)]
110 fn inline_size(_context: fidl::encoding::Context) -> usize {
111 12
112 }
113 #[inline(always)]
114 fn encode_is_copy() -> bool {
115 true
116 }
117
118 #[inline(always)]
119 fn decode_is_copy() -> bool {
120 true
121 }
122 }
123
124 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Addr, D> for &Addr {
125 #[inline]
126 unsafe fn encode(
127 self,
128 encoder: &mut fidl::encoding::Encoder<'_, D>,
129 offset: usize,
130 _depth: fidl::encoding::Depth,
131 ) -> fidl::Result<()> {
132 encoder.debug_check_bounds::<Addr>(offset);
133 unsafe {
134 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
136 (buf_ptr as *mut Addr).write_unaligned((self as *const Addr).read());
137 }
140 Ok(())
141 }
142 }
143 unsafe impl<
144 D: fidl::encoding::ResourceDialect,
145 T0: fidl::encoding::Encode<u32, D>,
146 T1: fidl::encoding::Encode<u32, D>,
147 T2: fidl::encoding::Encode<u32, D>,
148 > fidl::encoding::Encode<Addr, D> for (T0, T1, T2)
149 {
150 #[inline]
151 unsafe fn encode(
152 self,
153 encoder: &mut fidl::encoding::Encoder<'_, D>,
154 offset: usize,
155 depth: fidl::encoding::Depth,
156 ) -> fidl::Result<()> {
157 encoder.debug_check_bounds::<Addr>(offset);
158 self.0.encode(encoder, offset + 0, depth)?;
162 self.1.encode(encoder, offset + 4, depth)?;
163 self.2.encode(encoder, offset + 8, depth)?;
164 Ok(())
165 }
166 }
167
168 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Addr {
169 #[inline(always)]
170 fn new_empty() -> Self {
171 Self {
172 local_port: fidl::new_empty!(u32, D),
173 remote_cid: fidl::new_empty!(u32, D),
174 remote_port: fidl::new_empty!(u32, D),
175 }
176 }
177
178 #[inline]
179 unsafe fn decode(
180 &mut self,
181 decoder: &mut fidl::encoding::Decoder<'_, D>,
182 offset: usize,
183 _depth: fidl::encoding::Depth,
184 ) -> fidl::Result<()> {
185 decoder.debug_check_bounds::<Self>(offset);
186 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
187 unsafe {
190 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
191 }
192 Ok(())
193 }
194 }
195
196 impl fidl::encoding::ValueTypeMarker for CallbacksRequestRequest {
197 type Borrowed<'a> = &'a Self;
198 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
199 value
200 }
201 }
202
203 unsafe impl fidl::encoding::TypeMarker for CallbacksRequestRequest {
204 type Owned = Self;
205
206 #[inline(always)]
207 fn inline_align(_context: fidl::encoding::Context) -> usize {
208 4
209 }
210
211 #[inline(always)]
212 fn inline_size(_context: fidl::encoding::Context) -> usize {
213 12
214 }
215 #[inline(always)]
216 fn encode_is_copy() -> bool {
217 true
218 }
219
220 #[inline(always)]
221 fn decode_is_copy() -> bool {
222 true
223 }
224 }
225
226 unsafe impl<D: fidl::encoding::ResourceDialect>
227 fidl::encoding::Encode<CallbacksRequestRequest, D> for &CallbacksRequestRequest
228 {
229 #[inline]
230 unsafe fn encode(
231 self,
232 encoder: &mut fidl::encoding::Encoder<'_, D>,
233 offset: usize,
234 _depth: fidl::encoding::Depth,
235 ) -> fidl::Result<()> {
236 encoder.debug_check_bounds::<CallbacksRequestRequest>(offset);
237 unsafe {
238 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
240 (buf_ptr as *mut CallbacksRequestRequest)
241 .write_unaligned((self as *const CallbacksRequestRequest).read());
242 }
245 Ok(())
246 }
247 }
248 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Addr, D>>
249 fidl::encoding::Encode<CallbacksRequestRequest, D> for (T0,)
250 {
251 #[inline]
252 unsafe fn encode(
253 self,
254 encoder: &mut fidl::encoding::Encoder<'_, D>,
255 offset: usize,
256 depth: fidl::encoding::Depth,
257 ) -> fidl::Result<()> {
258 encoder.debug_check_bounds::<CallbacksRequestRequest>(offset);
259 self.0.encode(encoder, offset + 0, depth)?;
263 Ok(())
264 }
265 }
266
267 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
268 for CallbacksRequestRequest
269 {
270 #[inline(always)]
271 fn new_empty() -> Self {
272 Self { addr: fidl::new_empty!(Addr, D) }
273 }
274
275 #[inline]
276 unsafe fn decode(
277 &mut self,
278 decoder: &mut fidl::encoding::Decoder<'_, D>,
279 offset: usize,
280 _depth: fidl::encoding::Depth,
281 ) -> fidl::Result<()> {
282 decoder.debug_check_bounds::<Self>(offset);
283 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
284 unsafe {
287 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
288 }
289 Ok(())
290 }
291 }
292
293 impl fidl::encoding::ValueTypeMarker for CallbacksResponseRequest {
294 type Borrowed<'a> = &'a Self;
295 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
296 value
297 }
298 }
299
300 unsafe impl fidl::encoding::TypeMarker for CallbacksResponseRequest {
301 type Owned = Self;
302
303 #[inline(always)]
304 fn inline_align(_context: fidl::encoding::Context) -> usize {
305 4
306 }
307
308 #[inline(always)]
309 fn inline_size(_context: fidl::encoding::Context) -> usize {
310 12
311 }
312 #[inline(always)]
313 fn encode_is_copy() -> bool {
314 true
315 }
316
317 #[inline(always)]
318 fn decode_is_copy() -> bool {
319 true
320 }
321 }
322
323 unsafe impl<D: fidl::encoding::ResourceDialect>
324 fidl::encoding::Encode<CallbacksResponseRequest, D> for &CallbacksResponseRequest
325 {
326 #[inline]
327 unsafe fn encode(
328 self,
329 encoder: &mut fidl::encoding::Encoder<'_, D>,
330 offset: usize,
331 _depth: fidl::encoding::Depth,
332 ) -> fidl::Result<()> {
333 encoder.debug_check_bounds::<CallbacksResponseRequest>(offset);
334 unsafe {
335 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
337 (buf_ptr as *mut CallbacksResponseRequest)
338 .write_unaligned((self as *const CallbacksResponseRequest).read());
339 }
342 Ok(())
343 }
344 }
345 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Addr, D>>
346 fidl::encoding::Encode<CallbacksResponseRequest, D> for (T0,)
347 {
348 #[inline]
349 unsafe fn encode(
350 self,
351 encoder: &mut fidl::encoding::Encoder<'_, D>,
352 offset: usize,
353 depth: fidl::encoding::Depth,
354 ) -> fidl::Result<()> {
355 encoder.debug_check_bounds::<CallbacksResponseRequest>(offset);
356 self.0.encode(encoder, offset + 0, depth)?;
360 Ok(())
361 }
362 }
363
364 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
365 for CallbacksResponseRequest
366 {
367 #[inline(always)]
368 fn new_empty() -> Self {
369 Self { addr: fidl::new_empty!(Addr, D) }
370 }
371
372 #[inline]
373 unsafe fn decode(
374 &mut self,
375 decoder: &mut fidl::encoding::Decoder<'_, D>,
376 offset: usize,
377 _depth: fidl::encoding::Depth,
378 ) -> fidl::Result<()> {
379 decoder.debug_check_bounds::<Self>(offset);
380 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
381 unsafe {
384 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
385 }
386 Ok(())
387 }
388 }
389
390 impl fidl::encoding::ValueTypeMarker for CallbacksRstRequest {
391 type Borrowed<'a> = &'a Self;
392 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
393 value
394 }
395 }
396
397 unsafe impl fidl::encoding::TypeMarker for CallbacksRstRequest {
398 type Owned = Self;
399
400 #[inline(always)]
401 fn inline_align(_context: fidl::encoding::Context) -> usize {
402 4
403 }
404
405 #[inline(always)]
406 fn inline_size(_context: fidl::encoding::Context) -> usize {
407 12
408 }
409 #[inline(always)]
410 fn encode_is_copy() -> bool {
411 true
412 }
413
414 #[inline(always)]
415 fn decode_is_copy() -> bool {
416 true
417 }
418 }
419
420 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CallbacksRstRequest, D>
421 for &CallbacksRstRequest
422 {
423 #[inline]
424 unsafe fn encode(
425 self,
426 encoder: &mut fidl::encoding::Encoder<'_, D>,
427 offset: usize,
428 _depth: fidl::encoding::Depth,
429 ) -> fidl::Result<()> {
430 encoder.debug_check_bounds::<CallbacksRstRequest>(offset);
431 unsafe {
432 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
434 (buf_ptr as *mut CallbacksRstRequest)
435 .write_unaligned((self as *const CallbacksRstRequest).read());
436 }
439 Ok(())
440 }
441 }
442 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Addr, D>>
443 fidl::encoding::Encode<CallbacksRstRequest, D> for (T0,)
444 {
445 #[inline]
446 unsafe fn encode(
447 self,
448 encoder: &mut fidl::encoding::Encoder<'_, D>,
449 offset: usize,
450 depth: fidl::encoding::Depth,
451 ) -> fidl::Result<()> {
452 encoder.debug_check_bounds::<CallbacksRstRequest>(offset);
453 self.0.encode(encoder, offset + 0, depth)?;
457 Ok(())
458 }
459 }
460
461 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CallbacksRstRequest {
462 #[inline(always)]
463 fn new_empty() -> Self {
464 Self { addr: fidl::new_empty!(Addr, D) }
465 }
466
467 #[inline]
468 unsafe fn decode(
469 &mut self,
470 decoder: &mut fidl::encoding::Decoder<'_, D>,
471 offset: usize,
472 _depth: fidl::encoding::Depth,
473 ) -> fidl::Result<()> {
474 decoder.debug_check_bounds::<Self>(offset);
475 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
476 unsafe {
479 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
480 }
481 Ok(())
482 }
483 }
484
485 impl fidl::encoding::ValueTypeMarker for CallbacksShutdownRequest {
486 type Borrowed<'a> = &'a Self;
487 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
488 value
489 }
490 }
491
492 unsafe impl fidl::encoding::TypeMarker for CallbacksShutdownRequest {
493 type Owned = Self;
494
495 #[inline(always)]
496 fn inline_align(_context: fidl::encoding::Context) -> usize {
497 4
498 }
499
500 #[inline(always)]
501 fn inline_size(_context: fidl::encoding::Context) -> usize {
502 12
503 }
504 #[inline(always)]
505 fn encode_is_copy() -> bool {
506 true
507 }
508
509 #[inline(always)]
510 fn decode_is_copy() -> bool {
511 true
512 }
513 }
514
515 unsafe impl<D: fidl::encoding::ResourceDialect>
516 fidl::encoding::Encode<CallbacksShutdownRequest, D> for &CallbacksShutdownRequest
517 {
518 #[inline]
519 unsafe fn encode(
520 self,
521 encoder: &mut fidl::encoding::Encoder<'_, D>,
522 offset: usize,
523 _depth: fidl::encoding::Depth,
524 ) -> fidl::Result<()> {
525 encoder.debug_check_bounds::<CallbacksShutdownRequest>(offset);
526 unsafe {
527 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
529 (buf_ptr as *mut CallbacksShutdownRequest)
530 .write_unaligned((self as *const CallbacksShutdownRequest).read());
531 }
534 Ok(())
535 }
536 }
537 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Addr, D>>
538 fidl::encoding::Encode<CallbacksShutdownRequest, D> for (T0,)
539 {
540 #[inline]
541 unsafe fn encode(
542 self,
543 encoder: &mut fidl::encoding::Encoder<'_, D>,
544 offset: usize,
545 depth: fidl::encoding::Depth,
546 ) -> fidl::Result<()> {
547 encoder.debug_check_bounds::<CallbacksShutdownRequest>(offset);
548 self.0.encode(encoder, offset + 0, depth)?;
552 Ok(())
553 }
554 }
555
556 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
557 for CallbacksShutdownRequest
558 {
559 #[inline(always)]
560 fn new_empty() -> Self {
561 Self { addr: fidl::new_empty!(Addr, D) }
562 }
563
564 #[inline]
565 unsafe fn decode(
566 &mut self,
567 decoder: &mut fidl::encoding::Decoder<'_, D>,
568 offset: usize,
569 _depth: fidl::encoding::Depth,
570 ) -> fidl::Result<()> {
571 decoder.debug_check_bounds::<Self>(offset);
572 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
573 unsafe {
576 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
577 }
578 Ok(())
579 }
580 }
581
582 impl fidl::encoding::ValueTypeMarker for CallbacksTransportResetRequest {
583 type Borrowed<'a> = &'a Self;
584 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
585 value
586 }
587 }
588
589 unsafe impl fidl::encoding::TypeMarker for CallbacksTransportResetRequest {
590 type Owned = Self;
591
592 #[inline(always)]
593 fn inline_align(_context: fidl::encoding::Context) -> usize {
594 4
595 }
596
597 #[inline(always)]
598 fn inline_size(_context: fidl::encoding::Context) -> usize {
599 4
600 }
601 #[inline(always)]
602 fn encode_is_copy() -> bool {
603 true
604 }
605
606 #[inline(always)]
607 fn decode_is_copy() -> bool {
608 true
609 }
610 }
611
612 unsafe impl<D: fidl::encoding::ResourceDialect>
613 fidl::encoding::Encode<CallbacksTransportResetRequest, D>
614 for &CallbacksTransportResetRequest
615 {
616 #[inline]
617 unsafe fn encode(
618 self,
619 encoder: &mut fidl::encoding::Encoder<'_, D>,
620 offset: usize,
621 _depth: fidl::encoding::Depth,
622 ) -> fidl::Result<()> {
623 encoder.debug_check_bounds::<CallbacksTransportResetRequest>(offset);
624 unsafe {
625 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
627 (buf_ptr as *mut CallbacksTransportResetRequest)
628 .write_unaligned((self as *const CallbacksTransportResetRequest).read());
629 }
632 Ok(())
633 }
634 }
635 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
636 fidl::encoding::Encode<CallbacksTransportResetRequest, D> for (T0,)
637 {
638 #[inline]
639 unsafe fn encode(
640 self,
641 encoder: &mut fidl::encoding::Encoder<'_, D>,
642 offset: usize,
643 depth: fidl::encoding::Depth,
644 ) -> fidl::Result<()> {
645 encoder.debug_check_bounds::<CallbacksTransportResetRequest>(offset);
646 self.0.encode(encoder, offset + 0, depth)?;
650 Ok(())
651 }
652 }
653
654 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
655 for CallbacksTransportResetRequest
656 {
657 #[inline(always)]
658 fn new_empty() -> Self {
659 Self { new_cid: fidl::new_empty!(u32, D) }
660 }
661
662 #[inline]
663 unsafe fn decode(
664 &mut self,
665 decoder: &mut fidl::encoding::Decoder<'_, D>,
666 offset: usize,
667 _depth: fidl::encoding::Depth,
668 ) -> fidl::Result<()> {
669 decoder.debug_check_bounds::<Self>(offset);
670 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
671 unsafe {
674 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
675 }
676 Ok(())
677 }
678 }
679
680 impl fidl::encoding::ValueTypeMarker for DeviceGetCidResponse {
681 type Borrowed<'a> = &'a Self;
682 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
683 value
684 }
685 }
686
687 unsafe impl fidl::encoding::TypeMarker for DeviceGetCidResponse {
688 type Owned = Self;
689
690 #[inline(always)]
691 fn inline_align(_context: fidl::encoding::Context) -> usize {
692 4
693 }
694
695 #[inline(always)]
696 fn inline_size(_context: fidl::encoding::Context) -> usize {
697 4
698 }
699 #[inline(always)]
700 fn encode_is_copy() -> bool {
701 true
702 }
703
704 #[inline(always)]
705 fn decode_is_copy() -> bool {
706 true
707 }
708 }
709
710 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetCidResponse, D>
711 for &DeviceGetCidResponse
712 {
713 #[inline]
714 unsafe fn encode(
715 self,
716 encoder: &mut fidl::encoding::Encoder<'_, D>,
717 offset: usize,
718 _depth: fidl::encoding::Depth,
719 ) -> fidl::Result<()> {
720 encoder.debug_check_bounds::<DeviceGetCidResponse>(offset);
721 unsafe {
722 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
724 (buf_ptr as *mut DeviceGetCidResponse)
725 .write_unaligned((self as *const DeviceGetCidResponse).read());
726 }
729 Ok(())
730 }
731 }
732 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
733 fidl::encoding::Encode<DeviceGetCidResponse, D> for (T0,)
734 {
735 #[inline]
736 unsafe fn encode(
737 self,
738 encoder: &mut fidl::encoding::Encoder<'_, D>,
739 offset: usize,
740 depth: fidl::encoding::Depth,
741 ) -> fidl::Result<()> {
742 encoder.debug_check_bounds::<DeviceGetCidResponse>(offset);
743 self.0.encode(encoder, offset + 0, depth)?;
747 Ok(())
748 }
749 }
750
751 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetCidResponse {
752 #[inline(always)]
753 fn new_empty() -> Self {
754 Self { local_cid: fidl::new_empty!(u32, D) }
755 }
756
757 #[inline]
758 unsafe fn decode(
759 &mut self,
760 decoder: &mut fidl::encoding::Decoder<'_, D>,
761 offset: usize,
762 _depth: fidl::encoding::Depth,
763 ) -> fidl::Result<()> {
764 decoder.debug_check_bounds::<Self>(offset);
765 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
766 unsafe {
769 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
770 }
771 Ok(())
772 }
773 }
774
775 impl fidl::encoding::ValueTypeMarker for DeviceSendRstRequest {
776 type Borrowed<'a> = &'a Self;
777 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
778 value
779 }
780 }
781
782 unsafe impl fidl::encoding::TypeMarker for DeviceSendRstRequest {
783 type Owned = Self;
784
785 #[inline(always)]
786 fn inline_align(_context: fidl::encoding::Context) -> usize {
787 4
788 }
789
790 #[inline(always)]
791 fn inline_size(_context: fidl::encoding::Context) -> usize {
792 12
793 }
794 #[inline(always)]
795 fn encode_is_copy() -> bool {
796 true
797 }
798
799 #[inline(always)]
800 fn decode_is_copy() -> bool {
801 true
802 }
803 }
804
805 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceSendRstRequest, D>
806 for &DeviceSendRstRequest
807 {
808 #[inline]
809 unsafe fn encode(
810 self,
811 encoder: &mut fidl::encoding::Encoder<'_, D>,
812 offset: usize,
813 _depth: fidl::encoding::Depth,
814 ) -> fidl::Result<()> {
815 encoder.debug_check_bounds::<DeviceSendRstRequest>(offset);
816 unsafe {
817 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
819 (buf_ptr as *mut DeviceSendRstRequest)
820 .write_unaligned((self as *const DeviceSendRstRequest).read());
821 }
824 Ok(())
825 }
826 }
827 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Addr, D>>
828 fidl::encoding::Encode<DeviceSendRstRequest, D> for (T0,)
829 {
830 #[inline]
831 unsafe fn encode(
832 self,
833 encoder: &mut fidl::encoding::Encoder<'_, D>,
834 offset: usize,
835 depth: fidl::encoding::Depth,
836 ) -> fidl::Result<()> {
837 encoder.debug_check_bounds::<DeviceSendRstRequest>(offset);
838 self.0.encode(encoder, offset + 0, depth)?;
842 Ok(())
843 }
844 }
845
846 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceSendRstRequest {
847 #[inline(always)]
848 fn new_empty() -> Self {
849 Self { addr: fidl::new_empty!(Addr, D) }
850 }
851
852 #[inline]
853 unsafe fn decode(
854 &mut self,
855 decoder: &mut fidl::encoding::Decoder<'_, D>,
856 offset: usize,
857 _depth: fidl::encoding::Depth,
858 ) -> fidl::Result<()> {
859 decoder.debug_check_bounds::<Self>(offset);
860 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
861 unsafe {
864 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
865 }
866 Ok(())
867 }
868 }
869
870 impl fidl::encoding::ValueTypeMarker for DeviceSendShutdownRequest {
871 type Borrowed<'a> = &'a Self;
872 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
873 value
874 }
875 }
876
877 unsafe impl fidl::encoding::TypeMarker for DeviceSendShutdownRequest {
878 type Owned = Self;
879
880 #[inline(always)]
881 fn inline_align(_context: fidl::encoding::Context) -> usize {
882 4
883 }
884
885 #[inline(always)]
886 fn inline_size(_context: fidl::encoding::Context) -> usize {
887 12
888 }
889 #[inline(always)]
890 fn encode_is_copy() -> bool {
891 true
892 }
893
894 #[inline(always)]
895 fn decode_is_copy() -> bool {
896 true
897 }
898 }
899
900 unsafe impl<D: fidl::encoding::ResourceDialect>
901 fidl::encoding::Encode<DeviceSendShutdownRequest, D> for &DeviceSendShutdownRequest
902 {
903 #[inline]
904 unsafe fn encode(
905 self,
906 encoder: &mut fidl::encoding::Encoder<'_, D>,
907 offset: usize,
908 _depth: fidl::encoding::Depth,
909 ) -> fidl::Result<()> {
910 encoder.debug_check_bounds::<DeviceSendShutdownRequest>(offset);
911 unsafe {
912 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
914 (buf_ptr as *mut DeviceSendShutdownRequest)
915 .write_unaligned((self as *const DeviceSendShutdownRequest).read());
916 }
919 Ok(())
920 }
921 }
922 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Addr, D>>
923 fidl::encoding::Encode<DeviceSendShutdownRequest, D> for (T0,)
924 {
925 #[inline]
926 unsafe fn encode(
927 self,
928 encoder: &mut fidl::encoding::Encoder<'_, D>,
929 offset: usize,
930 depth: fidl::encoding::Depth,
931 ) -> fidl::Result<()> {
932 encoder.debug_check_bounds::<DeviceSendShutdownRequest>(offset);
933 self.0.encode(encoder, offset + 0, depth)?;
937 Ok(())
938 }
939 }
940
941 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
942 for DeviceSendShutdownRequest
943 {
944 #[inline(always)]
945 fn new_empty() -> Self {
946 Self { addr: fidl::new_empty!(Addr, D) }
947 }
948
949 #[inline]
950 unsafe fn decode(
951 &mut self,
952 decoder: &mut fidl::encoding::Decoder<'_, D>,
953 offset: usize,
954 _depth: fidl::encoding::Depth,
955 ) -> fidl::Result<()> {
956 decoder.debug_check_bounds::<Self>(offset);
957 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
958 unsafe {
961 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
962 }
963 Ok(())
964 }
965 }
966}