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 INJECTED_AUDIO_MAXIMUM_FILE_SIZE: u32 = 20971520;
16
17#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
19pub enum AudioTestError {
20 Fail,
26 #[doc(hidden)]
27 __SourceBreaking { unknown_ordinal: u32 },
28}
29
30#[macro_export]
32macro_rules! AudioTestErrorUnknown {
33 () => {
34 _
35 };
36}
37
38impl AudioTestError {
39 #[inline]
40 pub fn from_primitive(prim: u32) -> Option<Self> {
41 match prim {
42 1 => Some(Self::Fail),
43 _ => None,
44 }
45 }
46
47 #[inline]
48 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
49 match prim {
50 1 => Self::Fail,
51 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
52 }
53 }
54
55 #[inline]
56 pub fn unknown() -> Self {
57 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
58 }
59
60 #[inline]
61 pub const fn into_primitive(self) -> u32 {
62 match self {
63 Self::Fail => 1,
64 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
65 }
66 }
67
68 #[inline]
69 pub fn is_unknown(&self) -> bool {
70 match self {
71 Self::__SourceBreaking { unknown_ordinal: _ } => true,
72 _ => false,
73 }
74 }
75}
76
77#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
79pub enum QueuedCaptureResult {
80 Captured,
83 CapturedToTimeLimit,
87 FailedNoSoundTimeout,
89 #[doc(hidden)]
90 __SourceBreaking { unknown_ordinal: u32 },
91}
92
93#[macro_export]
95macro_rules! QueuedCaptureResultUnknown {
96 () => {
97 _
98 };
99}
100
101impl QueuedCaptureResult {
102 #[inline]
103 pub fn from_primitive(prim: u32) -> Option<Self> {
104 match prim {
105 1 => Some(Self::Captured),
106 2 => Some(Self::CapturedToTimeLimit),
107 3 => Some(Self::FailedNoSoundTimeout),
108 _ => None,
109 }
110 }
111
112 #[inline]
113 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
114 match prim {
115 1 => Self::Captured,
116 2 => Self::CapturedToTimeLimit,
117 3 => Self::FailedNoSoundTimeout,
118 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
119 }
120 }
121
122 #[inline]
123 pub fn unknown() -> Self {
124 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
125 }
126
127 #[inline]
128 pub const fn into_primitive(self) -> u32 {
129 match self {
130 Self::Captured => 1,
131 Self::CapturedToTimeLimit => 2,
132 Self::FailedNoSoundTimeout => 3,
133 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
134 }
135 }
136
137 #[inline]
138 pub fn is_unknown(&self) -> bool {
139 match self {
140 Self::__SourceBreaking { unknown_ordinal: _ } => true,
141 _ => false,
142 }
143 }
144}
145
146#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
148pub enum WaitForQuietResult {
149 Success,
151 QuietPeriodNotObserved,
154 #[doc(hidden)]
155 __SourceBreaking { unknown_ordinal: u32 },
156}
157
158#[macro_export]
160macro_rules! WaitForQuietResultUnknown {
161 () => {
162 _
163 };
164}
165
166impl WaitForQuietResult {
167 #[inline]
168 pub fn from_primitive(prim: u32) -> Option<Self> {
169 match prim {
170 1 => Some(Self::Success),
171 2 => Some(Self::QuietPeriodNotObserved),
172 _ => None,
173 }
174 }
175
176 #[inline]
177 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
178 match prim {
179 1 => Self::Success,
180 2 => Self::QuietPeriodNotObserved,
181 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
182 }
183 }
184
185 #[inline]
186 pub fn unknown() -> Self {
187 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
188 }
189
190 #[inline]
191 pub const fn into_primitive(self) -> u32 {
192 match self {
193 Self::Success => 1,
194 Self::QuietPeriodNotObserved => 2,
195 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
196 }
197 }
198
199 #[inline]
200 pub fn is_unknown(&self) -> bool {
201 match self {
202 Self::__SourceBreaking { unknown_ordinal: _ } => true,
203 _ => false,
204 }
205 }
206}
207
208#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
209pub struct CaptureWaitForQuietResponse {
210 pub result: WaitForQuietResult,
211}
212
213impl fidl::Persistable for CaptureWaitForQuietResponse {}
214
215#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
216pub struct CaptureWaitForTriggeredCaptureResponse {
217 pub result: QueuedCaptureResult,
218}
219
220impl fidl::Persistable for CaptureWaitForTriggeredCaptureResponse {}
221
222#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
223#[repr(C)]
224pub struct InjectionGetInputAudioSizeRequest {
225 pub index: i32,
226}
227
228impl fidl::Persistable for InjectionGetInputAudioSizeRequest {}
229
230#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
231#[repr(C)]
232pub struct InjectionGetInputAudioSizeResponse {
233 pub byte_count: u64,
234}
235
236impl fidl::Persistable for InjectionGetInputAudioSizeResponse {}
237
238#[derive(Clone, Debug, Default, PartialEq)]
239pub struct CaptureQueueTriggeredCaptureRequest {
240 pub maximum_time_to_wait_for_sound_ms: Option<u32>,
241 pub optional_quiet_before_stopping_ms: Option<u32>,
242 pub maximum_capture_duration_ms: Option<u32>,
243 #[doc(hidden)]
244 pub __source_breaking: fidl::marker::SourceBreaking,
245}
246
247impl fidl::Persistable for CaptureQueueTriggeredCaptureRequest {}
248
249#[derive(Clone, Debug, Default, PartialEq)]
250pub struct CaptureWaitForQuietRequest {
251 pub requested_quiet_period_ms: Option<u32>,
252 pub maximum_wait_time_ms: Option<u32>,
253 #[doc(hidden)]
254 pub __source_breaking: fidl::marker::SourceBreaking,
255}
256
257impl fidl::Persistable for CaptureWaitForQuietRequest {}
258
259pub mod capture_ordinals {
260 pub const START_OUTPUT_CAPTURE: u64 = 0x3da5afb01b70be17;
261 pub const STOP_OUTPUT_CAPTURE: u64 = 0x4598c765e8859b6b;
262 pub const WAIT_FOR_QUIET: u64 = 0x7f8de156ce46d54b;
263 pub const QUEUE_TRIGGERED_CAPTURE: u64 = 0x5d372fd28da4efb2;
264 pub const WAIT_FOR_TRIGGERED_CAPTURE: u64 = 0x7b55fa2cfe9c6c3;
265 pub const GET_OUTPUT_AUDIO: u64 = 0x23960702c8a96e54;
266}
267
268pub mod injection_ordinals {
269 pub const WRITE_INPUT_AUDIO: u64 = 0x2eaec6d4251a030d;
270 pub const GET_INPUT_AUDIO_SIZE: u64 = 0x57684145b51cf28;
271 pub const CLEAR_INPUT_AUDIO: u64 = 0x33259f902aace7b7;
272 pub const WAIT_UNTIL_INPUT_IS_DONE: u64 = 0x6cb5b4b48ffe7fc8;
273 pub const START_INPUT_INJECTION: u64 = 0x753a5415ad966b06;
274 pub const STOP_INPUT_INJECTION: u64 = 0x371fce6bb8d77fe;
275}
276
277mod internal {
278 use super::*;
279 unsafe impl fidl::encoding::TypeMarker for AudioTestError {
280 type Owned = Self;
281
282 #[inline(always)]
283 fn inline_align(_context: fidl::encoding::Context) -> usize {
284 std::mem::align_of::<u32>()
285 }
286
287 #[inline(always)]
288 fn inline_size(_context: fidl::encoding::Context) -> usize {
289 std::mem::size_of::<u32>()
290 }
291
292 #[inline(always)]
293 fn encode_is_copy() -> bool {
294 false
295 }
296
297 #[inline(always)]
298 fn decode_is_copy() -> bool {
299 false
300 }
301 }
302
303 impl fidl::encoding::ValueTypeMarker for AudioTestError {
304 type Borrowed<'a> = Self;
305 #[inline(always)]
306 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
307 *value
308 }
309 }
310
311 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AudioTestError {
312 #[inline]
313 unsafe fn encode(
314 self,
315 encoder: &mut fidl::encoding::Encoder<'_, D>,
316 offset: usize,
317 _depth: fidl::encoding::Depth,
318 ) -> fidl::Result<()> {
319 encoder.debug_check_bounds::<Self>(offset);
320 encoder.write_num(self.into_primitive(), offset);
321 Ok(())
322 }
323 }
324
325 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioTestError {
326 #[inline(always)]
327 fn new_empty() -> Self {
328 Self::unknown()
329 }
330
331 #[inline]
332 unsafe fn decode(
333 &mut self,
334 decoder: &mut fidl::encoding::Decoder<'_, D>,
335 offset: usize,
336 _depth: fidl::encoding::Depth,
337 ) -> fidl::Result<()> {
338 decoder.debug_check_bounds::<Self>(offset);
339 let prim = decoder.read_num::<u32>(offset);
340
341 *self = Self::from_primitive_allow_unknown(prim);
342 Ok(())
343 }
344 }
345 unsafe impl fidl::encoding::TypeMarker for QueuedCaptureResult {
346 type Owned = Self;
347
348 #[inline(always)]
349 fn inline_align(_context: fidl::encoding::Context) -> usize {
350 std::mem::align_of::<u32>()
351 }
352
353 #[inline(always)]
354 fn inline_size(_context: fidl::encoding::Context) -> usize {
355 std::mem::size_of::<u32>()
356 }
357
358 #[inline(always)]
359 fn encode_is_copy() -> bool {
360 false
361 }
362
363 #[inline(always)]
364 fn decode_is_copy() -> bool {
365 false
366 }
367 }
368
369 impl fidl::encoding::ValueTypeMarker for QueuedCaptureResult {
370 type Borrowed<'a> = Self;
371 #[inline(always)]
372 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
373 *value
374 }
375 }
376
377 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
378 for QueuedCaptureResult
379 {
380 #[inline]
381 unsafe fn encode(
382 self,
383 encoder: &mut fidl::encoding::Encoder<'_, D>,
384 offset: usize,
385 _depth: fidl::encoding::Depth,
386 ) -> fidl::Result<()> {
387 encoder.debug_check_bounds::<Self>(offset);
388 encoder.write_num(self.into_primitive(), offset);
389 Ok(())
390 }
391 }
392
393 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for QueuedCaptureResult {
394 #[inline(always)]
395 fn new_empty() -> Self {
396 Self::unknown()
397 }
398
399 #[inline]
400 unsafe fn decode(
401 &mut self,
402 decoder: &mut fidl::encoding::Decoder<'_, D>,
403 offset: usize,
404 _depth: fidl::encoding::Depth,
405 ) -> fidl::Result<()> {
406 decoder.debug_check_bounds::<Self>(offset);
407 let prim = decoder.read_num::<u32>(offset);
408
409 *self = Self::from_primitive_allow_unknown(prim);
410 Ok(())
411 }
412 }
413 unsafe impl fidl::encoding::TypeMarker for WaitForQuietResult {
414 type Owned = Self;
415
416 #[inline(always)]
417 fn inline_align(_context: fidl::encoding::Context) -> usize {
418 std::mem::align_of::<u32>()
419 }
420
421 #[inline(always)]
422 fn inline_size(_context: fidl::encoding::Context) -> usize {
423 std::mem::size_of::<u32>()
424 }
425
426 #[inline(always)]
427 fn encode_is_copy() -> bool {
428 false
429 }
430
431 #[inline(always)]
432 fn decode_is_copy() -> bool {
433 false
434 }
435 }
436
437 impl fidl::encoding::ValueTypeMarker for WaitForQuietResult {
438 type Borrowed<'a> = Self;
439 #[inline(always)]
440 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
441 *value
442 }
443 }
444
445 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
446 for WaitForQuietResult
447 {
448 #[inline]
449 unsafe fn encode(
450 self,
451 encoder: &mut fidl::encoding::Encoder<'_, D>,
452 offset: usize,
453 _depth: fidl::encoding::Depth,
454 ) -> fidl::Result<()> {
455 encoder.debug_check_bounds::<Self>(offset);
456 encoder.write_num(self.into_primitive(), offset);
457 Ok(())
458 }
459 }
460
461 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WaitForQuietResult {
462 #[inline(always)]
463 fn new_empty() -> Self {
464 Self::unknown()
465 }
466
467 #[inline]
468 unsafe fn decode(
469 &mut self,
470 decoder: &mut fidl::encoding::Decoder<'_, D>,
471 offset: usize,
472 _depth: fidl::encoding::Depth,
473 ) -> fidl::Result<()> {
474 decoder.debug_check_bounds::<Self>(offset);
475 let prim = decoder.read_num::<u32>(offset);
476
477 *self = Self::from_primitive_allow_unknown(prim);
478 Ok(())
479 }
480 }
481
482 impl fidl::encoding::ValueTypeMarker for CaptureWaitForQuietResponse {
483 type Borrowed<'a> = &'a Self;
484 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
485 value
486 }
487 }
488
489 unsafe impl fidl::encoding::TypeMarker for CaptureWaitForQuietResponse {
490 type Owned = Self;
491
492 #[inline(always)]
493 fn inline_align(_context: fidl::encoding::Context) -> usize {
494 4
495 }
496
497 #[inline(always)]
498 fn inline_size(_context: fidl::encoding::Context) -> usize {
499 4
500 }
501 }
502
503 unsafe impl<D: fidl::encoding::ResourceDialect>
504 fidl::encoding::Encode<CaptureWaitForQuietResponse, D> for &CaptureWaitForQuietResponse
505 {
506 #[inline]
507 unsafe fn encode(
508 self,
509 encoder: &mut fidl::encoding::Encoder<'_, D>,
510 offset: usize,
511 _depth: fidl::encoding::Depth,
512 ) -> fidl::Result<()> {
513 encoder.debug_check_bounds::<CaptureWaitForQuietResponse>(offset);
514 fidl::encoding::Encode::<CaptureWaitForQuietResponse, D>::encode(
516 (<WaitForQuietResult as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
517 encoder,
518 offset,
519 _depth,
520 )
521 }
522 }
523 unsafe impl<
524 D: fidl::encoding::ResourceDialect,
525 T0: fidl::encoding::Encode<WaitForQuietResult, D>,
526 > fidl::encoding::Encode<CaptureWaitForQuietResponse, D> for (T0,)
527 {
528 #[inline]
529 unsafe fn encode(
530 self,
531 encoder: &mut fidl::encoding::Encoder<'_, D>,
532 offset: usize,
533 depth: fidl::encoding::Depth,
534 ) -> fidl::Result<()> {
535 encoder.debug_check_bounds::<CaptureWaitForQuietResponse>(offset);
536 self.0.encode(encoder, offset + 0, depth)?;
540 Ok(())
541 }
542 }
543
544 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
545 for CaptureWaitForQuietResponse
546 {
547 #[inline(always)]
548 fn new_empty() -> Self {
549 Self { result: fidl::new_empty!(WaitForQuietResult, D) }
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 fidl::decode!(WaitForQuietResult, D, &mut self.result, decoder, offset + 0, _depth)?;
562 Ok(())
563 }
564 }
565
566 impl fidl::encoding::ValueTypeMarker for CaptureWaitForTriggeredCaptureResponse {
567 type Borrowed<'a> = &'a Self;
568 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
569 value
570 }
571 }
572
573 unsafe impl fidl::encoding::TypeMarker for CaptureWaitForTriggeredCaptureResponse {
574 type Owned = Self;
575
576 #[inline(always)]
577 fn inline_align(_context: fidl::encoding::Context) -> usize {
578 4
579 }
580
581 #[inline(always)]
582 fn inline_size(_context: fidl::encoding::Context) -> usize {
583 4
584 }
585 }
586
587 unsafe impl<D: fidl::encoding::ResourceDialect>
588 fidl::encoding::Encode<CaptureWaitForTriggeredCaptureResponse, D>
589 for &CaptureWaitForTriggeredCaptureResponse
590 {
591 #[inline]
592 unsafe fn encode(
593 self,
594 encoder: &mut fidl::encoding::Encoder<'_, D>,
595 offset: usize,
596 _depth: fidl::encoding::Depth,
597 ) -> fidl::Result<()> {
598 encoder.debug_check_bounds::<CaptureWaitForTriggeredCaptureResponse>(offset);
599 fidl::encoding::Encode::<CaptureWaitForTriggeredCaptureResponse, D>::encode(
601 (<QueuedCaptureResult as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
602 encoder,
603 offset,
604 _depth,
605 )
606 }
607 }
608 unsafe impl<
609 D: fidl::encoding::ResourceDialect,
610 T0: fidl::encoding::Encode<QueuedCaptureResult, D>,
611 > fidl::encoding::Encode<CaptureWaitForTriggeredCaptureResponse, D> for (T0,)
612 {
613 #[inline]
614 unsafe fn encode(
615 self,
616 encoder: &mut fidl::encoding::Encoder<'_, D>,
617 offset: usize,
618 depth: fidl::encoding::Depth,
619 ) -> fidl::Result<()> {
620 encoder.debug_check_bounds::<CaptureWaitForTriggeredCaptureResponse>(offset);
621 self.0.encode(encoder, offset + 0, depth)?;
625 Ok(())
626 }
627 }
628
629 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
630 for CaptureWaitForTriggeredCaptureResponse
631 {
632 #[inline(always)]
633 fn new_empty() -> Self {
634 Self { result: fidl::new_empty!(QueuedCaptureResult, D) }
635 }
636
637 #[inline]
638 unsafe fn decode(
639 &mut self,
640 decoder: &mut fidl::encoding::Decoder<'_, D>,
641 offset: usize,
642 _depth: fidl::encoding::Depth,
643 ) -> fidl::Result<()> {
644 decoder.debug_check_bounds::<Self>(offset);
645 fidl::decode!(QueuedCaptureResult, D, &mut self.result, decoder, offset + 0, _depth)?;
647 Ok(())
648 }
649 }
650
651 impl fidl::encoding::ValueTypeMarker for InjectionGetInputAudioSizeRequest {
652 type Borrowed<'a> = &'a Self;
653 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
654 value
655 }
656 }
657
658 unsafe impl fidl::encoding::TypeMarker for InjectionGetInputAudioSizeRequest {
659 type Owned = Self;
660
661 #[inline(always)]
662 fn inline_align(_context: fidl::encoding::Context) -> usize {
663 4
664 }
665
666 #[inline(always)]
667 fn inline_size(_context: fidl::encoding::Context) -> usize {
668 4
669 }
670 #[inline(always)]
671 fn encode_is_copy() -> bool {
672 true
673 }
674
675 #[inline(always)]
676 fn decode_is_copy() -> bool {
677 true
678 }
679 }
680
681 unsafe impl<D: fidl::encoding::ResourceDialect>
682 fidl::encoding::Encode<InjectionGetInputAudioSizeRequest, D>
683 for &InjectionGetInputAudioSizeRequest
684 {
685 #[inline]
686 unsafe fn encode(
687 self,
688 encoder: &mut fidl::encoding::Encoder<'_, D>,
689 offset: usize,
690 _depth: fidl::encoding::Depth,
691 ) -> fidl::Result<()> {
692 encoder.debug_check_bounds::<InjectionGetInputAudioSizeRequest>(offset);
693 unsafe {
694 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
696 (buf_ptr as *mut InjectionGetInputAudioSizeRequest)
697 .write_unaligned((self as *const InjectionGetInputAudioSizeRequest).read());
698 }
701 Ok(())
702 }
703 }
704 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
705 fidl::encoding::Encode<InjectionGetInputAudioSizeRequest, D> for (T0,)
706 {
707 #[inline]
708 unsafe fn encode(
709 self,
710 encoder: &mut fidl::encoding::Encoder<'_, D>,
711 offset: usize,
712 depth: fidl::encoding::Depth,
713 ) -> fidl::Result<()> {
714 encoder.debug_check_bounds::<InjectionGetInputAudioSizeRequest>(offset);
715 self.0.encode(encoder, offset + 0, depth)?;
719 Ok(())
720 }
721 }
722
723 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
724 for InjectionGetInputAudioSizeRequest
725 {
726 #[inline(always)]
727 fn new_empty() -> Self {
728 Self { index: fidl::new_empty!(i32, D) }
729 }
730
731 #[inline]
732 unsafe fn decode(
733 &mut self,
734 decoder: &mut fidl::encoding::Decoder<'_, D>,
735 offset: usize,
736 _depth: fidl::encoding::Depth,
737 ) -> fidl::Result<()> {
738 decoder.debug_check_bounds::<Self>(offset);
739 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
740 unsafe {
743 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
744 }
745 Ok(())
746 }
747 }
748
749 impl fidl::encoding::ValueTypeMarker for InjectionGetInputAudioSizeResponse {
750 type Borrowed<'a> = &'a Self;
751 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
752 value
753 }
754 }
755
756 unsafe impl fidl::encoding::TypeMarker for InjectionGetInputAudioSizeResponse {
757 type Owned = Self;
758
759 #[inline(always)]
760 fn inline_align(_context: fidl::encoding::Context) -> usize {
761 8
762 }
763
764 #[inline(always)]
765 fn inline_size(_context: fidl::encoding::Context) -> usize {
766 8
767 }
768 #[inline(always)]
769 fn encode_is_copy() -> bool {
770 true
771 }
772
773 #[inline(always)]
774 fn decode_is_copy() -> bool {
775 true
776 }
777 }
778
779 unsafe impl<D: fidl::encoding::ResourceDialect>
780 fidl::encoding::Encode<InjectionGetInputAudioSizeResponse, D>
781 for &InjectionGetInputAudioSizeResponse
782 {
783 #[inline]
784 unsafe fn encode(
785 self,
786 encoder: &mut fidl::encoding::Encoder<'_, D>,
787 offset: usize,
788 _depth: fidl::encoding::Depth,
789 ) -> fidl::Result<()> {
790 encoder.debug_check_bounds::<InjectionGetInputAudioSizeResponse>(offset);
791 unsafe {
792 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
794 (buf_ptr as *mut InjectionGetInputAudioSizeResponse)
795 .write_unaligned((self as *const InjectionGetInputAudioSizeResponse).read());
796 }
799 Ok(())
800 }
801 }
802 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
803 fidl::encoding::Encode<InjectionGetInputAudioSizeResponse, D> for (T0,)
804 {
805 #[inline]
806 unsafe fn encode(
807 self,
808 encoder: &mut fidl::encoding::Encoder<'_, D>,
809 offset: usize,
810 depth: fidl::encoding::Depth,
811 ) -> fidl::Result<()> {
812 encoder.debug_check_bounds::<InjectionGetInputAudioSizeResponse>(offset);
813 self.0.encode(encoder, offset + 0, depth)?;
817 Ok(())
818 }
819 }
820
821 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
822 for InjectionGetInputAudioSizeResponse
823 {
824 #[inline(always)]
825 fn new_empty() -> Self {
826 Self { byte_count: fidl::new_empty!(u64, D) }
827 }
828
829 #[inline]
830 unsafe fn decode(
831 &mut self,
832 decoder: &mut fidl::encoding::Decoder<'_, D>,
833 offset: usize,
834 _depth: fidl::encoding::Depth,
835 ) -> fidl::Result<()> {
836 decoder.debug_check_bounds::<Self>(offset);
837 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
838 unsafe {
841 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
842 }
843 Ok(())
844 }
845 }
846
847 impl CaptureQueueTriggeredCaptureRequest {
848 #[inline(always)]
849 fn max_ordinal_present(&self) -> u64 {
850 if let Some(_) = self.maximum_capture_duration_ms {
851 return 3;
852 }
853 if let Some(_) = self.optional_quiet_before_stopping_ms {
854 return 2;
855 }
856 if let Some(_) = self.maximum_time_to_wait_for_sound_ms {
857 return 1;
858 }
859 0
860 }
861 }
862
863 impl fidl::encoding::ValueTypeMarker for CaptureQueueTriggeredCaptureRequest {
864 type Borrowed<'a> = &'a Self;
865 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
866 value
867 }
868 }
869
870 unsafe impl fidl::encoding::TypeMarker for CaptureQueueTriggeredCaptureRequest {
871 type Owned = Self;
872
873 #[inline(always)]
874 fn inline_align(_context: fidl::encoding::Context) -> usize {
875 8
876 }
877
878 #[inline(always)]
879 fn inline_size(_context: fidl::encoding::Context) -> usize {
880 16
881 }
882 }
883
884 unsafe impl<D: fidl::encoding::ResourceDialect>
885 fidl::encoding::Encode<CaptureQueueTriggeredCaptureRequest, D>
886 for &CaptureQueueTriggeredCaptureRequest
887 {
888 unsafe fn encode(
889 self,
890 encoder: &mut fidl::encoding::Encoder<'_, D>,
891 offset: usize,
892 mut depth: fidl::encoding::Depth,
893 ) -> fidl::Result<()> {
894 encoder.debug_check_bounds::<CaptureQueueTriggeredCaptureRequest>(offset);
895 let max_ordinal: u64 = self.max_ordinal_present();
897 encoder.write_num(max_ordinal, offset);
898 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
899 if max_ordinal == 0 {
901 return Ok(());
902 }
903 depth.increment()?;
904 let envelope_size = 8;
905 let bytes_len = max_ordinal as usize * envelope_size;
906 #[allow(unused_variables)]
907 let offset = encoder.out_of_line_offset(bytes_len);
908 let mut _prev_end_offset: usize = 0;
909 if 1 > max_ordinal {
910 return Ok(());
911 }
912
913 let cur_offset: usize = (1 - 1) * envelope_size;
916
917 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
919
920 fidl::encoding::encode_in_envelope_optional::<u32, D>(
925 self.maximum_time_to_wait_for_sound_ms
926 .as_ref()
927 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
928 encoder,
929 offset + cur_offset,
930 depth,
931 )?;
932
933 _prev_end_offset = cur_offset + envelope_size;
934 if 2 > max_ordinal {
935 return Ok(());
936 }
937
938 let cur_offset: usize = (2 - 1) * envelope_size;
941
942 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
944
945 fidl::encoding::encode_in_envelope_optional::<u32, D>(
950 self.optional_quiet_before_stopping_ms
951 .as_ref()
952 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
953 encoder,
954 offset + cur_offset,
955 depth,
956 )?;
957
958 _prev_end_offset = cur_offset + envelope_size;
959 if 3 > max_ordinal {
960 return Ok(());
961 }
962
963 let cur_offset: usize = (3 - 1) * envelope_size;
966
967 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
969
970 fidl::encoding::encode_in_envelope_optional::<u32, D>(
975 self.maximum_capture_duration_ms
976 .as_ref()
977 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
978 encoder,
979 offset + cur_offset,
980 depth,
981 )?;
982
983 _prev_end_offset = cur_offset + envelope_size;
984
985 Ok(())
986 }
987 }
988
989 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
990 for CaptureQueueTriggeredCaptureRequest
991 {
992 #[inline(always)]
993 fn new_empty() -> Self {
994 Self::default()
995 }
996
997 unsafe fn decode(
998 &mut self,
999 decoder: &mut fidl::encoding::Decoder<'_, D>,
1000 offset: usize,
1001 mut depth: fidl::encoding::Depth,
1002 ) -> fidl::Result<()> {
1003 decoder.debug_check_bounds::<Self>(offset);
1004 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1005 None => return Err(fidl::Error::NotNullable),
1006 Some(len) => len,
1007 };
1008 if len == 0 {
1010 return Ok(());
1011 };
1012 depth.increment()?;
1013 let envelope_size = 8;
1014 let bytes_len = len * envelope_size;
1015 let offset = decoder.out_of_line_offset(bytes_len)?;
1016 let mut _next_ordinal_to_read = 0;
1018 let mut next_offset = offset;
1019 let end_offset = offset + bytes_len;
1020 _next_ordinal_to_read += 1;
1021 if next_offset >= end_offset {
1022 return Ok(());
1023 }
1024
1025 while _next_ordinal_to_read < 1 {
1027 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1028 _next_ordinal_to_read += 1;
1029 next_offset += envelope_size;
1030 }
1031
1032 let next_out_of_line = decoder.next_out_of_line();
1033 let handles_before = decoder.remaining_handles();
1034 if let Some((inlined, num_bytes, num_handles)) =
1035 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1036 {
1037 let member_inline_size =
1038 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1039 if inlined != (member_inline_size <= 4) {
1040 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1041 }
1042 let inner_offset;
1043 let mut inner_depth = depth.clone();
1044 if inlined {
1045 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1046 inner_offset = next_offset;
1047 } else {
1048 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1049 inner_depth.increment()?;
1050 }
1051 let val_ref = self
1052 .maximum_time_to_wait_for_sound_ms
1053 .get_or_insert_with(|| fidl::new_empty!(u32, D));
1054 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1055 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1056 {
1057 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1058 }
1059 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1060 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1061 }
1062 }
1063
1064 next_offset += envelope_size;
1065 _next_ordinal_to_read += 1;
1066 if next_offset >= end_offset {
1067 return Ok(());
1068 }
1069
1070 while _next_ordinal_to_read < 2 {
1072 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1073 _next_ordinal_to_read += 1;
1074 next_offset += envelope_size;
1075 }
1076
1077 let next_out_of_line = decoder.next_out_of_line();
1078 let handles_before = decoder.remaining_handles();
1079 if let Some((inlined, num_bytes, num_handles)) =
1080 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1081 {
1082 let member_inline_size =
1083 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1084 if inlined != (member_inline_size <= 4) {
1085 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1086 }
1087 let inner_offset;
1088 let mut inner_depth = depth.clone();
1089 if inlined {
1090 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1091 inner_offset = next_offset;
1092 } else {
1093 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1094 inner_depth.increment()?;
1095 }
1096 let val_ref = self
1097 .optional_quiet_before_stopping_ms
1098 .get_or_insert_with(|| fidl::new_empty!(u32, D));
1099 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1100 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1101 {
1102 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1103 }
1104 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1105 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1106 }
1107 }
1108
1109 next_offset += envelope_size;
1110 _next_ordinal_to_read += 1;
1111 if next_offset >= end_offset {
1112 return Ok(());
1113 }
1114
1115 while _next_ordinal_to_read < 3 {
1117 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1118 _next_ordinal_to_read += 1;
1119 next_offset += envelope_size;
1120 }
1121
1122 let next_out_of_line = decoder.next_out_of_line();
1123 let handles_before = decoder.remaining_handles();
1124 if let Some((inlined, num_bytes, num_handles)) =
1125 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1126 {
1127 let member_inline_size =
1128 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1129 if inlined != (member_inline_size <= 4) {
1130 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1131 }
1132 let inner_offset;
1133 let mut inner_depth = depth.clone();
1134 if inlined {
1135 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1136 inner_offset = next_offset;
1137 } else {
1138 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1139 inner_depth.increment()?;
1140 }
1141 let val_ref = self
1142 .maximum_capture_duration_ms
1143 .get_or_insert_with(|| fidl::new_empty!(u32, D));
1144 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1145 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1146 {
1147 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1148 }
1149 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1150 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1151 }
1152 }
1153
1154 next_offset += envelope_size;
1155
1156 while next_offset < end_offset {
1158 _next_ordinal_to_read += 1;
1159 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1160 next_offset += envelope_size;
1161 }
1162
1163 Ok(())
1164 }
1165 }
1166
1167 impl CaptureWaitForQuietRequest {
1168 #[inline(always)]
1169 fn max_ordinal_present(&self) -> u64 {
1170 if let Some(_) = self.maximum_wait_time_ms {
1171 return 2;
1172 }
1173 if let Some(_) = self.requested_quiet_period_ms {
1174 return 1;
1175 }
1176 0
1177 }
1178 }
1179
1180 impl fidl::encoding::ValueTypeMarker for CaptureWaitForQuietRequest {
1181 type Borrowed<'a> = &'a Self;
1182 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1183 value
1184 }
1185 }
1186
1187 unsafe impl fidl::encoding::TypeMarker for CaptureWaitForQuietRequest {
1188 type Owned = Self;
1189
1190 #[inline(always)]
1191 fn inline_align(_context: fidl::encoding::Context) -> usize {
1192 8
1193 }
1194
1195 #[inline(always)]
1196 fn inline_size(_context: fidl::encoding::Context) -> usize {
1197 16
1198 }
1199 }
1200
1201 unsafe impl<D: fidl::encoding::ResourceDialect>
1202 fidl::encoding::Encode<CaptureWaitForQuietRequest, D> for &CaptureWaitForQuietRequest
1203 {
1204 unsafe fn encode(
1205 self,
1206 encoder: &mut fidl::encoding::Encoder<'_, D>,
1207 offset: usize,
1208 mut depth: fidl::encoding::Depth,
1209 ) -> fidl::Result<()> {
1210 encoder.debug_check_bounds::<CaptureWaitForQuietRequest>(offset);
1211 let max_ordinal: u64 = self.max_ordinal_present();
1213 encoder.write_num(max_ordinal, offset);
1214 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1215 if max_ordinal == 0 {
1217 return Ok(());
1218 }
1219 depth.increment()?;
1220 let envelope_size = 8;
1221 let bytes_len = max_ordinal as usize * envelope_size;
1222 #[allow(unused_variables)]
1223 let offset = encoder.out_of_line_offset(bytes_len);
1224 let mut _prev_end_offset: usize = 0;
1225 if 1 > max_ordinal {
1226 return Ok(());
1227 }
1228
1229 let cur_offset: usize = (1 - 1) * envelope_size;
1232
1233 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1235
1236 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1241 self.requested_quiet_period_ms
1242 .as_ref()
1243 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1244 encoder,
1245 offset + cur_offset,
1246 depth,
1247 )?;
1248
1249 _prev_end_offset = cur_offset + envelope_size;
1250 if 2 > max_ordinal {
1251 return Ok(());
1252 }
1253
1254 let cur_offset: usize = (2 - 1) * envelope_size;
1257
1258 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1260
1261 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1266 self.maximum_wait_time_ms
1267 .as_ref()
1268 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1269 encoder,
1270 offset + cur_offset,
1271 depth,
1272 )?;
1273
1274 _prev_end_offset = cur_offset + envelope_size;
1275
1276 Ok(())
1277 }
1278 }
1279
1280 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1281 for CaptureWaitForQuietRequest
1282 {
1283 #[inline(always)]
1284 fn new_empty() -> Self {
1285 Self::default()
1286 }
1287
1288 unsafe fn decode(
1289 &mut self,
1290 decoder: &mut fidl::encoding::Decoder<'_, D>,
1291 offset: usize,
1292 mut depth: fidl::encoding::Depth,
1293 ) -> fidl::Result<()> {
1294 decoder.debug_check_bounds::<Self>(offset);
1295 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1296 None => return Err(fidl::Error::NotNullable),
1297 Some(len) => len,
1298 };
1299 if len == 0 {
1301 return Ok(());
1302 };
1303 depth.increment()?;
1304 let envelope_size = 8;
1305 let bytes_len = len * envelope_size;
1306 let offset = decoder.out_of_line_offset(bytes_len)?;
1307 let mut _next_ordinal_to_read = 0;
1309 let mut next_offset = offset;
1310 let end_offset = offset + bytes_len;
1311 _next_ordinal_to_read += 1;
1312 if next_offset >= end_offset {
1313 return Ok(());
1314 }
1315
1316 while _next_ordinal_to_read < 1 {
1318 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1319 _next_ordinal_to_read += 1;
1320 next_offset += envelope_size;
1321 }
1322
1323 let next_out_of_line = decoder.next_out_of_line();
1324 let handles_before = decoder.remaining_handles();
1325 if let Some((inlined, num_bytes, num_handles)) =
1326 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1327 {
1328 let member_inline_size =
1329 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1330 if inlined != (member_inline_size <= 4) {
1331 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1332 }
1333 let inner_offset;
1334 let mut inner_depth = depth.clone();
1335 if inlined {
1336 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1337 inner_offset = next_offset;
1338 } else {
1339 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1340 inner_depth.increment()?;
1341 }
1342 let val_ref =
1343 self.requested_quiet_period_ms.get_or_insert_with(|| fidl::new_empty!(u32, D));
1344 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1345 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1346 {
1347 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1348 }
1349 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1350 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1351 }
1352 }
1353
1354 next_offset += envelope_size;
1355 _next_ordinal_to_read += 1;
1356 if next_offset >= end_offset {
1357 return Ok(());
1358 }
1359
1360 while _next_ordinal_to_read < 2 {
1362 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1363 _next_ordinal_to_read += 1;
1364 next_offset += envelope_size;
1365 }
1366
1367 let next_out_of_line = decoder.next_out_of_line();
1368 let handles_before = decoder.remaining_handles();
1369 if let Some((inlined, num_bytes, num_handles)) =
1370 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1371 {
1372 let member_inline_size =
1373 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1374 if inlined != (member_inline_size <= 4) {
1375 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1376 }
1377 let inner_offset;
1378 let mut inner_depth = depth.clone();
1379 if inlined {
1380 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1381 inner_offset = next_offset;
1382 } else {
1383 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1384 inner_depth.increment()?;
1385 }
1386 let val_ref =
1387 self.maximum_wait_time_ms.get_or_insert_with(|| fidl::new_empty!(u32, D));
1388 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1389 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1390 {
1391 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1392 }
1393 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1394 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1395 }
1396 }
1397
1398 next_offset += envelope_size;
1399
1400 while next_offset < end_offset {
1402 _next_ordinal_to_read += 1;
1403 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1404 next_offset += envelope_size;
1405 }
1406
1407 Ok(())
1408 }
1409 }
1410}