fidl_fuchsia_sensors_common/
fidl_fuchsia_sensors_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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/// Errors that may be returned by Manager::Activate.
12#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13pub enum ActivateSensorError {
14    /// The SensorManager failed to get a response from the backing driver.
15    DriverUnavailable,
16    /// The provided SensorId does not correspond to an actual sensor.
17    InvalidSensorId,
18    #[doc(hidden)]
19    __SourceBreaking { unknown_ordinal: u32 },
20}
21
22/// Pattern that matches an unknown `ActivateSensorError` member.
23#[macro_export]
24macro_rules! ActivateSensorErrorUnknown {
25    () => {
26        _
27    };
28}
29
30impl ActivateSensorError {
31    #[inline]
32    pub fn from_primitive(prim: u32) -> Option<Self> {
33        match prim {
34            1 => Some(Self::DriverUnavailable),
35            2 => Some(Self::InvalidSensorId),
36            _ => None,
37        }
38    }
39
40    #[inline]
41    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
42        match prim {
43            1 => Self::DriverUnavailable,
44            2 => Self::InvalidSensorId,
45            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
46        }
47    }
48
49    #[inline]
50    pub fn unknown() -> Self {
51        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
52    }
53
54    #[inline]
55    pub const fn into_primitive(self) -> u32 {
56        match self {
57            Self::DriverUnavailable => 1,
58            Self::InvalidSensorId => 2,
59            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
60        }
61    }
62
63    #[inline]
64    pub fn is_unknown(&self) -> bool {
65        match self {
66            Self::__SourceBreaking { unknown_ordinal: _ } => true,
67            _ => false,
68        }
69    }
70}
71
72/// Errors that may be returned by ConfigurePlayback.
73#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
74pub enum ConfigurePlaybackError {
75    /// The Playback component was unavailable in this configuration of Fuchsia.
76    PlaybackUnavailable,
77    /// The type of the PlaybackSourceConfig union isn't recognized/supported.
78    InvalidConfigType,
79    /// Some part of the provided playback config is missing fields.
80    ConfigMissingFields,
81    /// A provided SensorInfo has a duplicate SensorId.
82    DuplicateSensorInfo,
83    /// No SensorEvents were given for a provided SensorInfo.
84    NoEventsForSensor,
85    /// A SensorEvent was seen with a SensorId for which no SensorInfo was
86    /// provided.
87    EventFromUnknownSensor,
88    /// A SensorEvent was seen with a SensorType that does not match the
89    /// corresponding SensorInfo.
90    EventSensorTypeMismatch,
91    /// A SensorEvent was seen with an EventPayload that doesn't match its
92    /// SensorType.
93    EventPayloadTypeMismatch,
94    /// The specified data file could not be opened.
95    FileOpenFailed,
96    /// The data in the specified file was not in the expected format.
97    ///
98    /// NOTE: Some file types may allow for situations where the file is not
99    /// fully read by the time configuration is complete. For example a call to
100    /// ConfigurePlayback may only result in a file's header being read and
101    /// parsed. Thus ConfigurePlayback not returning this error is not always a
102    /// guarantee that the whole file contains valid data.
103    FileParseError,
104    #[doc(hidden)]
105    __SourceBreaking { unknown_ordinal: u32 },
106}
107
108/// Pattern that matches an unknown `ConfigurePlaybackError` member.
109#[macro_export]
110macro_rules! ConfigurePlaybackErrorUnknown {
111    () => {
112        _
113    };
114}
115
116impl ConfigurePlaybackError {
117    #[inline]
118    pub fn from_primitive(prim: u32) -> Option<Self> {
119        match prim {
120            1 => Some(Self::PlaybackUnavailable),
121            2 => Some(Self::InvalidConfigType),
122            3 => Some(Self::ConfigMissingFields),
123            4 => Some(Self::DuplicateSensorInfo),
124            5 => Some(Self::NoEventsForSensor),
125            6 => Some(Self::EventFromUnknownSensor),
126            7 => Some(Self::EventSensorTypeMismatch),
127            8 => Some(Self::EventPayloadTypeMismatch),
128            9 => Some(Self::FileOpenFailed),
129            10 => Some(Self::FileParseError),
130            _ => None,
131        }
132    }
133
134    #[inline]
135    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
136        match prim {
137            1 => Self::PlaybackUnavailable,
138            2 => Self::InvalidConfigType,
139            3 => Self::ConfigMissingFields,
140            4 => Self::DuplicateSensorInfo,
141            5 => Self::NoEventsForSensor,
142            6 => Self::EventFromUnknownSensor,
143            7 => Self::EventSensorTypeMismatch,
144            8 => Self::EventPayloadTypeMismatch,
145            9 => Self::FileOpenFailed,
146            10 => Self::FileParseError,
147            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
148        }
149    }
150
151    #[inline]
152    pub fn unknown() -> Self {
153        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
154    }
155
156    #[inline]
157    pub const fn into_primitive(self) -> u32 {
158        match self {
159            Self::PlaybackUnavailable => 1,
160            Self::InvalidConfigType => 2,
161            Self::ConfigMissingFields => 3,
162            Self::DuplicateSensorInfo => 4,
163            Self::NoEventsForSensor => 5,
164            Self::EventFromUnknownSensor => 6,
165            Self::EventSensorTypeMismatch => 7,
166            Self::EventPayloadTypeMismatch => 8,
167            Self::FileOpenFailed => 9,
168            Self::FileParseError => 10,
169            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
170        }
171    }
172
173    #[inline]
174    pub fn is_unknown(&self) -> bool {
175        match self {
176            Self::__SourceBreaking { unknown_ordinal: _ } => true,
177            _ => false,
178        }
179    }
180}
181
182/// Errors that may be returned by Manager::ConfigureSensorRate.
183#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
184pub enum ConfigureSensorRateError {
185    /// The SensorManager failed to get a response from the backing driver.
186    DriverUnavailable,
187    /// The provided sensor SensorId does not correspond to an actual sensor.
188    InvalidSensorId,
189    /// The rate configuration was missing fields or contained an unsupported
190    /// sample rate and/or maximum reporting latency.
191    InvalidConfig,
192    #[doc(hidden)]
193    __SourceBreaking { unknown_ordinal: u32 },
194}
195
196/// Pattern that matches an unknown `ConfigureSensorRateError` member.
197#[macro_export]
198macro_rules! ConfigureSensorRateErrorUnknown {
199    () => {
200        _
201    };
202}
203
204impl ConfigureSensorRateError {
205    #[inline]
206    pub fn from_primitive(prim: u32) -> Option<Self> {
207        match prim {
208            1 => Some(Self::DriverUnavailable),
209            2 => Some(Self::InvalidSensorId),
210            3 => Some(Self::InvalidConfig),
211            _ => None,
212        }
213    }
214
215    #[inline]
216    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
217        match prim {
218            1 => Self::DriverUnavailable,
219            2 => Self::InvalidSensorId,
220            3 => Self::InvalidConfig,
221            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
222        }
223    }
224
225    #[inline]
226    pub fn unknown() -> Self {
227        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
228    }
229
230    #[inline]
231    pub const fn into_primitive(self) -> u32 {
232        match self {
233            Self::DriverUnavailable => 1,
234            Self::InvalidSensorId => 2,
235            Self::InvalidConfig => 3,
236            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
237        }
238    }
239
240    #[inline]
241    pub fn is_unknown(&self) -> bool {
242        match self {
243            Self::__SourceBreaking { unknown_ordinal: _ } => true,
244            _ => false,
245        }
246    }
247}
248
249/// Errors that may be returned by Manager::Deactivate.
250#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
251pub enum DeactivateSensorError {
252    /// The SensorManager failed to get a response from the backing driver.
253    DriverUnavailable,
254    /// The provided SensorId does not correspond to an actual sensor.
255    InvalidSensorId,
256    #[doc(hidden)]
257    __SourceBreaking { unknown_ordinal: u32 },
258}
259
260/// Pattern that matches an unknown `DeactivateSensorError` member.
261#[macro_export]
262macro_rules! DeactivateSensorErrorUnknown {
263    () => {
264        _
265    };
266}
267
268impl DeactivateSensorError {
269    #[inline]
270    pub fn from_primitive(prim: u32) -> Option<Self> {
271        match prim {
272            1 => Some(Self::DriverUnavailable),
273            2 => Some(Self::InvalidSensorId),
274            _ => None,
275        }
276    }
277
278    #[inline]
279    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
280        match prim {
281            1 => Self::DriverUnavailable,
282            2 => Self::InvalidSensorId,
283            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
284        }
285    }
286
287    #[inline]
288    pub fn unknown() -> Self {
289        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
290    }
291
292    #[inline]
293    pub const fn into_primitive(self) -> u32 {
294        match self {
295            Self::DriverUnavailable => 1,
296            Self::InvalidSensorId => 2,
297            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
298        }
299    }
300
301    #[inline]
302    pub fn is_unknown(&self) -> bool {
303        match self {
304            Self::__SourceBreaking { unknown_ordinal: _ } => true,
305            _ => false,
306        }
307    }
308}
309
310#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
311#[repr(C)]
312pub struct ManagerActivateRequest {
313    pub id: i32,
314}
315
316impl fidl::Persistable for ManagerActivateRequest {}
317
318#[derive(Clone, Debug, PartialEq)]
319pub struct ManagerConfigurePlaybackRequest {
320    pub source_config: fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
321}
322
323impl fidl::Persistable for ManagerConfigurePlaybackRequest {}
324
325#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
326#[repr(C)]
327pub struct ManagerDeactivateRequest {
328    pub id: i32,
329}
330
331impl fidl::Persistable for ManagerDeactivateRequest {}
332
333#[derive(Clone, Debug, PartialEq)]
334pub struct ManagerOnSensorEventRequest {
335    pub event: fidl_fuchsia_sensors_types::SensorEvent,
336}
337
338impl fidl::Persistable for ManagerOnSensorEventRequest {}
339
340#[derive(Clone, Debug, PartialEq)]
341pub struct ManagerGetSensorsListResponse {
342    pub sensors: Vec<fidl_fuchsia_sensors_types::SensorInfo>,
343}
344
345impl fidl::Persistable for ManagerGetSensorsListResponse {}
346
347mod internal {
348    use super::*;
349    unsafe impl fidl::encoding::TypeMarker for ActivateSensorError {
350        type Owned = Self;
351
352        #[inline(always)]
353        fn inline_align(_context: fidl::encoding::Context) -> usize {
354            std::mem::align_of::<u32>()
355        }
356
357        #[inline(always)]
358        fn inline_size(_context: fidl::encoding::Context) -> usize {
359            std::mem::size_of::<u32>()
360        }
361
362        #[inline(always)]
363        fn encode_is_copy() -> bool {
364            false
365        }
366
367        #[inline(always)]
368        fn decode_is_copy() -> bool {
369            false
370        }
371    }
372
373    impl fidl::encoding::ValueTypeMarker for ActivateSensorError {
374        type Borrowed<'a> = Self;
375        #[inline(always)]
376        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
377            *value
378        }
379    }
380
381    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
382        for ActivateSensorError
383    {
384        #[inline]
385        unsafe fn encode(
386            self,
387            encoder: &mut fidl::encoding::Encoder<'_, D>,
388            offset: usize,
389            _depth: fidl::encoding::Depth,
390        ) -> fidl::Result<()> {
391            encoder.debug_check_bounds::<Self>(offset);
392            encoder.write_num(self.into_primitive(), offset);
393            Ok(())
394        }
395    }
396
397    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ActivateSensorError {
398        #[inline(always)]
399        fn new_empty() -> Self {
400            Self::unknown()
401        }
402
403        #[inline]
404        unsafe fn decode(
405            &mut self,
406            decoder: &mut fidl::encoding::Decoder<'_, D>,
407            offset: usize,
408            _depth: fidl::encoding::Depth,
409        ) -> fidl::Result<()> {
410            decoder.debug_check_bounds::<Self>(offset);
411            let prim = decoder.read_num::<u32>(offset);
412
413            *self = Self::from_primitive_allow_unknown(prim);
414            Ok(())
415        }
416    }
417    unsafe impl fidl::encoding::TypeMarker for ConfigurePlaybackError {
418        type Owned = Self;
419
420        #[inline(always)]
421        fn inline_align(_context: fidl::encoding::Context) -> usize {
422            std::mem::align_of::<u32>()
423        }
424
425        #[inline(always)]
426        fn inline_size(_context: fidl::encoding::Context) -> usize {
427            std::mem::size_of::<u32>()
428        }
429
430        #[inline(always)]
431        fn encode_is_copy() -> bool {
432            false
433        }
434
435        #[inline(always)]
436        fn decode_is_copy() -> bool {
437            false
438        }
439    }
440
441    impl fidl::encoding::ValueTypeMarker for ConfigurePlaybackError {
442        type Borrowed<'a> = Self;
443        #[inline(always)]
444        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
445            *value
446        }
447    }
448
449    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
450        for ConfigurePlaybackError
451    {
452        #[inline]
453        unsafe fn encode(
454            self,
455            encoder: &mut fidl::encoding::Encoder<'_, D>,
456            offset: usize,
457            _depth: fidl::encoding::Depth,
458        ) -> fidl::Result<()> {
459            encoder.debug_check_bounds::<Self>(offset);
460            encoder.write_num(self.into_primitive(), offset);
461            Ok(())
462        }
463    }
464
465    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
466        for ConfigurePlaybackError
467    {
468        #[inline(always)]
469        fn new_empty() -> Self {
470            Self::unknown()
471        }
472
473        #[inline]
474        unsafe fn decode(
475            &mut self,
476            decoder: &mut fidl::encoding::Decoder<'_, D>,
477            offset: usize,
478            _depth: fidl::encoding::Depth,
479        ) -> fidl::Result<()> {
480            decoder.debug_check_bounds::<Self>(offset);
481            let prim = decoder.read_num::<u32>(offset);
482
483            *self = Self::from_primitive_allow_unknown(prim);
484            Ok(())
485        }
486    }
487    unsafe impl fidl::encoding::TypeMarker for ConfigureSensorRateError {
488        type Owned = Self;
489
490        #[inline(always)]
491        fn inline_align(_context: fidl::encoding::Context) -> usize {
492            std::mem::align_of::<u32>()
493        }
494
495        #[inline(always)]
496        fn inline_size(_context: fidl::encoding::Context) -> usize {
497            std::mem::size_of::<u32>()
498        }
499
500        #[inline(always)]
501        fn encode_is_copy() -> bool {
502            false
503        }
504
505        #[inline(always)]
506        fn decode_is_copy() -> bool {
507            false
508        }
509    }
510
511    impl fidl::encoding::ValueTypeMarker for ConfigureSensorRateError {
512        type Borrowed<'a> = Self;
513        #[inline(always)]
514        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
515            *value
516        }
517    }
518
519    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
520        for ConfigureSensorRateError
521    {
522        #[inline]
523        unsafe fn encode(
524            self,
525            encoder: &mut fidl::encoding::Encoder<'_, D>,
526            offset: usize,
527            _depth: fidl::encoding::Depth,
528        ) -> fidl::Result<()> {
529            encoder.debug_check_bounds::<Self>(offset);
530            encoder.write_num(self.into_primitive(), offset);
531            Ok(())
532        }
533    }
534
535    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
536        for ConfigureSensorRateError
537    {
538        #[inline(always)]
539        fn new_empty() -> Self {
540            Self::unknown()
541        }
542
543        #[inline]
544        unsafe fn decode(
545            &mut self,
546            decoder: &mut fidl::encoding::Decoder<'_, D>,
547            offset: usize,
548            _depth: fidl::encoding::Depth,
549        ) -> fidl::Result<()> {
550            decoder.debug_check_bounds::<Self>(offset);
551            let prim = decoder.read_num::<u32>(offset);
552
553            *self = Self::from_primitive_allow_unknown(prim);
554            Ok(())
555        }
556    }
557    unsafe impl fidl::encoding::TypeMarker for DeactivateSensorError {
558        type Owned = Self;
559
560        #[inline(always)]
561        fn inline_align(_context: fidl::encoding::Context) -> usize {
562            std::mem::align_of::<u32>()
563        }
564
565        #[inline(always)]
566        fn inline_size(_context: fidl::encoding::Context) -> usize {
567            std::mem::size_of::<u32>()
568        }
569
570        #[inline(always)]
571        fn encode_is_copy() -> bool {
572            false
573        }
574
575        #[inline(always)]
576        fn decode_is_copy() -> bool {
577            false
578        }
579    }
580
581    impl fidl::encoding::ValueTypeMarker for DeactivateSensorError {
582        type Borrowed<'a> = Self;
583        #[inline(always)]
584        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
585            *value
586        }
587    }
588
589    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
590        for DeactivateSensorError
591    {
592        #[inline]
593        unsafe fn encode(
594            self,
595            encoder: &mut fidl::encoding::Encoder<'_, D>,
596            offset: usize,
597            _depth: fidl::encoding::Depth,
598        ) -> fidl::Result<()> {
599            encoder.debug_check_bounds::<Self>(offset);
600            encoder.write_num(self.into_primitive(), offset);
601            Ok(())
602        }
603    }
604
605    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeactivateSensorError {
606        #[inline(always)]
607        fn new_empty() -> Self {
608            Self::unknown()
609        }
610
611        #[inline]
612        unsafe fn decode(
613            &mut self,
614            decoder: &mut fidl::encoding::Decoder<'_, D>,
615            offset: usize,
616            _depth: fidl::encoding::Depth,
617        ) -> fidl::Result<()> {
618            decoder.debug_check_bounds::<Self>(offset);
619            let prim = decoder.read_num::<u32>(offset);
620
621            *self = Self::from_primitive_allow_unknown(prim);
622            Ok(())
623        }
624    }
625
626    impl fidl::encoding::ValueTypeMarker for ManagerActivateRequest {
627        type Borrowed<'a> = &'a Self;
628        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
629            value
630        }
631    }
632
633    unsafe impl fidl::encoding::TypeMarker for ManagerActivateRequest {
634        type Owned = Self;
635
636        #[inline(always)]
637        fn inline_align(_context: fidl::encoding::Context) -> usize {
638            4
639        }
640
641        #[inline(always)]
642        fn inline_size(_context: fidl::encoding::Context) -> usize {
643            4
644        }
645        #[inline(always)]
646        fn encode_is_copy() -> bool {
647            true
648        }
649
650        #[inline(always)]
651        fn decode_is_copy() -> bool {
652            true
653        }
654    }
655
656    unsafe impl<D: fidl::encoding::ResourceDialect>
657        fidl::encoding::Encode<ManagerActivateRequest, D> for &ManagerActivateRequest
658    {
659        #[inline]
660        unsafe fn encode(
661            self,
662            encoder: &mut fidl::encoding::Encoder<'_, D>,
663            offset: usize,
664            _depth: fidl::encoding::Depth,
665        ) -> fidl::Result<()> {
666            encoder.debug_check_bounds::<ManagerActivateRequest>(offset);
667            unsafe {
668                // Copy the object into the buffer.
669                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
670                (buf_ptr as *mut ManagerActivateRequest)
671                    .write_unaligned((self as *const ManagerActivateRequest).read());
672                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
673                // done second because the memcpy will write garbage to these bytes.
674            }
675            Ok(())
676        }
677    }
678    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
679        fidl::encoding::Encode<ManagerActivateRequest, D> for (T0,)
680    {
681        #[inline]
682        unsafe fn encode(
683            self,
684            encoder: &mut fidl::encoding::Encoder<'_, D>,
685            offset: usize,
686            depth: fidl::encoding::Depth,
687        ) -> fidl::Result<()> {
688            encoder.debug_check_bounds::<ManagerActivateRequest>(offset);
689            // Zero out padding regions. There's no need to apply masks
690            // because the unmasked parts will be overwritten by fields.
691            // Write the fields.
692            self.0.encode(encoder, offset + 0, depth)?;
693            Ok(())
694        }
695    }
696
697    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
698        for ManagerActivateRequest
699    {
700        #[inline(always)]
701        fn new_empty() -> Self {
702            Self { id: fidl::new_empty!(i32, D) }
703        }
704
705        #[inline]
706        unsafe fn decode(
707            &mut self,
708            decoder: &mut fidl::encoding::Decoder<'_, D>,
709            offset: usize,
710            _depth: fidl::encoding::Depth,
711        ) -> fidl::Result<()> {
712            decoder.debug_check_bounds::<Self>(offset);
713            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
714            // Verify that padding bytes are zero.
715            // Copy from the buffer into the object.
716            unsafe {
717                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
718            }
719            Ok(())
720        }
721    }
722
723    impl fidl::encoding::ValueTypeMarker for ManagerConfigurePlaybackRequest {
724        type Borrowed<'a> = &'a Self;
725        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
726            value
727        }
728    }
729
730    unsafe impl fidl::encoding::TypeMarker for ManagerConfigurePlaybackRequest {
731        type Owned = Self;
732
733        #[inline(always)]
734        fn inline_align(_context: fidl::encoding::Context) -> usize {
735            8
736        }
737
738        #[inline(always)]
739        fn inline_size(_context: fidl::encoding::Context) -> usize {
740            16
741        }
742    }
743
744    unsafe impl<D: fidl::encoding::ResourceDialect>
745        fidl::encoding::Encode<ManagerConfigurePlaybackRequest, D>
746        for &ManagerConfigurePlaybackRequest
747    {
748        #[inline]
749        unsafe fn encode(
750            self,
751            encoder: &mut fidl::encoding::Encoder<'_, D>,
752            offset: usize,
753            _depth: fidl::encoding::Depth,
754        ) -> fidl::Result<()> {
755            encoder.debug_check_bounds::<ManagerConfigurePlaybackRequest>(offset);
756            // Delegate to tuple encoding.
757            fidl::encoding::Encode::<ManagerConfigurePlaybackRequest, D>::encode(
758                (
759                    <fidl_fuchsia_hardware_sensors::PlaybackSourceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.source_config),
760                ),
761                encoder, offset, _depth
762            )
763        }
764    }
765    unsafe impl<
766            D: fidl::encoding::ResourceDialect,
767            T0: fidl::encoding::Encode<fidl_fuchsia_hardware_sensors::PlaybackSourceConfig, D>,
768        > fidl::encoding::Encode<ManagerConfigurePlaybackRequest, D> for (T0,)
769    {
770        #[inline]
771        unsafe fn encode(
772            self,
773            encoder: &mut fidl::encoding::Encoder<'_, D>,
774            offset: usize,
775            depth: fidl::encoding::Depth,
776        ) -> fidl::Result<()> {
777            encoder.debug_check_bounds::<ManagerConfigurePlaybackRequest>(offset);
778            // Zero out padding regions. There's no need to apply masks
779            // because the unmasked parts will be overwritten by fields.
780            // Write the fields.
781            self.0.encode(encoder, offset + 0, depth)?;
782            Ok(())
783        }
784    }
785
786    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
787        for ManagerConfigurePlaybackRequest
788    {
789        #[inline(always)]
790        fn new_empty() -> Self {
791            Self {
792                source_config: fidl::new_empty!(
793                    fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
794                    D
795                ),
796            }
797        }
798
799        #[inline]
800        unsafe fn decode(
801            &mut self,
802            decoder: &mut fidl::encoding::Decoder<'_, D>,
803            offset: usize,
804            _depth: fidl::encoding::Depth,
805        ) -> fidl::Result<()> {
806            decoder.debug_check_bounds::<Self>(offset);
807            // Verify that padding bytes are zero.
808            fidl::decode!(
809                fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
810                D,
811                &mut self.source_config,
812                decoder,
813                offset + 0,
814                _depth
815            )?;
816            Ok(())
817        }
818    }
819
820    impl fidl::encoding::ValueTypeMarker for ManagerDeactivateRequest {
821        type Borrowed<'a> = &'a Self;
822        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
823            value
824        }
825    }
826
827    unsafe impl fidl::encoding::TypeMarker for ManagerDeactivateRequest {
828        type Owned = Self;
829
830        #[inline(always)]
831        fn inline_align(_context: fidl::encoding::Context) -> usize {
832            4
833        }
834
835        #[inline(always)]
836        fn inline_size(_context: fidl::encoding::Context) -> usize {
837            4
838        }
839        #[inline(always)]
840        fn encode_is_copy() -> bool {
841            true
842        }
843
844        #[inline(always)]
845        fn decode_is_copy() -> bool {
846            true
847        }
848    }
849
850    unsafe impl<D: fidl::encoding::ResourceDialect>
851        fidl::encoding::Encode<ManagerDeactivateRequest, D> for &ManagerDeactivateRequest
852    {
853        #[inline]
854        unsafe fn encode(
855            self,
856            encoder: &mut fidl::encoding::Encoder<'_, D>,
857            offset: usize,
858            _depth: fidl::encoding::Depth,
859        ) -> fidl::Result<()> {
860            encoder.debug_check_bounds::<ManagerDeactivateRequest>(offset);
861            unsafe {
862                // Copy the object into the buffer.
863                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
864                (buf_ptr as *mut ManagerDeactivateRequest)
865                    .write_unaligned((self as *const ManagerDeactivateRequest).read());
866                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
867                // done second because the memcpy will write garbage to these bytes.
868            }
869            Ok(())
870        }
871    }
872    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
873        fidl::encoding::Encode<ManagerDeactivateRequest, D> for (T0,)
874    {
875        #[inline]
876        unsafe fn encode(
877            self,
878            encoder: &mut fidl::encoding::Encoder<'_, D>,
879            offset: usize,
880            depth: fidl::encoding::Depth,
881        ) -> fidl::Result<()> {
882            encoder.debug_check_bounds::<ManagerDeactivateRequest>(offset);
883            // Zero out padding regions. There's no need to apply masks
884            // because the unmasked parts will be overwritten by fields.
885            // Write the fields.
886            self.0.encode(encoder, offset + 0, depth)?;
887            Ok(())
888        }
889    }
890
891    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
892        for ManagerDeactivateRequest
893    {
894        #[inline(always)]
895        fn new_empty() -> Self {
896            Self { id: fidl::new_empty!(i32, D) }
897        }
898
899        #[inline]
900        unsafe fn decode(
901            &mut self,
902            decoder: &mut fidl::encoding::Decoder<'_, D>,
903            offset: usize,
904            _depth: fidl::encoding::Depth,
905        ) -> fidl::Result<()> {
906            decoder.debug_check_bounds::<Self>(offset);
907            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
908            // Verify that padding bytes are zero.
909            // Copy from the buffer into the object.
910            unsafe {
911                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
912            }
913            Ok(())
914        }
915    }
916
917    impl fidl::encoding::ValueTypeMarker for ManagerOnSensorEventRequest {
918        type Borrowed<'a> = &'a Self;
919        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
920            value
921        }
922    }
923
924    unsafe impl fidl::encoding::TypeMarker for ManagerOnSensorEventRequest {
925        type Owned = Self;
926
927        #[inline(always)]
928        fn inline_align(_context: fidl::encoding::Context) -> usize {
929            8
930        }
931
932        #[inline(always)]
933        fn inline_size(_context: fidl::encoding::Context) -> usize {
934            40
935        }
936    }
937
938    unsafe impl<D: fidl::encoding::ResourceDialect>
939        fidl::encoding::Encode<ManagerOnSensorEventRequest, D> for &ManagerOnSensorEventRequest
940    {
941        #[inline]
942        unsafe fn encode(
943            self,
944            encoder: &mut fidl::encoding::Encoder<'_, D>,
945            offset: usize,
946            _depth: fidl::encoding::Depth,
947        ) -> fidl::Result<()> {
948            encoder.debug_check_bounds::<ManagerOnSensorEventRequest>(offset);
949            // Delegate to tuple encoding.
950            fidl::encoding::Encode::<ManagerOnSensorEventRequest, D>::encode(
951                (
952                    <fidl_fuchsia_sensors_types::SensorEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
953                ),
954                encoder, offset, _depth
955            )
956        }
957    }
958    unsafe impl<
959            D: fidl::encoding::ResourceDialect,
960            T0: fidl::encoding::Encode<fidl_fuchsia_sensors_types::SensorEvent, D>,
961        > fidl::encoding::Encode<ManagerOnSensorEventRequest, D> for (T0,)
962    {
963        #[inline]
964        unsafe fn encode(
965            self,
966            encoder: &mut fidl::encoding::Encoder<'_, D>,
967            offset: usize,
968            depth: fidl::encoding::Depth,
969        ) -> fidl::Result<()> {
970            encoder.debug_check_bounds::<ManagerOnSensorEventRequest>(offset);
971            // Zero out padding regions. There's no need to apply masks
972            // because the unmasked parts will be overwritten by fields.
973            // Write the fields.
974            self.0.encode(encoder, offset + 0, depth)?;
975            Ok(())
976        }
977    }
978
979    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
980        for ManagerOnSensorEventRequest
981    {
982        #[inline(always)]
983        fn new_empty() -> Self {
984            Self { event: fidl::new_empty!(fidl_fuchsia_sensors_types::SensorEvent, D) }
985        }
986
987        #[inline]
988        unsafe fn decode(
989            &mut self,
990            decoder: &mut fidl::encoding::Decoder<'_, D>,
991            offset: usize,
992            _depth: fidl::encoding::Depth,
993        ) -> fidl::Result<()> {
994            decoder.debug_check_bounds::<Self>(offset);
995            // Verify that padding bytes are zero.
996            fidl::decode!(
997                fidl_fuchsia_sensors_types::SensorEvent,
998                D,
999                &mut self.event,
1000                decoder,
1001                offset + 0,
1002                _depth
1003            )?;
1004            Ok(())
1005        }
1006    }
1007
1008    impl fidl::encoding::ValueTypeMarker for ManagerGetSensorsListResponse {
1009        type Borrowed<'a> = &'a Self;
1010        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1011            value
1012        }
1013    }
1014
1015    unsafe impl fidl::encoding::TypeMarker for ManagerGetSensorsListResponse {
1016        type Owned = Self;
1017
1018        #[inline(always)]
1019        fn inline_align(_context: fidl::encoding::Context) -> usize {
1020            8
1021        }
1022
1023        #[inline(always)]
1024        fn inline_size(_context: fidl::encoding::Context) -> usize {
1025            16
1026        }
1027    }
1028
1029    unsafe impl<D: fidl::encoding::ResourceDialect>
1030        fidl::encoding::Encode<ManagerGetSensorsListResponse, D>
1031        for &ManagerGetSensorsListResponse
1032    {
1033        #[inline]
1034        unsafe fn encode(
1035            self,
1036            encoder: &mut fidl::encoding::Encoder<'_, D>,
1037            offset: usize,
1038            _depth: fidl::encoding::Depth,
1039        ) -> fidl::Result<()> {
1040            encoder.debug_check_bounds::<ManagerGetSensorsListResponse>(offset);
1041            // Delegate to tuple encoding.
1042            fidl::encoding::Encode::<ManagerGetSensorsListResponse, D>::encode(
1043                (
1044                    <fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types::SensorInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensors),
1045                ),
1046                encoder, offset, _depth
1047            )
1048        }
1049    }
1050    unsafe impl<
1051            D: fidl::encoding::ResourceDialect,
1052            T0: fidl::encoding::Encode<
1053                fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types::SensorInfo>,
1054                D,
1055            >,
1056        > fidl::encoding::Encode<ManagerGetSensorsListResponse, D> for (T0,)
1057    {
1058        #[inline]
1059        unsafe fn encode(
1060            self,
1061            encoder: &mut fidl::encoding::Encoder<'_, D>,
1062            offset: usize,
1063            depth: fidl::encoding::Depth,
1064        ) -> fidl::Result<()> {
1065            encoder.debug_check_bounds::<ManagerGetSensorsListResponse>(offset);
1066            // Zero out padding regions. There's no need to apply masks
1067            // because the unmasked parts will be overwritten by fields.
1068            // Write the fields.
1069            self.0.encode(encoder, offset + 0, depth)?;
1070            Ok(())
1071        }
1072    }
1073
1074    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1075        for ManagerGetSensorsListResponse
1076    {
1077        #[inline(always)]
1078        fn new_empty() -> Self {
1079            Self {
1080                sensors: fidl::new_empty!(
1081                    fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types::SensorInfo>,
1082                    D
1083                ),
1084            }
1085        }
1086
1087        #[inline]
1088        unsafe fn decode(
1089            &mut self,
1090            decoder: &mut fidl::encoding::Decoder<'_, D>,
1091            offset: usize,
1092            _depth: fidl::encoding::Depth,
1093        ) -> fidl::Result<()> {
1094            decoder.debug_check_bounds::<Self>(offset);
1095            // Verify that padding bytes are zero.
1096            fidl::decode!(
1097                fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types::SensorInfo>,
1098                D,
1099                &mut self.sensors,
1100                decoder,
1101                offset + 0,
1102                _depth
1103            )?;
1104            Ok(())
1105        }
1106    }
1107}