Skip to main content

fidl_cf_sc_internal_scenemanagerstructuredconfig_common/
fidl_cf_sc_internal_scenemanagerstructuredconfig_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, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct Config {
13    pub attach_a11y_view: bool,
14    pub display_pixel_density: String,
15    pub display_rotation: u64,
16    pub enable_merge_touch_events: bool,
17    pub idle_threshold_ms: u64,
18    pub prefetch: bool,
19    pub supported_input_devices: Vec<String>,
20    pub suspend_enabled: bool,
21    pub viewing_distance: String,
22}
23
24impl fidl::Persistable for Config {}
25
26mod internal {
27    use super::*;
28
29    impl fidl::encoding::ValueTypeMarker for Config {
30        type Borrowed<'a> = &'a Self;
31        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
32            value
33        }
34    }
35
36    unsafe impl fidl::encoding::TypeMarker for Config {
37        type Owned = Self;
38
39        #[inline(always)]
40        fn inline_align(_context: fidl::encoding::Context) -> usize {
41            8
42        }
43
44        #[inline(always)]
45        fn inline_size(_context: fidl::encoding::Context) -> usize {
46            96
47        }
48    }
49
50    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
51        #[inline]
52        unsafe fn encode(
53            self,
54            encoder: &mut fidl::encoding::Encoder<'_, D>,
55            offset: usize,
56            _depth: fidl::encoding::Depth,
57        ) -> fidl::Result<()> {
58            encoder.debug_check_bounds::<Config>(offset);
59            // Delegate to tuple encoding.
60            fidl::encoding::Encode::<Config, D>::encode(
61                (
62                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.attach_a11y_view),
63                    <fidl::encoding::BoundedString<8> as fidl::encoding::ValueTypeMarker>::borrow(&self.display_pixel_density),
64                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.display_rotation),
65                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_merge_touch_events),
66                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.idle_threshold_ms),
67                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.prefetch),
68                    <fidl::encoding::Vector<fidl::encoding::BoundedString<12>, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.supported_input_devices),
69                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.suspend_enabled),
70                    <fidl::encoding::BoundedString<8> as fidl::encoding::ValueTypeMarker>::borrow(&self.viewing_distance),
71                ),
72                encoder, offset, _depth
73            )
74        }
75    }
76    unsafe impl<
77        D: fidl::encoding::ResourceDialect,
78        T0: fidl::encoding::Encode<bool, D>,
79        T1: fidl::encoding::Encode<fidl::encoding::BoundedString<8>, D>,
80        T2: fidl::encoding::Encode<u64, D>,
81        T3: fidl::encoding::Encode<bool, D>,
82        T4: fidl::encoding::Encode<u64, D>,
83        T5: fidl::encoding::Encode<bool, D>,
84        T6: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<12>, 6>, D>,
85        T7: fidl::encoding::Encode<bool, D>,
86        T8: fidl::encoding::Encode<fidl::encoding::BoundedString<8>, D>,
87    > fidl::encoding::Encode<Config, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)
88    {
89        #[inline]
90        unsafe fn encode(
91            self,
92            encoder: &mut fidl::encoding::Encoder<'_, D>,
93            offset: usize,
94            depth: fidl::encoding::Depth,
95        ) -> fidl::Result<()> {
96            encoder.debug_check_bounds::<Config>(offset);
97            // Zero out padding regions. There's no need to apply masks
98            // because the unmasked parts will be overwritten by fields.
99            unsafe {
100                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
101                (ptr as *mut u64).write_unaligned(0);
102            }
103            unsafe {
104                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
105                (ptr as *mut u64).write_unaligned(0);
106            }
107            unsafe {
108                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
109                (ptr as *mut u64).write_unaligned(0);
110            }
111            unsafe {
112                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(72);
113                (ptr as *mut u64).write_unaligned(0);
114            }
115            // Write the fields.
116            self.0.encode(encoder, offset + 0, depth)?;
117            self.1.encode(encoder, offset + 8, depth)?;
118            self.2.encode(encoder, offset + 24, depth)?;
119            self.3.encode(encoder, offset + 32, depth)?;
120            self.4.encode(encoder, offset + 40, depth)?;
121            self.5.encode(encoder, offset + 48, depth)?;
122            self.6.encode(encoder, offset + 56, depth)?;
123            self.7.encode(encoder, offset + 72, depth)?;
124            self.8.encode(encoder, offset + 80, depth)?;
125            Ok(())
126        }
127    }
128
129    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
130        #[inline(always)]
131        fn new_empty() -> Self {
132            Self {
133                attach_a11y_view: fidl::new_empty!(bool, D),
134                display_pixel_density: fidl::new_empty!(fidl::encoding::BoundedString<8>, D),
135                display_rotation: fidl::new_empty!(u64, D),
136                enable_merge_touch_events: fidl::new_empty!(bool, D),
137                idle_threshold_ms: fidl::new_empty!(u64, D),
138                prefetch: fidl::new_empty!(bool, D),
139                supported_input_devices: fidl::new_empty!(
140                    fidl::encoding::Vector<fidl::encoding::BoundedString<12>, 6>,
141                    D
142                ),
143                suspend_enabled: fidl::new_empty!(bool, D),
144                viewing_distance: fidl::new_empty!(fidl::encoding::BoundedString<8>, D),
145            }
146        }
147
148        #[inline]
149        unsafe fn decode(
150            &mut self,
151            decoder: &mut fidl::encoding::Decoder<'_, D>,
152            offset: usize,
153            _depth: fidl::encoding::Depth,
154        ) -> fidl::Result<()> {
155            decoder.debug_check_bounds::<Self>(offset);
156            // Verify that padding bytes are zero.
157            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
158            let padval = unsafe { (ptr as *const u64).read_unaligned() };
159            let mask = 0xffffffffffffff00u64;
160            let maskedval = padval & mask;
161            if maskedval != 0 {
162                return Err(fidl::Error::NonZeroPadding {
163                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
164                });
165            }
166            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
167            let padval = unsafe { (ptr as *const u64).read_unaligned() };
168            let mask = 0xffffffffffffff00u64;
169            let maskedval = padval & mask;
170            if maskedval != 0 {
171                return Err(fidl::Error::NonZeroPadding {
172                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
173                });
174            }
175            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
176            let padval = unsafe { (ptr as *const u64).read_unaligned() };
177            let mask = 0xffffffffffffff00u64;
178            let maskedval = padval & mask;
179            if maskedval != 0 {
180                return Err(fidl::Error::NonZeroPadding {
181                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
182                });
183            }
184            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(72) };
185            let padval = unsafe { (ptr as *const u64).read_unaligned() };
186            let mask = 0xffffffffffffff00u64;
187            let maskedval = padval & mask;
188            if maskedval != 0 {
189                return Err(fidl::Error::NonZeroPadding {
190                    padding_start: offset + 72 + ((mask as u64).trailing_zeros() / 8) as usize,
191                });
192            }
193            fidl::decode!(bool, D, &mut self.attach_a11y_view, decoder, offset + 0, _depth)?;
194            fidl::decode!(
195                fidl::encoding::BoundedString<8>,
196                D,
197                &mut self.display_pixel_density,
198                decoder,
199                offset + 8,
200                _depth
201            )?;
202            fidl::decode!(u64, D, &mut self.display_rotation, decoder, offset + 24, _depth)?;
203            fidl::decode!(
204                bool,
205                D,
206                &mut self.enable_merge_touch_events,
207                decoder,
208                offset + 32,
209                _depth
210            )?;
211            fidl::decode!(u64, D, &mut self.idle_threshold_ms, decoder, offset + 40, _depth)?;
212            fidl::decode!(bool, D, &mut self.prefetch, decoder, offset + 48, _depth)?;
213            fidl::decode!(
214                fidl::encoding::Vector<fidl::encoding::BoundedString<12>, 6>,
215                D,
216                &mut self.supported_input_devices,
217                decoder,
218                offset + 56,
219                _depth
220            )?;
221            fidl::decode!(bool, D, &mut self.suspend_enabled, decoder, offset + 72, _depth)?;
222            fidl::decode!(
223                fidl::encoding::BoundedString<8>,
224                D,
225                &mut self.viewing_distance,
226                decoder,
227                offset + 80,
228                _depth
229            )?;
230            Ok(())
231        }
232    }
233}