fidl_fuchsia_ui_policy_common/
fidl_fuchsia_ui_policy_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
11#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12#[repr(C)]
13pub struct DisplayBacklightSetMinimumRgbRequest {
14    pub minimum_rgb: u8,
15}
16
17impl fidl::Persistable for DisplayBacklightSetMinimumRgbRequest {}
18
19#[derive(Clone, Debug, PartialEq)]
20pub struct MediaButtonsListenerOnEventRequest {
21    pub event: fidl_fuchsia_ui_input::MediaButtonsEvent,
22}
23
24impl fidl::Persistable for MediaButtonsListenerOnEventRequest {}
25
26#[derive(Clone, Debug, PartialEq)]
27pub struct MediaButtonsListenerOnMediaButtonsEventRequest {
28    pub event: fidl_fuchsia_ui_input::MediaButtonsEvent,
29}
30
31impl fidl::Persistable for MediaButtonsListenerOnMediaButtonsEventRequest {}
32
33mod internal {
34    use super::*;
35
36    impl fidl::encoding::ValueTypeMarker for DisplayBacklightSetMinimumRgbRequest {
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 DisplayBacklightSetMinimumRgbRequest {
44        type Owned = Self;
45
46        #[inline(always)]
47        fn inline_align(_context: fidl::encoding::Context) -> usize {
48            1
49        }
50
51        #[inline(always)]
52        fn inline_size(_context: fidl::encoding::Context) -> usize {
53            1
54        }
55        #[inline(always)]
56        fn encode_is_copy() -> bool {
57            true
58        }
59
60        #[inline(always)]
61        fn decode_is_copy() -> bool {
62            true
63        }
64    }
65
66    unsafe impl<D: fidl::encoding::ResourceDialect>
67        fidl::encoding::Encode<DisplayBacklightSetMinimumRgbRequest, D>
68        for &DisplayBacklightSetMinimumRgbRequest
69    {
70        #[inline]
71        unsafe fn encode(
72            self,
73            encoder: &mut fidl::encoding::Encoder<'_, D>,
74            offset: usize,
75            _depth: fidl::encoding::Depth,
76        ) -> fidl::Result<()> {
77            encoder.debug_check_bounds::<DisplayBacklightSetMinimumRgbRequest>(offset);
78            unsafe {
79                // Copy the object into the buffer.
80                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
81                (buf_ptr as *mut DisplayBacklightSetMinimumRgbRequest)
82                    .write_unaligned((self as *const DisplayBacklightSetMinimumRgbRequest).read());
83                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
84                // done second because the memcpy will write garbage to these bytes.
85            }
86            Ok(())
87        }
88    }
89    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
90        fidl::encoding::Encode<DisplayBacklightSetMinimumRgbRequest, D> for (T0,)
91    {
92        #[inline]
93        unsafe fn encode(
94            self,
95            encoder: &mut fidl::encoding::Encoder<'_, D>,
96            offset: usize,
97            depth: fidl::encoding::Depth,
98        ) -> fidl::Result<()> {
99            encoder.debug_check_bounds::<DisplayBacklightSetMinimumRgbRequest>(offset);
100            // Zero out padding regions. There's no need to apply masks
101            // because the unmasked parts will be overwritten by fields.
102            // Write the fields.
103            self.0.encode(encoder, offset + 0, depth)?;
104            Ok(())
105        }
106    }
107
108    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
109        for DisplayBacklightSetMinimumRgbRequest
110    {
111        #[inline(always)]
112        fn new_empty() -> Self {
113            Self { minimum_rgb: fidl::new_empty!(u8, D) }
114        }
115
116        #[inline]
117        unsafe fn decode(
118            &mut self,
119            decoder: &mut fidl::encoding::Decoder<'_, D>,
120            offset: usize,
121            _depth: fidl::encoding::Depth,
122        ) -> fidl::Result<()> {
123            decoder.debug_check_bounds::<Self>(offset);
124            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
125            // Verify that padding bytes are zero.
126            // Copy from the buffer into the object.
127            unsafe {
128                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
129            }
130            Ok(())
131        }
132    }
133
134    impl fidl::encoding::ValueTypeMarker for MediaButtonsListenerOnEventRequest {
135        type Borrowed<'a> = &'a Self;
136        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
137            value
138        }
139    }
140
141    unsafe impl fidl::encoding::TypeMarker for MediaButtonsListenerOnEventRequest {
142        type Owned = Self;
143
144        #[inline(always)]
145        fn inline_align(_context: fidl::encoding::Context) -> usize {
146            8
147        }
148
149        #[inline(always)]
150        fn inline_size(_context: fidl::encoding::Context) -> usize {
151            16
152        }
153    }
154
155    unsafe impl<D: fidl::encoding::ResourceDialect>
156        fidl::encoding::Encode<MediaButtonsListenerOnEventRequest, D>
157        for &MediaButtonsListenerOnEventRequest
158    {
159        #[inline]
160        unsafe fn encode(
161            self,
162            encoder: &mut fidl::encoding::Encoder<'_, D>,
163            offset: usize,
164            _depth: fidl::encoding::Depth,
165        ) -> fidl::Result<()> {
166            encoder.debug_check_bounds::<MediaButtonsListenerOnEventRequest>(offset);
167            // Delegate to tuple encoding.
168            fidl::encoding::Encode::<MediaButtonsListenerOnEventRequest, D>::encode(
169                (
170                    <fidl_fuchsia_ui_input::MediaButtonsEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
171                ),
172                encoder, offset, _depth
173            )
174        }
175    }
176    unsafe impl<
177            D: fidl::encoding::ResourceDialect,
178            T0: fidl::encoding::Encode<fidl_fuchsia_ui_input::MediaButtonsEvent, D>,
179        > fidl::encoding::Encode<MediaButtonsListenerOnEventRequest, D> for (T0,)
180    {
181        #[inline]
182        unsafe fn encode(
183            self,
184            encoder: &mut fidl::encoding::Encoder<'_, D>,
185            offset: usize,
186            depth: fidl::encoding::Depth,
187        ) -> fidl::Result<()> {
188            encoder.debug_check_bounds::<MediaButtonsListenerOnEventRequest>(offset);
189            // Zero out padding regions. There's no need to apply masks
190            // because the unmasked parts will be overwritten by fields.
191            // Write the fields.
192            self.0.encode(encoder, offset + 0, depth)?;
193            Ok(())
194        }
195    }
196
197    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
198        for MediaButtonsListenerOnEventRequest
199    {
200        #[inline(always)]
201        fn new_empty() -> Self {
202            Self { event: fidl::new_empty!(fidl_fuchsia_ui_input::MediaButtonsEvent, D) }
203        }
204
205        #[inline]
206        unsafe fn decode(
207            &mut self,
208            decoder: &mut fidl::encoding::Decoder<'_, D>,
209            offset: usize,
210            _depth: fidl::encoding::Depth,
211        ) -> fidl::Result<()> {
212            decoder.debug_check_bounds::<Self>(offset);
213            // Verify that padding bytes are zero.
214            fidl::decode!(
215                fidl_fuchsia_ui_input::MediaButtonsEvent,
216                D,
217                &mut self.event,
218                decoder,
219                offset + 0,
220                _depth
221            )?;
222            Ok(())
223        }
224    }
225
226    impl fidl::encoding::ValueTypeMarker for MediaButtonsListenerOnMediaButtonsEventRequest {
227        type Borrowed<'a> = &'a Self;
228        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
229            value
230        }
231    }
232
233    unsafe impl fidl::encoding::TypeMarker for MediaButtonsListenerOnMediaButtonsEventRequest {
234        type Owned = Self;
235
236        #[inline(always)]
237        fn inline_align(_context: fidl::encoding::Context) -> usize {
238            8
239        }
240
241        #[inline(always)]
242        fn inline_size(_context: fidl::encoding::Context) -> usize {
243            16
244        }
245    }
246
247    unsafe impl<D: fidl::encoding::ResourceDialect>
248        fidl::encoding::Encode<MediaButtonsListenerOnMediaButtonsEventRequest, D>
249        for &MediaButtonsListenerOnMediaButtonsEventRequest
250    {
251        #[inline]
252        unsafe fn encode(
253            self,
254            encoder: &mut fidl::encoding::Encoder<'_, D>,
255            offset: usize,
256            _depth: fidl::encoding::Depth,
257        ) -> fidl::Result<()> {
258            encoder.debug_check_bounds::<MediaButtonsListenerOnMediaButtonsEventRequest>(offset);
259            // Delegate to tuple encoding.
260            fidl::encoding::Encode::<MediaButtonsListenerOnMediaButtonsEventRequest, D>::encode(
261                (
262                    <fidl_fuchsia_ui_input::MediaButtonsEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
263                ),
264                encoder, offset, _depth
265            )
266        }
267    }
268    unsafe impl<
269            D: fidl::encoding::ResourceDialect,
270            T0: fidl::encoding::Encode<fidl_fuchsia_ui_input::MediaButtonsEvent, D>,
271        > fidl::encoding::Encode<MediaButtonsListenerOnMediaButtonsEventRequest, D> for (T0,)
272    {
273        #[inline]
274        unsafe fn encode(
275            self,
276            encoder: &mut fidl::encoding::Encoder<'_, D>,
277            offset: usize,
278            depth: fidl::encoding::Depth,
279        ) -> fidl::Result<()> {
280            encoder.debug_check_bounds::<MediaButtonsListenerOnMediaButtonsEventRequest>(offset);
281            // Zero out padding regions. There's no need to apply masks
282            // because the unmasked parts will be overwritten by fields.
283            // Write the fields.
284            self.0.encode(encoder, offset + 0, depth)?;
285            Ok(())
286        }
287    }
288
289    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
290        for MediaButtonsListenerOnMediaButtonsEventRequest
291    {
292        #[inline(always)]
293        fn new_empty() -> Self {
294            Self { event: fidl::new_empty!(fidl_fuchsia_ui_input::MediaButtonsEvent, D) }
295        }
296
297        #[inline]
298        unsafe fn decode(
299            &mut self,
300            decoder: &mut fidl::encoding::Decoder<'_, D>,
301            offset: usize,
302            _depth: fidl::encoding::Depth,
303        ) -> fidl::Result<()> {
304            decoder.debug_check_bounds::<Self>(offset);
305            // Verify that padding bytes are zero.
306            fidl::decode!(
307                fidl_fuchsia_ui_input::MediaButtonsEvent,
308                D,
309                &mut self.event,
310                decoder,
311                offset + 0,
312                _depth
313            )?;
314            Ok(())
315        }
316    }
317}