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
11#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13#[repr(u32)]
14pub enum PlaySoundError {
15 NoSuchSound = 1,
17 RendererFailed = 2,
19 Stopped = 3,
21}
22
23impl PlaySoundError {
24 #[inline]
25 pub fn from_primitive(prim: u32) -> Option<Self> {
26 match prim {
27 1 => Some(Self::NoSuchSound),
28 2 => Some(Self::RendererFailed),
29 3 => Some(Self::Stopped),
30 _ => None,
31 }
32 }
33
34 #[inline]
35 pub const fn into_primitive(self) -> u32 {
36 self as u32
37 }
38
39 #[deprecated = "Strict enums should not use `is_unknown`"]
40 #[inline]
41 pub fn is_unknown(&self) -> bool {
42 false
43 }
44}
45
46#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub struct PlayerPlaySound2Request {
48 pub id: u32,
49 pub usage: fidl_fuchsia_media::AudioRenderUsage2,
50}
51
52impl fidl::Persistable for PlayerPlaySound2Request {}
53
54#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
55pub struct PlayerPlaySoundRequest {
56 pub id: u32,
57 pub usage: fidl_fuchsia_media::AudioRenderUsage,
58}
59
60impl fidl::Persistable for PlayerPlaySoundRequest {}
61
62#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
63#[repr(C)]
64pub struct PlayerRemoveSoundRequest {
65 pub id: u32,
66}
67
68impl fidl::Persistable for PlayerRemoveSoundRequest {}
69
70#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
71#[repr(C)]
72pub struct PlayerStopPlayingSoundRequest {
73 pub id: u32,
74}
75
76impl fidl::Persistable for PlayerStopPlayingSoundRequest {}
77
78#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
79#[repr(C)]
80pub struct PlayerAddSoundFromFileResponse {
81 pub duration: i64,
82}
83
84impl fidl::Persistable for PlayerAddSoundFromFileResponse {}
85
86mod internal {
87 use super::*;
88 unsafe impl fidl::encoding::TypeMarker for PlaySoundError {
89 type Owned = Self;
90
91 #[inline(always)]
92 fn inline_align(_context: fidl::encoding::Context) -> usize {
93 std::mem::align_of::<u32>()
94 }
95
96 #[inline(always)]
97 fn inline_size(_context: fidl::encoding::Context) -> usize {
98 std::mem::size_of::<u32>()
99 }
100
101 #[inline(always)]
102 fn encode_is_copy() -> bool {
103 true
104 }
105
106 #[inline(always)]
107 fn decode_is_copy() -> bool {
108 false
109 }
110 }
111
112 impl fidl::encoding::ValueTypeMarker for PlaySoundError {
113 type Borrowed<'a> = Self;
114 #[inline(always)]
115 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
116 *value
117 }
118 }
119
120 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PlaySoundError {
121 #[inline]
122 unsafe fn encode(
123 self,
124 encoder: &mut fidl::encoding::Encoder<'_, D>,
125 offset: usize,
126 _depth: fidl::encoding::Depth,
127 ) -> fidl::Result<()> {
128 encoder.debug_check_bounds::<Self>(offset);
129 encoder.write_num(self.into_primitive(), offset);
130 Ok(())
131 }
132 }
133
134 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlaySoundError {
135 #[inline(always)]
136 fn new_empty() -> Self {
137 Self::NoSuchSound
138 }
139
140 #[inline]
141 unsafe fn decode(
142 &mut self,
143 decoder: &mut fidl::encoding::Decoder<'_, D>,
144 offset: usize,
145 _depth: fidl::encoding::Depth,
146 ) -> fidl::Result<()> {
147 decoder.debug_check_bounds::<Self>(offset);
148 let prim = decoder.read_num::<u32>(offset);
149
150 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
151 Ok(())
152 }
153 }
154
155 impl fidl::encoding::ValueTypeMarker for PlayerPlaySound2Request {
156 type Borrowed<'a> = &'a Self;
157 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
158 value
159 }
160 }
161
162 unsafe impl fidl::encoding::TypeMarker for PlayerPlaySound2Request {
163 type Owned = Self;
164
165 #[inline(always)]
166 fn inline_align(_context: fidl::encoding::Context) -> usize {
167 4
168 }
169
170 #[inline(always)]
171 fn inline_size(_context: fidl::encoding::Context) -> usize {
172 8
173 }
174 }
175
176 unsafe impl<D: fidl::encoding::ResourceDialect>
177 fidl::encoding::Encode<PlayerPlaySound2Request, D> for &PlayerPlaySound2Request
178 {
179 #[inline]
180 unsafe fn encode(
181 self,
182 encoder: &mut fidl::encoding::Encoder<'_, D>,
183 offset: usize,
184 _depth: fidl::encoding::Depth,
185 ) -> fidl::Result<()> {
186 encoder.debug_check_bounds::<PlayerPlaySound2Request>(offset);
187 fidl::encoding::Encode::<PlayerPlaySound2Request, D>::encode(
189 (
190 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
191 <fidl_fuchsia_media::AudioRenderUsage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
192 ),
193 encoder, offset, _depth
194 )
195 }
196 }
197 unsafe impl<
198 D: fidl::encoding::ResourceDialect,
199 T0: fidl::encoding::Encode<u32, D>,
200 T1: fidl::encoding::Encode<fidl_fuchsia_media::AudioRenderUsage2, D>,
201 > fidl::encoding::Encode<PlayerPlaySound2Request, D> for (T0, T1)
202 {
203 #[inline]
204 unsafe fn encode(
205 self,
206 encoder: &mut fidl::encoding::Encoder<'_, D>,
207 offset: usize,
208 depth: fidl::encoding::Depth,
209 ) -> fidl::Result<()> {
210 encoder.debug_check_bounds::<PlayerPlaySound2Request>(offset);
211 self.0.encode(encoder, offset + 0, depth)?;
215 self.1.encode(encoder, offset + 4, depth)?;
216 Ok(())
217 }
218 }
219
220 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
221 for PlayerPlaySound2Request
222 {
223 #[inline(always)]
224 fn new_empty() -> Self {
225 Self {
226 id: fidl::new_empty!(u32, D),
227 usage: fidl::new_empty!(fidl_fuchsia_media::AudioRenderUsage2, D),
228 }
229 }
230
231 #[inline]
232 unsafe fn decode(
233 &mut self,
234 decoder: &mut fidl::encoding::Decoder<'_, D>,
235 offset: usize,
236 _depth: fidl::encoding::Depth,
237 ) -> fidl::Result<()> {
238 decoder.debug_check_bounds::<Self>(offset);
239 fidl::decode!(u32, D, &mut self.id, decoder, offset + 0, _depth)?;
241 fidl::decode!(
242 fidl_fuchsia_media::AudioRenderUsage2,
243 D,
244 &mut self.usage,
245 decoder,
246 offset + 4,
247 _depth
248 )?;
249 Ok(())
250 }
251 }
252
253 impl fidl::encoding::ValueTypeMarker for PlayerPlaySoundRequest {
254 type Borrowed<'a> = &'a Self;
255 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
256 value
257 }
258 }
259
260 unsafe impl fidl::encoding::TypeMarker for PlayerPlaySoundRequest {
261 type Owned = Self;
262
263 #[inline(always)]
264 fn inline_align(_context: fidl::encoding::Context) -> usize {
265 4
266 }
267
268 #[inline(always)]
269 fn inline_size(_context: fidl::encoding::Context) -> usize {
270 8
271 }
272 }
273
274 unsafe impl<D: fidl::encoding::ResourceDialect>
275 fidl::encoding::Encode<PlayerPlaySoundRequest, D> for &PlayerPlaySoundRequest
276 {
277 #[inline]
278 unsafe fn encode(
279 self,
280 encoder: &mut fidl::encoding::Encoder<'_, D>,
281 offset: usize,
282 _depth: fidl::encoding::Depth,
283 ) -> fidl::Result<()> {
284 encoder.debug_check_bounds::<PlayerPlaySoundRequest>(offset);
285 fidl::encoding::Encode::<PlayerPlaySoundRequest, D>::encode(
287 (
288 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
289 <fidl_fuchsia_media::AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
290 ),
291 encoder, offset, _depth
292 )
293 }
294 }
295 unsafe impl<
296 D: fidl::encoding::ResourceDialect,
297 T0: fidl::encoding::Encode<u32, D>,
298 T1: fidl::encoding::Encode<fidl_fuchsia_media::AudioRenderUsage, D>,
299 > fidl::encoding::Encode<PlayerPlaySoundRequest, D> for (T0, T1)
300 {
301 #[inline]
302 unsafe fn encode(
303 self,
304 encoder: &mut fidl::encoding::Encoder<'_, D>,
305 offset: usize,
306 depth: fidl::encoding::Depth,
307 ) -> fidl::Result<()> {
308 encoder.debug_check_bounds::<PlayerPlaySoundRequest>(offset);
309 self.0.encode(encoder, offset + 0, depth)?;
313 self.1.encode(encoder, offset + 4, depth)?;
314 Ok(())
315 }
316 }
317
318 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
319 for PlayerPlaySoundRequest
320 {
321 #[inline(always)]
322 fn new_empty() -> Self {
323 Self {
324 id: fidl::new_empty!(u32, D),
325 usage: fidl::new_empty!(fidl_fuchsia_media::AudioRenderUsage, D),
326 }
327 }
328
329 #[inline]
330 unsafe fn decode(
331 &mut self,
332 decoder: &mut fidl::encoding::Decoder<'_, D>,
333 offset: usize,
334 _depth: fidl::encoding::Depth,
335 ) -> fidl::Result<()> {
336 decoder.debug_check_bounds::<Self>(offset);
337 fidl::decode!(u32, D, &mut self.id, decoder, offset + 0, _depth)?;
339 fidl::decode!(
340 fidl_fuchsia_media::AudioRenderUsage,
341 D,
342 &mut self.usage,
343 decoder,
344 offset + 4,
345 _depth
346 )?;
347 Ok(())
348 }
349 }
350
351 impl fidl::encoding::ValueTypeMarker for PlayerRemoveSoundRequest {
352 type Borrowed<'a> = &'a Self;
353 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
354 value
355 }
356 }
357
358 unsafe impl fidl::encoding::TypeMarker for PlayerRemoveSoundRequest {
359 type Owned = Self;
360
361 #[inline(always)]
362 fn inline_align(_context: fidl::encoding::Context) -> usize {
363 4
364 }
365
366 #[inline(always)]
367 fn inline_size(_context: fidl::encoding::Context) -> usize {
368 4
369 }
370 #[inline(always)]
371 fn encode_is_copy() -> bool {
372 true
373 }
374
375 #[inline(always)]
376 fn decode_is_copy() -> bool {
377 true
378 }
379 }
380
381 unsafe impl<D: fidl::encoding::ResourceDialect>
382 fidl::encoding::Encode<PlayerRemoveSoundRequest, D> for &PlayerRemoveSoundRequest
383 {
384 #[inline]
385 unsafe fn encode(
386 self,
387 encoder: &mut fidl::encoding::Encoder<'_, D>,
388 offset: usize,
389 _depth: fidl::encoding::Depth,
390 ) -> fidl::Result<()> {
391 encoder.debug_check_bounds::<PlayerRemoveSoundRequest>(offset);
392 unsafe {
393 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
395 (buf_ptr as *mut PlayerRemoveSoundRequest)
396 .write_unaligned((self as *const PlayerRemoveSoundRequest).read());
397 }
400 Ok(())
401 }
402 }
403 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
404 fidl::encoding::Encode<PlayerRemoveSoundRequest, D> for (T0,)
405 {
406 #[inline]
407 unsafe fn encode(
408 self,
409 encoder: &mut fidl::encoding::Encoder<'_, D>,
410 offset: usize,
411 depth: fidl::encoding::Depth,
412 ) -> fidl::Result<()> {
413 encoder.debug_check_bounds::<PlayerRemoveSoundRequest>(offset);
414 self.0.encode(encoder, offset + 0, depth)?;
418 Ok(())
419 }
420 }
421
422 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
423 for PlayerRemoveSoundRequest
424 {
425 #[inline(always)]
426 fn new_empty() -> Self {
427 Self { id: fidl::new_empty!(u32, D) }
428 }
429
430 #[inline]
431 unsafe fn decode(
432 &mut self,
433 decoder: &mut fidl::encoding::Decoder<'_, D>,
434 offset: usize,
435 _depth: fidl::encoding::Depth,
436 ) -> fidl::Result<()> {
437 decoder.debug_check_bounds::<Self>(offset);
438 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
439 unsafe {
442 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
443 }
444 Ok(())
445 }
446 }
447
448 impl fidl::encoding::ValueTypeMarker for PlayerStopPlayingSoundRequest {
449 type Borrowed<'a> = &'a Self;
450 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
451 value
452 }
453 }
454
455 unsafe impl fidl::encoding::TypeMarker for PlayerStopPlayingSoundRequest {
456 type Owned = Self;
457
458 #[inline(always)]
459 fn inline_align(_context: fidl::encoding::Context) -> usize {
460 4
461 }
462
463 #[inline(always)]
464 fn inline_size(_context: fidl::encoding::Context) -> usize {
465 4
466 }
467 #[inline(always)]
468 fn encode_is_copy() -> bool {
469 true
470 }
471
472 #[inline(always)]
473 fn decode_is_copy() -> bool {
474 true
475 }
476 }
477
478 unsafe impl<D: fidl::encoding::ResourceDialect>
479 fidl::encoding::Encode<PlayerStopPlayingSoundRequest, D>
480 for &PlayerStopPlayingSoundRequest
481 {
482 #[inline]
483 unsafe fn encode(
484 self,
485 encoder: &mut fidl::encoding::Encoder<'_, D>,
486 offset: usize,
487 _depth: fidl::encoding::Depth,
488 ) -> fidl::Result<()> {
489 encoder.debug_check_bounds::<PlayerStopPlayingSoundRequest>(offset);
490 unsafe {
491 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
493 (buf_ptr as *mut PlayerStopPlayingSoundRequest)
494 .write_unaligned((self as *const PlayerStopPlayingSoundRequest).read());
495 }
498 Ok(())
499 }
500 }
501 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
502 fidl::encoding::Encode<PlayerStopPlayingSoundRequest, D> for (T0,)
503 {
504 #[inline]
505 unsafe fn encode(
506 self,
507 encoder: &mut fidl::encoding::Encoder<'_, D>,
508 offset: usize,
509 depth: fidl::encoding::Depth,
510 ) -> fidl::Result<()> {
511 encoder.debug_check_bounds::<PlayerStopPlayingSoundRequest>(offset);
512 self.0.encode(encoder, offset + 0, depth)?;
516 Ok(())
517 }
518 }
519
520 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
521 for PlayerStopPlayingSoundRequest
522 {
523 #[inline(always)]
524 fn new_empty() -> Self {
525 Self { id: fidl::new_empty!(u32, D) }
526 }
527
528 #[inline]
529 unsafe fn decode(
530 &mut self,
531 decoder: &mut fidl::encoding::Decoder<'_, D>,
532 offset: usize,
533 _depth: fidl::encoding::Depth,
534 ) -> fidl::Result<()> {
535 decoder.debug_check_bounds::<Self>(offset);
536 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
537 unsafe {
540 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
541 }
542 Ok(())
543 }
544 }
545
546 impl fidl::encoding::ValueTypeMarker for PlayerAddSoundFromFileResponse {
547 type Borrowed<'a> = &'a Self;
548 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
549 value
550 }
551 }
552
553 unsafe impl fidl::encoding::TypeMarker for PlayerAddSoundFromFileResponse {
554 type Owned = Self;
555
556 #[inline(always)]
557 fn inline_align(_context: fidl::encoding::Context) -> usize {
558 8
559 }
560
561 #[inline(always)]
562 fn inline_size(_context: fidl::encoding::Context) -> usize {
563 8
564 }
565 #[inline(always)]
566 fn encode_is_copy() -> bool {
567 true
568 }
569
570 #[inline(always)]
571 fn decode_is_copy() -> bool {
572 true
573 }
574 }
575
576 unsafe impl<D: fidl::encoding::ResourceDialect>
577 fidl::encoding::Encode<PlayerAddSoundFromFileResponse, D>
578 for &PlayerAddSoundFromFileResponse
579 {
580 #[inline]
581 unsafe fn encode(
582 self,
583 encoder: &mut fidl::encoding::Encoder<'_, D>,
584 offset: usize,
585 _depth: fidl::encoding::Depth,
586 ) -> fidl::Result<()> {
587 encoder.debug_check_bounds::<PlayerAddSoundFromFileResponse>(offset);
588 unsafe {
589 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
591 (buf_ptr as *mut PlayerAddSoundFromFileResponse)
592 .write_unaligned((self as *const PlayerAddSoundFromFileResponse).read());
593 }
596 Ok(())
597 }
598 }
599 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
600 fidl::encoding::Encode<PlayerAddSoundFromFileResponse, D> for (T0,)
601 {
602 #[inline]
603 unsafe fn encode(
604 self,
605 encoder: &mut fidl::encoding::Encoder<'_, D>,
606 offset: usize,
607 depth: fidl::encoding::Depth,
608 ) -> fidl::Result<()> {
609 encoder.debug_check_bounds::<PlayerAddSoundFromFileResponse>(offset);
610 self.0.encode(encoder, offset + 0, depth)?;
614 Ok(())
615 }
616 }
617
618 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
619 for PlayerAddSoundFromFileResponse
620 {
621 #[inline(always)]
622 fn new_empty() -> Self {
623 Self { duration: fidl::new_empty!(i64, D) }
624 }
625
626 #[inline]
627 unsafe fn decode(
628 &mut self,
629 decoder: &mut fidl::encoding::Decoder<'_, D>,
630 offset: usize,
631 _depth: fidl::encoding::Depth,
632 ) -> fidl::Result<()> {
633 decoder.debug_check_bounds::<Self>(offset);
634 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
635 unsafe {
638 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
639 }
640 Ok(())
641 }
642 }
643}