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