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