fidl_fuchsia_vsock_common/
fidl_fuchsia_vsock_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
11pub const SIGNAL_STREAM_INCOMING: u32 = USER_SIGNAL_0 as u32;
12
13pub const USER_SIGNAL_0: u32 = 16777216;
14
15#[derive(Clone, Debug, PartialEq)]
16pub struct AcceptorAcceptRequest {
17 pub addr: fidl_fuchsia_hardware_vsock::Addr,
18}
19
20impl fidl::Persistable for AcceptorAcceptRequest {}
21
22#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23#[repr(C)]
24pub struct ConnectorConnectResponse {
25 pub local_port: u32,
26}
27
28impl fidl::Persistable for ConnectorConnectResponse {}
29
30#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31#[repr(C)]
32pub struct ListenerListenRequest {
33 pub backlog: u32,
36}
37
38impl fidl::Persistable for ListenerListenRequest {}
39
40#[derive(Clone, Debug, PartialEq)]
41pub struct ListenerAcceptResponse {
42 pub addr: fidl_fuchsia_hardware_vsock::Addr,
43}
44
45impl fidl::Persistable for ListenerAcceptResponse {}
46
47mod internal {
48 use super::*;
49
50 impl fidl::encoding::ValueTypeMarker for AcceptorAcceptRequest {
51 type Borrowed<'a> = &'a Self;
52 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
53 value
54 }
55 }
56
57 unsafe impl fidl::encoding::TypeMarker for AcceptorAcceptRequest {
58 type Owned = Self;
59
60 #[inline(always)]
61 fn inline_align(_context: fidl::encoding::Context) -> usize {
62 4
63 }
64
65 #[inline(always)]
66 fn inline_size(_context: fidl::encoding::Context) -> usize {
67 12
68 }
69 }
70
71 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AcceptorAcceptRequest, D>
72 for &AcceptorAcceptRequest
73 {
74 #[inline]
75 unsafe fn encode(
76 self,
77 encoder: &mut fidl::encoding::Encoder<'_, D>,
78 offset: usize,
79 _depth: fidl::encoding::Depth,
80 ) -> fidl::Result<()> {
81 encoder.debug_check_bounds::<AcceptorAcceptRequest>(offset);
82 fidl::encoding::Encode::<AcceptorAcceptRequest, D>::encode(
84 (<fidl_fuchsia_hardware_vsock::Addr as fidl::encoding::ValueTypeMarker>::borrow(
85 &self.addr,
86 ),),
87 encoder,
88 offset,
89 _depth,
90 )
91 }
92 }
93 unsafe impl<
94 D: fidl::encoding::ResourceDialect,
95 T0: fidl::encoding::Encode<fidl_fuchsia_hardware_vsock::Addr, D>,
96 > fidl::encoding::Encode<AcceptorAcceptRequest, D> for (T0,)
97 {
98 #[inline]
99 unsafe fn encode(
100 self,
101 encoder: &mut fidl::encoding::Encoder<'_, D>,
102 offset: usize,
103 depth: fidl::encoding::Depth,
104 ) -> fidl::Result<()> {
105 encoder.debug_check_bounds::<AcceptorAcceptRequest>(offset);
106 self.0.encode(encoder, offset + 0, depth)?;
110 Ok(())
111 }
112 }
113
114 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AcceptorAcceptRequest {
115 #[inline(always)]
116 fn new_empty() -> Self {
117 Self { addr: fidl::new_empty!(fidl_fuchsia_hardware_vsock::Addr, D) }
118 }
119
120 #[inline]
121 unsafe fn decode(
122 &mut self,
123 decoder: &mut fidl::encoding::Decoder<'_, D>,
124 offset: usize,
125 _depth: fidl::encoding::Depth,
126 ) -> fidl::Result<()> {
127 decoder.debug_check_bounds::<Self>(offset);
128 fidl::decode!(
130 fidl_fuchsia_hardware_vsock::Addr,
131 D,
132 &mut self.addr,
133 decoder,
134 offset + 0,
135 _depth
136 )?;
137 Ok(())
138 }
139 }
140
141 impl fidl::encoding::ValueTypeMarker for ConnectorConnectResponse {
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 ConnectorConnectResponse {
149 type Owned = Self;
150
151 #[inline(always)]
152 fn inline_align(_context: fidl::encoding::Context) -> usize {
153 4
154 }
155
156 #[inline(always)]
157 fn inline_size(_context: fidl::encoding::Context) -> usize {
158 4
159 }
160 #[inline(always)]
161 fn encode_is_copy() -> bool {
162 true
163 }
164
165 #[inline(always)]
166 fn decode_is_copy() -> bool {
167 true
168 }
169 }
170
171 unsafe impl<D: fidl::encoding::ResourceDialect>
172 fidl::encoding::Encode<ConnectorConnectResponse, D> for &ConnectorConnectResponse
173 {
174 #[inline]
175 unsafe fn encode(
176 self,
177 encoder: &mut fidl::encoding::Encoder<'_, D>,
178 offset: usize,
179 _depth: fidl::encoding::Depth,
180 ) -> fidl::Result<()> {
181 encoder.debug_check_bounds::<ConnectorConnectResponse>(offset);
182 unsafe {
183 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
185 (buf_ptr as *mut ConnectorConnectResponse)
186 .write_unaligned((self as *const ConnectorConnectResponse).read());
187 }
190 Ok(())
191 }
192 }
193 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
194 fidl::encoding::Encode<ConnectorConnectResponse, D> for (T0,)
195 {
196 #[inline]
197 unsafe fn encode(
198 self,
199 encoder: &mut fidl::encoding::Encoder<'_, D>,
200 offset: usize,
201 depth: fidl::encoding::Depth,
202 ) -> fidl::Result<()> {
203 encoder.debug_check_bounds::<ConnectorConnectResponse>(offset);
204 self.0.encode(encoder, offset + 0, depth)?;
208 Ok(())
209 }
210 }
211
212 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
213 for ConnectorConnectResponse
214 {
215 #[inline(always)]
216 fn new_empty() -> Self {
217 Self { local_port: fidl::new_empty!(u32, D) }
218 }
219
220 #[inline]
221 unsafe fn decode(
222 &mut self,
223 decoder: &mut fidl::encoding::Decoder<'_, D>,
224 offset: usize,
225 _depth: fidl::encoding::Depth,
226 ) -> fidl::Result<()> {
227 decoder.debug_check_bounds::<Self>(offset);
228 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
229 unsafe {
232 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
233 }
234 Ok(())
235 }
236 }
237
238 impl fidl::encoding::ValueTypeMarker for ListenerListenRequest {
239 type Borrowed<'a> = &'a Self;
240 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
241 value
242 }
243 }
244
245 unsafe impl fidl::encoding::TypeMarker for ListenerListenRequest {
246 type Owned = Self;
247
248 #[inline(always)]
249 fn inline_align(_context: fidl::encoding::Context) -> usize {
250 4
251 }
252
253 #[inline(always)]
254 fn inline_size(_context: fidl::encoding::Context) -> usize {
255 4
256 }
257 #[inline(always)]
258 fn encode_is_copy() -> bool {
259 true
260 }
261
262 #[inline(always)]
263 fn decode_is_copy() -> bool {
264 true
265 }
266 }
267
268 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ListenerListenRequest, D>
269 for &ListenerListenRequest
270 {
271 #[inline]
272 unsafe fn encode(
273 self,
274 encoder: &mut fidl::encoding::Encoder<'_, D>,
275 offset: usize,
276 _depth: fidl::encoding::Depth,
277 ) -> fidl::Result<()> {
278 encoder.debug_check_bounds::<ListenerListenRequest>(offset);
279 unsafe {
280 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
282 (buf_ptr as *mut ListenerListenRequest)
283 .write_unaligned((self as *const ListenerListenRequest).read());
284 }
287 Ok(())
288 }
289 }
290 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
291 fidl::encoding::Encode<ListenerListenRequest, D> for (T0,)
292 {
293 #[inline]
294 unsafe fn encode(
295 self,
296 encoder: &mut fidl::encoding::Encoder<'_, D>,
297 offset: usize,
298 depth: fidl::encoding::Depth,
299 ) -> fidl::Result<()> {
300 encoder.debug_check_bounds::<ListenerListenRequest>(offset);
301 self.0.encode(encoder, offset + 0, depth)?;
305 Ok(())
306 }
307 }
308
309 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ListenerListenRequest {
310 #[inline(always)]
311 fn new_empty() -> Self {
312 Self { backlog: fidl::new_empty!(u32, D) }
313 }
314
315 #[inline]
316 unsafe fn decode(
317 &mut self,
318 decoder: &mut fidl::encoding::Decoder<'_, D>,
319 offset: usize,
320 _depth: fidl::encoding::Depth,
321 ) -> fidl::Result<()> {
322 decoder.debug_check_bounds::<Self>(offset);
323 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
324 unsafe {
327 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
328 }
329 Ok(())
330 }
331 }
332
333 impl fidl::encoding::ValueTypeMarker for ListenerAcceptResponse {
334 type Borrowed<'a> = &'a Self;
335 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
336 value
337 }
338 }
339
340 unsafe impl fidl::encoding::TypeMarker for ListenerAcceptResponse {
341 type Owned = Self;
342
343 #[inline(always)]
344 fn inline_align(_context: fidl::encoding::Context) -> usize {
345 4
346 }
347
348 #[inline(always)]
349 fn inline_size(_context: fidl::encoding::Context) -> usize {
350 12
351 }
352 }
353
354 unsafe impl<D: fidl::encoding::ResourceDialect>
355 fidl::encoding::Encode<ListenerAcceptResponse, D> for &ListenerAcceptResponse
356 {
357 #[inline]
358 unsafe fn encode(
359 self,
360 encoder: &mut fidl::encoding::Encoder<'_, D>,
361 offset: usize,
362 _depth: fidl::encoding::Depth,
363 ) -> fidl::Result<()> {
364 encoder.debug_check_bounds::<ListenerAcceptResponse>(offset);
365 fidl::encoding::Encode::<ListenerAcceptResponse, D>::encode(
367 (<fidl_fuchsia_hardware_vsock::Addr as fidl::encoding::ValueTypeMarker>::borrow(
368 &self.addr,
369 ),),
370 encoder,
371 offset,
372 _depth,
373 )
374 }
375 }
376 unsafe impl<
377 D: fidl::encoding::ResourceDialect,
378 T0: fidl::encoding::Encode<fidl_fuchsia_hardware_vsock::Addr, D>,
379 > fidl::encoding::Encode<ListenerAcceptResponse, D> for (T0,)
380 {
381 #[inline]
382 unsafe fn encode(
383 self,
384 encoder: &mut fidl::encoding::Encoder<'_, D>,
385 offset: usize,
386 depth: fidl::encoding::Depth,
387 ) -> fidl::Result<()> {
388 encoder.debug_check_bounds::<ListenerAcceptResponse>(offset);
389 self.0.encode(encoder, offset + 0, depth)?;
393 Ok(())
394 }
395 }
396
397 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
398 for ListenerAcceptResponse
399 {
400 #[inline(always)]
401 fn new_empty() -> Self {
402 Self { addr: fidl::new_empty!(fidl_fuchsia_hardware_vsock::Addr, D) }
403 }
404
405 #[inline]
406 unsafe fn decode(
407 &mut self,
408 decoder: &mut fidl::encoding::Decoder<'_, D>,
409 offset: usize,
410 _depth: fidl::encoding::Depth,
411 ) -> fidl::Result<()> {
412 decoder.debug_check_bounds::<Self>(offset);
413 fidl::decode!(
415 fidl_fuchsia_hardware_vsock::Addr,
416 D,
417 &mut self.addr,
418 decoder,
419 offset + 0,
420 _depth
421 )?;
422 Ok(())
423 }
424 }
425}