fidl_fuchsia_nodegroup_test_common/
fidl_fuchsia_nodegroup_test_common.rs1#![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 DeviceGetNumberResponse {
14 pub number: u32,
15}
16
17impl fidl::Persistable for DeviceGetNumberResponse {}
18
19#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
20#[repr(C)]
21pub struct WaiterAckRequest {
22 pub status: i32,
23}
24
25impl fidl::Persistable for WaiterAckRequest {}
26
27mod internal {
28 use super::*;
29
30 impl fidl::encoding::ValueTypeMarker for DeviceGetNumberResponse {
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 DeviceGetNumberResponse {
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>
61 fidl::encoding::Encode<DeviceGetNumberResponse, D> for &DeviceGetNumberResponse
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::<DeviceGetNumberResponse>(offset);
71 unsafe {
72 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
74 (buf_ptr as *mut DeviceGetNumberResponse)
75 .write_unaligned((self as *const DeviceGetNumberResponse).read());
76 }
79 Ok(())
80 }
81 }
82 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
83 fidl::encoding::Encode<DeviceGetNumberResponse, 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::<DeviceGetNumberResponse>(offset);
93 self.0.encode(encoder, offset + 0, depth)?;
97 Ok(())
98 }
99 }
100
101 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
102 for DeviceGetNumberResponse
103 {
104 #[inline(always)]
105 fn new_empty() -> Self {
106 Self { number: fidl::new_empty!(u32, D) }
107 }
108
109 #[inline]
110 unsafe fn decode(
111 &mut self,
112 decoder: &mut fidl::encoding::Decoder<'_, D>,
113 offset: usize,
114 _depth: fidl::encoding::Depth,
115 ) -> fidl::Result<()> {
116 decoder.debug_check_bounds::<Self>(offset);
117 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
118 unsafe {
121 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
122 }
123 Ok(())
124 }
125 }
126
127 impl fidl::encoding::ValueTypeMarker for WaiterAckRequest {
128 type Borrowed<'a> = &'a Self;
129 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
130 value
131 }
132 }
133
134 unsafe impl fidl::encoding::TypeMarker for WaiterAckRequest {
135 type Owned = Self;
136
137 #[inline(always)]
138 fn inline_align(_context: fidl::encoding::Context) -> usize {
139 4
140 }
141
142 #[inline(always)]
143 fn inline_size(_context: fidl::encoding::Context) -> usize {
144 4
145 }
146 #[inline(always)]
147 fn encode_is_copy() -> bool {
148 true
149 }
150
151 #[inline(always)]
152 fn decode_is_copy() -> bool {
153 true
154 }
155 }
156
157 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WaiterAckRequest, D>
158 for &WaiterAckRequest
159 {
160 #[inline]
161 unsafe fn encode(
162 self,
163 encoder: &mut fidl::encoding::Encoder<'_, D>,
164 offset: usize,
165 _depth: fidl::encoding::Depth,
166 ) -> fidl::Result<()> {
167 encoder.debug_check_bounds::<WaiterAckRequest>(offset);
168 unsafe {
169 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
171 (buf_ptr as *mut WaiterAckRequest)
172 .write_unaligned((self as *const WaiterAckRequest).read());
173 }
176 Ok(())
177 }
178 }
179 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
180 fidl::encoding::Encode<WaiterAckRequest, D> for (T0,)
181 {
182 #[inline]
183 unsafe fn encode(
184 self,
185 encoder: &mut fidl::encoding::Encoder<'_, D>,
186 offset: usize,
187 depth: fidl::encoding::Depth,
188 ) -> fidl::Result<()> {
189 encoder.debug_check_bounds::<WaiterAckRequest>(offset);
190 self.0.encode(encoder, offset + 0, depth)?;
194 Ok(())
195 }
196 }
197
198 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WaiterAckRequest {
199 #[inline(always)]
200 fn new_empty() -> Self {
201 Self { status: fidl::new_empty!(i32, D) }
202 }
203
204 #[inline]
205 unsafe fn decode(
206 &mut self,
207 decoder: &mut fidl::encoding::Decoder<'_, D>,
208 offset: usize,
209 _depth: fidl::encoding::Depth,
210 ) -> fidl::Result<()> {
211 decoder.debug_check_bounds::<Self>(offset);
212 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
213 unsafe {
216 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
217 }
218 Ok(())
219 }
220 }
221}