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__common::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__common::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__common::SensorInfo>,
343}
344
345impl fidl::Persistable for ManagerGetSensorsListResponse {}
346
347pub mod manager_ordinals {
348    pub const CONFIGURE_PLAYBACK: u64 = 0x2aec5d56edab43fa;
349    pub const GET_SENSORS_LIST: u64 = 0x48cf103cfbec3a4a;
350    pub const CONFIGURE_SENSOR_RATES: u64 = 0x28046f7f3f340652;
351    pub const ACTIVATE: u64 = 0x5678f117cae5ba42;
352    pub const DEACTIVATE: u64 = 0x7fafbca62982c87;
353    pub const ON_SENSOR_EVENT: u64 = 0x6ceb07e11d43e9b;
354}
355
356mod internal {
357    use super::*;
358    unsafe impl fidl::encoding::TypeMarker for ActivateSensorError {
359        type Owned = Self;
360
361        #[inline(always)]
362        fn inline_align(_context: fidl::encoding::Context) -> usize {
363            std::mem::align_of::<u32>()
364        }
365
366        #[inline(always)]
367        fn inline_size(_context: fidl::encoding::Context) -> usize {
368            std::mem::size_of::<u32>()
369        }
370
371        #[inline(always)]
372        fn encode_is_copy() -> bool {
373            false
374        }
375
376        #[inline(always)]
377        fn decode_is_copy() -> bool {
378            false
379        }
380    }
381
382    impl fidl::encoding::ValueTypeMarker for ActivateSensorError {
383        type Borrowed<'a> = Self;
384        #[inline(always)]
385        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
386            *value
387        }
388    }
389
390    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
391        for ActivateSensorError
392    {
393        #[inline]
394        unsafe fn encode(
395            self,
396            encoder: &mut fidl::encoding::Encoder<'_, D>,
397            offset: usize,
398            _depth: fidl::encoding::Depth,
399        ) -> fidl::Result<()> {
400            encoder.debug_check_bounds::<Self>(offset);
401            encoder.write_num(self.into_primitive(), offset);
402            Ok(())
403        }
404    }
405
406    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ActivateSensorError {
407        #[inline(always)]
408        fn new_empty() -> Self {
409            Self::unknown()
410        }
411
412        #[inline]
413        unsafe fn decode(
414            &mut self,
415            decoder: &mut fidl::encoding::Decoder<'_, D>,
416            offset: usize,
417            _depth: fidl::encoding::Depth,
418        ) -> fidl::Result<()> {
419            decoder.debug_check_bounds::<Self>(offset);
420            let prim = decoder.read_num::<u32>(offset);
421
422            *self = Self::from_primitive_allow_unknown(prim);
423            Ok(())
424        }
425    }
426    unsafe impl fidl::encoding::TypeMarker for ConfigurePlaybackError {
427        type Owned = Self;
428
429        #[inline(always)]
430        fn inline_align(_context: fidl::encoding::Context) -> usize {
431            std::mem::align_of::<u32>()
432        }
433
434        #[inline(always)]
435        fn inline_size(_context: fidl::encoding::Context) -> usize {
436            std::mem::size_of::<u32>()
437        }
438
439        #[inline(always)]
440        fn encode_is_copy() -> bool {
441            false
442        }
443
444        #[inline(always)]
445        fn decode_is_copy() -> bool {
446            false
447        }
448    }
449
450    impl fidl::encoding::ValueTypeMarker for ConfigurePlaybackError {
451        type Borrowed<'a> = Self;
452        #[inline(always)]
453        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
454            *value
455        }
456    }
457
458    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
459        for ConfigurePlaybackError
460    {
461        #[inline]
462        unsafe fn encode(
463            self,
464            encoder: &mut fidl::encoding::Encoder<'_, D>,
465            offset: usize,
466            _depth: fidl::encoding::Depth,
467        ) -> fidl::Result<()> {
468            encoder.debug_check_bounds::<Self>(offset);
469            encoder.write_num(self.into_primitive(), offset);
470            Ok(())
471        }
472    }
473
474    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
475        for ConfigurePlaybackError
476    {
477        #[inline(always)]
478        fn new_empty() -> Self {
479            Self::unknown()
480        }
481
482        #[inline]
483        unsafe fn decode(
484            &mut self,
485            decoder: &mut fidl::encoding::Decoder<'_, D>,
486            offset: usize,
487            _depth: fidl::encoding::Depth,
488        ) -> fidl::Result<()> {
489            decoder.debug_check_bounds::<Self>(offset);
490            let prim = decoder.read_num::<u32>(offset);
491
492            *self = Self::from_primitive_allow_unknown(prim);
493            Ok(())
494        }
495    }
496    unsafe impl fidl::encoding::TypeMarker for ConfigureSensorRateError {
497        type Owned = Self;
498
499        #[inline(always)]
500        fn inline_align(_context: fidl::encoding::Context) -> usize {
501            std::mem::align_of::<u32>()
502        }
503
504        #[inline(always)]
505        fn inline_size(_context: fidl::encoding::Context) -> usize {
506            std::mem::size_of::<u32>()
507        }
508
509        #[inline(always)]
510        fn encode_is_copy() -> bool {
511            false
512        }
513
514        #[inline(always)]
515        fn decode_is_copy() -> bool {
516            false
517        }
518    }
519
520    impl fidl::encoding::ValueTypeMarker for ConfigureSensorRateError {
521        type Borrowed<'a> = Self;
522        #[inline(always)]
523        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
524            *value
525        }
526    }
527
528    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
529        for ConfigureSensorRateError
530    {
531        #[inline]
532        unsafe fn encode(
533            self,
534            encoder: &mut fidl::encoding::Encoder<'_, D>,
535            offset: usize,
536            _depth: fidl::encoding::Depth,
537        ) -> fidl::Result<()> {
538            encoder.debug_check_bounds::<Self>(offset);
539            encoder.write_num(self.into_primitive(), offset);
540            Ok(())
541        }
542    }
543
544    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
545        for ConfigureSensorRateError
546    {
547        #[inline(always)]
548        fn new_empty() -> Self {
549            Self::unknown()
550        }
551
552        #[inline]
553        unsafe fn decode(
554            &mut self,
555            decoder: &mut fidl::encoding::Decoder<'_, D>,
556            offset: usize,
557            _depth: fidl::encoding::Depth,
558        ) -> fidl::Result<()> {
559            decoder.debug_check_bounds::<Self>(offset);
560            let prim = decoder.read_num::<u32>(offset);
561
562            *self = Self::from_primitive_allow_unknown(prim);
563            Ok(())
564        }
565    }
566    unsafe impl fidl::encoding::TypeMarker for DeactivateSensorError {
567        type Owned = Self;
568
569        #[inline(always)]
570        fn inline_align(_context: fidl::encoding::Context) -> usize {
571            std::mem::align_of::<u32>()
572        }
573
574        #[inline(always)]
575        fn inline_size(_context: fidl::encoding::Context) -> usize {
576            std::mem::size_of::<u32>()
577        }
578
579        #[inline(always)]
580        fn encode_is_copy() -> bool {
581            false
582        }
583
584        #[inline(always)]
585        fn decode_is_copy() -> bool {
586            false
587        }
588    }
589
590    impl fidl::encoding::ValueTypeMarker for DeactivateSensorError {
591        type Borrowed<'a> = Self;
592        #[inline(always)]
593        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
594            *value
595        }
596    }
597
598    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
599        for DeactivateSensorError
600    {
601        #[inline]
602        unsafe fn encode(
603            self,
604            encoder: &mut fidl::encoding::Encoder<'_, D>,
605            offset: usize,
606            _depth: fidl::encoding::Depth,
607        ) -> fidl::Result<()> {
608            encoder.debug_check_bounds::<Self>(offset);
609            encoder.write_num(self.into_primitive(), offset);
610            Ok(())
611        }
612    }
613
614    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeactivateSensorError {
615        #[inline(always)]
616        fn new_empty() -> Self {
617            Self::unknown()
618        }
619
620        #[inline]
621        unsafe fn decode(
622            &mut self,
623            decoder: &mut fidl::encoding::Decoder<'_, D>,
624            offset: usize,
625            _depth: fidl::encoding::Depth,
626        ) -> fidl::Result<()> {
627            decoder.debug_check_bounds::<Self>(offset);
628            let prim = decoder.read_num::<u32>(offset);
629
630            *self = Self::from_primitive_allow_unknown(prim);
631            Ok(())
632        }
633    }
634
635    impl fidl::encoding::ValueTypeMarker for ManagerActivateRequest {
636        type Borrowed<'a> = &'a Self;
637        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
638            value
639        }
640    }
641
642    unsafe impl fidl::encoding::TypeMarker for ManagerActivateRequest {
643        type Owned = Self;
644
645        #[inline(always)]
646        fn inline_align(_context: fidl::encoding::Context) -> usize {
647            4
648        }
649
650        #[inline(always)]
651        fn inline_size(_context: fidl::encoding::Context) -> usize {
652            4
653        }
654        #[inline(always)]
655        fn encode_is_copy() -> bool {
656            true
657        }
658
659        #[inline(always)]
660        fn decode_is_copy() -> bool {
661            true
662        }
663    }
664
665    unsafe impl<D: fidl::encoding::ResourceDialect>
666        fidl::encoding::Encode<ManagerActivateRequest, D> for &ManagerActivateRequest
667    {
668        #[inline]
669        unsafe fn encode(
670            self,
671            encoder: &mut fidl::encoding::Encoder<'_, D>,
672            offset: usize,
673            _depth: fidl::encoding::Depth,
674        ) -> fidl::Result<()> {
675            encoder.debug_check_bounds::<ManagerActivateRequest>(offset);
676            unsafe {
677                // Copy the object into the buffer.
678                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
679                (buf_ptr as *mut ManagerActivateRequest)
680                    .write_unaligned((self as *const ManagerActivateRequest).read());
681                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
682                // done second because the memcpy will write garbage to these bytes.
683            }
684            Ok(())
685        }
686    }
687    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
688        fidl::encoding::Encode<ManagerActivateRequest, D> for (T0,)
689    {
690        #[inline]
691        unsafe fn encode(
692            self,
693            encoder: &mut fidl::encoding::Encoder<'_, D>,
694            offset: usize,
695            depth: fidl::encoding::Depth,
696        ) -> fidl::Result<()> {
697            encoder.debug_check_bounds::<ManagerActivateRequest>(offset);
698            // Zero out padding regions. There's no need to apply masks
699            // because the unmasked parts will be overwritten by fields.
700            // Write the fields.
701            self.0.encode(encoder, offset + 0, depth)?;
702            Ok(())
703        }
704    }
705
706    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
707        for ManagerActivateRequest
708    {
709        #[inline(always)]
710        fn new_empty() -> Self {
711            Self { id: fidl::new_empty!(i32, D) }
712        }
713
714        #[inline]
715        unsafe fn decode(
716            &mut self,
717            decoder: &mut fidl::encoding::Decoder<'_, D>,
718            offset: usize,
719            _depth: fidl::encoding::Depth,
720        ) -> fidl::Result<()> {
721            decoder.debug_check_bounds::<Self>(offset);
722            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
723            // Verify that padding bytes are zero.
724            // Copy from the buffer into the object.
725            unsafe {
726                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
727            }
728            Ok(())
729        }
730    }
731
732    impl fidl::encoding::ValueTypeMarker for ManagerConfigurePlaybackRequest {
733        type Borrowed<'a> = &'a Self;
734        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
735            value
736        }
737    }
738
739    unsafe impl fidl::encoding::TypeMarker for ManagerConfigurePlaybackRequest {
740        type Owned = Self;
741
742        #[inline(always)]
743        fn inline_align(_context: fidl::encoding::Context) -> usize {
744            8
745        }
746
747        #[inline(always)]
748        fn inline_size(_context: fidl::encoding::Context) -> usize {
749            16
750        }
751    }
752
753    unsafe impl<D: fidl::encoding::ResourceDialect>
754        fidl::encoding::Encode<ManagerConfigurePlaybackRequest, D>
755        for &ManagerConfigurePlaybackRequest
756    {
757        #[inline]
758        unsafe fn encode(
759            self,
760            encoder: &mut fidl::encoding::Encoder<'_, D>,
761            offset: usize,
762            _depth: fidl::encoding::Depth,
763        ) -> fidl::Result<()> {
764            encoder.debug_check_bounds::<ManagerConfigurePlaybackRequest>(offset);
765            // Delegate to tuple encoding.
766            fidl::encoding::Encode::<ManagerConfigurePlaybackRequest, D>::encode(
767                (
768                    <fidl_fuchsia_hardware_sensors__common::PlaybackSourceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.source_config),
769                ),
770                encoder, offset, _depth
771            )
772        }
773    }
774    unsafe impl<
775            D: fidl::encoding::ResourceDialect,
776            T0: fidl::encoding::Encode<fidl_fuchsia_hardware_sensors__common::PlaybackSourceConfig, D>,
777        > fidl::encoding::Encode<ManagerConfigurePlaybackRequest, D> for (T0,)
778    {
779        #[inline]
780        unsafe fn encode(
781            self,
782            encoder: &mut fidl::encoding::Encoder<'_, D>,
783            offset: usize,
784            depth: fidl::encoding::Depth,
785        ) -> fidl::Result<()> {
786            encoder.debug_check_bounds::<ManagerConfigurePlaybackRequest>(offset);
787            // Zero out padding regions. There's no need to apply masks
788            // because the unmasked parts will be overwritten by fields.
789            // Write the fields.
790            self.0.encode(encoder, offset + 0, depth)?;
791            Ok(())
792        }
793    }
794
795    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
796        for ManagerConfigurePlaybackRequest
797    {
798        #[inline(always)]
799        fn new_empty() -> Self {
800            Self {
801                source_config: fidl::new_empty!(
802                    fidl_fuchsia_hardware_sensors__common::PlaybackSourceConfig,
803                    D
804                ),
805            }
806        }
807
808        #[inline]
809        unsafe fn decode(
810            &mut self,
811            decoder: &mut fidl::encoding::Decoder<'_, D>,
812            offset: usize,
813            _depth: fidl::encoding::Depth,
814        ) -> fidl::Result<()> {
815            decoder.debug_check_bounds::<Self>(offset);
816            // Verify that padding bytes are zero.
817            fidl::decode!(
818                fidl_fuchsia_hardware_sensors__common::PlaybackSourceConfig,
819                D,
820                &mut self.source_config,
821                decoder,
822                offset + 0,
823                _depth
824            )?;
825            Ok(())
826        }
827    }
828
829    impl fidl::encoding::ValueTypeMarker for ManagerDeactivateRequest {
830        type Borrowed<'a> = &'a Self;
831        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
832            value
833        }
834    }
835
836    unsafe impl fidl::encoding::TypeMarker for ManagerDeactivateRequest {
837        type Owned = Self;
838
839        #[inline(always)]
840        fn inline_align(_context: fidl::encoding::Context) -> usize {
841            4
842        }
843
844        #[inline(always)]
845        fn inline_size(_context: fidl::encoding::Context) -> usize {
846            4
847        }
848        #[inline(always)]
849        fn encode_is_copy() -> bool {
850            true
851        }
852
853        #[inline(always)]
854        fn decode_is_copy() -> bool {
855            true
856        }
857    }
858
859    unsafe impl<D: fidl::encoding::ResourceDialect>
860        fidl::encoding::Encode<ManagerDeactivateRequest, D> for &ManagerDeactivateRequest
861    {
862        #[inline]
863        unsafe fn encode(
864            self,
865            encoder: &mut fidl::encoding::Encoder<'_, D>,
866            offset: usize,
867            _depth: fidl::encoding::Depth,
868        ) -> fidl::Result<()> {
869            encoder.debug_check_bounds::<ManagerDeactivateRequest>(offset);
870            unsafe {
871                // Copy the object into the buffer.
872                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
873                (buf_ptr as *mut ManagerDeactivateRequest)
874                    .write_unaligned((self as *const ManagerDeactivateRequest).read());
875                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
876                // done second because the memcpy will write garbage to these bytes.
877            }
878            Ok(())
879        }
880    }
881    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
882        fidl::encoding::Encode<ManagerDeactivateRequest, D> for (T0,)
883    {
884        #[inline]
885        unsafe fn encode(
886            self,
887            encoder: &mut fidl::encoding::Encoder<'_, D>,
888            offset: usize,
889            depth: fidl::encoding::Depth,
890        ) -> fidl::Result<()> {
891            encoder.debug_check_bounds::<ManagerDeactivateRequest>(offset);
892            // Zero out padding regions. There's no need to apply masks
893            // because the unmasked parts will be overwritten by fields.
894            // Write the fields.
895            self.0.encode(encoder, offset + 0, depth)?;
896            Ok(())
897        }
898    }
899
900    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
901        for ManagerDeactivateRequest
902    {
903        #[inline(always)]
904        fn new_empty() -> Self {
905            Self { id: fidl::new_empty!(i32, D) }
906        }
907
908        #[inline]
909        unsafe fn decode(
910            &mut self,
911            decoder: &mut fidl::encoding::Decoder<'_, D>,
912            offset: usize,
913            _depth: fidl::encoding::Depth,
914        ) -> fidl::Result<()> {
915            decoder.debug_check_bounds::<Self>(offset);
916            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
917            // Verify that padding bytes are zero.
918            // Copy from the buffer into the object.
919            unsafe {
920                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
921            }
922            Ok(())
923        }
924    }
925
926    impl fidl::encoding::ValueTypeMarker for ManagerOnSensorEventRequest {
927        type Borrowed<'a> = &'a Self;
928        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
929            value
930        }
931    }
932
933    unsafe impl fidl::encoding::TypeMarker for ManagerOnSensorEventRequest {
934        type Owned = Self;
935
936        #[inline(always)]
937        fn inline_align(_context: fidl::encoding::Context) -> usize {
938            8
939        }
940
941        #[inline(always)]
942        fn inline_size(_context: fidl::encoding::Context) -> usize {
943            40
944        }
945    }
946
947    unsafe impl<D: fidl::encoding::ResourceDialect>
948        fidl::encoding::Encode<ManagerOnSensorEventRequest, D> for &ManagerOnSensorEventRequest
949    {
950        #[inline]
951        unsafe fn encode(
952            self,
953            encoder: &mut fidl::encoding::Encoder<'_, D>,
954            offset: usize,
955            _depth: fidl::encoding::Depth,
956        ) -> fidl::Result<()> {
957            encoder.debug_check_bounds::<ManagerOnSensorEventRequest>(offset);
958            // Delegate to tuple encoding.
959            fidl::encoding::Encode::<ManagerOnSensorEventRequest, D>::encode(
960                (
961                    <fidl_fuchsia_sensors_types__common::SensorEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
962                ),
963                encoder, offset, _depth
964            )
965        }
966    }
967    unsafe impl<
968            D: fidl::encoding::ResourceDialect,
969            T0: fidl::encoding::Encode<fidl_fuchsia_sensors_types__common::SensorEvent, D>,
970        > fidl::encoding::Encode<ManagerOnSensorEventRequest, D> for (T0,)
971    {
972        #[inline]
973        unsafe fn encode(
974            self,
975            encoder: &mut fidl::encoding::Encoder<'_, D>,
976            offset: usize,
977            depth: fidl::encoding::Depth,
978        ) -> fidl::Result<()> {
979            encoder.debug_check_bounds::<ManagerOnSensorEventRequest>(offset);
980            // Zero out padding regions. There's no need to apply masks
981            // because the unmasked parts will be overwritten by fields.
982            // Write the fields.
983            self.0.encode(encoder, offset + 0, depth)?;
984            Ok(())
985        }
986    }
987
988    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
989        for ManagerOnSensorEventRequest
990    {
991        #[inline(always)]
992        fn new_empty() -> Self {
993            Self { event: fidl::new_empty!(fidl_fuchsia_sensors_types__common::SensorEvent, D) }
994        }
995
996        #[inline]
997        unsafe fn decode(
998            &mut self,
999            decoder: &mut fidl::encoding::Decoder<'_, D>,
1000            offset: usize,
1001            _depth: fidl::encoding::Depth,
1002        ) -> fidl::Result<()> {
1003            decoder.debug_check_bounds::<Self>(offset);
1004            // Verify that padding bytes are zero.
1005            fidl::decode!(
1006                fidl_fuchsia_sensors_types__common::SensorEvent,
1007                D,
1008                &mut self.event,
1009                decoder,
1010                offset + 0,
1011                _depth
1012            )?;
1013            Ok(())
1014        }
1015    }
1016
1017    impl fidl::encoding::ValueTypeMarker for ManagerGetSensorsListResponse {
1018        type Borrowed<'a> = &'a Self;
1019        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1020            value
1021        }
1022    }
1023
1024    unsafe impl fidl::encoding::TypeMarker for ManagerGetSensorsListResponse {
1025        type Owned = Self;
1026
1027        #[inline(always)]
1028        fn inline_align(_context: fidl::encoding::Context) -> usize {
1029            8
1030        }
1031
1032        #[inline(always)]
1033        fn inline_size(_context: fidl::encoding::Context) -> usize {
1034            16
1035        }
1036    }
1037
1038    unsafe impl<D: fidl::encoding::ResourceDialect>
1039        fidl::encoding::Encode<ManagerGetSensorsListResponse, D>
1040        for &ManagerGetSensorsListResponse
1041    {
1042        #[inline]
1043        unsafe fn encode(
1044            self,
1045            encoder: &mut fidl::encoding::Encoder<'_, D>,
1046            offset: usize,
1047            _depth: fidl::encoding::Depth,
1048        ) -> fidl::Result<()> {
1049            encoder.debug_check_bounds::<ManagerGetSensorsListResponse>(offset);
1050            // Delegate to tuple encoding.
1051            fidl::encoding::Encode::<ManagerGetSensorsListResponse, D>::encode(
1052                (
1053                    <fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types__common::SensorInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensors),
1054                ),
1055                encoder, offset, _depth
1056            )
1057        }
1058    }
1059    unsafe impl<
1060            D: fidl::encoding::ResourceDialect,
1061            T0: fidl::encoding::Encode<
1062                fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types__common::SensorInfo>,
1063                D,
1064            >,
1065        > fidl::encoding::Encode<ManagerGetSensorsListResponse, D> for (T0,)
1066    {
1067        #[inline]
1068        unsafe fn encode(
1069            self,
1070            encoder: &mut fidl::encoding::Encoder<'_, D>,
1071            offset: usize,
1072            depth: fidl::encoding::Depth,
1073        ) -> fidl::Result<()> {
1074            encoder.debug_check_bounds::<ManagerGetSensorsListResponse>(offset);
1075            // Zero out padding regions. There's no need to apply masks
1076            // because the unmasked parts will be overwritten by fields.
1077            // Write the fields.
1078            self.0.encode(encoder, offset + 0, depth)?;
1079            Ok(())
1080        }
1081    }
1082
1083    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1084        for ManagerGetSensorsListResponse
1085    {
1086        #[inline(always)]
1087        fn new_empty() -> Self {
1088            Self {
1089                sensors: fidl::new_empty!(
1090                    fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types__common::SensorInfo>,
1091                    D
1092                ),
1093            }
1094        }
1095
1096        #[inline]
1097        unsafe fn decode(
1098            &mut self,
1099            decoder: &mut fidl::encoding::Decoder<'_, D>,
1100            offset: usize,
1101            _depth: fidl::encoding::Depth,
1102        ) -> fidl::Result<()> {
1103            decoder.debug_check_bounds::<Self>(offset);
1104            // Verify that padding bytes are zero.
1105            fidl::decode!(
1106                fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types__common::SensorInfo>,
1107                D,
1108                &mut self.sensors,
1109                decoder,
1110                offset + 0,
1111                _depth
1112            )?;
1113            Ok(())
1114        }
1115    }
1116}