1#![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 boot_animation: bool,
14 pub buffer_count: u32,
15 pub color_scheme: String,
16 pub disable: bool,
17 pub display_rotation: u32,
18 pub dpi: Vec<u32>,
19 pub font_size: String,
20 pub keep_log_visible: bool,
21 pub key_map: String,
22 pub keyrepeat: bool,
23 pub rounded_corners: bool,
24 pub scrollback_rows: u32,
25 pub show_logo: bool,
26}
27
28impl fidl::Persistable for Config {}
29
30mod internal {
31 use super::*;
32
33 impl fidl::encoding::ValueTypeMarker for Config {
34 type Borrowed<'a> = &'a Self;
35 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
36 value
37 }
38 }
39
40 unsafe impl fidl::encoding::TypeMarker for Config {
41 type Owned = Self;
42
43 #[inline(always)]
44 fn inline_align(_context: fidl::encoding::Context) -> usize {
45 8
46 }
47
48 #[inline(always)]
49 fn inline_size(_context: fidl::encoding::Context) -> usize {
50 104
51 }
52 }
53
54 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
55 #[inline]
56 unsafe fn encode(
57 self,
58 encoder: &mut fidl::encoding::Encoder<'_, D>,
59 offset: usize,
60 _depth: fidl::encoding::Depth,
61 ) -> fidl::Result<()> {
62 encoder.debug_check_bounds::<Config>(offset);
63 fidl::encoding::Encode::<Config, D>::encode(
65 (
66 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.boot_animation),
67 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_count),
68 <fidl::encoding::BoundedString<20> as fidl::encoding::ValueTypeMarker>::borrow(
69 &self.color_scheme,
70 ),
71 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.disable),
72 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.display_rotation),
73 <fidl::encoding::Vector<u32, 10> as fidl::encoding::ValueTypeMarker>::borrow(
74 &self.dpi,
75 ),
76 <fidl::encoding::BoundedString<10> as fidl::encoding::ValueTypeMarker>::borrow(
77 &self.font_size,
78 ),
79 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.keep_log_visible),
80 <fidl::encoding::BoundedString<10> as fidl::encoding::ValueTypeMarker>::borrow(
81 &self.key_map,
82 ),
83 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.keyrepeat),
84 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.rounded_corners),
85 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.scrollback_rows),
86 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.show_logo),
87 ),
88 encoder,
89 offset,
90 _depth,
91 )
92 }
93 }
94 unsafe impl<
95 D: fidl::encoding::ResourceDialect,
96 T0: fidl::encoding::Encode<bool, D>,
97 T1: fidl::encoding::Encode<u32, D>,
98 T2: fidl::encoding::Encode<fidl::encoding::BoundedString<20>, D>,
99 T3: fidl::encoding::Encode<bool, D>,
100 T4: fidl::encoding::Encode<u32, D>,
101 T5: fidl::encoding::Encode<fidl::encoding::Vector<u32, 10>, D>,
102 T6: fidl::encoding::Encode<fidl::encoding::BoundedString<10>, D>,
103 T7: fidl::encoding::Encode<bool, D>,
104 T8: fidl::encoding::Encode<fidl::encoding::BoundedString<10>, D>,
105 T9: fidl::encoding::Encode<bool, D>,
106 T10: fidl::encoding::Encode<bool, D>,
107 T11: fidl::encoding::Encode<u32, D>,
108 T12: fidl::encoding::Encode<bool, D>,
109 > fidl::encoding::Encode<Config, D>
110 for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)
111 {
112 #[inline]
113 unsafe fn encode(
114 self,
115 encoder: &mut fidl::encoding::Encoder<'_, D>,
116 offset: usize,
117 depth: fidl::encoding::Depth,
118 ) -> fidl::Result<()> {
119 encoder.debug_check_bounds::<Config>(offset);
120 unsafe {
123 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
124 (ptr as *mut u64).write_unaligned(0);
125 }
126 unsafe {
127 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
128 (ptr as *mut u64).write_unaligned(0);
129 }
130 unsafe {
131 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
132 (ptr as *mut u64).write_unaligned(0);
133 }
134 unsafe {
135 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(88);
136 (ptr as *mut u64).write_unaligned(0);
137 }
138 unsafe {
139 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(96);
140 (ptr as *mut u64).write_unaligned(0);
141 }
142 self.0.encode(encoder, offset + 0, depth)?;
144 self.1.encode(encoder, offset + 4, depth)?;
145 self.2.encode(encoder, offset + 8, depth)?;
146 self.3.encode(encoder, offset + 24, depth)?;
147 self.4.encode(encoder, offset + 28, depth)?;
148 self.5.encode(encoder, offset + 32, depth)?;
149 self.6.encode(encoder, offset + 48, depth)?;
150 self.7.encode(encoder, offset + 64, depth)?;
151 self.8.encode(encoder, offset + 72, depth)?;
152 self.9.encode(encoder, offset + 88, depth)?;
153 self.10.encode(encoder, offset + 89, depth)?;
154 self.11.encode(encoder, offset + 92, depth)?;
155 self.12.encode(encoder, offset + 96, depth)?;
156 Ok(())
157 }
158 }
159
160 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
161 #[inline(always)]
162 fn new_empty() -> Self {
163 Self {
164 boot_animation: fidl::new_empty!(bool, D),
165 buffer_count: fidl::new_empty!(u32, D),
166 color_scheme: fidl::new_empty!(fidl::encoding::BoundedString<20>, D),
167 disable: fidl::new_empty!(bool, D),
168 display_rotation: fidl::new_empty!(u32, D),
169 dpi: fidl::new_empty!(fidl::encoding::Vector<u32, 10>, D),
170 font_size: fidl::new_empty!(fidl::encoding::BoundedString<10>, D),
171 keep_log_visible: fidl::new_empty!(bool, D),
172 key_map: fidl::new_empty!(fidl::encoding::BoundedString<10>, D),
173 keyrepeat: fidl::new_empty!(bool, D),
174 rounded_corners: fidl::new_empty!(bool, D),
175 scrollback_rows: fidl::new_empty!(u32, D),
176 show_logo: fidl::new_empty!(bool, D),
177 }
178 }
179
180 #[inline]
181 unsafe fn decode(
182 &mut self,
183 decoder: &mut fidl::encoding::Decoder<'_, D>,
184 offset: usize,
185 _depth: fidl::encoding::Depth,
186 ) -> fidl::Result<()> {
187 decoder.debug_check_bounds::<Self>(offset);
188 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
190 let padval = unsafe { (ptr as *const u64).read_unaligned() };
191 let mask = 0xffffff00u64;
192 let maskedval = padval & mask;
193 if maskedval != 0 {
194 return Err(fidl::Error::NonZeroPadding {
195 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
196 });
197 }
198 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
199 let padval = unsafe { (ptr as *const u64).read_unaligned() };
200 let mask = 0xffffff00u64;
201 let maskedval = padval & mask;
202 if maskedval != 0 {
203 return Err(fidl::Error::NonZeroPadding {
204 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
205 });
206 }
207 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
208 let padval = unsafe { (ptr as *const u64).read_unaligned() };
209 let mask = 0xffffffffffffff00u64;
210 let maskedval = padval & mask;
211 if maskedval != 0 {
212 return Err(fidl::Error::NonZeroPadding {
213 padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
214 });
215 }
216 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(88) };
217 let padval = unsafe { (ptr as *const u64).read_unaligned() };
218 let mask = 0xffff0000u64;
219 let maskedval = padval & mask;
220 if maskedval != 0 {
221 return Err(fidl::Error::NonZeroPadding {
222 padding_start: offset + 88 + ((mask as u64).trailing_zeros() / 8) as usize,
223 });
224 }
225 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(96) };
226 let padval = unsafe { (ptr as *const u64).read_unaligned() };
227 let mask = 0xffffffffffffff00u64;
228 let maskedval = padval & mask;
229 if maskedval != 0 {
230 return Err(fidl::Error::NonZeroPadding {
231 padding_start: offset + 96 + ((mask as u64).trailing_zeros() / 8) as usize,
232 });
233 }
234 fidl::decode!(bool, D, &mut self.boot_animation, decoder, offset + 0, _depth)?;
235 fidl::decode!(u32, D, &mut self.buffer_count, decoder, offset + 4, _depth)?;
236 fidl::decode!(
237 fidl::encoding::BoundedString<20>,
238 D,
239 &mut self.color_scheme,
240 decoder,
241 offset + 8,
242 _depth
243 )?;
244 fidl::decode!(bool, D, &mut self.disable, decoder, offset + 24, _depth)?;
245 fidl::decode!(u32, D, &mut self.display_rotation, decoder, offset + 28, _depth)?;
246 fidl::decode!(fidl::encoding::Vector<u32, 10>, D, &mut self.dpi, decoder, offset + 32, _depth)?;
247 fidl::decode!(
248 fidl::encoding::BoundedString<10>,
249 D,
250 &mut self.font_size,
251 decoder,
252 offset + 48,
253 _depth
254 )?;
255 fidl::decode!(bool, D, &mut self.keep_log_visible, decoder, offset + 64, _depth)?;
256 fidl::decode!(
257 fidl::encoding::BoundedString<10>,
258 D,
259 &mut self.key_map,
260 decoder,
261 offset + 72,
262 _depth
263 )?;
264 fidl::decode!(bool, D, &mut self.keyrepeat, decoder, offset + 88, _depth)?;
265 fidl::decode!(bool, D, &mut self.rounded_corners, decoder, offset + 89, _depth)?;
266 fidl::decode!(u32, D, &mut self.scrollback_rows, decoder, offset + 92, _depth)?;
267 fidl::decode!(bool, D, &mut self.show_logo, decoder, offset + 96, _depth)?;
268 Ok(())
269 }
270 }
271}