fidl_fuchsia_netemul_test__common/
fidl_fuchsia_netemul_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 CounterIncrementResponse {
14 pub value: u32,
15}
16
17impl fidl::Persistable for CounterIncrementResponse {}
18
19#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
20pub struct CounterSetAbortOnShutdownRequest {
21 pub abort: bool,
22}
23
24impl fidl::Persistable for CounterSetAbortOnShutdownRequest {}
25
26#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct CounterTryOpenDirectoryRequest {
28 pub path: String,
29}
30
31impl fidl::Persistable for CounterTryOpenDirectoryRequest {}
32
33mod internal {
34 use super::*;
35
36 impl fidl::encoding::ValueTypeMarker for CounterIncrementResponse {
37 type Borrowed<'a> = &'a Self;
38 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
39 value
40 }
41 }
42
43 unsafe impl fidl::encoding::TypeMarker for CounterIncrementResponse {
44 type Owned = Self;
45
46 #[inline(always)]
47 fn inline_align(_context: fidl::encoding::Context) -> usize {
48 4
49 }
50
51 #[inline(always)]
52 fn inline_size(_context: fidl::encoding::Context) -> usize {
53 4
54 }
55 #[inline(always)]
56 fn encode_is_copy() -> bool {
57 true
58 }
59
60 #[inline(always)]
61 fn decode_is_copy() -> bool {
62 true
63 }
64 }
65
66 unsafe impl<D: fidl::encoding::ResourceDialect>
67 fidl::encoding::Encode<CounterIncrementResponse, D> for &CounterIncrementResponse
68 {
69 #[inline]
70 unsafe fn encode(
71 self,
72 encoder: &mut fidl::encoding::Encoder<'_, D>,
73 offset: usize,
74 _depth: fidl::encoding::Depth,
75 ) -> fidl::Result<()> {
76 encoder.debug_check_bounds::<CounterIncrementResponse>(offset);
77 unsafe {
78 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
80 (buf_ptr as *mut CounterIncrementResponse)
81 .write_unaligned((self as *const CounterIncrementResponse).read());
82 }
85 Ok(())
86 }
87 }
88 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
89 fidl::encoding::Encode<CounterIncrementResponse, D> for (T0,)
90 {
91 #[inline]
92 unsafe fn encode(
93 self,
94 encoder: &mut fidl::encoding::Encoder<'_, D>,
95 offset: usize,
96 depth: fidl::encoding::Depth,
97 ) -> fidl::Result<()> {
98 encoder.debug_check_bounds::<CounterIncrementResponse>(offset);
99 self.0.encode(encoder, offset + 0, depth)?;
103 Ok(())
104 }
105 }
106
107 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
108 for CounterIncrementResponse
109 {
110 #[inline(always)]
111 fn new_empty() -> Self {
112 Self { value: fidl::new_empty!(u32, D) }
113 }
114
115 #[inline]
116 unsafe fn decode(
117 &mut self,
118 decoder: &mut fidl::encoding::Decoder<'_, D>,
119 offset: usize,
120 _depth: fidl::encoding::Depth,
121 ) -> fidl::Result<()> {
122 decoder.debug_check_bounds::<Self>(offset);
123 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
124 unsafe {
127 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
128 }
129 Ok(())
130 }
131 }
132
133 impl fidl::encoding::ValueTypeMarker for CounterSetAbortOnShutdownRequest {
134 type Borrowed<'a> = &'a Self;
135 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
136 value
137 }
138 }
139
140 unsafe impl fidl::encoding::TypeMarker for CounterSetAbortOnShutdownRequest {
141 type Owned = Self;
142
143 #[inline(always)]
144 fn inline_align(_context: fidl::encoding::Context) -> usize {
145 1
146 }
147
148 #[inline(always)]
149 fn inline_size(_context: fidl::encoding::Context) -> usize {
150 1
151 }
152 }
153
154 unsafe impl<D: fidl::encoding::ResourceDialect>
155 fidl::encoding::Encode<CounterSetAbortOnShutdownRequest, D>
156 for &CounterSetAbortOnShutdownRequest
157 {
158 #[inline]
159 unsafe fn encode(
160 self,
161 encoder: &mut fidl::encoding::Encoder<'_, D>,
162 offset: usize,
163 _depth: fidl::encoding::Depth,
164 ) -> fidl::Result<()> {
165 encoder.debug_check_bounds::<CounterSetAbortOnShutdownRequest>(offset);
166 fidl::encoding::Encode::<CounterSetAbortOnShutdownRequest, D>::encode(
168 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.abort),),
169 encoder,
170 offset,
171 _depth,
172 )
173 }
174 }
175 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
176 fidl::encoding::Encode<CounterSetAbortOnShutdownRequest, D> for (T0,)
177 {
178 #[inline]
179 unsafe fn encode(
180 self,
181 encoder: &mut fidl::encoding::Encoder<'_, D>,
182 offset: usize,
183 depth: fidl::encoding::Depth,
184 ) -> fidl::Result<()> {
185 encoder.debug_check_bounds::<CounterSetAbortOnShutdownRequest>(offset);
186 self.0.encode(encoder, offset + 0, depth)?;
190 Ok(())
191 }
192 }
193
194 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
195 for CounterSetAbortOnShutdownRequest
196 {
197 #[inline(always)]
198 fn new_empty() -> Self {
199 Self { abort: fidl::new_empty!(bool, D) }
200 }
201
202 #[inline]
203 unsafe fn decode(
204 &mut self,
205 decoder: &mut fidl::encoding::Decoder<'_, D>,
206 offset: usize,
207 _depth: fidl::encoding::Depth,
208 ) -> fidl::Result<()> {
209 decoder.debug_check_bounds::<Self>(offset);
210 fidl::decode!(bool, D, &mut self.abort, decoder, offset + 0, _depth)?;
212 Ok(())
213 }
214 }
215
216 impl fidl::encoding::ValueTypeMarker for CounterTryOpenDirectoryRequest {
217 type Borrowed<'a> = &'a Self;
218 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
219 value
220 }
221 }
222
223 unsafe impl fidl::encoding::TypeMarker for CounterTryOpenDirectoryRequest {
224 type Owned = Self;
225
226 #[inline(always)]
227 fn inline_align(_context: fidl::encoding::Context) -> usize {
228 8
229 }
230
231 #[inline(always)]
232 fn inline_size(_context: fidl::encoding::Context) -> usize {
233 16
234 }
235 }
236
237 unsafe impl<D: fidl::encoding::ResourceDialect>
238 fidl::encoding::Encode<CounterTryOpenDirectoryRequest, D>
239 for &CounterTryOpenDirectoryRequest
240 {
241 #[inline]
242 unsafe fn encode(
243 self,
244 encoder: &mut fidl::encoding::Encoder<'_, D>,
245 offset: usize,
246 _depth: fidl::encoding::Depth,
247 ) -> fidl::Result<()> {
248 encoder.debug_check_bounds::<CounterTryOpenDirectoryRequest>(offset);
249 fidl::encoding::Encode::<CounterTryOpenDirectoryRequest, D>::encode(
251 (<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(
252 &self.path,
253 ),),
254 encoder,
255 offset,
256 _depth,
257 )
258 }
259 }
260 unsafe impl<
261 D: fidl::encoding::ResourceDialect,
262 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4095>, D>,
263 > fidl::encoding::Encode<CounterTryOpenDirectoryRequest, D> for (T0,)
264 {
265 #[inline]
266 unsafe fn encode(
267 self,
268 encoder: &mut fidl::encoding::Encoder<'_, D>,
269 offset: usize,
270 depth: fidl::encoding::Depth,
271 ) -> fidl::Result<()> {
272 encoder.debug_check_bounds::<CounterTryOpenDirectoryRequest>(offset);
273 self.0.encode(encoder, offset + 0, depth)?;
277 Ok(())
278 }
279 }
280
281 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
282 for CounterTryOpenDirectoryRequest
283 {
284 #[inline(always)]
285 fn new_empty() -> Self {
286 Self { path: fidl::new_empty!(fidl::encoding::BoundedString<4095>, D) }
287 }
288
289 #[inline]
290 unsafe fn decode(
291 &mut self,
292 decoder: &mut fidl::encoding::Decoder<'_, D>,
293 offset: usize,
294 _depth: fidl::encoding::Depth,
295 ) -> fidl::Result<()> {
296 decoder.debug_check_bounds::<Self>(offset);
297 fidl::decode!(
299 fidl::encoding::BoundedString<4095>,
300 D,
301 &mut self.path,
302 decoder,
303 offset + 0,
304 _depth
305 )?;
306 Ok(())
307 }
308 }
309}