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
11pub type Brightness = f32;
14
15#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
18pub struct BrightnessPoint {
19 pub ambient_lux: f32,
20 pub display_nits: f32,
21}
22
23impl fidl::Persistable for BrightnessPoint {}
24
25#[derive(Clone, Debug, PartialEq, PartialOrd)]
28pub struct BrightnessTable {
29 pub points: Vec<BrightnessPoint>,
30}
31
32impl fidl::Persistable for BrightnessTable {}
33
34#[derive(Clone, Debug, PartialEq)]
35pub struct ColorAdjustmentHandlerSetColorAdjustmentRequest {
36 pub color_adjustment: ColorAdjustmentTable,
37}
38
39impl fidl::Persistable for ColorAdjustmentHandlerSetColorAdjustmentRequest {}
40
41#[derive(Clone, Debug, PartialEq)]
42pub struct ColorAdjustmentSetDiscreteColorAdjustmentRequest {
43 pub color_adjustment: ColorAdjustmentTable,
44}
45
46impl fidl::Persistable for ColorAdjustmentSetDiscreteColorAdjustmentRequest {}
47
48#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
49pub struct ControlSetAutoBrightnessAdjustmentRequest {
50 pub adjustment: f32,
51}
52
53impl fidl::Persistable for ControlSetAutoBrightnessAdjustmentRequest {}
54
55#[derive(Clone, Debug, PartialEq, PartialOrd)]
56pub struct ControlSetBrightnessTableRequest {
57 pub table: BrightnessTable,
58}
59
60impl fidl::Persistable for ControlSetBrightnessTableRequest {}
61
62#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
63pub struct ControlSetManualBrightnessRequest {
64 pub value: f32,
65}
66
67impl fidl::Persistable for ControlSetManualBrightnessRequest {}
68
69#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
70pub struct ControlSetManualBrightnessSmoothRequest {
71 pub value: f32,
72 pub duration: i64,
73}
74
75impl fidl::Persistable for ControlSetManualBrightnessSmoothRequest {}
76
77#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
78pub struct ControlWatchAutoBrightnessAdjustmentResponse {
79 pub adjustment: f32,
80}
81
82impl fidl::Persistable for ControlWatchAutoBrightnessAdjustmentResponse {}
83
84#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
85pub struct ControlWatchAutoBrightnessResponse {
86 pub enabled: bool,
87}
88
89impl fidl::Persistable for ControlWatchAutoBrightnessResponse {}
90
91#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
92pub struct ControlWatchCurrentBrightnessResponse {
93 pub value: f32,
94}
95
96impl fidl::Persistable for ControlWatchCurrentBrightnessResponse {}
97
98#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
99pub struct ControlGetMaxAbsoluteBrightnessResponse {
100 pub max_brightness: f64,
101}
102
103impl fidl::Persistable for ControlGetMaxAbsoluteBrightnessResponse {}
104
105#[derive(Clone, Debug, Default, PartialEq)]
107pub struct ColorAdjustmentTable {
108 pub matrix: Option<[f32; 9]>,
112 #[doc(hidden)]
113 pub __source_breaking: fidl::marker::SourceBreaking,
114}
115
116impl fidl::Persistable for ColorAdjustmentTable {}
117
118mod internal {
119 use super::*;
120
121 impl fidl::encoding::ValueTypeMarker for BrightnessPoint {
122 type Borrowed<'a> = &'a Self;
123 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
124 value
125 }
126 }
127
128 unsafe impl fidl::encoding::TypeMarker for BrightnessPoint {
129 type Owned = Self;
130
131 #[inline(always)]
132 fn inline_align(_context: fidl::encoding::Context) -> usize {
133 4
134 }
135
136 #[inline(always)]
137 fn inline_size(_context: fidl::encoding::Context) -> usize {
138 8
139 }
140 }
141
142 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BrightnessPoint, D>
143 for &BrightnessPoint
144 {
145 #[inline]
146 unsafe fn encode(
147 self,
148 encoder: &mut fidl::encoding::Encoder<'_, D>,
149 offset: usize,
150 _depth: fidl::encoding::Depth,
151 ) -> fidl::Result<()> {
152 encoder.debug_check_bounds::<BrightnessPoint>(offset);
153 fidl::encoding::Encode::<BrightnessPoint, D>::encode(
155 (
156 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.ambient_lux),
157 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.display_nits),
158 ),
159 encoder,
160 offset,
161 _depth,
162 )
163 }
164 }
165 unsafe impl<
166 D: fidl::encoding::ResourceDialect,
167 T0: fidl::encoding::Encode<f32, D>,
168 T1: fidl::encoding::Encode<f32, D>,
169 > fidl::encoding::Encode<BrightnessPoint, D> for (T0, T1)
170 {
171 #[inline]
172 unsafe fn encode(
173 self,
174 encoder: &mut fidl::encoding::Encoder<'_, D>,
175 offset: usize,
176 depth: fidl::encoding::Depth,
177 ) -> fidl::Result<()> {
178 encoder.debug_check_bounds::<BrightnessPoint>(offset);
179 self.0.encode(encoder, offset + 0, depth)?;
183 self.1.encode(encoder, offset + 4, depth)?;
184 Ok(())
185 }
186 }
187
188 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BrightnessPoint {
189 #[inline(always)]
190 fn new_empty() -> Self {
191 Self { ambient_lux: fidl::new_empty!(f32, D), display_nits: fidl::new_empty!(f32, D) }
192 }
193
194 #[inline]
195 unsafe fn decode(
196 &mut self,
197 decoder: &mut fidl::encoding::Decoder<'_, D>,
198 offset: usize,
199 _depth: fidl::encoding::Depth,
200 ) -> fidl::Result<()> {
201 decoder.debug_check_bounds::<Self>(offset);
202 fidl::decode!(f32, D, &mut self.ambient_lux, decoder, offset + 0, _depth)?;
204 fidl::decode!(f32, D, &mut self.display_nits, decoder, offset + 4, _depth)?;
205 Ok(())
206 }
207 }
208
209 impl fidl::encoding::ValueTypeMarker for BrightnessTable {
210 type Borrowed<'a> = &'a Self;
211 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
212 value
213 }
214 }
215
216 unsafe impl fidl::encoding::TypeMarker for BrightnessTable {
217 type Owned = Self;
218
219 #[inline(always)]
220 fn inline_align(_context: fidl::encoding::Context) -> usize {
221 8
222 }
223
224 #[inline(always)]
225 fn inline_size(_context: fidl::encoding::Context) -> usize {
226 16
227 }
228 }
229
230 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BrightnessTable, D>
231 for &BrightnessTable
232 {
233 #[inline]
234 unsafe fn encode(
235 self,
236 encoder: &mut fidl::encoding::Encoder<'_, D>,
237 offset: usize,
238 _depth: fidl::encoding::Depth,
239 ) -> fidl::Result<()> {
240 encoder.debug_check_bounds::<BrightnessTable>(offset);
241 fidl::encoding::Encode::<BrightnessTable, D>::encode(
243 (
244 <fidl::encoding::Vector<BrightnessPoint, 50> as fidl::encoding::ValueTypeMarker>::borrow(&self.points),
245 ),
246 encoder, offset, _depth
247 )
248 }
249 }
250 unsafe impl<
251 D: fidl::encoding::ResourceDialect,
252 T0: fidl::encoding::Encode<fidl::encoding::Vector<BrightnessPoint, 50>, D>,
253 > fidl::encoding::Encode<BrightnessTable, D> for (T0,)
254 {
255 #[inline]
256 unsafe fn encode(
257 self,
258 encoder: &mut fidl::encoding::Encoder<'_, D>,
259 offset: usize,
260 depth: fidl::encoding::Depth,
261 ) -> fidl::Result<()> {
262 encoder.debug_check_bounds::<BrightnessTable>(offset);
263 self.0.encode(encoder, offset + 0, depth)?;
267 Ok(())
268 }
269 }
270
271 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BrightnessTable {
272 #[inline(always)]
273 fn new_empty() -> Self {
274 Self { points: fidl::new_empty!(fidl::encoding::Vector<BrightnessPoint, 50>, D) }
275 }
276
277 #[inline]
278 unsafe fn decode(
279 &mut self,
280 decoder: &mut fidl::encoding::Decoder<'_, D>,
281 offset: usize,
282 _depth: fidl::encoding::Depth,
283 ) -> fidl::Result<()> {
284 decoder.debug_check_bounds::<Self>(offset);
285 fidl::decode!(fidl::encoding::Vector<BrightnessPoint, 50>, D, &mut self.points, decoder, offset + 0, _depth)?;
287 Ok(())
288 }
289 }
290
291 impl fidl::encoding::ValueTypeMarker for ColorAdjustmentHandlerSetColorAdjustmentRequest {
292 type Borrowed<'a> = &'a Self;
293 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
294 value
295 }
296 }
297
298 unsafe impl fidl::encoding::TypeMarker for ColorAdjustmentHandlerSetColorAdjustmentRequest {
299 type Owned = Self;
300
301 #[inline(always)]
302 fn inline_align(_context: fidl::encoding::Context) -> usize {
303 8
304 }
305
306 #[inline(always)]
307 fn inline_size(_context: fidl::encoding::Context) -> usize {
308 16
309 }
310 }
311
312 unsafe impl<D: fidl::encoding::ResourceDialect>
313 fidl::encoding::Encode<ColorAdjustmentHandlerSetColorAdjustmentRequest, D>
314 for &ColorAdjustmentHandlerSetColorAdjustmentRequest
315 {
316 #[inline]
317 unsafe fn encode(
318 self,
319 encoder: &mut fidl::encoding::Encoder<'_, D>,
320 offset: usize,
321 _depth: fidl::encoding::Depth,
322 ) -> fidl::Result<()> {
323 encoder.debug_check_bounds::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(offset);
324 fidl::encoding::Encode::<ColorAdjustmentHandlerSetColorAdjustmentRequest, D>::encode(
326 (<ColorAdjustmentTable as fidl::encoding::ValueTypeMarker>::borrow(
327 &self.color_adjustment,
328 ),),
329 encoder,
330 offset,
331 _depth,
332 )
333 }
334 }
335 unsafe impl<
336 D: fidl::encoding::ResourceDialect,
337 T0: fidl::encoding::Encode<ColorAdjustmentTable, D>,
338 > fidl::encoding::Encode<ColorAdjustmentHandlerSetColorAdjustmentRequest, D> for (T0,)
339 {
340 #[inline]
341 unsafe fn encode(
342 self,
343 encoder: &mut fidl::encoding::Encoder<'_, D>,
344 offset: usize,
345 depth: fidl::encoding::Depth,
346 ) -> fidl::Result<()> {
347 encoder.debug_check_bounds::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(offset);
348 self.0.encode(encoder, offset + 0, depth)?;
352 Ok(())
353 }
354 }
355
356 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
357 for ColorAdjustmentHandlerSetColorAdjustmentRequest
358 {
359 #[inline(always)]
360 fn new_empty() -> Self {
361 Self { color_adjustment: fidl::new_empty!(ColorAdjustmentTable, D) }
362 }
363
364 #[inline]
365 unsafe fn decode(
366 &mut self,
367 decoder: &mut fidl::encoding::Decoder<'_, D>,
368 offset: usize,
369 _depth: fidl::encoding::Depth,
370 ) -> fidl::Result<()> {
371 decoder.debug_check_bounds::<Self>(offset);
372 fidl::decode!(
374 ColorAdjustmentTable,
375 D,
376 &mut self.color_adjustment,
377 decoder,
378 offset + 0,
379 _depth
380 )?;
381 Ok(())
382 }
383 }
384
385 impl fidl::encoding::ValueTypeMarker for ColorAdjustmentSetDiscreteColorAdjustmentRequest {
386 type Borrowed<'a> = &'a Self;
387 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
388 value
389 }
390 }
391
392 unsafe impl fidl::encoding::TypeMarker for ColorAdjustmentSetDiscreteColorAdjustmentRequest {
393 type Owned = Self;
394
395 #[inline(always)]
396 fn inline_align(_context: fidl::encoding::Context) -> usize {
397 8
398 }
399
400 #[inline(always)]
401 fn inline_size(_context: fidl::encoding::Context) -> usize {
402 16
403 }
404 }
405
406 unsafe impl<D: fidl::encoding::ResourceDialect>
407 fidl::encoding::Encode<ColorAdjustmentSetDiscreteColorAdjustmentRequest, D>
408 for &ColorAdjustmentSetDiscreteColorAdjustmentRequest
409 {
410 #[inline]
411 unsafe fn encode(
412 self,
413 encoder: &mut fidl::encoding::Encoder<'_, D>,
414 offset: usize,
415 _depth: fidl::encoding::Depth,
416 ) -> fidl::Result<()> {
417 encoder.debug_check_bounds::<ColorAdjustmentSetDiscreteColorAdjustmentRequest>(offset);
418 fidl::encoding::Encode::<ColorAdjustmentSetDiscreteColorAdjustmentRequest, D>::encode(
420 (<ColorAdjustmentTable as fidl::encoding::ValueTypeMarker>::borrow(
421 &self.color_adjustment,
422 ),),
423 encoder,
424 offset,
425 _depth,
426 )
427 }
428 }
429 unsafe impl<
430 D: fidl::encoding::ResourceDialect,
431 T0: fidl::encoding::Encode<ColorAdjustmentTable, D>,
432 > fidl::encoding::Encode<ColorAdjustmentSetDiscreteColorAdjustmentRequest, D> for (T0,)
433 {
434 #[inline]
435 unsafe fn encode(
436 self,
437 encoder: &mut fidl::encoding::Encoder<'_, D>,
438 offset: usize,
439 depth: fidl::encoding::Depth,
440 ) -> fidl::Result<()> {
441 encoder.debug_check_bounds::<ColorAdjustmentSetDiscreteColorAdjustmentRequest>(offset);
442 self.0.encode(encoder, offset + 0, depth)?;
446 Ok(())
447 }
448 }
449
450 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
451 for ColorAdjustmentSetDiscreteColorAdjustmentRequest
452 {
453 #[inline(always)]
454 fn new_empty() -> Self {
455 Self { color_adjustment: fidl::new_empty!(ColorAdjustmentTable, D) }
456 }
457
458 #[inline]
459 unsafe fn decode(
460 &mut self,
461 decoder: &mut fidl::encoding::Decoder<'_, D>,
462 offset: usize,
463 _depth: fidl::encoding::Depth,
464 ) -> fidl::Result<()> {
465 decoder.debug_check_bounds::<Self>(offset);
466 fidl::decode!(
468 ColorAdjustmentTable,
469 D,
470 &mut self.color_adjustment,
471 decoder,
472 offset + 0,
473 _depth
474 )?;
475 Ok(())
476 }
477 }
478
479 impl fidl::encoding::ValueTypeMarker for ControlSetAutoBrightnessAdjustmentRequest {
480 type Borrowed<'a> = &'a Self;
481 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
482 value
483 }
484 }
485
486 unsafe impl fidl::encoding::TypeMarker for ControlSetAutoBrightnessAdjustmentRequest {
487 type Owned = Self;
488
489 #[inline(always)]
490 fn inline_align(_context: fidl::encoding::Context) -> usize {
491 4
492 }
493
494 #[inline(always)]
495 fn inline_size(_context: fidl::encoding::Context) -> usize {
496 4
497 }
498 }
499
500 unsafe impl<D: fidl::encoding::ResourceDialect>
501 fidl::encoding::Encode<ControlSetAutoBrightnessAdjustmentRequest, D>
502 for &ControlSetAutoBrightnessAdjustmentRequest
503 {
504 #[inline]
505 unsafe fn encode(
506 self,
507 encoder: &mut fidl::encoding::Encoder<'_, D>,
508 offset: usize,
509 _depth: fidl::encoding::Depth,
510 ) -> fidl::Result<()> {
511 encoder.debug_check_bounds::<ControlSetAutoBrightnessAdjustmentRequest>(offset);
512 fidl::encoding::Encode::<ControlSetAutoBrightnessAdjustmentRequest, D>::encode(
514 (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.adjustment),),
515 encoder,
516 offset,
517 _depth,
518 )
519 }
520 }
521 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
522 fidl::encoding::Encode<ControlSetAutoBrightnessAdjustmentRequest, D> for (T0,)
523 {
524 #[inline]
525 unsafe fn encode(
526 self,
527 encoder: &mut fidl::encoding::Encoder<'_, D>,
528 offset: usize,
529 depth: fidl::encoding::Depth,
530 ) -> fidl::Result<()> {
531 encoder.debug_check_bounds::<ControlSetAutoBrightnessAdjustmentRequest>(offset);
532 self.0.encode(encoder, offset + 0, depth)?;
536 Ok(())
537 }
538 }
539
540 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
541 for ControlSetAutoBrightnessAdjustmentRequest
542 {
543 #[inline(always)]
544 fn new_empty() -> Self {
545 Self { adjustment: fidl::new_empty!(f32, D) }
546 }
547
548 #[inline]
549 unsafe fn decode(
550 &mut self,
551 decoder: &mut fidl::encoding::Decoder<'_, D>,
552 offset: usize,
553 _depth: fidl::encoding::Depth,
554 ) -> fidl::Result<()> {
555 decoder.debug_check_bounds::<Self>(offset);
556 fidl::decode!(f32, D, &mut self.adjustment, decoder, offset + 0, _depth)?;
558 Ok(())
559 }
560 }
561
562 impl fidl::encoding::ValueTypeMarker for ControlSetBrightnessTableRequest {
563 type Borrowed<'a> = &'a Self;
564 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
565 value
566 }
567 }
568
569 unsafe impl fidl::encoding::TypeMarker for ControlSetBrightnessTableRequest {
570 type Owned = Self;
571
572 #[inline(always)]
573 fn inline_align(_context: fidl::encoding::Context) -> usize {
574 8
575 }
576
577 #[inline(always)]
578 fn inline_size(_context: fidl::encoding::Context) -> usize {
579 16
580 }
581 }
582
583 unsafe impl<D: fidl::encoding::ResourceDialect>
584 fidl::encoding::Encode<ControlSetBrightnessTableRequest, D>
585 for &ControlSetBrightnessTableRequest
586 {
587 #[inline]
588 unsafe fn encode(
589 self,
590 encoder: &mut fidl::encoding::Encoder<'_, D>,
591 offset: usize,
592 _depth: fidl::encoding::Depth,
593 ) -> fidl::Result<()> {
594 encoder.debug_check_bounds::<ControlSetBrightnessTableRequest>(offset);
595 fidl::encoding::Encode::<ControlSetBrightnessTableRequest, D>::encode(
597 (<BrightnessTable as fidl::encoding::ValueTypeMarker>::borrow(&self.table),),
598 encoder,
599 offset,
600 _depth,
601 )
602 }
603 }
604 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BrightnessTable, D>>
605 fidl::encoding::Encode<ControlSetBrightnessTableRequest, D> for (T0,)
606 {
607 #[inline]
608 unsafe fn encode(
609 self,
610 encoder: &mut fidl::encoding::Encoder<'_, D>,
611 offset: usize,
612 depth: fidl::encoding::Depth,
613 ) -> fidl::Result<()> {
614 encoder.debug_check_bounds::<ControlSetBrightnessTableRequest>(offset);
615 self.0.encode(encoder, offset + 0, depth)?;
619 Ok(())
620 }
621 }
622
623 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
624 for ControlSetBrightnessTableRequest
625 {
626 #[inline(always)]
627 fn new_empty() -> Self {
628 Self { table: fidl::new_empty!(BrightnessTable, D) }
629 }
630
631 #[inline]
632 unsafe fn decode(
633 &mut self,
634 decoder: &mut fidl::encoding::Decoder<'_, D>,
635 offset: usize,
636 _depth: fidl::encoding::Depth,
637 ) -> fidl::Result<()> {
638 decoder.debug_check_bounds::<Self>(offset);
639 fidl::decode!(BrightnessTable, D, &mut self.table, decoder, offset + 0, _depth)?;
641 Ok(())
642 }
643 }
644
645 impl fidl::encoding::ValueTypeMarker for ControlSetManualBrightnessRequest {
646 type Borrowed<'a> = &'a Self;
647 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
648 value
649 }
650 }
651
652 unsafe impl fidl::encoding::TypeMarker for ControlSetManualBrightnessRequest {
653 type Owned = Self;
654
655 #[inline(always)]
656 fn inline_align(_context: fidl::encoding::Context) -> usize {
657 4
658 }
659
660 #[inline(always)]
661 fn inline_size(_context: fidl::encoding::Context) -> usize {
662 4
663 }
664 }
665
666 unsafe impl<D: fidl::encoding::ResourceDialect>
667 fidl::encoding::Encode<ControlSetManualBrightnessRequest, D>
668 for &ControlSetManualBrightnessRequest
669 {
670 #[inline]
671 unsafe fn encode(
672 self,
673 encoder: &mut fidl::encoding::Encoder<'_, D>,
674 offset: usize,
675 _depth: fidl::encoding::Depth,
676 ) -> fidl::Result<()> {
677 encoder.debug_check_bounds::<ControlSetManualBrightnessRequest>(offset);
678 fidl::encoding::Encode::<ControlSetManualBrightnessRequest, D>::encode(
680 (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
681 encoder,
682 offset,
683 _depth,
684 )
685 }
686 }
687 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
688 fidl::encoding::Encode<ControlSetManualBrightnessRequest, D> for (T0,)
689 {
690 #[inline]
691 unsafe fn encode(
692 self,
693 encoder: &mut fidl::encoding::Encoder<'_, D>,
694 offset: usize,
695 depth: fidl::encoding::Depth,
696 ) -> fidl::Result<()> {
697 encoder.debug_check_bounds::<ControlSetManualBrightnessRequest>(offset);
698 self.0.encode(encoder, offset + 0, depth)?;
702 Ok(())
703 }
704 }
705
706 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
707 for ControlSetManualBrightnessRequest
708 {
709 #[inline(always)]
710 fn new_empty() -> Self {
711 Self { value: fidl::new_empty!(f32, D) }
712 }
713
714 #[inline]
715 unsafe fn decode(
716 &mut self,
717 decoder: &mut fidl::encoding::Decoder<'_, D>,
718 offset: usize,
719 _depth: fidl::encoding::Depth,
720 ) -> fidl::Result<()> {
721 decoder.debug_check_bounds::<Self>(offset);
722 fidl::decode!(f32, D, &mut self.value, decoder, offset + 0, _depth)?;
724 Ok(())
725 }
726 }
727
728 impl fidl::encoding::ValueTypeMarker for ControlSetManualBrightnessSmoothRequest {
729 type Borrowed<'a> = &'a Self;
730 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
731 value
732 }
733 }
734
735 unsafe impl fidl::encoding::TypeMarker for ControlSetManualBrightnessSmoothRequest {
736 type Owned = Self;
737
738 #[inline(always)]
739 fn inline_align(_context: fidl::encoding::Context) -> usize {
740 8
741 }
742
743 #[inline(always)]
744 fn inline_size(_context: fidl::encoding::Context) -> usize {
745 16
746 }
747 }
748
749 unsafe impl<D: fidl::encoding::ResourceDialect>
750 fidl::encoding::Encode<ControlSetManualBrightnessSmoothRequest, D>
751 for &ControlSetManualBrightnessSmoothRequest
752 {
753 #[inline]
754 unsafe fn encode(
755 self,
756 encoder: &mut fidl::encoding::Encoder<'_, D>,
757 offset: usize,
758 _depth: fidl::encoding::Depth,
759 ) -> fidl::Result<()> {
760 encoder.debug_check_bounds::<ControlSetManualBrightnessSmoothRequest>(offset);
761 fidl::encoding::Encode::<ControlSetManualBrightnessSmoothRequest, D>::encode(
763 (
764 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
765 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration),
766 ),
767 encoder,
768 offset,
769 _depth,
770 )
771 }
772 }
773 unsafe impl<
774 D: fidl::encoding::ResourceDialect,
775 T0: fidl::encoding::Encode<f32, D>,
776 T1: fidl::encoding::Encode<i64, D>,
777 > fidl::encoding::Encode<ControlSetManualBrightnessSmoothRequest, D> for (T0, T1)
778 {
779 #[inline]
780 unsafe fn encode(
781 self,
782 encoder: &mut fidl::encoding::Encoder<'_, D>,
783 offset: usize,
784 depth: fidl::encoding::Depth,
785 ) -> fidl::Result<()> {
786 encoder.debug_check_bounds::<ControlSetManualBrightnessSmoothRequest>(offset);
787 unsafe {
790 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
791 (ptr as *mut u64).write_unaligned(0);
792 }
793 self.0.encode(encoder, offset + 0, depth)?;
795 self.1.encode(encoder, offset + 8, depth)?;
796 Ok(())
797 }
798 }
799
800 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
801 for ControlSetManualBrightnessSmoothRequest
802 {
803 #[inline(always)]
804 fn new_empty() -> Self {
805 Self { value: fidl::new_empty!(f32, D), duration: fidl::new_empty!(i64, D) }
806 }
807
808 #[inline]
809 unsafe fn decode(
810 &mut self,
811 decoder: &mut fidl::encoding::Decoder<'_, D>,
812 offset: usize,
813 _depth: fidl::encoding::Depth,
814 ) -> fidl::Result<()> {
815 decoder.debug_check_bounds::<Self>(offset);
816 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
818 let padval = unsafe { (ptr as *const u64).read_unaligned() };
819 let mask = 0xffffffff00000000u64;
820 let maskedval = padval & mask;
821 if maskedval != 0 {
822 return Err(fidl::Error::NonZeroPadding {
823 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
824 });
825 }
826 fidl::decode!(f32, D, &mut self.value, decoder, offset + 0, _depth)?;
827 fidl::decode!(i64, D, &mut self.duration, decoder, offset + 8, _depth)?;
828 Ok(())
829 }
830 }
831
832 impl fidl::encoding::ValueTypeMarker for ControlWatchAutoBrightnessAdjustmentResponse {
833 type Borrowed<'a> = &'a Self;
834 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
835 value
836 }
837 }
838
839 unsafe impl fidl::encoding::TypeMarker for ControlWatchAutoBrightnessAdjustmentResponse {
840 type Owned = Self;
841
842 #[inline(always)]
843 fn inline_align(_context: fidl::encoding::Context) -> usize {
844 4
845 }
846
847 #[inline(always)]
848 fn inline_size(_context: fidl::encoding::Context) -> usize {
849 4
850 }
851 }
852
853 unsafe impl<D: fidl::encoding::ResourceDialect>
854 fidl::encoding::Encode<ControlWatchAutoBrightnessAdjustmentResponse, D>
855 for &ControlWatchAutoBrightnessAdjustmentResponse
856 {
857 #[inline]
858 unsafe fn encode(
859 self,
860 encoder: &mut fidl::encoding::Encoder<'_, D>,
861 offset: usize,
862 _depth: fidl::encoding::Depth,
863 ) -> fidl::Result<()> {
864 encoder.debug_check_bounds::<ControlWatchAutoBrightnessAdjustmentResponse>(offset);
865 fidl::encoding::Encode::<ControlWatchAutoBrightnessAdjustmentResponse, D>::encode(
867 (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.adjustment),),
868 encoder,
869 offset,
870 _depth,
871 )
872 }
873 }
874 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
875 fidl::encoding::Encode<ControlWatchAutoBrightnessAdjustmentResponse, D> for (T0,)
876 {
877 #[inline]
878 unsafe fn encode(
879 self,
880 encoder: &mut fidl::encoding::Encoder<'_, D>,
881 offset: usize,
882 depth: fidl::encoding::Depth,
883 ) -> fidl::Result<()> {
884 encoder.debug_check_bounds::<ControlWatchAutoBrightnessAdjustmentResponse>(offset);
885 self.0.encode(encoder, offset + 0, depth)?;
889 Ok(())
890 }
891 }
892
893 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
894 for ControlWatchAutoBrightnessAdjustmentResponse
895 {
896 #[inline(always)]
897 fn new_empty() -> Self {
898 Self { adjustment: fidl::new_empty!(f32, D) }
899 }
900
901 #[inline]
902 unsafe fn decode(
903 &mut self,
904 decoder: &mut fidl::encoding::Decoder<'_, D>,
905 offset: usize,
906 _depth: fidl::encoding::Depth,
907 ) -> fidl::Result<()> {
908 decoder.debug_check_bounds::<Self>(offset);
909 fidl::decode!(f32, D, &mut self.adjustment, decoder, offset + 0, _depth)?;
911 Ok(())
912 }
913 }
914
915 impl fidl::encoding::ValueTypeMarker for ControlWatchAutoBrightnessResponse {
916 type Borrowed<'a> = &'a Self;
917 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
918 value
919 }
920 }
921
922 unsafe impl fidl::encoding::TypeMarker for ControlWatchAutoBrightnessResponse {
923 type Owned = Self;
924
925 #[inline(always)]
926 fn inline_align(_context: fidl::encoding::Context) -> usize {
927 1
928 }
929
930 #[inline(always)]
931 fn inline_size(_context: fidl::encoding::Context) -> usize {
932 1
933 }
934 }
935
936 unsafe impl<D: fidl::encoding::ResourceDialect>
937 fidl::encoding::Encode<ControlWatchAutoBrightnessResponse, D>
938 for &ControlWatchAutoBrightnessResponse
939 {
940 #[inline]
941 unsafe fn encode(
942 self,
943 encoder: &mut fidl::encoding::Encoder<'_, D>,
944 offset: usize,
945 _depth: fidl::encoding::Depth,
946 ) -> fidl::Result<()> {
947 encoder.debug_check_bounds::<ControlWatchAutoBrightnessResponse>(offset);
948 fidl::encoding::Encode::<ControlWatchAutoBrightnessResponse, D>::encode(
950 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
951 encoder,
952 offset,
953 _depth,
954 )
955 }
956 }
957 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
958 fidl::encoding::Encode<ControlWatchAutoBrightnessResponse, D> for (T0,)
959 {
960 #[inline]
961 unsafe fn encode(
962 self,
963 encoder: &mut fidl::encoding::Encoder<'_, D>,
964 offset: usize,
965 depth: fidl::encoding::Depth,
966 ) -> fidl::Result<()> {
967 encoder.debug_check_bounds::<ControlWatchAutoBrightnessResponse>(offset);
968 self.0.encode(encoder, offset + 0, depth)?;
972 Ok(())
973 }
974 }
975
976 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
977 for ControlWatchAutoBrightnessResponse
978 {
979 #[inline(always)]
980 fn new_empty() -> Self {
981 Self { enabled: fidl::new_empty!(bool, D) }
982 }
983
984 #[inline]
985 unsafe fn decode(
986 &mut self,
987 decoder: &mut fidl::encoding::Decoder<'_, D>,
988 offset: usize,
989 _depth: fidl::encoding::Depth,
990 ) -> fidl::Result<()> {
991 decoder.debug_check_bounds::<Self>(offset);
992 fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
994 Ok(())
995 }
996 }
997
998 impl fidl::encoding::ValueTypeMarker for ControlWatchCurrentBrightnessResponse {
999 type Borrowed<'a> = &'a Self;
1000 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1001 value
1002 }
1003 }
1004
1005 unsafe impl fidl::encoding::TypeMarker for ControlWatchCurrentBrightnessResponse {
1006 type Owned = Self;
1007
1008 #[inline(always)]
1009 fn inline_align(_context: fidl::encoding::Context) -> usize {
1010 4
1011 }
1012
1013 #[inline(always)]
1014 fn inline_size(_context: fidl::encoding::Context) -> usize {
1015 4
1016 }
1017 }
1018
1019 unsafe impl<D: fidl::encoding::ResourceDialect>
1020 fidl::encoding::Encode<ControlWatchCurrentBrightnessResponse, D>
1021 for &ControlWatchCurrentBrightnessResponse
1022 {
1023 #[inline]
1024 unsafe fn encode(
1025 self,
1026 encoder: &mut fidl::encoding::Encoder<'_, D>,
1027 offset: usize,
1028 _depth: fidl::encoding::Depth,
1029 ) -> fidl::Result<()> {
1030 encoder.debug_check_bounds::<ControlWatchCurrentBrightnessResponse>(offset);
1031 fidl::encoding::Encode::<ControlWatchCurrentBrightnessResponse, D>::encode(
1033 (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
1034 encoder,
1035 offset,
1036 _depth,
1037 )
1038 }
1039 }
1040 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
1041 fidl::encoding::Encode<ControlWatchCurrentBrightnessResponse, D> for (T0,)
1042 {
1043 #[inline]
1044 unsafe fn encode(
1045 self,
1046 encoder: &mut fidl::encoding::Encoder<'_, D>,
1047 offset: usize,
1048 depth: fidl::encoding::Depth,
1049 ) -> fidl::Result<()> {
1050 encoder.debug_check_bounds::<ControlWatchCurrentBrightnessResponse>(offset);
1051 self.0.encode(encoder, offset + 0, depth)?;
1055 Ok(())
1056 }
1057 }
1058
1059 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1060 for ControlWatchCurrentBrightnessResponse
1061 {
1062 #[inline(always)]
1063 fn new_empty() -> Self {
1064 Self { value: fidl::new_empty!(f32, D) }
1065 }
1066
1067 #[inline]
1068 unsafe fn decode(
1069 &mut self,
1070 decoder: &mut fidl::encoding::Decoder<'_, D>,
1071 offset: usize,
1072 _depth: fidl::encoding::Depth,
1073 ) -> fidl::Result<()> {
1074 decoder.debug_check_bounds::<Self>(offset);
1075 fidl::decode!(f32, D, &mut self.value, decoder, offset + 0, _depth)?;
1077 Ok(())
1078 }
1079 }
1080
1081 impl fidl::encoding::ValueTypeMarker for ControlGetMaxAbsoluteBrightnessResponse {
1082 type Borrowed<'a> = &'a Self;
1083 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1084 value
1085 }
1086 }
1087
1088 unsafe impl fidl::encoding::TypeMarker for ControlGetMaxAbsoluteBrightnessResponse {
1089 type Owned = Self;
1090
1091 #[inline(always)]
1092 fn inline_align(_context: fidl::encoding::Context) -> usize {
1093 8
1094 }
1095
1096 #[inline(always)]
1097 fn inline_size(_context: fidl::encoding::Context) -> usize {
1098 8
1099 }
1100 }
1101
1102 unsafe impl<D: fidl::encoding::ResourceDialect>
1103 fidl::encoding::Encode<ControlGetMaxAbsoluteBrightnessResponse, D>
1104 for &ControlGetMaxAbsoluteBrightnessResponse
1105 {
1106 #[inline]
1107 unsafe fn encode(
1108 self,
1109 encoder: &mut fidl::encoding::Encoder<'_, D>,
1110 offset: usize,
1111 _depth: fidl::encoding::Depth,
1112 ) -> fidl::Result<()> {
1113 encoder.debug_check_bounds::<ControlGetMaxAbsoluteBrightnessResponse>(offset);
1114 fidl::encoding::Encode::<ControlGetMaxAbsoluteBrightnessResponse, D>::encode(
1116 (<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_brightness),),
1117 encoder,
1118 offset,
1119 _depth,
1120 )
1121 }
1122 }
1123 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f64, D>>
1124 fidl::encoding::Encode<ControlGetMaxAbsoluteBrightnessResponse, D> for (T0,)
1125 {
1126 #[inline]
1127 unsafe fn encode(
1128 self,
1129 encoder: &mut fidl::encoding::Encoder<'_, D>,
1130 offset: usize,
1131 depth: fidl::encoding::Depth,
1132 ) -> fidl::Result<()> {
1133 encoder.debug_check_bounds::<ControlGetMaxAbsoluteBrightnessResponse>(offset);
1134 self.0.encode(encoder, offset + 0, depth)?;
1138 Ok(())
1139 }
1140 }
1141
1142 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1143 for ControlGetMaxAbsoluteBrightnessResponse
1144 {
1145 #[inline(always)]
1146 fn new_empty() -> Self {
1147 Self { max_brightness: fidl::new_empty!(f64, D) }
1148 }
1149
1150 #[inline]
1151 unsafe fn decode(
1152 &mut self,
1153 decoder: &mut fidl::encoding::Decoder<'_, D>,
1154 offset: usize,
1155 _depth: fidl::encoding::Depth,
1156 ) -> fidl::Result<()> {
1157 decoder.debug_check_bounds::<Self>(offset);
1158 fidl::decode!(f64, D, &mut self.max_brightness, decoder, offset + 0, _depth)?;
1160 Ok(())
1161 }
1162 }
1163
1164 impl ColorAdjustmentTable {
1165 #[inline(always)]
1166 fn max_ordinal_present(&self) -> u64 {
1167 if let Some(_) = self.matrix {
1168 return 1;
1169 }
1170 0
1171 }
1172 }
1173
1174 impl fidl::encoding::ValueTypeMarker for ColorAdjustmentTable {
1175 type Borrowed<'a> = &'a Self;
1176 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1177 value
1178 }
1179 }
1180
1181 unsafe impl fidl::encoding::TypeMarker for ColorAdjustmentTable {
1182 type Owned = Self;
1183
1184 #[inline(always)]
1185 fn inline_align(_context: fidl::encoding::Context) -> usize {
1186 8
1187 }
1188
1189 #[inline(always)]
1190 fn inline_size(_context: fidl::encoding::Context) -> usize {
1191 16
1192 }
1193 }
1194
1195 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ColorAdjustmentTable, D>
1196 for &ColorAdjustmentTable
1197 {
1198 unsafe fn encode(
1199 self,
1200 encoder: &mut fidl::encoding::Encoder<'_, D>,
1201 offset: usize,
1202 mut depth: fidl::encoding::Depth,
1203 ) -> fidl::Result<()> {
1204 encoder.debug_check_bounds::<ColorAdjustmentTable>(offset);
1205 let max_ordinal: u64 = self.max_ordinal_present();
1207 encoder.write_num(max_ordinal, offset);
1208 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1209 if max_ordinal == 0 {
1211 return Ok(());
1212 }
1213 depth.increment()?;
1214 let envelope_size = 8;
1215 let bytes_len = max_ordinal as usize * envelope_size;
1216 #[allow(unused_variables)]
1217 let offset = encoder.out_of_line_offset(bytes_len);
1218 let mut _prev_end_offset: usize = 0;
1219 if 1 > max_ordinal {
1220 return Ok(());
1221 }
1222
1223 let cur_offset: usize = (1 - 1) * envelope_size;
1226
1227 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1229
1230 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<f32, 9>, D>(
1235 self.matrix.as_ref().map(
1236 <fidl::encoding::Array<f32, 9> as fidl::encoding::ValueTypeMarker>::borrow,
1237 ),
1238 encoder,
1239 offset + cur_offset,
1240 depth,
1241 )?;
1242
1243 _prev_end_offset = cur_offset + envelope_size;
1244
1245 Ok(())
1246 }
1247 }
1248
1249 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ColorAdjustmentTable {
1250 #[inline(always)]
1251 fn new_empty() -> Self {
1252 Self::default()
1253 }
1254
1255 unsafe fn decode(
1256 &mut self,
1257 decoder: &mut fidl::encoding::Decoder<'_, D>,
1258 offset: usize,
1259 mut depth: fidl::encoding::Depth,
1260 ) -> fidl::Result<()> {
1261 decoder.debug_check_bounds::<Self>(offset);
1262 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1263 None => return Err(fidl::Error::NotNullable),
1264 Some(len) => len,
1265 };
1266 if len == 0 {
1268 return Ok(());
1269 };
1270 depth.increment()?;
1271 let envelope_size = 8;
1272 let bytes_len = len * envelope_size;
1273 let offset = decoder.out_of_line_offset(bytes_len)?;
1274 let mut _next_ordinal_to_read = 0;
1276 let mut next_offset = offset;
1277 let end_offset = offset + bytes_len;
1278 _next_ordinal_to_read += 1;
1279 if next_offset >= end_offset {
1280 return Ok(());
1281 }
1282
1283 while _next_ordinal_to_read < 1 {
1285 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1286 _next_ordinal_to_read += 1;
1287 next_offset += envelope_size;
1288 }
1289
1290 let next_out_of_line = decoder.next_out_of_line();
1291 let handles_before = decoder.remaining_handles();
1292 if let Some((inlined, num_bytes, num_handles)) =
1293 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1294 {
1295 let member_inline_size =
1296 <fidl::encoding::Array<f32, 9> as fidl::encoding::TypeMarker>::inline_size(
1297 decoder.context,
1298 );
1299 if inlined != (member_inline_size <= 4) {
1300 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1301 }
1302 let inner_offset;
1303 let mut inner_depth = depth.clone();
1304 if inlined {
1305 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1306 inner_offset = next_offset;
1307 } else {
1308 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1309 inner_depth.increment()?;
1310 }
1311 let val_ref = self
1312 .matrix
1313 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<f32, 9>, D));
1314 fidl::decode!(fidl::encoding::Array<f32, 9>, D, val_ref, decoder, inner_offset, inner_depth)?;
1315 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1316 {
1317 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1318 }
1319 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1320 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1321 }
1322 }
1323
1324 next_offset += envelope_size;
1325
1326 while next_offset < end_offset {
1328 _next_ordinal_to_read += 1;
1329 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1330 next_offset += envelope_size;
1331 }
1332
1333 Ok(())
1334 }
1335 }
1336}