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, Copy, Debug, PartialEq, PartialOrd)]
12pub struct DeviceSetNormalizedBrightnessScaleRequest {
13 pub scale: f64,
14}
15
16impl fidl::Persistable for DeviceSetNormalizedBrightnessScaleRequest {}
17
18#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
19pub struct DeviceSetStateAbsoluteRequest {
20 pub state: State,
21}
22
23impl fidl::Persistable for DeviceSetStateAbsoluteRequest {}
24
25#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
26pub struct DeviceSetStateNormalizedRequest {
27 pub state: State,
28}
29
30impl fidl::Persistable for DeviceSetStateNormalizedRequest {}
31
32#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
33pub struct DeviceGetMaxAbsoluteBrightnessResponse {
34 pub max_brightness: f64,
35}
36
37impl fidl::Persistable for DeviceGetMaxAbsoluteBrightnessResponse {}
38
39#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
40pub struct DeviceGetNormalizedBrightnessScaleResponse {
41 pub scale: f64,
42}
43
44impl fidl::Persistable for DeviceGetNormalizedBrightnessScaleResponse {}
45
46#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
47pub struct DeviceGetStateAbsoluteResponse {
48 pub state: State,
49}
50
51impl fidl::Persistable for DeviceGetStateAbsoluteResponse {}
52
53#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
54pub struct DeviceGetStateNormalizedResponse {
55 pub state: State,
56}
57
58impl fidl::Persistable for DeviceGetStateNormalizedResponse {}
59
60#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
61pub struct State {
62 pub backlight_on: bool,
63 pub brightness: f64,
73}
74
75impl fidl::Persistable for State {}
76
77mod internal {
78 use super::*;
79
80 impl fidl::encoding::ValueTypeMarker for DeviceSetNormalizedBrightnessScaleRequest {
81 type Borrowed<'a> = &'a Self;
82 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
83 value
84 }
85 }
86
87 unsafe impl fidl::encoding::TypeMarker for DeviceSetNormalizedBrightnessScaleRequest {
88 type Owned = Self;
89
90 #[inline(always)]
91 fn inline_align(_context: fidl::encoding::Context) -> usize {
92 8
93 }
94
95 #[inline(always)]
96 fn inline_size(_context: fidl::encoding::Context) -> usize {
97 8
98 }
99 }
100
101 unsafe impl<D: fidl::encoding::ResourceDialect>
102 fidl::encoding::Encode<DeviceSetNormalizedBrightnessScaleRequest, D>
103 for &DeviceSetNormalizedBrightnessScaleRequest
104 {
105 #[inline]
106 unsafe fn encode(
107 self,
108 encoder: &mut fidl::encoding::Encoder<'_, D>,
109 offset: usize,
110 _depth: fidl::encoding::Depth,
111 ) -> fidl::Result<()> {
112 encoder.debug_check_bounds::<DeviceSetNormalizedBrightnessScaleRequest>(offset);
113 fidl::encoding::Encode::<DeviceSetNormalizedBrightnessScaleRequest, D>::encode(
115 (<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),),
116 encoder,
117 offset,
118 _depth,
119 )
120 }
121 }
122 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f64, D>>
123 fidl::encoding::Encode<DeviceSetNormalizedBrightnessScaleRequest, D> for (T0,)
124 {
125 #[inline]
126 unsafe fn encode(
127 self,
128 encoder: &mut fidl::encoding::Encoder<'_, D>,
129 offset: usize,
130 depth: fidl::encoding::Depth,
131 ) -> fidl::Result<()> {
132 encoder.debug_check_bounds::<DeviceSetNormalizedBrightnessScaleRequest>(offset);
133 self.0.encode(encoder, offset + 0, depth)?;
137 Ok(())
138 }
139 }
140
141 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
142 for DeviceSetNormalizedBrightnessScaleRequest
143 {
144 #[inline(always)]
145 fn new_empty() -> Self {
146 Self { scale: fidl::new_empty!(f64, D) }
147 }
148
149 #[inline]
150 unsafe fn decode(
151 &mut self,
152 decoder: &mut fidl::encoding::Decoder<'_, D>,
153 offset: usize,
154 _depth: fidl::encoding::Depth,
155 ) -> fidl::Result<()> {
156 decoder.debug_check_bounds::<Self>(offset);
157 fidl::decode!(f64, D, &mut self.scale, decoder, offset + 0, _depth)?;
159 Ok(())
160 }
161 }
162
163 impl fidl::encoding::ValueTypeMarker for DeviceSetStateAbsoluteRequest {
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 DeviceSetStateAbsoluteRequest {
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 16
181 }
182 }
183
184 unsafe impl<D: fidl::encoding::ResourceDialect>
185 fidl::encoding::Encode<DeviceSetStateAbsoluteRequest, D>
186 for &DeviceSetStateAbsoluteRequest
187 {
188 #[inline]
189 unsafe fn encode(
190 self,
191 encoder: &mut fidl::encoding::Encoder<'_, D>,
192 offset: usize,
193 _depth: fidl::encoding::Depth,
194 ) -> fidl::Result<()> {
195 encoder.debug_check_bounds::<DeviceSetStateAbsoluteRequest>(offset);
196 fidl::encoding::Encode::<DeviceSetStateAbsoluteRequest, D>::encode(
198 (<State as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
199 encoder,
200 offset,
201 _depth,
202 )
203 }
204 }
205 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<State, D>>
206 fidl::encoding::Encode<DeviceSetStateAbsoluteRequest, D> for (T0,)
207 {
208 #[inline]
209 unsafe fn encode(
210 self,
211 encoder: &mut fidl::encoding::Encoder<'_, D>,
212 offset: usize,
213 depth: fidl::encoding::Depth,
214 ) -> fidl::Result<()> {
215 encoder.debug_check_bounds::<DeviceSetStateAbsoluteRequest>(offset);
216 self.0.encode(encoder, offset + 0, depth)?;
220 Ok(())
221 }
222 }
223
224 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
225 for DeviceSetStateAbsoluteRequest
226 {
227 #[inline(always)]
228 fn new_empty() -> Self {
229 Self { state: fidl::new_empty!(State, D) }
230 }
231
232 #[inline]
233 unsafe fn decode(
234 &mut self,
235 decoder: &mut fidl::encoding::Decoder<'_, D>,
236 offset: usize,
237 _depth: fidl::encoding::Depth,
238 ) -> fidl::Result<()> {
239 decoder.debug_check_bounds::<Self>(offset);
240 fidl::decode!(State, D, &mut self.state, decoder, offset + 0, _depth)?;
242 Ok(())
243 }
244 }
245
246 impl fidl::encoding::ValueTypeMarker for DeviceSetStateNormalizedRequest {
247 type Borrowed<'a> = &'a Self;
248 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
249 value
250 }
251 }
252
253 unsafe impl fidl::encoding::TypeMarker for DeviceSetStateNormalizedRequest {
254 type Owned = Self;
255
256 #[inline(always)]
257 fn inline_align(_context: fidl::encoding::Context) -> usize {
258 8
259 }
260
261 #[inline(always)]
262 fn inline_size(_context: fidl::encoding::Context) -> usize {
263 16
264 }
265 }
266
267 unsafe impl<D: fidl::encoding::ResourceDialect>
268 fidl::encoding::Encode<DeviceSetStateNormalizedRequest, D>
269 for &DeviceSetStateNormalizedRequest
270 {
271 #[inline]
272 unsafe fn encode(
273 self,
274 encoder: &mut fidl::encoding::Encoder<'_, D>,
275 offset: usize,
276 _depth: fidl::encoding::Depth,
277 ) -> fidl::Result<()> {
278 encoder.debug_check_bounds::<DeviceSetStateNormalizedRequest>(offset);
279 fidl::encoding::Encode::<DeviceSetStateNormalizedRequest, D>::encode(
281 (<State as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
282 encoder,
283 offset,
284 _depth,
285 )
286 }
287 }
288 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<State, D>>
289 fidl::encoding::Encode<DeviceSetStateNormalizedRequest, D> for (T0,)
290 {
291 #[inline]
292 unsafe fn encode(
293 self,
294 encoder: &mut fidl::encoding::Encoder<'_, D>,
295 offset: usize,
296 depth: fidl::encoding::Depth,
297 ) -> fidl::Result<()> {
298 encoder.debug_check_bounds::<DeviceSetStateNormalizedRequest>(offset);
299 self.0.encode(encoder, offset + 0, depth)?;
303 Ok(())
304 }
305 }
306
307 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
308 for DeviceSetStateNormalizedRequest
309 {
310 #[inline(always)]
311 fn new_empty() -> Self {
312 Self { state: fidl::new_empty!(State, D) }
313 }
314
315 #[inline]
316 unsafe fn decode(
317 &mut self,
318 decoder: &mut fidl::encoding::Decoder<'_, D>,
319 offset: usize,
320 _depth: fidl::encoding::Depth,
321 ) -> fidl::Result<()> {
322 decoder.debug_check_bounds::<Self>(offset);
323 fidl::decode!(State, D, &mut self.state, decoder, offset + 0, _depth)?;
325 Ok(())
326 }
327 }
328
329 impl fidl::encoding::ValueTypeMarker for DeviceGetMaxAbsoluteBrightnessResponse {
330 type Borrowed<'a> = &'a Self;
331 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
332 value
333 }
334 }
335
336 unsafe impl fidl::encoding::TypeMarker for DeviceGetMaxAbsoluteBrightnessResponse {
337 type Owned = Self;
338
339 #[inline(always)]
340 fn inline_align(_context: fidl::encoding::Context) -> usize {
341 8
342 }
343
344 #[inline(always)]
345 fn inline_size(_context: fidl::encoding::Context) -> usize {
346 8
347 }
348 }
349
350 unsafe impl<D: fidl::encoding::ResourceDialect>
351 fidl::encoding::Encode<DeviceGetMaxAbsoluteBrightnessResponse, D>
352 for &DeviceGetMaxAbsoluteBrightnessResponse
353 {
354 #[inline]
355 unsafe fn encode(
356 self,
357 encoder: &mut fidl::encoding::Encoder<'_, D>,
358 offset: usize,
359 _depth: fidl::encoding::Depth,
360 ) -> fidl::Result<()> {
361 encoder.debug_check_bounds::<DeviceGetMaxAbsoluteBrightnessResponse>(offset);
362 fidl::encoding::Encode::<DeviceGetMaxAbsoluteBrightnessResponse, D>::encode(
364 (<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_brightness),),
365 encoder,
366 offset,
367 _depth,
368 )
369 }
370 }
371 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f64, D>>
372 fidl::encoding::Encode<DeviceGetMaxAbsoluteBrightnessResponse, D> for (T0,)
373 {
374 #[inline]
375 unsafe fn encode(
376 self,
377 encoder: &mut fidl::encoding::Encoder<'_, D>,
378 offset: usize,
379 depth: fidl::encoding::Depth,
380 ) -> fidl::Result<()> {
381 encoder.debug_check_bounds::<DeviceGetMaxAbsoluteBrightnessResponse>(offset);
382 self.0.encode(encoder, offset + 0, depth)?;
386 Ok(())
387 }
388 }
389
390 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
391 for DeviceGetMaxAbsoluteBrightnessResponse
392 {
393 #[inline(always)]
394 fn new_empty() -> Self {
395 Self { max_brightness: fidl::new_empty!(f64, D) }
396 }
397
398 #[inline]
399 unsafe fn decode(
400 &mut self,
401 decoder: &mut fidl::encoding::Decoder<'_, D>,
402 offset: usize,
403 _depth: fidl::encoding::Depth,
404 ) -> fidl::Result<()> {
405 decoder.debug_check_bounds::<Self>(offset);
406 fidl::decode!(f64, D, &mut self.max_brightness, decoder, offset + 0, _depth)?;
408 Ok(())
409 }
410 }
411
412 impl fidl::encoding::ValueTypeMarker for DeviceGetNormalizedBrightnessScaleResponse {
413 type Borrowed<'a> = &'a Self;
414 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
415 value
416 }
417 }
418
419 unsafe impl fidl::encoding::TypeMarker for DeviceGetNormalizedBrightnessScaleResponse {
420 type Owned = Self;
421
422 #[inline(always)]
423 fn inline_align(_context: fidl::encoding::Context) -> usize {
424 8
425 }
426
427 #[inline(always)]
428 fn inline_size(_context: fidl::encoding::Context) -> usize {
429 8
430 }
431 }
432
433 unsafe impl<D: fidl::encoding::ResourceDialect>
434 fidl::encoding::Encode<DeviceGetNormalizedBrightnessScaleResponse, D>
435 for &DeviceGetNormalizedBrightnessScaleResponse
436 {
437 #[inline]
438 unsafe fn encode(
439 self,
440 encoder: &mut fidl::encoding::Encoder<'_, D>,
441 offset: usize,
442 _depth: fidl::encoding::Depth,
443 ) -> fidl::Result<()> {
444 encoder.debug_check_bounds::<DeviceGetNormalizedBrightnessScaleResponse>(offset);
445 fidl::encoding::Encode::<DeviceGetNormalizedBrightnessScaleResponse, D>::encode(
447 (<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),),
448 encoder,
449 offset,
450 _depth,
451 )
452 }
453 }
454 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f64, D>>
455 fidl::encoding::Encode<DeviceGetNormalizedBrightnessScaleResponse, D> for (T0,)
456 {
457 #[inline]
458 unsafe fn encode(
459 self,
460 encoder: &mut fidl::encoding::Encoder<'_, D>,
461 offset: usize,
462 depth: fidl::encoding::Depth,
463 ) -> fidl::Result<()> {
464 encoder.debug_check_bounds::<DeviceGetNormalizedBrightnessScaleResponse>(offset);
465 self.0.encode(encoder, offset + 0, depth)?;
469 Ok(())
470 }
471 }
472
473 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
474 for DeviceGetNormalizedBrightnessScaleResponse
475 {
476 #[inline(always)]
477 fn new_empty() -> Self {
478 Self { scale: fidl::new_empty!(f64, D) }
479 }
480
481 #[inline]
482 unsafe fn decode(
483 &mut self,
484 decoder: &mut fidl::encoding::Decoder<'_, D>,
485 offset: usize,
486 _depth: fidl::encoding::Depth,
487 ) -> fidl::Result<()> {
488 decoder.debug_check_bounds::<Self>(offset);
489 fidl::decode!(f64, D, &mut self.scale, decoder, offset + 0, _depth)?;
491 Ok(())
492 }
493 }
494
495 impl fidl::encoding::ValueTypeMarker for DeviceGetStateAbsoluteResponse {
496 type Borrowed<'a> = &'a Self;
497 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
498 value
499 }
500 }
501
502 unsafe impl fidl::encoding::TypeMarker for DeviceGetStateAbsoluteResponse {
503 type Owned = Self;
504
505 #[inline(always)]
506 fn inline_align(_context: fidl::encoding::Context) -> usize {
507 8
508 }
509
510 #[inline(always)]
511 fn inline_size(_context: fidl::encoding::Context) -> usize {
512 16
513 }
514 }
515
516 unsafe impl<D: fidl::encoding::ResourceDialect>
517 fidl::encoding::Encode<DeviceGetStateAbsoluteResponse, D>
518 for &DeviceGetStateAbsoluteResponse
519 {
520 #[inline]
521 unsafe fn encode(
522 self,
523 encoder: &mut fidl::encoding::Encoder<'_, D>,
524 offset: usize,
525 _depth: fidl::encoding::Depth,
526 ) -> fidl::Result<()> {
527 encoder.debug_check_bounds::<DeviceGetStateAbsoluteResponse>(offset);
528 fidl::encoding::Encode::<DeviceGetStateAbsoluteResponse, D>::encode(
530 (<State as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
531 encoder,
532 offset,
533 _depth,
534 )
535 }
536 }
537 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<State, D>>
538 fidl::encoding::Encode<DeviceGetStateAbsoluteResponse, D> for (T0,)
539 {
540 #[inline]
541 unsafe fn encode(
542 self,
543 encoder: &mut fidl::encoding::Encoder<'_, D>,
544 offset: usize,
545 depth: fidl::encoding::Depth,
546 ) -> fidl::Result<()> {
547 encoder.debug_check_bounds::<DeviceGetStateAbsoluteResponse>(offset);
548 self.0.encode(encoder, offset + 0, depth)?;
552 Ok(())
553 }
554 }
555
556 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
557 for DeviceGetStateAbsoluteResponse
558 {
559 #[inline(always)]
560 fn new_empty() -> Self {
561 Self { state: fidl::new_empty!(State, D) }
562 }
563
564 #[inline]
565 unsafe fn decode(
566 &mut self,
567 decoder: &mut fidl::encoding::Decoder<'_, D>,
568 offset: usize,
569 _depth: fidl::encoding::Depth,
570 ) -> fidl::Result<()> {
571 decoder.debug_check_bounds::<Self>(offset);
572 fidl::decode!(State, D, &mut self.state, decoder, offset + 0, _depth)?;
574 Ok(())
575 }
576 }
577
578 impl fidl::encoding::ValueTypeMarker for DeviceGetStateNormalizedResponse {
579 type Borrowed<'a> = &'a Self;
580 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
581 value
582 }
583 }
584
585 unsafe impl fidl::encoding::TypeMarker for DeviceGetStateNormalizedResponse {
586 type Owned = Self;
587
588 #[inline(always)]
589 fn inline_align(_context: fidl::encoding::Context) -> usize {
590 8
591 }
592
593 #[inline(always)]
594 fn inline_size(_context: fidl::encoding::Context) -> usize {
595 16
596 }
597 }
598
599 unsafe impl<D: fidl::encoding::ResourceDialect>
600 fidl::encoding::Encode<DeviceGetStateNormalizedResponse, D>
601 for &DeviceGetStateNormalizedResponse
602 {
603 #[inline]
604 unsafe fn encode(
605 self,
606 encoder: &mut fidl::encoding::Encoder<'_, D>,
607 offset: usize,
608 _depth: fidl::encoding::Depth,
609 ) -> fidl::Result<()> {
610 encoder.debug_check_bounds::<DeviceGetStateNormalizedResponse>(offset);
611 fidl::encoding::Encode::<DeviceGetStateNormalizedResponse, D>::encode(
613 (<State as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
614 encoder,
615 offset,
616 _depth,
617 )
618 }
619 }
620 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<State, D>>
621 fidl::encoding::Encode<DeviceGetStateNormalizedResponse, D> for (T0,)
622 {
623 #[inline]
624 unsafe fn encode(
625 self,
626 encoder: &mut fidl::encoding::Encoder<'_, D>,
627 offset: usize,
628 depth: fidl::encoding::Depth,
629 ) -> fidl::Result<()> {
630 encoder.debug_check_bounds::<DeviceGetStateNormalizedResponse>(offset);
631 self.0.encode(encoder, offset + 0, depth)?;
635 Ok(())
636 }
637 }
638
639 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
640 for DeviceGetStateNormalizedResponse
641 {
642 #[inline(always)]
643 fn new_empty() -> Self {
644 Self { state: fidl::new_empty!(State, D) }
645 }
646
647 #[inline]
648 unsafe fn decode(
649 &mut self,
650 decoder: &mut fidl::encoding::Decoder<'_, D>,
651 offset: usize,
652 _depth: fidl::encoding::Depth,
653 ) -> fidl::Result<()> {
654 decoder.debug_check_bounds::<Self>(offset);
655 fidl::decode!(State, D, &mut self.state, decoder, offset + 0, _depth)?;
657 Ok(())
658 }
659 }
660
661 impl fidl::encoding::ValueTypeMarker for State {
662 type Borrowed<'a> = &'a Self;
663 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
664 value
665 }
666 }
667
668 unsafe impl fidl::encoding::TypeMarker for State {
669 type Owned = Self;
670
671 #[inline(always)]
672 fn inline_align(_context: fidl::encoding::Context) -> usize {
673 8
674 }
675
676 #[inline(always)]
677 fn inline_size(_context: fidl::encoding::Context) -> usize {
678 16
679 }
680 }
681
682 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<State, D> for &State {
683 #[inline]
684 unsafe fn encode(
685 self,
686 encoder: &mut fidl::encoding::Encoder<'_, D>,
687 offset: usize,
688 _depth: fidl::encoding::Depth,
689 ) -> fidl::Result<()> {
690 encoder.debug_check_bounds::<State>(offset);
691 fidl::encoding::Encode::<State, D>::encode(
693 (
694 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.backlight_on),
695 <f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.brightness),
696 ),
697 encoder,
698 offset,
699 _depth,
700 )
701 }
702 }
703 unsafe impl<
704 D: fidl::encoding::ResourceDialect,
705 T0: fidl::encoding::Encode<bool, D>,
706 T1: fidl::encoding::Encode<f64, D>,
707 > fidl::encoding::Encode<State, D> for (T0, T1)
708 {
709 #[inline]
710 unsafe fn encode(
711 self,
712 encoder: &mut fidl::encoding::Encoder<'_, D>,
713 offset: usize,
714 depth: fidl::encoding::Depth,
715 ) -> fidl::Result<()> {
716 encoder.debug_check_bounds::<State>(offset);
717 unsafe {
720 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
721 (ptr as *mut u64).write_unaligned(0);
722 }
723 self.0.encode(encoder, offset + 0, depth)?;
725 self.1.encode(encoder, offset + 8, depth)?;
726 Ok(())
727 }
728 }
729
730 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for State {
731 #[inline(always)]
732 fn new_empty() -> Self {
733 Self { backlight_on: fidl::new_empty!(bool, D), brightness: fidl::new_empty!(f64, D) }
734 }
735
736 #[inline]
737 unsafe fn decode(
738 &mut self,
739 decoder: &mut fidl::encoding::Decoder<'_, D>,
740 offset: usize,
741 _depth: fidl::encoding::Depth,
742 ) -> fidl::Result<()> {
743 decoder.debug_check_bounds::<Self>(offset);
744 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
746 let padval = unsafe { (ptr as *const u64).read_unaligned() };
747 let mask = 0xffffffffffffff00u64;
748 let maskedval = padval & mask;
749 if maskedval != 0 {
750 return Err(fidl::Error::NonZeroPadding {
751 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
752 });
753 }
754 fidl::decode!(bool, D, &mut self.backlight_on, decoder, offset + 0, _depth)?;
755 fidl::decode!(f64, D, &mut self.brightness, decoder, offset + 8, _depth)?;
756 Ok(())
757 }
758 }
759}