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
33pub mod counter_ordinals {
34 pub const INCREMENT: u64 = 0x60cf610cd915d7a9;
35 pub const CONNECT_TO_PROTOCOL: u64 = 0x75ea8d3a0e7a4f68;
36 pub const OPEN_IN_NAMESPACE: u64 = 0x393b5808935aee83;
37 pub const TRY_OPEN_DIRECTORY: u64 = 0x37310702b1c8b863;
38 pub const SET_ABORT_ON_SHUTDOWN: u64 = 0x1d9c7aac19741829;
39}
40
41mod internal {
42 use super::*;
43
44 impl fidl::encoding::ValueTypeMarker for CounterIncrementResponse {
45 type Borrowed<'a> = &'a Self;
46 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
47 value
48 }
49 }
50
51 unsafe impl fidl::encoding::TypeMarker for CounterIncrementResponse {
52 type Owned = Self;
53
54 #[inline(always)]
55 fn inline_align(_context: fidl::encoding::Context) -> usize {
56 4
57 }
58
59 #[inline(always)]
60 fn inline_size(_context: fidl::encoding::Context) -> usize {
61 4
62 }
63 #[inline(always)]
64 fn encode_is_copy() -> bool {
65 true
66 }
67
68 #[inline(always)]
69 fn decode_is_copy() -> bool {
70 true
71 }
72 }
73
74 unsafe impl<D: fidl::encoding::ResourceDialect>
75 fidl::encoding::Encode<CounterIncrementResponse, D> for &CounterIncrementResponse
76 {
77 #[inline]
78 unsafe fn encode(
79 self,
80 encoder: &mut fidl::encoding::Encoder<'_, D>,
81 offset: usize,
82 _depth: fidl::encoding::Depth,
83 ) -> fidl::Result<()> {
84 encoder.debug_check_bounds::<CounterIncrementResponse>(offset);
85 unsafe {
86 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
88 (buf_ptr as *mut CounterIncrementResponse)
89 .write_unaligned((self as *const CounterIncrementResponse).read());
90 }
93 Ok(())
94 }
95 }
96 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
97 fidl::encoding::Encode<CounterIncrementResponse, D> for (T0,)
98 {
99 #[inline]
100 unsafe fn encode(
101 self,
102 encoder: &mut fidl::encoding::Encoder<'_, D>,
103 offset: usize,
104 depth: fidl::encoding::Depth,
105 ) -> fidl::Result<()> {
106 encoder.debug_check_bounds::<CounterIncrementResponse>(offset);
107 self.0.encode(encoder, offset + 0, depth)?;
111 Ok(())
112 }
113 }
114
115 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
116 for CounterIncrementResponse
117 {
118 #[inline(always)]
119 fn new_empty() -> Self {
120 Self { value: fidl::new_empty!(u32, D) }
121 }
122
123 #[inline]
124 unsafe fn decode(
125 &mut self,
126 decoder: &mut fidl::encoding::Decoder<'_, D>,
127 offset: usize,
128 _depth: fidl::encoding::Depth,
129 ) -> fidl::Result<()> {
130 decoder.debug_check_bounds::<Self>(offset);
131 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
132 unsafe {
135 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
136 }
137 Ok(())
138 }
139 }
140
141 impl fidl::encoding::ValueTypeMarker for CounterSetAbortOnShutdownRequest {
142 type Borrowed<'a> = &'a Self;
143 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
144 value
145 }
146 }
147
148 unsafe impl fidl::encoding::TypeMarker for CounterSetAbortOnShutdownRequest {
149 type Owned = Self;
150
151 #[inline(always)]
152 fn inline_align(_context: fidl::encoding::Context) -> usize {
153 1
154 }
155
156 #[inline(always)]
157 fn inline_size(_context: fidl::encoding::Context) -> usize {
158 1
159 }
160 }
161
162 unsafe impl<D: fidl::encoding::ResourceDialect>
163 fidl::encoding::Encode<CounterSetAbortOnShutdownRequest, D>
164 for &CounterSetAbortOnShutdownRequest
165 {
166 #[inline]
167 unsafe fn encode(
168 self,
169 encoder: &mut fidl::encoding::Encoder<'_, D>,
170 offset: usize,
171 _depth: fidl::encoding::Depth,
172 ) -> fidl::Result<()> {
173 encoder.debug_check_bounds::<CounterSetAbortOnShutdownRequest>(offset);
174 fidl::encoding::Encode::<CounterSetAbortOnShutdownRequest, D>::encode(
176 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.abort),),
177 encoder,
178 offset,
179 _depth,
180 )
181 }
182 }
183 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
184 fidl::encoding::Encode<CounterSetAbortOnShutdownRequest, D> for (T0,)
185 {
186 #[inline]
187 unsafe fn encode(
188 self,
189 encoder: &mut fidl::encoding::Encoder<'_, D>,
190 offset: usize,
191 depth: fidl::encoding::Depth,
192 ) -> fidl::Result<()> {
193 encoder.debug_check_bounds::<CounterSetAbortOnShutdownRequest>(offset);
194 self.0.encode(encoder, offset + 0, depth)?;
198 Ok(())
199 }
200 }
201
202 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
203 for CounterSetAbortOnShutdownRequest
204 {
205 #[inline(always)]
206 fn new_empty() -> Self {
207 Self { abort: fidl::new_empty!(bool, D) }
208 }
209
210 #[inline]
211 unsafe fn decode(
212 &mut self,
213 decoder: &mut fidl::encoding::Decoder<'_, D>,
214 offset: usize,
215 _depth: fidl::encoding::Depth,
216 ) -> fidl::Result<()> {
217 decoder.debug_check_bounds::<Self>(offset);
218 fidl::decode!(bool, D, &mut self.abort, decoder, offset + 0, _depth)?;
220 Ok(())
221 }
222 }
223
224 impl fidl::encoding::ValueTypeMarker for CounterTryOpenDirectoryRequest {
225 type Borrowed<'a> = &'a Self;
226 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
227 value
228 }
229 }
230
231 unsafe impl fidl::encoding::TypeMarker for CounterTryOpenDirectoryRequest {
232 type Owned = Self;
233
234 #[inline(always)]
235 fn inline_align(_context: fidl::encoding::Context) -> usize {
236 8
237 }
238
239 #[inline(always)]
240 fn inline_size(_context: fidl::encoding::Context) -> usize {
241 16
242 }
243 }
244
245 unsafe impl<D: fidl::encoding::ResourceDialect>
246 fidl::encoding::Encode<CounterTryOpenDirectoryRequest, D>
247 for &CounterTryOpenDirectoryRequest
248 {
249 #[inline]
250 unsafe fn encode(
251 self,
252 encoder: &mut fidl::encoding::Encoder<'_, D>,
253 offset: usize,
254 _depth: fidl::encoding::Depth,
255 ) -> fidl::Result<()> {
256 encoder.debug_check_bounds::<CounterTryOpenDirectoryRequest>(offset);
257 fidl::encoding::Encode::<CounterTryOpenDirectoryRequest, D>::encode(
259 (<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(
260 &self.path,
261 ),),
262 encoder,
263 offset,
264 _depth,
265 )
266 }
267 }
268 unsafe impl<
269 D: fidl::encoding::ResourceDialect,
270 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4095>, D>,
271 > fidl::encoding::Encode<CounterTryOpenDirectoryRequest, D> for (T0,)
272 {
273 #[inline]
274 unsafe fn encode(
275 self,
276 encoder: &mut fidl::encoding::Encoder<'_, D>,
277 offset: usize,
278 depth: fidl::encoding::Depth,
279 ) -> fidl::Result<()> {
280 encoder.debug_check_bounds::<CounterTryOpenDirectoryRequest>(offset);
281 self.0.encode(encoder, offset + 0, depth)?;
285 Ok(())
286 }
287 }
288
289 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
290 for CounterTryOpenDirectoryRequest
291 {
292 #[inline(always)]
293 fn new_empty() -> Self {
294 Self { path: fidl::new_empty!(fidl::encoding::BoundedString<4095>, D) }
295 }
296
297 #[inline]
298 unsafe fn decode(
299 &mut self,
300 decoder: &mut fidl::encoding::Decoder<'_, D>,
301 offset: usize,
302 _depth: fidl::encoding::Depth,
303 ) -> fidl::Result<()> {
304 decoder.debug_check_bounds::<Self>(offset);
305 fidl::decode!(
307 fidl::encoding::BoundedString<4095>,
308 D,
309 &mut self.path,
310 decoder,
311 offset + 0,
312 _depth
313 )?;
314 Ok(())
315 }
316 }
317}