1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_EFFECT_NAME_LENGTH: u32 = 128;
12
13pub const MAX_GAIN_DB: f32 = 24.0;
15
16pub const MAX_VOLUME: f32 = 1.0;
18
19pub const MIN_VOLUME: f32 = 0.0;
21
22pub const MUTED_GAIN_DB: f32 = -160.0;
25
26#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
28#[repr(u16)]
29pub enum RampType {
30 ScaleLinear = 1,
32}
33
34impl RampType {
35 #[inline]
36 pub fn from_primitive(prim: u16) -> Option<Self> {
37 match prim {
38 1 => Some(Self::ScaleLinear),
39 _ => None,
40 }
41 }
42
43 #[inline]
44 pub const fn into_primitive(self) -> u16 {
45 self as u16
46 }
47}
48
49#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
50#[repr(u32)]
51pub enum UpdateEffectError {
52 InvalidConfig = 1,
53 NotFound = 2,
54}
55
56impl UpdateEffectError {
57 #[inline]
58 pub fn from_primitive(prim: u32) -> Option<Self> {
59 match prim {
60 1 => Some(Self::InvalidConfig),
61 2 => Some(Self::NotFound),
62 _ => None,
63 }
64 }
65
66 #[inline]
67 pub const fn into_primitive(self) -> u32 {
68 self as u32
69 }
70}
71
72#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
73pub struct EffectsControllerUpdateEffectRequest {
74 pub effect_name: String,
75 pub config: String,
76}
77
78impl fidl::Persistable for EffectsControllerUpdateEffectRequest {}
79
80#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
81pub struct GainControlOnGainMuteChangedRequest {
82 pub gain_db: f32,
83 pub muted: bool,
84}
85
86impl fidl::Persistable for GainControlOnGainMuteChangedRequest {}
87
88#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
89pub struct GainControlSetGainRequest {
90 pub gain_db: f32,
91}
92
93impl fidl::Persistable for GainControlSetGainRequest {}
94
95#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
96pub struct GainControlSetGainWithRampRequest {
97 pub gain_db: f32,
98 pub duration: i64,
99 pub ramp_type: RampType,
100}
101
102impl fidl::Persistable for GainControlSetGainWithRampRequest {}
103
104#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub struct GainControlSetMuteRequest {
106 pub muted: bool,
107}
108
109impl fidl::Persistable for GainControlSetMuteRequest {}
110
111#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
112pub struct VolumeControlOnVolumeMuteChangedRequest {
113 pub new_volume: f32,
114 pub new_muted: bool,
115}
116
117impl fidl::Persistable for VolumeControlOnVolumeMuteChangedRequest {}
118
119#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
120pub struct VolumeControlSetMuteRequest {
121 pub mute: bool,
122}
123
124impl fidl::Persistable for VolumeControlSetMuteRequest {}
125
126#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
127pub struct VolumeControlSetVolumeRequest {
128 pub volume: f32,
129}
130
131impl fidl::Persistable for VolumeControlSetVolumeRequest {}
132
133mod internal {
134 use super::*;
135 unsafe impl fidl::encoding::TypeMarker for RampType {
136 type Owned = Self;
137
138 #[inline(always)]
139 fn inline_align(_context: fidl::encoding::Context) -> usize {
140 std::mem::align_of::<u16>()
141 }
142
143 #[inline(always)]
144 fn inline_size(_context: fidl::encoding::Context) -> usize {
145 std::mem::size_of::<u16>()
146 }
147
148 #[inline(always)]
149 fn encode_is_copy() -> bool {
150 true
151 }
152
153 #[inline(always)]
154 fn decode_is_copy() -> bool {
155 false
156 }
157 }
158
159 impl fidl::encoding::ValueTypeMarker for RampType {
160 type Borrowed<'a> = Self;
161 #[inline(always)]
162 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
163 *value
164 }
165 }
166
167 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RampType {
168 #[inline]
169 unsafe fn encode(
170 self,
171 encoder: &mut fidl::encoding::Encoder<'_, D>,
172 offset: usize,
173 _depth: fidl::encoding::Depth,
174 ) -> fidl::Result<()> {
175 encoder.debug_check_bounds::<Self>(offset);
176 encoder.write_num(self.into_primitive(), offset);
177 Ok(())
178 }
179 }
180
181 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RampType {
182 #[inline(always)]
183 fn new_empty() -> Self {
184 Self::ScaleLinear
185 }
186
187 #[inline]
188 unsafe fn decode(
189 &mut self,
190 decoder: &mut fidl::encoding::Decoder<'_, D>,
191 offset: usize,
192 _depth: fidl::encoding::Depth,
193 ) -> fidl::Result<()> {
194 decoder.debug_check_bounds::<Self>(offset);
195 let prim = decoder.read_num::<u16>(offset);
196
197 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
198 Ok(())
199 }
200 }
201 unsafe impl fidl::encoding::TypeMarker for UpdateEffectError {
202 type Owned = Self;
203
204 #[inline(always)]
205 fn inline_align(_context: fidl::encoding::Context) -> usize {
206 std::mem::align_of::<u32>()
207 }
208
209 #[inline(always)]
210 fn inline_size(_context: fidl::encoding::Context) -> usize {
211 std::mem::size_of::<u32>()
212 }
213
214 #[inline(always)]
215 fn encode_is_copy() -> bool {
216 true
217 }
218
219 #[inline(always)]
220 fn decode_is_copy() -> bool {
221 false
222 }
223 }
224
225 impl fidl::encoding::ValueTypeMarker for UpdateEffectError {
226 type Borrowed<'a> = Self;
227 #[inline(always)]
228 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
229 *value
230 }
231 }
232
233 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
234 for UpdateEffectError
235 {
236 #[inline]
237 unsafe fn encode(
238 self,
239 encoder: &mut fidl::encoding::Encoder<'_, D>,
240 offset: usize,
241 _depth: fidl::encoding::Depth,
242 ) -> fidl::Result<()> {
243 encoder.debug_check_bounds::<Self>(offset);
244 encoder.write_num(self.into_primitive(), offset);
245 Ok(())
246 }
247 }
248
249 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UpdateEffectError {
250 #[inline(always)]
251 fn new_empty() -> Self {
252 Self::InvalidConfig
253 }
254
255 #[inline]
256 unsafe fn decode(
257 &mut self,
258 decoder: &mut fidl::encoding::Decoder<'_, D>,
259 offset: usize,
260 _depth: fidl::encoding::Depth,
261 ) -> fidl::Result<()> {
262 decoder.debug_check_bounds::<Self>(offset);
263 let prim = decoder.read_num::<u32>(offset);
264
265 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
266 Ok(())
267 }
268 }
269
270 impl fidl::encoding::ValueTypeMarker for EffectsControllerUpdateEffectRequest {
271 type Borrowed<'a> = &'a Self;
272 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
273 value
274 }
275 }
276
277 unsafe impl fidl::encoding::TypeMarker for EffectsControllerUpdateEffectRequest {
278 type Owned = Self;
279
280 #[inline(always)]
281 fn inline_align(_context: fidl::encoding::Context) -> usize {
282 8
283 }
284
285 #[inline(always)]
286 fn inline_size(_context: fidl::encoding::Context) -> usize {
287 32
288 }
289 }
290
291 unsafe impl<D: fidl::encoding::ResourceDialect>
292 fidl::encoding::Encode<EffectsControllerUpdateEffectRequest, D>
293 for &EffectsControllerUpdateEffectRequest
294 {
295 #[inline]
296 unsafe fn encode(
297 self,
298 encoder: &mut fidl::encoding::Encoder<'_, D>,
299 offset: usize,
300 _depth: fidl::encoding::Depth,
301 ) -> fidl::Result<()> {
302 encoder.debug_check_bounds::<EffectsControllerUpdateEffectRequest>(offset);
303 fidl::encoding::Encode::<EffectsControllerUpdateEffectRequest, D>::encode(
305 (
306 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
307 &self.effect_name,
308 ),
309 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
310 &self.config,
311 ),
312 ),
313 encoder,
314 offset,
315 _depth,
316 )
317 }
318 }
319 unsafe impl<
320 D: fidl::encoding::ResourceDialect,
321 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
322 T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
323 > fidl::encoding::Encode<EffectsControllerUpdateEffectRequest, D> for (T0, T1)
324 {
325 #[inline]
326 unsafe fn encode(
327 self,
328 encoder: &mut fidl::encoding::Encoder<'_, D>,
329 offset: usize,
330 depth: fidl::encoding::Depth,
331 ) -> fidl::Result<()> {
332 encoder.debug_check_bounds::<EffectsControllerUpdateEffectRequest>(offset);
333 self.0.encode(encoder, offset + 0, depth)?;
337 self.1.encode(encoder, offset + 16, depth)?;
338 Ok(())
339 }
340 }
341
342 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
343 for EffectsControllerUpdateEffectRequest
344 {
345 #[inline(always)]
346 fn new_empty() -> Self {
347 Self {
348 effect_name: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
349 config: fidl::new_empty!(fidl::encoding::UnboundedString, D),
350 }
351 }
352
353 #[inline]
354 unsafe fn decode(
355 &mut self,
356 decoder: &mut fidl::encoding::Decoder<'_, D>,
357 offset: usize,
358 _depth: fidl::encoding::Depth,
359 ) -> fidl::Result<()> {
360 decoder.debug_check_bounds::<Self>(offset);
361 fidl::decode!(
363 fidl::encoding::BoundedString<128>,
364 D,
365 &mut self.effect_name,
366 decoder,
367 offset + 0,
368 _depth
369 )?;
370 fidl::decode!(
371 fidl::encoding::UnboundedString,
372 D,
373 &mut self.config,
374 decoder,
375 offset + 16,
376 _depth
377 )?;
378 Ok(())
379 }
380 }
381
382 impl fidl::encoding::ValueTypeMarker for GainControlOnGainMuteChangedRequest {
383 type Borrowed<'a> = &'a Self;
384 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
385 value
386 }
387 }
388
389 unsafe impl fidl::encoding::TypeMarker for GainControlOnGainMuteChangedRequest {
390 type Owned = Self;
391
392 #[inline(always)]
393 fn inline_align(_context: fidl::encoding::Context) -> usize {
394 4
395 }
396
397 #[inline(always)]
398 fn inline_size(_context: fidl::encoding::Context) -> usize {
399 8
400 }
401 }
402
403 unsafe impl<D: fidl::encoding::ResourceDialect>
404 fidl::encoding::Encode<GainControlOnGainMuteChangedRequest, D>
405 for &GainControlOnGainMuteChangedRequest
406 {
407 #[inline]
408 unsafe fn encode(
409 self,
410 encoder: &mut fidl::encoding::Encoder<'_, D>,
411 offset: usize,
412 _depth: fidl::encoding::Depth,
413 ) -> fidl::Result<()> {
414 encoder.debug_check_bounds::<GainControlOnGainMuteChangedRequest>(offset);
415 fidl::encoding::Encode::<GainControlOnGainMuteChangedRequest, D>::encode(
417 (
418 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
419 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.muted),
420 ),
421 encoder,
422 offset,
423 _depth,
424 )
425 }
426 }
427 unsafe impl<
428 D: fidl::encoding::ResourceDialect,
429 T0: fidl::encoding::Encode<f32, D>,
430 T1: fidl::encoding::Encode<bool, D>,
431 > fidl::encoding::Encode<GainControlOnGainMuteChangedRequest, D> for (T0, T1)
432 {
433 #[inline]
434 unsafe fn encode(
435 self,
436 encoder: &mut fidl::encoding::Encoder<'_, D>,
437 offset: usize,
438 depth: fidl::encoding::Depth,
439 ) -> fidl::Result<()> {
440 encoder.debug_check_bounds::<GainControlOnGainMuteChangedRequest>(offset);
441 unsafe {
444 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
445 (ptr as *mut u32).write_unaligned(0);
446 }
447 self.0.encode(encoder, offset + 0, depth)?;
449 self.1.encode(encoder, offset + 4, depth)?;
450 Ok(())
451 }
452 }
453
454 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
455 for GainControlOnGainMuteChangedRequest
456 {
457 #[inline(always)]
458 fn new_empty() -> Self {
459 Self { gain_db: fidl::new_empty!(f32, D), muted: fidl::new_empty!(bool, D) }
460 }
461
462 #[inline]
463 unsafe fn decode(
464 &mut self,
465 decoder: &mut fidl::encoding::Decoder<'_, D>,
466 offset: usize,
467 _depth: fidl::encoding::Depth,
468 ) -> fidl::Result<()> {
469 decoder.debug_check_bounds::<Self>(offset);
470 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
472 let padval = unsafe { (ptr as *const u32).read_unaligned() };
473 let mask = 0xffffff00u32;
474 let maskedval = padval & mask;
475 if maskedval != 0 {
476 return Err(fidl::Error::NonZeroPadding {
477 padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
478 });
479 }
480 fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 0, _depth)?;
481 fidl::decode!(bool, D, &mut self.muted, decoder, offset + 4, _depth)?;
482 Ok(())
483 }
484 }
485
486 impl fidl::encoding::ValueTypeMarker for GainControlSetGainRequest {
487 type Borrowed<'a> = &'a Self;
488 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
489 value
490 }
491 }
492
493 unsafe impl fidl::encoding::TypeMarker for GainControlSetGainRequest {
494 type Owned = Self;
495
496 #[inline(always)]
497 fn inline_align(_context: fidl::encoding::Context) -> usize {
498 4
499 }
500
501 #[inline(always)]
502 fn inline_size(_context: fidl::encoding::Context) -> usize {
503 4
504 }
505 }
506
507 unsafe impl<D: fidl::encoding::ResourceDialect>
508 fidl::encoding::Encode<GainControlSetGainRequest, D> for &GainControlSetGainRequest
509 {
510 #[inline]
511 unsafe fn encode(
512 self,
513 encoder: &mut fidl::encoding::Encoder<'_, D>,
514 offset: usize,
515 _depth: fidl::encoding::Depth,
516 ) -> fidl::Result<()> {
517 encoder.debug_check_bounds::<GainControlSetGainRequest>(offset);
518 fidl::encoding::Encode::<GainControlSetGainRequest, D>::encode(
520 (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),),
521 encoder,
522 offset,
523 _depth,
524 )
525 }
526 }
527 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
528 fidl::encoding::Encode<GainControlSetGainRequest, D> for (T0,)
529 {
530 #[inline]
531 unsafe fn encode(
532 self,
533 encoder: &mut fidl::encoding::Encoder<'_, D>,
534 offset: usize,
535 depth: fidl::encoding::Depth,
536 ) -> fidl::Result<()> {
537 encoder.debug_check_bounds::<GainControlSetGainRequest>(offset);
538 self.0.encode(encoder, offset + 0, depth)?;
542 Ok(())
543 }
544 }
545
546 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
547 for GainControlSetGainRequest
548 {
549 #[inline(always)]
550 fn new_empty() -> Self {
551 Self { gain_db: fidl::new_empty!(f32, D) }
552 }
553
554 #[inline]
555 unsafe fn decode(
556 &mut self,
557 decoder: &mut fidl::encoding::Decoder<'_, D>,
558 offset: usize,
559 _depth: fidl::encoding::Depth,
560 ) -> fidl::Result<()> {
561 decoder.debug_check_bounds::<Self>(offset);
562 fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 0, _depth)?;
564 Ok(())
565 }
566 }
567
568 impl fidl::encoding::ValueTypeMarker for GainControlSetGainWithRampRequest {
569 type Borrowed<'a> = &'a Self;
570 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
571 value
572 }
573 }
574
575 unsafe impl fidl::encoding::TypeMarker for GainControlSetGainWithRampRequest {
576 type Owned = Self;
577
578 #[inline(always)]
579 fn inline_align(_context: fidl::encoding::Context) -> usize {
580 8
581 }
582
583 #[inline(always)]
584 fn inline_size(_context: fidl::encoding::Context) -> usize {
585 24
586 }
587 }
588
589 unsafe impl<D: fidl::encoding::ResourceDialect>
590 fidl::encoding::Encode<GainControlSetGainWithRampRequest, D>
591 for &GainControlSetGainWithRampRequest
592 {
593 #[inline]
594 unsafe fn encode(
595 self,
596 encoder: &mut fidl::encoding::Encoder<'_, D>,
597 offset: usize,
598 _depth: fidl::encoding::Depth,
599 ) -> fidl::Result<()> {
600 encoder.debug_check_bounds::<GainControlSetGainWithRampRequest>(offset);
601 fidl::encoding::Encode::<GainControlSetGainWithRampRequest, D>::encode(
603 (
604 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
605 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration),
606 <RampType as fidl::encoding::ValueTypeMarker>::borrow(&self.ramp_type),
607 ),
608 encoder,
609 offset,
610 _depth,
611 )
612 }
613 }
614 unsafe impl<
615 D: fidl::encoding::ResourceDialect,
616 T0: fidl::encoding::Encode<f32, D>,
617 T1: fidl::encoding::Encode<i64, D>,
618 T2: fidl::encoding::Encode<RampType, D>,
619 > fidl::encoding::Encode<GainControlSetGainWithRampRequest, D> for (T0, T1, T2)
620 {
621 #[inline]
622 unsafe fn encode(
623 self,
624 encoder: &mut fidl::encoding::Encoder<'_, D>,
625 offset: usize,
626 depth: fidl::encoding::Depth,
627 ) -> fidl::Result<()> {
628 encoder.debug_check_bounds::<GainControlSetGainWithRampRequest>(offset);
629 unsafe {
632 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
633 (ptr as *mut u64).write_unaligned(0);
634 }
635 unsafe {
636 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
637 (ptr as *mut u64).write_unaligned(0);
638 }
639 self.0.encode(encoder, offset + 0, depth)?;
641 self.1.encode(encoder, offset + 8, depth)?;
642 self.2.encode(encoder, offset + 16, depth)?;
643 Ok(())
644 }
645 }
646
647 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
648 for GainControlSetGainWithRampRequest
649 {
650 #[inline(always)]
651 fn new_empty() -> Self {
652 Self {
653 gain_db: fidl::new_empty!(f32, D),
654 duration: fidl::new_empty!(i64, D),
655 ramp_type: fidl::new_empty!(RampType, D),
656 }
657 }
658
659 #[inline]
660 unsafe fn decode(
661 &mut self,
662 decoder: &mut fidl::encoding::Decoder<'_, D>,
663 offset: usize,
664 _depth: fidl::encoding::Depth,
665 ) -> fidl::Result<()> {
666 decoder.debug_check_bounds::<Self>(offset);
667 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
669 let padval = unsafe { (ptr as *const u64).read_unaligned() };
670 let mask = 0xffffffff00000000u64;
671 let maskedval = padval & mask;
672 if maskedval != 0 {
673 return Err(fidl::Error::NonZeroPadding {
674 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
675 });
676 }
677 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
678 let padval = unsafe { (ptr as *const u64).read_unaligned() };
679 let mask = 0xffffffffffff0000u64;
680 let maskedval = padval & mask;
681 if maskedval != 0 {
682 return Err(fidl::Error::NonZeroPadding {
683 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
684 });
685 }
686 fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 0, _depth)?;
687 fidl::decode!(i64, D, &mut self.duration, decoder, offset + 8, _depth)?;
688 fidl::decode!(RampType, D, &mut self.ramp_type, decoder, offset + 16, _depth)?;
689 Ok(())
690 }
691 }
692
693 impl fidl::encoding::ValueTypeMarker for GainControlSetMuteRequest {
694 type Borrowed<'a> = &'a Self;
695 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
696 value
697 }
698 }
699
700 unsafe impl fidl::encoding::TypeMarker for GainControlSetMuteRequest {
701 type Owned = Self;
702
703 #[inline(always)]
704 fn inline_align(_context: fidl::encoding::Context) -> usize {
705 1
706 }
707
708 #[inline(always)]
709 fn inline_size(_context: fidl::encoding::Context) -> usize {
710 1
711 }
712 }
713
714 unsafe impl<D: fidl::encoding::ResourceDialect>
715 fidl::encoding::Encode<GainControlSetMuteRequest, D> for &GainControlSetMuteRequest
716 {
717 #[inline]
718 unsafe fn encode(
719 self,
720 encoder: &mut fidl::encoding::Encoder<'_, D>,
721 offset: usize,
722 _depth: fidl::encoding::Depth,
723 ) -> fidl::Result<()> {
724 encoder.debug_check_bounds::<GainControlSetMuteRequest>(offset);
725 fidl::encoding::Encode::<GainControlSetMuteRequest, D>::encode(
727 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.muted),),
728 encoder,
729 offset,
730 _depth,
731 )
732 }
733 }
734 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
735 fidl::encoding::Encode<GainControlSetMuteRequest, D> for (T0,)
736 {
737 #[inline]
738 unsafe fn encode(
739 self,
740 encoder: &mut fidl::encoding::Encoder<'_, D>,
741 offset: usize,
742 depth: fidl::encoding::Depth,
743 ) -> fidl::Result<()> {
744 encoder.debug_check_bounds::<GainControlSetMuteRequest>(offset);
745 self.0.encode(encoder, offset + 0, depth)?;
749 Ok(())
750 }
751 }
752
753 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
754 for GainControlSetMuteRequest
755 {
756 #[inline(always)]
757 fn new_empty() -> Self {
758 Self { muted: fidl::new_empty!(bool, D) }
759 }
760
761 #[inline]
762 unsafe fn decode(
763 &mut self,
764 decoder: &mut fidl::encoding::Decoder<'_, D>,
765 offset: usize,
766 _depth: fidl::encoding::Depth,
767 ) -> fidl::Result<()> {
768 decoder.debug_check_bounds::<Self>(offset);
769 fidl::decode!(bool, D, &mut self.muted, decoder, offset + 0, _depth)?;
771 Ok(())
772 }
773 }
774
775 impl fidl::encoding::ValueTypeMarker for VolumeControlOnVolumeMuteChangedRequest {
776 type Borrowed<'a> = &'a Self;
777 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
778 value
779 }
780 }
781
782 unsafe impl fidl::encoding::TypeMarker for VolumeControlOnVolumeMuteChangedRequest {
783 type Owned = Self;
784
785 #[inline(always)]
786 fn inline_align(_context: fidl::encoding::Context) -> usize {
787 4
788 }
789
790 #[inline(always)]
791 fn inline_size(_context: fidl::encoding::Context) -> usize {
792 8
793 }
794 }
795
796 unsafe impl<D: fidl::encoding::ResourceDialect>
797 fidl::encoding::Encode<VolumeControlOnVolumeMuteChangedRequest, D>
798 for &VolumeControlOnVolumeMuteChangedRequest
799 {
800 #[inline]
801 unsafe fn encode(
802 self,
803 encoder: &mut fidl::encoding::Encoder<'_, D>,
804 offset: usize,
805 _depth: fidl::encoding::Depth,
806 ) -> fidl::Result<()> {
807 encoder.debug_check_bounds::<VolumeControlOnVolumeMuteChangedRequest>(offset);
808 fidl::encoding::Encode::<VolumeControlOnVolumeMuteChangedRequest, D>::encode(
810 (
811 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.new_volume),
812 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.new_muted),
813 ),
814 encoder,
815 offset,
816 _depth,
817 )
818 }
819 }
820 unsafe impl<
821 D: fidl::encoding::ResourceDialect,
822 T0: fidl::encoding::Encode<f32, D>,
823 T1: fidl::encoding::Encode<bool, D>,
824 > fidl::encoding::Encode<VolumeControlOnVolumeMuteChangedRequest, D> for (T0, T1)
825 {
826 #[inline]
827 unsafe fn encode(
828 self,
829 encoder: &mut fidl::encoding::Encoder<'_, D>,
830 offset: usize,
831 depth: fidl::encoding::Depth,
832 ) -> fidl::Result<()> {
833 encoder.debug_check_bounds::<VolumeControlOnVolumeMuteChangedRequest>(offset);
834 unsafe {
837 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
838 (ptr as *mut u32).write_unaligned(0);
839 }
840 self.0.encode(encoder, offset + 0, depth)?;
842 self.1.encode(encoder, offset + 4, depth)?;
843 Ok(())
844 }
845 }
846
847 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
848 for VolumeControlOnVolumeMuteChangedRequest
849 {
850 #[inline(always)]
851 fn new_empty() -> Self {
852 Self { new_volume: fidl::new_empty!(f32, D), new_muted: fidl::new_empty!(bool, D) }
853 }
854
855 #[inline]
856 unsafe fn decode(
857 &mut self,
858 decoder: &mut fidl::encoding::Decoder<'_, D>,
859 offset: usize,
860 _depth: fidl::encoding::Depth,
861 ) -> fidl::Result<()> {
862 decoder.debug_check_bounds::<Self>(offset);
863 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
865 let padval = unsafe { (ptr as *const u32).read_unaligned() };
866 let mask = 0xffffff00u32;
867 let maskedval = padval & mask;
868 if maskedval != 0 {
869 return Err(fidl::Error::NonZeroPadding {
870 padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
871 });
872 }
873 fidl::decode!(f32, D, &mut self.new_volume, decoder, offset + 0, _depth)?;
874 fidl::decode!(bool, D, &mut self.new_muted, decoder, offset + 4, _depth)?;
875 Ok(())
876 }
877 }
878
879 impl fidl::encoding::ValueTypeMarker for VolumeControlSetMuteRequest {
880 type Borrowed<'a> = &'a Self;
881 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
882 value
883 }
884 }
885
886 unsafe impl fidl::encoding::TypeMarker for VolumeControlSetMuteRequest {
887 type Owned = Self;
888
889 #[inline(always)]
890 fn inline_align(_context: fidl::encoding::Context) -> usize {
891 1
892 }
893
894 #[inline(always)]
895 fn inline_size(_context: fidl::encoding::Context) -> usize {
896 1
897 }
898 }
899
900 unsafe impl<D: fidl::encoding::ResourceDialect>
901 fidl::encoding::Encode<VolumeControlSetMuteRequest, D> for &VolumeControlSetMuteRequest
902 {
903 #[inline]
904 unsafe fn encode(
905 self,
906 encoder: &mut fidl::encoding::Encoder<'_, D>,
907 offset: usize,
908 _depth: fidl::encoding::Depth,
909 ) -> fidl::Result<()> {
910 encoder.debug_check_bounds::<VolumeControlSetMuteRequest>(offset);
911 fidl::encoding::Encode::<VolumeControlSetMuteRequest, D>::encode(
913 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.mute),),
914 encoder,
915 offset,
916 _depth,
917 )
918 }
919 }
920 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
921 fidl::encoding::Encode<VolumeControlSetMuteRequest, D> for (T0,)
922 {
923 #[inline]
924 unsafe fn encode(
925 self,
926 encoder: &mut fidl::encoding::Encoder<'_, D>,
927 offset: usize,
928 depth: fidl::encoding::Depth,
929 ) -> fidl::Result<()> {
930 encoder.debug_check_bounds::<VolumeControlSetMuteRequest>(offset);
931 self.0.encode(encoder, offset + 0, depth)?;
935 Ok(())
936 }
937 }
938
939 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
940 for VolumeControlSetMuteRequest
941 {
942 #[inline(always)]
943 fn new_empty() -> Self {
944 Self { mute: fidl::new_empty!(bool, D) }
945 }
946
947 #[inline]
948 unsafe fn decode(
949 &mut self,
950 decoder: &mut fidl::encoding::Decoder<'_, D>,
951 offset: usize,
952 _depth: fidl::encoding::Depth,
953 ) -> fidl::Result<()> {
954 decoder.debug_check_bounds::<Self>(offset);
955 fidl::decode!(bool, D, &mut self.mute, decoder, offset + 0, _depth)?;
957 Ok(())
958 }
959 }
960
961 impl fidl::encoding::ValueTypeMarker for VolumeControlSetVolumeRequest {
962 type Borrowed<'a> = &'a Self;
963 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
964 value
965 }
966 }
967
968 unsafe impl fidl::encoding::TypeMarker for VolumeControlSetVolumeRequest {
969 type Owned = Self;
970
971 #[inline(always)]
972 fn inline_align(_context: fidl::encoding::Context) -> usize {
973 4
974 }
975
976 #[inline(always)]
977 fn inline_size(_context: fidl::encoding::Context) -> usize {
978 4
979 }
980 }
981
982 unsafe impl<D: fidl::encoding::ResourceDialect>
983 fidl::encoding::Encode<VolumeControlSetVolumeRequest, D>
984 for &VolumeControlSetVolumeRequest
985 {
986 #[inline]
987 unsafe fn encode(
988 self,
989 encoder: &mut fidl::encoding::Encoder<'_, D>,
990 offset: usize,
991 _depth: fidl::encoding::Depth,
992 ) -> fidl::Result<()> {
993 encoder.debug_check_bounds::<VolumeControlSetVolumeRequest>(offset);
994 fidl::encoding::Encode::<VolumeControlSetVolumeRequest, D>::encode(
996 (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.volume),),
997 encoder,
998 offset,
999 _depth,
1000 )
1001 }
1002 }
1003 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
1004 fidl::encoding::Encode<VolumeControlSetVolumeRequest, D> for (T0,)
1005 {
1006 #[inline]
1007 unsafe fn encode(
1008 self,
1009 encoder: &mut fidl::encoding::Encoder<'_, D>,
1010 offset: usize,
1011 depth: fidl::encoding::Depth,
1012 ) -> fidl::Result<()> {
1013 encoder.debug_check_bounds::<VolumeControlSetVolumeRequest>(offset);
1014 self.0.encode(encoder, offset + 0, depth)?;
1018 Ok(())
1019 }
1020 }
1021
1022 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1023 for VolumeControlSetVolumeRequest
1024 {
1025 #[inline(always)]
1026 fn new_empty() -> Self {
1027 Self { volume: fidl::new_empty!(f32, D) }
1028 }
1029
1030 #[inline]
1031 unsafe fn decode(
1032 &mut self,
1033 decoder: &mut fidl::encoding::Decoder<'_, D>,
1034 offset: usize,
1035 _depth: fidl::encoding::Depth,
1036 ) -> fidl::Result<()> {
1037 decoder.debug_check_bounds::<Self>(offset);
1038 fidl::decode!(f32, D, &mut self.volume, decoder, offset + 0, _depth)?;
1040 Ok(())
1041 }
1042 }
1043}