fidl_fuchsia_basicdriver_ctftest__common/
fidl_fuchsia_basicdriver_ctftest__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
11#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12#[repr(C)]
13pub struct DevicePingResponse {
14    pub pong: u32,
15}
16
17impl fidl::Persistable for DevicePingResponse {}
18
19pub mod device_ordinals {
20    pub const PING: u64 = 0x53eb4e98ccf32729;
21}
22
23pub mod waiter_ordinals {
24    pub const ACK: u64 = 0x70e5c3f344540efa;
25}
26
27mod internal {
28    use super::*;
29
30    impl fidl::encoding::ValueTypeMarker for DevicePingResponse {
31        type Borrowed<'a> = &'a Self;
32        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
33            value
34        }
35    }
36
37    unsafe impl fidl::encoding::TypeMarker for DevicePingResponse {
38        type Owned = Self;
39
40        #[inline(always)]
41        fn inline_align(_context: fidl::encoding::Context) -> usize {
42            4
43        }
44
45        #[inline(always)]
46        fn inline_size(_context: fidl::encoding::Context) -> usize {
47            4
48        }
49        #[inline(always)]
50        fn encode_is_copy() -> bool {
51            true
52        }
53
54        #[inline(always)]
55        fn decode_is_copy() -> bool {
56            true
57        }
58    }
59
60    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DevicePingResponse, D>
61        for &DevicePingResponse
62    {
63        #[inline]
64        unsafe fn encode(
65            self,
66            encoder: &mut fidl::encoding::Encoder<'_, D>,
67            offset: usize,
68            _depth: fidl::encoding::Depth,
69        ) -> fidl::Result<()> {
70            encoder.debug_check_bounds::<DevicePingResponse>(offset);
71            unsafe {
72                // Copy the object into the buffer.
73                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
74                (buf_ptr as *mut DevicePingResponse)
75                    .write_unaligned((self as *const DevicePingResponse).read());
76                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
77                // done second because the memcpy will write garbage to these bytes.
78            }
79            Ok(())
80        }
81    }
82    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
83        fidl::encoding::Encode<DevicePingResponse, D> for (T0,)
84    {
85        #[inline]
86        unsafe fn encode(
87            self,
88            encoder: &mut fidl::encoding::Encoder<'_, D>,
89            offset: usize,
90            depth: fidl::encoding::Depth,
91        ) -> fidl::Result<()> {
92            encoder.debug_check_bounds::<DevicePingResponse>(offset);
93            // Zero out padding regions. There's no need to apply masks
94            // because the unmasked parts will be overwritten by fields.
95            // Write the fields.
96            self.0.encode(encoder, offset + 0, depth)?;
97            Ok(())
98        }
99    }
100
101    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DevicePingResponse {
102        #[inline(always)]
103        fn new_empty() -> Self {
104            Self { pong: fidl::new_empty!(u32, D) }
105        }
106
107        #[inline]
108        unsafe fn decode(
109            &mut self,
110            decoder: &mut fidl::encoding::Decoder<'_, D>,
111            offset: usize,
112            _depth: fidl::encoding::Depth,
113        ) -> fidl::Result<()> {
114            decoder.debug_check_bounds::<Self>(offset);
115            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
116            // Verify that padding bytes are zero.
117            // Copy from the buffer into the object.
118            unsafe {
119                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
120            }
121            Ok(())
122        }
123    }
124}