fidl_fuchsia_testing_proxy__common/
fidl_fuchsia_testing_proxy__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 TcpProxyControlOpenProxyResponse {
14 pub open_port: u16,
15}
16
17impl fidl::Persistable for TcpProxyControlOpenProxyResponse {}
18
19pub mod tcp_proxy__ordinals {}
20
21pub mod tcp_proxy_control_ordinals {
22 pub const OPEN_PROXY_: u64 = 0x6e2c348c371061e2;
23}
24
25mod internal {
26 use super::*;
27
28 impl fidl::encoding::ValueTypeMarker for TcpProxyControlOpenProxyResponse {
29 type Borrowed<'a> = &'a Self;
30 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
31 value
32 }
33 }
34
35 unsafe impl fidl::encoding::TypeMarker for TcpProxyControlOpenProxyResponse {
36 type Owned = Self;
37
38 #[inline(always)]
39 fn inline_align(_context: fidl::encoding::Context) -> usize {
40 2
41 }
42
43 #[inline(always)]
44 fn inline_size(_context: fidl::encoding::Context) -> usize {
45 2
46 }
47 #[inline(always)]
48 fn encode_is_copy() -> bool {
49 true
50 }
51
52 #[inline(always)]
53 fn decode_is_copy() -> bool {
54 true
55 }
56 }
57
58 unsafe impl<D: fidl::encoding::ResourceDialect>
59 fidl::encoding::Encode<TcpProxyControlOpenProxyResponse, D>
60 for &TcpProxyControlOpenProxyResponse
61 {
62 #[inline]
63 unsafe fn encode(
64 self,
65 encoder: &mut fidl::encoding::Encoder<'_, D>,
66 offset: usize,
67 _depth: fidl::encoding::Depth,
68 ) -> fidl::Result<()> {
69 encoder.debug_check_bounds::<TcpProxyControlOpenProxyResponse>(offset);
70 unsafe {
71 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
73 (buf_ptr as *mut TcpProxyControlOpenProxyResponse)
74 .write_unaligned((self as *const TcpProxyControlOpenProxyResponse).read());
75 }
78 Ok(())
79 }
80 }
81 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
82 fidl::encoding::Encode<TcpProxyControlOpenProxyResponse, D> for (T0,)
83 {
84 #[inline]
85 unsafe fn encode(
86 self,
87 encoder: &mut fidl::encoding::Encoder<'_, D>,
88 offset: usize,
89 depth: fidl::encoding::Depth,
90 ) -> fidl::Result<()> {
91 encoder.debug_check_bounds::<TcpProxyControlOpenProxyResponse>(offset);
92 self.0.encode(encoder, offset + 0, depth)?;
96 Ok(())
97 }
98 }
99
100 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
101 for TcpProxyControlOpenProxyResponse
102 {
103 #[inline(always)]
104 fn new_empty() -> Self {
105 Self { open_port: fidl::new_empty!(u16, D) }
106 }
107
108 #[inline]
109 unsafe fn decode(
110 &mut self,
111 decoder: &mut fidl::encoding::Decoder<'_, D>,
112 offset: usize,
113 _depth: fidl::encoding::Depth,
114 ) -> fidl::Result<()> {
115 decoder.debug_check_bounds::<Self>(offset);
116 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
117 unsafe {
120 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
121 }
122 Ok(())
123 }
124 }
125}