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)]
13pub enum ActivateSensorError {
14 InvalidSensorId,
16 #[doc(hidden)]
17 __SourceBreaking { unknown_ordinal: u32 },
18}
19
20#[macro_export]
22macro_rules! ActivateSensorErrorUnknown {
23 () => {
24 _
25 };
26}
27
28impl ActivateSensorError {
29 #[inline]
30 pub fn from_primitive(prim: u32) -> Option<Self> {
31 match prim {
32 1 => Some(Self::InvalidSensorId),
33 _ => None,
34 }
35 }
36
37 #[inline]
38 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
39 match prim {
40 1 => Self::InvalidSensorId,
41 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
42 }
43 }
44
45 #[inline]
46 pub fn unknown() -> Self {
47 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
48 }
49
50 #[inline]
51 pub const fn into_primitive(self) -> u32 {
52 match self {
53 Self::InvalidSensorId => 1,
54 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
55 }
56 }
57
58 #[inline]
59 pub fn is_unknown(&self) -> bool {
60 match self {
61 Self::__SourceBreaking { unknown_ordinal: _ } => true,
62 _ => false,
63 }
64 }
65}
66
67#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
69pub enum ConfigurePlaybackError {
70 InvalidConfigType,
72 ConfigMissingFields,
74 DuplicateSensorInfo,
76 NoEventsForSensor,
78 EventFromUnknownSensor,
81 EventSensorTypeMismatch,
84 EventPayloadTypeMismatch,
87 FileOpenFailed,
89 FileParseError,
97 #[doc(hidden)]
98 __SourceBreaking { unknown_ordinal: u32 },
99}
100
101#[macro_export]
103macro_rules! ConfigurePlaybackErrorUnknown {
104 () => {
105 _
106 };
107}
108
109impl ConfigurePlaybackError {
110 #[inline]
111 pub fn from_primitive(prim: u32) -> Option<Self> {
112 match prim {
113 1 => Some(Self::InvalidConfigType),
114 2 => Some(Self::ConfigMissingFields),
115 3 => Some(Self::DuplicateSensorInfo),
116 4 => Some(Self::NoEventsForSensor),
117 5 => Some(Self::EventFromUnknownSensor),
118 6 => Some(Self::EventSensorTypeMismatch),
119 7 => Some(Self::EventPayloadTypeMismatch),
120 8 => Some(Self::FileOpenFailed),
121 9 => Some(Self::FileParseError),
122 _ => None,
123 }
124 }
125
126 #[inline]
127 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
128 match prim {
129 1 => Self::InvalidConfigType,
130 2 => Self::ConfigMissingFields,
131 3 => Self::DuplicateSensorInfo,
132 4 => Self::NoEventsForSensor,
133 5 => Self::EventFromUnknownSensor,
134 6 => Self::EventSensorTypeMismatch,
135 7 => Self::EventPayloadTypeMismatch,
136 8 => Self::FileOpenFailed,
137 9 => Self::FileParseError,
138 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
139 }
140 }
141
142 #[inline]
143 pub fn unknown() -> Self {
144 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
145 }
146
147 #[inline]
148 pub const fn into_primitive(self) -> u32 {
149 match self {
150 Self::InvalidConfigType => 1,
151 Self::ConfigMissingFields => 2,
152 Self::DuplicateSensorInfo => 3,
153 Self::NoEventsForSensor => 4,
154 Self::EventFromUnknownSensor => 5,
155 Self::EventSensorTypeMismatch => 6,
156 Self::EventPayloadTypeMismatch => 7,
157 Self::FileOpenFailed => 8,
158 Self::FileParseError => 9,
159 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
160 }
161 }
162
163 #[inline]
164 pub fn is_unknown(&self) -> bool {
165 match self {
166 Self::__SourceBreaking { unknown_ordinal: _ } => true,
167 _ => false,
168 }
169 }
170}
171
172#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
174pub enum ConfigureSensorRateError {
175 InvalidSensorId,
177 InvalidConfig,
180 #[doc(hidden)]
181 __SourceBreaking { unknown_ordinal: u32 },
182}
183
184#[macro_export]
186macro_rules! ConfigureSensorRateErrorUnknown {
187 () => {
188 _
189 };
190}
191
192impl ConfigureSensorRateError {
193 #[inline]
194 pub fn from_primitive(prim: u32) -> Option<Self> {
195 match prim {
196 1 => Some(Self::InvalidSensorId),
197 2 => Some(Self::InvalidConfig),
198 _ => None,
199 }
200 }
201
202 #[inline]
203 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
204 match prim {
205 1 => Self::InvalidSensorId,
206 2 => Self::InvalidConfig,
207 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
208 }
209 }
210
211 #[inline]
212 pub fn unknown() -> Self {
213 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
214 }
215
216 #[inline]
217 pub const fn into_primitive(self) -> u32 {
218 match self {
219 Self::InvalidSensorId => 1,
220 Self::InvalidConfig => 2,
221 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
222 }
223 }
224
225 #[inline]
226 pub fn is_unknown(&self) -> bool {
227 match self {
228 Self::__SourceBreaking { unknown_ordinal: _ } => true,
229 _ => false,
230 }
231 }
232}
233
234#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
236pub enum DeactivateSensorError {
237 InvalidSensorId,
239 #[doc(hidden)]
240 __SourceBreaking { unknown_ordinal: u32 },
241}
242
243#[macro_export]
245macro_rules! DeactivateSensorErrorUnknown {
246 () => {
247 _
248 };
249}
250
251impl DeactivateSensorError {
252 #[inline]
253 pub fn from_primitive(prim: u32) -> Option<Self> {
254 match prim {
255 1 => Some(Self::InvalidSensorId),
256 _ => None,
257 }
258 }
259
260 #[inline]
261 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
262 match prim {
263 1 => Self::InvalidSensorId,
264 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
265 }
266 }
267
268 #[inline]
269 pub fn unknown() -> Self {
270 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
271 }
272
273 #[inline]
274 pub const fn into_primitive(self) -> u32 {
275 match self {
276 Self::InvalidSensorId => 1,
277 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
278 }
279 }
280
281 #[inline]
282 pub fn is_unknown(&self) -> bool {
283 match self {
284 Self::__SourceBreaking { unknown_ordinal: _ } => true,
285 _ => false,
286 }
287 }
288}
289
290#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
291#[repr(C)]
292pub struct DriverActivateSensorRequest {
293 pub sensor_id: i32,
294}
295
296impl fidl::Persistable for DriverActivateSensorRequest {}
297
298#[derive(Clone, Debug, PartialEq)]
299pub struct DriverConfigureSensorRateRequest {
300 pub sensor_id: i32,
301 pub sensor_rate_config: fidl_fuchsia_sensors_types__common::SensorRateConfig,
302}
303
304impl fidl::Persistable for DriverConfigureSensorRateRequest {}
305
306#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
307#[repr(C)]
308pub struct DriverDeactivateSensorRequest {
309 pub sensor_id: i32,
310}
311
312impl fidl::Persistable for DriverDeactivateSensorRequest {}
313
314#[derive(Clone, Debug, PartialEq)]
315pub struct DriverOnSensorEventRequest {
316 pub event: fidl_fuchsia_sensors_types__common::SensorEvent,
317}
318
319impl fidl::Persistable for DriverOnSensorEventRequest {}
320
321#[derive(Clone, Debug, PartialEq)]
322pub struct DriverGetSensorsListResponse {
323 pub sensor_list: Vec<fidl_fuchsia_sensors_types__common::SensorInfo>,
324}
325
326impl fidl::Persistable for DriverGetSensorsListResponse {}
327
328#[derive(Clone, Debug, PartialEq)]
329pub struct PlaybackConfigurePlaybackRequest {
330 pub source_config: PlaybackSourceConfig,
331}
332
333impl fidl::Persistable for PlaybackConfigurePlaybackRequest {}
334
335#[derive(Clone, Debug, Default, PartialEq)]
338pub struct FilePlaybackConfig {
339 pub file_path: Option<String>,
341 #[doc(hidden)]
342 pub __source_breaking: fidl::marker::SourceBreaking,
343}
344
345impl fidl::Persistable for FilePlaybackConfig {}
346
347#[derive(Clone, Debug, Default, PartialEq)]
358pub struct FixedValuesPlaybackConfig {
359 pub sensor_list: Option<Vec<fidl_fuchsia_sensors_types__common::SensorInfo>>,
363 pub sensor_events: Option<Vec<fidl_fuchsia_sensors_types__common::SensorEvent>>,
367 #[doc(hidden)]
368 pub __source_breaking: fidl::marker::SourceBreaking,
369}
370
371impl fidl::Persistable for FixedValuesPlaybackConfig {}
372
373#[derive(Clone, Debug)]
376pub enum PlaybackSourceConfig {
377 FixedValuesConfig(FixedValuesPlaybackConfig),
379 FilePlaybackConfig(FilePlaybackConfig),
381 #[doc(hidden)]
382 __SourceBreaking { unknown_ordinal: u64 },
383}
384
385#[macro_export]
387macro_rules! PlaybackSourceConfigUnknown {
388 () => {
389 _
390 };
391}
392
393impl PartialEq for PlaybackSourceConfig {
395 fn eq(&self, other: &Self) -> bool {
396 match (self, other) {
397 (Self::FixedValuesConfig(x), Self::FixedValuesConfig(y)) => *x == *y,
398 (Self::FilePlaybackConfig(x), Self::FilePlaybackConfig(y)) => *x == *y,
399 _ => false,
400 }
401 }
402}
403
404impl PlaybackSourceConfig {
405 #[inline]
406 pub fn ordinal(&self) -> u64 {
407 match *self {
408 Self::FixedValuesConfig(_) => 1,
409 Self::FilePlaybackConfig(_) => 2,
410 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
411 }
412 }
413
414 #[inline]
415 pub fn unknown_variant_for_testing() -> Self {
416 Self::__SourceBreaking { unknown_ordinal: 0 }
417 }
418
419 #[inline]
420 pub fn is_unknown(&self) -> bool {
421 match self {
422 Self::__SourceBreaking { .. } => true,
423 _ => false,
424 }
425 }
426}
427
428impl fidl::Persistable for PlaybackSourceConfig {}
429
430mod internal {
431 use super::*;
432 unsafe impl fidl::encoding::TypeMarker for ActivateSensorError {
433 type Owned = Self;
434
435 #[inline(always)]
436 fn inline_align(_context: fidl::encoding::Context) -> usize {
437 std::mem::align_of::<u32>()
438 }
439
440 #[inline(always)]
441 fn inline_size(_context: fidl::encoding::Context) -> usize {
442 std::mem::size_of::<u32>()
443 }
444
445 #[inline(always)]
446 fn encode_is_copy() -> bool {
447 false
448 }
449
450 #[inline(always)]
451 fn decode_is_copy() -> bool {
452 false
453 }
454 }
455
456 impl fidl::encoding::ValueTypeMarker for ActivateSensorError {
457 type Borrowed<'a> = Self;
458 #[inline(always)]
459 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
460 *value
461 }
462 }
463
464 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
465 for ActivateSensorError
466 {
467 #[inline]
468 unsafe fn encode(
469 self,
470 encoder: &mut fidl::encoding::Encoder<'_, D>,
471 offset: usize,
472 _depth: fidl::encoding::Depth,
473 ) -> fidl::Result<()> {
474 encoder.debug_check_bounds::<Self>(offset);
475 encoder.write_num(self.into_primitive(), offset);
476 Ok(())
477 }
478 }
479
480 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ActivateSensorError {
481 #[inline(always)]
482 fn new_empty() -> Self {
483 Self::unknown()
484 }
485
486 #[inline]
487 unsafe fn decode(
488 &mut self,
489 decoder: &mut fidl::encoding::Decoder<'_, D>,
490 offset: usize,
491 _depth: fidl::encoding::Depth,
492 ) -> fidl::Result<()> {
493 decoder.debug_check_bounds::<Self>(offset);
494 let prim = decoder.read_num::<u32>(offset);
495
496 *self = Self::from_primitive_allow_unknown(prim);
497 Ok(())
498 }
499 }
500 unsafe impl fidl::encoding::TypeMarker for ConfigurePlaybackError {
501 type Owned = Self;
502
503 #[inline(always)]
504 fn inline_align(_context: fidl::encoding::Context) -> usize {
505 std::mem::align_of::<u32>()
506 }
507
508 #[inline(always)]
509 fn inline_size(_context: fidl::encoding::Context) -> usize {
510 std::mem::size_of::<u32>()
511 }
512
513 #[inline(always)]
514 fn encode_is_copy() -> bool {
515 false
516 }
517
518 #[inline(always)]
519 fn decode_is_copy() -> bool {
520 false
521 }
522 }
523
524 impl fidl::encoding::ValueTypeMarker for ConfigurePlaybackError {
525 type Borrowed<'a> = Self;
526 #[inline(always)]
527 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
528 *value
529 }
530 }
531
532 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
533 for ConfigurePlaybackError
534 {
535 #[inline]
536 unsafe fn encode(
537 self,
538 encoder: &mut fidl::encoding::Encoder<'_, D>,
539 offset: usize,
540 _depth: fidl::encoding::Depth,
541 ) -> fidl::Result<()> {
542 encoder.debug_check_bounds::<Self>(offset);
543 encoder.write_num(self.into_primitive(), offset);
544 Ok(())
545 }
546 }
547
548 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
549 for ConfigurePlaybackError
550 {
551 #[inline(always)]
552 fn new_empty() -> Self {
553 Self::unknown()
554 }
555
556 #[inline]
557 unsafe fn decode(
558 &mut self,
559 decoder: &mut fidl::encoding::Decoder<'_, D>,
560 offset: usize,
561 _depth: fidl::encoding::Depth,
562 ) -> fidl::Result<()> {
563 decoder.debug_check_bounds::<Self>(offset);
564 let prim = decoder.read_num::<u32>(offset);
565
566 *self = Self::from_primitive_allow_unknown(prim);
567 Ok(())
568 }
569 }
570 unsafe impl fidl::encoding::TypeMarker for ConfigureSensorRateError {
571 type Owned = Self;
572
573 #[inline(always)]
574 fn inline_align(_context: fidl::encoding::Context) -> usize {
575 std::mem::align_of::<u32>()
576 }
577
578 #[inline(always)]
579 fn inline_size(_context: fidl::encoding::Context) -> usize {
580 std::mem::size_of::<u32>()
581 }
582
583 #[inline(always)]
584 fn encode_is_copy() -> bool {
585 false
586 }
587
588 #[inline(always)]
589 fn decode_is_copy() -> bool {
590 false
591 }
592 }
593
594 impl fidl::encoding::ValueTypeMarker for ConfigureSensorRateError {
595 type Borrowed<'a> = Self;
596 #[inline(always)]
597 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
598 *value
599 }
600 }
601
602 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
603 for ConfigureSensorRateError
604 {
605 #[inline]
606 unsafe fn encode(
607 self,
608 encoder: &mut fidl::encoding::Encoder<'_, D>,
609 offset: usize,
610 _depth: fidl::encoding::Depth,
611 ) -> fidl::Result<()> {
612 encoder.debug_check_bounds::<Self>(offset);
613 encoder.write_num(self.into_primitive(), offset);
614 Ok(())
615 }
616 }
617
618 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
619 for ConfigureSensorRateError
620 {
621 #[inline(always)]
622 fn new_empty() -> Self {
623 Self::unknown()
624 }
625
626 #[inline]
627 unsafe fn decode(
628 &mut self,
629 decoder: &mut fidl::encoding::Decoder<'_, D>,
630 offset: usize,
631 _depth: fidl::encoding::Depth,
632 ) -> fidl::Result<()> {
633 decoder.debug_check_bounds::<Self>(offset);
634 let prim = decoder.read_num::<u32>(offset);
635
636 *self = Self::from_primitive_allow_unknown(prim);
637 Ok(())
638 }
639 }
640 unsafe impl fidl::encoding::TypeMarker for DeactivateSensorError {
641 type Owned = Self;
642
643 #[inline(always)]
644 fn inline_align(_context: fidl::encoding::Context) -> usize {
645 std::mem::align_of::<u32>()
646 }
647
648 #[inline(always)]
649 fn inline_size(_context: fidl::encoding::Context) -> usize {
650 std::mem::size_of::<u32>()
651 }
652
653 #[inline(always)]
654 fn encode_is_copy() -> bool {
655 false
656 }
657
658 #[inline(always)]
659 fn decode_is_copy() -> bool {
660 false
661 }
662 }
663
664 impl fidl::encoding::ValueTypeMarker for DeactivateSensorError {
665 type Borrowed<'a> = Self;
666 #[inline(always)]
667 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
668 *value
669 }
670 }
671
672 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
673 for DeactivateSensorError
674 {
675 #[inline]
676 unsafe fn encode(
677 self,
678 encoder: &mut fidl::encoding::Encoder<'_, D>,
679 offset: usize,
680 _depth: fidl::encoding::Depth,
681 ) -> fidl::Result<()> {
682 encoder.debug_check_bounds::<Self>(offset);
683 encoder.write_num(self.into_primitive(), offset);
684 Ok(())
685 }
686 }
687
688 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeactivateSensorError {
689 #[inline(always)]
690 fn new_empty() -> Self {
691 Self::unknown()
692 }
693
694 #[inline]
695 unsafe fn decode(
696 &mut self,
697 decoder: &mut fidl::encoding::Decoder<'_, D>,
698 offset: usize,
699 _depth: fidl::encoding::Depth,
700 ) -> fidl::Result<()> {
701 decoder.debug_check_bounds::<Self>(offset);
702 let prim = decoder.read_num::<u32>(offset);
703
704 *self = Self::from_primitive_allow_unknown(prim);
705 Ok(())
706 }
707 }
708
709 impl fidl::encoding::ValueTypeMarker for DriverActivateSensorRequest {
710 type Borrowed<'a> = &'a Self;
711 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
712 value
713 }
714 }
715
716 unsafe impl fidl::encoding::TypeMarker for DriverActivateSensorRequest {
717 type Owned = Self;
718
719 #[inline(always)]
720 fn inline_align(_context: fidl::encoding::Context) -> usize {
721 4
722 }
723
724 #[inline(always)]
725 fn inline_size(_context: fidl::encoding::Context) -> usize {
726 4
727 }
728 #[inline(always)]
729 fn encode_is_copy() -> bool {
730 true
731 }
732
733 #[inline(always)]
734 fn decode_is_copy() -> bool {
735 true
736 }
737 }
738
739 unsafe impl<D: fidl::encoding::ResourceDialect>
740 fidl::encoding::Encode<DriverActivateSensorRequest, D> for &DriverActivateSensorRequest
741 {
742 #[inline]
743 unsafe fn encode(
744 self,
745 encoder: &mut fidl::encoding::Encoder<'_, D>,
746 offset: usize,
747 _depth: fidl::encoding::Depth,
748 ) -> fidl::Result<()> {
749 encoder.debug_check_bounds::<DriverActivateSensorRequest>(offset);
750 unsafe {
751 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
753 (buf_ptr as *mut DriverActivateSensorRequest)
754 .write_unaligned((self as *const DriverActivateSensorRequest).read());
755 }
758 Ok(())
759 }
760 }
761 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
762 fidl::encoding::Encode<DriverActivateSensorRequest, D> for (T0,)
763 {
764 #[inline]
765 unsafe fn encode(
766 self,
767 encoder: &mut fidl::encoding::Encoder<'_, D>,
768 offset: usize,
769 depth: fidl::encoding::Depth,
770 ) -> fidl::Result<()> {
771 encoder.debug_check_bounds::<DriverActivateSensorRequest>(offset);
772 self.0.encode(encoder, offset + 0, depth)?;
776 Ok(())
777 }
778 }
779
780 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
781 for DriverActivateSensorRequest
782 {
783 #[inline(always)]
784 fn new_empty() -> Self {
785 Self { sensor_id: fidl::new_empty!(i32, D) }
786 }
787
788 #[inline]
789 unsafe fn decode(
790 &mut self,
791 decoder: &mut fidl::encoding::Decoder<'_, D>,
792 offset: usize,
793 _depth: fidl::encoding::Depth,
794 ) -> fidl::Result<()> {
795 decoder.debug_check_bounds::<Self>(offset);
796 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
797 unsafe {
800 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
801 }
802 Ok(())
803 }
804 }
805
806 impl fidl::encoding::ValueTypeMarker for DriverConfigureSensorRateRequest {
807 type Borrowed<'a> = &'a Self;
808 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
809 value
810 }
811 }
812
813 unsafe impl fidl::encoding::TypeMarker for DriverConfigureSensorRateRequest {
814 type Owned = Self;
815
816 #[inline(always)]
817 fn inline_align(_context: fidl::encoding::Context) -> usize {
818 8
819 }
820
821 #[inline(always)]
822 fn inline_size(_context: fidl::encoding::Context) -> usize {
823 24
824 }
825 }
826
827 unsafe impl<D: fidl::encoding::ResourceDialect>
828 fidl::encoding::Encode<DriverConfigureSensorRateRequest, D>
829 for &DriverConfigureSensorRateRequest
830 {
831 #[inline]
832 unsafe fn encode(
833 self,
834 encoder: &mut fidl::encoding::Encoder<'_, D>,
835 offset: usize,
836 _depth: fidl::encoding::Depth,
837 ) -> fidl::Result<()> {
838 encoder.debug_check_bounds::<DriverConfigureSensorRateRequest>(offset);
839 fidl::encoding::Encode::<DriverConfigureSensorRateRequest, D>::encode(
841 (
842 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor_id),
843 <fidl_fuchsia_sensors_types__common::SensorRateConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor_rate_config),
844 ),
845 encoder, offset, _depth
846 )
847 }
848 }
849 unsafe impl<
850 D: fidl::encoding::ResourceDialect,
851 T0: fidl::encoding::Encode<i32, D>,
852 T1: fidl::encoding::Encode<fidl_fuchsia_sensors_types__common::SensorRateConfig, D>,
853 > fidl::encoding::Encode<DriverConfigureSensorRateRequest, D> for (T0, T1)
854 {
855 #[inline]
856 unsafe fn encode(
857 self,
858 encoder: &mut fidl::encoding::Encoder<'_, D>,
859 offset: usize,
860 depth: fidl::encoding::Depth,
861 ) -> fidl::Result<()> {
862 encoder.debug_check_bounds::<DriverConfigureSensorRateRequest>(offset);
863 unsafe {
866 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
867 (ptr as *mut u64).write_unaligned(0);
868 }
869 self.0.encode(encoder, offset + 0, depth)?;
871 self.1.encode(encoder, offset + 8, depth)?;
872 Ok(())
873 }
874 }
875
876 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
877 for DriverConfigureSensorRateRequest
878 {
879 #[inline(always)]
880 fn new_empty() -> Self {
881 Self {
882 sensor_id: fidl::new_empty!(i32, D),
883 sensor_rate_config: fidl::new_empty!(
884 fidl_fuchsia_sensors_types__common::SensorRateConfig,
885 D
886 ),
887 }
888 }
889
890 #[inline]
891 unsafe fn decode(
892 &mut self,
893 decoder: &mut fidl::encoding::Decoder<'_, D>,
894 offset: usize,
895 _depth: fidl::encoding::Depth,
896 ) -> fidl::Result<()> {
897 decoder.debug_check_bounds::<Self>(offset);
898 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
900 let padval = unsafe { (ptr as *const u64).read_unaligned() };
901 let mask = 0xffffffff00000000u64;
902 let maskedval = padval & mask;
903 if maskedval != 0 {
904 return Err(fidl::Error::NonZeroPadding {
905 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
906 });
907 }
908 fidl::decode!(i32, D, &mut self.sensor_id, decoder, offset + 0, _depth)?;
909 fidl::decode!(
910 fidl_fuchsia_sensors_types__common::SensorRateConfig,
911 D,
912 &mut self.sensor_rate_config,
913 decoder,
914 offset + 8,
915 _depth
916 )?;
917 Ok(())
918 }
919 }
920
921 impl fidl::encoding::ValueTypeMarker for DriverDeactivateSensorRequest {
922 type Borrowed<'a> = &'a Self;
923 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
924 value
925 }
926 }
927
928 unsafe impl fidl::encoding::TypeMarker for DriverDeactivateSensorRequest {
929 type Owned = Self;
930
931 #[inline(always)]
932 fn inline_align(_context: fidl::encoding::Context) -> usize {
933 4
934 }
935
936 #[inline(always)]
937 fn inline_size(_context: fidl::encoding::Context) -> usize {
938 4
939 }
940 #[inline(always)]
941 fn encode_is_copy() -> bool {
942 true
943 }
944
945 #[inline(always)]
946 fn decode_is_copy() -> bool {
947 true
948 }
949 }
950
951 unsafe impl<D: fidl::encoding::ResourceDialect>
952 fidl::encoding::Encode<DriverDeactivateSensorRequest, D>
953 for &DriverDeactivateSensorRequest
954 {
955 #[inline]
956 unsafe fn encode(
957 self,
958 encoder: &mut fidl::encoding::Encoder<'_, D>,
959 offset: usize,
960 _depth: fidl::encoding::Depth,
961 ) -> fidl::Result<()> {
962 encoder.debug_check_bounds::<DriverDeactivateSensorRequest>(offset);
963 unsafe {
964 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
966 (buf_ptr as *mut DriverDeactivateSensorRequest)
967 .write_unaligned((self as *const DriverDeactivateSensorRequest).read());
968 }
971 Ok(())
972 }
973 }
974 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
975 fidl::encoding::Encode<DriverDeactivateSensorRequest, D> for (T0,)
976 {
977 #[inline]
978 unsafe fn encode(
979 self,
980 encoder: &mut fidl::encoding::Encoder<'_, D>,
981 offset: usize,
982 depth: fidl::encoding::Depth,
983 ) -> fidl::Result<()> {
984 encoder.debug_check_bounds::<DriverDeactivateSensorRequest>(offset);
985 self.0.encode(encoder, offset + 0, depth)?;
989 Ok(())
990 }
991 }
992
993 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
994 for DriverDeactivateSensorRequest
995 {
996 #[inline(always)]
997 fn new_empty() -> Self {
998 Self { sensor_id: fidl::new_empty!(i32, D) }
999 }
1000
1001 #[inline]
1002 unsafe fn decode(
1003 &mut self,
1004 decoder: &mut fidl::encoding::Decoder<'_, D>,
1005 offset: usize,
1006 _depth: fidl::encoding::Depth,
1007 ) -> fidl::Result<()> {
1008 decoder.debug_check_bounds::<Self>(offset);
1009 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1010 unsafe {
1013 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1014 }
1015 Ok(())
1016 }
1017 }
1018
1019 impl fidl::encoding::ValueTypeMarker for DriverOnSensorEventRequest {
1020 type Borrowed<'a> = &'a Self;
1021 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1022 value
1023 }
1024 }
1025
1026 unsafe impl fidl::encoding::TypeMarker for DriverOnSensorEventRequest {
1027 type Owned = Self;
1028
1029 #[inline(always)]
1030 fn inline_align(_context: fidl::encoding::Context) -> usize {
1031 8
1032 }
1033
1034 #[inline(always)]
1035 fn inline_size(_context: fidl::encoding::Context) -> usize {
1036 40
1037 }
1038 }
1039
1040 unsafe impl<D: fidl::encoding::ResourceDialect>
1041 fidl::encoding::Encode<DriverOnSensorEventRequest, D> for &DriverOnSensorEventRequest
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::<DriverOnSensorEventRequest>(offset);
1051 fidl::encoding::Encode::<DriverOnSensorEventRequest, D>::encode(
1053 (
1054 <fidl_fuchsia_sensors_types__common::SensorEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
1055 ),
1056 encoder, offset, _depth
1057 )
1058 }
1059 }
1060 unsafe impl<
1061 D: fidl::encoding::ResourceDialect,
1062 T0: fidl::encoding::Encode<fidl_fuchsia_sensors_types__common::SensorEvent, D>,
1063 > fidl::encoding::Encode<DriverOnSensorEventRequest, D> for (T0,)
1064 {
1065 #[inline]
1066 unsafe fn encode(
1067 self,
1068 encoder: &mut fidl::encoding::Encoder<'_, D>,
1069 offset: usize,
1070 depth: fidl::encoding::Depth,
1071 ) -> fidl::Result<()> {
1072 encoder.debug_check_bounds::<DriverOnSensorEventRequest>(offset);
1073 self.0.encode(encoder, offset + 0, depth)?;
1077 Ok(())
1078 }
1079 }
1080
1081 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1082 for DriverOnSensorEventRequest
1083 {
1084 #[inline(always)]
1085 fn new_empty() -> Self {
1086 Self { event: fidl::new_empty!(fidl_fuchsia_sensors_types__common::SensorEvent, D) }
1087 }
1088
1089 #[inline]
1090 unsafe fn decode(
1091 &mut self,
1092 decoder: &mut fidl::encoding::Decoder<'_, D>,
1093 offset: usize,
1094 _depth: fidl::encoding::Depth,
1095 ) -> fidl::Result<()> {
1096 decoder.debug_check_bounds::<Self>(offset);
1097 fidl::decode!(
1099 fidl_fuchsia_sensors_types__common::SensorEvent,
1100 D,
1101 &mut self.event,
1102 decoder,
1103 offset + 0,
1104 _depth
1105 )?;
1106 Ok(())
1107 }
1108 }
1109
1110 impl fidl::encoding::ValueTypeMarker for DriverGetSensorsListResponse {
1111 type Borrowed<'a> = &'a Self;
1112 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1113 value
1114 }
1115 }
1116
1117 unsafe impl fidl::encoding::TypeMarker for DriverGetSensorsListResponse {
1118 type Owned = Self;
1119
1120 #[inline(always)]
1121 fn inline_align(_context: fidl::encoding::Context) -> usize {
1122 8
1123 }
1124
1125 #[inline(always)]
1126 fn inline_size(_context: fidl::encoding::Context) -> usize {
1127 16
1128 }
1129 }
1130
1131 unsafe impl<D: fidl::encoding::ResourceDialect>
1132 fidl::encoding::Encode<DriverGetSensorsListResponse, D> for &DriverGetSensorsListResponse
1133 {
1134 #[inline]
1135 unsafe fn encode(
1136 self,
1137 encoder: &mut fidl::encoding::Encoder<'_, D>,
1138 offset: usize,
1139 _depth: fidl::encoding::Depth,
1140 ) -> fidl::Result<()> {
1141 encoder.debug_check_bounds::<DriverGetSensorsListResponse>(offset);
1142 fidl::encoding::Encode::<DriverGetSensorsListResponse, D>::encode(
1144 (
1145 <fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types__common::SensorInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor_list),
1146 ),
1147 encoder, offset, _depth
1148 )
1149 }
1150 }
1151 unsafe impl<
1152 D: fidl::encoding::ResourceDialect,
1153 T0: fidl::encoding::Encode<
1154 fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types__common::SensorInfo>,
1155 D,
1156 >,
1157 > fidl::encoding::Encode<DriverGetSensorsListResponse, D> for (T0,)
1158 {
1159 #[inline]
1160 unsafe fn encode(
1161 self,
1162 encoder: &mut fidl::encoding::Encoder<'_, D>,
1163 offset: usize,
1164 depth: fidl::encoding::Depth,
1165 ) -> fidl::Result<()> {
1166 encoder.debug_check_bounds::<DriverGetSensorsListResponse>(offset);
1167 self.0.encode(encoder, offset + 0, depth)?;
1171 Ok(())
1172 }
1173 }
1174
1175 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1176 for DriverGetSensorsListResponse
1177 {
1178 #[inline(always)]
1179 fn new_empty() -> Self {
1180 Self {
1181 sensor_list: fidl::new_empty!(
1182 fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types__common::SensorInfo>,
1183 D
1184 ),
1185 }
1186 }
1187
1188 #[inline]
1189 unsafe fn decode(
1190 &mut self,
1191 decoder: &mut fidl::encoding::Decoder<'_, D>,
1192 offset: usize,
1193 _depth: fidl::encoding::Depth,
1194 ) -> fidl::Result<()> {
1195 decoder.debug_check_bounds::<Self>(offset);
1196 fidl::decode!(
1198 fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types__common::SensorInfo>,
1199 D,
1200 &mut self.sensor_list,
1201 decoder,
1202 offset + 0,
1203 _depth
1204 )?;
1205 Ok(())
1206 }
1207 }
1208
1209 impl fidl::encoding::ValueTypeMarker for PlaybackConfigurePlaybackRequest {
1210 type Borrowed<'a> = &'a Self;
1211 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1212 value
1213 }
1214 }
1215
1216 unsafe impl fidl::encoding::TypeMarker for PlaybackConfigurePlaybackRequest {
1217 type Owned = Self;
1218
1219 #[inline(always)]
1220 fn inline_align(_context: fidl::encoding::Context) -> usize {
1221 8
1222 }
1223
1224 #[inline(always)]
1225 fn inline_size(_context: fidl::encoding::Context) -> usize {
1226 16
1227 }
1228 }
1229
1230 unsafe impl<D: fidl::encoding::ResourceDialect>
1231 fidl::encoding::Encode<PlaybackConfigurePlaybackRequest, D>
1232 for &PlaybackConfigurePlaybackRequest
1233 {
1234 #[inline]
1235 unsafe fn encode(
1236 self,
1237 encoder: &mut fidl::encoding::Encoder<'_, D>,
1238 offset: usize,
1239 _depth: fidl::encoding::Depth,
1240 ) -> fidl::Result<()> {
1241 encoder.debug_check_bounds::<PlaybackConfigurePlaybackRequest>(offset);
1242 fidl::encoding::Encode::<PlaybackConfigurePlaybackRequest, D>::encode(
1244 (<PlaybackSourceConfig as fidl::encoding::ValueTypeMarker>::borrow(
1245 &self.source_config,
1246 ),),
1247 encoder,
1248 offset,
1249 _depth,
1250 )
1251 }
1252 }
1253 unsafe impl<
1254 D: fidl::encoding::ResourceDialect,
1255 T0: fidl::encoding::Encode<PlaybackSourceConfig, D>,
1256 > fidl::encoding::Encode<PlaybackConfigurePlaybackRequest, D> for (T0,)
1257 {
1258 #[inline]
1259 unsafe fn encode(
1260 self,
1261 encoder: &mut fidl::encoding::Encoder<'_, D>,
1262 offset: usize,
1263 depth: fidl::encoding::Depth,
1264 ) -> fidl::Result<()> {
1265 encoder.debug_check_bounds::<PlaybackConfigurePlaybackRequest>(offset);
1266 self.0.encode(encoder, offset + 0, depth)?;
1270 Ok(())
1271 }
1272 }
1273
1274 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1275 for PlaybackConfigurePlaybackRequest
1276 {
1277 #[inline(always)]
1278 fn new_empty() -> Self {
1279 Self { source_config: fidl::new_empty!(PlaybackSourceConfig, D) }
1280 }
1281
1282 #[inline]
1283 unsafe fn decode(
1284 &mut self,
1285 decoder: &mut fidl::encoding::Decoder<'_, D>,
1286 offset: usize,
1287 _depth: fidl::encoding::Depth,
1288 ) -> fidl::Result<()> {
1289 decoder.debug_check_bounds::<Self>(offset);
1290 fidl::decode!(
1292 PlaybackSourceConfig,
1293 D,
1294 &mut self.source_config,
1295 decoder,
1296 offset + 0,
1297 _depth
1298 )?;
1299 Ok(())
1300 }
1301 }
1302
1303 impl FilePlaybackConfig {
1304 #[inline(always)]
1305 fn max_ordinal_present(&self) -> u64 {
1306 if let Some(_) = self.file_path {
1307 return 1;
1308 }
1309 0
1310 }
1311 }
1312
1313 impl fidl::encoding::ValueTypeMarker for FilePlaybackConfig {
1314 type Borrowed<'a> = &'a Self;
1315 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1316 value
1317 }
1318 }
1319
1320 unsafe impl fidl::encoding::TypeMarker for FilePlaybackConfig {
1321 type Owned = Self;
1322
1323 #[inline(always)]
1324 fn inline_align(_context: fidl::encoding::Context) -> usize {
1325 8
1326 }
1327
1328 #[inline(always)]
1329 fn inline_size(_context: fidl::encoding::Context) -> usize {
1330 16
1331 }
1332 }
1333
1334 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FilePlaybackConfig, D>
1335 for &FilePlaybackConfig
1336 {
1337 unsafe fn encode(
1338 self,
1339 encoder: &mut fidl::encoding::Encoder<'_, D>,
1340 offset: usize,
1341 mut depth: fidl::encoding::Depth,
1342 ) -> fidl::Result<()> {
1343 encoder.debug_check_bounds::<FilePlaybackConfig>(offset);
1344 let max_ordinal: u64 = self.max_ordinal_present();
1346 encoder.write_num(max_ordinal, offset);
1347 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1348 if max_ordinal == 0 {
1350 return Ok(());
1351 }
1352 depth.increment()?;
1353 let envelope_size = 8;
1354 let bytes_len = max_ordinal as usize * envelope_size;
1355 #[allow(unused_variables)]
1356 let offset = encoder.out_of_line_offset(bytes_len);
1357 let mut _prev_end_offset: usize = 0;
1358 if 1 > max_ordinal {
1359 return Ok(());
1360 }
1361
1362 let cur_offset: usize = (1 - 1) * envelope_size;
1365
1366 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1368
1369 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
1374 self.file_path.as_ref().map(
1375 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
1376 ),
1377 encoder,
1378 offset + cur_offset,
1379 depth,
1380 )?;
1381
1382 _prev_end_offset = cur_offset + envelope_size;
1383
1384 Ok(())
1385 }
1386 }
1387
1388 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FilePlaybackConfig {
1389 #[inline(always)]
1390 fn new_empty() -> Self {
1391 Self::default()
1392 }
1393
1394 unsafe fn decode(
1395 &mut self,
1396 decoder: &mut fidl::encoding::Decoder<'_, D>,
1397 offset: usize,
1398 mut depth: fidl::encoding::Depth,
1399 ) -> fidl::Result<()> {
1400 decoder.debug_check_bounds::<Self>(offset);
1401 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1402 None => return Err(fidl::Error::NotNullable),
1403 Some(len) => len,
1404 };
1405 if len == 0 {
1407 return Ok(());
1408 };
1409 depth.increment()?;
1410 let envelope_size = 8;
1411 let bytes_len = len * envelope_size;
1412 let offset = decoder.out_of_line_offset(bytes_len)?;
1413 let mut _next_ordinal_to_read = 0;
1415 let mut next_offset = offset;
1416 let end_offset = offset + bytes_len;
1417 _next_ordinal_to_read += 1;
1418 if next_offset >= end_offset {
1419 return Ok(());
1420 }
1421
1422 while _next_ordinal_to_read < 1 {
1424 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1425 _next_ordinal_to_read += 1;
1426 next_offset += envelope_size;
1427 }
1428
1429 let next_out_of_line = decoder.next_out_of_line();
1430 let handles_before = decoder.remaining_handles();
1431 if let Some((inlined, num_bytes, num_handles)) =
1432 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1433 {
1434 let member_inline_size =
1435 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
1436 decoder.context,
1437 );
1438 if inlined != (member_inline_size <= 4) {
1439 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1440 }
1441 let inner_offset;
1442 let mut inner_depth = depth.clone();
1443 if inlined {
1444 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1445 inner_offset = next_offset;
1446 } else {
1447 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1448 inner_depth.increment()?;
1449 }
1450 let val_ref = self
1451 .file_path
1452 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
1453 fidl::decode!(
1454 fidl::encoding::UnboundedString,
1455 D,
1456 val_ref,
1457 decoder,
1458 inner_offset,
1459 inner_depth
1460 )?;
1461 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1462 {
1463 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1464 }
1465 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1466 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1467 }
1468 }
1469
1470 next_offset += envelope_size;
1471
1472 while next_offset < end_offset {
1474 _next_ordinal_to_read += 1;
1475 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1476 next_offset += envelope_size;
1477 }
1478
1479 Ok(())
1480 }
1481 }
1482
1483 impl FixedValuesPlaybackConfig {
1484 #[inline(always)]
1485 fn max_ordinal_present(&self) -> u64 {
1486 if let Some(_) = self.sensor_events {
1487 return 2;
1488 }
1489 if let Some(_) = self.sensor_list {
1490 return 1;
1491 }
1492 0
1493 }
1494 }
1495
1496 impl fidl::encoding::ValueTypeMarker for FixedValuesPlaybackConfig {
1497 type Borrowed<'a> = &'a Self;
1498 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1499 value
1500 }
1501 }
1502
1503 unsafe impl fidl::encoding::TypeMarker for FixedValuesPlaybackConfig {
1504 type Owned = Self;
1505
1506 #[inline(always)]
1507 fn inline_align(_context: fidl::encoding::Context) -> usize {
1508 8
1509 }
1510
1511 #[inline(always)]
1512 fn inline_size(_context: fidl::encoding::Context) -> usize {
1513 16
1514 }
1515 }
1516
1517 unsafe impl<D: fidl::encoding::ResourceDialect>
1518 fidl::encoding::Encode<FixedValuesPlaybackConfig, D> for &FixedValuesPlaybackConfig
1519 {
1520 unsafe fn encode(
1521 self,
1522 encoder: &mut fidl::encoding::Encoder<'_, D>,
1523 offset: usize,
1524 mut depth: fidl::encoding::Depth,
1525 ) -> fidl::Result<()> {
1526 encoder.debug_check_bounds::<FixedValuesPlaybackConfig>(offset);
1527 let max_ordinal: u64 = self.max_ordinal_present();
1529 encoder.write_num(max_ordinal, offset);
1530 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1531 if max_ordinal == 0 {
1533 return Ok(());
1534 }
1535 depth.increment()?;
1536 let envelope_size = 8;
1537 let bytes_len = max_ordinal as usize * envelope_size;
1538 #[allow(unused_variables)]
1539 let offset = encoder.out_of_line_offset(bytes_len);
1540 let mut _prev_end_offset: usize = 0;
1541 if 1 > max_ordinal {
1542 return Ok(());
1543 }
1544
1545 let cur_offset: usize = (1 - 1) * envelope_size;
1548
1549 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1551
1552 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types__common::SensorInfo>, D>(
1557 self.sensor_list.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types__common::SensorInfo> as fidl::encoding::ValueTypeMarker>::borrow),
1558 encoder, offset + cur_offset, depth
1559 )?;
1560
1561 _prev_end_offset = cur_offset + envelope_size;
1562 if 2 > max_ordinal {
1563 return Ok(());
1564 }
1565
1566 let cur_offset: usize = (2 - 1) * envelope_size;
1569
1570 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1572
1573 fidl::encoding::encode_in_envelope_optional::<
1578 fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types__common::SensorEvent>,
1579 D,
1580 >(
1581 self.sensor_events.as_ref().map(
1582 <fidl::encoding::UnboundedVector<
1583 fidl_fuchsia_sensors_types__common::SensorEvent,
1584 > as fidl::encoding::ValueTypeMarker>::borrow,
1585 ),
1586 encoder,
1587 offset + cur_offset,
1588 depth,
1589 )?;
1590
1591 _prev_end_offset = cur_offset + envelope_size;
1592
1593 Ok(())
1594 }
1595 }
1596
1597 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1598 for FixedValuesPlaybackConfig
1599 {
1600 #[inline(always)]
1601 fn new_empty() -> Self {
1602 Self::default()
1603 }
1604
1605 unsafe fn decode(
1606 &mut self,
1607 decoder: &mut fidl::encoding::Decoder<'_, D>,
1608 offset: usize,
1609 mut depth: fidl::encoding::Depth,
1610 ) -> fidl::Result<()> {
1611 decoder.debug_check_bounds::<Self>(offset);
1612 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1613 None => return Err(fidl::Error::NotNullable),
1614 Some(len) => len,
1615 };
1616 if len == 0 {
1618 return Ok(());
1619 };
1620 depth.increment()?;
1621 let envelope_size = 8;
1622 let bytes_len = len * envelope_size;
1623 let offset = decoder.out_of_line_offset(bytes_len)?;
1624 let mut _next_ordinal_to_read = 0;
1626 let mut next_offset = offset;
1627 let end_offset = offset + bytes_len;
1628 _next_ordinal_to_read += 1;
1629 if next_offset >= end_offset {
1630 return Ok(());
1631 }
1632
1633 while _next_ordinal_to_read < 1 {
1635 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1636 _next_ordinal_to_read += 1;
1637 next_offset += envelope_size;
1638 }
1639
1640 let next_out_of_line = decoder.next_out_of_line();
1641 let handles_before = decoder.remaining_handles();
1642 if let Some((inlined, num_bytes, num_handles)) =
1643 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1644 {
1645 let member_inline_size = <fidl::encoding::UnboundedVector<
1646 fidl_fuchsia_sensors_types__common::SensorInfo,
1647 > as fidl::encoding::TypeMarker>::inline_size(
1648 decoder.context
1649 );
1650 if inlined != (member_inline_size <= 4) {
1651 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1652 }
1653 let inner_offset;
1654 let mut inner_depth = depth.clone();
1655 if inlined {
1656 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1657 inner_offset = next_offset;
1658 } else {
1659 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1660 inner_depth.increment()?;
1661 }
1662 let val_ref = self.sensor_list.get_or_insert_with(|| {
1663 fidl::new_empty!(
1664 fidl::encoding::UnboundedVector<
1665 fidl_fuchsia_sensors_types__common::SensorInfo,
1666 >,
1667 D
1668 )
1669 });
1670 fidl::decode!(
1671 fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types__common::SensorInfo>,
1672 D,
1673 val_ref,
1674 decoder,
1675 inner_offset,
1676 inner_depth
1677 )?;
1678 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1679 {
1680 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1681 }
1682 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1683 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1684 }
1685 }
1686
1687 next_offset += envelope_size;
1688 _next_ordinal_to_read += 1;
1689 if next_offset >= end_offset {
1690 return Ok(());
1691 }
1692
1693 while _next_ordinal_to_read < 2 {
1695 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1696 _next_ordinal_to_read += 1;
1697 next_offset += envelope_size;
1698 }
1699
1700 let next_out_of_line = decoder.next_out_of_line();
1701 let handles_before = decoder.remaining_handles();
1702 if let Some((inlined, num_bytes, num_handles)) =
1703 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1704 {
1705 let member_inline_size = <fidl::encoding::UnboundedVector<
1706 fidl_fuchsia_sensors_types__common::SensorEvent,
1707 > as fidl::encoding::TypeMarker>::inline_size(
1708 decoder.context
1709 );
1710 if inlined != (member_inline_size <= 4) {
1711 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1712 }
1713 let inner_offset;
1714 let mut inner_depth = depth.clone();
1715 if inlined {
1716 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1717 inner_offset = next_offset;
1718 } else {
1719 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1720 inner_depth.increment()?;
1721 }
1722 let val_ref = self.sensor_events.get_or_insert_with(|| {
1723 fidl::new_empty!(
1724 fidl::encoding::UnboundedVector<
1725 fidl_fuchsia_sensors_types__common::SensorEvent,
1726 >,
1727 D
1728 )
1729 });
1730 fidl::decode!(
1731 fidl::encoding::UnboundedVector<
1732 fidl_fuchsia_sensors_types__common::SensorEvent,
1733 >,
1734 D,
1735 val_ref,
1736 decoder,
1737 inner_offset,
1738 inner_depth
1739 )?;
1740 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1741 {
1742 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1743 }
1744 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1745 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1746 }
1747 }
1748
1749 next_offset += envelope_size;
1750
1751 while next_offset < end_offset {
1753 _next_ordinal_to_read += 1;
1754 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1755 next_offset += envelope_size;
1756 }
1757
1758 Ok(())
1759 }
1760 }
1761
1762 impl fidl::encoding::ValueTypeMarker for PlaybackSourceConfig {
1763 type Borrowed<'a> = &'a Self;
1764 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1765 value
1766 }
1767 }
1768
1769 unsafe impl fidl::encoding::TypeMarker for PlaybackSourceConfig {
1770 type Owned = Self;
1771
1772 #[inline(always)]
1773 fn inline_align(_context: fidl::encoding::Context) -> usize {
1774 8
1775 }
1776
1777 #[inline(always)]
1778 fn inline_size(_context: fidl::encoding::Context) -> usize {
1779 16
1780 }
1781 }
1782
1783 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlaybackSourceConfig, D>
1784 for &PlaybackSourceConfig
1785 {
1786 #[inline]
1787 unsafe fn encode(
1788 self,
1789 encoder: &mut fidl::encoding::Encoder<'_, D>,
1790 offset: usize,
1791 _depth: fidl::encoding::Depth,
1792 ) -> fidl::Result<()> {
1793 encoder.debug_check_bounds::<PlaybackSourceConfig>(offset);
1794 encoder.write_num::<u64>(self.ordinal(), offset);
1795 match self {
1796 PlaybackSourceConfig::FixedValuesConfig(ref val) => {
1797 fidl::encoding::encode_in_envelope::<FixedValuesPlaybackConfig, D>(
1798 <FixedValuesPlaybackConfig as fidl::encoding::ValueTypeMarker>::borrow(val),
1799 encoder,
1800 offset + 8,
1801 _depth,
1802 )
1803 }
1804 PlaybackSourceConfig::FilePlaybackConfig(ref val) => {
1805 fidl::encoding::encode_in_envelope::<FilePlaybackConfig, D>(
1806 <FilePlaybackConfig as fidl::encoding::ValueTypeMarker>::borrow(val),
1807 encoder,
1808 offset + 8,
1809 _depth,
1810 )
1811 }
1812 PlaybackSourceConfig::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1813 }
1814 }
1815 }
1816
1817 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlaybackSourceConfig {
1818 #[inline(always)]
1819 fn new_empty() -> Self {
1820 Self::__SourceBreaking { unknown_ordinal: 0 }
1821 }
1822
1823 #[inline]
1824 unsafe fn decode(
1825 &mut self,
1826 decoder: &mut fidl::encoding::Decoder<'_, D>,
1827 offset: usize,
1828 mut depth: fidl::encoding::Depth,
1829 ) -> fidl::Result<()> {
1830 decoder.debug_check_bounds::<Self>(offset);
1831 #[allow(unused_variables)]
1832 let next_out_of_line = decoder.next_out_of_line();
1833 let handles_before = decoder.remaining_handles();
1834 let (ordinal, inlined, num_bytes, num_handles) =
1835 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1836
1837 let member_inline_size = match ordinal {
1838 1 => <FixedValuesPlaybackConfig as fidl::encoding::TypeMarker>::inline_size(
1839 decoder.context,
1840 ),
1841 2 => {
1842 <FilePlaybackConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context)
1843 }
1844 0 => return Err(fidl::Error::UnknownUnionTag),
1845 _ => num_bytes as usize,
1846 };
1847
1848 if inlined != (member_inline_size <= 4) {
1849 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1850 }
1851 let _inner_offset;
1852 if inlined {
1853 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1854 _inner_offset = offset + 8;
1855 } else {
1856 depth.increment()?;
1857 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1858 }
1859 match ordinal {
1860 1 => {
1861 #[allow(irrefutable_let_patterns)]
1862 if let PlaybackSourceConfig::FixedValuesConfig(_) = self {
1863 } else {
1865 *self = PlaybackSourceConfig::FixedValuesConfig(fidl::new_empty!(
1867 FixedValuesPlaybackConfig,
1868 D
1869 ));
1870 }
1871 #[allow(irrefutable_let_patterns)]
1872 if let PlaybackSourceConfig::FixedValuesConfig(ref mut val) = self {
1873 fidl::decode!(
1874 FixedValuesPlaybackConfig,
1875 D,
1876 val,
1877 decoder,
1878 _inner_offset,
1879 depth
1880 )?;
1881 } else {
1882 unreachable!()
1883 }
1884 }
1885 2 => {
1886 #[allow(irrefutable_let_patterns)]
1887 if let PlaybackSourceConfig::FilePlaybackConfig(_) = self {
1888 } else {
1890 *self = PlaybackSourceConfig::FilePlaybackConfig(fidl::new_empty!(
1892 FilePlaybackConfig,
1893 D
1894 ));
1895 }
1896 #[allow(irrefutable_let_patterns)]
1897 if let PlaybackSourceConfig::FilePlaybackConfig(ref mut val) = self {
1898 fidl::decode!(FilePlaybackConfig, D, val, decoder, _inner_offset, depth)?;
1899 } else {
1900 unreachable!()
1901 }
1902 }
1903 #[allow(deprecated)]
1904 ordinal => {
1905 for _ in 0..num_handles {
1906 decoder.drop_next_handle()?;
1907 }
1908 *self = PlaybackSourceConfig::__SourceBreaking { unknown_ordinal: ordinal };
1909 }
1910 }
1911 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1912 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1913 }
1914 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1915 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1916 }
1917 Ok(())
1918 }
1919 }
1920}