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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13#[repr(u32)]
14pub enum Error {
15 InvalidInput = 1,
18}
19
20impl Error {
21 #[inline]
22 pub fn from_primitive(prim: u32) -> Option<Self> {
23 match prim {
24 1 => Some(Self::InvalidInput),
25 _ => None,
26 }
27 }
28
29 #[inline]
30 pub const fn into_primitive(self) -> u32 {
31 self as u32
32 }
33
34 #[deprecated = "Strict enums should not use `is_unknown`"]
35 #[inline]
36 pub fn is_unknown(&self) -> bool {
37 false
38 }
39}
40
41#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
42pub struct CalibratorCalibrateRequest {
43 pub data: Rgbc,
44}
45
46impl fidl::Persistable for CalibratorCalibrateRequest {}
47
48#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
49pub struct CalibratorCalibrateResponse {
50 pub data: Rgbc,
51}
52
53impl fidl::Persistable for CalibratorCalibrateResponse {}
54
55#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
57pub struct Rgbc {
58 pub red_intensity: f32,
60 pub green_intensity: f32,
62 pub blue_intensity: f32,
64 pub clear_intensity: f32,
66}
67
68impl fidl::Persistable for Rgbc {}
69
70#[derive(Clone, Debug, PartialEq)]
71pub struct SensorWatchResponse {
72 pub data: LightSensorData,
73}
74
75impl fidl::Persistable for SensorWatchResponse {}
76
77#[derive(Clone, Debug, Default, PartialEq)]
78pub struct LightSensorData {
79 pub rgbc: Option<Rgbc>,
83 pub calculated_lux: Option<f32>,
86 pub correlated_color_temperature: Option<f32>,
89 pub si_rgbc: Option<Rgbc>,
92 pub is_calibrated: Option<bool>,
96 #[doc(hidden)]
97 pub __source_breaking: fidl::marker::SourceBreaking,
98}
99
100impl fidl::Persistable for LightSensorData {}
101
102mod internal {
103 use super::*;
104 unsafe impl fidl::encoding::TypeMarker for Error {
105 type Owned = Self;
106
107 #[inline(always)]
108 fn inline_align(_context: fidl::encoding::Context) -> usize {
109 std::mem::align_of::<u32>()
110 }
111
112 #[inline(always)]
113 fn inline_size(_context: fidl::encoding::Context) -> usize {
114 std::mem::size_of::<u32>()
115 }
116
117 #[inline(always)]
118 fn encode_is_copy() -> bool {
119 true
120 }
121
122 #[inline(always)]
123 fn decode_is_copy() -> bool {
124 false
125 }
126 }
127
128 impl fidl::encoding::ValueTypeMarker for Error {
129 type Borrowed<'a> = Self;
130 #[inline(always)]
131 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
132 *value
133 }
134 }
135
136 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
137 #[inline]
138 unsafe fn encode(
139 self,
140 encoder: &mut fidl::encoding::Encoder<'_, D>,
141 offset: usize,
142 _depth: fidl::encoding::Depth,
143 ) -> fidl::Result<()> {
144 encoder.debug_check_bounds::<Self>(offset);
145 encoder.write_num(self.into_primitive(), offset);
146 Ok(())
147 }
148 }
149
150 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
151 #[inline(always)]
152 fn new_empty() -> Self {
153 Self::InvalidInput
154 }
155
156 #[inline]
157 unsafe fn decode(
158 &mut self,
159 decoder: &mut fidl::encoding::Decoder<'_, D>,
160 offset: usize,
161 _depth: fidl::encoding::Depth,
162 ) -> fidl::Result<()> {
163 decoder.debug_check_bounds::<Self>(offset);
164 let prim = decoder.read_num::<u32>(offset);
165
166 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
167 Ok(())
168 }
169 }
170
171 impl fidl::encoding::ValueTypeMarker for CalibratorCalibrateRequest {
172 type Borrowed<'a> = &'a Self;
173 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
174 value
175 }
176 }
177
178 unsafe impl fidl::encoding::TypeMarker for CalibratorCalibrateRequest {
179 type Owned = Self;
180
181 #[inline(always)]
182 fn inline_align(_context: fidl::encoding::Context) -> usize {
183 4
184 }
185
186 #[inline(always)]
187 fn inline_size(_context: fidl::encoding::Context) -> usize {
188 16
189 }
190 }
191
192 unsafe impl<D: fidl::encoding::ResourceDialect>
193 fidl::encoding::Encode<CalibratorCalibrateRequest, D> for &CalibratorCalibrateRequest
194 {
195 #[inline]
196 unsafe fn encode(
197 self,
198 encoder: &mut fidl::encoding::Encoder<'_, D>,
199 offset: usize,
200 _depth: fidl::encoding::Depth,
201 ) -> fidl::Result<()> {
202 encoder.debug_check_bounds::<CalibratorCalibrateRequest>(offset);
203 fidl::encoding::Encode::<CalibratorCalibrateRequest, D>::encode(
205 (<Rgbc as fidl::encoding::ValueTypeMarker>::borrow(&self.data),),
206 encoder,
207 offset,
208 _depth,
209 )
210 }
211 }
212 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Rgbc, D>>
213 fidl::encoding::Encode<CalibratorCalibrateRequest, D> for (T0,)
214 {
215 #[inline]
216 unsafe fn encode(
217 self,
218 encoder: &mut fidl::encoding::Encoder<'_, D>,
219 offset: usize,
220 depth: fidl::encoding::Depth,
221 ) -> fidl::Result<()> {
222 encoder.debug_check_bounds::<CalibratorCalibrateRequest>(offset);
223 self.0.encode(encoder, offset + 0, depth)?;
227 Ok(())
228 }
229 }
230
231 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
232 for CalibratorCalibrateRequest
233 {
234 #[inline(always)]
235 fn new_empty() -> Self {
236 Self { data: fidl::new_empty!(Rgbc, D) }
237 }
238
239 #[inline]
240 unsafe fn decode(
241 &mut self,
242 decoder: &mut fidl::encoding::Decoder<'_, D>,
243 offset: usize,
244 _depth: fidl::encoding::Depth,
245 ) -> fidl::Result<()> {
246 decoder.debug_check_bounds::<Self>(offset);
247 fidl::decode!(Rgbc, D, &mut self.data, decoder, offset + 0, _depth)?;
249 Ok(())
250 }
251 }
252
253 impl fidl::encoding::ValueTypeMarker for CalibratorCalibrateResponse {
254 type Borrowed<'a> = &'a Self;
255 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
256 value
257 }
258 }
259
260 unsafe impl fidl::encoding::TypeMarker for CalibratorCalibrateResponse {
261 type Owned = Self;
262
263 #[inline(always)]
264 fn inline_align(_context: fidl::encoding::Context) -> usize {
265 4
266 }
267
268 #[inline(always)]
269 fn inline_size(_context: fidl::encoding::Context) -> usize {
270 16
271 }
272 }
273
274 unsafe impl<D: fidl::encoding::ResourceDialect>
275 fidl::encoding::Encode<CalibratorCalibrateResponse, D> for &CalibratorCalibrateResponse
276 {
277 #[inline]
278 unsafe fn encode(
279 self,
280 encoder: &mut fidl::encoding::Encoder<'_, D>,
281 offset: usize,
282 _depth: fidl::encoding::Depth,
283 ) -> fidl::Result<()> {
284 encoder.debug_check_bounds::<CalibratorCalibrateResponse>(offset);
285 fidl::encoding::Encode::<CalibratorCalibrateResponse, D>::encode(
287 (<Rgbc as fidl::encoding::ValueTypeMarker>::borrow(&self.data),),
288 encoder,
289 offset,
290 _depth,
291 )
292 }
293 }
294 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Rgbc, D>>
295 fidl::encoding::Encode<CalibratorCalibrateResponse, D> for (T0,)
296 {
297 #[inline]
298 unsafe fn encode(
299 self,
300 encoder: &mut fidl::encoding::Encoder<'_, D>,
301 offset: usize,
302 depth: fidl::encoding::Depth,
303 ) -> fidl::Result<()> {
304 encoder.debug_check_bounds::<CalibratorCalibrateResponse>(offset);
305 self.0.encode(encoder, offset + 0, depth)?;
309 Ok(())
310 }
311 }
312
313 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
314 for CalibratorCalibrateResponse
315 {
316 #[inline(always)]
317 fn new_empty() -> Self {
318 Self { data: fidl::new_empty!(Rgbc, D) }
319 }
320
321 #[inline]
322 unsafe fn decode(
323 &mut self,
324 decoder: &mut fidl::encoding::Decoder<'_, D>,
325 offset: usize,
326 _depth: fidl::encoding::Depth,
327 ) -> fidl::Result<()> {
328 decoder.debug_check_bounds::<Self>(offset);
329 fidl::decode!(Rgbc, D, &mut self.data, decoder, offset + 0, _depth)?;
331 Ok(())
332 }
333 }
334
335 impl fidl::encoding::ValueTypeMarker for Rgbc {
336 type Borrowed<'a> = &'a Self;
337 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
338 value
339 }
340 }
341
342 unsafe impl fidl::encoding::TypeMarker for Rgbc {
343 type Owned = Self;
344
345 #[inline(always)]
346 fn inline_align(_context: fidl::encoding::Context) -> usize {
347 4
348 }
349
350 #[inline(always)]
351 fn inline_size(_context: fidl::encoding::Context) -> usize {
352 16
353 }
354 }
355
356 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Rgbc, D> for &Rgbc {
357 #[inline]
358 unsafe fn encode(
359 self,
360 encoder: &mut fidl::encoding::Encoder<'_, D>,
361 offset: usize,
362 _depth: fidl::encoding::Depth,
363 ) -> fidl::Result<()> {
364 encoder.debug_check_bounds::<Rgbc>(offset);
365 fidl::encoding::Encode::<Rgbc, D>::encode(
367 (
368 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.red_intensity),
369 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.green_intensity),
370 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.blue_intensity),
371 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.clear_intensity),
372 ),
373 encoder,
374 offset,
375 _depth,
376 )
377 }
378 }
379 unsafe impl<
380 D: fidl::encoding::ResourceDialect,
381 T0: fidl::encoding::Encode<f32, D>,
382 T1: fidl::encoding::Encode<f32, D>,
383 T2: fidl::encoding::Encode<f32, D>,
384 T3: fidl::encoding::Encode<f32, D>,
385 > fidl::encoding::Encode<Rgbc, D> for (T0, T1, T2, T3)
386 {
387 #[inline]
388 unsafe fn encode(
389 self,
390 encoder: &mut fidl::encoding::Encoder<'_, D>,
391 offset: usize,
392 depth: fidl::encoding::Depth,
393 ) -> fidl::Result<()> {
394 encoder.debug_check_bounds::<Rgbc>(offset);
395 self.0.encode(encoder, offset + 0, depth)?;
399 self.1.encode(encoder, offset + 4, depth)?;
400 self.2.encode(encoder, offset + 8, depth)?;
401 self.3.encode(encoder, offset + 12, depth)?;
402 Ok(())
403 }
404 }
405
406 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Rgbc {
407 #[inline(always)]
408 fn new_empty() -> Self {
409 Self {
410 red_intensity: fidl::new_empty!(f32, D),
411 green_intensity: fidl::new_empty!(f32, D),
412 blue_intensity: fidl::new_empty!(f32, D),
413 clear_intensity: fidl::new_empty!(f32, D),
414 }
415 }
416
417 #[inline]
418 unsafe fn decode(
419 &mut self,
420 decoder: &mut fidl::encoding::Decoder<'_, D>,
421 offset: usize,
422 _depth: fidl::encoding::Depth,
423 ) -> fidl::Result<()> {
424 decoder.debug_check_bounds::<Self>(offset);
425 fidl::decode!(f32, D, &mut self.red_intensity, decoder, offset + 0, _depth)?;
427 fidl::decode!(f32, D, &mut self.green_intensity, decoder, offset + 4, _depth)?;
428 fidl::decode!(f32, D, &mut self.blue_intensity, decoder, offset + 8, _depth)?;
429 fidl::decode!(f32, D, &mut self.clear_intensity, decoder, offset + 12, _depth)?;
430 Ok(())
431 }
432 }
433
434 impl fidl::encoding::ValueTypeMarker for SensorWatchResponse {
435 type Borrowed<'a> = &'a Self;
436 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
437 value
438 }
439 }
440
441 unsafe impl fidl::encoding::TypeMarker for SensorWatchResponse {
442 type Owned = Self;
443
444 #[inline(always)]
445 fn inline_align(_context: fidl::encoding::Context) -> usize {
446 8
447 }
448
449 #[inline(always)]
450 fn inline_size(_context: fidl::encoding::Context) -> usize {
451 16
452 }
453 }
454
455 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorWatchResponse, D>
456 for &SensorWatchResponse
457 {
458 #[inline]
459 unsafe fn encode(
460 self,
461 encoder: &mut fidl::encoding::Encoder<'_, D>,
462 offset: usize,
463 _depth: fidl::encoding::Depth,
464 ) -> fidl::Result<()> {
465 encoder.debug_check_bounds::<SensorWatchResponse>(offset);
466 fidl::encoding::Encode::<SensorWatchResponse, D>::encode(
468 (<LightSensorData as fidl::encoding::ValueTypeMarker>::borrow(&self.data),),
469 encoder,
470 offset,
471 _depth,
472 )
473 }
474 }
475 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<LightSensorData, D>>
476 fidl::encoding::Encode<SensorWatchResponse, D> for (T0,)
477 {
478 #[inline]
479 unsafe fn encode(
480 self,
481 encoder: &mut fidl::encoding::Encoder<'_, D>,
482 offset: usize,
483 depth: fidl::encoding::Depth,
484 ) -> fidl::Result<()> {
485 encoder.debug_check_bounds::<SensorWatchResponse>(offset);
486 self.0.encode(encoder, offset + 0, depth)?;
490 Ok(())
491 }
492 }
493
494 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorWatchResponse {
495 #[inline(always)]
496 fn new_empty() -> Self {
497 Self { data: fidl::new_empty!(LightSensorData, D) }
498 }
499
500 #[inline]
501 unsafe fn decode(
502 &mut self,
503 decoder: &mut fidl::encoding::Decoder<'_, D>,
504 offset: usize,
505 _depth: fidl::encoding::Depth,
506 ) -> fidl::Result<()> {
507 decoder.debug_check_bounds::<Self>(offset);
508 fidl::decode!(LightSensorData, D, &mut self.data, decoder, offset + 0, _depth)?;
510 Ok(())
511 }
512 }
513
514 impl LightSensorData {
515 #[inline(always)]
516 fn max_ordinal_present(&self) -> u64 {
517 if let Some(_) = self.is_calibrated {
518 return 5;
519 }
520 if let Some(_) = self.si_rgbc {
521 return 4;
522 }
523 if let Some(_) = self.correlated_color_temperature {
524 return 3;
525 }
526 if let Some(_) = self.calculated_lux {
527 return 2;
528 }
529 if let Some(_) = self.rgbc {
530 return 1;
531 }
532 0
533 }
534 }
535
536 impl fidl::encoding::ValueTypeMarker for LightSensorData {
537 type Borrowed<'a> = &'a Self;
538 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
539 value
540 }
541 }
542
543 unsafe impl fidl::encoding::TypeMarker for LightSensorData {
544 type Owned = Self;
545
546 #[inline(always)]
547 fn inline_align(_context: fidl::encoding::Context) -> usize {
548 8
549 }
550
551 #[inline(always)]
552 fn inline_size(_context: fidl::encoding::Context) -> usize {
553 16
554 }
555 }
556
557 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LightSensorData, D>
558 for &LightSensorData
559 {
560 unsafe fn encode(
561 self,
562 encoder: &mut fidl::encoding::Encoder<'_, D>,
563 offset: usize,
564 mut depth: fidl::encoding::Depth,
565 ) -> fidl::Result<()> {
566 encoder.debug_check_bounds::<LightSensorData>(offset);
567 let max_ordinal: u64 = self.max_ordinal_present();
569 encoder.write_num(max_ordinal, offset);
570 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
571 if max_ordinal == 0 {
573 return Ok(());
574 }
575 depth.increment()?;
576 let envelope_size = 8;
577 let bytes_len = max_ordinal as usize * envelope_size;
578 #[allow(unused_variables)]
579 let offset = encoder.out_of_line_offset(bytes_len);
580 let mut _prev_end_offset: usize = 0;
581 if 1 > max_ordinal {
582 return Ok(());
583 }
584
585 let cur_offset: usize = (1 - 1) * envelope_size;
588
589 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
591
592 fidl::encoding::encode_in_envelope_optional::<Rgbc, D>(
597 self.rgbc.as_ref().map(<Rgbc as fidl::encoding::ValueTypeMarker>::borrow),
598 encoder,
599 offset + cur_offset,
600 depth,
601 )?;
602
603 _prev_end_offset = cur_offset + envelope_size;
604 if 2 > max_ordinal {
605 return Ok(());
606 }
607
608 let cur_offset: usize = (2 - 1) * envelope_size;
611
612 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
614
615 fidl::encoding::encode_in_envelope_optional::<f32, D>(
620 self.calculated_lux.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
621 encoder,
622 offset + cur_offset,
623 depth,
624 )?;
625
626 _prev_end_offset = cur_offset + envelope_size;
627 if 3 > max_ordinal {
628 return Ok(());
629 }
630
631 let cur_offset: usize = (3 - 1) * envelope_size;
634
635 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
637
638 fidl::encoding::encode_in_envelope_optional::<f32, D>(
643 self.correlated_color_temperature
644 .as_ref()
645 .map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
646 encoder,
647 offset + cur_offset,
648 depth,
649 )?;
650
651 _prev_end_offset = cur_offset + envelope_size;
652 if 4 > max_ordinal {
653 return Ok(());
654 }
655
656 let cur_offset: usize = (4 - 1) * envelope_size;
659
660 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
662
663 fidl::encoding::encode_in_envelope_optional::<Rgbc, D>(
668 self.si_rgbc.as_ref().map(<Rgbc as fidl::encoding::ValueTypeMarker>::borrow),
669 encoder,
670 offset + cur_offset,
671 depth,
672 )?;
673
674 _prev_end_offset = cur_offset + envelope_size;
675 if 5 > max_ordinal {
676 return Ok(());
677 }
678
679 let cur_offset: usize = (5 - 1) * envelope_size;
682
683 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
685
686 fidl::encoding::encode_in_envelope_optional::<bool, D>(
691 self.is_calibrated.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
692 encoder,
693 offset + cur_offset,
694 depth,
695 )?;
696
697 _prev_end_offset = cur_offset + envelope_size;
698
699 Ok(())
700 }
701 }
702
703 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LightSensorData {
704 #[inline(always)]
705 fn new_empty() -> Self {
706 Self::default()
707 }
708
709 unsafe fn decode(
710 &mut self,
711 decoder: &mut fidl::encoding::Decoder<'_, D>,
712 offset: usize,
713 mut depth: fidl::encoding::Depth,
714 ) -> fidl::Result<()> {
715 decoder.debug_check_bounds::<Self>(offset);
716 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
717 None => return Err(fidl::Error::NotNullable),
718 Some(len) => len,
719 };
720 if len == 0 {
722 return Ok(());
723 };
724 depth.increment()?;
725 let envelope_size = 8;
726 let bytes_len = len * envelope_size;
727 let offset = decoder.out_of_line_offset(bytes_len)?;
728 let mut _next_ordinal_to_read = 0;
730 let mut next_offset = offset;
731 let end_offset = offset + bytes_len;
732 _next_ordinal_to_read += 1;
733 if next_offset >= end_offset {
734 return Ok(());
735 }
736
737 while _next_ordinal_to_read < 1 {
739 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
740 _next_ordinal_to_read += 1;
741 next_offset += envelope_size;
742 }
743
744 let next_out_of_line = decoder.next_out_of_line();
745 let handles_before = decoder.remaining_handles();
746 if let Some((inlined, num_bytes, num_handles)) =
747 fidl::encoding::decode_envelope_header(decoder, next_offset)?
748 {
749 let member_inline_size =
750 <Rgbc as fidl::encoding::TypeMarker>::inline_size(decoder.context);
751 if inlined != (member_inline_size <= 4) {
752 return Err(fidl::Error::InvalidInlineBitInEnvelope);
753 }
754 let inner_offset;
755 let mut inner_depth = depth.clone();
756 if inlined {
757 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
758 inner_offset = next_offset;
759 } else {
760 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
761 inner_depth.increment()?;
762 }
763 let val_ref = self.rgbc.get_or_insert_with(|| fidl::new_empty!(Rgbc, D));
764 fidl::decode!(Rgbc, D, val_ref, decoder, inner_offset, inner_depth)?;
765 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
766 {
767 return Err(fidl::Error::InvalidNumBytesInEnvelope);
768 }
769 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
770 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
771 }
772 }
773
774 next_offset += envelope_size;
775 _next_ordinal_to_read += 1;
776 if next_offset >= end_offset {
777 return Ok(());
778 }
779
780 while _next_ordinal_to_read < 2 {
782 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
783 _next_ordinal_to_read += 1;
784 next_offset += envelope_size;
785 }
786
787 let next_out_of_line = decoder.next_out_of_line();
788 let handles_before = decoder.remaining_handles();
789 if let Some((inlined, num_bytes, num_handles)) =
790 fidl::encoding::decode_envelope_header(decoder, next_offset)?
791 {
792 let member_inline_size =
793 <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
794 if inlined != (member_inline_size <= 4) {
795 return Err(fidl::Error::InvalidInlineBitInEnvelope);
796 }
797 let inner_offset;
798 let mut inner_depth = depth.clone();
799 if inlined {
800 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
801 inner_offset = next_offset;
802 } else {
803 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
804 inner_depth.increment()?;
805 }
806 let val_ref = self.calculated_lux.get_or_insert_with(|| fidl::new_empty!(f32, D));
807 fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
808 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
809 {
810 return Err(fidl::Error::InvalidNumBytesInEnvelope);
811 }
812 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
813 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
814 }
815 }
816
817 next_offset += envelope_size;
818 _next_ordinal_to_read += 1;
819 if next_offset >= end_offset {
820 return Ok(());
821 }
822
823 while _next_ordinal_to_read < 3 {
825 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
826 _next_ordinal_to_read += 1;
827 next_offset += envelope_size;
828 }
829
830 let next_out_of_line = decoder.next_out_of_line();
831 let handles_before = decoder.remaining_handles();
832 if let Some((inlined, num_bytes, num_handles)) =
833 fidl::encoding::decode_envelope_header(decoder, next_offset)?
834 {
835 let member_inline_size =
836 <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
837 if inlined != (member_inline_size <= 4) {
838 return Err(fidl::Error::InvalidInlineBitInEnvelope);
839 }
840 let inner_offset;
841 let mut inner_depth = depth.clone();
842 if inlined {
843 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
844 inner_offset = next_offset;
845 } else {
846 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
847 inner_depth.increment()?;
848 }
849 let val_ref = self
850 .correlated_color_temperature
851 .get_or_insert_with(|| fidl::new_empty!(f32, D));
852 fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
853 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
854 {
855 return Err(fidl::Error::InvalidNumBytesInEnvelope);
856 }
857 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
858 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
859 }
860 }
861
862 next_offset += envelope_size;
863 _next_ordinal_to_read += 1;
864 if next_offset >= end_offset {
865 return Ok(());
866 }
867
868 while _next_ordinal_to_read < 4 {
870 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
871 _next_ordinal_to_read += 1;
872 next_offset += envelope_size;
873 }
874
875 let next_out_of_line = decoder.next_out_of_line();
876 let handles_before = decoder.remaining_handles();
877 if let Some((inlined, num_bytes, num_handles)) =
878 fidl::encoding::decode_envelope_header(decoder, next_offset)?
879 {
880 let member_inline_size =
881 <Rgbc as fidl::encoding::TypeMarker>::inline_size(decoder.context);
882 if inlined != (member_inline_size <= 4) {
883 return Err(fidl::Error::InvalidInlineBitInEnvelope);
884 }
885 let inner_offset;
886 let mut inner_depth = depth.clone();
887 if inlined {
888 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
889 inner_offset = next_offset;
890 } else {
891 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
892 inner_depth.increment()?;
893 }
894 let val_ref = self.si_rgbc.get_or_insert_with(|| fidl::new_empty!(Rgbc, D));
895 fidl::decode!(Rgbc, D, val_ref, decoder, inner_offset, inner_depth)?;
896 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
897 {
898 return Err(fidl::Error::InvalidNumBytesInEnvelope);
899 }
900 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
901 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
902 }
903 }
904
905 next_offset += envelope_size;
906 _next_ordinal_to_read += 1;
907 if next_offset >= end_offset {
908 return Ok(());
909 }
910
911 while _next_ordinal_to_read < 5 {
913 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
914 _next_ordinal_to_read += 1;
915 next_offset += envelope_size;
916 }
917
918 let next_out_of_line = decoder.next_out_of_line();
919 let handles_before = decoder.remaining_handles();
920 if let Some((inlined, num_bytes, num_handles)) =
921 fidl::encoding::decode_envelope_header(decoder, next_offset)?
922 {
923 let member_inline_size =
924 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
925 if inlined != (member_inline_size <= 4) {
926 return Err(fidl::Error::InvalidInlineBitInEnvelope);
927 }
928 let inner_offset;
929 let mut inner_depth = depth.clone();
930 if inlined {
931 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
932 inner_offset = next_offset;
933 } else {
934 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
935 inner_depth.increment()?;
936 }
937 let val_ref = self.is_calibrated.get_or_insert_with(|| fidl::new_empty!(bool, D));
938 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
939 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
940 {
941 return Err(fidl::Error::InvalidNumBytesInEnvelope);
942 }
943 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
944 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
945 }
946 }
947
948 next_offset += envelope_size;
949
950 while next_offset < end_offset {
952 _next_ordinal_to_read += 1;
953 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
954 next_offset += envelope_size;
955 }
956
957 Ok(())
958 }
959 }
960}