1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_ultrasound_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct FactoryCreateCapturerRequest {
16 pub request: fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioCapturerMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for FactoryCreateCapturerRequest
21{
22}
23
24#[derive(Debug, PartialEq)]
25pub struct FactoryCreateCapturerResponse {
26 pub reference_clock: fidl::Clock,
27 pub stream_type: fidl_fuchsia_media::AudioStreamType,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for FactoryCreateCapturerResponse
32{
33}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct FactoryCreateRendererRequest {
37 pub renderer: fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioRendererMarker>,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
41 for FactoryCreateRendererRequest
42{
43}
44
45#[derive(Debug, PartialEq)]
46pub struct FactoryCreateRendererResponse {
47 pub reference_clock: fidl::Clock,
48 pub stream_type: fidl_fuchsia_media::AudioStreamType,
49}
50
51impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
52 for FactoryCreateRendererResponse
53{
54}
55
56#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
57pub struct FactoryMarker;
58
59impl fidl::endpoints::ProtocolMarker for FactoryMarker {
60 type Proxy = FactoryProxy;
61 type RequestStream = FactoryRequestStream;
62 #[cfg(target_os = "fuchsia")]
63 type SynchronousProxy = FactorySynchronousProxy;
64
65 const DEBUG_NAME: &'static str = "fuchsia.ultrasound.Factory";
66}
67impl fidl::endpoints::DiscoverableProtocolMarker for FactoryMarker {}
68
69pub trait FactoryProxyInterface: Send + Sync {
70 type CreateCapturerResponseFut: std::future::Future<
71 Output = Result<(fidl::Clock, fidl_fuchsia_media::AudioStreamType), fidl::Error>,
72 > + Send;
73 fn r#create_capturer(
74 &self,
75 request: fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioCapturerMarker>,
76 ) -> Self::CreateCapturerResponseFut;
77 type CreateRendererResponseFut: std::future::Future<
78 Output = Result<(fidl::Clock, fidl_fuchsia_media::AudioStreamType), fidl::Error>,
79 > + Send;
80 fn r#create_renderer(
81 &self,
82 renderer: fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioRendererMarker>,
83 ) -> Self::CreateRendererResponseFut;
84}
85#[derive(Debug)]
86#[cfg(target_os = "fuchsia")]
87pub struct FactorySynchronousProxy {
88 client: fidl::client::sync::Client,
89}
90
91#[cfg(target_os = "fuchsia")]
92impl fidl::endpoints::SynchronousProxy for FactorySynchronousProxy {
93 type Proxy = FactoryProxy;
94 type Protocol = FactoryMarker;
95
96 fn from_channel(inner: fidl::Channel) -> Self {
97 Self::new(inner)
98 }
99
100 fn into_channel(self) -> fidl::Channel {
101 self.client.into_channel()
102 }
103
104 fn as_channel(&self) -> &fidl::Channel {
105 self.client.as_channel()
106 }
107}
108
109#[cfg(target_os = "fuchsia")]
110impl FactorySynchronousProxy {
111 pub fn new(channel: fidl::Channel) -> Self {
112 let protocol_name = <FactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
113 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
114 }
115
116 pub fn into_channel(self) -> fidl::Channel {
117 self.client.into_channel()
118 }
119
120 pub fn wait_for_event(
123 &self,
124 deadline: zx::MonotonicInstant,
125 ) -> Result<FactoryEvent, fidl::Error> {
126 FactoryEvent::decode(self.client.wait_for_event(deadline)?)
127 }
128
129 pub fn r#create_capturer(
150 &self,
151 mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioCapturerMarker>,
152 ___deadline: zx::MonotonicInstant,
153 ) -> Result<(fidl::Clock, fidl_fuchsia_media::AudioStreamType), fidl::Error> {
154 let _response =
155 self.client.send_query::<FactoryCreateCapturerRequest, FactoryCreateCapturerResponse>(
156 (request,),
157 0xe8b6e0e27f02115,
158 fidl::encoding::DynamicFlags::empty(),
159 ___deadline,
160 )?;
161 Ok((_response.reference_clock, _response.stream_type))
162 }
163
164 pub fn r#create_renderer(
185 &self,
186 mut renderer: fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioRendererMarker>,
187 ___deadline: zx::MonotonicInstant,
188 ) -> Result<(fidl::Clock, fidl_fuchsia_media::AudioStreamType), fidl::Error> {
189 let _response =
190 self.client.send_query::<FactoryCreateRendererRequest, FactoryCreateRendererResponse>(
191 (renderer,),
192 0x3ce8fb1897ec7932,
193 fidl::encoding::DynamicFlags::empty(),
194 ___deadline,
195 )?;
196 Ok((_response.reference_clock, _response.stream_type))
197 }
198}
199
200#[cfg(target_os = "fuchsia")]
201impl From<FactorySynchronousProxy> for zx::Handle {
202 fn from(value: FactorySynchronousProxy) -> Self {
203 value.into_channel().into()
204 }
205}
206
207#[cfg(target_os = "fuchsia")]
208impl From<fidl::Channel> for FactorySynchronousProxy {
209 fn from(value: fidl::Channel) -> Self {
210 Self::new(value)
211 }
212}
213
214#[derive(Debug, Clone)]
215pub struct FactoryProxy {
216 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
217}
218
219impl fidl::endpoints::Proxy for FactoryProxy {
220 type Protocol = FactoryMarker;
221
222 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
223 Self::new(inner)
224 }
225
226 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
227 self.client.into_channel().map_err(|client| Self { client })
228 }
229
230 fn as_channel(&self) -> &::fidl::AsyncChannel {
231 self.client.as_channel()
232 }
233}
234
235impl FactoryProxy {
236 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
238 let protocol_name = <FactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
239 Self { client: fidl::client::Client::new(channel, protocol_name) }
240 }
241
242 pub fn take_event_stream(&self) -> FactoryEventStream {
248 FactoryEventStream { event_receiver: self.client.take_event_receiver() }
249 }
250
251 pub fn r#create_capturer(
272 &self,
273 mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioCapturerMarker>,
274 ) -> fidl::client::QueryResponseFut<
275 (fidl::Clock, fidl_fuchsia_media::AudioStreamType),
276 fidl::encoding::DefaultFuchsiaResourceDialect,
277 > {
278 FactoryProxyInterface::r#create_capturer(self, request)
279 }
280
281 pub fn r#create_renderer(
302 &self,
303 mut renderer: fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioRendererMarker>,
304 ) -> fidl::client::QueryResponseFut<
305 (fidl::Clock, fidl_fuchsia_media::AudioStreamType),
306 fidl::encoding::DefaultFuchsiaResourceDialect,
307 > {
308 FactoryProxyInterface::r#create_renderer(self, renderer)
309 }
310}
311
312impl FactoryProxyInterface for FactoryProxy {
313 type CreateCapturerResponseFut = fidl::client::QueryResponseFut<
314 (fidl::Clock, fidl_fuchsia_media::AudioStreamType),
315 fidl::encoding::DefaultFuchsiaResourceDialect,
316 >;
317 fn r#create_capturer(
318 &self,
319 mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioCapturerMarker>,
320 ) -> Self::CreateCapturerResponseFut {
321 fn _decode(
322 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
323 ) -> Result<(fidl::Clock, fidl_fuchsia_media::AudioStreamType), fidl::Error> {
324 let _response = fidl::client::decode_transaction_body::<
325 FactoryCreateCapturerResponse,
326 fidl::encoding::DefaultFuchsiaResourceDialect,
327 0xe8b6e0e27f02115,
328 >(_buf?)?;
329 Ok((_response.reference_clock, _response.stream_type))
330 }
331 self.client.send_query_and_decode::<
332 FactoryCreateCapturerRequest,
333 (fidl::Clock, fidl_fuchsia_media::AudioStreamType),
334 >(
335 (request,),
336 0xe8b6e0e27f02115,
337 fidl::encoding::DynamicFlags::empty(),
338 _decode,
339 )
340 }
341
342 type CreateRendererResponseFut = fidl::client::QueryResponseFut<
343 (fidl::Clock, fidl_fuchsia_media::AudioStreamType),
344 fidl::encoding::DefaultFuchsiaResourceDialect,
345 >;
346 fn r#create_renderer(
347 &self,
348 mut renderer: fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioRendererMarker>,
349 ) -> Self::CreateRendererResponseFut {
350 fn _decode(
351 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
352 ) -> Result<(fidl::Clock, fidl_fuchsia_media::AudioStreamType), fidl::Error> {
353 let _response = fidl::client::decode_transaction_body::<
354 FactoryCreateRendererResponse,
355 fidl::encoding::DefaultFuchsiaResourceDialect,
356 0x3ce8fb1897ec7932,
357 >(_buf?)?;
358 Ok((_response.reference_clock, _response.stream_type))
359 }
360 self.client.send_query_and_decode::<
361 FactoryCreateRendererRequest,
362 (fidl::Clock, fidl_fuchsia_media::AudioStreamType),
363 >(
364 (renderer,),
365 0x3ce8fb1897ec7932,
366 fidl::encoding::DynamicFlags::empty(),
367 _decode,
368 )
369 }
370}
371
372pub struct FactoryEventStream {
373 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
374}
375
376impl std::marker::Unpin for FactoryEventStream {}
377
378impl futures::stream::FusedStream for FactoryEventStream {
379 fn is_terminated(&self) -> bool {
380 self.event_receiver.is_terminated()
381 }
382}
383
384impl futures::Stream for FactoryEventStream {
385 type Item = Result<FactoryEvent, fidl::Error>;
386
387 fn poll_next(
388 mut self: std::pin::Pin<&mut Self>,
389 cx: &mut std::task::Context<'_>,
390 ) -> std::task::Poll<Option<Self::Item>> {
391 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
392 &mut self.event_receiver,
393 cx
394 )?) {
395 Some(buf) => std::task::Poll::Ready(Some(FactoryEvent::decode(buf))),
396 None => std::task::Poll::Ready(None),
397 }
398 }
399}
400
401#[derive(Debug)]
402pub enum FactoryEvent {}
403
404impl FactoryEvent {
405 fn decode(
407 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
408 ) -> Result<FactoryEvent, fidl::Error> {
409 let (bytes, _handles) = buf.split_mut();
410 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
411 debug_assert_eq!(tx_header.tx_id, 0);
412 match tx_header.ordinal {
413 _ => Err(fidl::Error::UnknownOrdinal {
414 ordinal: tx_header.ordinal,
415 protocol_name: <FactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
416 }),
417 }
418 }
419}
420
421pub struct FactoryRequestStream {
423 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
424 is_terminated: bool,
425}
426
427impl std::marker::Unpin for FactoryRequestStream {}
428
429impl futures::stream::FusedStream for FactoryRequestStream {
430 fn is_terminated(&self) -> bool {
431 self.is_terminated
432 }
433}
434
435impl fidl::endpoints::RequestStream for FactoryRequestStream {
436 type Protocol = FactoryMarker;
437 type ControlHandle = FactoryControlHandle;
438
439 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
440 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
441 }
442
443 fn control_handle(&self) -> Self::ControlHandle {
444 FactoryControlHandle { inner: self.inner.clone() }
445 }
446
447 fn into_inner(
448 self,
449 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
450 {
451 (self.inner, self.is_terminated)
452 }
453
454 fn from_inner(
455 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
456 is_terminated: bool,
457 ) -> Self {
458 Self { inner, is_terminated }
459 }
460}
461
462impl futures::Stream for FactoryRequestStream {
463 type Item = Result<FactoryRequest, fidl::Error>;
464
465 fn poll_next(
466 mut self: std::pin::Pin<&mut Self>,
467 cx: &mut std::task::Context<'_>,
468 ) -> std::task::Poll<Option<Self::Item>> {
469 let this = &mut *self;
470 if this.inner.check_shutdown(cx) {
471 this.is_terminated = true;
472 return std::task::Poll::Ready(None);
473 }
474 if this.is_terminated {
475 panic!("polled FactoryRequestStream after completion");
476 }
477 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
478 |bytes, handles| {
479 match this.inner.channel().read_etc(cx, bytes, handles) {
480 std::task::Poll::Ready(Ok(())) => {}
481 std::task::Poll::Pending => return std::task::Poll::Pending,
482 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
483 this.is_terminated = true;
484 return std::task::Poll::Ready(None);
485 }
486 std::task::Poll::Ready(Err(e)) => {
487 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
488 e.into(),
489 ))))
490 }
491 }
492
493 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
495
496 std::task::Poll::Ready(Some(match header.ordinal {
497 0xe8b6e0e27f02115 => {
498 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
499 let mut req = fidl::new_empty!(
500 FactoryCreateCapturerRequest,
501 fidl::encoding::DefaultFuchsiaResourceDialect
502 );
503 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryCreateCapturerRequest>(&header, _body_bytes, handles, &mut req)?;
504 let control_handle = FactoryControlHandle { inner: this.inner.clone() };
505 Ok(FactoryRequest::CreateCapturer {
506 request: req.request,
507
508 responder: FactoryCreateCapturerResponder {
509 control_handle: std::mem::ManuallyDrop::new(control_handle),
510 tx_id: header.tx_id,
511 },
512 })
513 }
514 0x3ce8fb1897ec7932 => {
515 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
516 let mut req = fidl::new_empty!(
517 FactoryCreateRendererRequest,
518 fidl::encoding::DefaultFuchsiaResourceDialect
519 );
520 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryCreateRendererRequest>(&header, _body_bytes, handles, &mut req)?;
521 let control_handle = FactoryControlHandle { inner: this.inner.clone() };
522 Ok(FactoryRequest::CreateRenderer {
523 renderer: req.renderer,
524
525 responder: FactoryCreateRendererResponder {
526 control_handle: std::mem::ManuallyDrop::new(control_handle),
527 tx_id: header.tx_id,
528 },
529 })
530 }
531 _ => Err(fidl::Error::UnknownOrdinal {
532 ordinal: header.ordinal,
533 protocol_name:
534 <FactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
535 }),
536 }))
537 },
538 )
539 }
540}
541
542#[derive(Debug)]
543pub enum FactoryRequest {
544 CreateCapturer {
565 request: fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioCapturerMarker>,
566 responder: FactoryCreateCapturerResponder,
567 },
568 CreateRenderer {
589 renderer: fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioRendererMarker>,
590 responder: FactoryCreateRendererResponder,
591 },
592}
593
594impl FactoryRequest {
595 #[allow(irrefutable_let_patterns)]
596 pub fn into_create_capturer(
597 self,
598 ) -> Option<(
599 fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioCapturerMarker>,
600 FactoryCreateCapturerResponder,
601 )> {
602 if let FactoryRequest::CreateCapturer { request, responder } = self {
603 Some((request, responder))
604 } else {
605 None
606 }
607 }
608
609 #[allow(irrefutable_let_patterns)]
610 pub fn into_create_renderer(
611 self,
612 ) -> Option<(
613 fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioRendererMarker>,
614 FactoryCreateRendererResponder,
615 )> {
616 if let FactoryRequest::CreateRenderer { renderer, responder } = self {
617 Some((renderer, responder))
618 } else {
619 None
620 }
621 }
622
623 pub fn method_name(&self) -> &'static str {
625 match *self {
626 FactoryRequest::CreateCapturer { .. } => "create_capturer",
627 FactoryRequest::CreateRenderer { .. } => "create_renderer",
628 }
629 }
630}
631
632#[derive(Debug, Clone)]
633pub struct FactoryControlHandle {
634 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
635}
636
637impl fidl::endpoints::ControlHandle for FactoryControlHandle {
638 fn shutdown(&self) {
639 self.inner.shutdown()
640 }
641 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
642 self.inner.shutdown_with_epitaph(status)
643 }
644
645 fn is_closed(&self) -> bool {
646 self.inner.channel().is_closed()
647 }
648 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
649 self.inner.channel().on_closed()
650 }
651
652 #[cfg(target_os = "fuchsia")]
653 fn signal_peer(
654 &self,
655 clear_mask: zx::Signals,
656 set_mask: zx::Signals,
657 ) -> Result<(), zx_status::Status> {
658 use fidl::Peered;
659 self.inner.channel().signal_peer(clear_mask, set_mask)
660 }
661}
662
663impl FactoryControlHandle {}
664
665#[must_use = "FIDL methods require a response to be sent"]
666#[derive(Debug)]
667pub struct FactoryCreateCapturerResponder {
668 control_handle: std::mem::ManuallyDrop<FactoryControlHandle>,
669 tx_id: u32,
670}
671
672impl std::ops::Drop for FactoryCreateCapturerResponder {
676 fn drop(&mut self) {
677 self.control_handle.shutdown();
678 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
680 }
681}
682
683impl fidl::endpoints::Responder for FactoryCreateCapturerResponder {
684 type ControlHandle = FactoryControlHandle;
685
686 fn control_handle(&self) -> &FactoryControlHandle {
687 &self.control_handle
688 }
689
690 fn drop_without_shutdown(mut self) {
691 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
693 std::mem::forget(self);
695 }
696}
697
698impl FactoryCreateCapturerResponder {
699 pub fn send(
703 self,
704 mut reference_clock: fidl::Clock,
705 mut stream_type: &fidl_fuchsia_media::AudioStreamType,
706 ) -> Result<(), fidl::Error> {
707 let _result = self.send_raw(reference_clock, stream_type);
708 if _result.is_err() {
709 self.control_handle.shutdown();
710 }
711 self.drop_without_shutdown();
712 _result
713 }
714
715 pub fn send_no_shutdown_on_err(
717 self,
718 mut reference_clock: fidl::Clock,
719 mut stream_type: &fidl_fuchsia_media::AudioStreamType,
720 ) -> Result<(), fidl::Error> {
721 let _result = self.send_raw(reference_clock, stream_type);
722 self.drop_without_shutdown();
723 _result
724 }
725
726 fn send_raw(
727 &self,
728 mut reference_clock: fidl::Clock,
729 mut stream_type: &fidl_fuchsia_media::AudioStreamType,
730 ) -> Result<(), fidl::Error> {
731 self.control_handle.inner.send::<FactoryCreateCapturerResponse>(
732 (reference_clock, stream_type),
733 self.tx_id,
734 0xe8b6e0e27f02115,
735 fidl::encoding::DynamicFlags::empty(),
736 )
737 }
738}
739
740#[must_use = "FIDL methods require a response to be sent"]
741#[derive(Debug)]
742pub struct FactoryCreateRendererResponder {
743 control_handle: std::mem::ManuallyDrop<FactoryControlHandle>,
744 tx_id: u32,
745}
746
747impl std::ops::Drop for FactoryCreateRendererResponder {
751 fn drop(&mut self) {
752 self.control_handle.shutdown();
753 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
755 }
756}
757
758impl fidl::endpoints::Responder for FactoryCreateRendererResponder {
759 type ControlHandle = FactoryControlHandle;
760
761 fn control_handle(&self) -> &FactoryControlHandle {
762 &self.control_handle
763 }
764
765 fn drop_without_shutdown(mut self) {
766 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
768 std::mem::forget(self);
770 }
771}
772
773impl FactoryCreateRendererResponder {
774 pub fn send(
778 self,
779 mut reference_clock: fidl::Clock,
780 mut stream_type: &fidl_fuchsia_media::AudioStreamType,
781 ) -> Result<(), fidl::Error> {
782 let _result = self.send_raw(reference_clock, stream_type);
783 if _result.is_err() {
784 self.control_handle.shutdown();
785 }
786 self.drop_without_shutdown();
787 _result
788 }
789
790 pub fn send_no_shutdown_on_err(
792 self,
793 mut reference_clock: fidl::Clock,
794 mut stream_type: &fidl_fuchsia_media::AudioStreamType,
795 ) -> Result<(), fidl::Error> {
796 let _result = self.send_raw(reference_clock, stream_type);
797 self.drop_without_shutdown();
798 _result
799 }
800
801 fn send_raw(
802 &self,
803 mut reference_clock: fidl::Clock,
804 mut stream_type: &fidl_fuchsia_media::AudioStreamType,
805 ) -> Result<(), fidl::Error> {
806 self.control_handle.inner.send::<FactoryCreateRendererResponse>(
807 (reference_clock, stream_type),
808 self.tx_id,
809 0x3ce8fb1897ec7932,
810 fidl::encoding::DynamicFlags::empty(),
811 )
812 }
813}
814
815mod internal {
816 use super::*;
817
818 impl fidl::encoding::ResourceTypeMarker for FactoryCreateCapturerRequest {
819 type Borrowed<'a> = &'a mut Self;
820 fn take_or_borrow<'a>(
821 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
822 ) -> Self::Borrowed<'a> {
823 value
824 }
825 }
826
827 unsafe impl fidl::encoding::TypeMarker for FactoryCreateCapturerRequest {
828 type Owned = Self;
829
830 #[inline(always)]
831 fn inline_align(_context: fidl::encoding::Context) -> usize {
832 4
833 }
834
835 #[inline(always)]
836 fn inline_size(_context: fidl::encoding::Context) -> usize {
837 4
838 }
839 }
840
841 unsafe impl
842 fidl::encoding::Encode<
843 FactoryCreateCapturerRequest,
844 fidl::encoding::DefaultFuchsiaResourceDialect,
845 > for &mut FactoryCreateCapturerRequest
846 {
847 #[inline]
848 unsafe fn encode(
849 self,
850 encoder: &mut fidl::encoding::Encoder<
851 '_,
852 fidl::encoding::DefaultFuchsiaResourceDialect,
853 >,
854 offset: usize,
855 _depth: fidl::encoding::Depth,
856 ) -> fidl::Result<()> {
857 encoder.debug_check_bounds::<FactoryCreateCapturerRequest>(offset);
858 fidl::encoding::Encode::<
860 FactoryCreateCapturerRequest,
861 fidl::encoding::DefaultFuchsiaResourceDialect,
862 >::encode(
863 (<fidl::encoding::Endpoint<
864 fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioCapturerMarker>,
865 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
866 &mut self.request
867 ),),
868 encoder,
869 offset,
870 _depth,
871 )
872 }
873 }
874 unsafe impl<
875 T0: fidl::encoding::Encode<
876 fidl::encoding::Endpoint<
877 fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioCapturerMarker>,
878 >,
879 fidl::encoding::DefaultFuchsiaResourceDialect,
880 >,
881 >
882 fidl::encoding::Encode<
883 FactoryCreateCapturerRequest,
884 fidl::encoding::DefaultFuchsiaResourceDialect,
885 > for (T0,)
886 {
887 #[inline]
888 unsafe fn encode(
889 self,
890 encoder: &mut fidl::encoding::Encoder<
891 '_,
892 fidl::encoding::DefaultFuchsiaResourceDialect,
893 >,
894 offset: usize,
895 depth: fidl::encoding::Depth,
896 ) -> fidl::Result<()> {
897 encoder.debug_check_bounds::<FactoryCreateCapturerRequest>(offset);
898 self.0.encode(encoder, offset + 0, depth)?;
902 Ok(())
903 }
904 }
905
906 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
907 for FactoryCreateCapturerRequest
908 {
909 #[inline(always)]
910 fn new_empty() -> Self {
911 Self {
912 request: fidl::new_empty!(
913 fidl::encoding::Endpoint<
914 fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioCapturerMarker>,
915 >,
916 fidl::encoding::DefaultFuchsiaResourceDialect
917 ),
918 }
919 }
920
921 #[inline]
922 unsafe fn decode(
923 &mut self,
924 decoder: &mut fidl::encoding::Decoder<
925 '_,
926 fidl::encoding::DefaultFuchsiaResourceDialect,
927 >,
928 offset: usize,
929 _depth: fidl::encoding::Depth,
930 ) -> fidl::Result<()> {
931 decoder.debug_check_bounds::<Self>(offset);
932 fidl::decode!(
934 fidl::encoding::Endpoint<
935 fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioCapturerMarker>,
936 >,
937 fidl::encoding::DefaultFuchsiaResourceDialect,
938 &mut self.request,
939 decoder,
940 offset + 0,
941 _depth
942 )?;
943 Ok(())
944 }
945 }
946
947 impl fidl::encoding::ResourceTypeMarker for FactoryCreateCapturerResponse {
948 type Borrowed<'a> = &'a mut Self;
949 fn take_or_borrow<'a>(
950 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
951 ) -> Self::Borrowed<'a> {
952 value
953 }
954 }
955
956 unsafe impl fidl::encoding::TypeMarker for FactoryCreateCapturerResponse {
957 type Owned = Self;
958
959 #[inline(always)]
960 fn inline_align(_context: fidl::encoding::Context) -> usize {
961 4
962 }
963
964 #[inline(always)]
965 fn inline_size(_context: fidl::encoding::Context) -> usize {
966 16
967 }
968 }
969
970 unsafe impl
971 fidl::encoding::Encode<
972 FactoryCreateCapturerResponse,
973 fidl::encoding::DefaultFuchsiaResourceDialect,
974 > for &mut FactoryCreateCapturerResponse
975 {
976 #[inline]
977 unsafe fn encode(
978 self,
979 encoder: &mut fidl::encoding::Encoder<
980 '_,
981 fidl::encoding::DefaultFuchsiaResourceDialect,
982 >,
983 offset: usize,
984 _depth: fidl::encoding::Depth,
985 ) -> fidl::Result<()> {
986 encoder.debug_check_bounds::<FactoryCreateCapturerResponse>(offset);
987 fidl::encoding::Encode::<FactoryCreateCapturerResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
989 (
990 <fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reference_clock),
991 <fidl_fuchsia_media::AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_type),
992 ),
993 encoder, offset, _depth
994 )
995 }
996 }
997 unsafe impl<
998 T0: fidl::encoding::Encode<
999 fidl::encoding::HandleType<
1000 fidl::Clock,
1001 { fidl::ObjectType::CLOCK.into_raw() },
1002 2147483648,
1003 >,
1004 fidl::encoding::DefaultFuchsiaResourceDialect,
1005 >,
1006 T1: fidl::encoding::Encode<
1007 fidl_fuchsia_media::AudioStreamType,
1008 fidl::encoding::DefaultFuchsiaResourceDialect,
1009 >,
1010 >
1011 fidl::encoding::Encode<
1012 FactoryCreateCapturerResponse,
1013 fidl::encoding::DefaultFuchsiaResourceDialect,
1014 > for (T0, T1)
1015 {
1016 #[inline]
1017 unsafe fn encode(
1018 self,
1019 encoder: &mut fidl::encoding::Encoder<
1020 '_,
1021 fidl::encoding::DefaultFuchsiaResourceDialect,
1022 >,
1023 offset: usize,
1024 depth: fidl::encoding::Depth,
1025 ) -> fidl::Result<()> {
1026 encoder.debug_check_bounds::<FactoryCreateCapturerResponse>(offset);
1027 self.0.encode(encoder, offset + 0, depth)?;
1031 self.1.encode(encoder, offset + 4, depth)?;
1032 Ok(())
1033 }
1034 }
1035
1036 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1037 for FactoryCreateCapturerResponse
1038 {
1039 #[inline(always)]
1040 fn new_empty() -> Self {
1041 Self {
1042 reference_clock: fidl::new_empty!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1043 stream_type: fidl::new_empty!(
1044 fidl_fuchsia_media::AudioStreamType,
1045 fidl::encoding::DefaultFuchsiaResourceDialect
1046 ),
1047 }
1048 }
1049
1050 #[inline]
1051 unsafe fn decode(
1052 &mut self,
1053 decoder: &mut fidl::encoding::Decoder<
1054 '_,
1055 fidl::encoding::DefaultFuchsiaResourceDialect,
1056 >,
1057 offset: usize,
1058 _depth: fidl::encoding::Depth,
1059 ) -> fidl::Result<()> {
1060 decoder.debug_check_bounds::<Self>(offset);
1061 fidl::decode!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reference_clock, decoder, offset + 0, _depth)?;
1063 fidl::decode!(
1064 fidl_fuchsia_media::AudioStreamType,
1065 fidl::encoding::DefaultFuchsiaResourceDialect,
1066 &mut self.stream_type,
1067 decoder,
1068 offset + 4,
1069 _depth
1070 )?;
1071 Ok(())
1072 }
1073 }
1074
1075 impl fidl::encoding::ResourceTypeMarker for FactoryCreateRendererRequest {
1076 type Borrowed<'a> = &'a mut Self;
1077 fn take_or_borrow<'a>(
1078 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1079 ) -> Self::Borrowed<'a> {
1080 value
1081 }
1082 }
1083
1084 unsafe impl fidl::encoding::TypeMarker for FactoryCreateRendererRequest {
1085 type Owned = Self;
1086
1087 #[inline(always)]
1088 fn inline_align(_context: fidl::encoding::Context) -> usize {
1089 4
1090 }
1091
1092 #[inline(always)]
1093 fn inline_size(_context: fidl::encoding::Context) -> usize {
1094 4
1095 }
1096 }
1097
1098 unsafe impl
1099 fidl::encoding::Encode<
1100 FactoryCreateRendererRequest,
1101 fidl::encoding::DefaultFuchsiaResourceDialect,
1102 > for &mut FactoryCreateRendererRequest
1103 {
1104 #[inline]
1105 unsafe fn encode(
1106 self,
1107 encoder: &mut fidl::encoding::Encoder<
1108 '_,
1109 fidl::encoding::DefaultFuchsiaResourceDialect,
1110 >,
1111 offset: usize,
1112 _depth: fidl::encoding::Depth,
1113 ) -> fidl::Result<()> {
1114 encoder.debug_check_bounds::<FactoryCreateRendererRequest>(offset);
1115 fidl::encoding::Encode::<
1117 FactoryCreateRendererRequest,
1118 fidl::encoding::DefaultFuchsiaResourceDialect,
1119 >::encode(
1120 (<fidl::encoding::Endpoint<
1121 fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioRendererMarker>,
1122 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1123 &mut self.renderer
1124 ),),
1125 encoder,
1126 offset,
1127 _depth,
1128 )
1129 }
1130 }
1131 unsafe impl<
1132 T0: fidl::encoding::Encode<
1133 fidl::encoding::Endpoint<
1134 fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioRendererMarker>,
1135 >,
1136 fidl::encoding::DefaultFuchsiaResourceDialect,
1137 >,
1138 >
1139 fidl::encoding::Encode<
1140 FactoryCreateRendererRequest,
1141 fidl::encoding::DefaultFuchsiaResourceDialect,
1142 > for (T0,)
1143 {
1144 #[inline]
1145 unsafe fn encode(
1146 self,
1147 encoder: &mut fidl::encoding::Encoder<
1148 '_,
1149 fidl::encoding::DefaultFuchsiaResourceDialect,
1150 >,
1151 offset: usize,
1152 depth: fidl::encoding::Depth,
1153 ) -> fidl::Result<()> {
1154 encoder.debug_check_bounds::<FactoryCreateRendererRequest>(offset);
1155 self.0.encode(encoder, offset + 0, depth)?;
1159 Ok(())
1160 }
1161 }
1162
1163 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1164 for FactoryCreateRendererRequest
1165 {
1166 #[inline(always)]
1167 fn new_empty() -> Self {
1168 Self {
1169 renderer: fidl::new_empty!(
1170 fidl::encoding::Endpoint<
1171 fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioRendererMarker>,
1172 >,
1173 fidl::encoding::DefaultFuchsiaResourceDialect
1174 ),
1175 }
1176 }
1177
1178 #[inline]
1179 unsafe fn decode(
1180 &mut self,
1181 decoder: &mut fidl::encoding::Decoder<
1182 '_,
1183 fidl::encoding::DefaultFuchsiaResourceDialect,
1184 >,
1185 offset: usize,
1186 _depth: fidl::encoding::Depth,
1187 ) -> fidl::Result<()> {
1188 decoder.debug_check_bounds::<Self>(offset);
1189 fidl::decode!(
1191 fidl::encoding::Endpoint<
1192 fidl::endpoints::ServerEnd<fidl_fuchsia_media::AudioRendererMarker>,
1193 >,
1194 fidl::encoding::DefaultFuchsiaResourceDialect,
1195 &mut self.renderer,
1196 decoder,
1197 offset + 0,
1198 _depth
1199 )?;
1200 Ok(())
1201 }
1202 }
1203
1204 impl fidl::encoding::ResourceTypeMarker for FactoryCreateRendererResponse {
1205 type Borrowed<'a> = &'a mut Self;
1206 fn take_or_borrow<'a>(
1207 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1208 ) -> Self::Borrowed<'a> {
1209 value
1210 }
1211 }
1212
1213 unsafe impl fidl::encoding::TypeMarker for FactoryCreateRendererResponse {
1214 type Owned = Self;
1215
1216 #[inline(always)]
1217 fn inline_align(_context: fidl::encoding::Context) -> usize {
1218 4
1219 }
1220
1221 #[inline(always)]
1222 fn inline_size(_context: fidl::encoding::Context) -> usize {
1223 16
1224 }
1225 }
1226
1227 unsafe impl
1228 fidl::encoding::Encode<
1229 FactoryCreateRendererResponse,
1230 fidl::encoding::DefaultFuchsiaResourceDialect,
1231 > for &mut FactoryCreateRendererResponse
1232 {
1233 #[inline]
1234 unsafe fn encode(
1235 self,
1236 encoder: &mut fidl::encoding::Encoder<
1237 '_,
1238 fidl::encoding::DefaultFuchsiaResourceDialect,
1239 >,
1240 offset: usize,
1241 _depth: fidl::encoding::Depth,
1242 ) -> fidl::Result<()> {
1243 encoder.debug_check_bounds::<FactoryCreateRendererResponse>(offset);
1244 fidl::encoding::Encode::<FactoryCreateRendererResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1246 (
1247 <fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reference_clock),
1248 <fidl_fuchsia_media::AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_type),
1249 ),
1250 encoder, offset, _depth
1251 )
1252 }
1253 }
1254 unsafe impl<
1255 T0: fidl::encoding::Encode<
1256 fidl::encoding::HandleType<
1257 fidl::Clock,
1258 { fidl::ObjectType::CLOCK.into_raw() },
1259 2147483648,
1260 >,
1261 fidl::encoding::DefaultFuchsiaResourceDialect,
1262 >,
1263 T1: fidl::encoding::Encode<
1264 fidl_fuchsia_media::AudioStreamType,
1265 fidl::encoding::DefaultFuchsiaResourceDialect,
1266 >,
1267 >
1268 fidl::encoding::Encode<
1269 FactoryCreateRendererResponse,
1270 fidl::encoding::DefaultFuchsiaResourceDialect,
1271 > for (T0, T1)
1272 {
1273 #[inline]
1274 unsafe fn encode(
1275 self,
1276 encoder: &mut fidl::encoding::Encoder<
1277 '_,
1278 fidl::encoding::DefaultFuchsiaResourceDialect,
1279 >,
1280 offset: usize,
1281 depth: fidl::encoding::Depth,
1282 ) -> fidl::Result<()> {
1283 encoder.debug_check_bounds::<FactoryCreateRendererResponse>(offset);
1284 self.0.encode(encoder, offset + 0, depth)?;
1288 self.1.encode(encoder, offset + 4, depth)?;
1289 Ok(())
1290 }
1291 }
1292
1293 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1294 for FactoryCreateRendererResponse
1295 {
1296 #[inline(always)]
1297 fn new_empty() -> Self {
1298 Self {
1299 reference_clock: fidl::new_empty!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1300 stream_type: fidl::new_empty!(
1301 fidl_fuchsia_media::AudioStreamType,
1302 fidl::encoding::DefaultFuchsiaResourceDialect
1303 ),
1304 }
1305 }
1306
1307 #[inline]
1308 unsafe fn decode(
1309 &mut self,
1310 decoder: &mut fidl::encoding::Decoder<
1311 '_,
1312 fidl::encoding::DefaultFuchsiaResourceDialect,
1313 >,
1314 offset: usize,
1315 _depth: fidl::encoding::Depth,
1316 ) -> fidl::Result<()> {
1317 decoder.debug_check_bounds::<Self>(offset);
1318 fidl::decode!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reference_clock, decoder, offset + 0, _depth)?;
1320 fidl::decode!(
1321 fidl_fuchsia_media::AudioStreamType,
1322 fidl::encoding::DefaultFuchsiaResourceDialect,
1323 &mut self.stream_type,
1324 decoder,
1325 offset + 4,
1326 _depth
1327 )?;
1328 Ok(())
1329 }
1330 }
1331}