fidl_fuchsia_blackout_test__common/
fidl_fuchsia_blackout_test__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 const MAX_DEVICE_PATH: u64 = 100;
12
13#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct ControllerSetupRequest {
15    pub device_label: String,
16    pub device_path: Option<String>,
17    pub seed: u64,
18}
19
20impl fidl::Persistable for ControllerSetupRequest {}
21
22#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23pub struct ControllerTestRequest {
24    pub device_label: String,
25    pub device_path: Option<String>,
26    pub seed: u64,
27    pub duration: u64,
28}
29
30impl fidl::Persistable for ControllerTestRequest {}
31
32#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct ControllerVerifyRequest {
34    pub device_label: String,
35    pub device_path: Option<String>,
36    pub seed: u64,
37}
38
39impl fidl::Persistable for ControllerVerifyRequest {}
40
41pub mod controller_ordinals {
42    pub const SETUP: u64 = 0x764c5a319190bb48;
43    pub const TEST: u64 = 0x3bbfd404364ff799;
44    pub const VERIFY: u64 = 0x83fd280ed680d48;
45}
46
47mod internal {
48    use super::*;
49
50    impl fidl::encoding::ValueTypeMarker for ControllerSetupRequest {
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 ControllerSetupRequest {
58        type Owned = Self;
59
60        #[inline(always)]
61        fn inline_align(_context: fidl::encoding::Context) -> usize {
62            8
63        }
64
65        #[inline(always)]
66        fn inline_size(_context: fidl::encoding::Context) -> usize {
67            40
68        }
69    }
70
71    unsafe impl<D: fidl::encoding::ResourceDialect>
72        fidl::encoding::Encode<ControllerSetupRequest, D> for &ControllerSetupRequest
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::<ControllerSetupRequest>(offset);
82            // Delegate to tuple encoding.
83            fidl::encoding::Encode::<ControllerSetupRequest, D>::encode(
84                (
85                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_label),
86                    <fidl::encoding::Optional<fidl::encoding::BoundedString<100>> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_path),
87                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.seed),
88                ),
89                encoder, offset, _depth
90            )
91        }
92    }
93    unsafe impl<
94            D: fidl::encoding::ResourceDialect,
95            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<100>, D>,
96            T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<100>>, D>,
97            T2: fidl::encoding::Encode<u64, D>,
98        > fidl::encoding::Encode<ControllerSetupRequest, D> for (T0, T1, T2)
99    {
100        #[inline]
101        unsafe fn encode(
102            self,
103            encoder: &mut fidl::encoding::Encoder<'_, D>,
104            offset: usize,
105            depth: fidl::encoding::Depth,
106        ) -> fidl::Result<()> {
107            encoder.debug_check_bounds::<ControllerSetupRequest>(offset);
108            // Zero out padding regions. There's no need to apply masks
109            // because the unmasked parts will be overwritten by fields.
110            // Write the fields.
111            self.0.encode(encoder, offset + 0, depth)?;
112            self.1.encode(encoder, offset + 16, depth)?;
113            self.2.encode(encoder, offset + 32, depth)?;
114            Ok(())
115        }
116    }
117
118    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
119        for ControllerSetupRequest
120    {
121        #[inline(always)]
122        fn new_empty() -> Self {
123            Self {
124                device_label: fidl::new_empty!(fidl::encoding::BoundedString<100>, D),
125                device_path: fidl::new_empty!(
126                    fidl::encoding::Optional<fidl::encoding::BoundedString<100>>,
127                    D
128                ),
129                seed: fidl::new_empty!(u64, D),
130            }
131        }
132
133        #[inline]
134        unsafe fn decode(
135            &mut self,
136            decoder: &mut fidl::encoding::Decoder<'_, D>,
137            offset: usize,
138            _depth: fidl::encoding::Depth,
139        ) -> fidl::Result<()> {
140            decoder.debug_check_bounds::<Self>(offset);
141            // Verify that padding bytes are zero.
142            fidl::decode!(
143                fidl::encoding::BoundedString<100>,
144                D,
145                &mut self.device_label,
146                decoder,
147                offset + 0,
148                _depth
149            )?;
150            fidl::decode!(
151                fidl::encoding::Optional<fidl::encoding::BoundedString<100>>,
152                D,
153                &mut self.device_path,
154                decoder,
155                offset + 16,
156                _depth
157            )?;
158            fidl::decode!(u64, D, &mut self.seed, decoder, offset + 32, _depth)?;
159            Ok(())
160        }
161    }
162
163    impl fidl::encoding::ValueTypeMarker for ControllerTestRequest {
164        type Borrowed<'a> = &'a Self;
165        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
166            value
167        }
168    }
169
170    unsafe impl fidl::encoding::TypeMarker for ControllerTestRequest {
171        type Owned = Self;
172
173        #[inline(always)]
174        fn inline_align(_context: fidl::encoding::Context) -> usize {
175            8
176        }
177
178        #[inline(always)]
179        fn inline_size(_context: fidl::encoding::Context) -> usize {
180            48
181        }
182    }
183
184    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ControllerTestRequest, D>
185        for &ControllerTestRequest
186    {
187        #[inline]
188        unsafe fn encode(
189            self,
190            encoder: &mut fidl::encoding::Encoder<'_, D>,
191            offset: usize,
192            _depth: fidl::encoding::Depth,
193        ) -> fidl::Result<()> {
194            encoder.debug_check_bounds::<ControllerTestRequest>(offset);
195            // Delegate to tuple encoding.
196            fidl::encoding::Encode::<ControllerTestRequest, D>::encode(
197                (
198                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_label),
199                    <fidl::encoding::Optional<fidl::encoding::BoundedString<100>> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_path),
200                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.seed),
201                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration),
202                ),
203                encoder, offset, _depth
204            )
205        }
206    }
207    unsafe impl<
208            D: fidl::encoding::ResourceDialect,
209            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<100>, D>,
210            T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<100>>, D>,
211            T2: fidl::encoding::Encode<u64, D>,
212            T3: fidl::encoding::Encode<u64, D>,
213        > fidl::encoding::Encode<ControllerTestRequest, D> for (T0, T1, T2, T3)
214    {
215        #[inline]
216        unsafe fn encode(
217            self,
218            encoder: &mut fidl::encoding::Encoder<'_, D>,
219            offset: usize,
220            depth: fidl::encoding::Depth,
221        ) -> fidl::Result<()> {
222            encoder.debug_check_bounds::<ControllerTestRequest>(offset);
223            // Zero out padding regions. There's no need to apply masks
224            // because the unmasked parts will be overwritten by fields.
225            // Write the fields.
226            self.0.encode(encoder, offset + 0, depth)?;
227            self.1.encode(encoder, offset + 16, depth)?;
228            self.2.encode(encoder, offset + 32, depth)?;
229            self.3.encode(encoder, offset + 40, depth)?;
230            Ok(())
231        }
232    }
233
234    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ControllerTestRequest {
235        #[inline(always)]
236        fn new_empty() -> Self {
237            Self {
238                device_label: fidl::new_empty!(fidl::encoding::BoundedString<100>, D),
239                device_path: fidl::new_empty!(
240                    fidl::encoding::Optional<fidl::encoding::BoundedString<100>>,
241                    D
242                ),
243                seed: fidl::new_empty!(u64, D),
244                duration: fidl::new_empty!(u64, D),
245            }
246        }
247
248        #[inline]
249        unsafe fn decode(
250            &mut self,
251            decoder: &mut fidl::encoding::Decoder<'_, D>,
252            offset: usize,
253            _depth: fidl::encoding::Depth,
254        ) -> fidl::Result<()> {
255            decoder.debug_check_bounds::<Self>(offset);
256            // Verify that padding bytes are zero.
257            fidl::decode!(
258                fidl::encoding::BoundedString<100>,
259                D,
260                &mut self.device_label,
261                decoder,
262                offset + 0,
263                _depth
264            )?;
265            fidl::decode!(
266                fidl::encoding::Optional<fidl::encoding::BoundedString<100>>,
267                D,
268                &mut self.device_path,
269                decoder,
270                offset + 16,
271                _depth
272            )?;
273            fidl::decode!(u64, D, &mut self.seed, decoder, offset + 32, _depth)?;
274            fidl::decode!(u64, D, &mut self.duration, decoder, offset + 40, _depth)?;
275            Ok(())
276        }
277    }
278
279    impl fidl::encoding::ValueTypeMarker for ControllerVerifyRequest {
280        type Borrowed<'a> = &'a Self;
281        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
282            value
283        }
284    }
285
286    unsafe impl fidl::encoding::TypeMarker for ControllerVerifyRequest {
287        type Owned = Self;
288
289        #[inline(always)]
290        fn inline_align(_context: fidl::encoding::Context) -> usize {
291            8
292        }
293
294        #[inline(always)]
295        fn inline_size(_context: fidl::encoding::Context) -> usize {
296            40
297        }
298    }
299
300    unsafe impl<D: fidl::encoding::ResourceDialect>
301        fidl::encoding::Encode<ControllerVerifyRequest, D> for &ControllerVerifyRequest
302    {
303        #[inline]
304        unsafe fn encode(
305            self,
306            encoder: &mut fidl::encoding::Encoder<'_, D>,
307            offset: usize,
308            _depth: fidl::encoding::Depth,
309        ) -> fidl::Result<()> {
310            encoder.debug_check_bounds::<ControllerVerifyRequest>(offset);
311            // Delegate to tuple encoding.
312            fidl::encoding::Encode::<ControllerVerifyRequest, D>::encode(
313                (
314                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_label),
315                    <fidl::encoding::Optional<fidl::encoding::BoundedString<100>> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_path),
316                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.seed),
317                ),
318                encoder, offset, _depth
319            )
320        }
321    }
322    unsafe impl<
323            D: fidl::encoding::ResourceDialect,
324            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<100>, D>,
325            T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<100>>, D>,
326            T2: fidl::encoding::Encode<u64, D>,
327        > fidl::encoding::Encode<ControllerVerifyRequest, D> for (T0, T1, T2)
328    {
329        #[inline]
330        unsafe fn encode(
331            self,
332            encoder: &mut fidl::encoding::Encoder<'_, D>,
333            offset: usize,
334            depth: fidl::encoding::Depth,
335        ) -> fidl::Result<()> {
336            encoder.debug_check_bounds::<ControllerVerifyRequest>(offset);
337            // Zero out padding regions. There's no need to apply masks
338            // because the unmasked parts will be overwritten by fields.
339            // Write the fields.
340            self.0.encode(encoder, offset + 0, depth)?;
341            self.1.encode(encoder, offset + 16, depth)?;
342            self.2.encode(encoder, offset + 32, depth)?;
343            Ok(())
344        }
345    }
346
347    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
348        for ControllerVerifyRequest
349    {
350        #[inline(always)]
351        fn new_empty() -> Self {
352            Self {
353                device_label: fidl::new_empty!(fidl::encoding::BoundedString<100>, D),
354                device_path: fidl::new_empty!(
355                    fidl::encoding::Optional<fidl::encoding::BoundedString<100>>,
356                    D
357                ),
358                seed: fidl::new_empty!(u64, D),
359            }
360        }
361
362        #[inline]
363        unsafe fn decode(
364            &mut self,
365            decoder: &mut fidl::encoding::Decoder<'_, D>,
366            offset: usize,
367            _depth: fidl::encoding::Depth,
368        ) -> fidl::Result<()> {
369            decoder.debug_check_bounds::<Self>(offset);
370            // Verify that padding bytes are zero.
371            fidl::decode!(
372                fidl::encoding::BoundedString<100>,
373                D,
374                &mut self.device_label,
375                decoder,
376                offset + 0,
377                _depth
378            )?;
379            fidl::decode!(
380                fidl::encoding::Optional<fidl::encoding::BoundedString<100>>,
381                D,
382                &mut self.device_path,
383                decoder,
384                offset + 16,
385                _depth
386            )?;
387            fidl::decode!(u64, D, &mut self.seed, decoder, offset + 32, _depth)?;
388            Ok(())
389        }
390    }
391}