fidl_test_ping__common/
fidl_test_ping__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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 type PingString = String;
12
13pub type PongString = String;
14
15#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16pub struct PingPingRequest {
17    pub ping: String,
18}
19
20impl fidl::Persistable for PingPingRequest {}
21
22#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23pub struct PingPingResponse {
24    pub pong: String,
25}
26
27impl fidl::Persistable for PingPingResponse {}
28
29pub mod ping_ordinals {
30    pub const PING: u64 = 0x509ea7ec7cd43504;
31}
32
33mod internal {
34    use super::*;
35
36    impl fidl::encoding::ValueTypeMarker for PingPingRequest {
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 PingPingRequest {
44        type Owned = Self;
45
46        #[inline(always)]
47        fn inline_align(_context: fidl::encoding::Context) -> usize {
48            8
49        }
50
51        #[inline(always)]
52        fn inline_size(_context: fidl::encoding::Context) -> usize {
53            16
54        }
55    }
56
57    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PingPingRequest, D>
58        for &PingPingRequest
59    {
60        #[inline]
61        unsafe fn encode(
62            self,
63            encoder: &mut fidl::encoding::Encoder<'_, D>,
64            offset: usize,
65            _depth: fidl::encoding::Depth,
66        ) -> fidl::Result<()> {
67            encoder.debug_check_bounds::<PingPingRequest>(offset);
68            // Delegate to tuple encoding.
69            fidl::encoding::Encode::<PingPingRequest, D>::encode(
70                (<fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(
71                    &self.ping,
72                ),),
73                encoder,
74                offset,
75                _depth,
76            )
77        }
78    }
79    unsafe impl<
80            D: fidl::encoding::ResourceDialect,
81            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<100>, D>,
82        > fidl::encoding::Encode<PingPingRequest, 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::<PingPingRequest>(offset);
92            // Zero out padding regions. There's no need to apply masks
93            // because the unmasked parts will be overwritten by fields.
94            // Write the fields.
95            self.0.encode(encoder, offset + 0, depth)?;
96            Ok(())
97        }
98    }
99
100    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PingPingRequest {
101        #[inline(always)]
102        fn new_empty() -> Self {
103            Self { ping: fidl::new_empty!(fidl::encoding::BoundedString<100>, D) }
104        }
105
106        #[inline]
107        unsafe fn decode(
108            &mut self,
109            decoder: &mut fidl::encoding::Decoder<'_, D>,
110            offset: usize,
111            _depth: fidl::encoding::Depth,
112        ) -> fidl::Result<()> {
113            decoder.debug_check_bounds::<Self>(offset);
114            // Verify that padding bytes are zero.
115            fidl::decode!(
116                fidl::encoding::BoundedString<100>,
117                D,
118                &mut self.ping,
119                decoder,
120                offset + 0,
121                _depth
122            )?;
123            Ok(())
124        }
125    }
126
127    impl fidl::encoding::ValueTypeMarker for PingPingResponse {
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 PingPingResponse {
135        type Owned = Self;
136
137        #[inline(always)]
138        fn inline_align(_context: fidl::encoding::Context) -> usize {
139            8
140        }
141
142        #[inline(always)]
143        fn inline_size(_context: fidl::encoding::Context) -> usize {
144            16
145        }
146    }
147
148    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PingPingResponse, D>
149        for &PingPingResponse
150    {
151        #[inline]
152        unsafe fn encode(
153            self,
154            encoder: &mut fidl::encoding::Encoder<'_, D>,
155            offset: usize,
156            _depth: fidl::encoding::Depth,
157        ) -> fidl::Result<()> {
158            encoder.debug_check_bounds::<PingPingResponse>(offset);
159            // Delegate to tuple encoding.
160            fidl::encoding::Encode::<PingPingResponse, D>::encode(
161                (<fidl::encoding::BoundedString<105> as fidl::encoding::ValueTypeMarker>::borrow(
162                    &self.pong,
163                ),),
164                encoder,
165                offset,
166                _depth,
167            )
168        }
169    }
170    unsafe impl<
171            D: fidl::encoding::ResourceDialect,
172            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<105>, D>,
173        > fidl::encoding::Encode<PingPingResponse, D> for (T0,)
174    {
175        #[inline]
176        unsafe fn encode(
177            self,
178            encoder: &mut fidl::encoding::Encoder<'_, D>,
179            offset: usize,
180            depth: fidl::encoding::Depth,
181        ) -> fidl::Result<()> {
182            encoder.debug_check_bounds::<PingPingResponse>(offset);
183            // Zero out padding regions. There's no need to apply masks
184            // because the unmasked parts will be overwritten by fields.
185            // Write the fields.
186            self.0.encode(encoder, offset + 0, depth)?;
187            Ok(())
188        }
189    }
190
191    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PingPingResponse {
192        #[inline(always)]
193        fn new_empty() -> Self {
194            Self { pong: fidl::new_empty!(fidl::encoding::BoundedString<105>, D) }
195        }
196
197        #[inline]
198        unsafe fn decode(
199            &mut self,
200            decoder: &mut fidl::encoding::Decoder<'_, D>,
201            offset: usize,
202            _depth: fidl::encoding::Depth,
203        ) -> fidl::Result<()> {
204            decoder.debug_check_bounds::<Self>(offset);
205            // Verify that padding bytes are zero.
206            fidl::decode!(
207                fidl::encoding::BoundedString<105>,
208                D,
209                &mut self.pong,
210                decoder,
211                offset + 0,
212                _depth
213            )?;
214            Ok(())
215        }
216    }
217}