fidl_fuchsia_hardware_haptics__common/
fidl_fuchsia_hardware_haptics__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#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12pub enum CompositeEffectWaveform {
13    /// No vibration.
14    Noop,
15    /// A sharp, crisp click waveform.
16    Click,
17    /// A dull, heavy impact waveform.
18    Thud,
19    /// A spinning or rotating sensation.
20    Spin,
21    /// A waveform with a rapid onset.
22    QuickRise,
23    /// A waveform with a gradual onset.
24    SlowRise,
25    /// A waveform with a rapid decay.
26    QuickFall,
27    /// A light, short tick waveform.
28    LightTick,
29    /// A low-frequency tick waveform.
30    LowTick,
31    #[doc(hidden)]
32    __SourceBreaking { unknown_ordinal: u32 },
33}
34
35/// Pattern that matches an unknown `CompositeEffectWaveform` member.
36#[macro_export]
37macro_rules! CompositeEffectWaveformUnknown {
38    () => {
39        _
40    };
41}
42
43impl CompositeEffectWaveform {
44    #[inline]
45    pub fn from_primitive(prim: u32) -> Option<Self> {
46        match prim {
47            0 => Some(Self::Noop),
48            1 => Some(Self::Click),
49            2 => Some(Self::Thud),
50            3 => Some(Self::Spin),
51            4 => Some(Self::QuickRise),
52            5 => Some(Self::SlowRise),
53            6 => Some(Self::QuickFall),
54            7 => Some(Self::LightTick),
55            8 => Some(Self::LowTick),
56            _ => None,
57        }
58    }
59
60    #[inline]
61    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
62        match prim {
63            0 => Self::Noop,
64            1 => Self::Click,
65            2 => Self::Thud,
66            3 => Self::Spin,
67            4 => Self::QuickRise,
68            5 => Self::SlowRise,
69            6 => Self::QuickFall,
70            7 => Self::LightTick,
71            8 => Self::LowTick,
72            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
73        }
74    }
75
76    #[inline]
77    pub fn unknown() -> Self {
78        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
79    }
80
81    #[inline]
82    pub const fn into_primitive(self) -> u32 {
83        match self {
84            Self::Noop => 0,
85            Self::Click => 1,
86            Self::Thud => 2,
87            Self::Spin => 3,
88            Self::QuickRise => 4,
89            Self::SlowRise => 5,
90            Self::QuickFall => 6,
91            Self::LightTick => 7,
92            Self::LowTick => 8,
93            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
94        }
95    }
96
97    #[inline]
98    pub fn is_unknown(&self) -> bool {
99        match self {
100            Self::__SourceBreaking { unknown_ordinal: _ } => true,
101            _ => false,
102        }
103    }
104}
105
106#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
107pub enum Effect {
108    /// A sharp, crisp click.
109    Click,
110    /// Two sharp, crisp clicks in quick succession.
111    DoubleClick,
112    /// A short, light tap.
113    Tick,
114    /// A dull, heavy impact.
115    Thud,
116    /// A sudden, percussive sensation.
117    Pop,
118    /// A more intense version of CLICK.
119    HeavyClick,
120    /// The ringtone effects are vendor-specific variations. A method to query
121    /// these may be added in the future if needed.
122    Ringtone1,
123    Ringtone2,
124    Ringtone3,
125    Ringtone4,
126    Ringtone5,
127    Ringtone6,
128    Ringtone7,
129    Ringtone8,
130    Ringtone9,
131    Ringtone10,
132    Ringtone11,
133    Ringtone12,
134    Ringtone13,
135    Ringtone14,
136    Ringtone15,
137    /// A tick with a textured feel.
138    TextureTick,
139    #[doc(hidden)]
140    __SourceBreaking {
141        unknown_ordinal: u32,
142    },
143}
144
145/// Pattern that matches an unknown `Effect` member.
146#[macro_export]
147macro_rules! EffectUnknown {
148    () => {
149        _
150    };
151}
152
153impl Effect {
154    #[inline]
155    pub fn from_primitive(prim: u32) -> Option<Self> {
156        match prim {
157            0 => Some(Self::Click),
158            1 => Some(Self::DoubleClick),
159            2 => Some(Self::Tick),
160            3 => Some(Self::Thud),
161            4 => Some(Self::Pop),
162            5 => Some(Self::HeavyClick),
163            6 => Some(Self::Ringtone1),
164            7 => Some(Self::Ringtone2),
165            8 => Some(Self::Ringtone3),
166            9 => Some(Self::Ringtone4),
167            10 => Some(Self::Ringtone5),
168            11 => Some(Self::Ringtone6),
169            12 => Some(Self::Ringtone7),
170            13 => Some(Self::Ringtone8),
171            14 => Some(Self::Ringtone9),
172            15 => Some(Self::Ringtone10),
173            16 => Some(Self::Ringtone11),
174            17 => Some(Self::Ringtone12),
175            18 => Some(Self::Ringtone13),
176            19 => Some(Self::Ringtone14),
177            20 => Some(Self::Ringtone15),
178            21 => Some(Self::TextureTick),
179            _ => None,
180        }
181    }
182
183    #[inline]
184    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
185        match prim {
186            0 => Self::Click,
187            1 => Self::DoubleClick,
188            2 => Self::Tick,
189            3 => Self::Thud,
190            4 => Self::Pop,
191            5 => Self::HeavyClick,
192            6 => Self::Ringtone1,
193            7 => Self::Ringtone2,
194            8 => Self::Ringtone3,
195            9 => Self::Ringtone4,
196            10 => Self::Ringtone5,
197            11 => Self::Ringtone6,
198            12 => Self::Ringtone7,
199            13 => Self::Ringtone8,
200            14 => Self::Ringtone9,
201            15 => Self::Ringtone10,
202            16 => Self::Ringtone11,
203            17 => Self::Ringtone12,
204            18 => Self::Ringtone13,
205            19 => Self::Ringtone14,
206            20 => Self::Ringtone15,
207            21 => Self::TextureTick,
208            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
209        }
210    }
211
212    #[inline]
213    pub fn unknown() -> Self {
214        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
215    }
216
217    #[inline]
218    pub const fn into_primitive(self) -> u32 {
219        match self {
220            Self::Click => 0,
221            Self::DoubleClick => 1,
222            Self::Tick => 2,
223            Self::Thud => 3,
224            Self::Pop => 4,
225            Self::HeavyClick => 5,
226            Self::Ringtone1 => 6,
227            Self::Ringtone2 => 7,
228            Self::Ringtone3 => 8,
229            Self::Ringtone4 => 9,
230            Self::Ringtone5 => 10,
231            Self::Ringtone6 => 11,
232            Self::Ringtone7 => 12,
233            Self::Ringtone8 => 13,
234            Self::Ringtone9 => 14,
235            Self::Ringtone10 => 15,
236            Self::Ringtone11 => 16,
237            Self::Ringtone12 => 17,
238            Self::Ringtone13 => 18,
239            Self::Ringtone14 => 19,
240            Self::Ringtone15 => 20,
241            Self::TextureTick => 21,
242            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
243        }
244    }
245
246    #[inline]
247    pub fn is_unknown(&self) -> bool {
248        match self {
249            Self::__SourceBreaking { unknown_ordinal: _ } => true,
250            _ => false,
251        }
252    }
253}
254
255#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
256pub enum EffectStrength {
257    Light,
258    Medium,
259    Strong,
260    #[doc(hidden)]
261    __SourceBreaking {
262        unknown_ordinal: u32,
263    },
264}
265
266/// Pattern that matches an unknown `EffectStrength` member.
267#[macro_export]
268macro_rules! EffectStrengthUnknown {
269    () => {
270        _
271    };
272}
273
274impl EffectStrength {
275    #[inline]
276    pub fn from_primitive(prim: u32) -> Option<Self> {
277        match prim {
278            0 => Some(Self::Light),
279            1 => Some(Self::Medium),
280            2 => Some(Self::Strong),
281            _ => None,
282        }
283    }
284
285    #[inline]
286    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
287        match prim {
288            0 => Self::Light,
289            1 => Self::Medium,
290            2 => Self::Strong,
291            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
292        }
293    }
294
295    #[inline]
296    pub fn unknown() -> Self {
297        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
298    }
299
300    #[inline]
301    pub const fn into_primitive(self) -> u32 {
302        match self {
303            Self::Light => 0,
304            Self::Medium => 1,
305            Self::Strong => 2,
306            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
307        }
308    }
309
310    #[inline]
311    pub fn is_unknown(&self) -> bool {
312        match self {
313            Self::__SourceBreaking { unknown_ordinal: _ } => true,
314            _ => false,
315        }
316    }
317}
318
319#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
320pub struct CompositeEffect {
321    /// Delay before [`fuchsia.hardware.haptics/SupportedEffect.waveform`] is
322    /// played.
323    pub delay: i64,
324    /// Waveform to be played.
325    pub waveform: CompositeEffectWaveform,
326    /// Adjusts the gain applied to
327    /// [`fuchsia.hardware.haptics/SupportedEffect.waveform`] when played. Must
328    /// be in range [0.0, 1.0] where 0.0 is the minimum "feelable" amplitude.
329    pub scale: f32,
330}
331
332impl fidl::Persistable for CompositeEffect {}
333
334#[derive(Clone, Debug, PartialEq, PartialOrd)]
335pub struct DevicePlayCompositeWaveformRequest {
336    /// Composite waveform to be played.
337    pub composite_waveform: Vec<CompositeEffect>,
338}
339
340impl fidl::Persistable for DevicePlayCompositeWaveformRequest {}
341
342#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
343pub struct DevicePlayEffectRequest {
344    /// Effect to be played.
345    pub effect: Effect,
346    /// The strength of `effect` when played.
347    pub strength: EffectStrength,
348}
349
350impl fidl::Persistable for DevicePlayEffectRequest {}
351
352#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
353#[repr(C)]
354pub struct DevicePlayVibrationRequest {
355    /// Duration of the vibration.
356    pub duration: i64,
357}
358
359impl fidl::Persistable for DevicePlayVibrationRequest {}
360
361#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
362pub struct DeviceSetAmplitudeRequest {
363    /// Behaves nearly like a percentage gain applied to vibrations played
364    /// in the future. Must be in the range (0, 1] where 0 means vibrations
365    /// are muted and 1 means the amplitude of vibrations are unaltered.
366    pub amplitude: f32,
367}
368
369impl fidl::Persistable for DeviceSetAmplitudeRequest {}
370
371#[derive(Clone, Debug, PartialEq, PartialOrd)]
372pub struct DeviceGetPropertiesResponse {
373    /// The fundamental resonant frequency (in hertz) of the haptics
374    /// device. Also known as F0.
375    pub fundamental_resonant_frequency_hz: f32,
376    /// The quality factor of the haptics device. Also known as the Q
377    /// factor.
378    pub quality_factor: f32,
379    /// List of effects that the haptics device can play.
380    pub supported_effects: Vec<SupportedEffect>,
381    /// List of composite effect waveforms that the haptics device can
382    /// play.
383    pub supported_composite_effect_waveforms: Vec<SupportedCompositeEffectWaveform>,
384    /// The max number of `CompositeEffect`'s that a composite waveform can
385    /// be composed of.
386    pub max_composite_waveform_effect_count: u64,
387    /// Returns the max delay a `CompositeEffect` can have in a composite
388    /// waveform.
389    pub max_composite_effect_delay: i64,
390}
391
392impl fidl::Persistable for DeviceGetPropertiesResponse {}
393
394/// Composite effect waveform that the haptics device can play.
395#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
396pub struct SupportedCompositeEffectWaveform {
397    /// Composite effect waveform that the haptics device can play.
398    pub waveform: CompositeEffectWaveform,
399    /// Duration of
400    /// [`fuchsia.hardware.haptics/SupportedCompositeEffectWaveform.waveform`]
401    /// when played by the haptics device.
402    pub duration: i64,
403}
404
405impl fidl::Persistable for SupportedCompositeEffectWaveform {}
406
407/// Effect that the haptics device can play.
408#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
409pub struct SupportedEffect {
410    /// Effect that the haptics device can play.
411    pub effect: Effect,
412    /// Duration of [`fuchsia.hardware.haptics/SupportedEffect.effect`] when
413    /// played by the haptics device.
414    pub duration: i64,
415}
416
417impl fidl::Persistable for SupportedEffect {}
418
419pub mod device_ordinals {
420    pub const START_VIBRATION: u64 = 0x439dad11bbcca662;
421    pub const PLAY_VIBRATION: u64 = 0x7b23b51b00917d27;
422    pub const PLAY_EFFECT: u64 = 0x713695448db55cd5;
423    pub const PLAY_COMPOSITE_WAVEFORM: u64 = 0xd6fca2a36d44085;
424    pub const STOP_VIBRATION: u64 = 0x5861752ab352f513;
425    pub const SET_AMPLITUDE: u64 = 0x1123b5c82cac1ba0;
426    pub const GET_PROPERTIES: u64 = 0x6482dc9bc50e8972;
427}
428
429mod internal {
430    use super::*;
431    unsafe impl fidl::encoding::TypeMarker for CompositeEffectWaveform {
432        type Owned = Self;
433
434        #[inline(always)]
435        fn inline_align(_context: fidl::encoding::Context) -> usize {
436            std::mem::align_of::<u32>()
437        }
438
439        #[inline(always)]
440        fn inline_size(_context: fidl::encoding::Context) -> usize {
441            std::mem::size_of::<u32>()
442        }
443
444        #[inline(always)]
445        fn encode_is_copy() -> bool {
446            false
447        }
448
449        #[inline(always)]
450        fn decode_is_copy() -> bool {
451            false
452        }
453    }
454
455    impl fidl::encoding::ValueTypeMarker for CompositeEffectWaveform {
456        type Borrowed<'a> = Self;
457        #[inline(always)]
458        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
459            *value
460        }
461    }
462
463    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
464        for CompositeEffectWaveform
465    {
466        #[inline]
467        unsafe fn encode(
468            self,
469            encoder: &mut fidl::encoding::Encoder<'_, D>,
470            offset: usize,
471            _depth: fidl::encoding::Depth,
472        ) -> fidl::Result<()> {
473            encoder.debug_check_bounds::<Self>(offset);
474            encoder.write_num(self.into_primitive(), offset);
475            Ok(())
476        }
477    }
478
479    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
480        for CompositeEffectWaveform
481    {
482        #[inline(always)]
483        fn new_empty() -> Self {
484            Self::unknown()
485        }
486
487        #[inline]
488        unsafe fn decode(
489            &mut self,
490            decoder: &mut fidl::encoding::Decoder<'_, D>,
491            offset: usize,
492            _depth: fidl::encoding::Depth,
493        ) -> fidl::Result<()> {
494            decoder.debug_check_bounds::<Self>(offset);
495            let prim = decoder.read_num::<u32>(offset);
496
497            *self = Self::from_primitive_allow_unknown(prim);
498            Ok(())
499        }
500    }
501    unsafe impl fidl::encoding::TypeMarker for Effect {
502        type Owned = Self;
503
504        #[inline(always)]
505        fn inline_align(_context: fidl::encoding::Context) -> usize {
506            std::mem::align_of::<u32>()
507        }
508
509        #[inline(always)]
510        fn inline_size(_context: fidl::encoding::Context) -> usize {
511            std::mem::size_of::<u32>()
512        }
513
514        #[inline(always)]
515        fn encode_is_copy() -> bool {
516            false
517        }
518
519        #[inline(always)]
520        fn decode_is_copy() -> bool {
521            false
522        }
523    }
524
525    impl fidl::encoding::ValueTypeMarker for Effect {
526        type Borrowed<'a> = Self;
527        #[inline(always)]
528        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
529            *value
530        }
531    }
532
533    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Effect {
534        #[inline]
535        unsafe fn encode(
536            self,
537            encoder: &mut fidl::encoding::Encoder<'_, D>,
538            offset: usize,
539            _depth: fidl::encoding::Depth,
540        ) -> fidl::Result<()> {
541            encoder.debug_check_bounds::<Self>(offset);
542            encoder.write_num(self.into_primitive(), offset);
543            Ok(())
544        }
545    }
546
547    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Effect {
548        #[inline(always)]
549        fn new_empty() -> Self {
550            Self::unknown()
551        }
552
553        #[inline]
554        unsafe fn decode(
555            &mut self,
556            decoder: &mut fidl::encoding::Decoder<'_, D>,
557            offset: usize,
558            _depth: fidl::encoding::Depth,
559        ) -> fidl::Result<()> {
560            decoder.debug_check_bounds::<Self>(offset);
561            let prim = decoder.read_num::<u32>(offset);
562
563            *self = Self::from_primitive_allow_unknown(prim);
564            Ok(())
565        }
566    }
567    unsafe impl fidl::encoding::TypeMarker for EffectStrength {
568        type Owned = Self;
569
570        #[inline(always)]
571        fn inline_align(_context: fidl::encoding::Context) -> usize {
572            std::mem::align_of::<u32>()
573        }
574
575        #[inline(always)]
576        fn inline_size(_context: fidl::encoding::Context) -> usize {
577            std::mem::size_of::<u32>()
578        }
579
580        #[inline(always)]
581        fn encode_is_copy() -> bool {
582            false
583        }
584
585        #[inline(always)]
586        fn decode_is_copy() -> bool {
587            false
588        }
589    }
590
591    impl fidl::encoding::ValueTypeMarker for EffectStrength {
592        type Borrowed<'a> = Self;
593        #[inline(always)]
594        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
595            *value
596        }
597    }
598
599    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for EffectStrength {
600        #[inline]
601        unsafe fn encode(
602            self,
603            encoder: &mut fidl::encoding::Encoder<'_, D>,
604            offset: usize,
605            _depth: fidl::encoding::Depth,
606        ) -> fidl::Result<()> {
607            encoder.debug_check_bounds::<Self>(offset);
608            encoder.write_num(self.into_primitive(), offset);
609            Ok(())
610        }
611    }
612
613    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EffectStrength {
614        #[inline(always)]
615        fn new_empty() -> Self {
616            Self::unknown()
617        }
618
619        #[inline]
620        unsafe fn decode(
621            &mut self,
622            decoder: &mut fidl::encoding::Decoder<'_, D>,
623            offset: usize,
624            _depth: fidl::encoding::Depth,
625        ) -> fidl::Result<()> {
626            decoder.debug_check_bounds::<Self>(offset);
627            let prim = decoder.read_num::<u32>(offset);
628
629            *self = Self::from_primitive_allow_unknown(prim);
630            Ok(())
631        }
632    }
633
634    impl fidl::encoding::ValueTypeMarker for CompositeEffect {
635        type Borrowed<'a> = &'a Self;
636        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
637            value
638        }
639    }
640
641    unsafe impl fidl::encoding::TypeMarker for CompositeEffect {
642        type Owned = Self;
643
644        #[inline(always)]
645        fn inline_align(_context: fidl::encoding::Context) -> usize {
646            8
647        }
648
649        #[inline(always)]
650        fn inline_size(_context: fidl::encoding::Context) -> usize {
651            16
652        }
653    }
654
655    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CompositeEffect, D>
656        for &CompositeEffect
657    {
658        #[inline]
659        unsafe fn encode(
660            self,
661            encoder: &mut fidl::encoding::Encoder<'_, D>,
662            offset: usize,
663            _depth: fidl::encoding::Depth,
664        ) -> fidl::Result<()> {
665            encoder.debug_check_bounds::<CompositeEffect>(offset);
666            // Delegate to tuple encoding.
667            fidl::encoding::Encode::<CompositeEffect, D>::encode(
668                (
669                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.delay),
670                    <CompositeEffectWaveform as fidl::encoding::ValueTypeMarker>::borrow(
671                        &self.waveform,
672                    ),
673                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),
674                ),
675                encoder,
676                offset,
677                _depth,
678            )
679        }
680    }
681    unsafe impl<
682        D: fidl::encoding::ResourceDialect,
683        T0: fidl::encoding::Encode<i64, D>,
684        T1: fidl::encoding::Encode<CompositeEffectWaveform, D>,
685        T2: fidl::encoding::Encode<f32, D>,
686    > fidl::encoding::Encode<CompositeEffect, D> for (T0, T1, T2)
687    {
688        #[inline]
689        unsafe fn encode(
690            self,
691            encoder: &mut fidl::encoding::Encoder<'_, D>,
692            offset: usize,
693            depth: fidl::encoding::Depth,
694        ) -> fidl::Result<()> {
695            encoder.debug_check_bounds::<CompositeEffect>(offset);
696            // Zero out padding regions. There's no need to apply masks
697            // because the unmasked parts will be overwritten by fields.
698            // Write the fields.
699            self.0.encode(encoder, offset + 0, depth)?;
700            self.1.encode(encoder, offset + 8, depth)?;
701            self.2.encode(encoder, offset + 12, depth)?;
702            Ok(())
703        }
704    }
705
706    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CompositeEffect {
707        #[inline(always)]
708        fn new_empty() -> Self {
709            Self {
710                delay: fidl::new_empty!(i64, D),
711                waveform: fidl::new_empty!(CompositeEffectWaveform, D),
712                scale: fidl::new_empty!(f32, D),
713            }
714        }
715
716        #[inline]
717        unsafe fn decode(
718            &mut self,
719            decoder: &mut fidl::encoding::Decoder<'_, D>,
720            offset: usize,
721            _depth: fidl::encoding::Depth,
722        ) -> fidl::Result<()> {
723            decoder.debug_check_bounds::<Self>(offset);
724            // Verify that padding bytes are zero.
725            fidl::decode!(i64, D, &mut self.delay, decoder, offset + 0, _depth)?;
726            fidl::decode!(
727                CompositeEffectWaveform,
728                D,
729                &mut self.waveform,
730                decoder,
731                offset + 8,
732                _depth
733            )?;
734            fidl::decode!(f32, D, &mut self.scale, decoder, offset + 12, _depth)?;
735            Ok(())
736        }
737    }
738
739    impl fidl::encoding::ValueTypeMarker for DevicePlayCompositeWaveformRequest {
740        type Borrowed<'a> = &'a Self;
741        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
742            value
743        }
744    }
745
746    unsafe impl fidl::encoding::TypeMarker for DevicePlayCompositeWaveformRequest {
747        type Owned = Self;
748
749        #[inline(always)]
750        fn inline_align(_context: fidl::encoding::Context) -> usize {
751            8
752        }
753
754        #[inline(always)]
755        fn inline_size(_context: fidl::encoding::Context) -> usize {
756            16
757        }
758    }
759
760    unsafe impl<D: fidl::encoding::ResourceDialect>
761        fidl::encoding::Encode<DevicePlayCompositeWaveformRequest, D>
762        for &DevicePlayCompositeWaveformRequest
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::<DevicePlayCompositeWaveformRequest>(offset);
772            // Delegate to tuple encoding.
773            fidl::encoding::Encode::<DevicePlayCompositeWaveformRequest, D>::encode(
774                (
775                    <fidl::encoding::UnboundedVector<CompositeEffect> as fidl::encoding::ValueTypeMarker>::borrow(&self.composite_waveform),
776                ),
777                encoder, offset, _depth
778            )
779        }
780    }
781    unsafe impl<
782        D: fidl::encoding::ResourceDialect,
783        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<CompositeEffect>, D>,
784    > fidl::encoding::Encode<DevicePlayCompositeWaveformRequest, D> for (T0,)
785    {
786        #[inline]
787        unsafe fn encode(
788            self,
789            encoder: &mut fidl::encoding::Encoder<'_, D>,
790            offset: usize,
791            depth: fidl::encoding::Depth,
792        ) -> fidl::Result<()> {
793            encoder.debug_check_bounds::<DevicePlayCompositeWaveformRequest>(offset);
794            // Zero out padding regions. There's no need to apply masks
795            // because the unmasked parts will be overwritten by fields.
796            // Write the fields.
797            self.0.encode(encoder, offset + 0, depth)?;
798            Ok(())
799        }
800    }
801
802    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
803        for DevicePlayCompositeWaveformRequest
804    {
805        #[inline(always)]
806        fn new_empty() -> Self {
807            Self {
808                composite_waveform: fidl::new_empty!(
809                    fidl::encoding::UnboundedVector<CompositeEffect>,
810                    D
811                ),
812            }
813        }
814
815        #[inline]
816        unsafe fn decode(
817            &mut self,
818            decoder: &mut fidl::encoding::Decoder<'_, D>,
819            offset: usize,
820            _depth: fidl::encoding::Depth,
821        ) -> fidl::Result<()> {
822            decoder.debug_check_bounds::<Self>(offset);
823            // Verify that padding bytes are zero.
824            fidl::decode!(
825                fidl::encoding::UnboundedVector<CompositeEffect>,
826                D,
827                &mut self.composite_waveform,
828                decoder,
829                offset + 0,
830                _depth
831            )?;
832            Ok(())
833        }
834    }
835
836    impl fidl::encoding::ValueTypeMarker for DevicePlayEffectRequest {
837        type Borrowed<'a> = &'a Self;
838        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
839            value
840        }
841    }
842
843    unsafe impl fidl::encoding::TypeMarker for DevicePlayEffectRequest {
844        type Owned = Self;
845
846        #[inline(always)]
847        fn inline_align(_context: fidl::encoding::Context) -> usize {
848            4
849        }
850
851        #[inline(always)]
852        fn inline_size(_context: fidl::encoding::Context) -> usize {
853            8
854        }
855    }
856
857    unsafe impl<D: fidl::encoding::ResourceDialect>
858        fidl::encoding::Encode<DevicePlayEffectRequest, D> for &DevicePlayEffectRequest
859    {
860        #[inline]
861        unsafe fn encode(
862            self,
863            encoder: &mut fidl::encoding::Encoder<'_, D>,
864            offset: usize,
865            _depth: fidl::encoding::Depth,
866        ) -> fidl::Result<()> {
867            encoder.debug_check_bounds::<DevicePlayEffectRequest>(offset);
868            // Delegate to tuple encoding.
869            fidl::encoding::Encode::<DevicePlayEffectRequest, D>::encode(
870                (
871                    <Effect as fidl::encoding::ValueTypeMarker>::borrow(&self.effect),
872                    <EffectStrength as fidl::encoding::ValueTypeMarker>::borrow(&self.strength),
873                ),
874                encoder,
875                offset,
876                _depth,
877            )
878        }
879    }
880    unsafe impl<
881        D: fidl::encoding::ResourceDialect,
882        T0: fidl::encoding::Encode<Effect, D>,
883        T1: fidl::encoding::Encode<EffectStrength, D>,
884    > fidl::encoding::Encode<DevicePlayEffectRequest, D> for (T0, T1)
885    {
886        #[inline]
887        unsafe fn encode(
888            self,
889            encoder: &mut fidl::encoding::Encoder<'_, D>,
890            offset: usize,
891            depth: fidl::encoding::Depth,
892        ) -> fidl::Result<()> {
893            encoder.debug_check_bounds::<DevicePlayEffectRequest>(offset);
894            // Zero out padding regions. There's no need to apply masks
895            // because the unmasked parts will be overwritten by fields.
896            // Write the fields.
897            self.0.encode(encoder, offset + 0, depth)?;
898            self.1.encode(encoder, offset + 4, depth)?;
899            Ok(())
900        }
901    }
902
903    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
904        for DevicePlayEffectRequest
905    {
906        #[inline(always)]
907        fn new_empty() -> Self {
908            Self {
909                effect: fidl::new_empty!(Effect, D),
910                strength: fidl::new_empty!(EffectStrength, D),
911            }
912        }
913
914        #[inline]
915        unsafe fn decode(
916            &mut self,
917            decoder: &mut fidl::encoding::Decoder<'_, D>,
918            offset: usize,
919            _depth: fidl::encoding::Depth,
920        ) -> fidl::Result<()> {
921            decoder.debug_check_bounds::<Self>(offset);
922            // Verify that padding bytes are zero.
923            fidl::decode!(Effect, D, &mut self.effect, decoder, offset + 0, _depth)?;
924            fidl::decode!(EffectStrength, D, &mut self.strength, decoder, offset + 4, _depth)?;
925            Ok(())
926        }
927    }
928
929    impl fidl::encoding::ValueTypeMarker for DevicePlayVibrationRequest {
930        type Borrowed<'a> = &'a Self;
931        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
932            value
933        }
934    }
935
936    unsafe impl fidl::encoding::TypeMarker for DevicePlayVibrationRequest {
937        type Owned = Self;
938
939        #[inline(always)]
940        fn inline_align(_context: fidl::encoding::Context) -> usize {
941            8
942        }
943
944        #[inline(always)]
945        fn inline_size(_context: fidl::encoding::Context) -> usize {
946            8
947        }
948        #[inline(always)]
949        fn encode_is_copy() -> bool {
950            true
951        }
952
953        #[inline(always)]
954        fn decode_is_copy() -> bool {
955            true
956        }
957    }
958
959    unsafe impl<D: fidl::encoding::ResourceDialect>
960        fidl::encoding::Encode<DevicePlayVibrationRequest, D> for &DevicePlayVibrationRequest
961    {
962        #[inline]
963        unsafe fn encode(
964            self,
965            encoder: &mut fidl::encoding::Encoder<'_, D>,
966            offset: usize,
967            _depth: fidl::encoding::Depth,
968        ) -> fidl::Result<()> {
969            encoder.debug_check_bounds::<DevicePlayVibrationRequest>(offset);
970            unsafe {
971                // Copy the object into the buffer.
972                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
973                (buf_ptr as *mut DevicePlayVibrationRequest)
974                    .write_unaligned((self as *const DevicePlayVibrationRequest).read());
975                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
976                // done second because the memcpy will write garbage to these bytes.
977            }
978            Ok(())
979        }
980    }
981    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
982        fidl::encoding::Encode<DevicePlayVibrationRequest, D> for (T0,)
983    {
984        #[inline]
985        unsafe fn encode(
986            self,
987            encoder: &mut fidl::encoding::Encoder<'_, D>,
988            offset: usize,
989            depth: fidl::encoding::Depth,
990        ) -> fidl::Result<()> {
991            encoder.debug_check_bounds::<DevicePlayVibrationRequest>(offset);
992            // Zero out padding regions. There's no need to apply masks
993            // because the unmasked parts will be overwritten by fields.
994            // Write the fields.
995            self.0.encode(encoder, offset + 0, depth)?;
996            Ok(())
997        }
998    }
999
1000    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1001        for DevicePlayVibrationRequest
1002    {
1003        #[inline(always)]
1004        fn new_empty() -> Self {
1005            Self { duration: fidl::new_empty!(i64, D) }
1006        }
1007
1008        #[inline]
1009        unsafe fn decode(
1010            &mut self,
1011            decoder: &mut fidl::encoding::Decoder<'_, D>,
1012            offset: usize,
1013            _depth: fidl::encoding::Depth,
1014        ) -> fidl::Result<()> {
1015            decoder.debug_check_bounds::<Self>(offset);
1016            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1017            // Verify that padding bytes are zero.
1018            // Copy from the buffer into the object.
1019            unsafe {
1020                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1021            }
1022            Ok(())
1023        }
1024    }
1025
1026    impl fidl::encoding::ValueTypeMarker for DeviceSetAmplitudeRequest {
1027        type Borrowed<'a> = &'a Self;
1028        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1029            value
1030        }
1031    }
1032
1033    unsafe impl fidl::encoding::TypeMarker for DeviceSetAmplitudeRequest {
1034        type Owned = Self;
1035
1036        #[inline(always)]
1037        fn inline_align(_context: fidl::encoding::Context) -> usize {
1038            4
1039        }
1040
1041        #[inline(always)]
1042        fn inline_size(_context: fidl::encoding::Context) -> usize {
1043            4
1044        }
1045    }
1046
1047    unsafe impl<D: fidl::encoding::ResourceDialect>
1048        fidl::encoding::Encode<DeviceSetAmplitudeRequest, D> for &DeviceSetAmplitudeRequest
1049    {
1050        #[inline]
1051        unsafe fn encode(
1052            self,
1053            encoder: &mut fidl::encoding::Encoder<'_, D>,
1054            offset: usize,
1055            _depth: fidl::encoding::Depth,
1056        ) -> fidl::Result<()> {
1057            encoder.debug_check_bounds::<DeviceSetAmplitudeRequest>(offset);
1058            // Delegate to tuple encoding.
1059            fidl::encoding::Encode::<DeviceSetAmplitudeRequest, D>::encode(
1060                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.amplitude),),
1061                encoder,
1062                offset,
1063                _depth,
1064            )
1065        }
1066    }
1067    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
1068        fidl::encoding::Encode<DeviceSetAmplitudeRequest, D> for (T0,)
1069    {
1070        #[inline]
1071        unsafe fn encode(
1072            self,
1073            encoder: &mut fidl::encoding::Encoder<'_, D>,
1074            offset: usize,
1075            depth: fidl::encoding::Depth,
1076        ) -> fidl::Result<()> {
1077            encoder.debug_check_bounds::<DeviceSetAmplitudeRequest>(offset);
1078            // Zero out padding regions. There's no need to apply masks
1079            // because the unmasked parts will be overwritten by fields.
1080            // Write the fields.
1081            self.0.encode(encoder, offset + 0, depth)?;
1082            Ok(())
1083        }
1084    }
1085
1086    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1087        for DeviceSetAmplitudeRequest
1088    {
1089        #[inline(always)]
1090        fn new_empty() -> Self {
1091            Self { amplitude: fidl::new_empty!(f32, D) }
1092        }
1093
1094        #[inline]
1095        unsafe fn decode(
1096            &mut self,
1097            decoder: &mut fidl::encoding::Decoder<'_, D>,
1098            offset: usize,
1099            _depth: fidl::encoding::Depth,
1100        ) -> fidl::Result<()> {
1101            decoder.debug_check_bounds::<Self>(offset);
1102            // Verify that padding bytes are zero.
1103            fidl::decode!(f32, D, &mut self.amplitude, decoder, offset + 0, _depth)?;
1104            Ok(())
1105        }
1106    }
1107
1108    impl fidl::encoding::ValueTypeMarker for DeviceGetPropertiesResponse {
1109        type Borrowed<'a> = &'a Self;
1110        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1111            value
1112        }
1113    }
1114
1115    unsafe impl fidl::encoding::TypeMarker for DeviceGetPropertiesResponse {
1116        type Owned = Self;
1117
1118        #[inline(always)]
1119        fn inline_align(_context: fidl::encoding::Context) -> usize {
1120            8
1121        }
1122
1123        #[inline(always)]
1124        fn inline_size(_context: fidl::encoding::Context) -> usize {
1125            56
1126        }
1127    }
1128
1129    unsafe impl<D: fidl::encoding::ResourceDialect>
1130        fidl::encoding::Encode<DeviceGetPropertiesResponse, D> for &DeviceGetPropertiesResponse
1131    {
1132        #[inline]
1133        unsafe fn encode(
1134            self,
1135            encoder: &mut fidl::encoding::Encoder<'_, D>,
1136            offset: usize,
1137            _depth: fidl::encoding::Depth,
1138        ) -> fidl::Result<()> {
1139            encoder.debug_check_bounds::<DeviceGetPropertiesResponse>(offset);
1140            // Delegate to tuple encoding.
1141            fidl::encoding::Encode::<DeviceGetPropertiesResponse, D>::encode(
1142                (
1143                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.fundamental_resonant_frequency_hz),
1144                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.quality_factor),
1145                    <fidl::encoding::UnboundedVector<SupportedEffect> as fidl::encoding::ValueTypeMarker>::borrow(&self.supported_effects),
1146                    <fidl::encoding::UnboundedVector<SupportedCompositeEffectWaveform> as fidl::encoding::ValueTypeMarker>::borrow(&self.supported_composite_effect_waveforms),
1147                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_composite_waveform_effect_count),
1148                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_composite_effect_delay),
1149                ),
1150                encoder, offset, _depth
1151            )
1152        }
1153    }
1154    unsafe impl<
1155        D: fidl::encoding::ResourceDialect,
1156        T0: fidl::encoding::Encode<f32, D>,
1157        T1: fidl::encoding::Encode<f32, D>,
1158        T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<SupportedEffect>, D>,
1159        T3: fidl::encoding::Encode<
1160                fidl::encoding::UnboundedVector<SupportedCompositeEffectWaveform>,
1161                D,
1162            >,
1163        T4: fidl::encoding::Encode<u64, D>,
1164        T5: fidl::encoding::Encode<i64, D>,
1165    > fidl::encoding::Encode<DeviceGetPropertiesResponse, D> for (T0, T1, T2, T3, T4, T5)
1166    {
1167        #[inline]
1168        unsafe fn encode(
1169            self,
1170            encoder: &mut fidl::encoding::Encoder<'_, D>,
1171            offset: usize,
1172            depth: fidl::encoding::Depth,
1173        ) -> fidl::Result<()> {
1174            encoder.debug_check_bounds::<DeviceGetPropertiesResponse>(offset);
1175            // Zero out padding regions. There's no need to apply masks
1176            // because the unmasked parts will be overwritten by fields.
1177            // Write the fields.
1178            self.0.encode(encoder, offset + 0, depth)?;
1179            self.1.encode(encoder, offset + 4, depth)?;
1180            self.2.encode(encoder, offset + 8, depth)?;
1181            self.3.encode(encoder, offset + 24, depth)?;
1182            self.4.encode(encoder, offset + 40, depth)?;
1183            self.5.encode(encoder, offset + 48, depth)?;
1184            Ok(())
1185        }
1186    }
1187
1188    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1189        for DeviceGetPropertiesResponse
1190    {
1191        #[inline(always)]
1192        fn new_empty() -> Self {
1193            Self {
1194                fundamental_resonant_frequency_hz: fidl::new_empty!(f32, D),
1195                quality_factor: fidl::new_empty!(f32, D),
1196                supported_effects: fidl::new_empty!(
1197                    fidl::encoding::UnboundedVector<SupportedEffect>,
1198                    D
1199                ),
1200                supported_composite_effect_waveforms: fidl::new_empty!(
1201                    fidl::encoding::UnboundedVector<SupportedCompositeEffectWaveform>,
1202                    D
1203                ),
1204                max_composite_waveform_effect_count: fidl::new_empty!(u64, D),
1205                max_composite_effect_delay: fidl::new_empty!(i64, D),
1206            }
1207        }
1208
1209        #[inline]
1210        unsafe fn decode(
1211            &mut self,
1212            decoder: &mut fidl::encoding::Decoder<'_, D>,
1213            offset: usize,
1214            _depth: fidl::encoding::Depth,
1215        ) -> fidl::Result<()> {
1216            decoder.debug_check_bounds::<Self>(offset);
1217            // Verify that padding bytes are zero.
1218            fidl::decode!(
1219                f32,
1220                D,
1221                &mut self.fundamental_resonant_frequency_hz,
1222                decoder,
1223                offset + 0,
1224                _depth
1225            )?;
1226            fidl::decode!(f32, D, &mut self.quality_factor, decoder, offset + 4, _depth)?;
1227            fidl::decode!(
1228                fidl::encoding::UnboundedVector<SupportedEffect>,
1229                D,
1230                &mut self.supported_effects,
1231                decoder,
1232                offset + 8,
1233                _depth
1234            )?;
1235            fidl::decode!(
1236                fidl::encoding::UnboundedVector<SupportedCompositeEffectWaveform>,
1237                D,
1238                &mut self.supported_composite_effect_waveforms,
1239                decoder,
1240                offset + 24,
1241                _depth
1242            )?;
1243            fidl::decode!(
1244                u64,
1245                D,
1246                &mut self.max_composite_waveform_effect_count,
1247                decoder,
1248                offset + 40,
1249                _depth
1250            )?;
1251            fidl::decode!(
1252                i64,
1253                D,
1254                &mut self.max_composite_effect_delay,
1255                decoder,
1256                offset + 48,
1257                _depth
1258            )?;
1259            Ok(())
1260        }
1261    }
1262
1263    impl fidl::encoding::ValueTypeMarker for SupportedCompositeEffectWaveform {
1264        type Borrowed<'a> = &'a Self;
1265        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1266            value
1267        }
1268    }
1269
1270    unsafe impl fidl::encoding::TypeMarker for SupportedCompositeEffectWaveform {
1271        type Owned = Self;
1272
1273        #[inline(always)]
1274        fn inline_align(_context: fidl::encoding::Context) -> usize {
1275            8
1276        }
1277
1278        #[inline(always)]
1279        fn inline_size(_context: fidl::encoding::Context) -> usize {
1280            16
1281        }
1282    }
1283
1284    unsafe impl<D: fidl::encoding::ResourceDialect>
1285        fidl::encoding::Encode<SupportedCompositeEffectWaveform, D>
1286        for &SupportedCompositeEffectWaveform
1287    {
1288        #[inline]
1289        unsafe fn encode(
1290            self,
1291            encoder: &mut fidl::encoding::Encoder<'_, D>,
1292            offset: usize,
1293            _depth: fidl::encoding::Depth,
1294        ) -> fidl::Result<()> {
1295            encoder.debug_check_bounds::<SupportedCompositeEffectWaveform>(offset);
1296            // Delegate to tuple encoding.
1297            fidl::encoding::Encode::<SupportedCompositeEffectWaveform, D>::encode(
1298                (
1299                    <CompositeEffectWaveform as fidl::encoding::ValueTypeMarker>::borrow(
1300                        &self.waveform,
1301                    ),
1302                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration),
1303                ),
1304                encoder,
1305                offset,
1306                _depth,
1307            )
1308        }
1309    }
1310    unsafe impl<
1311        D: fidl::encoding::ResourceDialect,
1312        T0: fidl::encoding::Encode<CompositeEffectWaveform, D>,
1313        T1: fidl::encoding::Encode<i64, D>,
1314    > fidl::encoding::Encode<SupportedCompositeEffectWaveform, D> for (T0, T1)
1315    {
1316        #[inline]
1317        unsafe fn encode(
1318            self,
1319            encoder: &mut fidl::encoding::Encoder<'_, D>,
1320            offset: usize,
1321            depth: fidl::encoding::Depth,
1322        ) -> fidl::Result<()> {
1323            encoder.debug_check_bounds::<SupportedCompositeEffectWaveform>(offset);
1324            // Zero out padding regions. There's no need to apply masks
1325            // because the unmasked parts will be overwritten by fields.
1326            unsafe {
1327                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1328                (ptr as *mut u64).write_unaligned(0);
1329            }
1330            // Write the fields.
1331            self.0.encode(encoder, offset + 0, depth)?;
1332            self.1.encode(encoder, offset + 8, depth)?;
1333            Ok(())
1334        }
1335    }
1336
1337    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1338        for SupportedCompositeEffectWaveform
1339    {
1340        #[inline(always)]
1341        fn new_empty() -> Self {
1342            Self {
1343                waveform: fidl::new_empty!(CompositeEffectWaveform, D),
1344                duration: fidl::new_empty!(i64, D),
1345            }
1346        }
1347
1348        #[inline]
1349        unsafe fn decode(
1350            &mut self,
1351            decoder: &mut fidl::encoding::Decoder<'_, D>,
1352            offset: usize,
1353            _depth: fidl::encoding::Depth,
1354        ) -> fidl::Result<()> {
1355            decoder.debug_check_bounds::<Self>(offset);
1356            // Verify that padding bytes are zero.
1357            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1358            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1359            let mask = 0xffffffff00000000u64;
1360            let maskedval = padval & mask;
1361            if maskedval != 0 {
1362                return Err(fidl::Error::NonZeroPadding {
1363                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1364                });
1365            }
1366            fidl::decode!(
1367                CompositeEffectWaveform,
1368                D,
1369                &mut self.waveform,
1370                decoder,
1371                offset + 0,
1372                _depth
1373            )?;
1374            fidl::decode!(i64, D, &mut self.duration, decoder, offset + 8, _depth)?;
1375            Ok(())
1376        }
1377    }
1378
1379    impl fidl::encoding::ValueTypeMarker for SupportedEffect {
1380        type Borrowed<'a> = &'a Self;
1381        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1382            value
1383        }
1384    }
1385
1386    unsafe impl fidl::encoding::TypeMarker for SupportedEffect {
1387        type Owned = Self;
1388
1389        #[inline(always)]
1390        fn inline_align(_context: fidl::encoding::Context) -> usize {
1391            8
1392        }
1393
1394        #[inline(always)]
1395        fn inline_size(_context: fidl::encoding::Context) -> usize {
1396            16
1397        }
1398    }
1399
1400    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SupportedEffect, D>
1401        for &SupportedEffect
1402    {
1403        #[inline]
1404        unsafe fn encode(
1405            self,
1406            encoder: &mut fidl::encoding::Encoder<'_, D>,
1407            offset: usize,
1408            _depth: fidl::encoding::Depth,
1409        ) -> fidl::Result<()> {
1410            encoder.debug_check_bounds::<SupportedEffect>(offset);
1411            // Delegate to tuple encoding.
1412            fidl::encoding::Encode::<SupportedEffect, D>::encode(
1413                (
1414                    <Effect as fidl::encoding::ValueTypeMarker>::borrow(&self.effect),
1415                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration),
1416                ),
1417                encoder,
1418                offset,
1419                _depth,
1420            )
1421        }
1422    }
1423    unsafe impl<
1424        D: fidl::encoding::ResourceDialect,
1425        T0: fidl::encoding::Encode<Effect, D>,
1426        T1: fidl::encoding::Encode<i64, D>,
1427    > fidl::encoding::Encode<SupportedEffect, D> for (T0, T1)
1428    {
1429        #[inline]
1430        unsafe fn encode(
1431            self,
1432            encoder: &mut fidl::encoding::Encoder<'_, D>,
1433            offset: usize,
1434            depth: fidl::encoding::Depth,
1435        ) -> fidl::Result<()> {
1436            encoder.debug_check_bounds::<SupportedEffect>(offset);
1437            // Zero out padding regions. There's no need to apply masks
1438            // because the unmasked parts will be overwritten by fields.
1439            unsafe {
1440                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1441                (ptr as *mut u64).write_unaligned(0);
1442            }
1443            // Write the fields.
1444            self.0.encode(encoder, offset + 0, depth)?;
1445            self.1.encode(encoder, offset + 8, depth)?;
1446            Ok(())
1447        }
1448    }
1449
1450    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SupportedEffect {
1451        #[inline(always)]
1452        fn new_empty() -> Self {
1453            Self { effect: fidl::new_empty!(Effect, D), duration: fidl::new_empty!(i64, D) }
1454        }
1455
1456        #[inline]
1457        unsafe fn decode(
1458            &mut self,
1459            decoder: &mut fidl::encoding::Decoder<'_, D>,
1460            offset: usize,
1461            _depth: fidl::encoding::Depth,
1462        ) -> fidl::Result<()> {
1463            decoder.debug_check_bounds::<Self>(offset);
1464            // Verify that padding bytes are zero.
1465            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1466            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1467            let mask = 0xffffffff00000000u64;
1468            let maskedval = padval & mask;
1469            if maskedval != 0 {
1470                return Err(fidl::Error::NonZeroPadding {
1471                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1472                });
1473            }
1474            fidl::decode!(Effect, D, &mut self.effect, decoder, offset + 0, _depth)?;
1475            fidl::decode!(i64, D, &mut self.duration, decoder, offset + 8, _depth)?;
1476            Ok(())
1477        }
1478    }
1479}