fidl_test_time_realm__common/
fidl_test_time_realm__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 MAX_TIME_UPDATES: u64 = 100;
17
18#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
19#[repr(C)]
20pub struct ConnectionsResponse {
21 pub num_lifetime_connections: u32,
22}
23
24impl fidl::Persistable for ConnectionsResponse {}
25
26#[derive(Clone, Debug, PartialEq)]
27pub struct SetSampleArgs {
28 pub sample: fidl_fuchsia_time_external__common::TimeSample,
29}
30
31impl fidl::Persistable for SetSampleArgs {}
32
33#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
34pub struct SetStatusArgs {
35 pub status: fidl_fuchsia_time_external__common::Status,
36}
37
38impl fidl::Persistable for SetStatusArgs {}
39
40pub mod push_source_puppet_ordinals {
41 pub const SET_SAMPLE: u64 = 0x2819099d8cadf9d6;
42 pub const SET_STATUS: u64 = 0x5aaa3bde01f79ca6;
43 pub const CRASH: u64 = 0x76872d19611aa8ac;
44 pub const GET_LIFETIME_SERVED_CONNECTIONS: u64 = 0x131f6c16b577fd05;
45}
46
47pub mod realm_factory_ordinals {
48 pub const CREATE_REALM: u64 = 0x601159669adee8b6;
49}
50
51pub mod rtc_updates_ordinals {
52 pub const GET: u64 = 0x5a797db0c0d68c8a;
53}
54
55mod internal {
56 use super::*;
57
58 impl fidl::encoding::ValueTypeMarker for ConnectionsResponse {
59 type Borrowed<'a> = &'a Self;
60 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
61 value
62 }
63 }
64
65 unsafe impl fidl::encoding::TypeMarker for ConnectionsResponse {
66 type Owned = Self;
67
68 #[inline(always)]
69 fn inline_align(_context: fidl::encoding::Context) -> usize {
70 4
71 }
72
73 #[inline(always)]
74 fn inline_size(_context: fidl::encoding::Context) -> usize {
75 4
76 }
77 #[inline(always)]
78 fn encode_is_copy() -> bool {
79 true
80 }
81
82 #[inline(always)]
83 fn decode_is_copy() -> bool {
84 true
85 }
86 }
87
88 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ConnectionsResponse, D>
89 for &ConnectionsResponse
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::<ConnectionsResponse>(offset);
99 unsafe {
100 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
102 (buf_ptr as *mut ConnectionsResponse)
103 .write_unaligned((self as *const ConnectionsResponse).read());
104 }
107 Ok(())
108 }
109 }
110 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
111 fidl::encoding::Encode<ConnectionsResponse, D> for (T0,)
112 {
113 #[inline]
114 unsafe fn encode(
115 self,
116 encoder: &mut fidl::encoding::Encoder<'_, D>,
117 offset: usize,
118 depth: fidl::encoding::Depth,
119 ) -> fidl::Result<()> {
120 encoder.debug_check_bounds::<ConnectionsResponse>(offset);
121 self.0.encode(encoder, offset + 0, depth)?;
125 Ok(())
126 }
127 }
128
129 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConnectionsResponse {
130 #[inline(always)]
131 fn new_empty() -> Self {
132 Self { num_lifetime_connections: fidl::new_empty!(u32, D) }
133 }
134
135 #[inline]
136 unsafe fn decode(
137 &mut self,
138 decoder: &mut fidl::encoding::Decoder<'_, D>,
139 offset: usize,
140 _depth: fidl::encoding::Depth,
141 ) -> fidl::Result<()> {
142 decoder.debug_check_bounds::<Self>(offset);
143 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
144 unsafe {
147 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
148 }
149 Ok(())
150 }
151 }
152
153 impl fidl::encoding::ValueTypeMarker for SetSampleArgs {
154 type Borrowed<'a> = &'a Self;
155 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
156 value
157 }
158 }
159
160 unsafe impl fidl::encoding::TypeMarker for SetSampleArgs {
161 type Owned = Self;
162
163 #[inline(always)]
164 fn inline_align(_context: fidl::encoding::Context) -> usize {
165 8
166 }
167
168 #[inline(always)]
169 fn inline_size(_context: fidl::encoding::Context) -> usize {
170 16
171 }
172 }
173
174 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetSampleArgs, D>
175 for &SetSampleArgs
176 {
177 #[inline]
178 unsafe fn encode(
179 self,
180 encoder: &mut fidl::encoding::Encoder<'_, D>,
181 offset: usize,
182 _depth: fidl::encoding::Depth,
183 ) -> fidl::Result<()> {
184 encoder.debug_check_bounds::<SetSampleArgs>(offset);
185 fidl::encoding::Encode::<SetSampleArgs, D>::encode(
187 (
188 <fidl_fuchsia_time_external__common::TimeSample as fidl::encoding::ValueTypeMarker>::borrow(&self.sample),
189 ),
190 encoder, offset, _depth
191 )
192 }
193 }
194 unsafe impl<
195 D: fidl::encoding::ResourceDialect,
196 T0: fidl::encoding::Encode<fidl_fuchsia_time_external__common::TimeSample, D>,
197 > fidl::encoding::Encode<SetSampleArgs, D> for (T0,)
198 {
199 #[inline]
200 unsafe fn encode(
201 self,
202 encoder: &mut fidl::encoding::Encoder<'_, D>,
203 offset: usize,
204 depth: fidl::encoding::Depth,
205 ) -> fidl::Result<()> {
206 encoder.debug_check_bounds::<SetSampleArgs>(offset);
207 self.0.encode(encoder, offset + 0, depth)?;
211 Ok(())
212 }
213 }
214
215 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetSampleArgs {
216 #[inline(always)]
217 fn new_empty() -> Self {
218 Self { sample: fidl::new_empty!(fidl_fuchsia_time_external__common::TimeSample, D) }
219 }
220
221 #[inline]
222 unsafe fn decode(
223 &mut self,
224 decoder: &mut fidl::encoding::Decoder<'_, D>,
225 offset: usize,
226 _depth: fidl::encoding::Depth,
227 ) -> fidl::Result<()> {
228 decoder.debug_check_bounds::<Self>(offset);
229 fidl::decode!(
231 fidl_fuchsia_time_external__common::TimeSample,
232 D,
233 &mut self.sample,
234 decoder,
235 offset + 0,
236 _depth
237 )?;
238 Ok(())
239 }
240 }
241
242 impl fidl::encoding::ValueTypeMarker for SetStatusArgs {
243 type Borrowed<'a> = &'a Self;
244 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
245 value
246 }
247 }
248
249 unsafe impl fidl::encoding::TypeMarker for SetStatusArgs {
250 type Owned = Self;
251
252 #[inline(always)]
253 fn inline_align(_context: fidl::encoding::Context) -> usize {
254 4
255 }
256
257 #[inline(always)]
258 fn inline_size(_context: fidl::encoding::Context) -> usize {
259 4
260 }
261 }
262
263 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetStatusArgs, D>
264 for &SetStatusArgs
265 {
266 #[inline]
267 unsafe fn encode(
268 self,
269 encoder: &mut fidl::encoding::Encoder<'_, D>,
270 offset: usize,
271 _depth: fidl::encoding::Depth,
272 ) -> fidl::Result<()> {
273 encoder.debug_check_bounds::<SetStatusArgs>(offset);
274 fidl::encoding::Encode::<SetStatusArgs, D>::encode(
276 (
277 <fidl_fuchsia_time_external__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
278 ),
279 encoder, offset, _depth
280 )
281 }
282 }
283 unsafe impl<
284 D: fidl::encoding::ResourceDialect,
285 T0: fidl::encoding::Encode<fidl_fuchsia_time_external__common::Status, D>,
286 > fidl::encoding::Encode<SetStatusArgs, D> for (T0,)
287 {
288 #[inline]
289 unsafe fn encode(
290 self,
291 encoder: &mut fidl::encoding::Encoder<'_, D>,
292 offset: usize,
293 depth: fidl::encoding::Depth,
294 ) -> fidl::Result<()> {
295 encoder.debug_check_bounds::<SetStatusArgs>(offset);
296 self.0.encode(encoder, offset + 0, depth)?;
300 Ok(())
301 }
302 }
303
304 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetStatusArgs {
305 #[inline(always)]
306 fn new_empty() -> Self {
307 Self { status: fidl::new_empty!(fidl_fuchsia_time_external__common::Status, D) }
308 }
309
310 #[inline]
311 unsafe fn decode(
312 &mut self,
313 decoder: &mut fidl::encoding::Decoder<'_, D>,
314 offset: usize,
315 _depth: fidl::encoding::Depth,
316 ) -> fidl::Result<()> {
317 decoder.debug_check_bounds::<Self>(offset);
318 fidl::decode!(
320 fidl_fuchsia_time_external__common::Status,
321 D,
322 &mut self.status,
323 decoder,
324 offset + 0,
325 _depth
326 )?;
327 Ok(())
328 }
329 }
330}