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_media_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct AudioCapturerBindGainControlRequest {
16 pub gain_control_request:
17 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for AudioCapturerBindGainControlRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct AudioCapturerGetReferenceClockResponse {
27 pub reference_clock: fidl::Clock,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for AudioCapturerGetReferenceClockResponse
32{
33}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct AudioCapturerSetReferenceClockRequest {
37 pub reference_clock: Option<fidl::Clock>,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
41 for AudioCapturerSetReferenceClockRequest
42{
43}
44
45#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
46pub struct AudioConsumerBindVolumeControlRequest {
47 pub volume_control_request:
48 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
49}
50
51impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
52 for AudioConsumerBindVolumeControlRequest
53{
54}
55
56#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
57pub struct AudioConsumerCreateStreamSinkRequest {
58 pub buffers: Vec<fidl::Vmo>,
59 pub stream_type: AudioStreamType,
60 pub compression: Option<Box<Compression>>,
61 pub stream_sink_request: fidl::endpoints::ServerEnd<StreamSinkMarker>,
62}
63
64impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
65 for AudioConsumerCreateStreamSinkRequest
66{
67}
68
69#[derive(Debug, PartialEq)]
70pub struct AudioCoreBindUsageVolumeControl2Request {
71 pub usage: Usage2,
72 pub volume_control: fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
76 for AudioCoreBindUsageVolumeControl2Request
77{
78}
79
80#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
81pub struct AudioCoreBindUsageVolumeControlRequest {
82 pub usage: Usage,
83 pub volume_control: fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
84}
85
86impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
87 for AudioCoreBindUsageVolumeControlRequest
88{
89}
90
91#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
92pub struct AudioCoreCreateAudioCapturerRequest {
93 pub loopback: bool,
94 pub audio_in_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
95}
96
97impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
98 for AudioCoreCreateAudioCapturerRequest
99{
100}
101
102#[derive(Debug, PartialEq)]
103pub struct AudioCoreCreateAudioCapturerWithConfigurationRequest {
104 pub stream_type: AudioStreamType,
105 pub configuration: AudioCapturerConfiguration,
106 pub audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
107}
108
109impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
110 for AudioCoreCreateAudioCapturerWithConfigurationRequest
111{
112}
113
114#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
115pub struct AudioCoreCreateAudioRendererRequest {
116 pub audio_out_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
117}
118
119impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
120 for AudioCoreCreateAudioRendererRequest
121{
122}
123
124#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
125pub struct AudioCreateAudioCapturerRequest {
126 pub audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
127 pub loopback: bool,
128}
129
130impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
131 for AudioCreateAudioCapturerRequest
132{
133}
134
135#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
136pub struct AudioCreateAudioRendererRequest {
137 pub audio_renderer_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
138}
139
140impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
141 for AudioCreateAudioRendererRequest
142{
143}
144
145#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
146pub struct AudioDeviceEnumeratorAddDeviceByChannelRequest {
147 pub device_name: String,
148 pub is_input: bool,
149 pub channel: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
150}
151
152impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
153 for AudioDeviceEnumeratorAddDeviceByChannelRequest
154{
155}
156
157#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
158pub struct AudioRendererBindGainControlRequest {
159 pub gain_control_request:
160 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
161}
162
163impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
164 for AudioRendererBindGainControlRequest
165{
166}
167
168#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
169pub struct AudioRendererGetReferenceClockResponse {
170 pub reference_clock: fidl::Clock,
171}
172
173impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
174 for AudioRendererGetReferenceClockResponse
175{
176}
177
178#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
179pub struct AudioRendererSetReferenceClockRequest {
180 pub reference_clock: Option<fidl::Clock>,
181}
182
183impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
184 for AudioRendererSetReferenceClockRequest
185{
186}
187
188#[derive(Debug, PartialEq, PartialOrd)]
189pub struct ProfileProviderRegisterHandlerWithCapacityRequest {
190 pub thread_handle: fidl::Thread,
191 pub name: String,
192 pub period: i64,
193 pub capacity: f32,
194}
195
196impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
197 for ProfileProviderRegisterHandlerWithCapacityRequest
198{
199}
200
201#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
202pub struct ProfileProviderRegisterMemoryRangeRequest {
203 pub vmar_handle: fidl::Vmar,
204 pub name: String,
205}
206
207impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
208 for ProfileProviderRegisterMemoryRangeRequest
209{
210}
211
212#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
213pub struct ProfileProviderUnregisterHandlerRequest {
214 pub thread_handle: fidl::Thread,
215 pub name: String,
216}
217
218impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
219 for ProfileProviderUnregisterHandlerRequest
220{
221}
222
223#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
224pub struct ProfileProviderUnregisterMemoryRangeRequest {
225 pub vmar_handle: fidl::Vmar,
226}
227
228impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
229 for ProfileProviderUnregisterMemoryRangeRequest
230{
231}
232
233#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
234pub struct SessionAudioConsumerFactoryCreateAudioConsumerRequest {
235 pub session_id: u64,
236 pub audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
237}
238
239impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
240 for SessionAudioConsumerFactoryCreateAudioConsumerRequest
241{
242}
243
244#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
245pub struct StreamBufferSetAddPayloadBufferRequest {
246 pub id: u32,
247 pub payload_buffer: fidl::Vmo,
248}
249
250impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
251 for StreamBufferSetAddPayloadBufferRequest
252{
253}
254
255#[derive(Debug, PartialEq)]
256pub struct StreamProcessorSetInputBufferPartialSettingsRequest {
257 pub input_settings: StreamBufferPartialSettings,
258}
259
260impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
261 for StreamProcessorSetInputBufferPartialSettingsRequest
262{
263}
264
265#[derive(Debug, PartialEq)]
266pub struct StreamProcessorSetOutputBufferPartialSettingsRequest {
267 pub output_settings: StreamBufferPartialSettings,
268}
269
270impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
271 for StreamProcessorSetOutputBufferPartialSettingsRequest
272{
273}
274
275#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
276pub struct Usage2AudioConsumerFactoryCreateAudioConsumerRequest {
277 pub usage: AudioRenderUsage2,
278 pub audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
279}
280
281impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
282 for Usage2AudioConsumerFactoryCreateAudioConsumerRequest
283{
284}
285
286#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
287pub struct UsageAudioConsumerFactoryCreateAudioConsumerRequest {
288 pub usage: AudioRenderUsage,
289 pub audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
290}
291
292impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
293 for UsageAudioConsumerFactoryCreateAudioConsumerRequest
294{
295}
296
297#[derive(Debug, PartialEq)]
298pub struct UsageGainReporterRegisterListener2Request {
299 pub device_unique_id: String,
300 pub usage: Usage2,
301 pub usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
302}
303
304impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
305 for UsageGainReporterRegisterListener2Request
306{
307}
308
309#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
310pub struct UsageGainReporterRegisterListenerRequest {
311 pub device_unique_id: String,
312 pub usage: Usage,
313 pub usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
314}
315
316impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
317 for UsageGainReporterRegisterListenerRequest
318{
319}
320
321#[derive(Debug, PartialEq)]
322pub struct UsageReporterWatch2Request {
323 pub usage: Usage2,
324 pub usage_watcher: fidl::endpoints::ClientEnd<UsageWatcher2Marker>,
325}
326
327impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
328 for UsageReporterWatch2Request
329{
330}
331
332#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
333pub struct UsageReporterWatchRequest {
334 pub usage: Usage,
335 pub usage_watcher: fidl::endpoints::ClientEnd<UsageWatcherMarker>,
336}
337
338impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for UsageReporterWatchRequest {}
339
340#[derive(Debug, Default, PartialEq)]
341pub struct StreamBufferPartialSettings {
342 pub buffer_lifetime_ordinal: Option<u64>,
355 pub buffer_constraints_version_ordinal: Option<u64>,
368 pub single_buffer_mode: Option<bool>,
369 pub packet_count_for_server: Option<u32>,
370 pub packet_count_for_client: Option<u32>,
371 pub sysmem_token:
372 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>>,
373 pub sysmem2_token:
381 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>>,
382 #[doc(hidden)]
383 pub __source_breaking: fidl::marker::SourceBreaking,
384}
385
386impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
387 for StreamBufferPartialSettings
388{
389}
390
391#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
392pub struct ActivityReporterMarker;
393
394impl fidl::endpoints::ProtocolMarker for ActivityReporterMarker {
395 type Proxy = ActivityReporterProxy;
396 type RequestStream = ActivityReporterRequestStream;
397 #[cfg(target_os = "fuchsia")]
398 type SynchronousProxy = ActivityReporterSynchronousProxy;
399
400 const DEBUG_NAME: &'static str = "fuchsia.media.ActivityReporter";
401}
402impl fidl::endpoints::DiscoverableProtocolMarker for ActivityReporterMarker {}
403
404pub trait ActivityReporterProxyInterface: Send + Sync {
405 type WatchRenderActivityResponseFut: std::future::Future<Output = Result<Vec<AudioRenderUsage>, fidl::Error>>
406 + Send;
407 fn r#watch_render_activity(&self) -> Self::WatchRenderActivityResponseFut;
408 type WatchRenderActivity2ResponseFut: std::future::Future<Output = Result<Vec<AudioRenderUsage2>, fidl::Error>>
409 + Send;
410 fn r#watch_render_activity2(&self) -> Self::WatchRenderActivity2ResponseFut;
411 type WatchCaptureActivityResponseFut: std::future::Future<Output = Result<Vec<AudioCaptureUsage>, fidl::Error>>
412 + Send;
413 fn r#watch_capture_activity(&self) -> Self::WatchCaptureActivityResponseFut;
414 type WatchCaptureActivity2ResponseFut: std::future::Future<Output = Result<Vec<AudioCaptureUsage2>, fidl::Error>>
415 + Send;
416 fn r#watch_capture_activity2(&self) -> Self::WatchCaptureActivity2ResponseFut;
417}
418#[derive(Debug)]
419#[cfg(target_os = "fuchsia")]
420pub struct ActivityReporterSynchronousProxy {
421 client: fidl::client::sync::Client,
422}
423
424#[cfg(target_os = "fuchsia")]
425impl fidl::endpoints::SynchronousProxy for ActivityReporterSynchronousProxy {
426 type Proxy = ActivityReporterProxy;
427 type Protocol = ActivityReporterMarker;
428
429 fn from_channel(inner: fidl::Channel) -> Self {
430 Self::new(inner)
431 }
432
433 fn into_channel(self) -> fidl::Channel {
434 self.client.into_channel()
435 }
436
437 fn as_channel(&self) -> &fidl::Channel {
438 self.client.as_channel()
439 }
440}
441
442#[cfg(target_os = "fuchsia")]
443impl ActivityReporterSynchronousProxy {
444 pub fn new(channel: fidl::Channel) -> Self {
445 let protocol_name = <ActivityReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
446 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
447 }
448
449 pub fn into_channel(self) -> fidl::Channel {
450 self.client.into_channel()
451 }
452
453 pub fn wait_for_event(
456 &self,
457 deadline: zx::MonotonicInstant,
458 ) -> Result<ActivityReporterEvent, fidl::Error> {
459 ActivityReporterEvent::decode(self.client.wait_for_event(deadline)?)
460 }
461
462 pub fn r#watch_render_activity(
465 &self,
466 ___deadline: zx::MonotonicInstant,
467 ) -> Result<Vec<AudioRenderUsage>, fidl::Error> {
468 let _response = self.client.send_query::<
469 fidl::encoding::EmptyPayload,
470 ActivityReporterWatchRenderActivityResponse,
471 >(
472 (),
473 0x2974e9f5880b2f1f,
474 fidl::encoding::DynamicFlags::empty(),
475 ___deadline,
476 )?;
477 Ok(_response.active_usages)
478 }
479
480 pub fn r#watch_render_activity2(
483 &self,
484 ___deadline: zx::MonotonicInstant,
485 ) -> Result<Vec<AudioRenderUsage2>, fidl::Error> {
486 let _response = self.client.send_query::<
487 fidl::encoding::EmptyPayload,
488 fidl::encoding::FlexibleType<ActivityReporterWatchRenderActivity2Response>,
489 >(
490 (),
491 0x484236fc11b363e6,
492 fidl::encoding::DynamicFlags::FLEXIBLE,
493 ___deadline,
494 )?
495 .into_result::<ActivityReporterMarker>("watch_render_activity2")?;
496 Ok(_response.active_usages)
497 }
498
499 pub fn r#watch_capture_activity(
502 &self,
503 ___deadline: zx::MonotonicInstant,
504 ) -> Result<Vec<AudioCaptureUsage>, fidl::Error> {
505 let _response = self.client.send_query::<
506 fidl::encoding::EmptyPayload,
507 ActivityReporterWatchCaptureActivityResponse,
508 >(
509 (),
510 0x70e7038e9658e128,
511 fidl::encoding::DynamicFlags::empty(),
512 ___deadline,
513 )?;
514 Ok(_response.active_usages)
515 }
516
517 pub fn r#watch_capture_activity2(
520 &self,
521 ___deadline: zx::MonotonicInstant,
522 ) -> Result<Vec<AudioCaptureUsage2>, fidl::Error> {
523 let _response = self.client.send_query::<
524 fidl::encoding::EmptyPayload,
525 fidl::encoding::FlexibleType<ActivityReporterWatchCaptureActivity2Response>,
526 >(
527 (),
528 0x3d137e0364f9d550,
529 fidl::encoding::DynamicFlags::FLEXIBLE,
530 ___deadline,
531 )?
532 .into_result::<ActivityReporterMarker>("watch_capture_activity2")?;
533 Ok(_response.active_usages)
534 }
535}
536
537#[cfg(target_os = "fuchsia")]
538impl From<ActivityReporterSynchronousProxy> for zx::Handle {
539 fn from(value: ActivityReporterSynchronousProxy) -> Self {
540 value.into_channel().into()
541 }
542}
543
544#[cfg(target_os = "fuchsia")]
545impl From<fidl::Channel> for ActivityReporterSynchronousProxy {
546 fn from(value: fidl::Channel) -> Self {
547 Self::new(value)
548 }
549}
550
551#[derive(Debug, Clone)]
552pub struct ActivityReporterProxy {
553 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
554}
555
556impl fidl::endpoints::Proxy for ActivityReporterProxy {
557 type Protocol = ActivityReporterMarker;
558
559 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
560 Self::new(inner)
561 }
562
563 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
564 self.client.into_channel().map_err(|client| Self { client })
565 }
566
567 fn as_channel(&self) -> &::fidl::AsyncChannel {
568 self.client.as_channel()
569 }
570}
571
572impl ActivityReporterProxy {
573 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
575 let protocol_name = <ActivityReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
576 Self { client: fidl::client::Client::new(channel, protocol_name) }
577 }
578
579 pub fn take_event_stream(&self) -> ActivityReporterEventStream {
585 ActivityReporterEventStream { event_receiver: self.client.take_event_receiver() }
586 }
587
588 pub fn r#watch_render_activity(
591 &self,
592 ) -> fidl::client::QueryResponseFut<
593 Vec<AudioRenderUsage>,
594 fidl::encoding::DefaultFuchsiaResourceDialect,
595 > {
596 ActivityReporterProxyInterface::r#watch_render_activity(self)
597 }
598
599 pub fn r#watch_render_activity2(
602 &self,
603 ) -> fidl::client::QueryResponseFut<
604 Vec<AudioRenderUsage2>,
605 fidl::encoding::DefaultFuchsiaResourceDialect,
606 > {
607 ActivityReporterProxyInterface::r#watch_render_activity2(self)
608 }
609
610 pub fn r#watch_capture_activity(
613 &self,
614 ) -> fidl::client::QueryResponseFut<
615 Vec<AudioCaptureUsage>,
616 fidl::encoding::DefaultFuchsiaResourceDialect,
617 > {
618 ActivityReporterProxyInterface::r#watch_capture_activity(self)
619 }
620
621 pub fn r#watch_capture_activity2(
624 &self,
625 ) -> fidl::client::QueryResponseFut<
626 Vec<AudioCaptureUsage2>,
627 fidl::encoding::DefaultFuchsiaResourceDialect,
628 > {
629 ActivityReporterProxyInterface::r#watch_capture_activity2(self)
630 }
631}
632
633impl ActivityReporterProxyInterface for ActivityReporterProxy {
634 type WatchRenderActivityResponseFut = fidl::client::QueryResponseFut<
635 Vec<AudioRenderUsage>,
636 fidl::encoding::DefaultFuchsiaResourceDialect,
637 >;
638 fn r#watch_render_activity(&self) -> Self::WatchRenderActivityResponseFut {
639 fn _decode(
640 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
641 ) -> Result<Vec<AudioRenderUsage>, fidl::Error> {
642 let _response = fidl::client::decode_transaction_body::<
643 ActivityReporterWatchRenderActivityResponse,
644 fidl::encoding::DefaultFuchsiaResourceDialect,
645 0x2974e9f5880b2f1f,
646 >(_buf?)?;
647 Ok(_response.active_usages)
648 }
649 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<AudioRenderUsage>>(
650 (),
651 0x2974e9f5880b2f1f,
652 fidl::encoding::DynamicFlags::empty(),
653 _decode,
654 )
655 }
656
657 type WatchRenderActivity2ResponseFut = fidl::client::QueryResponseFut<
658 Vec<AudioRenderUsage2>,
659 fidl::encoding::DefaultFuchsiaResourceDialect,
660 >;
661 fn r#watch_render_activity2(&self) -> Self::WatchRenderActivity2ResponseFut {
662 fn _decode(
663 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
664 ) -> Result<Vec<AudioRenderUsage2>, fidl::Error> {
665 let _response = fidl::client::decode_transaction_body::<
666 fidl::encoding::FlexibleType<ActivityReporterWatchRenderActivity2Response>,
667 fidl::encoding::DefaultFuchsiaResourceDialect,
668 0x484236fc11b363e6,
669 >(_buf?)?
670 .into_result::<ActivityReporterMarker>("watch_render_activity2")?;
671 Ok(_response.active_usages)
672 }
673 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<AudioRenderUsage2>>(
674 (),
675 0x484236fc11b363e6,
676 fidl::encoding::DynamicFlags::FLEXIBLE,
677 _decode,
678 )
679 }
680
681 type WatchCaptureActivityResponseFut = fidl::client::QueryResponseFut<
682 Vec<AudioCaptureUsage>,
683 fidl::encoding::DefaultFuchsiaResourceDialect,
684 >;
685 fn r#watch_capture_activity(&self) -> Self::WatchCaptureActivityResponseFut {
686 fn _decode(
687 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
688 ) -> Result<Vec<AudioCaptureUsage>, fidl::Error> {
689 let _response = fidl::client::decode_transaction_body::<
690 ActivityReporterWatchCaptureActivityResponse,
691 fidl::encoding::DefaultFuchsiaResourceDialect,
692 0x70e7038e9658e128,
693 >(_buf?)?;
694 Ok(_response.active_usages)
695 }
696 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<AudioCaptureUsage>>(
697 (),
698 0x70e7038e9658e128,
699 fidl::encoding::DynamicFlags::empty(),
700 _decode,
701 )
702 }
703
704 type WatchCaptureActivity2ResponseFut = fidl::client::QueryResponseFut<
705 Vec<AudioCaptureUsage2>,
706 fidl::encoding::DefaultFuchsiaResourceDialect,
707 >;
708 fn r#watch_capture_activity2(&self) -> Self::WatchCaptureActivity2ResponseFut {
709 fn _decode(
710 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
711 ) -> Result<Vec<AudioCaptureUsage2>, fidl::Error> {
712 let _response = fidl::client::decode_transaction_body::<
713 fidl::encoding::FlexibleType<ActivityReporterWatchCaptureActivity2Response>,
714 fidl::encoding::DefaultFuchsiaResourceDialect,
715 0x3d137e0364f9d550,
716 >(_buf?)?
717 .into_result::<ActivityReporterMarker>("watch_capture_activity2")?;
718 Ok(_response.active_usages)
719 }
720 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<AudioCaptureUsage2>>(
721 (),
722 0x3d137e0364f9d550,
723 fidl::encoding::DynamicFlags::FLEXIBLE,
724 _decode,
725 )
726 }
727}
728
729pub struct ActivityReporterEventStream {
730 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
731}
732
733impl std::marker::Unpin for ActivityReporterEventStream {}
734
735impl futures::stream::FusedStream for ActivityReporterEventStream {
736 fn is_terminated(&self) -> bool {
737 self.event_receiver.is_terminated()
738 }
739}
740
741impl futures::Stream for ActivityReporterEventStream {
742 type Item = Result<ActivityReporterEvent, fidl::Error>;
743
744 fn poll_next(
745 mut self: std::pin::Pin<&mut Self>,
746 cx: &mut std::task::Context<'_>,
747 ) -> std::task::Poll<Option<Self::Item>> {
748 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
749 &mut self.event_receiver,
750 cx
751 )?) {
752 Some(buf) => std::task::Poll::Ready(Some(ActivityReporterEvent::decode(buf))),
753 None => std::task::Poll::Ready(None),
754 }
755 }
756}
757
758#[derive(Debug)]
759pub enum ActivityReporterEvent {
760 #[non_exhaustive]
761 _UnknownEvent {
762 ordinal: u64,
764 },
765}
766
767impl ActivityReporterEvent {
768 fn decode(
770 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
771 ) -> Result<ActivityReporterEvent, fidl::Error> {
772 let (bytes, _handles) = buf.split_mut();
773 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
774 debug_assert_eq!(tx_header.tx_id, 0);
775 match tx_header.ordinal {
776 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
777 Ok(ActivityReporterEvent::_UnknownEvent { ordinal: tx_header.ordinal })
778 }
779 _ => Err(fidl::Error::UnknownOrdinal {
780 ordinal: tx_header.ordinal,
781 protocol_name:
782 <ActivityReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
783 }),
784 }
785 }
786}
787
788pub struct ActivityReporterRequestStream {
790 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
791 is_terminated: bool,
792}
793
794impl std::marker::Unpin for ActivityReporterRequestStream {}
795
796impl futures::stream::FusedStream for ActivityReporterRequestStream {
797 fn is_terminated(&self) -> bool {
798 self.is_terminated
799 }
800}
801
802impl fidl::endpoints::RequestStream for ActivityReporterRequestStream {
803 type Protocol = ActivityReporterMarker;
804 type ControlHandle = ActivityReporterControlHandle;
805
806 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
807 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
808 }
809
810 fn control_handle(&self) -> Self::ControlHandle {
811 ActivityReporterControlHandle { inner: self.inner.clone() }
812 }
813
814 fn into_inner(
815 self,
816 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
817 {
818 (self.inner, self.is_terminated)
819 }
820
821 fn from_inner(
822 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
823 is_terminated: bool,
824 ) -> Self {
825 Self { inner, is_terminated }
826 }
827}
828
829impl futures::Stream for ActivityReporterRequestStream {
830 type Item = Result<ActivityReporterRequest, fidl::Error>;
831
832 fn poll_next(
833 mut self: std::pin::Pin<&mut Self>,
834 cx: &mut std::task::Context<'_>,
835 ) -> std::task::Poll<Option<Self::Item>> {
836 let this = &mut *self;
837 if this.inner.check_shutdown(cx) {
838 this.is_terminated = true;
839 return std::task::Poll::Ready(None);
840 }
841 if this.is_terminated {
842 panic!("polled ActivityReporterRequestStream after completion");
843 }
844 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
845 |bytes, handles| {
846 match this.inner.channel().read_etc(cx, bytes, handles) {
847 std::task::Poll::Ready(Ok(())) => {}
848 std::task::Poll::Pending => return std::task::Poll::Pending,
849 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
850 this.is_terminated = true;
851 return std::task::Poll::Ready(None);
852 }
853 std::task::Poll::Ready(Err(e)) => {
854 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
855 e.into(),
856 ))))
857 }
858 }
859
860 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
862
863 std::task::Poll::Ready(Some(match header.ordinal {
864 0x2974e9f5880b2f1f => {
865 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
866 let mut req = fidl::new_empty!(
867 fidl::encoding::EmptyPayload,
868 fidl::encoding::DefaultFuchsiaResourceDialect
869 );
870 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
871 let control_handle =
872 ActivityReporterControlHandle { inner: this.inner.clone() };
873 Ok(ActivityReporterRequest::WatchRenderActivity {
874 responder: ActivityReporterWatchRenderActivityResponder {
875 control_handle: std::mem::ManuallyDrop::new(control_handle),
876 tx_id: header.tx_id,
877 },
878 })
879 }
880 0x484236fc11b363e6 => {
881 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
882 let mut req = fidl::new_empty!(
883 fidl::encoding::EmptyPayload,
884 fidl::encoding::DefaultFuchsiaResourceDialect
885 );
886 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
887 let control_handle =
888 ActivityReporterControlHandle { inner: this.inner.clone() };
889 Ok(ActivityReporterRequest::WatchRenderActivity2 {
890 responder: ActivityReporterWatchRenderActivity2Responder {
891 control_handle: std::mem::ManuallyDrop::new(control_handle),
892 tx_id: header.tx_id,
893 },
894 })
895 }
896 0x70e7038e9658e128 => {
897 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
898 let mut req = fidl::new_empty!(
899 fidl::encoding::EmptyPayload,
900 fidl::encoding::DefaultFuchsiaResourceDialect
901 );
902 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
903 let control_handle =
904 ActivityReporterControlHandle { inner: this.inner.clone() };
905 Ok(ActivityReporterRequest::WatchCaptureActivity {
906 responder: ActivityReporterWatchCaptureActivityResponder {
907 control_handle: std::mem::ManuallyDrop::new(control_handle),
908 tx_id: header.tx_id,
909 },
910 })
911 }
912 0x3d137e0364f9d550 => {
913 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
914 let mut req = fidl::new_empty!(
915 fidl::encoding::EmptyPayload,
916 fidl::encoding::DefaultFuchsiaResourceDialect
917 );
918 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
919 let control_handle =
920 ActivityReporterControlHandle { inner: this.inner.clone() };
921 Ok(ActivityReporterRequest::WatchCaptureActivity2 {
922 responder: ActivityReporterWatchCaptureActivity2Responder {
923 control_handle: std::mem::ManuallyDrop::new(control_handle),
924 tx_id: header.tx_id,
925 },
926 })
927 }
928 _ if header.tx_id == 0
929 && header
930 .dynamic_flags()
931 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
932 {
933 Ok(ActivityReporterRequest::_UnknownMethod {
934 ordinal: header.ordinal,
935 control_handle: ActivityReporterControlHandle {
936 inner: this.inner.clone(),
937 },
938 method_type: fidl::MethodType::OneWay,
939 })
940 }
941 _ if header
942 .dynamic_flags()
943 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
944 {
945 this.inner.send_framework_err(
946 fidl::encoding::FrameworkErr::UnknownMethod,
947 header.tx_id,
948 header.ordinal,
949 header.dynamic_flags(),
950 (bytes, handles),
951 )?;
952 Ok(ActivityReporterRequest::_UnknownMethod {
953 ordinal: header.ordinal,
954 control_handle: ActivityReporterControlHandle {
955 inner: this.inner.clone(),
956 },
957 method_type: fidl::MethodType::TwoWay,
958 })
959 }
960 _ => Err(fidl::Error::UnknownOrdinal {
961 ordinal: header.ordinal,
962 protocol_name:
963 <ActivityReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
964 }),
965 }))
966 },
967 )
968 }
969}
970
971#[derive(Debug)]
973pub enum ActivityReporterRequest {
974 WatchRenderActivity { responder: ActivityReporterWatchRenderActivityResponder },
977 WatchRenderActivity2 { responder: ActivityReporterWatchRenderActivity2Responder },
980 WatchCaptureActivity { responder: ActivityReporterWatchCaptureActivityResponder },
983 WatchCaptureActivity2 { responder: ActivityReporterWatchCaptureActivity2Responder },
986 #[non_exhaustive]
988 _UnknownMethod {
989 ordinal: u64,
991 control_handle: ActivityReporterControlHandle,
992 method_type: fidl::MethodType,
993 },
994}
995
996impl ActivityReporterRequest {
997 #[allow(irrefutable_let_patterns)]
998 pub fn into_watch_render_activity(
999 self,
1000 ) -> Option<(ActivityReporterWatchRenderActivityResponder)> {
1001 if let ActivityReporterRequest::WatchRenderActivity { responder } = self {
1002 Some((responder))
1003 } else {
1004 None
1005 }
1006 }
1007
1008 #[allow(irrefutable_let_patterns)]
1009 pub fn into_watch_render_activity2(
1010 self,
1011 ) -> Option<(ActivityReporterWatchRenderActivity2Responder)> {
1012 if let ActivityReporterRequest::WatchRenderActivity2 { responder } = self {
1013 Some((responder))
1014 } else {
1015 None
1016 }
1017 }
1018
1019 #[allow(irrefutable_let_patterns)]
1020 pub fn into_watch_capture_activity(
1021 self,
1022 ) -> Option<(ActivityReporterWatchCaptureActivityResponder)> {
1023 if let ActivityReporterRequest::WatchCaptureActivity { responder } = self {
1024 Some((responder))
1025 } else {
1026 None
1027 }
1028 }
1029
1030 #[allow(irrefutable_let_patterns)]
1031 pub fn into_watch_capture_activity2(
1032 self,
1033 ) -> Option<(ActivityReporterWatchCaptureActivity2Responder)> {
1034 if let ActivityReporterRequest::WatchCaptureActivity2 { responder } = self {
1035 Some((responder))
1036 } else {
1037 None
1038 }
1039 }
1040
1041 pub fn method_name(&self) -> &'static str {
1043 match *self {
1044 ActivityReporterRequest::WatchRenderActivity { .. } => "watch_render_activity",
1045 ActivityReporterRequest::WatchRenderActivity2 { .. } => "watch_render_activity2",
1046 ActivityReporterRequest::WatchCaptureActivity { .. } => "watch_capture_activity",
1047 ActivityReporterRequest::WatchCaptureActivity2 { .. } => "watch_capture_activity2",
1048 ActivityReporterRequest::_UnknownMethod {
1049 method_type: fidl::MethodType::OneWay,
1050 ..
1051 } => "unknown one-way method",
1052 ActivityReporterRequest::_UnknownMethod {
1053 method_type: fidl::MethodType::TwoWay,
1054 ..
1055 } => "unknown two-way method",
1056 }
1057 }
1058}
1059
1060#[derive(Debug, Clone)]
1061pub struct ActivityReporterControlHandle {
1062 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1063}
1064
1065impl fidl::endpoints::ControlHandle for ActivityReporterControlHandle {
1066 fn shutdown(&self) {
1067 self.inner.shutdown()
1068 }
1069 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1070 self.inner.shutdown_with_epitaph(status)
1071 }
1072
1073 fn is_closed(&self) -> bool {
1074 self.inner.channel().is_closed()
1075 }
1076 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1077 self.inner.channel().on_closed()
1078 }
1079
1080 #[cfg(target_os = "fuchsia")]
1081 fn signal_peer(
1082 &self,
1083 clear_mask: zx::Signals,
1084 set_mask: zx::Signals,
1085 ) -> Result<(), zx_status::Status> {
1086 use fidl::Peered;
1087 self.inner.channel().signal_peer(clear_mask, set_mask)
1088 }
1089}
1090
1091impl ActivityReporterControlHandle {}
1092
1093#[must_use = "FIDL methods require a response to be sent"]
1094#[derive(Debug)]
1095pub struct ActivityReporterWatchRenderActivityResponder {
1096 control_handle: std::mem::ManuallyDrop<ActivityReporterControlHandle>,
1097 tx_id: u32,
1098}
1099
1100impl std::ops::Drop for ActivityReporterWatchRenderActivityResponder {
1104 fn drop(&mut self) {
1105 self.control_handle.shutdown();
1106 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1108 }
1109}
1110
1111impl fidl::endpoints::Responder for ActivityReporterWatchRenderActivityResponder {
1112 type ControlHandle = ActivityReporterControlHandle;
1113
1114 fn control_handle(&self) -> &ActivityReporterControlHandle {
1115 &self.control_handle
1116 }
1117
1118 fn drop_without_shutdown(mut self) {
1119 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1121 std::mem::forget(self);
1123 }
1124}
1125
1126impl ActivityReporterWatchRenderActivityResponder {
1127 pub fn send(self, mut active_usages: &[AudioRenderUsage]) -> Result<(), fidl::Error> {
1131 let _result = self.send_raw(active_usages);
1132 if _result.is_err() {
1133 self.control_handle.shutdown();
1134 }
1135 self.drop_without_shutdown();
1136 _result
1137 }
1138
1139 pub fn send_no_shutdown_on_err(
1141 self,
1142 mut active_usages: &[AudioRenderUsage],
1143 ) -> Result<(), fidl::Error> {
1144 let _result = self.send_raw(active_usages);
1145 self.drop_without_shutdown();
1146 _result
1147 }
1148
1149 fn send_raw(&self, mut active_usages: &[AudioRenderUsage]) -> Result<(), fidl::Error> {
1150 self.control_handle.inner.send::<ActivityReporterWatchRenderActivityResponse>(
1151 (active_usages,),
1152 self.tx_id,
1153 0x2974e9f5880b2f1f,
1154 fidl::encoding::DynamicFlags::empty(),
1155 )
1156 }
1157}
1158
1159#[must_use = "FIDL methods require a response to be sent"]
1160#[derive(Debug)]
1161pub struct ActivityReporterWatchRenderActivity2Responder {
1162 control_handle: std::mem::ManuallyDrop<ActivityReporterControlHandle>,
1163 tx_id: u32,
1164}
1165
1166impl std::ops::Drop for ActivityReporterWatchRenderActivity2Responder {
1170 fn drop(&mut self) {
1171 self.control_handle.shutdown();
1172 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1174 }
1175}
1176
1177impl fidl::endpoints::Responder for ActivityReporterWatchRenderActivity2Responder {
1178 type ControlHandle = ActivityReporterControlHandle;
1179
1180 fn control_handle(&self) -> &ActivityReporterControlHandle {
1181 &self.control_handle
1182 }
1183
1184 fn drop_without_shutdown(mut self) {
1185 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1187 std::mem::forget(self);
1189 }
1190}
1191
1192impl ActivityReporterWatchRenderActivity2Responder {
1193 pub fn send(self, mut active_usages: &[AudioRenderUsage2]) -> Result<(), fidl::Error> {
1197 let _result = self.send_raw(active_usages);
1198 if _result.is_err() {
1199 self.control_handle.shutdown();
1200 }
1201 self.drop_without_shutdown();
1202 _result
1203 }
1204
1205 pub fn send_no_shutdown_on_err(
1207 self,
1208 mut active_usages: &[AudioRenderUsage2],
1209 ) -> Result<(), fidl::Error> {
1210 let _result = self.send_raw(active_usages);
1211 self.drop_without_shutdown();
1212 _result
1213 }
1214
1215 fn send_raw(&self, mut active_usages: &[AudioRenderUsage2]) -> Result<(), fidl::Error> {
1216 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
1217 ActivityReporterWatchRenderActivity2Response,
1218 >>(
1219 fidl::encoding::Flexible::new((active_usages,)),
1220 self.tx_id,
1221 0x484236fc11b363e6,
1222 fidl::encoding::DynamicFlags::FLEXIBLE,
1223 )
1224 }
1225}
1226
1227#[must_use = "FIDL methods require a response to be sent"]
1228#[derive(Debug)]
1229pub struct ActivityReporterWatchCaptureActivityResponder {
1230 control_handle: std::mem::ManuallyDrop<ActivityReporterControlHandle>,
1231 tx_id: u32,
1232}
1233
1234impl std::ops::Drop for ActivityReporterWatchCaptureActivityResponder {
1238 fn drop(&mut self) {
1239 self.control_handle.shutdown();
1240 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1242 }
1243}
1244
1245impl fidl::endpoints::Responder for ActivityReporterWatchCaptureActivityResponder {
1246 type ControlHandle = ActivityReporterControlHandle;
1247
1248 fn control_handle(&self) -> &ActivityReporterControlHandle {
1249 &self.control_handle
1250 }
1251
1252 fn drop_without_shutdown(mut self) {
1253 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1255 std::mem::forget(self);
1257 }
1258}
1259
1260impl ActivityReporterWatchCaptureActivityResponder {
1261 pub fn send(self, mut active_usages: &[AudioCaptureUsage]) -> Result<(), fidl::Error> {
1265 let _result = self.send_raw(active_usages);
1266 if _result.is_err() {
1267 self.control_handle.shutdown();
1268 }
1269 self.drop_without_shutdown();
1270 _result
1271 }
1272
1273 pub fn send_no_shutdown_on_err(
1275 self,
1276 mut active_usages: &[AudioCaptureUsage],
1277 ) -> Result<(), fidl::Error> {
1278 let _result = self.send_raw(active_usages);
1279 self.drop_without_shutdown();
1280 _result
1281 }
1282
1283 fn send_raw(&self, mut active_usages: &[AudioCaptureUsage]) -> Result<(), fidl::Error> {
1284 self.control_handle.inner.send::<ActivityReporterWatchCaptureActivityResponse>(
1285 (active_usages,),
1286 self.tx_id,
1287 0x70e7038e9658e128,
1288 fidl::encoding::DynamicFlags::empty(),
1289 )
1290 }
1291}
1292
1293#[must_use = "FIDL methods require a response to be sent"]
1294#[derive(Debug)]
1295pub struct ActivityReporterWatchCaptureActivity2Responder {
1296 control_handle: std::mem::ManuallyDrop<ActivityReporterControlHandle>,
1297 tx_id: u32,
1298}
1299
1300impl std::ops::Drop for ActivityReporterWatchCaptureActivity2Responder {
1304 fn drop(&mut self) {
1305 self.control_handle.shutdown();
1306 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1308 }
1309}
1310
1311impl fidl::endpoints::Responder for ActivityReporterWatchCaptureActivity2Responder {
1312 type ControlHandle = ActivityReporterControlHandle;
1313
1314 fn control_handle(&self) -> &ActivityReporterControlHandle {
1315 &self.control_handle
1316 }
1317
1318 fn drop_without_shutdown(mut self) {
1319 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1321 std::mem::forget(self);
1323 }
1324}
1325
1326impl ActivityReporterWatchCaptureActivity2Responder {
1327 pub fn send(self, mut active_usages: &[AudioCaptureUsage2]) -> Result<(), fidl::Error> {
1331 let _result = self.send_raw(active_usages);
1332 if _result.is_err() {
1333 self.control_handle.shutdown();
1334 }
1335 self.drop_without_shutdown();
1336 _result
1337 }
1338
1339 pub fn send_no_shutdown_on_err(
1341 self,
1342 mut active_usages: &[AudioCaptureUsage2],
1343 ) -> Result<(), fidl::Error> {
1344 let _result = self.send_raw(active_usages);
1345 self.drop_without_shutdown();
1346 _result
1347 }
1348
1349 fn send_raw(&self, mut active_usages: &[AudioCaptureUsage2]) -> Result<(), fidl::Error> {
1350 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
1351 ActivityReporterWatchCaptureActivity2Response,
1352 >>(
1353 fidl::encoding::Flexible::new((active_usages,)),
1354 self.tx_id,
1355 0x3d137e0364f9d550,
1356 fidl::encoding::DynamicFlags::FLEXIBLE,
1357 )
1358 }
1359}
1360
1361#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1362pub struct AudioMarker;
1363
1364impl fidl::endpoints::ProtocolMarker for AudioMarker {
1365 type Proxy = AudioProxy;
1366 type RequestStream = AudioRequestStream;
1367 #[cfg(target_os = "fuchsia")]
1368 type SynchronousProxy = AudioSynchronousProxy;
1369
1370 const DEBUG_NAME: &'static str = "fuchsia.media.Audio";
1371}
1372impl fidl::endpoints::DiscoverableProtocolMarker for AudioMarker {}
1373
1374pub trait AudioProxyInterface: Send + Sync {
1375 fn r#create_audio_renderer(
1376 &self,
1377 audio_renderer_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
1378 ) -> Result<(), fidl::Error>;
1379 fn r#create_audio_capturer(
1380 &self,
1381 audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
1382 loopback: bool,
1383 ) -> Result<(), fidl::Error>;
1384}
1385#[derive(Debug)]
1386#[cfg(target_os = "fuchsia")]
1387pub struct AudioSynchronousProxy {
1388 client: fidl::client::sync::Client,
1389}
1390
1391#[cfg(target_os = "fuchsia")]
1392impl fidl::endpoints::SynchronousProxy for AudioSynchronousProxy {
1393 type Proxy = AudioProxy;
1394 type Protocol = AudioMarker;
1395
1396 fn from_channel(inner: fidl::Channel) -> Self {
1397 Self::new(inner)
1398 }
1399
1400 fn into_channel(self) -> fidl::Channel {
1401 self.client.into_channel()
1402 }
1403
1404 fn as_channel(&self) -> &fidl::Channel {
1405 self.client.as_channel()
1406 }
1407}
1408
1409#[cfg(target_os = "fuchsia")]
1410impl AudioSynchronousProxy {
1411 pub fn new(channel: fidl::Channel) -> Self {
1412 let protocol_name = <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1413 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1414 }
1415
1416 pub fn into_channel(self) -> fidl::Channel {
1417 self.client.into_channel()
1418 }
1419
1420 pub fn wait_for_event(
1423 &self,
1424 deadline: zx::MonotonicInstant,
1425 ) -> Result<AudioEvent, fidl::Error> {
1426 AudioEvent::decode(self.client.wait_for_event(deadline)?)
1427 }
1428
1429 pub fn r#create_audio_renderer(
1430 &self,
1431 mut audio_renderer_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
1432 ) -> Result<(), fidl::Error> {
1433 self.client.send::<AudioCreateAudioRendererRequest>(
1434 (audio_renderer_request,),
1435 0x572f413566fd58f1,
1436 fidl::encoding::DynamicFlags::empty(),
1437 )
1438 }
1439
1440 pub fn r#create_audio_capturer(
1444 &self,
1445 mut audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
1446 mut loopback: bool,
1447 ) -> Result<(), fidl::Error> {
1448 self.client.send::<AudioCreateAudioCapturerRequest>(
1449 (audio_capturer_request, loopback),
1450 0x44660fc63a6202f,
1451 fidl::encoding::DynamicFlags::empty(),
1452 )
1453 }
1454}
1455
1456#[cfg(target_os = "fuchsia")]
1457impl From<AudioSynchronousProxy> for zx::Handle {
1458 fn from(value: AudioSynchronousProxy) -> Self {
1459 value.into_channel().into()
1460 }
1461}
1462
1463#[cfg(target_os = "fuchsia")]
1464impl From<fidl::Channel> for AudioSynchronousProxy {
1465 fn from(value: fidl::Channel) -> Self {
1466 Self::new(value)
1467 }
1468}
1469
1470#[derive(Debug, Clone)]
1471pub struct AudioProxy {
1472 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1473}
1474
1475impl fidl::endpoints::Proxy for AudioProxy {
1476 type Protocol = AudioMarker;
1477
1478 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1479 Self::new(inner)
1480 }
1481
1482 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1483 self.client.into_channel().map_err(|client| Self { client })
1484 }
1485
1486 fn as_channel(&self) -> &::fidl::AsyncChannel {
1487 self.client.as_channel()
1488 }
1489}
1490
1491impl AudioProxy {
1492 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1494 let protocol_name = <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1495 Self { client: fidl::client::Client::new(channel, protocol_name) }
1496 }
1497
1498 pub fn take_event_stream(&self) -> AudioEventStream {
1504 AudioEventStream { event_receiver: self.client.take_event_receiver() }
1505 }
1506
1507 pub fn r#create_audio_renderer(
1508 &self,
1509 mut audio_renderer_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
1510 ) -> Result<(), fidl::Error> {
1511 AudioProxyInterface::r#create_audio_renderer(self, audio_renderer_request)
1512 }
1513
1514 pub fn r#create_audio_capturer(
1518 &self,
1519 mut audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
1520 mut loopback: bool,
1521 ) -> Result<(), fidl::Error> {
1522 AudioProxyInterface::r#create_audio_capturer(self, audio_capturer_request, loopback)
1523 }
1524}
1525
1526impl AudioProxyInterface for AudioProxy {
1527 fn r#create_audio_renderer(
1528 &self,
1529 mut audio_renderer_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
1530 ) -> Result<(), fidl::Error> {
1531 self.client.send::<AudioCreateAudioRendererRequest>(
1532 (audio_renderer_request,),
1533 0x572f413566fd58f1,
1534 fidl::encoding::DynamicFlags::empty(),
1535 )
1536 }
1537
1538 fn r#create_audio_capturer(
1539 &self,
1540 mut audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
1541 mut loopback: bool,
1542 ) -> Result<(), fidl::Error> {
1543 self.client.send::<AudioCreateAudioCapturerRequest>(
1544 (audio_capturer_request, loopback),
1545 0x44660fc63a6202f,
1546 fidl::encoding::DynamicFlags::empty(),
1547 )
1548 }
1549}
1550
1551pub struct AudioEventStream {
1552 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1553}
1554
1555impl std::marker::Unpin for AudioEventStream {}
1556
1557impl futures::stream::FusedStream for AudioEventStream {
1558 fn is_terminated(&self) -> bool {
1559 self.event_receiver.is_terminated()
1560 }
1561}
1562
1563impl futures::Stream for AudioEventStream {
1564 type Item = Result<AudioEvent, fidl::Error>;
1565
1566 fn poll_next(
1567 mut self: std::pin::Pin<&mut Self>,
1568 cx: &mut std::task::Context<'_>,
1569 ) -> std::task::Poll<Option<Self::Item>> {
1570 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1571 &mut self.event_receiver,
1572 cx
1573 )?) {
1574 Some(buf) => std::task::Poll::Ready(Some(AudioEvent::decode(buf))),
1575 None => std::task::Poll::Ready(None),
1576 }
1577 }
1578}
1579
1580#[derive(Debug)]
1581pub enum AudioEvent {}
1582
1583impl AudioEvent {
1584 fn decode(
1586 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1587 ) -> Result<AudioEvent, fidl::Error> {
1588 let (bytes, _handles) = buf.split_mut();
1589 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1590 debug_assert_eq!(tx_header.tx_id, 0);
1591 match tx_header.ordinal {
1592 _ => Err(fidl::Error::UnknownOrdinal {
1593 ordinal: tx_header.ordinal,
1594 protocol_name: <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1595 }),
1596 }
1597 }
1598}
1599
1600pub struct AudioRequestStream {
1602 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1603 is_terminated: bool,
1604}
1605
1606impl std::marker::Unpin for AudioRequestStream {}
1607
1608impl futures::stream::FusedStream for AudioRequestStream {
1609 fn is_terminated(&self) -> bool {
1610 self.is_terminated
1611 }
1612}
1613
1614impl fidl::endpoints::RequestStream for AudioRequestStream {
1615 type Protocol = AudioMarker;
1616 type ControlHandle = AudioControlHandle;
1617
1618 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1619 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1620 }
1621
1622 fn control_handle(&self) -> Self::ControlHandle {
1623 AudioControlHandle { inner: self.inner.clone() }
1624 }
1625
1626 fn into_inner(
1627 self,
1628 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1629 {
1630 (self.inner, self.is_terminated)
1631 }
1632
1633 fn from_inner(
1634 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1635 is_terminated: bool,
1636 ) -> Self {
1637 Self { inner, is_terminated }
1638 }
1639}
1640
1641impl futures::Stream for AudioRequestStream {
1642 type Item = Result<AudioRequest, fidl::Error>;
1643
1644 fn poll_next(
1645 mut self: std::pin::Pin<&mut Self>,
1646 cx: &mut std::task::Context<'_>,
1647 ) -> std::task::Poll<Option<Self::Item>> {
1648 let this = &mut *self;
1649 if this.inner.check_shutdown(cx) {
1650 this.is_terminated = true;
1651 return std::task::Poll::Ready(None);
1652 }
1653 if this.is_terminated {
1654 panic!("polled AudioRequestStream after completion");
1655 }
1656 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1657 |bytes, handles| {
1658 match this.inner.channel().read_etc(cx, bytes, handles) {
1659 std::task::Poll::Ready(Ok(())) => {}
1660 std::task::Poll::Pending => return std::task::Poll::Pending,
1661 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1662 this.is_terminated = true;
1663 return std::task::Poll::Ready(None);
1664 }
1665 std::task::Poll::Ready(Err(e)) => {
1666 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1667 e.into(),
1668 ))))
1669 }
1670 }
1671
1672 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1674
1675 std::task::Poll::Ready(Some(match header.ordinal {
1676 0x572f413566fd58f1 => {
1677 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1678 let mut req = fidl::new_empty!(
1679 AudioCreateAudioRendererRequest,
1680 fidl::encoding::DefaultFuchsiaResourceDialect
1681 );
1682 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCreateAudioRendererRequest>(&header, _body_bytes, handles, &mut req)?;
1683 let control_handle = AudioControlHandle { inner: this.inner.clone() };
1684 Ok(AudioRequest::CreateAudioRenderer {
1685 audio_renderer_request: req.audio_renderer_request,
1686
1687 control_handle,
1688 })
1689 }
1690 0x44660fc63a6202f => {
1691 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1692 let mut req = fidl::new_empty!(
1693 AudioCreateAudioCapturerRequest,
1694 fidl::encoding::DefaultFuchsiaResourceDialect
1695 );
1696 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCreateAudioCapturerRequest>(&header, _body_bytes, handles, &mut req)?;
1697 let control_handle = AudioControlHandle { inner: this.inner.clone() };
1698 Ok(AudioRequest::CreateAudioCapturer {
1699 audio_capturer_request: req.audio_capturer_request,
1700 loopback: req.loopback,
1701
1702 control_handle,
1703 })
1704 }
1705 _ => Err(fidl::Error::UnknownOrdinal {
1706 ordinal: header.ordinal,
1707 protocol_name: <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1708 }),
1709 }))
1710 },
1711 )
1712 }
1713}
1714
1715#[derive(Debug)]
1716pub enum AudioRequest {
1717 CreateAudioRenderer {
1718 audio_renderer_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
1719 control_handle: AudioControlHandle,
1720 },
1721 CreateAudioCapturer {
1725 audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
1726 loopback: bool,
1727 control_handle: AudioControlHandle,
1728 },
1729}
1730
1731impl AudioRequest {
1732 #[allow(irrefutable_let_patterns)]
1733 pub fn into_create_audio_renderer(
1734 self,
1735 ) -> Option<(fidl::endpoints::ServerEnd<AudioRendererMarker>, AudioControlHandle)> {
1736 if let AudioRequest::CreateAudioRenderer { audio_renderer_request, control_handle } = self {
1737 Some((audio_renderer_request, control_handle))
1738 } else {
1739 None
1740 }
1741 }
1742
1743 #[allow(irrefutable_let_patterns)]
1744 pub fn into_create_audio_capturer(
1745 self,
1746 ) -> Option<(fidl::endpoints::ServerEnd<AudioCapturerMarker>, bool, AudioControlHandle)> {
1747 if let AudioRequest::CreateAudioCapturer {
1748 audio_capturer_request,
1749 loopback,
1750 control_handle,
1751 } = self
1752 {
1753 Some((audio_capturer_request, loopback, control_handle))
1754 } else {
1755 None
1756 }
1757 }
1758
1759 pub fn method_name(&self) -> &'static str {
1761 match *self {
1762 AudioRequest::CreateAudioRenderer { .. } => "create_audio_renderer",
1763 AudioRequest::CreateAudioCapturer { .. } => "create_audio_capturer",
1764 }
1765 }
1766}
1767
1768#[derive(Debug, Clone)]
1769pub struct AudioControlHandle {
1770 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1771}
1772
1773impl fidl::endpoints::ControlHandle for AudioControlHandle {
1774 fn shutdown(&self) {
1775 self.inner.shutdown()
1776 }
1777 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1778 self.inner.shutdown_with_epitaph(status)
1779 }
1780
1781 fn is_closed(&self) -> bool {
1782 self.inner.channel().is_closed()
1783 }
1784 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1785 self.inner.channel().on_closed()
1786 }
1787
1788 #[cfg(target_os = "fuchsia")]
1789 fn signal_peer(
1790 &self,
1791 clear_mask: zx::Signals,
1792 set_mask: zx::Signals,
1793 ) -> Result<(), zx_status::Status> {
1794 use fidl::Peered;
1795 self.inner.channel().signal_peer(clear_mask, set_mask)
1796 }
1797}
1798
1799impl AudioControlHandle {}
1800
1801#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1802pub struct AudioCapturerMarker;
1803
1804impl fidl::endpoints::ProtocolMarker for AudioCapturerMarker {
1805 type Proxy = AudioCapturerProxy;
1806 type RequestStream = AudioCapturerRequestStream;
1807 #[cfg(target_os = "fuchsia")]
1808 type SynchronousProxy = AudioCapturerSynchronousProxy;
1809
1810 const DEBUG_NAME: &'static str = "fuchsia.media.AudioCapturer";
1811}
1812impl fidl::endpoints::DiscoverableProtocolMarker for AudioCapturerMarker {}
1813
1814pub trait AudioCapturerProxyInterface: Send + Sync {
1815 fn r#add_payload_buffer(&self, id: u32, payload_buffer: fidl::Vmo) -> Result<(), fidl::Error>;
1816 fn r#remove_payload_buffer(&self, id: u32) -> Result<(), fidl::Error>;
1817 fn r#release_packet(&self, packet: &StreamPacket) -> Result<(), fidl::Error>;
1818 type DiscardAllPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1819 fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut;
1820 fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error>;
1821 fn r#set_pcm_stream_type(&self, stream_type: &AudioStreamType) -> Result<(), fidl::Error>;
1822 type CaptureAtResponseFut: std::future::Future<Output = Result<StreamPacket, fidl::Error>>
1823 + Send;
1824 fn r#capture_at(
1825 &self,
1826 payload_buffer_id: u32,
1827 payload_offset: u32,
1828 frames: u32,
1829 ) -> Self::CaptureAtResponseFut;
1830 fn r#start_async_capture(&self, frames_per_packet: u32) -> Result<(), fidl::Error>;
1831 type StopAsyncCaptureResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1832 fn r#stop_async_capture(&self) -> Self::StopAsyncCaptureResponseFut;
1833 fn r#stop_async_capture_no_reply(&self) -> Result<(), fidl::Error>;
1834 fn r#bind_gain_control(
1835 &self,
1836 gain_control_request: fidl::endpoints::ServerEnd<
1837 fidl_fuchsia_media_audio::GainControlMarker,
1838 >,
1839 ) -> Result<(), fidl::Error>;
1840 type GetReferenceClockResponseFut: std::future::Future<Output = Result<fidl::Clock, fidl::Error>>
1841 + Send;
1842 fn r#get_reference_clock(&self) -> Self::GetReferenceClockResponseFut;
1843 fn r#set_reference_clock(
1844 &self,
1845 reference_clock: Option<fidl::Clock>,
1846 ) -> Result<(), fidl::Error>;
1847 fn r#set_usage(&self, usage: AudioCaptureUsage) -> Result<(), fidl::Error>;
1848 fn r#set_usage2(&self, usage: AudioCaptureUsage2) -> Result<(), fidl::Error>;
1849 type GetStreamTypeResponseFut: std::future::Future<Output = Result<StreamType, fidl::Error>>
1850 + Send;
1851 fn r#get_stream_type(&self) -> Self::GetStreamTypeResponseFut;
1852}
1853#[derive(Debug)]
1854#[cfg(target_os = "fuchsia")]
1855pub struct AudioCapturerSynchronousProxy {
1856 client: fidl::client::sync::Client,
1857}
1858
1859#[cfg(target_os = "fuchsia")]
1860impl fidl::endpoints::SynchronousProxy for AudioCapturerSynchronousProxy {
1861 type Proxy = AudioCapturerProxy;
1862 type Protocol = AudioCapturerMarker;
1863
1864 fn from_channel(inner: fidl::Channel) -> Self {
1865 Self::new(inner)
1866 }
1867
1868 fn into_channel(self) -> fidl::Channel {
1869 self.client.into_channel()
1870 }
1871
1872 fn as_channel(&self) -> &fidl::Channel {
1873 self.client.as_channel()
1874 }
1875}
1876
1877#[cfg(target_os = "fuchsia")]
1878impl AudioCapturerSynchronousProxy {
1879 pub fn new(channel: fidl::Channel) -> Self {
1880 let protocol_name = <AudioCapturerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1881 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1882 }
1883
1884 pub fn into_channel(self) -> fidl::Channel {
1885 self.client.into_channel()
1886 }
1887
1888 pub fn wait_for_event(
1891 &self,
1892 deadline: zx::MonotonicInstant,
1893 ) -> Result<AudioCapturerEvent, fidl::Error> {
1894 AudioCapturerEvent::decode(self.client.wait_for_event(deadline)?)
1895 }
1896
1897 pub fn r#add_payload_buffer(
1904 &self,
1905 mut id: u32,
1906 mut payload_buffer: fidl::Vmo,
1907 ) -> Result<(), fidl::Error> {
1908 self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
1909 (id, payload_buffer),
1910 0x3b3a37fc34fe5b56,
1911 fidl::encoding::DynamicFlags::empty(),
1912 )
1913 }
1914
1915 pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
1921 self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
1922 (id,),
1923 0x5d1e4f74c3658262,
1924 fidl::encoding::DynamicFlags::empty(),
1925 )
1926 }
1927
1928 pub fn r#release_packet(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
1931 self.client.send::<StreamSourceReleasePacketRequest>(
1932 (packet,),
1933 0x7a7b57f0f7d9e4bb,
1934 fidl::encoding::DynamicFlags::empty(),
1935 )
1936 }
1937
1938 pub fn r#discard_all_packets(
1939 &self,
1940 ___deadline: zx::MonotonicInstant,
1941 ) -> Result<(), fidl::Error> {
1942 let _response =
1943 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
1944 (),
1945 0x27afd605e97b09d2,
1946 fidl::encoding::DynamicFlags::empty(),
1947 ___deadline,
1948 )?;
1949 Ok(_response)
1950 }
1951
1952 pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
1953 self.client.send::<fidl::encoding::EmptyPayload>(
1954 (),
1955 0x35f9d721e905b831,
1956 fidl::encoding::DynamicFlags::empty(),
1957 )
1958 }
1959
1960 pub fn r#set_pcm_stream_type(
1965 &self,
1966 mut stream_type: &AudioStreamType,
1967 ) -> Result<(), fidl::Error> {
1968 self.client.send::<AudioCapturerSetPcmStreamTypeRequest>(
1969 (stream_type,),
1970 0x1531ea9ea2c852cd,
1971 fidl::encoding::DynamicFlags::empty(),
1972 )
1973 }
1974
1975 pub fn r#capture_at(
1978 &self,
1979 mut payload_buffer_id: u32,
1980 mut payload_offset: u32,
1981 mut frames: u32,
1982 ___deadline: zx::MonotonicInstant,
1983 ) -> Result<StreamPacket, fidl::Error> {
1984 let _response = self
1985 .client
1986 .send_query::<AudioCapturerCaptureAtRequest, AudioCapturerCaptureAtResponse>(
1987 (payload_buffer_id, payload_offset, frames),
1988 0x784e25df72cea780,
1989 fidl::encoding::DynamicFlags::empty(),
1990 ___deadline,
1991 )?;
1992 Ok(_response.captured_packet)
1993 }
1994
1995 pub fn r#start_async_capture(&self, mut frames_per_packet: u32) -> Result<(), fidl::Error> {
2000 self.client.send::<AudioCapturerStartAsyncCaptureRequest>(
2001 (frames_per_packet,),
2002 0x7768adbb1ccfd7a6,
2003 fidl::encoding::DynamicFlags::empty(),
2004 )
2005 }
2006
2007 pub fn r#stop_async_capture(
2010 &self,
2011 ___deadline: zx::MonotonicInstant,
2012 ) -> Result<(), fidl::Error> {
2013 let _response =
2014 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
2015 (),
2016 0x5bfc8790a8cef8cb,
2017 fidl::encoding::DynamicFlags::empty(),
2018 ___deadline,
2019 )?;
2020 Ok(_response)
2021 }
2022
2023 pub fn r#stop_async_capture_no_reply(&self) -> Result<(), fidl::Error> {
2024 self.client.send::<fidl::encoding::EmptyPayload>(
2025 (),
2026 0x33223cb2962c95e3,
2027 fidl::encoding::DynamicFlags::empty(),
2028 )
2029 }
2030
2031 pub fn r#bind_gain_control(
2033 &self,
2034 mut gain_control_request: fidl::endpoints::ServerEnd<
2035 fidl_fuchsia_media_audio::GainControlMarker,
2036 >,
2037 ) -> Result<(), fidl::Error> {
2038 self.client.send::<AudioCapturerBindGainControlRequest>(
2039 (gain_control_request,),
2040 0x658a6a17ddb3a8e0,
2041 fidl::encoding::DynamicFlags::empty(),
2042 )
2043 }
2044
2045 pub fn r#get_reference_clock(
2048 &self,
2049 ___deadline: zx::MonotonicInstant,
2050 ) -> Result<fidl::Clock, fidl::Error> {
2051 let _response = self
2052 .client
2053 .send_query::<fidl::encoding::EmptyPayload, AudioCapturerGetReferenceClockResponse>(
2054 (),
2055 0x50d037aa5a4b4d71,
2056 fidl::encoding::DynamicFlags::empty(),
2057 ___deadline,
2058 )?;
2059 Ok(_response.reference_clock)
2060 }
2061
2062 pub fn r#set_reference_clock(
2074 &self,
2075 mut reference_clock: Option<fidl::Clock>,
2076 ) -> Result<(), fidl::Error> {
2077 self.client.send::<AudioCapturerSetReferenceClockRequest>(
2078 (reference_clock,),
2079 0x732b2c496d521bcf,
2080 fidl::encoding::DynamicFlags::empty(),
2081 )
2082 }
2083
2084 pub fn r#set_usage(&self, mut usage: AudioCaptureUsage) -> Result<(), fidl::Error> {
2087 self.client.send::<AudioCapturerSetUsageRequest>(
2088 (usage,),
2089 0x42a16f392bd21b25,
2090 fidl::encoding::DynamicFlags::empty(),
2091 )
2092 }
2093
2094 pub fn r#set_usage2(&self, mut usage: AudioCaptureUsage2) -> Result<(), fidl::Error> {
2097 self.client.send::<AudioCapturerSetUsage2Request>(
2098 (usage,),
2099 0x7a73e251b8d2382b,
2100 fidl::encoding::DynamicFlags::FLEXIBLE,
2101 )
2102 }
2103
2104 pub fn r#get_stream_type(
2111 &self,
2112 ___deadline: zx::MonotonicInstant,
2113 ) -> Result<StreamType, fidl::Error> {
2114 let _response = self
2115 .client
2116 .send_query::<fidl::encoding::EmptyPayload, AudioCapturerGetStreamTypeResponse>(
2117 (),
2118 0x5dcaaa670b433088,
2119 fidl::encoding::DynamicFlags::empty(),
2120 ___deadline,
2121 )?;
2122 Ok(_response.stream_type)
2123 }
2124}
2125
2126#[cfg(target_os = "fuchsia")]
2127impl From<AudioCapturerSynchronousProxy> for zx::Handle {
2128 fn from(value: AudioCapturerSynchronousProxy) -> Self {
2129 value.into_channel().into()
2130 }
2131}
2132
2133#[cfg(target_os = "fuchsia")]
2134impl From<fidl::Channel> for AudioCapturerSynchronousProxy {
2135 fn from(value: fidl::Channel) -> Self {
2136 Self::new(value)
2137 }
2138}
2139
2140#[derive(Debug, Clone)]
2141pub struct AudioCapturerProxy {
2142 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2143}
2144
2145impl fidl::endpoints::Proxy for AudioCapturerProxy {
2146 type Protocol = AudioCapturerMarker;
2147
2148 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2149 Self::new(inner)
2150 }
2151
2152 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2153 self.client.into_channel().map_err(|client| Self { client })
2154 }
2155
2156 fn as_channel(&self) -> &::fidl::AsyncChannel {
2157 self.client.as_channel()
2158 }
2159}
2160
2161impl AudioCapturerProxy {
2162 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2164 let protocol_name = <AudioCapturerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2165 Self { client: fidl::client::Client::new(channel, protocol_name) }
2166 }
2167
2168 pub fn take_event_stream(&self) -> AudioCapturerEventStream {
2174 AudioCapturerEventStream { event_receiver: self.client.take_event_receiver() }
2175 }
2176
2177 pub fn r#add_payload_buffer(
2184 &self,
2185 mut id: u32,
2186 mut payload_buffer: fidl::Vmo,
2187 ) -> Result<(), fidl::Error> {
2188 AudioCapturerProxyInterface::r#add_payload_buffer(self, id, payload_buffer)
2189 }
2190
2191 pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
2197 AudioCapturerProxyInterface::r#remove_payload_buffer(self, id)
2198 }
2199
2200 pub fn r#release_packet(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
2203 AudioCapturerProxyInterface::r#release_packet(self, packet)
2204 }
2205
2206 pub fn r#discard_all_packets(
2207 &self,
2208 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2209 AudioCapturerProxyInterface::r#discard_all_packets(self)
2210 }
2211
2212 pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
2213 AudioCapturerProxyInterface::r#discard_all_packets_no_reply(self)
2214 }
2215
2216 pub fn r#set_pcm_stream_type(
2221 &self,
2222 mut stream_type: &AudioStreamType,
2223 ) -> Result<(), fidl::Error> {
2224 AudioCapturerProxyInterface::r#set_pcm_stream_type(self, stream_type)
2225 }
2226
2227 pub fn r#capture_at(
2230 &self,
2231 mut payload_buffer_id: u32,
2232 mut payload_offset: u32,
2233 mut frames: u32,
2234 ) -> fidl::client::QueryResponseFut<StreamPacket, fidl::encoding::DefaultFuchsiaResourceDialect>
2235 {
2236 AudioCapturerProxyInterface::r#capture_at(self, payload_buffer_id, payload_offset, frames)
2237 }
2238
2239 pub fn r#start_async_capture(&self, mut frames_per_packet: u32) -> Result<(), fidl::Error> {
2244 AudioCapturerProxyInterface::r#start_async_capture(self, frames_per_packet)
2245 }
2246
2247 pub fn r#stop_async_capture(
2250 &self,
2251 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2252 AudioCapturerProxyInterface::r#stop_async_capture(self)
2253 }
2254
2255 pub fn r#stop_async_capture_no_reply(&self) -> Result<(), fidl::Error> {
2256 AudioCapturerProxyInterface::r#stop_async_capture_no_reply(self)
2257 }
2258
2259 pub fn r#bind_gain_control(
2261 &self,
2262 mut gain_control_request: fidl::endpoints::ServerEnd<
2263 fidl_fuchsia_media_audio::GainControlMarker,
2264 >,
2265 ) -> Result<(), fidl::Error> {
2266 AudioCapturerProxyInterface::r#bind_gain_control(self, gain_control_request)
2267 }
2268
2269 pub fn r#get_reference_clock(
2272 &self,
2273 ) -> fidl::client::QueryResponseFut<fidl::Clock, fidl::encoding::DefaultFuchsiaResourceDialect>
2274 {
2275 AudioCapturerProxyInterface::r#get_reference_clock(self)
2276 }
2277
2278 pub fn r#set_reference_clock(
2290 &self,
2291 mut reference_clock: Option<fidl::Clock>,
2292 ) -> Result<(), fidl::Error> {
2293 AudioCapturerProxyInterface::r#set_reference_clock(self, reference_clock)
2294 }
2295
2296 pub fn r#set_usage(&self, mut usage: AudioCaptureUsage) -> Result<(), fidl::Error> {
2299 AudioCapturerProxyInterface::r#set_usage(self, usage)
2300 }
2301
2302 pub fn r#set_usage2(&self, mut usage: AudioCaptureUsage2) -> Result<(), fidl::Error> {
2305 AudioCapturerProxyInterface::r#set_usage2(self, usage)
2306 }
2307
2308 pub fn r#get_stream_type(
2315 &self,
2316 ) -> fidl::client::QueryResponseFut<StreamType, fidl::encoding::DefaultFuchsiaResourceDialect>
2317 {
2318 AudioCapturerProxyInterface::r#get_stream_type(self)
2319 }
2320}
2321
2322impl AudioCapturerProxyInterface for AudioCapturerProxy {
2323 fn r#add_payload_buffer(
2324 &self,
2325 mut id: u32,
2326 mut payload_buffer: fidl::Vmo,
2327 ) -> Result<(), fidl::Error> {
2328 self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
2329 (id, payload_buffer),
2330 0x3b3a37fc34fe5b56,
2331 fidl::encoding::DynamicFlags::empty(),
2332 )
2333 }
2334
2335 fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
2336 self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
2337 (id,),
2338 0x5d1e4f74c3658262,
2339 fidl::encoding::DynamicFlags::empty(),
2340 )
2341 }
2342
2343 fn r#release_packet(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
2344 self.client.send::<StreamSourceReleasePacketRequest>(
2345 (packet,),
2346 0x7a7b57f0f7d9e4bb,
2347 fidl::encoding::DynamicFlags::empty(),
2348 )
2349 }
2350
2351 type DiscardAllPacketsResponseFut =
2352 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2353 fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut {
2354 fn _decode(
2355 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2356 ) -> Result<(), fidl::Error> {
2357 let _response = fidl::client::decode_transaction_body::<
2358 fidl::encoding::EmptyPayload,
2359 fidl::encoding::DefaultFuchsiaResourceDialect,
2360 0x27afd605e97b09d2,
2361 >(_buf?)?;
2362 Ok(_response)
2363 }
2364 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2365 (),
2366 0x27afd605e97b09d2,
2367 fidl::encoding::DynamicFlags::empty(),
2368 _decode,
2369 )
2370 }
2371
2372 fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
2373 self.client.send::<fidl::encoding::EmptyPayload>(
2374 (),
2375 0x35f9d721e905b831,
2376 fidl::encoding::DynamicFlags::empty(),
2377 )
2378 }
2379
2380 fn r#set_pcm_stream_type(&self, mut stream_type: &AudioStreamType) -> Result<(), fidl::Error> {
2381 self.client.send::<AudioCapturerSetPcmStreamTypeRequest>(
2382 (stream_type,),
2383 0x1531ea9ea2c852cd,
2384 fidl::encoding::DynamicFlags::empty(),
2385 )
2386 }
2387
2388 type CaptureAtResponseFut =
2389 fidl::client::QueryResponseFut<StreamPacket, fidl::encoding::DefaultFuchsiaResourceDialect>;
2390 fn r#capture_at(
2391 &self,
2392 mut payload_buffer_id: u32,
2393 mut payload_offset: u32,
2394 mut frames: u32,
2395 ) -> Self::CaptureAtResponseFut {
2396 fn _decode(
2397 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2398 ) -> Result<StreamPacket, fidl::Error> {
2399 let _response = fidl::client::decode_transaction_body::<
2400 AudioCapturerCaptureAtResponse,
2401 fidl::encoding::DefaultFuchsiaResourceDialect,
2402 0x784e25df72cea780,
2403 >(_buf?)?;
2404 Ok(_response.captured_packet)
2405 }
2406 self.client.send_query_and_decode::<AudioCapturerCaptureAtRequest, StreamPacket>(
2407 (payload_buffer_id, payload_offset, frames),
2408 0x784e25df72cea780,
2409 fidl::encoding::DynamicFlags::empty(),
2410 _decode,
2411 )
2412 }
2413
2414 fn r#start_async_capture(&self, mut frames_per_packet: u32) -> Result<(), fidl::Error> {
2415 self.client.send::<AudioCapturerStartAsyncCaptureRequest>(
2416 (frames_per_packet,),
2417 0x7768adbb1ccfd7a6,
2418 fidl::encoding::DynamicFlags::empty(),
2419 )
2420 }
2421
2422 type StopAsyncCaptureResponseFut =
2423 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2424 fn r#stop_async_capture(&self) -> Self::StopAsyncCaptureResponseFut {
2425 fn _decode(
2426 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2427 ) -> Result<(), fidl::Error> {
2428 let _response = fidl::client::decode_transaction_body::<
2429 fidl::encoding::EmptyPayload,
2430 fidl::encoding::DefaultFuchsiaResourceDialect,
2431 0x5bfc8790a8cef8cb,
2432 >(_buf?)?;
2433 Ok(_response)
2434 }
2435 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2436 (),
2437 0x5bfc8790a8cef8cb,
2438 fidl::encoding::DynamicFlags::empty(),
2439 _decode,
2440 )
2441 }
2442
2443 fn r#stop_async_capture_no_reply(&self) -> Result<(), fidl::Error> {
2444 self.client.send::<fidl::encoding::EmptyPayload>(
2445 (),
2446 0x33223cb2962c95e3,
2447 fidl::encoding::DynamicFlags::empty(),
2448 )
2449 }
2450
2451 fn r#bind_gain_control(
2452 &self,
2453 mut gain_control_request: fidl::endpoints::ServerEnd<
2454 fidl_fuchsia_media_audio::GainControlMarker,
2455 >,
2456 ) -> Result<(), fidl::Error> {
2457 self.client.send::<AudioCapturerBindGainControlRequest>(
2458 (gain_control_request,),
2459 0x658a6a17ddb3a8e0,
2460 fidl::encoding::DynamicFlags::empty(),
2461 )
2462 }
2463
2464 type GetReferenceClockResponseFut =
2465 fidl::client::QueryResponseFut<fidl::Clock, fidl::encoding::DefaultFuchsiaResourceDialect>;
2466 fn r#get_reference_clock(&self) -> Self::GetReferenceClockResponseFut {
2467 fn _decode(
2468 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2469 ) -> Result<fidl::Clock, fidl::Error> {
2470 let _response = fidl::client::decode_transaction_body::<
2471 AudioCapturerGetReferenceClockResponse,
2472 fidl::encoding::DefaultFuchsiaResourceDialect,
2473 0x50d037aa5a4b4d71,
2474 >(_buf?)?;
2475 Ok(_response.reference_clock)
2476 }
2477 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Clock>(
2478 (),
2479 0x50d037aa5a4b4d71,
2480 fidl::encoding::DynamicFlags::empty(),
2481 _decode,
2482 )
2483 }
2484
2485 fn r#set_reference_clock(
2486 &self,
2487 mut reference_clock: Option<fidl::Clock>,
2488 ) -> Result<(), fidl::Error> {
2489 self.client.send::<AudioCapturerSetReferenceClockRequest>(
2490 (reference_clock,),
2491 0x732b2c496d521bcf,
2492 fidl::encoding::DynamicFlags::empty(),
2493 )
2494 }
2495
2496 fn r#set_usage(&self, mut usage: AudioCaptureUsage) -> Result<(), fidl::Error> {
2497 self.client.send::<AudioCapturerSetUsageRequest>(
2498 (usage,),
2499 0x42a16f392bd21b25,
2500 fidl::encoding::DynamicFlags::empty(),
2501 )
2502 }
2503
2504 fn r#set_usage2(&self, mut usage: AudioCaptureUsage2) -> Result<(), fidl::Error> {
2505 self.client.send::<AudioCapturerSetUsage2Request>(
2506 (usage,),
2507 0x7a73e251b8d2382b,
2508 fidl::encoding::DynamicFlags::FLEXIBLE,
2509 )
2510 }
2511
2512 type GetStreamTypeResponseFut =
2513 fidl::client::QueryResponseFut<StreamType, fidl::encoding::DefaultFuchsiaResourceDialect>;
2514 fn r#get_stream_type(&self) -> Self::GetStreamTypeResponseFut {
2515 fn _decode(
2516 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2517 ) -> Result<StreamType, fidl::Error> {
2518 let _response = fidl::client::decode_transaction_body::<
2519 AudioCapturerGetStreamTypeResponse,
2520 fidl::encoding::DefaultFuchsiaResourceDialect,
2521 0x5dcaaa670b433088,
2522 >(_buf?)?;
2523 Ok(_response.stream_type)
2524 }
2525 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamType>(
2526 (),
2527 0x5dcaaa670b433088,
2528 fidl::encoding::DynamicFlags::empty(),
2529 _decode,
2530 )
2531 }
2532}
2533
2534pub struct AudioCapturerEventStream {
2535 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2536}
2537
2538impl std::marker::Unpin for AudioCapturerEventStream {}
2539
2540impl futures::stream::FusedStream for AudioCapturerEventStream {
2541 fn is_terminated(&self) -> bool {
2542 self.event_receiver.is_terminated()
2543 }
2544}
2545
2546impl futures::Stream for AudioCapturerEventStream {
2547 type Item = Result<AudioCapturerEvent, fidl::Error>;
2548
2549 fn poll_next(
2550 mut self: std::pin::Pin<&mut Self>,
2551 cx: &mut std::task::Context<'_>,
2552 ) -> std::task::Poll<Option<Self::Item>> {
2553 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2554 &mut self.event_receiver,
2555 cx
2556 )?) {
2557 Some(buf) => std::task::Poll::Ready(Some(AudioCapturerEvent::decode(buf))),
2558 None => std::task::Poll::Ready(None),
2559 }
2560 }
2561}
2562
2563#[derive(Debug)]
2564pub enum AudioCapturerEvent {
2565 OnPacketProduced {
2566 packet: StreamPacket,
2567 },
2568 OnEndOfStream {},
2569 #[non_exhaustive]
2570 _UnknownEvent {
2571 ordinal: u64,
2573 },
2574}
2575
2576impl AudioCapturerEvent {
2577 #[allow(irrefutable_let_patterns)]
2578 pub fn into_on_packet_produced(self) -> Option<StreamPacket> {
2579 if let AudioCapturerEvent::OnPacketProduced { packet } = self {
2580 Some((packet))
2581 } else {
2582 None
2583 }
2584 }
2585 #[allow(irrefutable_let_patterns)]
2586 pub fn into_on_end_of_stream(self) -> Option<()> {
2587 if let AudioCapturerEvent::OnEndOfStream {} = self {
2588 Some(())
2589 } else {
2590 None
2591 }
2592 }
2593
2594 fn decode(
2596 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2597 ) -> Result<AudioCapturerEvent, fidl::Error> {
2598 let (bytes, _handles) = buf.split_mut();
2599 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2600 debug_assert_eq!(tx_header.tx_id, 0);
2601 match tx_header.ordinal {
2602 0x6bbe69746a3c8bd9 => {
2603 let mut out = fidl::new_empty!(
2604 StreamSourceOnPacketProducedRequest,
2605 fidl::encoding::DefaultFuchsiaResourceDialect
2606 );
2607 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSourceOnPacketProducedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2608 Ok((AudioCapturerEvent::OnPacketProduced { packet: out.packet }))
2609 }
2610 0x550e69b41d03e2c2 => {
2611 let mut out = fidl::new_empty!(
2612 fidl::encoding::EmptyPayload,
2613 fidl::encoding::DefaultFuchsiaResourceDialect
2614 );
2615 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
2616 Ok((AudioCapturerEvent::OnEndOfStream {}))
2617 }
2618 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2619 Ok(AudioCapturerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2620 }
2621 _ => Err(fidl::Error::UnknownOrdinal {
2622 ordinal: tx_header.ordinal,
2623 protocol_name: <AudioCapturerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2624 }),
2625 }
2626 }
2627}
2628
2629pub struct AudioCapturerRequestStream {
2631 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2632 is_terminated: bool,
2633}
2634
2635impl std::marker::Unpin for AudioCapturerRequestStream {}
2636
2637impl futures::stream::FusedStream for AudioCapturerRequestStream {
2638 fn is_terminated(&self) -> bool {
2639 self.is_terminated
2640 }
2641}
2642
2643impl fidl::endpoints::RequestStream for AudioCapturerRequestStream {
2644 type Protocol = AudioCapturerMarker;
2645 type ControlHandle = AudioCapturerControlHandle;
2646
2647 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2648 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2649 }
2650
2651 fn control_handle(&self) -> Self::ControlHandle {
2652 AudioCapturerControlHandle { inner: self.inner.clone() }
2653 }
2654
2655 fn into_inner(
2656 self,
2657 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2658 {
2659 (self.inner, self.is_terminated)
2660 }
2661
2662 fn from_inner(
2663 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2664 is_terminated: bool,
2665 ) -> Self {
2666 Self { inner, is_terminated }
2667 }
2668}
2669
2670impl futures::Stream for AudioCapturerRequestStream {
2671 type Item = Result<AudioCapturerRequest, fidl::Error>;
2672
2673 fn poll_next(
2674 mut self: std::pin::Pin<&mut Self>,
2675 cx: &mut std::task::Context<'_>,
2676 ) -> std::task::Poll<Option<Self::Item>> {
2677 let this = &mut *self;
2678 if this.inner.check_shutdown(cx) {
2679 this.is_terminated = true;
2680 return std::task::Poll::Ready(None);
2681 }
2682 if this.is_terminated {
2683 panic!("polled AudioCapturerRequestStream after completion");
2684 }
2685 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2686 |bytes, handles| {
2687 match this.inner.channel().read_etc(cx, bytes, handles) {
2688 std::task::Poll::Ready(Ok(())) => {}
2689 std::task::Poll::Pending => return std::task::Poll::Pending,
2690 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2691 this.is_terminated = true;
2692 return std::task::Poll::Ready(None);
2693 }
2694 std::task::Poll::Ready(Err(e)) => {
2695 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2696 e.into(),
2697 ))))
2698 }
2699 }
2700
2701 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2703
2704 std::task::Poll::Ready(Some(match header.ordinal {
2705 0x3b3a37fc34fe5b56 => {
2706 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2707 let mut req = fidl::new_empty!(
2708 StreamBufferSetAddPayloadBufferRequest,
2709 fidl::encoding::DefaultFuchsiaResourceDialect
2710 );
2711 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetAddPayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
2712 let control_handle =
2713 AudioCapturerControlHandle { inner: this.inner.clone() };
2714 Ok(AudioCapturerRequest::AddPayloadBuffer {
2715 id: req.id,
2716 payload_buffer: req.payload_buffer,
2717
2718 control_handle,
2719 })
2720 }
2721 0x5d1e4f74c3658262 => {
2722 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2723 let mut req = fidl::new_empty!(
2724 StreamBufferSetRemovePayloadBufferRequest,
2725 fidl::encoding::DefaultFuchsiaResourceDialect
2726 );
2727 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetRemovePayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
2728 let control_handle =
2729 AudioCapturerControlHandle { inner: this.inner.clone() };
2730 Ok(AudioCapturerRequest::RemovePayloadBuffer { id: req.id, control_handle })
2731 }
2732 0x7a7b57f0f7d9e4bb => {
2733 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2734 let mut req = fidl::new_empty!(
2735 StreamSourceReleasePacketRequest,
2736 fidl::encoding::DefaultFuchsiaResourceDialect
2737 );
2738 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSourceReleasePacketRequest>(&header, _body_bytes, handles, &mut req)?;
2739 let control_handle =
2740 AudioCapturerControlHandle { inner: this.inner.clone() };
2741 Ok(AudioCapturerRequest::ReleasePacket {
2742 packet: req.packet,
2743
2744 control_handle,
2745 })
2746 }
2747 0x27afd605e97b09d2 => {
2748 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2749 let mut req = fidl::new_empty!(
2750 fidl::encoding::EmptyPayload,
2751 fidl::encoding::DefaultFuchsiaResourceDialect
2752 );
2753 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2754 let control_handle =
2755 AudioCapturerControlHandle { inner: this.inner.clone() };
2756 Ok(AudioCapturerRequest::DiscardAllPackets {
2757 responder: AudioCapturerDiscardAllPacketsResponder {
2758 control_handle: std::mem::ManuallyDrop::new(control_handle),
2759 tx_id: header.tx_id,
2760 },
2761 })
2762 }
2763 0x35f9d721e905b831 => {
2764 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2765 let mut req = fidl::new_empty!(
2766 fidl::encoding::EmptyPayload,
2767 fidl::encoding::DefaultFuchsiaResourceDialect
2768 );
2769 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2770 let control_handle =
2771 AudioCapturerControlHandle { inner: this.inner.clone() };
2772 Ok(AudioCapturerRequest::DiscardAllPacketsNoReply { control_handle })
2773 }
2774 0x1531ea9ea2c852cd => {
2775 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2776 let mut req = fidl::new_empty!(
2777 AudioCapturerSetPcmStreamTypeRequest,
2778 fidl::encoding::DefaultFuchsiaResourceDialect
2779 );
2780 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerSetPcmStreamTypeRequest>(&header, _body_bytes, handles, &mut req)?;
2781 let control_handle =
2782 AudioCapturerControlHandle { inner: this.inner.clone() };
2783 Ok(AudioCapturerRequest::SetPcmStreamType {
2784 stream_type: req.stream_type,
2785
2786 control_handle,
2787 })
2788 }
2789 0x784e25df72cea780 => {
2790 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2791 let mut req = fidl::new_empty!(
2792 AudioCapturerCaptureAtRequest,
2793 fidl::encoding::DefaultFuchsiaResourceDialect
2794 );
2795 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerCaptureAtRequest>(&header, _body_bytes, handles, &mut req)?;
2796 let control_handle =
2797 AudioCapturerControlHandle { inner: this.inner.clone() };
2798 Ok(AudioCapturerRequest::CaptureAt {
2799 payload_buffer_id: req.payload_buffer_id,
2800 payload_offset: req.payload_offset,
2801 frames: req.frames,
2802
2803 responder: AudioCapturerCaptureAtResponder {
2804 control_handle: std::mem::ManuallyDrop::new(control_handle),
2805 tx_id: header.tx_id,
2806 },
2807 })
2808 }
2809 0x7768adbb1ccfd7a6 => {
2810 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2811 let mut req = fidl::new_empty!(
2812 AudioCapturerStartAsyncCaptureRequest,
2813 fidl::encoding::DefaultFuchsiaResourceDialect
2814 );
2815 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerStartAsyncCaptureRequest>(&header, _body_bytes, handles, &mut req)?;
2816 let control_handle =
2817 AudioCapturerControlHandle { inner: this.inner.clone() };
2818 Ok(AudioCapturerRequest::StartAsyncCapture {
2819 frames_per_packet: req.frames_per_packet,
2820
2821 control_handle,
2822 })
2823 }
2824 0x5bfc8790a8cef8cb => {
2825 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2826 let mut req = fidl::new_empty!(
2827 fidl::encoding::EmptyPayload,
2828 fidl::encoding::DefaultFuchsiaResourceDialect
2829 );
2830 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2831 let control_handle =
2832 AudioCapturerControlHandle { inner: this.inner.clone() };
2833 Ok(AudioCapturerRequest::StopAsyncCapture {
2834 responder: AudioCapturerStopAsyncCaptureResponder {
2835 control_handle: std::mem::ManuallyDrop::new(control_handle),
2836 tx_id: header.tx_id,
2837 },
2838 })
2839 }
2840 0x33223cb2962c95e3 => {
2841 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2842 let mut req = fidl::new_empty!(
2843 fidl::encoding::EmptyPayload,
2844 fidl::encoding::DefaultFuchsiaResourceDialect
2845 );
2846 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2847 let control_handle =
2848 AudioCapturerControlHandle { inner: this.inner.clone() };
2849 Ok(AudioCapturerRequest::StopAsyncCaptureNoReply { control_handle })
2850 }
2851 0x658a6a17ddb3a8e0 => {
2852 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2853 let mut req = fidl::new_empty!(
2854 AudioCapturerBindGainControlRequest,
2855 fidl::encoding::DefaultFuchsiaResourceDialect
2856 );
2857 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerBindGainControlRequest>(&header, _body_bytes, handles, &mut req)?;
2858 let control_handle =
2859 AudioCapturerControlHandle { inner: this.inner.clone() };
2860 Ok(AudioCapturerRequest::BindGainControl {
2861 gain_control_request: req.gain_control_request,
2862
2863 control_handle,
2864 })
2865 }
2866 0x50d037aa5a4b4d71 => {
2867 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2868 let mut req = fidl::new_empty!(
2869 fidl::encoding::EmptyPayload,
2870 fidl::encoding::DefaultFuchsiaResourceDialect
2871 );
2872 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2873 let control_handle =
2874 AudioCapturerControlHandle { inner: this.inner.clone() };
2875 Ok(AudioCapturerRequest::GetReferenceClock {
2876 responder: AudioCapturerGetReferenceClockResponder {
2877 control_handle: std::mem::ManuallyDrop::new(control_handle),
2878 tx_id: header.tx_id,
2879 },
2880 })
2881 }
2882 0x732b2c496d521bcf => {
2883 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2884 let mut req = fidl::new_empty!(
2885 AudioCapturerSetReferenceClockRequest,
2886 fidl::encoding::DefaultFuchsiaResourceDialect
2887 );
2888 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerSetReferenceClockRequest>(&header, _body_bytes, handles, &mut req)?;
2889 let control_handle =
2890 AudioCapturerControlHandle { inner: this.inner.clone() };
2891 Ok(AudioCapturerRequest::SetReferenceClock {
2892 reference_clock: req.reference_clock,
2893
2894 control_handle,
2895 })
2896 }
2897 0x42a16f392bd21b25 => {
2898 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2899 let mut req = fidl::new_empty!(
2900 AudioCapturerSetUsageRequest,
2901 fidl::encoding::DefaultFuchsiaResourceDialect
2902 );
2903 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerSetUsageRequest>(&header, _body_bytes, handles, &mut req)?;
2904 let control_handle =
2905 AudioCapturerControlHandle { inner: this.inner.clone() };
2906 Ok(AudioCapturerRequest::SetUsage { usage: req.usage, control_handle })
2907 }
2908 0x7a73e251b8d2382b => {
2909 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2910 let mut req = fidl::new_empty!(
2911 AudioCapturerSetUsage2Request,
2912 fidl::encoding::DefaultFuchsiaResourceDialect
2913 );
2914 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCapturerSetUsage2Request>(&header, _body_bytes, handles, &mut req)?;
2915 let control_handle =
2916 AudioCapturerControlHandle { inner: this.inner.clone() };
2917 Ok(AudioCapturerRequest::SetUsage2 { usage: req.usage, control_handle })
2918 }
2919 0x5dcaaa670b433088 => {
2920 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2921 let mut req = fidl::new_empty!(
2922 fidl::encoding::EmptyPayload,
2923 fidl::encoding::DefaultFuchsiaResourceDialect
2924 );
2925 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2926 let control_handle =
2927 AudioCapturerControlHandle { inner: this.inner.clone() };
2928 Ok(AudioCapturerRequest::GetStreamType {
2929 responder: AudioCapturerGetStreamTypeResponder {
2930 control_handle: std::mem::ManuallyDrop::new(control_handle),
2931 tx_id: header.tx_id,
2932 },
2933 })
2934 }
2935 _ if header.tx_id == 0
2936 && header
2937 .dynamic_flags()
2938 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2939 {
2940 Ok(AudioCapturerRequest::_UnknownMethod {
2941 ordinal: header.ordinal,
2942 control_handle: AudioCapturerControlHandle {
2943 inner: this.inner.clone(),
2944 },
2945 method_type: fidl::MethodType::OneWay,
2946 })
2947 }
2948 _ if header
2949 .dynamic_flags()
2950 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2951 {
2952 this.inner.send_framework_err(
2953 fidl::encoding::FrameworkErr::UnknownMethod,
2954 header.tx_id,
2955 header.ordinal,
2956 header.dynamic_flags(),
2957 (bytes, handles),
2958 )?;
2959 Ok(AudioCapturerRequest::_UnknownMethod {
2960 ordinal: header.ordinal,
2961 control_handle: AudioCapturerControlHandle {
2962 inner: this.inner.clone(),
2963 },
2964 method_type: fidl::MethodType::TwoWay,
2965 })
2966 }
2967 _ => Err(fidl::Error::UnknownOrdinal {
2968 ordinal: header.ordinal,
2969 protocol_name:
2970 <AudioCapturerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2971 }),
2972 }))
2973 },
2974 )
2975 }
2976}
2977
2978#[derive(Debug)]
3188pub enum AudioCapturerRequest {
3189 AddPayloadBuffer {
3196 id: u32,
3197 payload_buffer: fidl::Vmo,
3198 control_handle: AudioCapturerControlHandle,
3199 },
3200 RemovePayloadBuffer {
3206 id: u32,
3207 control_handle: AudioCapturerControlHandle,
3208 },
3209 ReleasePacket {
3212 packet: StreamPacket,
3213 control_handle: AudioCapturerControlHandle,
3214 },
3215 DiscardAllPackets {
3216 responder: AudioCapturerDiscardAllPacketsResponder,
3217 },
3218 DiscardAllPacketsNoReply {
3219 control_handle: AudioCapturerControlHandle,
3220 },
3221 SetPcmStreamType {
3226 stream_type: AudioStreamType,
3227 control_handle: AudioCapturerControlHandle,
3228 },
3229 CaptureAt {
3232 payload_buffer_id: u32,
3233 payload_offset: u32,
3234 frames: u32,
3235 responder: AudioCapturerCaptureAtResponder,
3236 },
3237 StartAsyncCapture {
3242 frames_per_packet: u32,
3243 control_handle: AudioCapturerControlHandle,
3244 },
3245 StopAsyncCapture {
3248 responder: AudioCapturerStopAsyncCaptureResponder,
3249 },
3250 StopAsyncCaptureNoReply {
3251 control_handle: AudioCapturerControlHandle,
3252 },
3253 BindGainControl {
3255 gain_control_request:
3256 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
3257 control_handle: AudioCapturerControlHandle,
3258 },
3259 GetReferenceClock {
3262 responder: AudioCapturerGetReferenceClockResponder,
3263 },
3264 SetReferenceClock {
3276 reference_clock: Option<fidl::Clock>,
3277 control_handle: AudioCapturerControlHandle,
3278 },
3279 SetUsage {
3282 usage: AudioCaptureUsage,
3283 control_handle: AudioCapturerControlHandle,
3284 },
3285 SetUsage2 {
3288 usage: AudioCaptureUsage2,
3289 control_handle: AudioCapturerControlHandle,
3290 },
3291 GetStreamType {
3298 responder: AudioCapturerGetStreamTypeResponder,
3299 },
3300 #[non_exhaustive]
3302 _UnknownMethod {
3303 ordinal: u64,
3305 control_handle: AudioCapturerControlHandle,
3306 method_type: fidl::MethodType,
3307 },
3308}
3309
3310impl AudioCapturerRequest {
3311 #[allow(irrefutable_let_patterns)]
3312 pub fn into_add_payload_buffer(self) -> Option<(u32, fidl::Vmo, AudioCapturerControlHandle)> {
3313 if let AudioCapturerRequest::AddPayloadBuffer { id, payload_buffer, control_handle } = self
3314 {
3315 Some((id, payload_buffer, control_handle))
3316 } else {
3317 None
3318 }
3319 }
3320
3321 #[allow(irrefutable_let_patterns)]
3322 pub fn into_remove_payload_buffer(self) -> Option<(u32, AudioCapturerControlHandle)> {
3323 if let AudioCapturerRequest::RemovePayloadBuffer { id, control_handle } = self {
3324 Some((id, control_handle))
3325 } else {
3326 None
3327 }
3328 }
3329
3330 #[allow(irrefutable_let_patterns)]
3331 pub fn into_release_packet(self) -> Option<(StreamPacket, AudioCapturerControlHandle)> {
3332 if let AudioCapturerRequest::ReleasePacket { packet, control_handle } = self {
3333 Some((packet, control_handle))
3334 } else {
3335 None
3336 }
3337 }
3338
3339 #[allow(irrefutable_let_patterns)]
3340 pub fn into_discard_all_packets(self) -> Option<(AudioCapturerDiscardAllPacketsResponder)> {
3341 if let AudioCapturerRequest::DiscardAllPackets { responder } = self {
3342 Some((responder))
3343 } else {
3344 None
3345 }
3346 }
3347
3348 #[allow(irrefutable_let_patterns)]
3349 pub fn into_discard_all_packets_no_reply(self) -> Option<(AudioCapturerControlHandle)> {
3350 if let AudioCapturerRequest::DiscardAllPacketsNoReply { control_handle } = self {
3351 Some((control_handle))
3352 } else {
3353 None
3354 }
3355 }
3356
3357 #[allow(irrefutable_let_patterns)]
3358 pub fn into_set_pcm_stream_type(self) -> Option<(AudioStreamType, AudioCapturerControlHandle)> {
3359 if let AudioCapturerRequest::SetPcmStreamType { stream_type, control_handle } = self {
3360 Some((stream_type, control_handle))
3361 } else {
3362 None
3363 }
3364 }
3365
3366 #[allow(irrefutable_let_patterns)]
3367 pub fn into_capture_at(self) -> Option<(u32, u32, u32, AudioCapturerCaptureAtResponder)> {
3368 if let AudioCapturerRequest::CaptureAt {
3369 payload_buffer_id,
3370 payload_offset,
3371 frames,
3372 responder,
3373 } = self
3374 {
3375 Some((payload_buffer_id, payload_offset, frames, responder))
3376 } else {
3377 None
3378 }
3379 }
3380
3381 #[allow(irrefutable_let_patterns)]
3382 pub fn into_start_async_capture(self) -> Option<(u32, AudioCapturerControlHandle)> {
3383 if let AudioCapturerRequest::StartAsyncCapture { frames_per_packet, control_handle } = self
3384 {
3385 Some((frames_per_packet, control_handle))
3386 } else {
3387 None
3388 }
3389 }
3390
3391 #[allow(irrefutable_let_patterns)]
3392 pub fn into_stop_async_capture(self) -> Option<(AudioCapturerStopAsyncCaptureResponder)> {
3393 if let AudioCapturerRequest::StopAsyncCapture { responder } = self {
3394 Some((responder))
3395 } else {
3396 None
3397 }
3398 }
3399
3400 #[allow(irrefutable_let_patterns)]
3401 pub fn into_stop_async_capture_no_reply(self) -> Option<(AudioCapturerControlHandle)> {
3402 if let AudioCapturerRequest::StopAsyncCaptureNoReply { control_handle } = self {
3403 Some((control_handle))
3404 } else {
3405 None
3406 }
3407 }
3408
3409 #[allow(irrefutable_let_patterns)]
3410 pub fn into_bind_gain_control(
3411 self,
3412 ) -> Option<(
3413 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
3414 AudioCapturerControlHandle,
3415 )> {
3416 if let AudioCapturerRequest::BindGainControl { gain_control_request, control_handle } = self
3417 {
3418 Some((gain_control_request, control_handle))
3419 } else {
3420 None
3421 }
3422 }
3423
3424 #[allow(irrefutable_let_patterns)]
3425 pub fn into_get_reference_clock(self) -> Option<(AudioCapturerGetReferenceClockResponder)> {
3426 if let AudioCapturerRequest::GetReferenceClock { responder } = self {
3427 Some((responder))
3428 } else {
3429 None
3430 }
3431 }
3432
3433 #[allow(irrefutable_let_patterns)]
3434 pub fn into_set_reference_clock(
3435 self,
3436 ) -> Option<(Option<fidl::Clock>, AudioCapturerControlHandle)> {
3437 if let AudioCapturerRequest::SetReferenceClock { reference_clock, control_handle } = self {
3438 Some((reference_clock, control_handle))
3439 } else {
3440 None
3441 }
3442 }
3443
3444 #[allow(irrefutable_let_patterns)]
3445 pub fn into_set_usage(self) -> Option<(AudioCaptureUsage, AudioCapturerControlHandle)> {
3446 if let AudioCapturerRequest::SetUsage { usage, control_handle } = self {
3447 Some((usage, control_handle))
3448 } else {
3449 None
3450 }
3451 }
3452
3453 #[allow(irrefutable_let_patterns)]
3454 pub fn into_set_usage2(self) -> Option<(AudioCaptureUsage2, AudioCapturerControlHandle)> {
3455 if let AudioCapturerRequest::SetUsage2 { usage, control_handle } = self {
3456 Some((usage, control_handle))
3457 } else {
3458 None
3459 }
3460 }
3461
3462 #[allow(irrefutable_let_patterns)]
3463 pub fn into_get_stream_type(self) -> Option<(AudioCapturerGetStreamTypeResponder)> {
3464 if let AudioCapturerRequest::GetStreamType { responder } = self {
3465 Some((responder))
3466 } else {
3467 None
3468 }
3469 }
3470
3471 pub fn method_name(&self) -> &'static str {
3473 match *self {
3474 AudioCapturerRequest::AddPayloadBuffer { .. } => "add_payload_buffer",
3475 AudioCapturerRequest::RemovePayloadBuffer { .. } => "remove_payload_buffer",
3476 AudioCapturerRequest::ReleasePacket { .. } => "release_packet",
3477 AudioCapturerRequest::DiscardAllPackets { .. } => "discard_all_packets",
3478 AudioCapturerRequest::DiscardAllPacketsNoReply { .. } => "discard_all_packets_no_reply",
3479 AudioCapturerRequest::SetPcmStreamType { .. } => "set_pcm_stream_type",
3480 AudioCapturerRequest::CaptureAt { .. } => "capture_at",
3481 AudioCapturerRequest::StartAsyncCapture { .. } => "start_async_capture",
3482 AudioCapturerRequest::StopAsyncCapture { .. } => "stop_async_capture",
3483 AudioCapturerRequest::StopAsyncCaptureNoReply { .. } => "stop_async_capture_no_reply",
3484 AudioCapturerRequest::BindGainControl { .. } => "bind_gain_control",
3485 AudioCapturerRequest::GetReferenceClock { .. } => "get_reference_clock",
3486 AudioCapturerRequest::SetReferenceClock { .. } => "set_reference_clock",
3487 AudioCapturerRequest::SetUsage { .. } => "set_usage",
3488 AudioCapturerRequest::SetUsage2 { .. } => "set_usage2",
3489 AudioCapturerRequest::GetStreamType { .. } => "get_stream_type",
3490 AudioCapturerRequest::_UnknownMethod {
3491 method_type: fidl::MethodType::OneWay, ..
3492 } => "unknown one-way method",
3493 AudioCapturerRequest::_UnknownMethod {
3494 method_type: fidl::MethodType::TwoWay, ..
3495 } => "unknown two-way method",
3496 }
3497 }
3498}
3499
3500#[derive(Debug, Clone)]
3501pub struct AudioCapturerControlHandle {
3502 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3503}
3504
3505impl fidl::endpoints::ControlHandle for AudioCapturerControlHandle {
3506 fn shutdown(&self) {
3507 self.inner.shutdown()
3508 }
3509 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3510 self.inner.shutdown_with_epitaph(status)
3511 }
3512
3513 fn is_closed(&self) -> bool {
3514 self.inner.channel().is_closed()
3515 }
3516 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3517 self.inner.channel().on_closed()
3518 }
3519
3520 #[cfg(target_os = "fuchsia")]
3521 fn signal_peer(
3522 &self,
3523 clear_mask: zx::Signals,
3524 set_mask: zx::Signals,
3525 ) -> Result<(), zx_status::Status> {
3526 use fidl::Peered;
3527 self.inner.channel().signal_peer(clear_mask, set_mask)
3528 }
3529}
3530
3531impl AudioCapturerControlHandle {
3532 pub fn send_on_packet_produced(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
3533 self.inner.send::<StreamSourceOnPacketProducedRequest>(
3534 (packet,),
3535 0,
3536 0x6bbe69746a3c8bd9,
3537 fidl::encoding::DynamicFlags::empty(),
3538 )
3539 }
3540
3541 pub fn send_on_end_of_stream(&self) -> Result<(), fidl::Error> {
3542 self.inner.send::<fidl::encoding::EmptyPayload>(
3543 (),
3544 0,
3545 0x550e69b41d03e2c2,
3546 fidl::encoding::DynamicFlags::empty(),
3547 )
3548 }
3549}
3550
3551#[must_use = "FIDL methods require a response to be sent"]
3552#[derive(Debug)]
3553pub struct AudioCapturerDiscardAllPacketsResponder {
3554 control_handle: std::mem::ManuallyDrop<AudioCapturerControlHandle>,
3555 tx_id: u32,
3556}
3557
3558impl std::ops::Drop for AudioCapturerDiscardAllPacketsResponder {
3562 fn drop(&mut self) {
3563 self.control_handle.shutdown();
3564 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3566 }
3567}
3568
3569impl fidl::endpoints::Responder for AudioCapturerDiscardAllPacketsResponder {
3570 type ControlHandle = AudioCapturerControlHandle;
3571
3572 fn control_handle(&self) -> &AudioCapturerControlHandle {
3573 &self.control_handle
3574 }
3575
3576 fn drop_without_shutdown(mut self) {
3577 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3579 std::mem::forget(self);
3581 }
3582}
3583
3584impl AudioCapturerDiscardAllPacketsResponder {
3585 pub fn send(self) -> Result<(), fidl::Error> {
3589 let _result = self.send_raw();
3590 if _result.is_err() {
3591 self.control_handle.shutdown();
3592 }
3593 self.drop_without_shutdown();
3594 _result
3595 }
3596
3597 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3599 let _result = self.send_raw();
3600 self.drop_without_shutdown();
3601 _result
3602 }
3603
3604 fn send_raw(&self) -> Result<(), fidl::Error> {
3605 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3606 (),
3607 self.tx_id,
3608 0x27afd605e97b09d2,
3609 fidl::encoding::DynamicFlags::empty(),
3610 )
3611 }
3612}
3613
3614#[must_use = "FIDL methods require a response to be sent"]
3615#[derive(Debug)]
3616pub struct AudioCapturerCaptureAtResponder {
3617 control_handle: std::mem::ManuallyDrop<AudioCapturerControlHandle>,
3618 tx_id: u32,
3619}
3620
3621impl std::ops::Drop for AudioCapturerCaptureAtResponder {
3625 fn drop(&mut self) {
3626 self.control_handle.shutdown();
3627 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3629 }
3630}
3631
3632impl fidl::endpoints::Responder for AudioCapturerCaptureAtResponder {
3633 type ControlHandle = AudioCapturerControlHandle;
3634
3635 fn control_handle(&self) -> &AudioCapturerControlHandle {
3636 &self.control_handle
3637 }
3638
3639 fn drop_without_shutdown(mut self) {
3640 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3642 std::mem::forget(self);
3644 }
3645}
3646
3647impl AudioCapturerCaptureAtResponder {
3648 pub fn send(self, mut captured_packet: &StreamPacket) -> Result<(), fidl::Error> {
3652 let _result = self.send_raw(captured_packet);
3653 if _result.is_err() {
3654 self.control_handle.shutdown();
3655 }
3656 self.drop_without_shutdown();
3657 _result
3658 }
3659
3660 pub fn send_no_shutdown_on_err(
3662 self,
3663 mut captured_packet: &StreamPacket,
3664 ) -> Result<(), fidl::Error> {
3665 let _result = self.send_raw(captured_packet);
3666 self.drop_without_shutdown();
3667 _result
3668 }
3669
3670 fn send_raw(&self, mut captured_packet: &StreamPacket) -> Result<(), fidl::Error> {
3671 self.control_handle.inner.send::<AudioCapturerCaptureAtResponse>(
3672 (captured_packet,),
3673 self.tx_id,
3674 0x784e25df72cea780,
3675 fidl::encoding::DynamicFlags::empty(),
3676 )
3677 }
3678}
3679
3680#[must_use = "FIDL methods require a response to be sent"]
3681#[derive(Debug)]
3682pub struct AudioCapturerStopAsyncCaptureResponder {
3683 control_handle: std::mem::ManuallyDrop<AudioCapturerControlHandle>,
3684 tx_id: u32,
3685}
3686
3687impl std::ops::Drop for AudioCapturerStopAsyncCaptureResponder {
3691 fn drop(&mut self) {
3692 self.control_handle.shutdown();
3693 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3695 }
3696}
3697
3698impl fidl::endpoints::Responder for AudioCapturerStopAsyncCaptureResponder {
3699 type ControlHandle = AudioCapturerControlHandle;
3700
3701 fn control_handle(&self) -> &AudioCapturerControlHandle {
3702 &self.control_handle
3703 }
3704
3705 fn drop_without_shutdown(mut self) {
3706 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3708 std::mem::forget(self);
3710 }
3711}
3712
3713impl AudioCapturerStopAsyncCaptureResponder {
3714 pub fn send(self) -> Result<(), fidl::Error> {
3718 let _result = self.send_raw();
3719 if _result.is_err() {
3720 self.control_handle.shutdown();
3721 }
3722 self.drop_without_shutdown();
3723 _result
3724 }
3725
3726 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3728 let _result = self.send_raw();
3729 self.drop_without_shutdown();
3730 _result
3731 }
3732
3733 fn send_raw(&self) -> Result<(), fidl::Error> {
3734 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3735 (),
3736 self.tx_id,
3737 0x5bfc8790a8cef8cb,
3738 fidl::encoding::DynamicFlags::empty(),
3739 )
3740 }
3741}
3742
3743#[must_use = "FIDL methods require a response to be sent"]
3744#[derive(Debug)]
3745pub struct AudioCapturerGetReferenceClockResponder {
3746 control_handle: std::mem::ManuallyDrop<AudioCapturerControlHandle>,
3747 tx_id: u32,
3748}
3749
3750impl std::ops::Drop for AudioCapturerGetReferenceClockResponder {
3754 fn drop(&mut self) {
3755 self.control_handle.shutdown();
3756 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3758 }
3759}
3760
3761impl fidl::endpoints::Responder for AudioCapturerGetReferenceClockResponder {
3762 type ControlHandle = AudioCapturerControlHandle;
3763
3764 fn control_handle(&self) -> &AudioCapturerControlHandle {
3765 &self.control_handle
3766 }
3767
3768 fn drop_without_shutdown(mut self) {
3769 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3771 std::mem::forget(self);
3773 }
3774}
3775
3776impl AudioCapturerGetReferenceClockResponder {
3777 pub fn send(self, mut reference_clock: fidl::Clock) -> Result<(), fidl::Error> {
3781 let _result = self.send_raw(reference_clock);
3782 if _result.is_err() {
3783 self.control_handle.shutdown();
3784 }
3785 self.drop_without_shutdown();
3786 _result
3787 }
3788
3789 pub fn send_no_shutdown_on_err(
3791 self,
3792 mut reference_clock: fidl::Clock,
3793 ) -> Result<(), fidl::Error> {
3794 let _result = self.send_raw(reference_clock);
3795 self.drop_without_shutdown();
3796 _result
3797 }
3798
3799 fn send_raw(&self, mut reference_clock: fidl::Clock) -> Result<(), fidl::Error> {
3800 self.control_handle.inner.send::<AudioCapturerGetReferenceClockResponse>(
3801 (reference_clock,),
3802 self.tx_id,
3803 0x50d037aa5a4b4d71,
3804 fidl::encoding::DynamicFlags::empty(),
3805 )
3806 }
3807}
3808
3809#[must_use = "FIDL methods require a response to be sent"]
3810#[derive(Debug)]
3811pub struct AudioCapturerGetStreamTypeResponder {
3812 control_handle: std::mem::ManuallyDrop<AudioCapturerControlHandle>,
3813 tx_id: u32,
3814}
3815
3816impl std::ops::Drop for AudioCapturerGetStreamTypeResponder {
3820 fn drop(&mut self) {
3821 self.control_handle.shutdown();
3822 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3824 }
3825}
3826
3827impl fidl::endpoints::Responder for AudioCapturerGetStreamTypeResponder {
3828 type ControlHandle = AudioCapturerControlHandle;
3829
3830 fn control_handle(&self) -> &AudioCapturerControlHandle {
3831 &self.control_handle
3832 }
3833
3834 fn drop_without_shutdown(mut self) {
3835 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3837 std::mem::forget(self);
3839 }
3840}
3841
3842impl AudioCapturerGetStreamTypeResponder {
3843 pub fn send(self, mut stream_type: &StreamType) -> Result<(), fidl::Error> {
3847 let _result = self.send_raw(stream_type);
3848 if _result.is_err() {
3849 self.control_handle.shutdown();
3850 }
3851 self.drop_without_shutdown();
3852 _result
3853 }
3854
3855 pub fn send_no_shutdown_on_err(self, mut stream_type: &StreamType) -> Result<(), fidl::Error> {
3857 let _result = self.send_raw(stream_type);
3858 self.drop_without_shutdown();
3859 _result
3860 }
3861
3862 fn send_raw(&self, mut stream_type: &StreamType) -> Result<(), fidl::Error> {
3863 self.control_handle.inner.send::<AudioCapturerGetStreamTypeResponse>(
3864 (stream_type,),
3865 self.tx_id,
3866 0x5dcaaa670b433088,
3867 fidl::encoding::DynamicFlags::empty(),
3868 )
3869 }
3870}
3871
3872#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3873pub struct AudioConsumerMarker;
3874
3875impl fidl::endpoints::ProtocolMarker for AudioConsumerMarker {
3876 type Proxy = AudioConsumerProxy;
3877 type RequestStream = AudioConsumerRequestStream;
3878 #[cfg(target_os = "fuchsia")]
3879 type SynchronousProxy = AudioConsumerSynchronousProxy;
3880
3881 const DEBUG_NAME: &'static str = "(anonymous) AudioConsumer";
3882}
3883
3884pub trait AudioConsumerProxyInterface: Send + Sync {
3885 fn r#create_stream_sink(
3886 &self,
3887 buffers: Vec<fidl::Vmo>,
3888 stream_type: &AudioStreamType,
3889 compression: Option<&Compression>,
3890 stream_sink_request: fidl::endpoints::ServerEnd<StreamSinkMarker>,
3891 ) -> Result<(), fidl::Error>;
3892 fn r#start(
3893 &self,
3894 flags: AudioConsumerStartFlags,
3895 reference_time: i64,
3896 media_time: i64,
3897 ) -> Result<(), fidl::Error>;
3898 fn r#stop(&self) -> Result<(), fidl::Error>;
3899 fn r#set_rate(&self, rate: f32) -> Result<(), fidl::Error>;
3900 fn r#bind_volume_control(
3901 &self,
3902 volume_control_request: fidl::endpoints::ServerEnd<
3903 fidl_fuchsia_media_audio::VolumeControlMarker,
3904 >,
3905 ) -> Result<(), fidl::Error>;
3906 type WatchStatusResponseFut: std::future::Future<Output = Result<AudioConsumerStatus, fidl::Error>>
3907 + Send;
3908 fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
3909}
3910#[derive(Debug)]
3911#[cfg(target_os = "fuchsia")]
3912pub struct AudioConsumerSynchronousProxy {
3913 client: fidl::client::sync::Client,
3914}
3915
3916#[cfg(target_os = "fuchsia")]
3917impl fidl::endpoints::SynchronousProxy for AudioConsumerSynchronousProxy {
3918 type Proxy = AudioConsumerProxy;
3919 type Protocol = AudioConsumerMarker;
3920
3921 fn from_channel(inner: fidl::Channel) -> Self {
3922 Self::new(inner)
3923 }
3924
3925 fn into_channel(self) -> fidl::Channel {
3926 self.client.into_channel()
3927 }
3928
3929 fn as_channel(&self) -> &fidl::Channel {
3930 self.client.as_channel()
3931 }
3932}
3933
3934#[cfg(target_os = "fuchsia")]
3935impl AudioConsumerSynchronousProxy {
3936 pub fn new(channel: fidl::Channel) -> Self {
3937 let protocol_name = <AudioConsumerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3938 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3939 }
3940
3941 pub fn into_channel(self) -> fidl::Channel {
3942 self.client.into_channel()
3943 }
3944
3945 pub fn wait_for_event(
3948 &self,
3949 deadline: zx::MonotonicInstant,
3950 ) -> Result<AudioConsumerEvent, fidl::Error> {
3951 AudioConsumerEvent::decode(self.client.wait_for_event(deadline)?)
3952 }
3953
3954 pub fn r#create_stream_sink(
3966 &self,
3967 mut buffers: Vec<fidl::Vmo>,
3968 mut stream_type: &AudioStreamType,
3969 mut compression: Option<&Compression>,
3970 mut stream_sink_request: fidl::endpoints::ServerEnd<StreamSinkMarker>,
3971 ) -> Result<(), fidl::Error> {
3972 self.client.send::<AudioConsumerCreateStreamSinkRequest>(
3973 (buffers.as_mut(), stream_type, compression, stream_sink_request),
3974 0x525b3b97fdf7d884,
3975 fidl::encoding::DynamicFlags::empty(),
3976 )
3977 }
3978
3979 pub fn r#start(
4003 &self,
4004 mut flags: AudioConsumerStartFlags,
4005 mut reference_time: i64,
4006 mut media_time: i64,
4007 ) -> Result<(), fidl::Error> {
4008 self.client.send::<AudioConsumerStartRequest>(
4009 (flags, reference_time, media_time),
4010 0x4fdbd44b3f2a3a3c,
4011 fidl::encoding::DynamicFlags::empty(),
4012 )
4013 }
4014
4015 pub fn r#stop(&self) -> Result<(), fidl::Error> {
4018 self.client.send::<fidl::encoding::EmptyPayload>(
4019 (),
4020 0x3d46c3741686c40d,
4021 fidl::encoding::DynamicFlags::empty(),
4022 )
4023 }
4024
4025 pub fn r#set_rate(&self, mut rate: f32) -> Result<(), fidl::Error> {
4029 self.client.send::<AudioConsumerSetRateRequest>(
4030 (rate,),
4031 0x45342b73968bfafe,
4032 fidl::encoding::DynamicFlags::empty(),
4033 )
4034 }
4035
4036 pub fn r#bind_volume_control(
4038 &self,
4039 mut volume_control_request: fidl::endpoints::ServerEnd<
4040 fidl_fuchsia_media_audio::VolumeControlMarker,
4041 >,
4042 ) -> Result<(), fidl::Error> {
4043 self.client.send::<AudioConsumerBindVolumeControlRequest>(
4044 (volume_control_request,),
4045 0x6f1b01fd887f5748,
4046 fidl::encoding::DynamicFlags::empty(),
4047 )
4048 }
4049
4050 pub fn r#watch_status(
4054 &self,
4055 ___deadline: zx::MonotonicInstant,
4056 ) -> Result<AudioConsumerStatus, fidl::Error> {
4057 let _response = self
4058 .client
4059 .send_query::<fidl::encoding::EmptyPayload, AudioConsumerWatchStatusResponse>(
4060 (),
4061 0x35cf702c721e2cc6,
4062 fidl::encoding::DynamicFlags::empty(),
4063 ___deadline,
4064 )?;
4065 Ok(_response.status)
4066 }
4067}
4068
4069#[cfg(target_os = "fuchsia")]
4070impl From<AudioConsumerSynchronousProxy> for zx::Handle {
4071 fn from(value: AudioConsumerSynchronousProxy) -> Self {
4072 value.into_channel().into()
4073 }
4074}
4075
4076#[cfg(target_os = "fuchsia")]
4077impl From<fidl::Channel> for AudioConsumerSynchronousProxy {
4078 fn from(value: fidl::Channel) -> Self {
4079 Self::new(value)
4080 }
4081}
4082
4083#[derive(Debug, Clone)]
4084pub struct AudioConsumerProxy {
4085 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4086}
4087
4088impl fidl::endpoints::Proxy for AudioConsumerProxy {
4089 type Protocol = AudioConsumerMarker;
4090
4091 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4092 Self::new(inner)
4093 }
4094
4095 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4096 self.client.into_channel().map_err(|client| Self { client })
4097 }
4098
4099 fn as_channel(&self) -> &::fidl::AsyncChannel {
4100 self.client.as_channel()
4101 }
4102}
4103
4104impl AudioConsumerProxy {
4105 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4107 let protocol_name = <AudioConsumerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4108 Self { client: fidl::client::Client::new(channel, protocol_name) }
4109 }
4110
4111 pub fn take_event_stream(&self) -> AudioConsumerEventStream {
4117 AudioConsumerEventStream { event_receiver: self.client.take_event_receiver() }
4118 }
4119
4120 pub fn r#create_stream_sink(
4132 &self,
4133 mut buffers: Vec<fidl::Vmo>,
4134 mut stream_type: &AudioStreamType,
4135 mut compression: Option<&Compression>,
4136 mut stream_sink_request: fidl::endpoints::ServerEnd<StreamSinkMarker>,
4137 ) -> Result<(), fidl::Error> {
4138 AudioConsumerProxyInterface::r#create_stream_sink(
4139 self,
4140 buffers,
4141 stream_type,
4142 compression,
4143 stream_sink_request,
4144 )
4145 }
4146
4147 pub fn r#start(
4171 &self,
4172 mut flags: AudioConsumerStartFlags,
4173 mut reference_time: i64,
4174 mut media_time: i64,
4175 ) -> Result<(), fidl::Error> {
4176 AudioConsumerProxyInterface::r#start(self, flags, reference_time, media_time)
4177 }
4178
4179 pub fn r#stop(&self) -> Result<(), fidl::Error> {
4182 AudioConsumerProxyInterface::r#stop(self)
4183 }
4184
4185 pub fn r#set_rate(&self, mut rate: f32) -> Result<(), fidl::Error> {
4189 AudioConsumerProxyInterface::r#set_rate(self, rate)
4190 }
4191
4192 pub fn r#bind_volume_control(
4194 &self,
4195 mut volume_control_request: fidl::endpoints::ServerEnd<
4196 fidl_fuchsia_media_audio::VolumeControlMarker,
4197 >,
4198 ) -> Result<(), fidl::Error> {
4199 AudioConsumerProxyInterface::r#bind_volume_control(self, volume_control_request)
4200 }
4201
4202 pub fn r#watch_status(
4206 &self,
4207 ) -> fidl::client::QueryResponseFut<
4208 AudioConsumerStatus,
4209 fidl::encoding::DefaultFuchsiaResourceDialect,
4210 > {
4211 AudioConsumerProxyInterface::r#watch_status(self)
4212 }
4213}
4214
4215impl AudioConsumerProxyInterface for AudioConsumerProxy {
4216 fn r#create_stream_sink(
4217 &self,
4218 mut buffers: Vec<fidl::Vmo>,
4219 mut stream_type: &AudioStreamType,
4220 mut compression: Option<&Compression>,
4221 mut stream_sink_request: fidl::endpoints::ServerEnd<StreamSinkMarker>,
4222 ) -> Result<(), fidl::Error> {
4223 self.client.send::<AudioConsumerCreateStreamSinkRequest>(
4224 (buffers.as_mut(), stream_type, compression, stream_sink_request),
4225 0x525b3b97fdf7d884,
4226 fidl::encoding::DynamicFlags::empty(),
4227 )
4228 }
4229
4230 fn r#start(
4231 &self,
4232 mut flags: AudioConsumerStartFlags,
4233 mut reference_time: i64,
4234 mut media_time: i64,
4235 ) -> Result<(), fidl::Error> {
4236 self.client.send::<AudioConsumerStartRequest>(
4237 (flags, reference_time, media_time),
4238 0x4fdbd44b3f2a3a3c,
4239 fidl::encoding::DynamicFlags::empty(),
4240 )
4241 }
4242
4243 fn r#stop(&self) -> Result<(), fidl::Error> {
4244 self.client.send::<fidl::encoding::EmptyPayload>(
4245 (),
4246 0x3d46c3741686c40d,
4247 fidl::encoding::DynamicFlags::empty(),
4248 )
4249 }
4250
4251 fn r#set_rate(&self, mut rate: f32) -> Result<(), fidl::Error> {
4252 self.client.send::<AudioConsumerSetRateRequest>(
4253 (rate,),
4254 0x45342b73968bfafe,
4255 fidl::encoding::DynamicFlags::empty(),
4256 )
4257 }
4258
4259 fn r#bind_volume_control(
4260 &self,
4261 mut volume_control_request: fidl::endpoints::ServerEnd<
4262 fidl_fuchsia_media_audio::VolumeControlMarker,
4263 >,
4264 ) -> Result<(), fidl::Error> {
4265 self.client.send::<AudioConsumerBindVolumeControlRequest>(
4266 (volume_control_request,),
4267 0x6f1b01fd887f5748,
4268 fidl::encoding::DynamicFlags::empty(),
4269 )
4270 }
4271
4272 type WatchStatusResponseFut = fidl::client::QueryResponseFut<
4273 AudioConsumerStatus,
4274 fidl::encoding::DefaultFuchsiaResourceDialect,
4275 >;
4276 fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
4277 fn _decode(
4278 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4279 ) -> Result<AudioConsumerStatus, fidl::Error> {
4280 let _response = fidl::client::decode_transaction_body::<
4281 AudioConsumerWatchStatusResponse,
4282 fidl::encoding::DefaultFuchsiaResourceDialect,
4283 0x35cf702c721e2cc6,
4284 >(_buf?)?;
4285 Ok(_response.status)
4286 }
4287 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AudioConsumerStatus>(
4288 (),
4289 0x35cf702c721e2cc6,
4290 fidl::encoding::DynamicFlags::empty(),
4291 _decode,
4292 )
4293 }
4294}
4295
4296pub struct AudioConsumerEventStream {
4297 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4298}
4299
4300impl std::marker::Unpin for AudioConsumerEventStream {}
4301
4302impl futures::stream::FusedStream for AudioConsumerEventStream {
4303 fn is_terminated(&self) -> bool {
4304 self.event_receiver.is_terminated()
4305 }
4306}
4307
4308impl futures::Stream for AudioConsumerEventStream {
4309 type Item = Result<AudioConsumerEvent, fidl::Error>;
4310
4311 fn poll_next(
4312 mut self: std::pin::Pin<&mut Self>,
4313 cx: &mut std::task::Context<'_>,
4314 ) -> std::task::Poll<Option<Self::Item>> {
4315 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4316 &mut self.event_receiver,
4317 cx
4318 )?) {
4319 Some(buf) => std::task::Poll::Ready(Some(AudioConsumerEvent::decode(buf))),
4320 None => std::task::Poll::Ready(None),
4321 }
4322 }
4323}
4324
4325#[derive(Debug)]
4326pub enum AudioConsumerEvent {
4327 OnEndOfStream {},
4328}
4329
4330impl AudioConsumerEvent {
4331 #[allow(irrefutable_let_patterns)]
4332 pub fn into_on_end_of_stream(self) -> Option<()> {
4333 if let AudioConsumerEvent::OnEndOfStream {} = self {
4334 Some(())
4335 } else {
4336 None
4337 }
4338 }
4339
4340 fn decode(
4342 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4343 ) -> Result<AudioConsumerEvent, fidl::Error> {
4344 let (bytes, _handles) = buf.split_mut();
4345 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4346 debug_assert_eq!(tx_header.tx_id, 0);
4347 match tx_header.ordinal {
4348 0x53a64e6d0e8f8a20 => {
4349 let mut out = fidl::new_empty!(
4350 fidl::encoding::EmptyPayload,
4351 fidl::encoding::DefaultFuchsiaResourceDialect
4352 );
4353 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
4354 Ok((AudioConsumerEvent::OnEndOfStream {}))
4355 }
4356 _ => Err(fidl::Error::UnknownOrdinal {
4357 ordinal: tx_header.ordinal,
4358 protocol_name: <AudioConsumerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4359 }),
4360 }
4361 }
4362}
4363
4364pub struct AudioConsumerRequestStream {
4366 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4367 is_terminated: bool,
4368}
4369
4370impl std::marker::Unpin for AudioConsumerRequestStream {}
4371
4372impl futures::stream::FusedStream for AudioConsumerRequestStream {
4373 fn is_terminated(&self) -> bool {
4374 self.is_terminated
4375 }
4376}
4377
4378impl fidl::endpoints::RequestStream for AudioConsumerRequestStream {
4379 type Protocol = AudioConsumerMarker;
4380 type ControlHandle = AudioConsumerControlHandle;
4381
4382 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4383 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4384 }
4385
4386 fn control_handle(&self) -> Self::ControlHandle {
4387 AudioConsumerControlHandle { inner: self.inner.clone() }
4388 }
4389
4390 fn into_inner(
4391 self,
4392 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4393 {
4394 (self.inner, self.is_terminated)
4395 }
4396
4397 fn from_inner(
4398 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4399 is_terminated: bool,
4400 ) -> Self {
4401 Self { inner, is_terminated }
4402 }
4403}
4404
4405impl futures::Stream for AudioConsumerRequestStream {
4406 type Item = Result<AudioConsumerRequest, fidl::Error>;
4407
4408 fn poll_next(
4409 mut self: std::pin::Pin<&mut Self>,
4410 cx: &mut std::task::Context<'_>,
4411 ) -> std::task::Poll<Option<Self::Item>> {
4412 let this = &mut *self;
4413 if this.inner.check_shutdown(cx) {
4414 this.is_terminated = true;
4415 return std::task::Poll::Ready(None);
4416 }
4417 if this.is_terminated {
4418 panic!("polled AudioConsumerRequestStream after completion");
4419 }
4420 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4421 |bytes, handles| {
4422 match this.inner.channel().read_etc(cx, bytes, handles) {
4423 std::task::Poll::Ready(Ok(())) => {}
4424 std::task::Poll::Pending => return std::task::Poll::Pending,
4425 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4426 this.is_terminated = true;
4427 return std::task::Poll::Ready(None);
4428 }
4429 std::task::Poll::Ready(Err(e)) => {
4430 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4431 e.into(),
4432 ))))
4433 }
4434 }
4435
4436 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4438
4439 std::task::Poll::Ready(Some(match header.ordinal {
4440 0x525b3b97fdf7d884 => {
4441 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4442 let mut req = fidl::new_empty!(
4443 AudioConsumerCreateStreamSinkRequest,
4444 fidl::encoding::DefaultFuchsiaResourceDialect
4445 );
4446 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioConsumerCreateStreamSinkRequest>(&header, _body_bytes, handles, &mut req)?;
4447 let control_handle =
4448 AudioConsumerControlHandle { inner: this.inner.clone() };
4449 Ok(AudioConsumerRequest::CreateStreamSink {
4450 buffers: req.buffers,
4451 stream_type: req.stream_type,
4452 compression: req.compression,
4453 stream_sink_request: req.stream_sink_request,
4454
4455 control_handle,
4456 })
4457 }
4458 0x4fdbd44b3f2a3a3c => {
4459 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4460 let mut req = fidl::new_empty!(
4461 AudioConsumerStartRequest,
4462 fidl::encoding::DefaultFuchsiaResourceDialect
4463 );
4464 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioConsumerStartRequest>(&header, _body_bytes, handles, &mut req)?;
4465 let control_handle =
4466 AudioConsumerControlHandle { inner: this.inner.clone() };
4467 Ok(AudioConsumerRequest::Start {
4468 flags: req.flags,
4469 reference_time: req.reference_time,
4470 media_time: req.media_time,
4471
4472 control_handle,
4473 })
4474 }
4475 0x3d46c3741686c40d => {
4476 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4477 let mut req = fidl::new_empty!(
4478 fidl::encoding::EmptyPayload,
4479 fidl::encoding::DefaultFuchsiaResourceDialect
4480 );
4481 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4482 let control_handle =
4483 AudioConsumerControlHandle { inner: this.inner.clone() };
4484 Ok(AudioConsumerRequest::Stop { control_handle })
4485 }
4486 0x45342b73968bfafe => {
4487 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4488 let mut req = fidl::new_empty!(
4489 AudioConsumerSetRateRequest,
4490 fidl::encoding::DefaultFuchsiaResourceDialect
4491 );
4492 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioConsumerSetRateRequest>(&header, _body_bytes, handles, &mut req)?;
4493 let control_handle =
4494 AudioConsumerControlHandle { inner: this.inner.clone() };
4495 Ok(AudioConsumerRequest::SetRate { rate: req.rate, control_handle })
4496 }
4497 0x6f1b01fd887f5748 => {
4498 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4499 let mut req = fidl::new_empty!(
4500 AudioConsumerBindVolumeControlRequest,
4501 fidl::encoding::DefaultFuchsiaResourceDialect
4502 );
4503 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioConsumerBindVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
4504 let control_handle =
4505 AudioConsumerControlHandle { inner: this.inner.clone() };
4506 Ok(AudioConsumerRequest::BindVolumeControl {
4507 volume_control_request: req.volume_control_request,
4508
4509 control_handle,
4510 })
4511 }
4512 0x35cf702c721e2cc6 => {
4513 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4514 let mut req = fidl::new_empty!(
4515 fidl::encoding::EmptyPayload,
4516 fidl::encoding::DefaultFuchsiaResourceDialect
4517 );
4518 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4519 let control_handle =
4520 AudioConsumerControlHandle { inner: this.inner.clone() };
4521 Ok(AudioConsumerRequest::WatchStatus {
4522 responder: AudioConsumerWatchStatusResponder {
4523 control_handle: std::mem::ManuallyDrop::new(control_handle),
4524 tx_id: header.tx_id,
4525 },
4526 })
4527 }
4528 _ => Err(fidl::Error::UnknownOrdinal {
4529 ordinal: header.ordinal,
4530 protocol_name:
4531 <AudioConsumerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4532 }),
4533 }))
4534 },
4535 )
4536 }
4537}
4538
4539#[derive(Debug)]
4541pub enum AudioConsumerRequest {
4542 CreateStreamSink {
4554 buffers: Vec<fidl::Vmo>,
4555 stream_type: AudioStreamType,
4556 compression: Option<Box<Compression>>,
4557 stream_sink_request: fidl::endpoints::ServerEnd<StreamSinkMarker>,
4558 control_handle: AudioConsumerControlHandle,
4559 },
4560 Start {
4584 flags: AudioConsumerStartFlags,
4585 reference_time: i64,
4586 media_time: i64,
4587 control_handle: AudioConsumerControlHandle,
4588 },
4589 Stop { control_handle: AudioConsumerControlHandle },
4592 SetRate { rate: f32, control_handle: AudioConsumerControlHandle },
4596 BindVolumeControl {
4598 volume_control_request:
4599 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
4600 control_handle: AudioConsumerControlHandle,
4601 },
4602 WatchStatus { responder: AudioConsumerWatchStatusResponder },
4606}
4607
4608impl AudioConsumerRequest {
4609 #[allow(irrefutable_let_patterns)]
4610 pub fn into_create_stream_sink(
4611 self,
4612 ) -> Option<(
4613 Vec<fidl::Vmo>,
4614 AudioStreamType,
4615 Option<Box<Compression>>,
4616 fidl::endpoints::ServerEnd<StreamSinkMarker>,
4617 AudioConsumerControlHandle,
4618 )> {
4619 if let AudioConsumerRequest::CreateStreamSink {
4620 buffers,
4621 stream_type,
4622 compression,
4623 stream_sink_request,
4624 control_handle,
4625 } = self
4626 {
4627 Some((buffers, stream_type, compression, stream_sink_request, control_handle))
4628 } else {
4629 None
4630 }
4631 }
4632
4633 #[allow(irrefutable_let_patterns)]
4634 pub fn into_start(
4635 self,
4636 ) -> Option<(AudioConsumerStartFlags, i64, i64, AudioConsumerControlHandle)> {
4637 if let AudioConsumerRequest::Start { flags, reference_time, media_time, control_handle } =
4638 self
4639 {
4640 Some((flags, reference_time, media_time, control_handle))
4641 } else {
4642 None
4643 }
4644 }
4645
4646 #[allow(irrefutable_let_patterns)]
4647 pub fn into_stop(self) -> Option<(AudioConsumerControlHandle)> {
4648 if let AudioConsumerRequest::Stop { control_handle } = self {
4649 Some((control_handle))
4650 } else {
4651 None
4652 }
4653 }
4654
4655 #[allow(irrefutable_let_patterns)]
4656 pub fn into_set_rate(self) -> Option<(f32, AudioConsumerControlHandle)> {
4657 if let AudioConsumerRequest::SetRate { rate, control_handle } = self {
4658 Some((rate, control_handle))
4659 } else {
4660 None
4661 }
4662 }
4663
4664 #[allow(irrefutable_let_patterns)]
4665 pub fn into_bind_volume_control(
4666 self,
4667 ) -> Option<(
4668 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
4669 AudioConsumerControlHandle,
4670 )> {
4671 if let AudioConsumerRequest::BindVolumeControl { volume_control_request, control_handle } =
4672 self
4673 {
4674 Some((volume_control_request, control_handle))
4675 } else {
4676 None
4677 }
4678 }
4679
4680 #[allow(irrefutable_let_patterns)]
4681 pub fn into_watch_status(self) -> Option<(AudioConsumerWatchStatusResponder)> {
4682 if let AudioConsumerRequest::WatchStatus { responder } = self {
4683 Some((responder))
4684 } else {
4685 None
4686 }
4687 }
4688
4689 pub fn method_name(&self) -> &'static str {
4691 match *self {
4692 AudioConsumerRequest::CreateStreamSink { .. } => "create_stream_sink",
4693 AudioConsumerRequest::Start { .. } => "start",
4694 AudioConsumerRequest::Stop { .. } => "stop",
4695 AudioConsumerRequest::SetRate { .. } => "set_rate",
4696 AudioConsumerRequest::BindVolumeControl { .. } => "bind_volume_control",
4697 AudioConsumerRequest::WatchStatus { .. } => "watch_status",
4698 }
4699 }
4700}
4701
4702#[derive(Debug, Clone)]
4703pub struct AudioConsumerControlHandle {
4704 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4705}
4706
4707impl fidl::endpoints::ControlHandle for AudioConsumerControlHandle {
4708 fn shutdown(&self) {
4709 self.inner.shutdown()
4710 }
4711 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4712 self.inner.shutdown_with_epitaph(status)
4713 }
4714
4715 fn is_closed(&self) -> bool {
4716 self.inner.channel().is_closed()
4717 }
4718 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4719 self.inner.channel().on_closed()
4720 }
4721
4722 #[cfg(target_os = "fuchsia")]
4723 fn signal_peer(
4724 &self,
4725 clear_mask: zx::Signals,
4726 set_mask: zx::Signals,
4727 ) -> Result<(), zx_status::Status> {
4728 use fidl::Peered;
4729 self.inner.channel().signal_peer(clear_mask, set_mask)
4730 }
4731}
4732
4733impl AudioConsumerControlHandle {
4734 pub fn send_on_end_of_stream(&self) -> Result<(), fidl::Error> {
4735 self.inner.send::<fidl::encoding::EmptyPayload>(
4736 (),
4737 0,
4738 0x53a64e6d0e8f8a20,
4739 fidl::encoding::DynamicFlags::empty(),
4740 )
4741 }
4742}
4743
4744#[must_use = "FIDL methods require a response to be sent"]
4745#[derive(Debug)]
4746pub struct AudioConsumerWatchStatusResponder {
4747 control_handle: std::mem::ManuallyDrop<AudioConsumerControlHandle>,
4748 tx_id: u32,
4749}
4750
4751impl std::ops::Drop for AudioConsumerWatchStatusResponder {
4755 fn drop(&mut self) {
4756 self.control_handle.shutdown();
4757 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4759 }
4760}
4761
4762impl fidl::endpoints::Responder for AudioConsumerWatchStatusResponder {
4763 type ControlHandle = AudioConsumerControlHandle;
4764
4765 fn control_handle(&self) -> &AudioConsumerControlHandle {
4766 &self.control_handle
4767 }
4768
4769 fn drop_without_shutdown(mut self) {
4770 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4772 std::mem::forget(self);
4774 }
4775}
4776
4777impl AudioConsumerWatchStatusResponder {
4778 pub fn send(self, mut status: &AudioConsumerStatus) -> Result<(), fidl::Error> {
4782 let _result = self.send_raw(status);
4783 if _result.is_err() {
4784 self.control_handle.shutdown();
4785 }
4786 self.drop_without_shutdown();
4787 _result
4788 }
4789
4790 pub fn send_no_shutdown_on_err(
4792 self,
4793 mut status: &AudioConsumerStatus,
4794 ) -> Result<(), fidl::Error> {
4795 let _result = self.send_raw(status);
4796 self.drop_without_shutdown();
4797 _result
4798 }
4799
4800 fn send_raw(&self, mut status: &AudioConsumerStatus) -> Result<(), fidl::Error> {
4801 self.control_handle.inner.send::<AudioConsumerWatchStatusResponse>(
4802 (status,),
4803 self.tx_id,
4804 0x35cf702c721e2cc6,
4805 fidl::encoding::DynamicFlags::empty(),
4806 )
4807 }
4808}
4809
4810#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4811pub struct AudioCoreMarker;
4812
4813impl fidl::endpoints::ProtocolMarker for AudioCoreMarker {
4814 type Proxy = AudioCoreProxy;
4815 type RequestStream = AudioCoreRequestStream;
4816 #[cfg(target_os = "fuchsia")]
4817 type SynchronousProxy = AudioCoreSynchronousProxy;
4818
4819 const DEBUG_NAME: &'static str = "fuchsia.media.AudioCore";
4820}
4821impl fidl::endpoints::DiscoverableProtocolMarker for AudioCoreMarker {}
4822
4823pub trait AudioCoreProxyInterface: Send + Sync {
4824 fn r#create_audio_renderer(
4825 &self,
4826 audio_out_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
4827 ) -> Result<(), fidl::Error>;
4828 fn r#create_audio_capturer_with_configuration(
4829 &self,
4830 stream_type: &AudioStreamType,
4831 configuration: &AudioCapturerConfiguration,
4832 audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
4833 ) -> Result<(), fidl::Error>;
4834 fn r#create_audio_capturer(
4835 &self,
4836 loopback: bool,
4837 audio_in_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
4838 ) -> Result<(), fidl::Error>;
4839 fn r#enable_device_settings(&self, enabled: bool) -> Result<(), fidl::Error>;
4840 fn r#set_render_usage_gain(
4841 &self,
4842 usage: AudioRenderUsage,
4843 gain_db: f32,
4844 ) -> Result<(), fidl::Error>;
4845 fn r#set_render_usage_gain2(
4846 &self,
4847 usage: AudioRenderUsage2,
4848 gain_db: f32,
4849 ) -> Result<(), fidl::Error>;
4850 fn r#set_capture_usage_gain(
4851 &self,
4852 usage: AudioCaptureUsage,
4853 gain_db: f32,
4854 ) -> Result<(), fidl::Error>;
4855 fn r#set_capture_usage_gain2(
4856 &self,
4857 usage: AudioCaptureUsage2,
4858 gain_db: f32,
4859 ) -> Result<(), fidl::Error>;
4860 fn r#bind_usage_volume_control(
4861 &self,
4862 usage: &Usage,
4863 volume_control: fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
4864 ) -> Result<(), fidl::Error>;
4865 fn r#bind_usage_volume_control2(
4866 &self,
4867 usage: &Usage2,
4868 volume_control: fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
4869 ) -> Result<(), fidl::Error>;
4870 type GetVolumeFromDbResponseFut: std::future::Future<Output = Result<f32, fidl::Error>> + Send;
4871 fn r#get_volume_from_db(&self, usage: &Usage, gain_db: f32)
4872 -> Self::GetVolumeFromDbResponseFut;
4873 type GetVolumeFromDb2ResponseFut: std::future::Future<Output = Result<f32, fidl::Error>> + Send;
4874 fn r#get_volume_from_db2(
4875 &self,
4876 usage: &Usage2,
4877 gain_db: f32,
4878 ) -> Self::GetVolumeFromDb2ResponseFut;
4879 type GetDbFromVolumeResponseFut: std::future::Future<Output = Result<f32, fidl::Error>> + Send;
4880 fn r#get_db_from_volume(&self, usage: &Usage, volume: f32) -> Self::GetDbFromVolumeResponseFut;
4881 type GetDbFromVolume2ResponseFut: std::future::Future<Output = Result<f32, fidl::Error>> + Send;
4882 fn r#get_db_from_volume2(
4883 &self,
4884 usage: &Usage2,
4885 volume: f32,
4886 ) -> Self::GetDbFromVolume2ResponseFut;
4887 fn r#set_interaction(
4888 &self,
4889 active: &Usage,
4890 affected: &Usage,
4891 behavior: Behavior,
4892 ) -> Result<(), fidl::Error>;
4893 fn r#set_interaction2(
4894 &self,
4895 active: &Usage2,
4896 affected: &Usage2,
4897 behavior: Behavior,
4898 ) -> Result<(), fidl::Error>;
4899 fn r#reset_interactions(&self) -> Result<(), fidl::Error>;
4900 fn r#load_defaults(&self) -> Result<(), fidl::Error>;
4901}
4902#[derive(Debug)]
4903#[cfg(target_os = "fuchsia")]
4904pub struct AudioCoreSynchronousProxy {
4905 client: fidl::client::sync::Client,
4906}
4907
4908#[cfg(target_os = "fuchsia")]
4909impl fidl::endpoints::SynchronousProxy for AudioCoreSynchronousProxy {
4910 type Proxy = AudioCoreProxy;
4911 type Protocol = AudioCoreMarker;
4912
4913 fn from_channel(inner: fidl::Channel) -> Self {
4914 Self::new(inner)
4915 }
4916
4917 fn into_channel(self) -> fidl::Channel {
4918 self.client.into_channel()
4919 }
4920
4921 fn as_channel(&self) -> &fidl::Channel {
4922 self.client.as_channel()
4923 }
4924}
4925
4926#[cfg(target_os = "fuchsia")]
4927impl AudioCoreSynchronousProxy {
4928 pub fn new(channel: fidl::Channel) -> Self {
4929 let protocol_name = <AudioCoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4930 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4931 }
4932
4933 pub fn into_channel(self) -> fidl::Channel {
4934 self.client.into_channel()
4935 }
4936
4937 pub fn wait_for_event(
4940 &self,
4941 deadline: zx::MonotonicInstant,
4942 ) -> Result<AudioCoreEvent, fidl::Error> {
4943 AudioCoreEvent::decode(self.client.wait_for_event(deadline)?)
4944 }
4945
4946 pub fn r#create_audio_renderer(
4948 &self,
4949 mut audio_out_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
4950 ) -> Result<(), fidl::Error> {
4951 self.client.send::<AudioCoreCreateAudioRendererRequest>(
4952 (audio_out_request,),
4953 0x2ac9beba47f83435,
4954 fidl::encoding::DynamicFlags::empty(),
4955 )
4956 }
4957
4958 pub fn r#create_audio_capturer_with_configuration(
4970 &self,
4971 mut stream_type: &AudioStreamType,
4972 mut configuration: &AudioCapturerConfiguration,
4973 mut audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
4974 ) -> Result<(), fidl::Error> {
4975 self.client.send::<AudioCoreCreateAudioCapturerWithConfigurationRequest>(
4976 (stream_type, configuration, audio_capturer_request),
4977 0x459de383b0d76d97,
4978 fidl::encoding::DynamicFlags::empty(),
4979 )
4980 }
4981
4982 pub fn r#create_audio_capturer(
4986 &self,
4987 mut loopback: bool,
4988 mut audio_in_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
4989 ) -> Result<(), fidl::Error> {
4990 self.client.send::<AudioCoreCreateAudioCapturerRequest>(
4991 (loopback, audio_in_request),
4992 0x787db169df99aed0,
4993 fidl::encoding::DynamicFlags::empty(),
4994 )
4995 }
4996
4997 pub fn r#enable_device_settings(&self, mut enabled: bool) -> Result<(), fidl::Error> {
4998 self.client.send::<AudioCoreEnableDeviceSettingsRequest>(
4999 (enabled,),
5000 0x41107a1917269b3e,
5001 fidl::encoding::DynamicFlags::empty(),
5002 )
5003 }
5004
5005 pub fn r#set_render_usage_gain(
5007 &self,
5008 mut usage: AudioRenderUsage,
5009 mut gain_db: f32,
5010 ) -> Result<(), fidl::Error> {
5011 self.client.send::<AudioCoreSetRenderUsageGainRequest>(
5012 (usage, gain_db),
5013 0x48097f45f6e2b8e7,
5014 fidl::encoding::DynamicFlags::empty(),
5015 )
5016 }
5017
5018 pub fn r#set_render_usage_gain2(
5020 &self,
5021 mut usage: AudioRenderUsage2,
5022 mut gain_db: f32,
5023 ) -> Result<(), fidl::Error> {
5024 self.client.send::<AudioCoreSetRenderUsageGain2Request>(
5025 (usage, gain_db),
5026 0x779b1531dc9e64f4,
5027 fidl::encoding::DynamicFlags::FLEXIBLE,
5028 )
5029 }
5030
5031 pub fn r#set_capture_usage_gain(
5033 &self,
5034 mut usage: AudioCaptureUsage,
5035 mut gain_db: f32,
5036 ) -> Result<(), fidl::Error> {
5037 self.client.send::<AudioCoreSetCaptureUsageGainRequest>(
5038 (usage, gain_db),
5039 0x457d29217d4ea248,
5040 fidl::encoding::DynamicFlags::empty(),
5041 )
5042 }
5043
5044 pub fn r#set_capture_usage_gain2(
5046 &self,
5047 mut usage: AudioCaptureUsage2,
5048 mut gain_db: f32,
5049 ) -> Result<(), fidl::Error> {
5050 self.client.send::<AudioCoreSetCaptureUsageGain2Request>(
5051 (usage, gain_db),
5052 0x15065ee308f44af0,
5053 fidl::encoding::DynamicFlags::FLEXIBLE,
5054 )
5055 }
5056
5057 pub fn r#bind_usage_volume_control(
5059 &self,
5060 mut usage: &Usage,
5061 mut volume_control: fidl::endpoints::ServerEnd<
5062 fidl_fuchsia_media_audio::VolumeControlMarker,
5063 >,
5064 ) -> Result<(), fidl::Error> {
5065 self.client.send::<AudioCoreBindUsageVolumeControlRequest>(
5066 (usage, volume_control),
5067 0x7225be116aadc137,
5068 fidl::encoding::DynamicFlags::empty(),
5069 )
5070 }
5071
5072 pub fn r#bind_usage_volume_control2(
5074 &self,
5075 mut usage: &Usage2,
5076 mut volume_control: fidl::endpoints::ServerEnd<
5077 fidl_fuchsia_media_audio::VolumeControlMarker,
5078 >,
5079 ) -> Result<(), fidl::Error> {
5080 self.client.send::<AudioCoreBindUsageVolumeControl2Request>(
5081 (usage, volume_control),
5082 0x729dff93019d055,
5083 fidl::encoding::DynamicFlags::FLEXIBLE,
5084 )
5085 }
5086
5087 pub fn r#get_volume_from_db(
5091 &self,
5092 mut usage: &Usage,
5093 mut gain_db: f32,
5094 ___deadline: zx::MonotonicInstant,
5095 ) -> Result<f32, fidl::Error> {
5096 let _response = self
5097 .client
5098 .send_query::<AudioCoreGetVolumeFromDbRequest, AudioCoreGetVolumeFromDbResponse>(
5099 (usage, gain_db),
5100 0x50e3ca45509770bf,
5101 fidl::encoding::DynamicFlags::empty(),
5102 ___deadline,
5103 )?;
5104 Ok(_response.volume)
5105 }
5106
5107 pub fn r#get_volume_from_db2(
5111 &self,
5112 mut usage: &Usage2,
5113 mut gain_db: f32,
5114 ___deadline: zx::MonotonicInstant,
5115 ) -> Result<f32, fidl::Error> {
5116 let _response = self.client.send_query::<
5117 AudioCoreGetVolumeFromDb2Request,
5118 fidl::encoding::FlexibleType<AudioCoreGetVolumeFromDb2Response>,
5119 >(
5120 (usage, gain_db,),
5121 0x165c811091ef99da,
5122 fidl::encoding::DynamicFlags::FLEXIBLE,
5123 ___deadline,
5124 )?
5125 .into_result::<AudioCoreMarker>("get_volume_from_db2")?;
5126 Ok(_response.volume)
5127 }
5128
5129 pub fn r#get_db_from_volume(
5132 &self,
5133 mut usage: &Usage,
5134 mut volume: f32,
5135 ___deadline: zx::MonotonicInstant,
5136 ) -> Result<f32, fidl::Error> {
5137 let _response = self
5138 .client
5139 .send_query::<AudioCoreGetDbFromVolumeRequest, AudioCoreGetDbFromVolumeResponse>(
5140 (usage, volume),
5141 0x3e8eec27dd5a8bda,
5142 fidl::encoding::DynamicFlags::empty(),
5143 ___deadline,
5144 )?;
5145 Ok(_response.gain_db)
5146 }
5147
5148 pub fn r#get_db_from_volume2(
5151 &self,
5152 mut usage: &Usage2,
5153 mut volume: f32,
5154 ___deadline: zx::MonotonicInstant,
5155 ) -> Result<f32, fidl::Error> {
5156 let _response = self.client.send_query::<
5157 AudioCoreGetDbFromVolume2Request,
5158 fidl::encoding::FlexibleType<AudioCoreGetDbFromVolume2Response>,
5159 >(
5160 (usage, volume,),
5161 0x5f421a8ebf265bf3,
5162 fidl::encoding::DynamicFlags::FLEXIBLE,
5163 ___deadline,
5164 )?
5165 .into_result::<AudioCoreMarker>("get_db_from_volume2")?;
5166 Ok(_response.gain_db)
5167 }
5168
5169 pub fn r#set_interaction(
5173 &self,
5174 mut active: &Usage,
5175 mut affected: &Usage,
5176 mut behavior: Behavior,
5177 ) -> Result<(), fidl::Error> {
5178 self.client.send::<AudioCoreSetInteractionRequest>(
5179 (active, affected, behavior),
5180 0x7bfed14345ece7b7,
5181 fidl::encoding::DynamicFlags::empty(),
5182 )
5183 }
5184
5185 pub fn r#set_interaction2(
5189 &self,
5190 mut active: &Usage2,
5191 mut affected: &Usage2,
5192 mut behavior: Behavior,
5193 ) -> Result<(), fidl::Error> {
5194 self.client.send::<AudioCoreSetInteraction2Request>(
5195 (active, affected, behavior),
5196 0x7226c7c6e6edc62f,
5197 fidl::encoding::DynamicFlags::FLEXIBLE,
5198 )
5199 }
5200
5201 pub fn r#reset_interactions(&self) -> Result<(), fidl::Error> {
5204 self.client.send::<fidl::encoding::EmptyPayload>(
5205 (),
5206 0x65bd94d9d0a28b5e,
5207 fidl::encoding::DynamicFlags::empty(),
5208 )
5209 }
5210
5211 pub fn r#load_defaults(&self) -> Result<(), fidl::Error> {
5214 self.client.send::<fidl::encoding::EmptyPayload>(
5215 (),
5216 0x54a0bebca85f6b31,
5217 fidl::encoding::DynamicFlags::empty(),
5218 )
5219 }
5220}
5221
5222#[cfg(target_os = "fuchsia")]
5223impl From<AudioCoreSynchronousProxy> for zx::Handle {
5224 fn from(value: AudioCoreSynchronousProxy) -> Self {
5225 value.into_channel().into()
5226 }
5227}
5228
5229#[cfg(target_os = "fuchsia")]
5230impl From<fidl::Channel> for AudioCoreSynchronousProxy {
5231 fn from(value: fidl::Channel) -> Self {
5232 Self::new(value)
5233 }
5234}
5235
5236#[derive(Debug, Clone)]
5237pub struct AudioCoreProxy {
5238 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5239}
5240
5241impl fidl::endpoints::Proxy for AudioCoreProxy {
5242 type Protocol = AudioCoreMarker;
5243
5244 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5245 Self::new(inner)
5246 }
5247
5248 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5249 self.client.into_channel().map_err(|client| Self { client })
5250 }
5251
5252 fn as_channel(&self) -> &::fidl::AsyncChannel {
5253 self.client.as_channel()
5254 }
5255}
5256
5257impl AudioCoreProxy {
5258 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5260 let protocol_name = <AudioCoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5261 Self { client: fidl::client::Client::new(channel, protocol_name) }
5262 }
5263
5264 pub fn take_event_stream(&self) -> AudioCoreEventStream {
5270 AudioCoreEventStream { event_receiver: self.client.take_event_receiver() }
5271 }
5272
5273 pub fn r#create_audio_renderer(
5275 &self,
5276 mut audio_out_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
5277 ) -> Result<(), fidl::Error> {
5278 AudioCoreProxyInterface::r#create_audio_renderer(self, audio_out_request)
5279 }
5280
5281 pub fn r#create_audio_capturer_with_configuration(
5293 &self,
5294 mut stream_type: &AudioStreamType,
5295 mut configuration: &AudioCapturerConfiguration,
5296 mut audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
5297 ) -> Result<(), fidl::Error> {
5298 AudioCoreProxyInterface::r#create_audio_capturer_with_configuration(
5299 self,
5300 stream_type,
5301 configuration,
5302 audio_capturer_request,
5303 )
5304 }
5305
5306 pub fn r#create_audio_capturer(
5310 &self,
5311 mut loopback: bool,
5312 mut audio_in_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
5313 ) -> Result<(), fidl::Error> {
5314 AudioCoreProxyInterface::r#create_audio_capturer(self, loopback, audio_in_request)
5315 }
5316
5317 pub fn r#enable_device_settings(&self, mut enabled: bool) -> Result<(), fidl::Error> {
5318 AudioCoreProxyInterface::r#enable_device_settings(self, enabled)
5319 }
5320
5321 pub fn r#set_render_usage_gain(
5323 &self,
5324 mut usage: AudioRenderUsage,
5325 mut gain_db: f32,
5326 ) -> Result<(), fidl::Error> {
5327 AudioCoreProxyInterface::r#set_render_usage_gain(self, usage, gain_db)
5328 }
5329
5330 pub fn r#set_render_usage_gain2(
5332 &self,
5333 mut usage: AudioRenderUsage2,
5334 mut gain_db: f32,
5335 ) -> Result<(), fidl::Error> {
5336 AudioCoreProxyInterface::r#set_render_usage_gain2(self, usage, gain_db)
5337 }
5338
5339 pub fn r#set_capture_usage_gain(
5341 &self,
5342 mut usage: AudioCaptureUsage,
5343 mut gain_db: f32,
5344 ) -> Result<(), fidl::Error> {
5345 AudioCoreProxyInterface::r#set_capture_usage_gain(self, usage, gain_db)
5346 }
5347
5348 pub fn r#set_capture_usage_gain2(
5350 &self,
5351 mut usage: AudioCaptureUsage2,
5352 mut gain_db: f32,
5353 ) -> Result<(), fidl::Error> {
5354 AudioCoreProxyInterface::r#set_capture_usage_gain2(self, usage, gain_db)
5355 }
5356
5357 pub fn r#bind_usage_volume_control(
5359 &self,
5360 mut usage: &Usage,
5361 mut volume_control: fidl::endpoints::ServerEnd<
5362 fidl_fuchsia_media_audio::VolumeControlMarker,
5363 >,
5364 ) -> Result<(), fidl::Error> {
5365 AudioCoreProxyInterface::r#bind_usage_volume_control(self, usage, volume_control)
5366 }
5367
5368 pub fn r#bind_usage_volume_control2(
5370 &self,
5371 mut usage: &Usage2,
5372 mut volume_control: fidl::endpoints::ServerEnd<
5373 fidl_fuchsia_media_audio::VolumeControlMarker,
5374 >,
5375 ) -> Result<(), fidl::Error> {
5376 AudioCoreProxyInterface::r#bind_usage_volume_control2(self, usage, volume_control)
5377 }
5378
5379 pub fn r#get_volume_from_db(
5383 &self,
5384 mut usage: &Usage,
5385 mut gain_db: f32,
5386 ) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
5387 AudioCoreProxyInterface::r#get_volume_from_db(self, usage, gain_db)
5388 }
5389
5390 pub fn r#get_volume_from_db2(
5394 &self,
5395 mut usage: &Usage2,
5396 mut gain_db: f32,
5397 ) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
5398 AudioCoreProxyInterface::r#get_volume_from_db2(self, usage, gain_db)
5399 }
5400
5401 pub fn r#get_db_from_volume(
5404 &self,
5405 mut usage: &Usage,
5406 mut volume: f32,
5407 ) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
5408 AudioCoreProxyInterface::r#get_db_from_volume(self, usage, volume)
5409 }
5410
5411 pub fn r#get_db_from_volume2(
5414 &self,
5415 mut usage: &Usage2,
5416 mut volume: f32,
5417 ) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
5418 AudioCoreProxyInterface::r#get_db_from_volume2(self, usage, volume)
5419 }
5420
5421 pub fn r#set_interaction(
5425 &self,
5426 mut active: &Usage,
5427 mut affected: &Usage,
5428 mut behavior: Behavior,
5429 ) -> Result<(), fidl::Error> {
5430 AudioCoreProxyInterface::r#set_interaction(self, active, affected, behavior)
5431 }
5432
5433 pub fn r#set_interaction2(
5437 &self,
5438 mut active: &Usage2,
5439 mut affected: &Usage2,
5440 mut behavior: Behavior,
5441 ) -> Result<(), fidl::Error> {
5442 AudioCoreProxyInterface::r#set_interaction2(self, active, affected, behavior)
5443 }
5444
5445 pub fn r#reset_interactions(&self) -> Result<(), fidl::Error> {
5448 AudioCoreProxyInterface::r#reset_interactions(self)
5449 }
5450
5451 pub fn r#load_defaults(&self) -> Result<(), fidl::Error> {
5454 AudioCoreProxyInterface::r#load_defaults(self)
5455 }
5456}
5457
5458impl AudioCoreProxyInterface for AudioCoreProxy {
5459 fn r#create_audio_renderer(
5460 &self,
5461 mut audio_out_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
5462 ) -> Result<(), fidl::Error> {
5463 self.client.send::<AudioCoreCreateAudioRendererRequest>(
5464 (audio_out_request,),
5465 0x2ac9beba47f83435,
5466 fidl::encoding::DynamicFlags::empty(),
5467 )
5468 }
5469
5470 fn r#create_audio_capturer_with_configuration(
5471 &self,
5472 mut stream_type: &AudioStreamType,
5473 mut configuration: &AudioCapturerConfiguration,
5474 mut audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
5475 ) -> Result<(), fidl::Error> {
5476 self.client.send::<AudioCoreCreateAudioCapturerWithConfigurationRequest>(
5477 (stream_type, configuration, audio_capturer_request),
5478 0x459de383b0d76d97,
5479 fidl::encoding::DynamicFlags::empty(),
5480 )
5481 }
5482
5483 fn r#create_audio_capturer(
5484 &self,
5485 mut loopback: bool,
5486 mut audio_in_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
5487 ) -> Result<(), fidl::Error> {
5488 self.client.send::<AudioCoreCreateAudioCapturerRequest>(
5489 (loopback, audio_in_request),
5490 0x787db169df99aed0,
5491 fidl::encoding::DynamicFlags::empty(),
5492 )
5493 }
5494
5495 fn r#enable_device_settings(&self, mut enabled: bool) -> Result<(), fidl::Error> {
5496 self.client.send::<AudioCoreEnableDeviceSettingsRequest>(
5497 (enabled,),
5498 0x41107a1917269b3e,
5499 fidl::encoding::DynamicFlags::empty(),
5500 )
5501 }
5502
5503 fn r#set_render_usage_gain(
5504 &self,
5505 mut usage: AudioRenderUsage,
5506 mut gain_db: f32,
5507 ) -> Result<(), fidl::Error> {
5508 self.client.send::<AudioCoreSetRenderUsageGainRequest>(
5509 (usage, gain_db),
5510 0x48097f45f6e2b8e7,
5511 fidl::encoding::DynamicFlags::empty(),
5512 )
5513 }
5514
5515 fn r#set_render_usage_gain2(
5516 &self,
5517 mut usage: AudioRenderUsage2,
5518 mut gain_db: f32,
5519 ) -> Result<(), fidl::Error> {
5520 self.client.send::<AudioCoreSetRenderUsageGain2Request>(
5521 (usage, gain_db),
5522 0x779b1531dc9e64f4,
5523 fidl::encoding::DynamicFlags::FLEXIBLE,
5524 )
5525 }
5526
5527 fn r#set_capture_usage_gain(
5528 &self,
5529 mut usage: AudioCaptureUsage,
5530 mut gain_db: f32,
5531 ) -> Result<(), fidl::Error> {
5532 self.client.send::<AudioCoreSetCaptureUsageGainRequest>(
5533 (usage, gain_db),
5534 0x457d29217d4ea248,
5535 fidl::encoding::DynamicFlags::empty(),
5536 )
5537 }
5538
5539 fn r#set_capture_usage_gain2(
5540 &self,
5541 mut usage: AudioCaptureUsage2,
5542 mut gain_db: f32,
5543 ) -> Result<(), fidl::Error> {
5544 self.client.send::<AudioCoreSetCaptureUsageGain2Request>(
5545 (usage, gain_db),
5546 0x15065ee308f44af0,
5547 fidl::encoding::DynamicFlags::FLEXIBLE,
5548 )
5549 }
5550
5551 fn r#bind_usage_volume_control(
5552 &self,
5553 mut usage: &Usage,
5554 mut volume_control: fidl::endpoints::ServerEnd<
5555 fidl_fuchsia_media_audio::VolumeControlMarker,
5556 >,
5557 ) -> Result<(), fidl::Error> {
5558 self.client.send::<AudioCoreBindUsageVolumeControlRequest>(
5559 (usage, volume_control),
5560 0x7225be116aadc137,
5561 fidl::encoding::DynamicFlags::empty(),
5562 )
5563 }
5564
5565 fn r#bind_usage_volume_control2(
5566 &self,
5567 mut usage: &Usage2,
5568 mut volume_control: fidl::endpoints::ServerEnd<
5569 fidl_fuchsia_media_audio::VolumeControlMarker,
5570 >,
5571 ) -> Result<(), fidl::Error> {
5572 self.client.send::<AudioCoreBindUsageVolumeControl2Request>(
5573 (usage, volume_control),
5574 0x729dff93019d055,
5575 fidl::encoding::DynamicFlags::FLEXIBLE,
5576 )
5577 }
5578
5579 type GetVolumeFromDbResponseFut =
5580 fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
5581 fn r#get_volume_from_db(
5582 &self,
5583 mut usage: &Usage,
5584 mut gain_db: f32,
5585 ) -> Self::GetVolumeFromDbResponseFut {
5586 fn _decode(
5587 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5588 ) -> Result<f32, fidl::Error> {
5589 let _response = fidl::client::decode_transaction_body::<
5590 AudioCoreGetVolumeFromDbResponse,
5591 fidl::encoding::DefaultFuchsiaResourceDialect,
5592 0x50e3ca45509770bf,
5593 >(_buf?)?;
5594 Ok(_response.volume)
5595 }
5596 self.client.send_query_and_decode::<AudioCoreGetVolumeFromDbRequest, f32>(
5597 (usage, gain_db),
5598 0x50e3ca45509770bf,
5599 fidl::encoding::DynamicFlags::empty(),
5600 _decode,
5601 )
5602 }
5603
5604 type GetVolumeFromDb2ResponseFut =
5605 fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
5606 fn r#get_volume_from_db2(
5607 &self,
5608 mut usage: &Usage2,
5609 mut gain_db: f32,
5610 ) -> Self::GetVolumeFromDb2ResponseFut {
5611 fn _decode(
5612 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5613 ) -> Result<f32, fidl::Error> {
5614 let _response = fidl::client::decode_transaction_body::<
5615 fidl::encoding::FlexibleType<AudioCoreGetVolumeFromDb2Response>,
5616 fidl::encoding::DefaultFuchsiaResourceDialect,
5617 0x165c811091ef99da,
5618 >(_buf?)?
5619 .into_result::<AudioCoreMarker>("get_volume_from_db2")?;
5620 Ok(_response.volume)
5621 }
5622 self.client.send_query_and_decode::<AudioCoreGetVolumeFromDb2Request, f32>(
5623 (usage, gain_db),
5624 0x165c811091ef99da,
5625 fidl::encoding::DynamicFlags::FLEXIBLE,
5626 _decode,
5627 )
5628 }
5629
5630 type GetDbFromVolumeResponseFut =
5631 fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
5632 fn r#get_db_from_volume(
5633 &self,
5634 mut usage: &Usage,
5635 mut volume: f32,
5636 ) -> Self::GetDbFromVolumeResponseFut {
5637 fn _decode(
5638 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5639 ) -> Result<f32, fidl::Error> {
5640 let _response = fidl::client::decode_transaction_body::<
5641 AudioCoreGetDbFromVolumeResponse,
5642 fidl::encoding::DefaultFuchsiaResourceDialect,
5643 0x3e8eec27dd5a8bda,
5644 >(_buf?)?;
5645 Ok(_response.gain_db)
5646 }
5647 self.client.send_query_and_decode::<AudioCoreGetDbFromVolumeRequest, f32>(
5648 (usage, volume),
5649 0x3e8eec27dd5a8bda,
5650 fidl::encoding::DynamicFlags::empty(),
5651 _decode,
5652 )
5653 }
5654
5655 type GetDbFromVolume2ResponseFut =
5656 fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
5657 fn r#get_db_from_volume2(
5658 &self,
5659 mut usage: &Usage2,
5660 mut volume: f32,
5661 ) -> Self::GetDbFromVolume2ResponseFut {
5662 fn _decode(
5663 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5664 ) -> Result<f32, fidl::Error> {
5665 let _response = fidl::client::decode_transaction_body::<
5666 fidl::encoding::FlexibleType<AudioCoreGetDbFromVolume2Response>,
5667 fidl::encoding::DefaultFuchsiaResourceDialect,
5668 0x5f421a8ebf265bf3,
5669 >(_buf?)?
5670 .into_result::<AudioCoreMarker>("get_db_from_volume2")?;
5671 Ok(_response.gain_db)
5672 }
5673 self.client.send_query_and_decode::<AudioCoreGetDbFromVolume2Request, f32>(
5674 (usage, volume),
5675 0x5f421a8ebf265bf3,
5676 fidl::encoding::DynamicFlags::FLEXIBLE,
5677 _decode,
5678 )
5679 }
5680
5681 fn r#set_interaction(
5682 &self,
5683 mut active: &Usage,
5684 mut affected: &Usage,
5685 mut behavior: Behavior,
5686 ) -> Result<(), fidl::Error> {
5687 self.client.send::<AudioCoreSetInteractionRequest>(
5688 (active, affected, behavior),
5689 0x7bfed14345ece7b7,
5690 fidl::encoding::DynamicFlags::empty(),
5691 )
5692 }
5693
5694 fn r#set_interaction2(
5695 &self,
5696 mut active: &Usage2,
5697 mut affected: &Usage2,
5698 mut behavior: Behavior,
5699 ) -> Result<(), fidl::Error> {
5700 self.client.send::<AudioCoreSetInteraction2Request>(
5701 (active, affected, behavior),
5702 0x7226c7c6e6edc62f,
5703 fidl::encoding::DynamicFlags::FLEXIBLE,
5704 )
5705 }
5706
5707 fn r#reset_interactions(&self) -> Result<(), fidl::Error> {
5708 self.client.send::<fidl::encoding::EmptyPayload>(
5709 (),
5710 0x65bd94d9d0a28b5e,
5711 fidl::encoding::DynamicFlags::empty(),
5712 )
5713 }
5714
5715 fn r#load_defaults(&self) -> Result<(), fidl::Error> {
5716 self.client.send::<fidl::encoding::EmptyPayload>(
5717 (),
5718 0x54a0bebca85f6b31,
5719 fidl::encoding::DynamicFlags::empty(),
5720 )
5721 }
5722}
5723
5724pub struct AudioCoreEventStream {
5725 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5726}
5727
5728impl std::marker::Unpin for AudioCoreEventStream {}
5729
5730impl futures::stream::FusedStream for AudioCoreEventStream {
5731 fn is_terminated(&self) -> bool {
5732 self.event_receiver.is_terminated()
5733 }
5734}
5735
5736impl futures::Stream for AudioCoreEventStream {
5737 type Item = Result<AudioCoreEvent, fidl::Error>;
5738
5739 fn poll_next(
5740 mut self: std::pin::Pin<&mut Self>,
5741 cx: &mut std::task::Context<'_>,
5742 ) -> std::task::Poll<Option<Self::Item>> {
5743 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5744 &mut self.event_receiver,
5745 cx
5746 )?) {
5747 Some(buf) => std::task::Poll::Ready(Some(AudioCoreEvent::decode(buf))),
5748 None => std::task::Poll::Ready(None),
5749 }
5750 }
5751}
5752
5753#[derive(Debug)]
5754pub enum AudioCoreEvent {
5755 #[non_exhaustive]
5756 _UnknownEvent {
5757 ordinal: u64,
5759 },
5760}
5761
5762impl AudioCoreEvent {
5763 fn decode(
5765 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5766 ) -> Result<AudioCoreEvent, fidl::Error> {
5767 let (bytes, _handles) = buf.split_mut();
5768 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5769 debug_assert_eq!(tx_header.tx_id, 0);
5770 match tx_header.ordinal {
5771 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5772 Ok(AudioCoreEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5773 }
5774 _ => Err(fidl::Error::UnknownOrdinal {
5775 ordinal: tx_header.ordinal,
5776 protocol_name: <AudioCoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5777 }),
5778 }
5779 }
5780}
5781
5782pub struct AudioCoreRequestStream {
5784 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5785 is_terminated: bool,
5786}
5787
5788impl std::marker::Unpin for AudioCoreRequestStream {}
5789
5790impl futures::stream::FusedStream for AudioCoreRequestStream {
5791 fn is_terminated(&self) -> bool {
5792 self.is_terminated
5793 }
5794}
5795
5796impl fidl::endpoints::RequestStream for AudioCoreRequestStream {
5797 type Protocol = AudioCoreMarker;
5798 type ControlHandle = AudioCoreControlHandle;
5799
5800 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5801 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5802 }
5803
5804 fn control_handle(&self) -> Self::ControlHandle {
5805 AudioCoreControlHandle { inner: self.inner.clone() }
5806 }
5807
5808 fn into_inner(
5809 self,
5810 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5811 {
5812 (self.inner, self.is_terminated)
5813 }
5814
5815 fn from_inner(
5816 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5817 is_terminated: bool,
5818 ) -> Self {
5819 Self { inner, is_terminated }
5820 }
5821}
5822
5823impl futures::Stream for AudioCoreRequestStream {
5824 type Item = Result<AudioCoreRequest, fidl::Error>;
5825
5826 fn poll_next(
5827 mut self: std::pin::Pin<&mut Self>,
5828 cx: &mut std::task::Context<'_>,
5829 ) -> std::task::Poll<Option<Self::Item>> {
5830 let this = &mut *self;
5831 if this.inner.check_shutdown(cx) {
5832 this.is_terminated = true;
5833 return std::task::Poll::Ready(None);
5834 }
5835 if this.is_terminated {
5836 panic!("polled AudioCoreRequestStream after completion");
5837 }
5838 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5839 |bytes, handles| {
5840 match this.inner.channel().read_etc(cx, bytes, handles) {
5841 std::task::Poll::Ready(Ok(())) => {}
5842 std::task::Poll::Pending => return std::task::Poll::Pending,
5843 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5844 this.is_terminated = true;
5845 return std::task::Poll::Ready(None);
5846 }
5847 std::task::Poll::Ready(Err(e)) => {
5848 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5849 e.into(),
5850 ))))
5851 }
5852 }
5853
5854 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5856
5857 std::task::Poll::Ready(Some(match header.ordinal {
5858 0x2ac9beba47f83435 => {
5859 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5860 let mut req = fidl::new_empty!(
5861 AudioCoreCreateAudioRendererRequest,
5862 fidl::encoding::DefaultFuchsiaResourceDialect
5863 );
5864 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreCreateAudioRendererRequest>(&header, _body_bytes, handles, &mut req)?;
5865 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
5866 Ok(AudioCoreRequest::CreateAudioRenderer {
5867 audio_out_request: req.audio_out_request,
5868
5869 control_handle,
5870 })
5871 }
5872 0x459de383b0d76d97 => {
5873 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5874 let mut req = fidl::new_empty!(
5875 AudioCoreCreateAudioCapturerWithConfigurationRequest,
5876 fidl::encoding::DefaultFuchsiaResourceDialect
5877 );
5878 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreCreateAudioCapturerWithConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
5879 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
5880 Ok(AudioCoreRequest::CreateAudioCapturerWithConfiguration {
5881 stream_type: req.stream_type,
5882 configuration: req.configuration,
5883 audio_capturer_request: req.audio_capturer_request,
5884
5885 control_handle,
5886 })
5887 }
5888 0x787db169df99aed0 => {
5889 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5890 let mut req = fidl::new_empty!(
5891 AudioCoreCreateAudioCapturerRequest,
5892 fidl::encoding::DefaultFuchsiaResourceDialect
5893 );
5894 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreCreateAudioCapturerRequest>(&header, _body_bytes, handles, &mut req)?;
5895 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
5896 Ok(AudioCoreRequest::CreateAudioCapturer {
5897 loopback: req.loopback,
5898 audio_in_request: req.audio_in_request,
5899
5900 control_handle,
5901 })
5902 }
5903 0x41107a1917269b3e => {
5904 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5905 let mut req = fidl::new_empty!(
5906 AudioCoreEnableDeviceSettingsRequest,
5907 fidl::encoding::DefaultFuchsiaResourceDialect
5908 );
5909 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreEnableDeviceSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
5910 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
5911 Ok(AudioCoreRequest::EnableDeviceSettings {
5912 enabled: req.enabled,
5913
5914 control_handle,
5915 })
5916 }
5917 0x48097f45f6e2b8e7 => {
5918 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5919 let mut req = fidl::new_empty!(
5920 AudioCoreSetRenderUsageGainRequest,
5921 fidl::encoding::DefaultFuchsiaResourceDialect
5922 );
5923 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreSetRenderUsageGainRequest>(&header, _body_bytes, handles, &mut req)?;
5924 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
5925 Ok(AudioCoreRequest::SetRenderUsageGain {
5926 usage: req.usage,
5927 gain_db: req.gain_db,
5928
5929 control_handle,
5930 })
5931 }
5932 0x779b1531dc9e64f4 => {
5933 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5934 let mut req = fidl::new_empty!(
5935 AudioCoreSetRenderUsageGain2Request,
5936 fidl::encoding::DefaultFuchsiaResourceDialect
5937 );
5938 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreSetRenderUsageGain2Request>(&header, _body_bytes, handles, &mut req)?;
5939 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
5940 Ok(AudioCoreRequest::SetRenderUsageGain2 {
5941 usage: req.usage,
5942 gain_db: req.gain_db,
5943
5944 control_handle,
5945 })
5946 }
5947 0x457d29217d4ea248 => {
5948 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5949 let mut req = fidl::new_empty!(
5950 AudioCoreSetCaptureUsageGainRequest,
5951 fidl::encoding::DefaultFuchsiaResourceDialect
5952 );
5953 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreSetCaptureUsageGainRequest>(&header, _body_bytes, handles, &mut req)?;
5954 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
5955 Ok(AudioCoreRequest::SetCaptureUsageGain {
5956 usage: req.usage,
5957 gain_db: req.gain_db,
5958
5959 control_handle,
5960 })
5961 }
5962 0x15065ee308f44af0 => {
5963 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5964 let mut req = fidl::new_empty!(
5965 AudioCoreSetCaptureUsageGain2Request,
5966 fidl::encoding::DefaultFuchsiaResourceDialect
5967 );
5968 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreSetCaptureUsageGain2Request>(&header, _body_bytes, handles, &mut req)?;
5969 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
5970 Ok(AudioCoreRequest::SetCaptureUsageGain2 {
5971 usage: req.usage,
5972 gain_db: req.gain_db,
5973
5974 control_handle,
5975 })
5976 }
5977 0x7225be116aadc137 => {
5978 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5979 let mut req = fidl::new_empty!(
5980 AudioCoreBindUsageVolumeControlRequest,
5981 fidl::encoding::DefaultFuchsiaResourceDialect
5982 );
5983 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreBindUsageVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
5984 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
5985 Ok(AudioCoreRequest::BindUsageVolumeControl {
5986 usage: req.usage,
5987 volume_control: req.volume_control,
5988
5989 control_handle,
5990 })
5991 }
5992 0x729dff93019d055 => {
5993 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5994 let mut req = fidl::new_empty!(
5995 AudioCoreBindUsageVolumeControl2Request,
5996 fidl::encoding::DefaultFuchsiaResourceDialect
5997 );
5998 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreBindUsageVolumeControl2Request>(&header, _body_bytes, handles, &mut req)?;
5999 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
6000 Ok(AudioCoreRequest::BindUsageVolumeControl2 {
6001 usage: req.usage,
6002 volume_control: req.volume_control,
6003
6004 control_handle,
6005 })
6006 }
6007 0x50e3ca45509770bf => {
6008 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6009 let mut req = fidl::new_empty!(
6010 AudioCoreGetVolumeFromDbRequest,
6011 fidl::encoding::DefaultFuchsiaResourceDialect
6012 );
6013 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreGetVolumeFromDbRequest>(&header, _body_bytes, handles, &mut req)?;
6014 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
6015 Ok(AudioCoreRequest::GetVolumeFromDb {
6016 usage: req.usage,
6017 gain_db: req.gain_db,
6018
6019 responder: AudioCoreGetVolumeFromDbResponder {
6020 control_handle: std::mem::ManuallyDrop::new(control_handle),
6021 tx_id: header.tx_id,
6022 },
6023 })
6024 }
6025 0x165c811091ef99da => {
6026 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6027 let mut req = fidl::new_empty!(
6028 AudioCoreGetVolumeFromDb2Request,
6029 fidl::encoding::DefaultFuchsiaResourceDialect
6030 );
6031 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreGetVolumeFromDb2Request>(&header, _body_bytes, handles, &mut req)?;
6032 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
6033 Ok(AudioCoreRequest::GetVolumeFromDb2 {
6034 usage: req.usage,
6035 gain_db: req.gain_db,
6036
6037 responder: AudioCoreGetVolumeFromDb2Responder {
6038 control_handle: std::mem::ManuallyDrop::new(control_handle),
6039 tx_id: header.tx_id,
6040 },
6041 })
6042 }
6043 0x3e8eec27dd5a8bda => {
6044 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6045 let mut req = fidl::new_empty!(
6046 AudioCoreGetDbFromVolumeRequest,
6047 fidl::encoding::DefaultFuchsiaResourceDialect
6048 );
6049 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreGetDbFromVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
6050 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
6051 Ok(AudioCoreRequest::GetDbFromVolume {
6052 usage: req.usage,
6053 volume: req.volume,
6054
6055 responder: AudioCoreGetDbFromVolumeResponder {
6056 control_handle: std::mem::ManuallyDrop::new(control_handle),
6057 tx_id: header.tx_id,
6058 },
6059 })
6060 }
6061 0x5f421a8ebf265bf3 => {
6062 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6063 let mut req = fidl::new_empty!(
6064 AudioCoreGetDbFromVolume2Request,
6065 fidl::encoding::DefaultFuchsiaResourceDialect
6066 );
6067 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreGetDbFromVolume2Request>(&header, _body_bytes, handles, &mut req)?;
6068 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
6069 Ok(AudioCoreRequest::GetDbFromVolume2 {
6070 usage: req.usage,
6071 volume: req.volume,
6072
6073 responder: AudioCoreGetDbFromVolume2Responder {
6074 control_handle: std::mem::ManuallyDrop::new(control_handle),
6075 tx_id: header.tx_id,
6076 },
6077 })
6078 }
6079 0x7bfed14345ece7b7 => {
6080 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6081 let mut req = fidl::new_empty!(
6082 AudioCoreSetInteractionRequest,
6083 fidl::encoding::DefaultFuchsiaResourceDialect
6084 );
6085 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreSetInteractionRequest>(&header, _body_bytes, handles, &mut req)?;
6086 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
6087 Ok(AudioCoreRequest::SetInteraction {
6088 active: req.active,
6089 affected: req.affected,
6090 behavior: req.behavior,
6091
6092 control_handle,
6093 })
6094 }
6095 0x7226c7c6e6edc62f => {
6096 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6097 let mut req = fidl::new_empty!(
6098 AudioCoreSetInteraction2Request,
6099 fidl::encoding::DefaultFuchsiaResourceDialect
6100 );
6101 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioCoreSetInteraction2Request>(&header, _body_bytes, handles, &mut req)?;
6102 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
6103 Ok(AudioCoreRequest::SetInteraction2 {
6104 active: req.active,
6105 affected: req.affected,
6106 behavior: req.behavior,
6107
6108 control_handle,
6109 })
6110 }
6111 0x65bd94d9d0a28b5e => {
6112 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6113 let mut req = fidl::new_empty!(
6114 fidl::encoding::EmptyPayload,
6115 fidl::encoding::DefaultFuchsiaResourceDialect
6116 );
6117 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6118 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
6119 Ok(AudioCoreRequest::ResetInteractions { control_handle })
6120 }
6121 0x54a0bebca85f6b31 => {
6122 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6123 let mut req = fidl::new_empty!(
6124 fidl::encoding::EmptyPayload,
6125 fidl::encoding::DefaultFuchsiaResourceDialect
6126 );
6127 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6128 let control_handle = AudioCoreControlHandle { inner: this.inner.clone() };
6129 Ok(AudioCoreRequest::LoadDefaults { control_handle })
6130 }
6131 _ if header.tx_id == 0
6132 && header
6133 .dynamic_flags()
6134 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6135 {
6136 Ok(AudioCoreRequest::_UnknownMethod {
6137 ordinal: header.ordinal,
6138 control_handle: AudioCoreControlHandle { inner: this.inner.clone() },
6139 method_type: fidl::MethodType::OneWay,
6140 })
6141 }
6142 _ if header
6143 .dynamic_flags()
6144 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6145 {
6146 this.inner.send_framework_err(
6147 fidl::encoding::FrameworkErr::UnknownMethod,
6148 header.tx_id,
6149 header.ordinal,
6150 header.dynamic_flags(),
6151 (bytes, handles),
6152 )?;
6153 Ok(AudioCoreRequest::_UnknownMethod {
6154 ordinal: header.ordinal,
6155 control_handle: AudioCoreControlHandle { inner: this.inner.clone() },
6156 method_type: fidl::MethodType::TwoWay,
6157 })
6158 }
6159 _ => Err(fidl::Error::UnknownOrdinal {
6160 ordinal: header.ordinal,
6161 protocol_name:
6162 <AudioCoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6163 }),
6164 }))
6165 },
6166 )
6167 }
6168}
6169
6170#[derive(Debug)]
6171pub enum AudioCoreRequest {
6172 CreateAudioRenderer {
6174 audio_out_request: fidl::endpoints::ServerEnd<AudioRendererMarker>,
6175 control_handle: AudioCoreControlHandle,
6176 },
6177 CreateAudioCapturerWithConfiguration {
6189 stream_type: AudioStreamType,
6190 configuration: AudioCapturerConfiguration,
6191 audio_capturer_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
6192 control_handle: AudioCoreControlHandle,
6193 },
6194 CreateAudioCapturer {
6198 loopback: bool,
6199 audio_in_request: fidl::endpoints::ServerEnd<AudioCapturerMarker>,
6200 control_handle: AudioCoreControlHandle,
6201 },
6202 EnableDeviceSettings {
6203 enabled: bool,
6204 control_handle: AudioCoreControlHandle,
6205 },
6206 SetRenderUsageGain {
6208 usage: AudioRenderUsage,
6209 gain_db: f32,
6210 control_handle: AudioCoreControlHandle,
6211 },
6212 SetRenderUsageGain2 {
6214 usage: AudioRenderUsage2,
6215 gain_db: f32,
6216 control_handle: AudioCoreControlHandle,
6217 },
6218 SetCaptureUsageGain {
6220 usage: AudioCaptureUsage,
6221 gain_db: f32,
6222 control_handle: AudioCoreControlHandle,
6223 },
6224 SetCaptureUsageGain2 {
6226 usage: AudioCaptureUsage2,
6227 gain_db: f32,
6228 control_handle: AudioCoreControlHandle,
6229 },
6230 BindUsageVolumeControl {
6232 usage: Usage,
6233 volume_control: fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
6234 control_handle: AudioCoreControlHandle,
6235 },
6236 BindUsageVolumeControl2 {
6238 usage: Usage2,
6239 volume_control: fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
6240 control_handle: AudioCoreControlHandle,
6241 },
6242 GetVolumeFromDb {
6246 usage: Usage,
6247 gain_db: f32,
6248 responder: AudioCoreGetVolumeFromDbResponder,
6249 },
6250 GetVolumeFromDb2 {
6254 usage: Usage2,
6255 gain_db: f32,
6256 responder: AudioCoreGetVolumeFromDb2Responder,
6257 },
6258 GetDbFromVolume {
6261 usage: Usage,
6262 volume: f32,
6263 responder: AudioCoreGetDbFromVolumeResponder,
6264 },
6265 GetDbFromVolume2 {
6268 usage: Usage2,
6269 volume: f32,
6270 responder: AudioCoreGetDbFromVolume2Responder,
6271 },
6272 SetInteraction {
6276 active: Usage,
6277 affected: Usage,
6278 behavior: Behavior,
6279 control_handle: AudioCoreControlHandle,
6280 },
6281 SetInteraction2 {
6285 active: Usage2,
6286 affected: Usage2,
6287 behavior: Behavior,
6288 control_handle: AudioCoreControlHandle,
6289 },
6290 ResetInteractions {
6293 control_handle: AudioCoreControlHandle,
6294 },
6295 LoadDefaults {
6298 control_handle: AudioCoreControlHandle,
6299 },
6300 #[non_exhaustive]
6302 _UnknownMethod {
6303 ordinal: u64,
6305 control_handle: AudioCoreControlHandle,
6306 method_type: fidl::MethodType,
6307 },
6308}
6309
6310impl AudioCoreRequest {
6311 #[allow(irrefutable_let_patterns)]
6312 pub fn into_create_audio_renderer(
6313 self,
6314 ) -> Option<(fidl::endpoints::ServerEnd<AudioRendererMarker>, AudioCoreControlHandle)> {
6315 if let AudioCoreRequest::CreateAudioRenderer { audio_out_request, control_handle } = self {
6316 Some((audio_out_request, control_handle))
6317 } else {
6318 None
6319 }
6320 }
6321
6322 #[allow(irrefutable_let_patterns)]
6323 pub fn into_create_audio_capturer_with_configuration(
6324 self,
6325 ) -> Option<(
6326 AudioStreamType,
6327 AudioCapturerConfiguration,
6328 fidl::endpoints::ServerEnd<AudioCapturerMarker>,
6329 AudioCoreControlHandle,
6330 )> {
6331 if let AudioCoreRequest::CreateAudioCapturerWithConfiguration {
6332 stream_type,
6333 configuration,
6334 audio_capturer_request,
6335 control_handle,
6336 } = self
6337 {
6338 Some((stream_type, configuration, audio_capturer_request, control_handle))
6339 } else {
6340 None
6341 }
6342 }
6343
6344 #[allow(irrefutable_let_patterns)]
6345 pub fn into_create_audio_capturer(
6346 self,
6347 ) -> Option<(bool, fidl::endpoints::ServerEnd<AudioCapturerMarker>, AudioCoreControlHandle)>
6348 {
6349 if let AudioCoreRequest::CreateAudioCapturer {
6350 loopback,
6351 audio_in_request,
6352 control_handle,
6353 } = self
6354 {
6355 Some((loopback, audio_in_request, control_handle))
6356 } else {
6357 None
6358 }
6359 }
6360
6361 #[allow(irrefutable_let_patterns)]
6362 pub fn into_enable_device_settings(self) -> Option<(bool, AudioCoreControlHandle)> {
6363 if let AudioCoreRequest::EnableDeviceSettings { enabled, control_handle } = self {
6364 Some((enabled, control_handle))
6365 } else {
6366 None
6367 }
6368 }
6369
6370 #[allow(irrefutable_let_patterns)]
6371 pub fn into_set_render_usage_gain(
6372 self,
6373 ) -> Option<(AudioRenderUsage, f32, AudioCoreControlHandle)> {
6374 if let AudioCoreRequest::SetRenderUsageGain { usage, gain_db, control_handle } = self {
6375 Some((usage, gain_db, control_handle))
6376 } else {
6377 None
6378 }
6379 }
6380
6381 #[allow(irrefutable_let_patterns)]
6382 pub fn into_set_render_usage_gain2(
6383 self,
6384 ) -> Option<(AudioRenderUsage2, f32, AudioCoreControlHandle)> {
6385 if let AudioCoreRequest::SetRenderUsageGain2 { usage, gain_db, control_handle } = self {
6386 Some((usage, gain_db, control_handle))
6387 } else {
6388 None
6389 }
6390 }
6391
6392 #[allow(irrefutable_let_patterns)]
6393 pub fn into_set_capture_usage_gain(
6394 self,
6395 ) -> Option<(AudioCaptureUsage, f32, AudioCoreControlHandle)> {
6396 if let AudioCoreRequest::SetCaptureUsageGain { usage, gain_db, control_handle } = self {
6397 Some((usage, gain_db, control_handle))
6398 } else {
6399 None
6400 }
6401 }
6402
6403 #[allow(irrefutable_let_patterns)]
6404 pub fn into_set_capture_usage_gain2(
6405 self,
6406 ) -> Option<(AudioCaptureUsage2, f32, AudioCoreControlHandle)> {
6407 if let AudioCoreRequest::SetCaptureUsageGain2 { usage, gain_db, control_handle } = self {
6408 Some((usage, gain_db, control_handle))
6409 } else {
6410 None
6411 }
6412 }
6413
6414 #[allow(irrefutable_let_patterns)]
6415 pub fn into_bind_usage_volume_control(
6416 self,
6417 ) -> Option<(
6418 Usage,
6419 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
6420 AudioCoreControlHandle,
6421 )> {
6422 if let AudioCoreRequest::BindUsageVolumeControl { usage, volume_control, control_handle } =
6423 self
6424 {
6425 Some((usage, volume_control, control_handle))
6426 } else {
6427 None
6428 }
6429 }
6430
6431 #[allow(irrefutable_let_patterns)]
6432 pub fn into_bind_usage_volume_control2(
6433 self,
6434 ) -> Option<(
6435 Usage2,
6436 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
6437 AudioCoreControlHandle,
6438 )> {
6439 if let AudioCoreRequest::BindUsageVolumeControl2 { usage, volume_control, control_handle } =
6440 self
6441 {
6442 Some((usage, volume_control, control_handle))
6443 } else {
6444 None
6445 }
6446 }
6447
6448 #[allow(irrefutable_let_patterns)]
6449 pub fn into_get_volume_from_db(
6450 self,
6451 ) -> Option<(Usage, f32, AudioCoreGetVolumeFromDbResponder)> {
6452 if let AudioCoreRequest::GetVolumeFromDb { usage, gain_db, responder } = self {
6453 Some((usage, gain_db, responder))
6454 } else {
6455 None
6456 }
6457 }
6458
6459 #[allow(irrefutable_let_patterns)]
6460 pub fn into_get_volume_from_db2(
6461 self,
6462 ) -> Option<(Usage2, f32, AudioCoreGetVolumeFromDb2Responder)> {
6463 if let AudioCoreRequest::GetVolumeFromDb2 { usage, gain_db, responder } = self {
6464 Some((usage, gain_db, responder))
6465 } else {
6466 None
6467 }
6468 }
6469
6470 #[allow(irrefutable_let_patterns)]
6471 pub fn into_get_db_from_volume(
6472 self,
6473 ) -> Option<(Usage, f32, AudioCoreGetDbFromVolumeResponder)> {
6474 if let AudioCoreRequest::GetDbFromVolume { usage, volume, responder } = self {
6475 Some((usage, volume, responder))
6476 } else {
6477 None
6478 }
6479 }
6480
6481 #[allow(irrefutable_let_patterns)]
6482 pub fn into_get_db_from_volume2(
6483 self,
6484 ) -> Option<(Usage2, f32, AudioCoreGetDbFromVolume2Responder)> {
6485 if let AudioCoreRequest::GetDbFromVolume2 { usage, volume, responder } = self {
6486 Some((usage, volume, responder))
6487 } else {
6488 None
6489 }
6490 }
6491
6492 #[allow(irrefutable_let_patterns)]
6493 pub fn into_set_interaction(self) -> Option<(Usage, Usage, Behavior, AudioCoreControlHandle)> {
6494 if let AudioCoreRequest::SetInteraction { active, affected, behavior, control_handle } =
6495 self
6496 {
6497 Some((active, affected, behavior, control_handle))
6498 } else {
6499 None
6500 }
6501 }
6502
6503 #[allow(irrefutable_let_patterns)]
6504 pub fn into_set_interaction2(
6505 self,
6506 ) -> Option<(Usage2, Usage2, Behavior, AudioCoreControlHandle)> {
6507 if let AudioCoreRequest::SetInteraction2 { active, affected, behavior, control_handle } =
6508 self
6509 {
6510 Some((active, affected, behavior, control_handle))
6511 } else {
6512 None
6513 }
6514 }
6515
6516 #[allow(irrefutable_let_patterns)]
6517 pub fn into_reset_interactions(self) -> Option<(AudioCoreControlHandle)> {
6518 if let AudioCoreRequest::ResetInteractions { control_handle } = self {
6519 Some((control_handle))
6520 } else {
6521 None
6522 }
6523 }
6524
6525 #[allow(irrefutable_let_patterns)]
6526 pub fn into_load_defaults(self) -> Option<(AudioCoreControlHandle)> {
6527 if let AudioCoreRequest::LoadDefaults { control_handle } = self {
6528 Some((control_handle))
6529 } else {
6530 None
6531 }
6532 }
6533
6534 pub fn method_name(&self) -> &'static str {
6536 match *self {
6537 AudioCoreRequest::CreateAudioRenderer { .. } => "create_audio_renderer",
6538 AudioCoreRequest::CreateAudioCapturerWithConfiguration { .. } => {
6539 "create_audio_capturer_with_configuration"
6540 }
6541 AudioCoreRequest::CreateAudioCapturer { .. } => "create_audio_capturer",
6542 AudioCoreRequest::EnableDeviceSettings { .. } => "enable_device_settings",
6543 AudioCoreRequest::SetRenderUsageGain { .. } => "set_render_usage_gain",
6544 AudioCoreRequest::SetRenderUsageGain2 { .. } => "set_render_usage_gain2",
6545 AudioCoreRequest::SetCaptureUsageGain { .. } => "set_capture_usage_gain",
6546 AudioCoreRequest::SetCaptureUsageGain2 { .. } => "set_capture_usage_gain2",
6547 AudioCoreRequest::BindUsageVolumeControl { .. } => "bind_usage_volume_control",
6548 AudioCoreRequest::BindUsageVolumeControl2 { .. } => "bind_usage_volume_control2",
6549 AudioCoreRequest::GetVolumeFromDb { .. } => "get_volume_from_db",
6550 AudioCoreRequest::GetVolumeFromDb2 { .. } => "get_volume_from_db2",
6551 AudioCoreRequest::GetDbFromVolume { .. } => "get_db_from_volume",
6552 AudioCoreRequest::GetDbFromVolume2 { .. } => "get_db_from_volume2",
6553 AudioCoreRequest::SetInteraction { .. } => "set_interaction",
6554 AudioCoreRequest::SetInteraction2 { .. } => "set_interaction2",
6555 AudioCoreRequest::ResetInteractions { .. } => "reset_interactions",
6556 AudioCoreRequest::LoadDefaults { .. } => "load_defaults",
6557 AudioCoreRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
6558 "unknown one-way method"
6559 }
6560 AudioCoreRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
6561 "unknown two-way method"
6562 }
6563 }
6564 }
6565}
6566
6567#[derive(Debug, Clone)]
6568pub struct AudioCoreControlHandle {
6569 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6570}
6571
6572impl fidl::endpoints::ControlHandle for AudioCoreControlHandle {
6573 fn shutdown(&self) {
6574 self.inner.shutdown()
6575 }
6576 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6577 self.inner.shutdown_with_epitaph(status)
6578 }
6579
6580 fn is_closed(&self) -> bool {
6581 self.inner.channel().is_closed()
6582 }
6583 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6584 self.inner.channel().on_closed()
6585 }
6586
6587 #[cfg(target_os = "fuchsia")]
6588 fn signal_peer(
6589 &self,
6590 clear_mask: zx::Signals,
6591 set_mask: zx::Signals,
6592 ) -> Result<(), zx_status::Status> {
6593 use fidl::Peered;
6594 self.inner.channel().signal_peer(clear_mask, set_mask)
6595 }
6596}
6597
6598impl AudioCoreControlHandle {}
6599
6600#[must_use = "FIDL methods require a response to be sent"]
6601#[derive(Debug)]
6602pub struct AudioCoreGetVolumeFromDbResponder {
6603 control_handle: std::mem::ManuallyDrop<AudioCoreControlHandle>,
6604 tx_id: u32,
6605}
6606
6607impl std::ops::Drop for AudioCoreGetVolumeFromDbResponder {
6611 fn drop(&mut self) {
6612 self.control_handle.shutdown();
6613 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6615 }
6616}
6617
6618impl fidl::endpoints::Responder for AudioCoreGetVolumeFromDbResponder {
6619 type ControlHandle = AudioCoreControlHandle;
6620
6621 fn control_handle(&self) -> &AudioCoreControlHandle {
6622 &self.control_handle
6623 }
6624
6625 fn drop_without_shutdown(mut self) {
6626 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6628 std::mem::forget(self);
6630 }
6631}
6632
6633impl AudioCoreGetVolumeFromDbResponder {
6634 pub fn send(self, mut volume: f32) -> Result<(), fidl::Error> {
6638 let _result = self.send_raw(volume);
6639 if _result.is_err() {
6640 self.control_handle.shutdown();
6641 }
6642 self.drop_without_shutdown();
6643 _result
6644 }
6645
6646 pub fn send_no_shutdown_on_err(self, mut volume: f32) -> Result<(), fidl::Error> {
6648 let _result = self.send_raw(volume);
6649 self.drop_without_shutdown();
6650 _result
6651 }
6652
6653 fn send_raw(&self, mut volume: f32) -> Result<(), fidl::Error> {
6654 self.control_handle.inner.send::<AudioCoreGetVolumeFromDbResponse>(
6655 (volume,),
6656 self.tx_id,
6657 0x50e3ca45509770bf,
6658 fidl::encoding::DynamicFlags::empty(),
6659 )
6660 }
6661}
6662
6663#[must_use = "FIDL methods require a response to be sent"]
6664#[derive(Debug)]
6665pub struct AudioCoreGetVolumeFromDb2Responder {
6666 control_handle: std::mem::ManuallyDrop<AudioCoreControlHandle>,
6667 tx_id: u32,
6668}
6669
6670impl std::ops::Drop for AudioCoreGetVolumeFromDb2Responder {
6674 fn drop(&mut self) {
6675 self.control_handle.shutdown();
6676 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6678 }
6679}
6680
6681impl fidl::endpoints::Responder for AudioCoreGetVolumeFromDb2Responder {
6682 type ControlHandle = AudioCoreControlHandle;
6683
6684 fn control_handle(&self) -> &AudioCoreControlHandle {
6685 &self.control_handle
6686 }
6687
6688 fn drop_without_shutdown(mut self) {
6689 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6691 std::mem::forget(self);
6693 }
6694}
6695
6696impl AudioCoreGetVolumeFromDb2Responder {
6697 pub fn send(self, mut volume: f32) -> Result<(), fidl::Error> {
6701 let _result = self.send_raw(volume);
6702 if _result.is_err() {
6703 self.control_handle.shutdown();
6704 }
6705 self.drop_without_shutdown();
6706 _result
6707 }
6708
6709 pub fn send_no_shutdown_on_err(self, mut volume: f32) -> Result<(), fidl::Error> {
6711 let _result = self.send_raw(volume);
6712 self.drop_without_shutdown();
6713 _result
6714 }
6715
6716 fn send_raw(&self, mut volume: f32) -> Result<(), fidl::Error> {
6717 self.control_handle
6718 .inner
6719 .send::<fidl::encoding::FlexibleType<AudioCoreGetVolumeFromDb2Response>>(
6720 fidl::encoding::Flexible::new((volume,)),
6721 self.tx_id,
6722 0x165c811091ef99da,
6723 fidl::encoding::DynamicFlags::FLEXIBLE,
6724 )
6725 }
6726}
6727
6728#[must_use = "FIDL methods require a response to be sent"]
6729#[derive(Debug)]
6730pub struct AudioCoreGetDbFromVolumeResponder {
6731 control_handle: std::mem::ManuallyDrop<AudioCoreControlHandle>,
6732 tx_id: u32,
6733}
6734
6735impl std::ops::Drop for AudioCoreGetDbFromVolumeResponder {
6739 fn drop(&mut self) {
6740 self.control_handle.shutdown();
6741 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6743 }
6744}
6745
6746impl fidl::endpoints::Responder for AudioCoreGetDbFromVolumeResponder {
6747 type ControlHandle = AudioCoreControlHandle;
6748
6749 fn control_handle(&self) -> &AudioCoreControlHandle {
6750 &self.control_handle
6751 }
6752
6753 fn drop_without_shutdown(mut self) {
6754 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6756 std::mem::forget(self);
6758 }
6759}
6760
6761impl AudioCoreGetDbFromVolumeResponder {
6762 pub fn send(self, mut gain_db: f32) -> Result<(), fidl::Error> {
6766 let _result = self.send_raw(gain_db);
6767 if _result.is_err() {
6768 self.control_handle.shutdown();
6769 }
6770 self.drop_without_shutdown();
6771 _result
6772 }
6773
6774 pub fn send_no_shutdown_on_err(self, mut gain_db: f32) -> Result<(), fidl::Error> {
6776 let _result = self.send_raw(gain_db);
6777 self.drop_without_shutdown();
6778 _result
6779 }
6780
6781 fn send_raw(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
6782 self.control_handle.inner.send::<AudioCoreGetDbFromVolumeResponse>(
6783 (gain_db,),
6784 self.tx_id,
6785 0x3e8eec27dd5a8bda,
6786 fidl::encoding::DynamicFlags::empty(),
6787 )
6788 }
6789}
6790
6791#[must_use = "FIDL methods require a response to be sent"]
6792#[derive(Debug)]
6793pub struct AudioCoreGetDbFromVolume2Responder {
6794 control_handle: std::mem::ManuallyDrop<AudioCoreControlHandle>,
6795 tx_id: u32,
6796}
6797
6798impl std::ops::Drop for AudioCoreGetDbFromVolume2Responder {
6802 fn drop(&mut self) {
6803 self.control_handle.shutdown();
6804 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6806 }
6807}
6808
6809impl fidl::endpoints::Responder for AudioCoreGetDbFromVolume2Responder {
6810 type ControlHandle = AudioCoreControlHandle;
6811
6812 fn control_handle(&self) -> &AudioCoreControlHandle {
6813 &self.control_handle
6814 }
6815
6816 fn drop_without_shutdown(mut self) {
6817 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6819 std::mem::forget(self);
6821 }
6822}
6823
6824impl AudioCoreGetDbFromVolume2Responder {
6825 pub fn send(self, mut gain_db: f32) -> Result<(), fidl::Error> {
6829 let _result = self.send_raw(gain_db);
6830 if _result.is_err() {
6831 self.control_handle.shutdown();
6832 }
6833 self.drop_without_shutdown();
6834 _result
6835 }
6836
6837 pub fn send_no_shutdown_on_err(self, mut gain_db: f32) -> Result<(), fidl::Error> {
6839 let _result = self.send_raw(gain_db);
6840 self.drop_without_shutdown();
6841 _result
6842 }
6843
6844 fn send_raw(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
6845 self.control_handle
6846 .inner
6847 .send::<fidl::encoding::FlexibleType<AudioCoreGetDbFromVolume2Response>>(
6848 fidl::encoding::Flexible::new((gain_db,)),
6849 self.tx_id,
6850 0x5f421a8ebf265bf3,
6851 fidl::encoding::DynamicFlags::FLEXIBLE,
6852 )
6853 }
6854}
6855
6856#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6857pub struct AudioDeviceEnumeratorMarker;
6858
6859impl fidl::endpoints::ProtocolMarker for AudioDeviceEnumeratorMarker {
6860 type Proxy = AudioDeviceEnumeratorProxy;
6861 type RequestStream = AudioDeviceEnumeratorRequestStream;
6862 #[cfg(target_os = "fuchsia")]
6863 type SynchronousProxy = AudioDeviceEnumeratorSynchronousProxy;
6864
6865 const DEBUG_NAME: &'static str = "fuchsia.media.AudioDeviceEnumerator";
6866}
6867impl fidl::endpoints::DiscoverableProtocolMarker for AudioDeviceEnumeratorMarker {}
6868
6869pub trait AudioDeviceEnumeratorProxyInterface: Send + Sync {
6870 type GetDevicesResponseFut: std::future::Future<Output = Result<Vec<AudioDeviceInfo>, fidl::Error>>
6871 + Send;
6872 fn r#get_devices(&self) -> Self::GetDevicesResponseFut;
6873 type GetDeviceGainResponseFut: std::future::Future<Output = Result<(u64, AudioGainInfo), fidl::Error>>
6874 + Send;
6875 fn r#get_device_gain(&self, device_token: u64) -> Self::GetDeviceGainResponseFut;
6876 fn r#set_device_gain(
6877 &self,
6878 device_token: u64,
6879 gain_info: &AudioGainInfo,
6880 valid_flags: AudioGainValidFlags,
6881 ) -> Result<(), fidl::Error>;
6882 fn r#add_device_by_channel(
6883 &self,
6884 device_name: &str,
6885 is_input: bool,
6886 channel: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
6887 ) -> Result<(), fidl::Error>;
6888}
6889#[derive(Debug)]
6890#[cfg(target_os = "fuchsia")]
6891pub struct AudioDeviceEnumeratorSynchronousProxy {
6892 client: fidl::client::sync::Client,
6893}
6894
6895#[cfg(target_os = "fuchsia")]
6896impl fidl::endpoints::SynchronousProxy for AudioDeviceEnumeratorSynchronousProxy {
6897 type Proxy = AudioDeviceEnumeratorProxy;
6898 type Protocol = AudioDeviceEnumeratorMarker;
6899
6900 fn from_channel(inner: fidl::Channel) -> Self {
6901 Self::new(inner)
6902 }
6903
6904 fn into_channel(self) -> fidl::Channel {
6905 self.client.into_channel()
6906 }
6907
6908 fn as_channel(&self) -> &fidl::Channel {
6909 self.client.as_channel()
6910 }
6911}
6912
6913#[cfg(target_os = "fuchsia")]
6914impl AudioDeviceEnumeratorSynchronousProxy {
6915 pub fn new(channel: fidl::Channel) -> Self {
6916 let protocol_name =
6917 <AudioDeviceEnumeratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6918 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6919 }
6920
6921 pub fn into_channel(self) -> fidl::Channel {
6922 self.client.into_channel()
6923 }
6924
6925 pub fn wait_for_event(
6928 &self,
6929 deadline: zx::MonotonicInstant,
6930 ) -> Result<AudioDeviceEnumeratorEvent, fidl::Error> {
6931 AudioDeviceEnumeratorEvent::decode(self.client.wait_for_event(deadline)?)
6932 }
6933
6934 pub fn r#get_devices(
6936 &self,
6937 ___deadline: zx::MonotonicInstant,
6938 ) -> Result<Vec<AudioDeviceInfo>, fidl::Error> {
6939 let _response = self
6940 .client
6941 .send_query::<fidl::encoding::EmptyPayload, AudioDeviceEnumeratorGetDevicesResponse>(
6942 (),
6943 0x4ce1aa218aeb12a6,
6944 fidl::encoding::DynamicFlags::empty(),
6945 ___deadline,
6946 )?;
6947 Ok(_response.devices)
6948 }
6949
6950 pub fn r#get_device_gain(
6970 &self,
6971 mut device_token: u64,
6972 ___deadline: zx::MonotonicInstant,
6973 ) -> Result<(u64, AudioGainInfo), fidl::Error> {
6974 let _response = self.client.send_query::<
6975 AudioDeviceEnumeratorGetDeviceGainRequest,
6976 AudioDeviceEnumeratorGetDeviceGainResponse,
6977 >(
6978 (device_token,),
6979 0x25dd4723403c414b,
6980 fidl::encoding::DynamicFlags::empty(),
6981 ___deadline,
6982 )?;
6983 Ok((_response.device_token, _response.gain_info))
6984 }
6985
6986 pub fn r#set_device_gain(
6987 &self,
6988 mut device_token: u64,
6989 mut gain_info: &AudioGainInfo,
6990 mut valid_flags: AudioGainValidFlags,
6991 ) -> Result<(), fidl::Error> {
6992 self.client.send::<AudioDeviceEnumeratorSetDeviceGainRequest>(
6993 (device_token, gain_info, valid_flags),
6994 0x5bdabc8ebe83591,
6995 fidl::encoding::DynamicFlags::empty(),
6996 )
6997 }
6998
6999 pub fn r#add_device_by_channel(
7006 &self,
7007 mut device_name: &str,
7008 mut is_input: bool,
7009 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
7010 ) -> Result<(), fidl::Error> {
7011 self.client.send::<AudioDeviceEnumeratorAddDeviceByChannelRequest>(
7012 (device_name, is_input, channel),
7013 0x72cdbada4d70ed67,
7014 fidl::encoding::DynamicFlags::empty(),
7015 )
7016 }
7017}
7018
7019#[cfg(target_os = "fuchsia")]
7020impl From<AudioDeviceEnumeratorSynchronousProxy> for zx::Handle {
7021 fn from(value: AudioDeviceEnumeratorSynchronousProxy) -> Self {
7022 value.into_channel().into()
7023 }
7024}
7025
7026#[cfg(target_os = "fuchsia")]
7027impl From<fidl::Channel> for AudioDeviceEnumeratorSynchronousProxy {
7028 fn from(value: fidl::Channel) -> Self {
7029 Self::new(value)
7030 }
7031}
7032
7033#[derive(Debug, Clone)]
7034pub struct AudioDeviceEnumeratorProxy {
7035 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7036}
7037
7038impl fidl::endpoints::Proxy for AudioDeviceEnumeratorProxy {
7039 type Protocol = AudioDeviceEnumeratorMarker;
7040
7041 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7042 Self::new(inner)
7043 }
7044
7045 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7046 self.client.into_channel().map_err(|client| Self { client })
7047 }
7048
7049 fn as_channel(&self) -> &::fidl::AsyncChannel {
7050 self.client.as_channel()
7051 }
7052}
7053
7054impl AudioDeviceEnumeratorProxy {
7055 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7057 let protocol_name =
7058 <AudioDeviceEnumeratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7059 Self { client: fidl::client::Client::new(channel, protocol_name) }
7060 }
7061
7062 pub fn take_event_stream(&self) -> AudioDeviceEnumeratorEventStream {
7068 AudioDeviceEnumeratorEventStream { event_receiver: self.client.take_event_receiver() }
7069 }
7070
7071 pub fn r#get_devices(
7073 &self,
7074 ) -> fidl::client::QueryResponseFut<
7075 Vec<AudioDeviceInfo>,
7076 fidl::encoding::DefaultFuchsiaResourceDialect,
7077 > {
7078 AudioDeviceEnumeratorProxyInterface::r#get_devices(self)
7079 }
7080
7081 pub fn r#get_device_gain(
7101 &self,
7102 mut device_token: u64,
7103 ) -> fidl::client::QueryResponseFut<
7104 (u64, AudioGainInfo),
7105 fidl::encoding::DefaultFuchsiaResourceDialect,
7106 > {
7107 AudioDeviceEnumeratorProxyInterface::r#get_device_gain(self, device_token)
7108 }
7109
7110 pub fn r#set_device_gain(
7111 &self,
7112 mut device_token: u64,
7113 mut gain_info: &AudioGainInfo,
7114 mut valid_flags: AudioGainValidFlags,
7115 ) -> Result<(), fidl::Error> {
7116 AudioDeviceEnumeratorProxyInterface::r#set_device_gain(
7117 self,
7118 device_token,
7119 gain_info,
7120 valid_flags,
7121 )
7122 }
7123
7124 pub fn r#add_device_by_channel(
7131 &self,
7132 mut device_name: &str,
7133 mut is_input: bool,
7134 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
7135 ) -> Result<(), fidl::Error> {
7136 AudioDeviceEnumeratorProxyInterface::r#add_device_by_channel(
7137 self,
7138 device_name,
7139 is_input,
7140 channel,
7141 )
7142 }
7143}
7144
7145impl AudioDeviceEnumeratorProxyInterface for AudioDeviceEnumeratorProxy {
7146 type GetDevicesResponseFut = fidl::client::QueryResponseFut<
7147 Vec<AudioDeviceInfo>,
7148 fidl::encoding::DefaultFuchsiaResourceDialect,
7149 >;
7150 fn r#get_devices(&self) -> Self::GetDevicesResponseFut {
7151 fn _decode(
7152 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7153 ) -> Result<Vec<AudioDeviceInfo>, fidl::Error> {
7154 let _response = fidl::client::decode_transaction_body::<
7155 AudioDeviceEnumeratorGetDevicesResponse,
7156 fidl::encoding::DefaultFuchsiaResourceDialect,
7157 0x4ce1aa218aeb12a6,
7158 >(_buf?)?;
7159 Ok(_response.devices)
7160 }
7161 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<AudioDeviceInfo>>(
7162 (),
7163 0x4ce1aa218aeb12a6,
7164 fidl::encoding::DynamicFlags::empty(),
7165 _decode,
7166 )
7167 }
7168
7169 type GetDeviceGainResponseFut = fidl::client::QueryResponseFut<
7170 (u64, AudioGainInfo),
7171 fidl::encoding::DefaultFuchsiaResourceDialect,
7172 >;
7173 fn r#get_device_gain(&self, mut device_token: u64) -> Self::GetDeviceGainResponseFut {
7174 fn _decode(
7175 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7176 ) -> Result<(u64, AudioGainInfo), fidl::Error> {
7177 let _response = fidl::client::decode_transaction_body::<
7178 AudioDeviceEnumeratorGetDeviceGainResponse,
7179 fidl::encoding::DefaultFuchsiaResourceDialect,
7180 0x25dd4723403c414b,
7181 >(_buf?)?;
7182 Ok((_response.device_token, _response.gain_info))
7183 }
7184 self.client.send_query_and_decode::<
7185 AudioDeviceEnumeratorGetDeviceGainRequest,
7186 (u64, AudioGainInfo),
7187 >(
7188 (device_token,),
7189 0x25dd4723403c414b,
7190 fidl::encoding::DynamicFlags::empty(),
7191 _decode,
7192 )
7193 }
7194
7195 fn r#set_device_gain(
7196 &self,
7197 mut device_token: u64,
7198 mut gain_info: &AudioGainInfo,
7199 mut valid_flags: AudioGainValidFlags,
7200 ) -> Result<(), fidl::Error> {
7201 self.client.send::<AudioDeviceEnumeratorSetDeviceGainRequest>(
7202 (device_token, gain_info, valid_flags),
7203 0x5bdabc8ebe83591,
7204 fidl::encoding::DynamicFlags::empty(),
7205 )
7206 }
7207
7208 fn r#add_device_by_channel(
7209 &self,
7210 mut device_name: &str,
7211 mut is_input: bool,
7212 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
7213 ) -> Result<(), fidl::Error> {
7214 self.client.send::<AudioDeviceEnumeratorAddDeviceByChannelRequest>(
7215 (device_name, is_input, channel),
7216 0x72cdbada4d70ed67,
7217 fidl::encoding::DynamicFlags::empty(),
7218 )
7219 }
7220}
7221
7222pub struct AudioDeviceEnumeratorEventStream {
7223 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7224}
7225
7226impl std::marker::Unpin for AudioDeviceEnumeratorEventStream {}
7227
7228impl futures::stream::FusedStream for AudioDeviceEnumeratorEventStream {
7229 fn is_terminated(&self) -> bool {
7230 self.event_receiver.is_terminated()
7231 }
7232}
7233
7234impl futures::Stream for AudioDeviceEnumeratorEventStream {
7235 type Item = Result<AudioDeviceEnumeratorEvent, fidl::Error>;
7236
7237 fn poll_next(
7238 mut self: std::pin::Pin<&mut Self>,
7239 cx: &mut std::task::Context<'_>,
7240 ) -> std::task::Poll<Option<Self::Item>> {
7241 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7242 &mut self.event_receiver,
7243 cx
7244 )?) {
7245 Some(buf) => std::task::Poll::Ready(Some(AudioDeviceEnumeratorEvent::decode(buf))),
7246 None => std::task::Poll::Ready(None),
7247 }
7248 }
7249}
7250
7251#[derive(Debug)]
7252pub enum AudioDeviceEnumeratorEvent {
7253 OnDeviceAdded { device: AudioDeviceInfo },
7254 OnDeviceRemoved { device_token: u64 },
7255 OnDeviceGainChanged { device_token: u64, gain_info: AudioGainInfo },
7256 OnDefaultDeviceChanged { old_default_token: u64, new_default_token: u64 },
7257}
7258
7259impl AudioDeviceEnumeratorEvent {
7260 #[allow(irrefutable_let_patterns)]
7261 pub fn into_on_device_added(self) -> Option<AudioDeviceInfo> {
7262 if let AudioDeviceEnumeratorEvent::OnDeviceAdded { device } = self {
7263 Some((device))
7264 } else {
7265 None
7266 }
7267 }
7268 #[allow(irrefutable_let_patterns)]
7269 pub fn into_on_device_removed(self) -> Option<u64> {
7270 if let AudioDeviceEnumeratorEvent::OnDeviceRemoved { device_token } = self {
7271 Some((device_token))
7272 } else {
7273 None
7274 }
7275 }
7276 #[allow(irrefutable_let_patterns)]
7277 pub fn into_on_device_gain_changed(self) -> Option<(u64, AudioGainInfo)> {
7278 if let AudioDeviceEnumeratorEvent::OnDeviceGainChanged { device_token, gain_info } = self {
7279 Some((device_token, gain_info))
7280 } else {
7281 None
7282 }
7283 }
7284 #[allow(irrefutable_let_patterns)]
7285 pub fn into_on_default_device_changed(self) -> Option<(u64, u64)> {
7286 if let AudioDeviceEnumeratorEvent::OnDefaultDeviceChanged {
7287 old_default_token,
7288 new_default_token,
7289 } = self
7290 {
7291 Some((old_default_token, new_default_token))
7292 } else {
7293 None
7294 }
7295 }
7296
7297 fn decode(
7299 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7300 ) -> Result<AudioDeviceEnumeratorEvent, fidl::Error> {
7301 let (bytes, _handles) = buf.split_mut();
7302 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7303 debug_assert_eq!(tx_header.tx_id, 0);
7304 match tx_header.ordinal {
7305 0xe0fbe40057c4b44 => {
7306 let mut out = fidl::new_empty!(
7307 AudioDeviceEnumeratorOnDeviceAddedRequest,
7308 fidl::encoding::DefaultFuchsiaResourceDialect
7309 );
7310 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorOnDeviceAddedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
7311 Ok((AudioDeviceEnumeratorEvent::OnDeviceAdded { device: out.device }))
7312 }
7313 0x6f3b7574463d9ff8 => {
7314 let mut out = fidl::new_empty!(
7315 AudioDeviceEnumeratorOnDeviceRemovedRequest,
7316 fidl::encoding::DefaultFuchsiaResourceDialect
7317 );
7318 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorOnDeviceRemovedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
7319 Ok((AudioDeviceEnumeratorEvent::OnDeviceRemoved { device_token: out.device_token }))
7320 }
7321 0x14aefcbbb076b0e9 => {
7322 let mut out = fidl::new_empty!(
7323 AudioDeviceEnumeratorOnDeviceGainChangedRequest,
7324 fidl::encoding::DefaultFuchsiaResourceDialect
7325 );
7326 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorOnDeviceGainChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
7327 Ok((AudioDeviceEnumeratorEvent::OnDeviceGainChanged {
7328 device_token: out.device_token,
7329 gain_info: out.gain_info,
7330 }))
7331 }
7332 0x16357b42d4c16e11 => {
7333 let mut out = fidl::new_empty!(
7334 AudioDeviceEnumeratorOnDefaultDeviceChangedRequest,
7335 fidl::encoding::DefaultFuchsiaResourceDialect
7336 );
7337 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorOnDefaultDeviceChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
7338 Ok((AudioDeviceEnumeratorEvent::OnDefaultDeviceChanged {
7339 old_default_token: out.old_default_token,
7340 new_default_token: out.new_default_token,
7341 }))
7342 }
7343 _ => Err(fidl::Error::UnknownOrdinal {
7344 ordinal: tx_header.ordinal,
7345 protocol_name:
7346 <AudioDeviceEnumeratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7347 }),
7348 }
7349 }
7350}
7351
7352pub struct AudioDeviceEnumeratorRequestStream {
7354 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7355 is_terminated: bool,
7356}
7357
7358impl std::marker::Unpin for AudioDeviceEnumeratorRequestStream {}
7359
7360impl futures::stream::FusedStream for AudioDeviceEnumeratorRequestStream {
7361 fn is_terminated(&self) -> bool {
7362 self.is_terminated
7363 }
7364}
7365
7366impl fidl::endpoints::RequestStream for AudioDeviceEnumeratorRequestStream {
7367 type Protocol = AudioDeviceEnumeratorMarker;
7368 type ControlHandle = AudioDeviceEnumeratorControlHandle;
7369
7370 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7371 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7372 }
7373
7374 fn control_handle(&self) -> Self::ControlHandle {
7375 AudioDeviceEnumeratorControlHandle { inner: self.inner.clone() }
7376 }
7377
7378 fn into_inner(
7379 self,
7380 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7381 {
7382 (self.inner, self.is_terminated)
7383 }
7384
7385 fn from_inner(
7386 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7387 is_terminated: bool,
7388 ) -> Self {
7389 Self { inner, is_terminated }
7390 }
7391}
7392
7393impl futures::Stream for AudioDeviceEnumeratorRequestStream {
7394 type Item = Result<AudioDeviceEnumeratorRequest, fidl::Error>;
7395
7396 fn poll_next(
7397 mut self: std::pin::Pin<&mut Self>,
7398 cx: &mut std::task::Context<'_>,
7399 ) -> std::task::Poll<Option<Self::Item>> {
7400 let this = &mut *self;
7401 if this.inner.check_shutdown(cx) {
7402 this.is_terminated = true;
7403 return std::task::Poll::Ready(None);
7404 }
7405 if this.is_terminated {
7406 panic!("polled AudioDeviceEnumeratorRequestStream after completion");
7407 }
7408 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7409 |bytes, handles| {
7410 match this.inner.channel().read_etc(cx, bytes, handles) {
7411 std::task::Poll::Ready(Ok(())) => {}
7412 std::task::Poll::Pending => return std::task::Poll::Pending,
7413 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7414 this.is_terminated = true;
7415 return std::task::Poll::Ready(None);
7416 }
7417 std::task::Poll::Ready(Err(e)) => {
7418 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7419 e.into(),
7420 ))))
7421 }
7422 }
7423
7424 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7426
7427 std::task::Poll::Ready(Some(match header.ordinal {
7428 0x4ce1aa218aeb12a6 => {
7429 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7430 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7431 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7432 let control_handle = AudioDeviceEnumeratorControlHandle {
7433 inner: this.inner.clone(),
7434 };
7435 Ok(AudioDeviceEnumeratorRequest::GetDevices {
7436 responder: AudioDeviceEnumeratorGetDevicesResponder {
7437 control_handle: std::mem::ManuallyDrop::new(control_handle),
7438 tx_id: header.tx_id,
7439 },
7440 })
7441 }
7442 0x25dd4723403c414b => {
7443 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7444 let mut req = fidl::new_empty!(AudioDeviceEnumeratorGetDeviceGainRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7445 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorGetDeviceGainRequest>(&header, _body_bytes, handles, &mut req)?;
7446 let control_handle = AudioDeviceEnumeratorControlHandle {
7447 inner: this.inner.clone(),
7448 };
7449 Ok(AudioDeviceEnumeratorRequest::GetDeviceGain {device_token: req.device_token,
7450
7451 responder: AudioDeviceEnumeratorGetDeviceGainResponder {
7452 control_handle: std::mem::ManuallyDrop::new(control_handle),
7453 tx_id: header.tx_id,
7454 },
7455 })
7456 }
7457 0x5bdabc8ebe83591 => {
7458 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7459 let mut req = fidl::new_empty!(AudioDeviceEnumeratorSetDeviceGainRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7460 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorSetDeviceGainRequest>(&header, _body_bytes, handles, &mut req)?;
7461 let control_handle = AudioDeviceEnumeratorControlHandle {
7462 inner: this.inner.clone(),
7463 };
7464 Ok(AudioDeviceEnumeratorRequest::SetDeviceGain {device_token: req.device_token,
7465gain_info: req.gain_info,
7466valid_flags: req.valid_flags,
7467
7468 control_handle,
7469 })
7470 }
7471 0x72cdbada4d70ed67 => {
7472 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7473 let mut req = fidl::new_empty!(AudioDeviceEnumeratorAddDeviceByChannelRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7474 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDeviceEnumeratorAddDeviceByChannelRequest>(&header, _body_bytes, handles, &mut req)?;
7475 let control_handle = AudioDeviceEnumeratorControlHandle {
7476 inner: this.inner.clone(),
7477 };
7478 Ok(AudioDeviceEnumeratorRequest::AddDeviceByChannel {device_name: req.device_name,
7479is_input: req.is_input,
7480channel: req.channel,
7481
7482 control_handle,
7483 })
7484 }
7485 _ => Err(fidl::Error::UnknownOrdinal {
7486 ordinal: header.ordinal,
7487 protocol_name: <AudioDeviceEnumeratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7488 }),
7489 }))
7490 },
7491 )
7492 }
7493}
7494
7495#[derive(Debug)]
7496pub enum AudioDeviceEnumeratorRequest {
7497 GetDevices { responder: AudioDeviceEnumeratorGetDevicesResponder },
7499 GetDeviceGain { device_token: u64, responder: AudioDeviceEnumeratorGetDeviceGainResponder },
7519 SetDeviceGain {
7520 device_token: u64,
7521 gain_info: AudioGainInfo,
7522 valid_flags: AudioGainValidFlags,
7523 control_handle: AudioDeviceEnumeratorControlHandle,
7524 },
7525 AddDeviceByChannel {
7532 device_name: String,
7533 is_input: bool,
7534 channel: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
7535 control_handle: AudioDeviceEnumeratorControlHandle,
7536 },
7537}
7538
7539impl AudioDeviceEnumeratorRequest {
7540 #[allow(irrefutable_let_patterns)]
7541 pub fn into_get_devices(self) -> Option<(AudioDeviceEnumeratorGetDevicesResponder)> {
7542 if let AudioDeviceEnumeratorRequest::GetDevices { responder } = self {
7543 Some((responder))
7544 } else {
7545 None
7546 }
7547 }
7548
7549 #[allow(irrefutable_let_patterns)]
7550 pub fn into_get_device_gain(
7551 self,
7552 ) -> Option<(u64, AudioDeviceEnumeratorGetDeviceGainResponder)> {
7553 if let AudioDeviceEnumeratorRequest::GetDeviceGain { device_token, responder } = self {
7554 Some((device_token, responder))
7555 } else {
7556 None
7557 }
7558 }
7559
7560 #[allow(irrefutable_let_patterns)]
7561 pub fn into_set_device_gain(
7562 self,
7563 ) -> Option<(u64, AudioGainInfo, AudioGainValidFlags, AudioDeviceEnumeratorControlHandle)> {
7564 if let AudioDeviceEnumeratorRequest::SetDeviceGain {
7565 device_token,
7566 gain_info,
7567 valid_flags,
7568 control_handle,
7569 } = self
7570 {
7571 Some((device_token, gain_info, valid_flags, control_handle))
7572 } else {
7573 None
7574 }
7575 }
7576
7577 #[allow(irrefutable_let_patterns)]
7578 pub fn into_add_device_by_channel(
7579 self,
7580 ) -> Option<(
7581 String,
7582 bool,
7583 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
7584 AudioDeviceEnumeratorControlHandle,
7585 )> {
7586 if let AudioDeviceEnumeratorRequest::AddDeviceByChannel {
7587 device_name,
7588 is_input,
7589 channel,
7590 control_handle,
7591 } = self
7592 {
7593 Some((device_name, is_input, channel, control_handle))
7594 } else {
7595 None
7596 }
7597 }
7598
7599 pub fn method_name(&self) -> &'static str {
7601 match *self {
7602 AudioDeviceEnumeratorRequest::GetDevices { .. } => "get_devices",
7603 AudioDeviceEnumeratorRequest::GetDeviceGain { .. } => "get_device_gain",
7604 AudioDeviceEnumeratorRequest::SetDeviceGain { .. } => "set_device_gain",
7605 AudioDeviceEnumeratorRequest::AddDeviceByChannel { .. } => "add_device_by_channel",
7606 }
7607 }
7608}
7609
7610#[derive(Debug, Clone)]
7611pub struct AudioDeviceEnumeratorControlHandle {
7612 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7613}
7614
7615impl fidl::endpoints::ControlHandle for AudioDeviceEnumeratorControlHandle {
7616 fn shutdown(&self) {
7617 self.inner.shutdown()
7618 }
7619 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7620 self.inner.shutdown_with_epitaph(status)
7621 }
7622
7623 fn is_closed(&self) -> bool {
7624 self.inner.channel().is_closed()
7625 }
7626 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7627 self.inner.channel().on_closed()
7628 }
7629
7630 #[cfg(target_os = "fuchsia")]
7631 fn signal_peer(
7632 &self,
7633 clear_mask: zx::Signals,
7634 set_mask: zx::Signals,
7635 ) -> Result<(), zx_status::Status> {
7636 use fidl::Peered;
7637 self.inner.channel().signal_peer(clear_mask, set_mask)
7638 }
7639}
7640
7641impl AudioDeviceEnumeratorControlHandle {
7642 pub fn send_on_device_added(&self, mut device: &AudioDeviceInfo) -> Result<(), fidl::Error> {
7643 self.inner.send::<AudioDeviceEnumeratorOnDeviceAddedRequest>(
7644 (device,),
7645 0,
7646 0xe0fbe40057c4b44,
7647 fidl::encoding::DynamicFlags::empty(),
7648 )
7649 }
7650
7651 pub fn send_on_device_removed(&self, mut device_token: u64) -> Result<(), fidl::Error> {
7652 self.inner.send::<AudioDeviceEnumeratorOnDeviceRemovedRequest>(
7653 (device_token,),
7654 0,
7655 0x6f3b7574463d9ff8,
7656 fidl::encoding::DynamicFlags::empty(),
7657 )
7658 }
7659
7660 pub fn send_on_device_gain_changed(
7661 &self,
7662 mut device_token: u64,
7663 mut gain_info: &AudioGainInfo,
7664 ) -> Result<(), fidl::Error> {
7665 self.inner.send::<AudioDeviceEnumeratorOnDeviceGainChangedRequest>(
7666 (device_token, gain_info),
7667 0,
7668 0x14aefcbbb076b0e9,
7669 fidl::encoding::DynamicFlags::empty(),
7670 )
7671 }
7672
7673 pub fn send_on_default_device_changed(
7674 &self,
7675 mut old_default_token: u64,
7676 mut new_default_token: u64,
7677 ) -> Result<(), fidl::Error> {
7678 self.inner.send::<AudioDeviceEnumeratorOnDefaultDeviceChangedRequest>(
7679 (old_default_token, new_default_token),
7680 0,
7681 0x16357b42d4c16e11,
7682 fidl::encoding::DynamicFlags::empty(),
7683 )
7684 }
7685}
7686
7687#[must_use = "FIDL methods require a response to be sent"]
7688#[derive(Debug)]
7689pub struct AudioDeviceEnumeratorGetDevicesResponder {
7690 control_handle: std::mem::ManuallyDrop<AudioDeviceEnumeratorControlHandle>,
7691 tx_id: u32,
7692}
7693
7694impl std::ops::Drop for AudioDeviceEnumeratorGetDevicesResponder {
7698 fn drop(&mut self) {
7699 self.control_handle.shutdown();
7700 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7702 }
7703}
7704
7705impl fidl::endpoints::Responder for AudioDeviceEnumeratorGetDevicesResponder {
7706 type ControlHandle = AudioDeviceEnumeratorControlHandle;
7707
7708 fn control_handle(&self) -> &AudioDeviceEnumeratorControlHandle {
7709 &self.control_handle
7710 }
7711
7712 fn drop_without_shutdown(mut self) {
7713 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7715 std::mem::forget(self);
7717 }
7718}
7719
7720impl AudioDeviceEnumeratorGetDevicesResponder {
7721 pub fn send(self, mut devices: &[AudioDeviceInfo]) -> Result<(), fidl::Error> {
7725 let _result = self.send_raw(devices);
7726 if _result.is_err() {
7727 self.control_handle.shutdown();
7728 }
7729 self.drop_without_shutdown();
7730 _result
7731 }
7732
7733 pub fn send_no_shutdown_on_err(
7735 self,
7736 mut devices: &[AudioDeviceInfo],
7737 ) -> Result<(), fidl::Error> {
7738 let _result = self.send_raw(devices);
7739 self.drop_without_shutdown();
7740 _result
7741 }
7742
7743 fn send_raw(&self, mut devices: &[AudioDeviceInfo]) -> Result<(), fidl::Error> {
7744 self.control_handle.inner.send::<AudioDeviceEnumeratorGetDevicesResponse>(
7745 (devices,),
7746 self.tx_id,
7747 0x4ce1aa218aeb12a6,
7748 fidl::encoding::DynamicFlags::empty(),
7749 )
7750 }
7751}
7752
7753#[must_use = "FIDL methods require a response to be sent"]
7754#[derive(Debug)]
7755pub struct AudioDeviceEnumeratorGetDeviceGainResponder {
7756 control_handle: std::mem::ManuallyDrop<AudioDeviceEnumeratorControlHandle>,
7757 tx_id: u32,
7758}
7759
7760impl std::ops::Drop for AudioDeviceEnumeratorGetDeviceGainResponder {
7764 fn drop(&mut self) {
7765 self.control_handle.shutdown();
7766 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7768 }
7769}
7770
7771impl fidl::endpoints::Responder for AudioDeviceEnumeratorGetDeviceGainResponder {
7772 type ControlHandle = AudioDeviceEnumeratorControlHandle;
7773
7774 fn control_handle(&self) -> &AudioDeviceEnumeratorControlHandle {
7775 &self.control_handle
7776 }
7777
7778 fn drop_without_shutdown(mut self) {
7779 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7781 std::mem::forget(self);
7783 }
7784}
7785
7786impl AudioDeviceEnumeratorGetDeviceGainResponder {
7787 pub fn send(
7791 self,
7792 mut device_token: u64,
7793 mut gain_info: &AudioGainInfo,
7794 ) -> Result<(), fidl::Error> {
7795 let _result = self.send_raw(device_token, gain_info);
7796 if _result.is_err() {
7797 self.control_handle.shutdown();
7798 }
7799 self.drop_without_shutdown();
7800 _result
7801 }
7802
7803 pub fn send_no_shutdown_on_err(
7805 self,
7806 mut device_token: u64,
7807 mut gain_info: &AudioGainInfo,
7808 ) -> Result<(), fidl::Error> {
7809 let _result = self.send_raw(device_token, gain_info);
7810 self.drop_without_shutdown();
7811 _result
7812 }
7813
7814 fn send_raw(
7815 &self,
7816 mut device_token: u64,
7817 mut gain_info: &AudioGainInfo,
7818 ) -> Result<(), fidl::Error> {
7819 self.control_handle.inner.send::<AudioDeviceEnumeratorGetDeviceGainResponse>(
7820 (device_token, gain_info),
7821 self.tx_id,
7822 0x25dd4723403c414b,
7823 fidl::encoding::DynamicFlags::empty(),
7824 )
7825 }
7826}
7827
7828#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7829pub struct AudioRendererMarker;
7830
7831impl fidl::endpoints::ProtocolMarker for AudioRendererMarker {
7832 type Proxy = AudioRendererProxy;
7833 type RequestStream = AudioRendererRequestStream;
7834 #[cfg(target_os = "fuchsia")]
7835 type SynchronousProxy = AudioRendererSynchronousProxy;
7836
7837 const DEBUG_NAME: &'static str = "fuchsia.media.AudioRenderer";
7838}
7839impl fidl::endpoints::DiscoverableProtocolMarker for AudioRendererMarker {}
7840
7841pub trait AudioRendererProxyInterface: Send + Sync {
7842 fn r#add_payload_buffer(&self, id: u32, payload_buffer: fidl::Vmo) -> Result<(), fidl::Error>;
7843 fn r#remove_payload_buffer(&self, id: u32) -> Result<(), fidl::Error>;
7844 type SendPacketResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
7845 fn r#send_packet(&self, packet: &StreamPacket) -> Self::SendPacketResponseFut;
7846 fn r#send_packet_no_reply(&self, packet: &StreamPacket) -> Result<(), fidl::Error>;
7847 fn r#end_of_stream(&self) -> Result<(), fidl::Error>;
7848 type DiscardAllPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
7849 fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut;
7850 fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error>;
7851 fn r#bind_gain_control(
7852 &self,
7853 gain_control_request: fidl::endpoints::ServerEnd<
7854 fidl_fuchsia_media_audio::GainControlMarker,
7855 >,
7856 ) -> Result<(), fidl::Error>;
7857 fn r#set_pts_units(
7858 &self,
7859 tick_per_second_numerator: u32,
7860 tick_per_second_denominator: u32,
7861 ) -> Result<(), fidl::Error>;
7862 fn r#set_pts_continuity_threshold(&self, threshold_seconds: f32) -> Result<(), fidl::Error>;
7863 type GetReferenceClockResponseFut: std::future::Future<Output = Result<fidl::Clock, fidl::Error>>
7864 + Send;
7865 fn r#get_reference_clock(&self) -> Self::GetReferenceClockResponseFut;
7866 fn r#set_reference_clock(
7867 &self,
7868 reference_clock: Option<fidl::Clock>,
7869 ) -> Result<(), fidl::Error>;
7870 fn r#set_usage(&self, usage: AudioRenderUsage) -> Result<(), fidl::Error>;
7871 fn r#set_usage2(&self, usage2: AudioRenderUsage2) -> Result<(), fidl::Error>;
7872 fn r#set_pcm_stream_type(&self, type_: &AudioStreamType) -> Result<(), fidl::Error>;
7873 fn r#enable_min_lead_time_events(&self, enabled: bool) -> Result<(), fidl::Error>;
7874 type GetMinLeadTimeResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
7875 fn r#get_min_lead_time(&self) -> Self::GetMinLeadTimeResponseFut;
7876 type PlayResponseFut: std::future::Future<Output = Result<(i64, i64), fidl::Error>> + Send;
7877 fn r#play(&self, reference_time: i64, media_time: i64) -> Self::PlayResponseFut;
7878 fn r#play_no_reply(&self, reference_time: i64, media_time: i64) -> Result<(), fidl::Error>;
7879 type PauseResponseFut: std::future::Future<Output = Result<(i64, i64), fidl::Error>> + Send;
7880 fn r#pause(&self) -> Self::PauseResponseFut;
7881 fn r#pause_no_reply(&self) -> Result<(), fidl::Error>;
7882}
7883#[derive(Debug)]
7884#[cfg(target_os = "fuchsia")]
7885pub struct AudioRendererSynchronousProxy {
7886 client: fidl::client::sync::Client,
7887}
7888
7889#[cfg(target_os = "fuchsia")]
7890impl fidl::endpoints::SynchronousProxy for AudioRendererSynchronousProxy {
7891 type Proxy = AudioRendererProxy;
7892 type Protocol = AudioRendererMarker;
7893
7894 fn from_channel(inner: fidl::Channel) -> Self {
7895 Self::new(inner)
7896 }
7897
7898 fn into_channel(self) -> fidl::Channel {
7899 self.client.into_channel()
7900 }
7901
7902 fn as_channel(&self) -> &fidl::Channel {
7903 self.client.as_channel()
7904 }
7905}
7906
7907#[cfg(target_os = "fuchsia")]
7908impl AudioRendererSynchronousProxy {
7909 pub fn new(channel: fidl::Channel) -> Self {
7910 let protocol_name = <AudioRendererMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7911 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7912 }
7913
7914 pub fn into_channel(self) -> fidl::Channel {
7915 self.client.into_channel()
7916 }
7917
7918 pub fn wait_for_event(
7921 &self,
7922 deadline: zx::MonotonicInstant,
7923 ) -> Result<AudioRendererEvent, fidl::Error> {
7924 AudioRendererEvent::decode(self.client.wait_for_event(deadline)?)
7925 }
7926
7927 pub fn r#add_payload_buffer(
7934 &self,
7935 mut id: u32,
7936 mut payload_buffer: fidl::Vmo,
7937 ) -> Result<(), fidl::Error> {
7938 self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
7939 (id, payload_buffer),
7940 0x3b3a37fc34fe5b56,
7941 fidl::encoding::DynamicFlags::empty(),
7942 )
7943 }
7944
7945 pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
7951 self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
7952 (id,),
7953 0x5d1e4f74c3658262,
7954 fidl::encoding::DynamicFlags::empty(),
7955 )
7956 }
7957
7958 pub fn r#send_packet(
7964 &self,
7965 mut packet: &StreamPacket,
7966 ___deadline: zx::MonotonicInstant,
7967 ) -> Result<(), fidl::Error> {
7968 let _response =
7969 self.client.send_query::<StreamSinkSendPacketRequest, fidl::encoding::EmptyPayload>(
7970 (packet,),
7971 0x67cddd607442775f,
7972 fidl::encoding::DynamicFlags::empty(),
7973 ___deadline,
7974 )?;
7975 Ok(_response)
7976 }
7977
7978 pub fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
7985 self.client.send::<StreamSinkSendPacketNoReplyRequest>(
7986 (packet,),
7987 0x8d9b8b413ceba9d,
7988 fidl::encoding::DynamicFlags::empty(),
7989 )
7990 }
7991
7992 pub fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
7995 self.client.send::<fidl::encoding::EmptyPayload>(
7996 (),
7997 0x6180fd6f7e793b71,
7998 fidl::encoding::DynamicFlags::empty(),
7999 )
8000 }
8001
8002 pub fn r#discard_all_packets(
8006 &self,
8007 ___deadline: zx::MonotonicInstant,
8008 ) -> Result<(), fidl::Error> {
8009 let _response =
8010 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
8011 (),
8012 0x6f4dad7af2917665,
8013 fidl::encoding::DynamicFlags::empty(),
8014 ___deadline,
8015 )?;
8016 Ok(_response)
8017 }
8018
8019 pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
8022 self.client.send::<fidl::encoding::EmptyPayload>(
8023 (),
8024 0x50d36d0d23081bc4,
8025 fidl::encoding::DynamicFlags::empty(),
8026 )
8027 }
8028
8029 pub fn r#bind_gain_control(
8031 &self,
8032 mut gain_control_request: fidl::endpoints::ServerEnd<
8033 fidl_fuchsia_media_audio::GainControlMarker,
8034 >,
8035 ) -> Result<(), fidl::Error> {
8036 self.client.send::<AudioRendererBindGainControlRequest>(
8037 (gain_control_request,),
8038 0x293f5c7f8fba2bdc,
8039 fidl::encoding::DynamicFlags::empty(),
8040 )
8041 }
8042
8043 pub fn r#set_pts_units(
8047 &self,
8048 mut tick_per_second_numerator: u32,
8049 mut tick_per_second_denominator: u32,
8050 ) -> Result<(), fidl::Error> {
8051 self.client.send::<AudioRendererSetPtsUnitsRequest>(
8052 (tick_per_second_numerator, tick_per_second_denominator),
8053 0xf68cd108785a27c,
8054 fidl::encoding::DynamicFlags::empty(),
8055 )
8056 }
8057
8058 pub fn r#set_pts_continuity_threshold(
8124 &self,
8125 mut threshold_seconds: f32,
8126 ) -> Result<(), fidl::Error> {
8127 self.client.send::<AudioRendererSetPtsContinuityThresholdRequest>(
8128 (threshold_seconds,),
8129 0x2849ba571d1971ba,
8130 fidl::encoding::DynamicFlags::empty(),
8131 )
8132 }
8133
8134 pub fn r#get_reference_clock(
8137 &self,
8138 ___deadline: zx::MonotonicInstant,
8139 ) -> Result<fidl::Clock, fidl::Error> {
8140 let _response = self
8141 .client
8142 .send_query::<fidl::encoding::EmptyPayload, AudioRendererGetReferenceClockResponse>(
8143 (),
8144 0x2f7a7f011a172f7e,
8145 fidl::encoding::DynamicFlags::empty(),
8146 ___deadline,
8147 )?;
8148 Ok(_response.reference_clock)
8149 }
8150
8151 pub fn r#set_reference_clock(
8163 &self,
8164 mut reference_clock: Option<fidl::Clock>,
8165 ) -> Result<(), fidl::Error> {
8166 self.client.send::<AudioRendererSetReferenceClockRequest>(
8167 (reference_clock,),
8168 0x39acd05d832b5fed,
8169 fidl::encoding::DynamicFlags::empty(),
8170 )
8171 }
8172
8173 pub fn r#set_usage(&self, mut usage: AudioRenderUsage) -> Result<(), fidl::Error> {
8176 self.client.send::<AudioRendererSetUsageRequest>(
8177 (usage,),
8178 0x3994bd23b55a733e,
8179 fidl::encoding::DynamicFlags::empty(),
8180 )
8181 }
8182
8183 pub fn r#set_usage2(&self, mut usage2: AudioRenderUsage2) -> Result<(), fidl::Error> {
8186 self.client.send::<AudioRendererSetUsage2Request>(
8187 (usage2,),
8188 0x2904035c7132b103,
8189 fidl::encoding::DynamicFlags::FLEXIBLE,
8190 )
8191 }
8192
8193 pub fn r#set_pcm_stream_type(&self, mut type_: &AudioStreamType) -> Result<(), fidl::Error> {
8200 self.client.send::<AudioRendererSetPcmStreamTypeRequest>(
8201 (type_,),
8202 0x27aa715d8901fa19,
8203 fidl::encoding::DynamicFlags::empty(),
8204 )
8205 }
8206
8207 pub fn r#enable_min_lead_time_events(&self, mut enabled: bool) -> Result<(), fidl::Error> {
8235 self.client.send::<AudioRendererEnableMinLeadTimeEventsRequest>(
8236 (enabled,),
8237 0x62808dfad72bf890,
8238 fidl::encoding::DynamicFlags::empty(),
8239 )
8240 }
8241
8242 pub fn r#get_min_lead_time(
8250 &self,
8251 ___deadline: zx::MonotonicInstant,
8252 ) -> Result<i64, fidl::Error> {
8253 let _response = self
8254 .client
8255 .send_query::<fidl::encoding::EmptyPayload, AudioRendererGetMinLeadTimeResponse>(
8256 (),
8257 0x1cf3c3ecd8fec26b,
8258 fidl::encoding::DynamicFlags::empty(),
8259 ___deadline,
8260 )?;
8261 Ok(_response.min_lead_time_nsec)
8262 }
8263
8264 pub fn r#play(
8368 &self,
8369 mut reference_time: i64,
8370 mut media_time: i64,
8371 ___deadline: zx::MonotonicInstant,
8372 ) -> Result<(i64, i64), fidl::Error> {
8373 let _response =
8374 self.client.send_query::<AudioRendererPlayRequest, AudioRendererPlayResponse>(
8375 (reference_time, media_time),
8376 0x3c0162db084f74a3,
8377 fidl::encoding::DynamicFlags::empty(),
8378 ___deadline,
8379 )?;
8380 Ok((_response.reference_time, _response.media_time))
8381 }
8382
8383 pub fn r#play_no_reply(
8384 &self,
8385 mut reference_time: i64,
8386 mut media_time: i64,
8387 ) -> Result<(), fidl::Error> {
8388 self.client.send::<AudioRendererPlayNoReplyRequest>(
8389 (reference_time, media_time),
8390 0x1b7fe832b68c22ef,
8391 fidl::encoding::DynamicFlags::empty(),
8392 )
8393 }
8394
8395 pub fn r#pause(&self, ___deadline: zx::MonotonicInstant) -> Result<(i64, i64), fidl::Error> {
8402 let _response =
8403 self.client.send_query::<fidl::encoding::EmptyPayload, AudioRendererPauseResponse>(
8404 (),
8405 0x41d557588d93d153,
8406 fidl::encoding::DynamicFlags::empty(),
8407 ___deadline,
8408 )?;
8409 Ok((_response.reference_time, _response.media_time))
8410 }
8411
8412 pub fn r#pause_no_reply(&self) -> Result<(), fidl::Error> {
8413 self.client.send::<fidl::encoding::EmptyPayload>(
8414 (),
8415 0x24cc45d4f3855ab,
8416 fidl::encoding::DynamicFlags::empty(),
8417 )
8418 }
8419}
8420
8421#[cfg(target_os = "fuchsia")]
8422impl From<AudioRendererSynchronousProxy> for zx::Handle {
8423 fn from(value: AudioRendererSynchronousProxy) -> Self {
8424 value.into_channel().into()
8425 }
8426}
8427
8428#[cfg(target_os = "fuchsia")]
8429impl From<fidl::Channel> for AudioRendererSynchronousProxy {
8430 fn from(value: fidl::Channel) -> Self {
8431 Self::new(value)
8432 }
8433}
8434
8435#[derive(Debug, Clone)]
8436pub struct AudioRendererProxy {
8437 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8438}
8439
8440impl fidl::endpoints::Proxy for AudioRendererProxy {
8441 type Protocol = AudioRendererMarker;
8442
8443 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8444 Self::new(inner)
8445 }
8446
8447 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8448 self.client.into_channel().map_err(|client| Self { client })
8449 }
8450
8451 fn as_channel(&self) -> &::fidl::AsyncChannel {
8452 self.client.as_channel()
8453 }
8454}
8455
8456impl AudioRendererProxy {
8457 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8459 let protocol_name = <AudioRendererMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8460 Self { client: fidl::client::Client::new(channel, protocol_name) }
8461 }
8462
8463 pub fn take_event_stream(&self) -> AudioRendererEventStream {
8469 AudioRendererEventStream { event_receiver: self.client.take_event_receiver() }
8470 }
8471
8472 pub fn r#add_payload_buffer(
8479 &self,
8480 mut id: u32,
8481 mut payload_buffer: fidl::Vmo,
8482 ) -> Result<(), fidl::Error> {
8483 AudioRendererProxyInterface::r#add_payload_buffer(self, id, payload_buffer)
8484 }
8485
8486 pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
8492 AudioRendererProxyInterface::r#remove_payload_buffer(self, id)
8493 }
8494
8495 pub fn r#send_packet(
8501 &self,
8502 mut packet: &StreamPacket,
8503 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8504 AudioRendererProxyInterface::r#send_packet(self, packet)
8505 }
8506
8507 pub fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
8514 AudioRendererProxyInterface::r#send_packet_no_reply(self, packet)
8515 }
8516
8517 pub fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
8520 AudioRendererProxyInterface::r#end_of_stream(self)
8521 }
8522
8523 pub fn r#discard_all_packets(
8527 &self,
8528 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8529 AudioRendererProxyInterface::r#discard_all_packets(self)
8530 }
8531
8532 pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
8535 AudioRendererProxyInterface::r#discard_all_packets_no_reply(self)
8536 }
8537
8538 pub fn r#bind_gain_control(
8540 &self,
8541 mut gain_control_request: fidl::endpoints::ServerEnd<
8542 fidl_fuchsia_media_audio::GainControlMarker,
8543 >,
8544 ) -> Result<(), fidl::Error> {
8545 AudioRendererProxyInterface::r#bind_gain_control(self, gain_control_request)
8546 }
8547
8548 pub fn r#set_pts_units(
8552 &self,
8553 mut tick_per_second_numerator: u32,
8554 mut tick_per_second_denominator: u32,
8555 ) -> Result<(), fidl::Error> {
8556 AudioRendererProxyInterface::r#set_pts_units(
8557 self,
8558 tick_per_second_numerator,
8559 tick_per_second_denominator,
8560 )
8561 }
8562
8563 pub fn r#set_pts_continuity_threshold(
8629 &self,
8630 mut threshold_seconds: f32,
8631 ) -> Result<(), fidl::Error> {
8632 AudioRendererProxyInterface::r#set_pts_continuity_threshold(self, threshold_seconds)
8633 }
8634
8635 pub fn r#get_reference_clock(
8638 &self,
8639 ) -> fidl::client::QueryResponseFut<fidl::Clock, fidl::encoding::DefaultFuchsiaResourceDialect>
8640 {
8641 AudioRendererProxyInterface::r#get_reference_clock(self)
8642 }
8643
8644 pub fn r#set_reference_clock(
8656 &self,
8657 mut reference_clock: Option<fidl::Clock>,
8658 ) -> Result<(), fidl::Error> {
8659 AudioRendererProxyInterface::r#set_reference_clock(self, reference_clock)
8660 }
8661
8662 pub fn r#set_usage(&self, mut usage: AudioRenderUsage) -> Result<(), fidl::Error> {
8665 AudioRendererProxyInterface::r#set_usage(self, usage)
8666 }
8667
8668 pub fn r#set_usage2(&self, mut usage2: AudioRenderUsage2) -> Result<(), fidl::Error> {
8671 AudioRendererProxyInterface::r#set_usage2(self, usage2)
8672 }
8673
8674 pub fn r#set_pcm_stream_type(&self, mut type_: &AudioStreamType) -> Result<(), fidl::Error> {
8681 AudioRendererProxyInterface::r#set_pcm_stream_type(self, type_)
8682 }
8683
8684 pub fn r#enable_min_lead_time_events(&self, mut enabled: bool) -> Result<(), fidl::Error> {
8712 AudioRendererProxyInterface::r#enable_min_lead_time_events(self, enabled)
8713 }
8714
8715 pub fn r#get_min_lead_time(
8723 &self,
8724 ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
8725 AudioRendererProxyInterface::r#get_min_lead_time(self)
8726 }
8727
8728 pub fn r#play(
8832 &self,
8833 mut reference_time: i64,
8834 mut media_time: i64,
8835 ) -> fidl::client::QueryResponseFut<(i64, i64), fidl::encoding::DefaultFuchsiaResourceDialect>
8836 {
8837 AudioRendererProxyInterface::r#play(self, reference_time, media_time)
8838 }
8839
8840 pub fn r#play_no_reply(
8841 &self,
8842 mut reference_time: i64,
8843 mut media_time: i64,
8844 ) -> Result<(), fidl::Error> {
8845 AudioRendererProxyInterface::r#play_no_reply(self, reference_time, media_time)
8846 }
8847
8848 pub fn r#pause(
8855 &self,
8856 ) -> fidl::client::QueryResponseFut<(i64, i64), fidl::encoding::DefaultFuchsiaResourceDialect>
8857 {
8858 AudioRendererProxyInterface::r#pause(self)
8859 }
8860
8861 pub fn r#pause_no_reply(&self) -> Result<(), fidl::Error> {
8862 AudioRendererProxyInterface::r#pause_no_reply(self)
8863 }
8864}
8865
8866impl AudioRendererProxyInterface for AudioRendererProxy {
8867 fn r#add_payload_buffer(
8868 &self,
8869 mut id: u32,
8870 mut payload_buffer: fidl::Vmo,
8871 ) -> Result<(), fidl::Error> {
8872 self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
8873 (id, payload_buffer),
8874 0x3b3a37fc34fe5b56,
8875 fidl::encoding::DynamicFlags::empty(),
8876 )
8877 }
8878
8879 fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
8880 self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
8881 (id,),
8882 0x5d1e4f74c3658262,
8883 fidl::encoding::DynamicFlags::empty(),
8884 )
8885 }
8886
8887 type SendPacketResponseFut =
8888 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8889 fn r#send_packet(&self, mut packet: &StreamPacket) -> Self::SendPacketResponseFut {
8890 fn _decode(
8891 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8892 ) -> Result<(), fidl::Error> {
8893 let _response = fidl::client::decode_transaction_body::<
8894 fidl::encoding::EmptyPayload,
8895 fidl::encoding::DefaultFuchsiaResourceDialect,
8896 0x67cddd607442775f,
8897 >(_buf?)?;
8898 Ok(_response)
8899 }
8900 self.client.send_query_and_decode::<StreamSinkSendPacketRequest, ()>(
8901 (packet,),
8902 0x67cddd607442775f,
8903 fidl::encoding::DynamicFlags::empty(),
8904 _decode,
8905 )
8906 }
8907
8908 fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
8909 self.client.send::<StreamSinkSendPacketNoReplyRequest>(
8910 (packet,),
8911 0x8d9b8b413ceba9d,
8912 fidl::encoding::DynamicFlags::empty(),
8913 )
8914 }
8915
8916 fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
8917 self.client.send::<fidl::encoding::EmptyPayload>(
8918 (),
8919 0x6180fd6f7e793b71,
8920 fidl::encoding::DynamicFlags::empty(),
8921 )
8922 }
8923
8924 type DiscardAllPacketsResponseFut =
8925 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8926 fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut {
8927 fn _decode(
8928 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8929 ) -> Result<(), fidl::Error> {
8930 let _response = fidl::client::decode_transaction_body::<
8931 fidl::encoding::EmptyPayload,
8932 fidl::encoding::DefaultFuchsiaResourceDialect,
8933 0x6f4dad7af2917665,
8934 >(_buf?)?;
8935 Ok(_response)
8936 }
8937 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
8938 (),
8939 0x6f4dad7af2917665,
8940 fidl::encoding::DynamicFlags::empty(),
8941 _decode,
8942 )
8943 }
8944
8945 fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
8946 self.client.send::<fidl::encoding::EmptyPayload>(
8947 (),
8948 0x50d36d0d23081bc4,
8949 fidl::encoding::DynamicFlags::empty(),
8950 )
8951 }
8952
8953 fn r#bind_gain_control(
8954 &self,
8955 mut gain_control_request: fidl::endpoints::ServerEnd<
8956 fidl_fuchsia_media_audio::GainControlMarker,
8957 >,
8958 ) -> Result<(), fidl::Error> {
8959 self.client.send::<AudioRendererBindGainControlRequest>(
8960 (gain_control_request,),
8961 0x293f5c7f8fba2bdc,
8962 fidl::encoding::DynamicFlags::empty(),
8963 )
8964 }
8965
8966 fn r#set_pts_units(
8967 &self,
8968 mut tick_per_second_numerator: u32,
8969 mut tick_per_second_denominator: u32,
8970 ) -> Result<(), fidl::Error> {
8971 self.client.send::<AudioRendererSetPtsUnitsRequest>(
8972 (tick_per_second_numerator, tick_per_second_denominator),
8973 0xf68cd108785a27c,
8974 fidl::encoding::DynamicFlags::empty(),
8975 )
8976 }
8977
8978 fn r#set_pts_continuity_threshold(
8979 &self,
8980 mut threshold_seconds: f32,
8981 ) -> Result<(), fidl::Error> {
8982 self.client.send::<AudioRendererSetPtsContinuityThresholdRequest>(
8983 (threshold_seconds,),
8984 0x2849ba571d1971ba,
8985 fidl::encoding::DynamicFlags::empty(),
8986 )
8987 }
8988
8989 type GetReferenceClockResponseFut =
8990 fidl::client::QueryResponseFut<fidl::Clock, fidl::encoding::DefaultFuchsiaResourceDialect>;
8991 fn r#get_reference_clock(&self) -> Self::GetReferenceClockResponseFut {
8992 fn _decode(
8993 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8994 ) -> Result<fidl::Clock, fidl::Error> {
8995 let _response = fidl::client::decode_transaction_body::<
8996 AudioRendererGetReferenceClockResponse,
8997 fidl::encoding::DefaultFuchsiaResourceDialect,
8998 0x2f7a7f011a172f7e,
8999 >(_buf?)?;
9000 Ok(_response.reference_clock)
9001 }
9002 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Clock>(
9003 (),
9004 0x2f7a7f011a172f7e,
9005 fidl::encoding::DynamicFlags::empty(),
9006 _decode,
9007 )
9008 }
9009
9010 fn r#set_reference_clock(
9011 &self,
9012 mut reference_clock: Option<fidl::Clock>,
9013 ) -> Result<(), fidl::Error> {
9014 self.client.send::<AudioRendererSetReferenceClockRequest>(
9015 (reference_clock,),
9016 0x39acd05d832b5fed,
9017 fidl::encoding::DynamicFlags::empty(),
9018 )
9019 }
9020
9021 fn r#set_usage(&self, mut usage: AudioRenderUsage) -> Result<(), fidl::Error> {
9022 self.client.send::<AudioRendererSetUsageRequest>(
9023 (usage,),
9024 0x3994bd23b55a733e,
9025 fidl::encoding::DynamicFlags::empty(),
9026 )
9027 }
9028
9029 fn r#set_usage2(&self, mut usage2: AudioRenderUsage2) -> Result<(), fidl::Error> {
9030 self.client.send::<AudioRendererSetUsage2Request>(
9031 (usage2,),
9032 0x2904035c7132b103,
9033 fidl::encoding::DynamicFlags::FLEXIBLE,
9034 )
9035 }
9036
9037 fn r#set_pcm_stream_type(&self, mut type_: &AudioStreamType) -> Result<(), fidl::Error> {
9038 self.client.send::<AudioRendererSetPcmStreamTypeRequest>(
9039 (type_,),
9040 0x27aa715d8901fa19,
9041 fidl::encoding::DynamicFlags::empty(),
9042 )
9043 }
9044
9045 fn r#enable_min_lead_time_events(&self, mut enabled: bool) -> Result<(), fidl::Error> {
9046 self.client.send::<AudioRendererEnableMinLeadTimeEventsRequest>(
9047 (enabled,),
9048 0x62808dfad72bf890,
9049 fidl::encoding::DynamicFlags::empty(),
9050 )
9051 }
9052
9053 type GetMinLeadTimeResponseFut =
9054 fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
9055 fn r#get_min_lead_time(&self) -> Self::GetMinLeadTimeResponseFut {
9056 fn _decode(
9057 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9058 ) -> Result<i64, fidl::Error> {
9059 let _response = fidl::client::decode_transaction_body::<
9060 AudioRendererGetMinLeadTimeResponse,
9061 fidl::encoding::DefaultFuchsiaResourceDialect,
9062 0x1cf3c3ecd8fec26b,
9063 >(_buf?)?;
9064 Ok(_response.min_lead_time_nsec)
9065 }
9066 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
9067 (),
9068 0x1cf3c3ecd8fec26b,
9069 fidl::encoding::DynamicFlags::empty(),
9070 _decode,
9071 )
9072 }
9073
9074 type PlayResponseFut =
9075 fidl::client::QueryResponseFut<(i64, i64), fidl::encoding::DefaultFuchsiaResourceDialect>;
9076 fn r#play(&self, mut reference_time: i64, mut media_time: i64) -> Self::PlayResponseFut {
9077 fn _decode(
9078 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9079 ) -> Result<(i64, i64), fidl::Error> {
9080 let _response = fidl::client::decode_transaction_body::<
9081 AudioRendererPlayResponse,
9082 fidl::encoding::DefaultFuchsiaResourceDialect,
9083 0x3c0162db084f74a3,
9084 >(_buf?)?;
9085 Ok((_response.reference_time, _response.media_time))
9086 }
9087 self.client.send_query_and_decode::<AudioRendererPlayRequest, (i64, i64)>(
9088 (reference_time, media_time),
9089 0x3c0162db084f74a3,
9090 fidl::encoding::DynamicFlags::empty(),
9091 _decode,
9092 )
9093 }
9094
9095 fn r#play_no_reply(
9096 &self,
9097 mut reference_time: i64,
9098 mut media_time: i64,
9099 ) -> Result<(), fidl::Error> {
9100 self.client.send::<AudioRendererPlayNoReplyRequest>(
9101 (reference_time, media_time),
9102 0x1b7fe832b68c22ef,
9103 fidl::encoding::DynamicFlags::empty(),
9104 )
9105 }
9106
9107 type PauseResponseFut =
9108 fidl::client::QueryResponseFut<(i64, i64), fidl::encoding::DefaultFuchsiaResourceDialect>;
9109 fn r#pause(&self) -> Self::PauseResponseFut {
9110 fn _decode(
9111 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9112 ) -> Result<(i64, i64), fidl::Error> {
9113 let _response = fidl::client::decode_transaction_body::<
9114 AudioRendererPauseResponse,
9115 fidl::encoding::DefaultFuchsiaResourceDialect,
9116 0x41d557588d93d153,
9117 >(_buf?)?;
9118 Ok((_response.reference_time, _response.media_time))
9119 }
9120 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i64, i64)>(
9121 (),
9122 0x41d557588d93d153,
9123 fidl::encoding::DynamicFlags::empty(),
9124 _decode,
9125 )
9126 }
9127
9128 fn r#pause_no_reply(&self) -> Result<(), fidl::Error> {
9129 self.client.send::<fidl::encoding::EmptyPayload>(
9130 (),
9131 0x24cc45d4f3855ab,
9132 fidl::encoding::DynamicFlags::empty(),
9133 )
9134 }
9135}
9136
9137pub struct AudioRendererEventStream {
9138 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9139}
9140
9141impl std::marker::Unpin for AudioRendererEventStream {}
9142
9143impl futures::stream::FusedStream for AudioRendererEventStream {
9144 fn is_terminated(&self) -> bool {
9145 self.event_receiver.is_terminated()
9146 }
9147}
9148
9149impl futures::Stream for AudioRendererEventStream {
9150 type Item = Result<AudioRendererEvent, fidl::Error>;
9151
9152 fn poll_next(
9153 mut self: std::pin::Pin<&mut Self>,
9154 cx: &mut std::task::Context<'_>,
9155 ) -> std::task::Poll<Option<Self::Item>> {
9156 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9157 &mut self.event_receiver,
9158 cx
9159 )?) {
9160 Some(buf) => std::task::Poll::Ready(Some(AudioRendererEvent::decode(buf))),
9161 None => std::task::Poll::Ready(None),
9162 }
9163 }
9164}
9165
9166#[derive(Debug)]
9167pub enum AudioRendererEvent {
9168 OnMinLeadTimeChanged {
9169 min_lead_time_nsec: i64,
9170 },
9171 #[non_exhaustive]
9172 _UnknownEvent {
9173 ordinal: u64,
9175 },
9176}
9177
9178impl AudioRendererEvent {
9179 #[allow(irrefutable_let_patterns)]
9180 pub fn into_on_min_lead_time_changed(self) -> Option<i64> {
9181 if let AudioRendererEvent::OnMinLeadTimeChanged { min_lead_time_nsec } = self {
9182 Some((min_lead_time_nsec))
9183 } else {
9184 None
9185 }
9186 }
9187
9188 fn decode(
9190 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9191 ) -> Result<AudioRendererEvent, fidl::Error> {
9192 let (bytes, _handles) = buf.split_mut();
9193 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9194 debug_assert_eq!(tx_header.tx_id, 0);
9195 match tx_header.ordinal {
9196 0x4feff7d278978c4e => {
9197 let mut out = fidl::new_empty!(
9198 AudioRendererOnMinLeadTimeChangedRequest,
9199 fidl::encoding::DefaultFuchsiaResourceDialect
9200 );
9201 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererOnMinLeadTimeChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
9202 Ok((AudioRendererEvent::OnMinLeadTimeChanged {
9203 min_lead_time_nsec: out.min_lead_time_nsec,
9204 }))
9205 }
9206 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
9207 Ok(AudioRendererEvent::_UnknownEvent { ordinal: tx_header.ordinal })
9208 }
9209 _ => Err(fidl::Error::UnknownOrdinal {
9210 ordinal: tx_header.ordinal,
9211 protocol_name: <AudioRendererMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9212 }),
9213 }
9214 }
9215}
9216
9217pub struct AudioRendererRequestStream {
9219 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9220 is_terminated: bool,
9221}
9222
9223impl std::marker::Unpin for AudioRendererRequestStream {}
9224
9225impl futures::stream::FusedStream for AudioRendererRequestStream {
9226 fn is_terminated(&self) -> bool {
9227 self.is_terminated
9228 }
9229}
9230
9231impl fidl::endpoints::RequestStream for AudioRendererRequestStream {
9232 type Protocol = AudioRendererMarker;
9233 type ControlHandle = AudioRendererControlHandle;
9234
9235 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9236 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9237 }
9238
9239 fn control_handle(&self) -> Self::ControlHandle {
9240 AudioRendererControlHandle { inner: self.inner.clone() }
9241 }
9242
9243 fn into_inner(
9244 self,
9245 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9246 {
9247 (self.inner, self.is_terminated)
9248 }
9249
9250 fn from_inner(
9251 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9252 is_terminated: bool,
9253 ) -> Self {
9254 Self { inner, is_terminated }
9255 }
9256}
9257
9258impl futures::Stream for AudioRendererRequestStream {
9259 type Item = Result<AudioRendererRequest, fidl::Error>;
9260
9261 fn poll_next(
9262 mut self: std::pin::Pin<&mut Self>,
9263 cx: &mut std::task::Context<'_>,
9264 ) -> std::task::Poll<Option<Self::Item>> {
9265 let this = &mut *self;
9266 if this.inner.check_shutdown(cx) {
9267 this.is_terminated = true;
9268 return std::task::Poll::Ready(None);
9269 }
9270 if this.is_terminated {
9271 panic!("polled AudioRendererRequestStream after completion");
9272 }
9273 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9274 |bytes, handles| {
9275 match this.inner.channel().read_etc(cx, bytes, handles) {
9276 std::task::Poll::Ready(Ok(())) => {}
9277 std::task::Poll::Pending => return std::task::Poll::Pending,
9278 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9279 this.is_terminated = true;
9280 return std::task::Poll::Ready(None);
9281 }
9282 std::task::Poll::Ready(Err(e)) => {
9283 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9284 e.into(),
9285 ))))
9286 }
9287 }
9288
9289 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9291
9292 std::task::Poll::Ready(Some(match header.ordinal {
9293 0x3b3a37fc34fe5b56 => {
9294 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9295 let mut req = fidl::new_empty!(
9296 StreamBufferSetAddPayloadBufferRequest,
9297 fidl::encoding::DefaultFuchsiaResourceDialect
9298 );
9299 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetAddPayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
9300 let control_handle =
9301 AudioRendererControlHandle { inner: this.inner.clone() };
9302 Ok(AudioRendererRequest::AddPayloadBuffer {
9303 id: req.id,
9304 payload_buffer: req.payload_buffer,
9305
9306 control_handle,
9307 })
9308 }
9309 0x5d1e4f74c3658262 => {
9310 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9311 let mut req = fidl::new_empty!(
9312 StreamBufferSetRemovePayloadBufferRequest,
9313 fidl::encoding::DefaultFuchsiaResourceDialect
9314 );
9315 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetRemovePayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
9316 let control_handle =
9317 AudioRendererControlHandle { inner: this.inner.clone() };
9318 Ok(AudioRendererRequest::RemovePayloadBuffer { id: req.id, control_handle })
9319 }
9320 0x67cddd607442775f => {
9321 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9322 let mut req = fidl::new_empty!(
9323 StreamSinkSendPacketRequest,
9324 fidl::encoding::DefaultFuchsiaResourceDialect
9325 );
9326 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkSendPacketRequest>(&header, _body_bytes, handles, &mut req)?;
9327 let control_handle =
9328 AudioRendererControlHandle { inner: this.inner.clone() };
9329 Ok(AudioRendererRequest::SendPacket {
9330 packet: req.packet,
9331
9332 responder: AudioRendererSendPacketResponder {
9333 control_handle: std::mem::ManuallyDrop::new(control_handle),
9334 tx_id: header.tx_id,
9335 },
9336 })
9337 }
9338 0x8d9b8b413ceba9d => {
9339 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9340 let mut req = fidl::new_empty!(
9341 StreamSinkSendPacketNoReplyRequest,
9342 fidl::encoding::DefaultFuchsiaResourceDialect
9343 );
9344 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkSendPacketNoReplyRequest>(&header, _body_bytes, handles, &mut req)?;
9345 let control_handle =
9346 AudioRendererControlHandle { inner: this.inner.clone() };
9347 Ok(AudioRendererRequest::SendPacketNoReply {
9348 packet: req.packet,
9349
9350 control_handle,
9351 })
9352 }
9353 0x6180fd6f7e793b71 => {
9354 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9355 let mut req = fidl::new_empty!(
9356 fidl::encoding::EmptyPayload,
9357 fidl::encoding::DefaultFuchsiaResourceDialect
9358 );
9359 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9360 let control_handle =
9361 AudioRendererControlHandle { inner: this.inner.clone() };
9362 Ok(AudioRendererRequest::EndOfStream { control_handle })
9363 }
9364 0x6f4dad7af2917665 => {
9365 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9366 let mut req = fidl::new_empty!(
9367 fidl::encoding::EmptyPayload,
9368 fidl::encoding::DefaultFuchsiaResourceDialect
9369 );
9370 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9371 let control_handle =
9372 AudioRendererControlHandle { inner: this.inner.clone() };
9373 Ok(AudioRendererRequest::DiscardAllPackets {
9374 responder: AudioRendererDiscardAllPacketsResponder {
9375 control_handle: std::mem::ManuallyDrop::new(control_handle),
9376 tx_id: header.tx_id,
9377 },
9378 })
9379 }
9380 0x50d36d0d23081bc4 => {
9381 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9382 let mut req = fidl::new_empty!(
9383 fidl::encoding::EmptyPayload,
9384 fidl::encoding::DefaultFuchsiaResourceDialect
9385 );
9386 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9387 let control_handle =
9388 AudioRendererControlHandle { inner: this.inner.clone() };
9389 Ok(AudioRendererRequest::DiscardAllPacketsNoReply { control_handle })
9390 }
9391 0x293f5c7f8fba2bdc => {
9392 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9393 let mut req = fidl::new_empty!(
9394 AudioRendererBindGainControlRequest,
9395 fidl::encoding::DefaultFuchsiaResourceDialect
9396 );
9397 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererBindGainControlRequest>(&header, _body_bytes, handles, &mut req)?;
9398 let control_handle =
9399 AudioRendererControlHandle { inner: this.inner.clone() };
9400 Ok(AudioRendererRequest::BindGainControl {
9401 gain_control_request: req.gain_control_request,
9402
9403 control_handle,
9404 })
9405 }
9406 0xf68cd108785a27c => {
9407 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9408 let mut req = fidl::new_empty!(
9409 AudioRendererSetPtsUnitsRequest,
9410 fidl::encoding::DefaultFuchsiaResourceDialect
9411 );
9412 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererSetPtsUnitsRequest>(&header, _body_bytes, handles, &mut req)?;
9413 let control_handle =
9414 AudioRendererControlHandle { inner: this.inner.clone() };
9415 Ok(AudioRendererRequest::SetPtsUnits {
9416 tick_per_second_numerator: req.tick_per_second_numerator,
9417 tick_per_second_denominator: req.tick_per_second_denominator,
9418
9419 control_handle,
9420 })
9421 }
9422 0x2849ba571d1971ba => {
9423 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9424 let mut req = fidl::new_empty!(
9425 AudioRendererSetPtsContinuityThresholdRequest,
9426 fidl::encoding::DefaultFuchsiaResourceDialect
9427 );
9428 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererSetPtsContinuityThresholdRequest>(&header, _body_bytes, handles, &mut req)?;
9429 let control_handle =
9430 AudioRendererControlHandle { inner: this.inner.clone() };
9431 Ok(AudioRendererRequest::SetPtsContinuityThreshold {
9432 threshold_seconds: req.threshold_seconds,
9433
9434 control_handle,
9435 })
9436 }
9437 0x2f7a7f011a172f7e => {
9438 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9439 let mut req = fidl::new_empty!(
9440 fidl::encoding::EmptyPayload,
9441 fidl::encoding::DefaultFuchsiaResourceDialect
9442 );
9443 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9444 let control_handle =
9445 AudioRendererControlHandle { inner: this.inner.clone() };
9446 Ok(AudioRendererRequest::GetReferenceClock {
9447 responder: AudioRendererGetReferenceClockResponder {
9448 control_handle: std::mem::ManuallyDrop::new(control_handle),
9449 tx_id: header.tx_id,
9450 },
9451 })
9452 }
9453 0x39acd05d832b5fed => {
9454 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9455 let mut req = fidl::new_empty!(
9456 AudioRendererSetReferenceClockRequest,
9457 fidl::encoding::DefaultFuchsiaResourceDialect
9458 );
9459 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererSetReferenceClockRequest>(&header, _body_bytes, handles, &mut req)?;
9460 let control_handle =
9461 AudioRendererControlHandle { inner: this.inner.clone() };
9462 Ok(AudioRendererRequest::SetReferenceClock {
9463 reference_clock: req.reference_clock,
9464
9465 control_handle,
9466 })
9467 }
9468 0x3994bd23b55a733e => {
9469 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9470 let mut req = fidl::new_empty!(
9471 AudioRendererSetUsageRequest,
9472 fidl::encoding::DefaultFuchsiaResourceDialect
9473 );
9474 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererSetUsageRequest>(&header, _body_bytes, handles, &mut req)?;
9475 let control_handle =
9476 AudioRendererControlHandle { inner: this.inner.clone() };
9477 Ok(AudioRendererRequest::SetUsage { usage: req.usage, control_handle })
9478 }
9479 0x2904035c7132b103 => {
9480 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9481 let mut req = fidl::new_empty!(
9482 AudioRendererSetUsage2Request,
9483 fidl::encoding::DefaultFuchsiaResourceDialect
9484 );
9485 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererSetUsage2Request>(&header, _body_bytes, handles, &mut req)?;
9486 let control_handle =
9487 AudioRendererControlHandle { inner: this.inner.clone() };
9488 Ok(AudioRendererRequest::SetUsage2 { usage2: req.usage2, control_handle })
9489 }
9490 0x27aa715d8901fa19 => {
9491 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9492 let mut req = fidl::new_empty!(
9493 AudioRendererSetPcmStreamTypeRequest,
9494 fidl::encoding::DefaultFuchsiaResourceDialect
9495 );
9496 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererSetPcmStreamTypeRequest>(&header, _body_bytes, handles, &mut req)?;
9497 let control_handle =
9498 AudioRendererControlHandle { inner: this.inner.clone() };
9499 Ok(AudioRendererRequest::SetPcmStreamType {
9500 type_: req.type_,
9501
9502 control_handle,
9503 })
9504 }
9505 0x62808dfad72bf890 => {
9506 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9507 let mut req = fidl::new_empty!(
9508 AudioRendererEnableMinLeadTimeEventsRequest,
9509 fidl::encoding::DefaultFuchsiaResourceDialect
9510 );
9511 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererEnableMinLeadTimeEventsRequest>(&header, _body_bytes, handles, &mut req)?;
9512 let control_handle =
9513 AudioRendererControlHandle { inner: this.inner.clone() };
9514 Ok(AudioRendererRequest::EnableMinLeadTimeEvents {
9515 enabled: req.enabled,
9516
9517 control_handle,
9518 })
9519 }
9520 0x1cf3c3ecd8fec26b => {
9521 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9522 let mut req = fidl::new_empty!(
9523 fidl::encoding::EmptyPayload,
9524 fidl::encoding::DefaultFuchsiaResourceDialect
9525 );
9526 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9527 let control_handle =
9528 AudioRendererControlHandle { inner: this.inner.clone() };
9529 Ok(AudioRendererRequest::GetMinLeadTime {
9530 responder: AudioRendererGetMinLeadTimeResponder {
9531 control_handle: std::mem::ManuallyDrop::new(control_handle),
9532 tx_id: header.tx_id,
9533 },
9534 })
9535 }
9536 0x3c0162db084f74a3 => {
9537 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9538 let mut req = fidl::new_empty!(
9539 AudioRendererPlayRequest,
9540 fidl::encoding::DefaultFuchsiaResourceDialect
9541 );
9542 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererPlayRequest>(&header, _body_bytes, handles, &mut req)?;
9543 let control_handle =
9544 AudioRendererControlHandle { inner: this.inner.clone() };
9545 Ok(AudioRendererRequest::Play {
9546 reference_time: req.reference_time,
9547 media_time: req.media_time,
9548
9549 responder: AudioRendererPlayResponder {
9550 control_handle: std::mem::ManuallyDrop::new(control_handle),
9551 tx_id: header.tx_id,
9552 },
9553 })
9554 }
9555 0x1b7fe832b68c22ef => {
9556 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9557 let mut req = fidl::new_empty!(
9558 AudioRendererPlayNoReplyRequest,
9559 fidl::encoding::DefaultFuchsiaResourceDialect
9560 );
9561 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioRendererPlayNoReplyRequest>(&header, _body_bytes, handles, &mut req)?;
9562 let control_handle =
9563 AudioRendererControlHandle { inner: this.inner.clone() };
9564 Ok(AudioRendererRequest::PlayNoReply {
9565 reference_time: req.reference_time,
9566 media_time: req.media_time,
9567
9568 control_handle,
9569 })
9570 }
9571 0x41d557588d93d153 => {
9572 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9573 let mut req = fidl::new_empty!(
9574 fidl::encoding::EmptyPayload,
9575 fidl::encoding::DefaultFuchsiaResourceDialect
9576 );
9577 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9578 let control_handle =
9579 AudioRendererControlHandle { inner: this.inner.clone() };
9580 Ok(AudioRendererRequest::Pause {
9581 responder: AudioRendererPauseResponder {
9582 control_handle: std::mem::ManuallyDrop::new(control_handle),
9583 tx_id: header.tx_id,
9584 },
9585 })
9586 }
9587 0x24cc45d4f3855ab => {
9588 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9589 let mut req = fidl::new_empty!(
9590 fidl::encoding::EmptyPayload,
9591 fidl::encoding::DefaultFuchsiaResourceDialect
9592 );
9593 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9594 let control_handle =
9595 AudioRendererControlHandle { inner: this.inner.clone() };
9596 Ok(AudioRendererRequest::PauseNoReply { control_handle })
9597 }
9598 _ if header.tx_id == 0
9599 && header
9600 .dynamic_flags()
9601 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9602 {
9603 Ok(AudioRendererRequest::_UnknownMethod {
9604 ordinal: header.ordinal,
9605 control_handle: AudioRendererControlHandle {
9606 inner: this.inner.clone(),
9607 },
9608 method_type: fidl::MethodType::OneWay,
9609 })
9610 }
9611 _ if header
9612 .dynamic_flags()
9613 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9614 {
9615 this.inner.send_framework_err(
9616 fidl::encoding::FrameworkErr::UnknownMethod,
9617 header.tx_id,
9618 header.ordinal,
9619 header.dynamic_flags(),
9620 (bytes, handles),
9621 )?;
9622 Ok(AudioRendererRequest::_UnknownMethod {
9623 ordinal: header.ordinal,
9624 control_handle: AudioRendererControlHandle {
9625 inner: this.inner.clone(),
9626 },
9627 method_type: fidl::MethodType::TwoWay,
9628 })
9629 }
9630 _ => Err(fidl::Error::UnknownOrdinal {
9631 ordinal: header.ordinal,
9632 protocol_name:
9633 <AudioRendererMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9634 }),
9635 }))
9636 },
9637 )
9638 }
9639}
9640
9641#[derive(Debug)]
9653pub enum AudioRendererRequest {
9654 AddPayloadBuffer {
9661 id: u32,
9662 payload_buffer: fidl::Vmo,
9663 control_handle: AudioRendererControlHandle,
9664 },
9665 RemovePayloadBuffer {
9671 id: u32,
9672 control_handle: AudioRendererControlHandle,
9673 },
9674 SendPacket {
9680 packet: StreamPacket,
9681 responder: AudioRendererSendPacketResponder,
9682 },
9683 SendPacketNoReply {
9690 packet: StreamPacket,
9691 control_handle: AudioRendererControlHandle,
9692 },
9693 EndOfStream {
9696 control_handle: AudioRendererControlHandle,
9697 },
9698 DiscardAllPackets {
9702 responder: AudioRendererDiscardAllPacketsResponder,
9703 },
9704 DiscardAllPacketsNoReply {
9707 control_handle: AudioRendererControlHandle,
9708 },
9709 BindGainControl {
9711 gain_control_request:
9712 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
9713 control_handle: AudioRendererControlHandle,
9714 },
9715 SetPtsUnits {
9719 tick_per_second_numerator: u32,
9720 tick_per_second_denominator: u32,
9721 control_handle: AudioRendererControlHandle,
9722 },
9723 SetPtsContinuityThreshold {
9789 threshold_seconds: f32,
9790 control_handle: AudioRendererControlHandle,
9791 },
9792 GetReferenceClock {
9795 responder: AudioRendererGetReferenceClockResponder,
9796 },
9797 SetReferenceClock {
9809 reference_clock: Option<fidl::Clock>,
9810 control_handle: AudioRendererControlHandle,
9811 },
9812 SetUsage {
9815 usage: AudioRenderUsage,
9816 control_handle: AudioRendererControlHandle,
9817 },
9818 SetUsage2 {
9821 usage2: AudioRenderUsage2,
9822 control_handle: AudioRendererControlHandle,
9823 },
9824 SetPcmStreamType {
9831 type_: AudioStreamType,
9832 control_handle: AudioRendererControlHandle,
9833 },
9834 EnableMinLeadTimeEvents {
9862 enabled: bool,
9863 control_handle: AudioRendererControlHandle,
9864 },
9865 GetMinLeadTime {
9873 responder: AudioRendererGetMinLeadTimeResponder,
9874 },
9875 Play {
9979 reference_time: i64,
9980 media_time: i64,
9981 responder: AudioRendererPlayResponder,
9982 },
9983 PlayNoReply {
9984 reference_time: i64,
9985 media_time: i64,
9986 control_handle: AudioRendererControlHandle,
9987 },
9988 Pause {
9995 responder: AudioRendererPauseResponder,
9996 },
9997 PauseNoReply {
9998 control_handle: AudioRendererControlHandle,
9999 },
10000 #[non_exhaustive]
10002 _UnknownMethod {
10003 ordinal: u64,
10005 control_handle: AudioRendererControlHandle,
10006 method_type: fidl::MethodType,
10007 },
10008}
10009
10010impl AudioRendererRequest {
10011 #[allow(irrefutable_let_patterns)]
10012 pub fn into_add_payload_buffer(self) -> Option<(u32, fidl::Vmo, AudioRendererControlHandle)> {
10013 if let AudioRendererRequest::AddPayloadBuffer { id, payload_buffer, control_handle } = self
10014 {
10015 Some((id, payload_buffer, control_handle))
10016 } else {
10017 None
10018 }
10019 }
10020
10021 #[allow(irrefutable_let_patterns)]
10022 pub fn into_remove_payload_buffer(self) -> Option<(u32, AudioRendererControlHandle)> {
10023 if let AudioRendererRequest::RemovePayloadBuffer { id, control_handle } = self {
10024 Some((id, control_handle))
10025 } else {
10026 None
10027 }
10028 }
10029
10030 #[allow(irrefutable_let_patterns)]
10031 pub fn into_send_packet(self) -> Option<(StreamPacket, AudioRendererSendPacketResponder)> {
10032 if let AudioRendererRequest::SendPacket { packet, responder } = self {
10033 Some((packet, responder))
10034 } else {
10035 None
10036 }
10037 }
10038
10039 #[allow(irrefutable_let_patterns)]
10040 pub fn into_send_packet_no_reply(self) -> Option<(StreamPacket, AudioRendererControlHandle)> {
10041 if let AudioRendererRequest::SendPacketNoReply { packet, control_handle } = self {
10042 Some((packet, control_handle))
10043 } else {
10044 None
10045 }
10046 }
10047
10048 #[allow(irrefutable_let_patterns)]
10049 pub fn into_end_of_stream(self) -> Option<(AudioRendererControlHandle)> {
10050 if let AudioRendererRequest::EndOfStream { control_handle } = self {
10051 Some((control_handle))
10052 } else {
10053 None
10054 }
10055 }
10056
10057 #[allow(irrefutable_let_patterns)]
10058 pub fn into_discard_all_packets(self) -> Option<(AudioRendererDiscardAllPacketsResponder)> {
10059 if let AudioRendererRequest::DiscardAllPackets { responder } = self {
10060 Some((responder))
10061 } else {
10062 None
10063 }
10064 }
10065
10066 #[allow(irrefutable_let_patterns)]
10067 pub fn into_discard_all_packets_no_reply(self) -> Option<(AudioRendererControlHandle)> {
10068 if let AudioRendererRequest::DiscardAllPacketsNoReply { control_handle } = self {
10069 Some((control_handle))
10070 } else {
10071 None
10072 }
10073 }
10074
10075 #[allow(irrefutable_let_patterns)]
10076 pub fn into_bind_gain_control(
10077 self,
10078 ) -> Option<(
10079 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
10080 AudioRendererControlHandle,
10081 )> {
10082 if let AudioRendererRequest::BindGainControl { gain_control_request, control_handle } = self
10083 {
10084 Some((gain_control_request, control_handle))
10085 } else {
10086 None
10087 }
10088 }
10089
10090 #[allow(irrefutable_let_patterns)]
10091 pub fn into_set_pts_units(self) -> Option<(u32, u32, AudioRendererControlHandle)> {
10092 if let AudioRendererRequest::SetPtsUnits {
10093 tick_per_second_numerator,
10094 tick_per_second_denominator,
10095 control_handle,
10096 } = self
10097 {
10098 Some((tick_per_second_numerator, tick_per_second_denominator, control_handle))
10099 } else {
10100 None
10101 }
10102 }
10103
10104 #[allow(irrefutable_let_patterns)]
10105 pub fn into_set_pts_continuity_threshold(self) -> Option<(f32, AudioRendererControlHandle)> {
10106 if let AudioRendererRequest::SetPtsContinuityThreshold {
10107 threshold_seconds,
10108 control_handle,
10109 } = self
10110 {
10111 Some((threshold_seconds, control_handle))
10112 } else {
10113 None
10114 }
10115 }
10116
10117 #[allow(irrefutable_let_patterns)]
10118 pub fn into_get_reference_clock(self) -> Option<(AudioRendererGetReferenceClockResponder)> {
10119 if let AudioRendererRequest::GetReferenceClock { responder } = self {
10120 Some((responder))
10121 } else {
10122 None
10123 }
10124 }
10125
10126 #[allow(irrefutable_let_patterns)]
10127 pub fn into_set_reference_clock(
10128 self,
10129 ) -> Option<(Option<fidl::Clock>, AudioRendererControlHandle)> {
10130 if let AudioRendererRequest::SetReferenceClock { reference_clock, control_handle } = self {
10131 Some((reference_clock, control_handle))
10132 } else {
10133 None
10134 }
10135 }
10136
10137 #[allow(irrefutable_let_patterns)]
10138 pub fn into_set_usage(self) -> Option<(AudioRenderUsage, AudioRendererControlHandle)> {
10139 if let AudioRendererRequest::SetUsage { usage, control_handle } = self {
10140 Some((usage, control_handle))
10141 } else {
10142 None
10143 }
10144 }
10145
10146 #[allow(irrefutable_let_patterns)]
10147 pub fn into_set_usage2(self) -> Option<(AudioRenderUsage2, AudioRendererControlHandle)> {
10148 if let AudioRendererRequest::SetUsage2 { usage2, control_handle } = self {
10149 Some((usage2, control_handle))
10150 } else {
10151 None
10152 }
10153 }
10154
10155 #[allow(irrefutable_let_patterns)]
10156 pub fn into_set_pcm_stream_type(self) -> Option<(AudioStreamType, AudioRendererControlHandle)> {
10157 if let AudioRendererRequest::SetPcmStreamType { type_, control_handle } = self {
10158 Some((type_, control_handle))
10159 } else {
10160 None
10161 }
10162 }
10163
10164 #[allow(irrefutable_let_patterns)]
10165 pub fn into_enable_min_lead_time_events(self) -> Option<(bool, AudioRendererControlHandle)> {
10166 if let AudioRendererRequest::EnableMinLeadTimeEvents { enabled, control_handle } = self {
10167 Some((enabled, control_handle))
10168 } else {
10169 None
10170 }
10171 }
10172
10173 #[allow(irrefutable_let_patterns)]
10174 pub fn into_get_min_lead_time(self) -> Option<(AudioRendererGetMinLeadTimeResponder)> {
10175 if let AudioRendererRequest::GetMinLeadTime { responder } = self {
10176 Some((responder))
10177 } else {
10178 None
10179 }
10180 }
10181
10182 #[allow(irrefutable_let_patterns)]
10183 pub fn into_play(self) -> Option<(i64, i64, AudioRendererPlayResponder)> {
10184 if let AudioRendererRequest::Play { reference_time, media_time, responder } = self {
10185 Some((reference_time, media_time, responder))
10186 } else {
10187 None
10188 }
10189 }
10190
10191 #[allow(irrefutable_let_patterns)]
10192 pub fn into_play_no_reply(self) -> Option<(i64, i64, AudioRendererControlHandle)> {
10193 if let AudioRendererRequest::PlayNoReply { reference_time, media_time, control_handle } =
10194 self
10195 {
10196 Some((reference_time, media_time, control_handle))
10197 } else {
10198 None
10199 }
10200 }
10201
10202 #[allow(irrefutable_let_patterns)]
10203 pub fn into_pause(self) -> Option<(AudioRendererPauseResponder)> {
10204 if let AudioRendererRequest::Pause { responder } = self {
10205 Some((responder))
10206 } else {
10207 None
10208 }
10209 }
10210
10211 #[allow(irrefutable_let_patterns)]
10212 pub fn into_pause_no_reply(self) -> Option<(AudioRendererControlHandle)> {
10213 if let AudioRendererRequest::PauseNoReply { control_handle } = self {
10214 Some((control_handle))
10215 } else {
10216 None
10217 }
10218 }
10219
10220 pub fn method_name(&self) -> &'static str {
10222 match *self {
10223 AudioRendererRequest::AddPayloadBuffer { .. } => "add_payload_buffer",
10224 AudioRendererRequest::RemovePayloadBuffer { .. } => "remove_payload_buffer",
10225 AudioRendererRequest::SendPacket { .. } => "send_packet",
10226 AudioRendererRequest::SendPacketNoReply { .. } => "send_packet_no_reply",
10227 AudioRendererRequest::EndOfStream { .. } => "end_of_stream",
10228 AudioRendererRequest::DiscardAllPackets { .. } => "discard_all_packets",
10229 AudioRendererRequest::DiscardAllPacketsNoReply { .. } => "discard_all_packets_no_reply",
10230 AudioRendererRequest::BindGainControl { .. } => "bind_gain_control",
10231 AudioRendererRequest::SetPtsUnits { .. } => "set_pts_units",
10232 AudioRendererRequest::SetPtsContinuityThreshold { .. } => {
10233 "set_pts_continuity_threshold"
10234 }
10235 AudioRendererRequest::GetReferenceClock { .. } => "get_reference_clock",
10236 AudioRendererRequest::SetReferenceClock { .. } => "set_reference_clock",
10237 AudioRendererRequest::SetUsage { .. } => "set_usage",
10238 AudioRendererRequest::SetUsage2 { .. } => "set_usage2",
10239 AudioRendererRequest::SetPcmStreamType { .. } => "set_pcm_stream_type",
10240 AudioRendererRequest::EnableMinLeadTimeEvents { .. } => "enable_min_lead_time_events",
10241 AudioRendererRequest::GetMinLeadTime { .. } => "get_min_lead_time",
10242 AudioRendererRequest::Play { .. } => "play",
10243 AudioRendererRequest::PlayNoReply { .. } => "play_no_reply",
10244 AudioRendererRequest::Pause { .. } => "pause",
10245 AudioRendererRequest::PauseNoReply { .. } => "pause_no_reply",
10246 AudioRendererRequest::_UnknownMethod {
10247 method_type: fidl::MethodType::OneWay, ..
10248 } => "unknown one-way method",
10249 AudioRendererRequest::_UnknownMethod {
10250 method_type: fidl::MethodType::TwoWay, ..
10251 } => "unknown two-way method",
10252 }
10253 }
10254}
10255
10256#[derive(Debug, Clone)]
10257pub struct AudioRendererControlHandle {
10258 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10259}
10260
10261impl fidl::endpoints::ControlHandle for AudioRendererControlHandle {
10262 fn shutdown(&self) {
10263 self.inner.shutdown()
10264 }
10265 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10266 self.inner.shutdown_with_epitaph(status)
10267 }
10268
10269 fn is_closed(&self) -> bool {
10270 self.inner.channel().is_closed()
10271 }
10272 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10273 self.inner.channel().on_closed()
10274 }
10275
10276 #[cfg(target_os = "fuchsia")]
10277 fn signal_peer(
10278 &self,
10279 clear_mask: zx::Signals,
10280 set_mask: zx::Signals,
10281 ) -> Result<(), zx_status::Status> {
10282 use fidl::Peered;
10283 self.inner.channel().signal_peer(clear_mask, set_mask)
10284 }
10285}
10286
10287impl AudioRendererControlHandle {
10288 pub fn send_on_min_lead_time_changed(
10289 &self,
10290 mut min_lead_time_nsec: i64,
10291 ) -> Result<(), fidl::Error> {
10292 self.inner.send::<AudioRendererOnMinLeadTimeChangedRequest>(
10293 (min_lead_time_nsec,),
10294 0,
10295 0x4feff7d278978c4e,
10296 fidl::encoding::DynamicFlags::empty(),
10297 )
10298 }
10299}
10300
10301#[must_use = "FIDL methods require a response to be sent"]
10302#[derive(Debug)]
10303pub struct AudioRendererSendPacketResponder {
10304 control_handle: std::mem::ManuallyDrop<AudioRendererControlHandle>,
10305 tx_id: u32,
10306}
10307
10308impl std::ops::Drop for AudioRendererSendPacketResponder {
10312 fn drop(&mut self) {
10313 self.control_handle.shutdown();
10314 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10316 }
10317}
10318
10319impl fidl::endpoints::Responder for AudioRendererSendPacketResponder {
10320 type ControlHandle = AudioRendererControlHandle;
10321
10322 fn control_handle(&self) -> &AudioRendererControlHandle {
10323 &self.control_handle
10324 }
10325
10326 fn drop_without_shutdown(mut self) {
10327 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10329 std::mem::forget(self);
10331 }
10332}
10333
10334impl AudioRendererSendPacketResponder {
10335 pub fn send(self) -> Result<(), fidl::Error> {
10339 let _result = self.send_raw();
10340 if _result.is_err() {
10341 self.control_handle.shutdown();
10342 }
10343 self.drop_without_shutdown();
10344 _result
10345 }
10346
10347 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
10349 let _result = self.send_raw();
10350 self.drop_without_shutdown();
10351 _result
10352 }
10353
10354 fn send_raw(&self) -> Result<(), fidl::Error> {
10355 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
10356 (),
10357 self.tx_id,
10358 0x67cddd607442775f,
10359 fidl::encoding::DynamicFlags::empty(),
10360 )
10361 }
10362}
10363
10364#[must_use = "FIDL methods require a response to be sent"]
10365#[derive(Debug)]
10366pub struct AudioRendererDiscardAllPacketsResponder {
10367 control_handle: std::mem::ManuallyDrop<AudioRendererControlHandle>,
10368 tx_id: u32,
10369}
10370
10371impl std::ops::Drop for AudioRendererDiscardAllPacketsResponder {
10375 fn drop(&mut self) {
10376 self.control_handle.shutdown();
10377 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10379 }
10380}
10381
10382impl fidl::endpoints::Responder for AudioRendererDiscardAllPacketsResponder {
10383 type ControlHandle = AudioRendererControlHandle;
10384
10385 fn control_handle(&self) -> &AudioRendererControlHandle {
10386 &self.control_handle
10387 }
10388
10389 fn drop_without_shutdown(mut self) {
10390 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10392 std::mem::forget(self);
10394 }
10395}
10396
10397impl AudioRendererDiscardAllPacketsResponder {
10398 pub fn send(self) -> Result<(), fidl::Error> {
10402 let _result = self.send_raw();
10403 if _result.is_err() {
10404 self.control_handle.shutdown();
10405 }
10406 self.drop_without_shutdown();
10407 _result
10408 }
10409
10410 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
10412 let _result = self.send_raw();
10413 self.drop_without_shutdown();
10414 _result
10415 }
10416
10417 fn send_raw(&self) -> Result<(), fidl::Error> {
10418 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
10419 (),
10420 self.tx_id,
10421 0x6f4dad7af2917665,
10422 fidl::encoding::DynamicFlags::empty(),
10423 )
10424 }
10425}
10426
10427#[must_use = "FIDL methods require a response to be sent"]
10428#[derive(Debug)]
10429pub struct AudioRendererGetReferenceClockResponder {
10430 control_handle: std::mem::ManuallyDrop<AudioRendererControlHandle>,
10431 tx_id: u32,
10432}
10433
10434impl std::ops::Drop for AudioRendererGetReferenceClockResponder {
10438 fn drop(&mut self) {
10439 self.control_handle.shutdown();
10440 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10442 }
10443}
10444
10445impl fidl::endpoints::Responder for AudioRendererGetReferenceClockResponder {
10446 type ControlHandle = AudioRendererControlHandle;
10447
10448 fn control_handle(&self) -> &AudioRendererControlHandle {
10449 &self.control_handle
10450 }
10451
10452 fn drop_without_shutdown(mut self) {
10453 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10455 std::mem::forget(self);
10457 }
10458}
10459
10460impl AudioRendererGetReferenceClockResponder {
10461 pub fn send(self, mut reference_clock: fidl::Clock) -> Result<(), fidl::Error> {
10465 let _result = self.send_raw(reference_clock);
10466 if _result.is_err() {
10467 self.control_handle.shutdown();
10468 }
10469 self.drop_without_shutdown();
10470 _result
10471 }
10472
10473 pub fn send_no_shutdown_on_err(
10475 self,
10476 mut reference_clock: fidl::Clock,
10477 ) -> Result<(), fidl::Error> {
10478 let _result = self.send_raw(reference_clock);
10479 self.drop_without_shutdown();
10480 _result
10481 }
10482
10483 fn send_raw(&self, mut reference_clock: fidl::Clock) -> Result<(), fidl::Error> {
10484 self.control_handle.inner.send::<AudioRendererGetReferenceClockResponse>(
10485 (reference_clock,),
10486 self.tx_id,
10487 0x2f7a7f011a172f7e,
10488 fidl::encoding::DynamicFlags::empty(),
10489 )
10490 }
10491}
10492
10493#[must_use = "FIDL methods require a response to be sent"]
10494#[derive(Debug)]
10495pub struct AudioRendererGetMinLeadTimeResponder {
10496 control_handle: std::mem::ManuallyDrop<AudioRendererControlHandle>,
10497 tx_id: u32,
10498}
10499
10500impl std::ops::Drop for AudioRendererGetMinLeadTimeResponder {
10504 fn drop(&mut self) {
10505 self.control_handle.shutdown();
10506 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10508 }
10509}
10510
10511impl fidl::endpoints::Responder for AudioRendererGetMinLeadTimeResponder {
10512 type ControlHandle = AudioRendererControlHandle;
10513
10514 fn control_handle(&self) -> &AudioRendererControlHandle {
10515 &self.control_handle
10516 }
10517
10518 fn drop_without_shutdown(mut self) {
10519 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10521 std::mem::forget(self);
10523 }
10524}
10525
10526impl AudioRendererGetMinLeadTimeResponder {
10527 pub fn send(self, mut min_lead_time_nsec: i64) -> Result<(), fidl::Error> {
10531 let _result = self.send_raw(min_lead_time_nsec);
10532 if _result.is_err() {
10533 self.control_handle.shutdown();
10534 }
10535 self.drop_without_shutdown();
10536 _result
10537 }
10538
10539 pub fn send_no_shutdown_on_err(self, mut min_lead_time_nsec: i64) -> Result<(), fidl::Error> {
10541 let _result = self.send_raw(min_lead_time_nsec);
10542 self.drop_without_shutdown();
10543 _result
10544 }
10545
10546 fn send_raw(&self, mut min_lead_time_nsec: i64) -> Result<(), fidl::Error> {
10547 self.control_handle.inner.send::<AudioRendererGetMinLeadTimeResponse>(
10548 (min_lead_time_nsec,),
10549 self.tx_id,
10550 0x1cf3c3ecd8fec26b,
10551 fidl::encoding::DynamicFlags::empty(),
10552 )
10553 }
10554}
10555
10556#[must_use = "FIDL methods require a response to be sent"]
10557#[derive(Debug)]
10558pub struct AudioRendererPlayResponder {
10559 control_handle: std::mem::ManuallyDrop<AudioRendererControlHandle>,
10560 tx_id: u32,
10561}
10562
10563impl std::ops::Drop for AudioRendererPlayResponder {
10567 fn drop(&mut self) {
10568 self.control_handle.shutdown();
10569 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10571 }
10572}
10573
10574impl fidl::endpoints::Responder for AudioRendererPlayResponder {
10575 type ControlHandle = AudioRendererControlHandle;
10576
10577 fn control_handle(&self) -> &AudioRendererControlHandle {
10578 &self.control_handle
10579 }
10580
10581 fn drop_without_shutdown(mut self) {
10582 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10584 std::mem::forget(self);
10586 }
10587}
10588
10589impl AudioRendererPlayResponder {
10590 pub fn send(self, mut reference_time: i64, mut media_time: i64) -> Result<(), fidl::Error> {
10594 let _result = self.send_raw(reference_time, media_time);
10595 if _result.is_err() {
10596 self.control_handle.shutdown();
10597 }
10598 self.drop_without_shutdown();
10599 _result
10600 }
10601
10602 pub fn send_no_shutdown_on_err(
10604 self,
10605 mut reference_time: i64,
10606 mut media_time: i64,
10607 ) -> Result<(), fidl::Error> {
10608 let _result = self.send_raw(reference_time, media_time);
10609 self.drop_without_shutdown();
10610 _result
10611 }
10612
10613 fn send_raw(&self, mut reference_time: i64, mut media_time: i64) -> Result<(), fidl::Error> {
10614 self.control_handle.inner.send::<AudioRendererPlayResponse>(
10615 (reference_time, media_time),
10616 self.tx_id,
10617 0x3c0162db084f74a3,
10618 fidl::encoding::DynamicFlags::empty(),
10619 )
10620 }
10621}
10622
10623#[must_use = "FIDL methods require a response to be sent"]
10624#[derive(Debug)]
10625pub struct AudioRendererPauseResponder {
10626 control_handle: std::mem::ManuallyDrop<AudioRendererControlHandle>,
10627 tx_id: u32,
10628}
10629
10630impl std::ops::Drop for AudioRendererPauseResponder {
10634 fn drop(&mut self) {
10635 self.control_handle.shutdown();
10636 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10638 }
10639}
10640
10641impl fidl::endpoints::Responder for AudioRendererPauseResponder {
10642 type ControlHandle = AudioRendererControlHandle;
10643
10644 fn control_handle(&self) -> &AudioRendererControlHandle {
10645 &self.control_handle
10646 }
10647
10648 fn drop_without_shutdown(mut self) {
10649 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10651 std::mem::forget(self);
10653 }
10654}
10655
10656impl AudioRendererPauseResponder {
10657 pub fn send(self, mut reference_time: i64, mut media_time: i64) -> Result<(), fidl::Error> {
10661 let _result = self.send_raw(reference_time, media_time);
10662 if _result.is_err() {
10663 self.control_handle.shutdown();
10664 }
10665 self.drop_without_shutdown();
10666 _result
10667 }
10668
10669 pub fn send_no_shutdown_on_err(
10671 self,
10672 mut reference_time: i64,
10673 mut media_time: i64,
10674 ) -> Result<(), fidl::Error> {
10675 let _result = self.send_raw(reference_time, media_time);
10676 self.drop_without_shutdown();
10677 _result
10678 }
10679
10680 fn send_raw(&self, mut reference_time: i64, mut media_time: i64) -> Result<(), fidl::Error> {
10681 self.control_handle.inner.send::<AudioRendererPauseResponse>(
10682 (reference_time, media_time),
10683 self.tx_id,
10684 0x41d557588d93d153,
10685 fidl::encoding::DynamicFlags::empty(),
10686 )
10687 }
10688}
10689
10690#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10691pub struct ProfileProviderMarker;
10692
10693impl fidl::endpoints::ProtocolMarker for ProfileProviderMarker {
10694 type Proxy = ProfileProviderProxy;
10695 type RequestStream = ProfileProviderRequestStream;
10696 #[cfg(target_os = "fuchsia")]
10697 type SynchronousProxy = ProfileProviderSynchronousProxy;
10698
10699 const DEBUG_NAME: &'static str = "fuchsia.media.ProfileProvider";
10700}
10701impl fidl::endpoints::DiscoverableProtocolMarker for ProfileProviderMarker {}
10702
10703pub trait ProfileProviderProxyInterface: Send + Sync {
10704 type RegisterHandlerWithCapacityResponseFut: std::future::Future<Output = Result<(i64, i64), fidl::Error>>
10705 + Send;
10706 fn r#register_handler_with_capacity(
10707 &self,
10708 thread_handle: fidl::Thread,
10709 name: &str,
10710 period: i64,
10711 capacity: f32,
10712 ) -> Self::RegisterHandlerWithCapacityResponseFut;
10713 type UnregisterHandlerResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
10714 fn r#unregister_handler(
10715 &self,
10716 thread_handle: fidl::Thread,
10717 name: &str,
10718 ) -> Self::UnregisterHandlerResponseFut;
10719 type RegisterMemoryRangeResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
10720 + Send;
10721 fn r#register_memory_range(
10722 &self,
10723 vmar_handle: fidl::Vmar,
10724 name: &str,
10725 ) -> Self::RegisterMemoryRangeResponseFut;
10726 type UnregisterMemoryRangeResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
10727 + Send;
10728 fn r#unregister_memory_range(
10729 &self,
10730 vmar_handle: fidl::Vmar,
10731 ) -> Self::UnregisterMemoryRangeResponseFut;
10732}
10733#[derive(Debug)]
10734#[cfg(target_os = "fuchsia")]
10735pub struct ProfileProviderSynchronousProxy {
10736 client: fidl::client::sync::Client,
10737}
10738
10739#[cfg(target_os = "fuchsia")]
10740impl fidl::endpoints::SynchronousProxy for ProfileProviderSynchronousProxy {
10741 type Proxy = ProfileProviderProxy;
10742 type Protocol = ProfileProviderMarker;
10743
10744 fn from_channel(inner: fidl::Channel) -> Self {
10745 Self::new(inner)
10746 }
10747
10748 fn into_channel(self) -> fidl::Channel {
10749 self.client.into_channel()
10750 }
10751
10752 fn as_channel(&self) -> &fidl::Channel {
10753 self.client.as_channel()
10754 }
10755}
10756
10757#[cfg(target_os = "fuchsia")]
10758impl ProfileProviderSynchronousProxy {
10759 pub fn new(channel: fidl::Channel) -> Self {
10760 let protocol_name = <ProfileProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10761 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
10762 }
10763
10764 pub fn into_channel(self) -> fidl::Channel {
10765 self.client.into_channel()
10766 }
10767
10768 pub fn wait_for_event(
10771 &self,
10772 deadline: zx::MonotonicInstant,
10773 ) -> Result<ProfileProviderEvent, fidl::Error> {
10774 ProfileProviderEvent::decode(self.client.wait_for_event(deadline)?)
10775 }
10776
10777 pub fn r#register_handler_with_capacity(
10809 &self,
10810 mut thread_handle: fidl::Thread,
10811 mut name: &str,
10812 mut period: i64,
10813 mut capacity: f32,
10814 ___deadline: zx::MonotonicInstant,
10815 ) -> Result<(i64, i64), fidl::Error> {
10816 let _response = self.client.send_query::<
10817 ProfileProviderRegisterHandlerWithCapacityRequest,
10818 ProfileProviderRegisterHandlerWithCapacityResponse,
10819 >(
10820 (thread_handle, name, period, capacity,),
10821 0x60459ecef7458176,
10822 fidl::encoding::DynamicFlags::empty(),
10823 ___deadline,
10824 )?;
10825 Ok((_response.period, _response.capacity))
10826 }
10827
10828 pub fn r#unregister_handler(
10830 &self,
10831 mut thread_handle: fidl::Thread,
10832 mut name: &str,
10833 ___deadline: zx::MonotonicInstant,
10834 ) -> Result<(), fidl::Error> {
10835 let _response = self
10836 .client
10837 .send_query::<ProfileProviderUnregisterHandlerRequest, fidl::encoding::EmptyPayload>(
10838 (thread_handle, name),
10839 0x724d9d5fd8ef544c,
10840 fidl::encoding::DynamicFlags::empty(),
10841 ___deadline,
10842 )?;
10843 Ok(_response)
10844 }
10845
10846 pub fn r#register_memory_range(
10854 &self,
10855 mut vmar_handle: fidl::Vmar,
10856 mut name: &str,
10857 ___deadline: zx::MonotonicInstant,
10858 ) -> Result<(), fidl::Error> {
10859 let _response = self
10860 .client
10861 .send_query::<ProfileProviderRegisterMemoryRangeRequest, fidl::encoding::EmptyPayload>(
10862 (vmar_handle, name),
10863 0x2f509d3523e9562d,
10864 fidl::encoding::DynamicFlags::empty(),
10865 ___deadline,
10866 )?;
10867 Ok(_response)
10868 }
10869
10870 pub fn r#unregister_memory_range(
10872 &self,
10873 mut vmar_handle: fidl::Vmar,
10874 ___deadline: zx::MonotonicInstant,
10875 ) -> Result<(), fidl::Error> {
10876 let _response = self.client.send_query::<
10877 ProfileProviderUnregisterMemoryRangeRequest,
10878 fidl::encoding::EmptyPayload,
10879 >(
10880 (vmar_handle,),
10881 0x2dc313d6aa81ad27,
10882 fidl::encoding::DynamicFlags::empty(),
10883 ___deadline,
10884 )?;
10885 Ok(_response)
10886 }
10887}
10888
10889#[cfg(target_os = "fuchsia")]
10890impl From<ProfileProviderSynchronousProxy> for zx::Handle {
10891 fn from(value: ProfileProviderSynchronousProxy) -> Self {
10892 value.into_channel().into()
10893 }
10894}
10895
10896#[cfg(target_os = "fuchsia")]
10897impl From<fidl::Channel> for ProfileProviderSynchronousProxy {
10898 fn from(value: fidl::Channel) -> Self {
10899 Self::new(value)
10900 }
10901}
10902
10903#[derive(Debug, Clone)]
10904pub struct ProfileProviderProxy {
10905 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10906}
10907
10908impl fidl::endpoints::Proxy for ProfileProviderProxy {
10909 type Protocol = ProfileProviderMarker;
10910
10911 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10912 Self::new(inner)
10913 }
10914
10915 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10916 self.client.into_channel().map_err(|client| Self { client })
10917 }
10918
10919 fn as_channel(&self) -> &::fidl::AsyncChannel {
10920 self.client.as_channel()
10921 }
10922}
10923
10924impl ProfileProviderProxy {
10925 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10927 let protocol_name = <ProfileProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10928 Self { client: fidl::client::Client::new(channel, protocol_name) }
10929 }
10930
10931 pub fn take_event_stream(&self) -> ProfileProviderEventStream {
10937 ProfileProviderEventStream { event_receiver: self.client.take_event_receiver() }
10938 }
10939
10940 pub fn r#register_handler_with_capacity(
10972 &self,
10973 mut thread_handle: fidl::Thread,
10974 mut name: &str,
10975 mut period: i64,
10976 mut capacity: f32,
10977 ) -> fidl::client::QueryResponseFut<(i64, i64), fidl::encoding::DefaultFuchsiaResourceDialect>
10978 {
10979 ProfileProviderProxyInterface::r#register_handler_with_capacity(
10980 self,
10981 thread_handle,
10982 name,
10983 period,
10984 capacity,
10985 )
10986 }
10987
10988 pub fn r#unregister_handler(
10990 &self,
10991 mut thread_handle: fidl::Thread,
10992 mut name: &str,
10993 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
10994 ProfileProviderProxyInterface::r#unregister_handler(self, thread_handle, name)
10995 }
10996
10997 pub fn r#register_memory_range(
11005 &self,
11006 mut vmar_handle: fidl::Vmar,
11007 mut name: &str,
11008 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
11009 ProfileProviderProxyInterface::r#register_memory_range(self, vmar_handle, name)
11010 }
11011
11012 pub fn r#unregister_memory_range(
11014 &self,
11015 mut vmar_handle: fidl::Vmar,
11016 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
11017 ProfileProviderProxyInterface::r#unregister_memory_range(self, vmar_handle)
11018 }
11019}
11020
11021impl ProfileProviderProxyInterface for ProfileProviderProxy {
11022 type RegisterHandlerWithCapacityResponseFut =
11023 fidl::client::QueryResponseFut<(i64, i64), fidl::encoding::DefaultFuchsiaResourceDialect>;
11024 fn r#register_handler_with_capacity(
11025 &self,
11026 mut thread_handle: fidl::Thread,
11027 mut name: &str,
11028 mut period: i64,
11029 mut capacity: f32,
11030 ) -> Self::RegisterHandlerWithCapacityResponseFut {
11031 fn _decode(
11032 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11033 ) -> Result<(i64, i64), fidl::Error> {
11034 let _response = fidl::client::decode_transaction_body::<
11035 ProfileProviderRegisterHandlerWithCapacityResponse,
11036 fidl::encoding::DefaultFuchsiaResourceDialect,
11037 0x60459ecef7458176,
11038 >(_buf?)?;
11039 Ok((_response.period, _response.capacity))
11040 }
11041 self.client
11042 .send_query_and_decode::<ProfileProviderRegisterHandlerWithCapacityRequest, (i64, i64)>(
11043 (thread_handle, name, period, capacity),
11044 0x60459ecef7458176,
11045 fidl::encoding::DynamicFlags::empty(),
11046 _decode,
11047 )
11048 }
11049
11050 type UnregisterHandlerResponseFut =
11051 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
11052 fn r#unregister_handler(
11053 &self,
11054 mut thread_handle: fidl::Thread,
11055 mut name: &str,
11056 ) -> Self::UnregisterHandlerResponseFut {
11057 fn _decode(
11058 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11059 ) -> Result<(), fidl::Error> {
11060 let _response = fidl::client::decode_transaction_body::<
11061 fidl::encoding::EmptyPayload,
11062 fidl::encoding::DefaultFuchsiaResourceDialect,
11063 0x724d9d5fd8ef544c,
11064 >(_buf?)?;
11065 Ok(_response)
11066 }
11067 self.client.send_query_and_decode::<ProfileProviderUnregisterHandlerRequest, ()>(
11068 (thread_handle, name),
11069 0x724d9d5fd8ef544c,
11070 fidl::encoding::DynamicFlags::empty(),
11071 _decode,
11072 )
11073 }
11074
11075 type RegisterMemoryRangeResponseFut =
11076 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
11077 fn r#register_memory_range(
11078 &self,
11079 mut vmar_handle: fidl::Vmar,
11080 mut name: &str,
11081 ) -> Self::RegisterMemoryRangeResponseFut {
11082 fn _decode(
11083 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11084 ) -> Result<(), fidl::Error> {
11085 let _response = fidl::client::decode_transaction_body::<
11086 fidl::encoding::EmptyPayload,
11087 fidl::encoding::DefaultFuchsiaResourceDialect,
11088 0x2f509d3523e9562d,
11089 >(_buf?)?;
11090 Ok(_response)
11091 }
11092 self.client.send_query_and_decode::<ProfileProviderRegisterMemoryRangeRequest, ()>(
11093 (vmar_handle, name),
11094 0x2f509d3523e9562d,
11095 fidl::encoding::DynamicFlags::empty(),
11096 _decode,
11097 )
11098 }
11099
11100 type UnregisterMemoryRangeResponseFut =
11101 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
11102 fn r#unregister_memory_range(
11103 &self,
11104 mut vmar_handle: fidl::Vmar,
11105 ) -> Self::UnregisterMemoryRangeResponseFut {
11106 fn _decode(
11107 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11108 ) -> Result<(), fidl::Error> {
11109 let _response = fidl::client::decode_transaction_body::<
11110 fidl::encoding::EmptyPayload,
11111 fidl::encoding::DefaultFuchsiaResourceDialect,
11112 0x2dc313d6aa81ad27,
11113 >(_buf?)?;
11114 Ok(_response)
11115 }
11116 self.client.send_query_and_decode::<ProfileProviderUnregisterMemoryRangeRequest, ()>(
11117 (vmar_handle,),
11118 0x2dc313d6aa81ad27,
11119 fidl::encoding::DynamicFlags::empty(),
11120 _decode,
11121 )
11122 }
11123}
11124
11125pub struct ProfileProviderEventStream {
11126 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11127}
11128
11129impl std::marker::Unpin for ProfileProviderEventStream {}
11130
11131impl futures::stream::FusedStream for ProfileProviderEventStream {
11132 fn is_terminated(&self) -> bool {
11133 self.event_receiver.is_terminated()
11134 }
11135}
11136
11137impl futures::Stream for ProfileProviderEventStream {
11138 type Item = Result<ProfileProviderEvent, fidl::Error>;
11139
11140 fn poll_next(
11141 mut self: std::pin::Pin<&mut Self>,
11142 cx: &mut std::task::Context<'_>,
11143 ) -> std::task::Poll<Option<Self::Item>> {
11144 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
11145 &mut self.event_receiver,
11146 cx
11147 )?) {
11148 Some(buf) => std::task::Poll::Ready(Some(ProfileProviderEvent::decode(buf))),
11149 None => std::task::Poll::Ready(None),
11150 }
11151 }
11152}
11153
11154#[derive(Debug)]
11155pub enum ProfileProviderEvent {}
11156
11157impl ProfileProviderEvent {
11158 fn decode(
11160 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
11161 ) -> Result<ProfileProviderEvent, fidl::Error> {
11162 let (bytes, _handles) = buf.split_mut();
11163 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11164 debug_assert_eq!(tx_header.tx_id, 0);
11165 match tx_header.ordinal {
11166 _ => Err(fidl::Error::UnknownOrdinal {
11167 ordinal: tx_header.ordinal,
11168 protocol_name:
11169 <ProfileProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11170 }),
11171 }
11172 }
11173}
11174
11175pub struct ProfileProviderRequestStream {
11177 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11178 is_terminated: bool,
11179}
11180
11181impl std::marker::Unpin for ProfileProviderRequestStream {}
11182
11183impl futures::stream::FusedStream for ProfileProviderRequestStream {
11184 fn is_terminated(&self) -> bool {
11185 self.is_terminated
11186 }
11187}
11188
11189impl fidl::endpoints::RequestStream for ProfileProviderRequestStream {
11190 type Protocol = ProfileProviderMarker;
11191 type ControlHandle = ProfileProviderControlHandle;
11192
11193 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11194 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11195 }
11196
11197 fn control_handle(&self) -> Self::ControlHandle {
11198 ProfileProviderControlHandle { inner: self.inner.clone() }
11199 }
11200
11201 fn into_inner(
11202 self,
11203 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
11204 {
11205 (self.inner, self.is_terminated)
11206 }
11207
11208 fn from_inner(
11209 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11210 is_terminated: bool,
11211 ) -> Self {
11212 Self { inner, is_terminated }
11213 }
11214}
11215
11216impl futures::Stream for ProfileProviderRequestStream {
11217 type Item = Result<ProfileProviderRequest, fidl::Error>;
11218
11219 fn poll_next(
11220 mut self: std::pin::Pin<&mut Self>,
11221 cx: &mut std::task::Context<'_>,
11222 ) -> std::task::Poll<Option<Self::Item>> {
11223 let this = &mut *self;
11224 if this.inner.check_shutdown(cx) {
11225 this.is_terminated = true;
11226 return std::task::Poll::Ready(None);
11227 }
11228 if this.is_terminated {
11229 panic!("polled ProfileProviderRequestStream after completion");
11230 }
11231 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11232 |bytes, handles| {
11233 match this.inner.channel().read_etc(cx, bytes, handles) {
11234 std::task::Poll::Ready(Ok(())) => {}
11235 std::task::Poll::Pending => return std::task::Poll::Pending,
11236 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11237 this.is_terminated = true;
11238 return std::task::Poll::Ready(None);
11239 }
11240 std::task::Poll::Ready(Err(e)) => {
11241 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11242 e.into(),
11243 ))))
11244 }
11245 }
11246
11247 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11249
11250 std::task::Poll::Ready(Some(match header.ordinal {
11251 0x60459ecef7458176 => {
11252 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11253 let mut req = fidl::new_empty!(
11254 ProfileProviderRegisterHandlerWithCapacityRequest,
11255 fidl::encoding::DefaultFuchsiaResourceDialect
11256 );
11257 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileProviderRegisterHandlerWithCapacityRequest>(&header, _body_bytes, handles, &mut req)?;
11258 let control_handle =
11259 ProfileProviderControlHandle { inner: this.inner.clone() };
11260 Ok(ProfileProviderRequest::RegisterHandlerWithCapacity {
11261 thread_handle: req.thread_handle,
11262 name: req.name,
11263 period: req.period,
11264 capacity: req.capacity,
11265
11266 responder: ProfileProviderRegisterHandlerWithCapacityResponder {
11267 control_handle: std::mem::ManuallyDrop::new(control_handle),
11268 tx_id: header.tx_id,
11269 },
11270 })
11271 }
11272 0x724d9d5fd8ef544c => {
11273 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11274 let mut req = fidl::new_empty!(
11275 ProfileProviderUnregisterHandlerRequest,
11276 fidl::encoding::DefaultFuchsiaResourceDialect
11277 );
11278 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileProviderUnregisterHandlerRequest>(&header, _body_bytes, handles, &mut req)?;
11279 let control_handle =
11280 ProfileProviderControlHandle { inner: this.inner.clone() };
11281 Ok(ProfileProviderRequest::UnregisterHandler {
11282 thread_handle: req.thread_handle,
11283 name: req.name,
11284
11285 responder: ProfileProviderUnregisterHandlerResponder {
11286 control_handle: std::mem::ManuallyDrop::new(control_handle),
11287 tx_id: header.tx_id,
11288 },
11289 })
11290 }
11291 0x2f509d3523e9562d => {
11292 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11293 let mut req = fidl::new_empty!(
11294 ProfileProviderRegisterMemoryRangeRequest,
11295 fidl::encoding::DefaultFuchsiaResourceDialect
11296 );
11297 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileProviderRegisterMemoryRangeRequest>(&header, _body_bytes, handles, &mut req)?;
11298 let control_handle =
11299 ProfileProviderControlHandle { inner: this.inner.clone() };
11300 Ok(ProfileProviderRequest::RegisterMemoryRange {
11301 vmar_handle: req.vmar_handle,
11302 name: req.name,
11303
11304 responder: ProfileProviderRegisterMemoryRangeResponder {
11305 control_handle: std::mem::ManuallyDrop::new(control_handle),
11306 tx_id: header.tx_id,
11307 },
11308 })
11309 }
11310 0x2dc313d6aa81ad27 => {
11311 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11312 let mut req = fidl::new_empty!(
11313 ProfileProviderUnregisterMemoryRangeRequest,
11314 fidl::encoding::DefaultFuchsiaResourceDialect
11315 );
11316 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileProviderUnregisterMemoryRangeRequest>(&header, _body_bytes, handles, &mut req)?;
11317 let control_handle =
11318 ProfileProviderControlHandle { inner: this.inner.clone() };
11319 Ok(ProfileProviderRequest::UnregisterMemoryRange {
11320 vmar_handle: req.vmar_handle,
11321
11322 responder: ProfileProviderUnregisterMemoryRangeResponder {
11323 control_handle: std::mem::ManuallyDrop::new(control_handle),
11324 tx_id: header.tx_id,
11325 },
11326 })
11327 }
11328 _ => Err(fidl::Error::UnknownOrdinal {
11329 ordinal: header.ordinal,
11330 protocol_name:
11331 <ProfileProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11332 }),
11333 }))
11334 },
11335 )
11336 }
11337}
11338
11339#[derive(Debug)]
11340pub enum ProfileProviderRequest {
11341 RegisterHandlerWithCapacity {
11373 thread_handle: fidl::Thread,
11374 name: String,
11375 period: i64,
11376 capacity: f32,
11377 responder: ProfileProviderRegisterHandlerWithCapacityResponder,
11378 },
11379 UnregisterHandler {
11381 thread_handle: fidl::Thread,
11382 name: String,
11383 responder: ProfileProviderUnregisterHandlerResponder,
11384 },
11385 RegisterMemoryRange {
11393 vmar_handle: fidl::Vmar,
11394 name: String,
11395 responder: ProfileProviderRegisterMemoryRangeResponder,
11396 },
11397 UnregisterMemoryRange {
11399 vmar_handle: fidl::Vmar,
11400 responder: ProfileProviderUnregisterMemoryRangeResponder,
11401 },
11402}
11403
11404impl ProfileProviderRequest {
11405 #[allow(irrefutable_let_patterns)]
11406 pub fn into_register_handler_with_capacity(
11407 self,
11408 ) -> Option<(fidl::Thread, String, i64, f32, ProfileProviderRegisterHandlerWithCapacityResponder)>
11409 {
11410 if let ProfileProviderRequest::RegisterHandlerWithCapacity {
11411 thread_handle,
11412 name,
11413 period,
11414 capacity,
11415 responder,
11416 } = self
11417 {
11418 Some((thread_handle, name, period, capacity, responder))
11419 } else {
11420 None
11421 }
11422 }
11423
11424 #[allow(irrefutable_let_patterns)]
11425 pub fn into_unregister_handler(
11426 self,
11427 ) -> Option<(fidl::Thread, String, ProfileProviderUnregisterHandlerResponder)> {
11428 if let ProfileProviderRequest::UnregisterHandler { thread_handle, name, responder } = self {
11429 Some((thread_handle, name, responder))
11430 } else {
11431 None
11432 }
11433 }
11434
11435 #[allow(irrefutable_let_patterns)]
11436 pub fn into_register_memory_range(
11437 self,
11438 ) -> Option<(fidl::Vmar, String, ProfileProviderRegisterMemoryRangeResponder)> {
11439 if let ProfileProviderRequest::RegisterMemoryRange { vmar_handle, name, responder } = self {
11440 Some((vmar_handle, name, responder))
11441 } else {
11442 None
11443 }
11444 }
11445
11446 #[allow(irrefutable_let_patterns)]
11447 pub fn into_unregister_memory_range(
11448 self,
11449 ) -> Option<(fidl::Vmar, ProfileProviderUnregisterMemoryRangeResponder)> {
11450 if let ProfileProviderRequest::UnregisterMemoryRange { vmar_handle, responder } = self {
11451 Some((vmar_handle, responder))
11452 } else {
11453 None
11454 }
11455 }
11456
11457 pub fn method_name(&self) -> &'static str {
11459 match *self {
11460 ProfileProviderRequest::RegisterHandlerWithCapacity { .. } => {
11461 "register_handler_with_capacity"
11462 }
11463 ProfileProviderRequest::UnregisterHandler { .. } => "unregister_handler",
11464 ProfileProviderRequest::RegisterMemoryRange { .. } => "register_memory_range",
11465 ProfileProviderRequest::UnregisterMemoryRange { .. } => "unregister_memory_range",
11466 }
11467 }
11468}
11469
11470#[derive(Debug, Clone)]
11471pub struct ProfileProviderControlHandle {
11472 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11473}
11474
11475impl fidl::endpoints::ControlHandle for ProfileProviderControlHandle {
11476 fn shutdown(&self) {
11477 self.inner.shutdown()
11478 }
11479 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11480 self.inner.shutdown_with_epitaph(status)
11481 }
11482
11483 fn is_closed(&self) -> bool {
11484 self.inner.channel().is_closed()
11485 }
11486 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11487 self.inner.channel().on_closed()
11488 }
11489
11490 #[cfg(target_os = "fuchsia")]
11491 fn signal_peer(
11492 &self,
11493 clear_mask: zx::Signals,
11494 set_mask: zx::Signals,
11495 ) -> Result<(), zx_status::Status> {
11496 use fidl::Peered;
11497 self.inner.channel().signal_peer(clear_mask, set_mask)
11498 }
11499}
11500
11501impl ProfileProviderControlHandle {}
11502
11503#[must_use = "FIDL methods require a response to be sent"]
11504#[derive(Debug)]
11505pub struct ProfileProviderRegisterHandlerWithCapacityResponder {
11506 control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
11507 tx_id: u32,
11508}
11509
11510impl std::ops::Drop for ProfileProviderRegisterHandlerWithCapacityResponder {
11514 fn drop(&mut self) {
11515 self.control_handle.shutdown();
11516 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11518 }
11519}
11520
11521impl fidl::endpoints::Responder for ProfileProviderRegisterHandlerWithCapacityResponder {
11522 type ControlHandle = ProfileProviderControlHandle;
11523
11524 fn control_handle(&self) -> &ProfileProviderControlHandle {
11525 &self.control_handle
11526 }
11527
11528 fn drop_without_shutdown(mut self) {
11529 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11531 std::mem::forget(self);
11533 }
11534}
11535
11536impl ProfileProviderRegisterHandlerWithCapacityResponder {
11537 pub fn send(self, mut period: i64, mut capacity: i64) -> Result<(), fidl::Error> {
11541 let _result = self.send_raw(period, capacity);
11542 if _result.is_err() {
11543 self.control_handle.shutdown();
11544 }
11545 self.drop_without_shutdown();
11546 _result
11547 }
11548
11549 pub fn send_no_shutdown_on_err(
11551 self,
11552 mut period: i64,
11553 mut capacity: i64,
11554 ) -> Result<(), fidl::Error> {
11555 let _result = self.send_raw(period, capacity);
11556 self.drop_without_shutdown();
11557 _result
11558 }
11559
11560 fn send_raw(&self, mut period: i64, mut capacity: i64) -> Result<(), fidl::Error> {
11561 self.control_handle.inner.send::<ProfileProviderRegisterHandlerWithCapacityResponse>(
11562 (period, capacity),
11563 self.tx_id,
11564 0x60459ecef7458176,
11565 fidl::encoding::DynamicFlags::empty(),
11566 )
11567 }
11568}
11569
11570#[must_use = "FIDL methods require a response to be sent"]
11571#[derive(Debug)]
11572pub struct ProfileProviderUnregisterHandlerResponder {
11573 control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
11574 tx_id: u32,
11575}
11576
11577impl std::ops::Drop for ProfileProviderUnregisterHandlerResponder {
11581 fn drop(&mut self) {
11582 self.control_handle.shutdown();
11583 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11585 }
11586}
11587
11588impl fidl::endpoints::Responder for ProfileProviderUnregisterHandlerResponder {
11589 type ControlHandle = ProfileProviderControlHandle;
11590
11591 fn control_handle(&self) -> &ProfileProviderControlHandle {
11592 &self.control_handle
11593 }
11594
11595 fn drop_without_shutdown(mut self) {
11596 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11598 std::mem::forget(self);
11600 }
11601}
11602
11603impl ProfileProviderUnregisterHandlerResponder {
11604 pub fn send(self) -> Result<(), fidl::Error> {
11608 let _result = self.send_raw();
11609 if _result.is_err() {
11610 self.control_handle.shutdown();
11611 }
11612 self.drop_without_shutdown();
11613 _result
11614 }
11615
11616 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
11618 let _result = self.send_raw();
11619 self.drop_without_shutdown();
11620 _result
11621 }
11622
11623 fn send_raw(&self) -> Result<(), fidl::Error> {
11624 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11625 (),
11626 self.tx_id,
11627 0x724d9d5fd8ef544c,
11628 fidl::encoding::DynamicFlags::empty(),
11629 )
11630 }
11631}
11632
11633#[must_use = "FIDL methods require a response to be sent"]
11634#[derive(Debug)]
11635pub struct ProfileProviderRegisterMemoryRangeResponder {
11636 control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
11637 tx_id: u32,
11638}
11639
11640impl std::ops::Drop for ProfileProviderRegisterMemoryRangeResponder {
11644 fn drop(&mut self) {
11645 self.control_handle.shutdown();
11646 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11648 }
11649}
11650
11651impl fidl::endpoints::Responder for ProfileProviderRegisterMemoryRangeResponder {
11652 type ControlHandle = ProfileProviderControlHandle;
11653
11654 fn control_handle(&self) -> &ProfileProviderControlHandle {
11655 &self.control_handle
11656 }
11657
11658 fn drop_without_shutdown(mut self) {
11659 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11661 std::mem::forget(self);
11663 }
11664}
11665
11666impl ProfileProviderRegisterMemoryRangeResponder {
11667 pub fn send(self) -> Result<(), fidl::Error> {
11671 let _result = self.send_raw();
11672 if _result.is_err() {
11673 self.control_handle.shutdown();
11674 }
11675 self.drop_without_shutdown();
11676 _result
11677 }
11678
11679 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
11681 let _result = self.send_raw();
11682 self.drop_without_shutdown();
11683 _result
11684 }
11685
11686 fn send_raw(&self) -> Result<(), fidl::Error> {
11687 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11688 (),
11689 self.tx_id,
11690 0x2f509d3523e9562d,
11691 fidl::encoding::DynamicFlags::empty(),
11692 )
11693 }
11694}
11695
11696#[must_use = "FIDL methods require a response to be sent"]
11697#[derive(Debug)]
11698pub struct ProfileProviderUnregisterMemoryRangeResponder {
11699 control_handle: std::mem::ManuallyDrop<ProfileProviderControlHandle>,
11700 tx_id: u32,
11701}
11702
11703impl std::ops::Drop for ProfileProviderUnregisterMemoryRangeResponder {
11707 fn drop(&mut self) {
11708 self.control_handle.shutdown();
11709 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11711 }
11712}
11713
11714impl fidl::endpoints::Responder for ProfileProviderUnregisterMemoryRangeResponder {
11715 type ControlHandle = ProfileProviderControlHandle;
11716
11717 fn control_handle(&self) -> &ProfileProviderControlHandle {
11718 &self.control_handle
11719 }
11720
11721 fn drop_without_shutdown(mut self) {
11722 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11724 std::mem::forget(self);
11726 }
11727}
11728
11729impl ProfileProviderUnregisterMemoryRangeResponder {
11730 pub fn send(self) -> Result<(), fidl::Error> {
11734 let _result = self.send_raw();
11735 if _result.is_err() {
11736 self.control_handle.shutdown();
11737 }
11738 self.drop_without_shutdown();
11739 _result
11740 }
11741
11742 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
11744 let _result = self.send_raw();
11745 self.drop_without_shutdown();
11746 _result
11747 }
11748
11749 fn send_raw(&self) -> Result<(), fidl::Error> {
11750 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11751 (),
11752 self.tx_id,
11753 0x2dc313d6aa81ad27,
11754 fidl::encoding::DynamicFlags::empty(),
11755 )
11756 }
11757}
11758
11759#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11760pub struct SessionAudioConsumerFactoryMarker;
11761
11762impl fidl::endpoints::ProtocolMarker for SessionAudioConsumerFactoryMarker {
11763 type Proxy = SessionAudioConsumerFactoryProxy;
11764 type RequestStream = SessionAudioConsumerFactoryRequestStream;
11765 #[cfg(target_os = "fuchsia")]
11766 type SynchronousProxy = SessionAudioConsumerFactorySynchronousProxy;
11767
11768 const DEBUG_NAME: &'static str = "fuchsia.media.SessionAudioConsumerFactory";
11769}
11770impl fidl::endpoints::DiscoverableProtocolMarker for SessionAudioConsumerFactoryMarker {}
11771
11772pub trait SessionAudioConsumerFactoryProxyInterface: Send + Sync {
11773 fn r#create_audio_consumer(
11774 &self,
11775 session_id: u64,
11776 audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
11777 ) -> Result<(), fidl::Error>;
11778}
11779#[derive(Debug)]
11780#[cfg(target_os = "fuchsia")]
11781pub struct SessionAudioConsumerFactorySynchronousProxy {
11782 client: fidl::client::sync::Client,
11783}
11784
11785#[cfg(target_os = "fuchsia")]
11786impl fidl::endpoints::SynchronousProxy for SessionAudioConsumerFactorySynchronousProxy {
11787 type Proxy = SessionAudioConsumerFactoryProxy;
11788 type Protocol = SessionAudioConsumerFactoryMarker;
11789
11790 fn from_channel(inner: fidl::Channel) -> Self {
11791 Self::new(inner)
11792 }
11793
11794 fn into_channel(self) -> fidl::Channel {
11795 self.client.into_channel()
11796 }
11797
11798 fn as_channel(&self) -> &fidl::Channel {
11799 self.client.as_channel()
11800 }
11801}
11802
11803#[cfg(target_os = "fuchsia")]
11804impl SessionAudioConsumerFactorySynchronousProxy {
11805 pub fn new(channel: fidl::Channel) -> Self {
11806 let protocol_name =
11807 <SessionAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11808 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
11809 }
11810
11811 pub fn into_channel(self) -> fidl::Channel {
11812 self.client.into_channel()
11813 }
11814
11815 pub fn wait_for_event(
11818 &self,
11819 deadline: zx::MonotonicInstant,
11820 ) -> Result<SessionAudioConsumerFactoryEvent, fidl::Error> {
11821 SessionAudioConsumerFactoryEvent::decode(self.client.wait_for_event(deadline)?)
11822 }
11823
11824 pub fn r#create_audio_consumer(
11828 &self,
11829 mut session_id: u64,
11830 mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
11831 ) -> Result<(), fidl::Error> {
11832 self.client.send::<SessionAudioConsumerFactoryCreateAudioConsumerRequest>(
11833 (session_id, audio_consumer_request),
11834 0x6fab96f988e7d7fb,
11835 fidl::encoding::DynamicFlags::empty(),
11836 )
11837 }
11838}
11839
11840#[cfg(target_os = "fuchsia")]
11841impl From<SessionAudioConsumerFactorySynchronousProxy> for zx::Handle {
11842 fn from(value: SessionAudioConsumerFactorySynchronousProxy) -> Self {
11843 value.into_channel().into()
11844 }
11845}
11846
11847#[cfg(target_os = "fuchsia")]
11848impl From<fidl::Channel> for SessionAudioConsumerFactorySynchronousProxy {
11849 fn from(value: fidl::Channel) -> Self {
11850 Self::new(value)
11851 }
11852}
11853
11854#[derive(Debug, Clone)]
11855pub struct SessionAudioConsumerFactoryProxy {
11856 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11857}
11858
11859impl fidl::endpoints::Proxy for SessionAudioConsumerFactoryProxy {
11860 type Protocol = SessionAudioConsumerFactoryMarker;
11861
11862 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11863 Self::new(inner)
11864 }
11865
11866 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11867 self.client.into_channel().map_err(|client| Self { client })
11868 }
11869
11870 fn as_channel(&self) -> &::fidl::AsyncChannel {
11871 self.client.as_channel()
11872 }
11873}
11874
11875impl SessionAudioConsumerFactoryProxy {
11876 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11878 let protocol_name =
11879 <SessionAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11880 Self { client: fidl::client::Client::new(channel, protocol_name) }
11881 }
11882
11883 pub fn take_event_stream(&self) -> SessionAudioConsumerFactoryEventStream {
11889 SessionAudioConsumerFactoryEventStream { event_receiver: self.client.take_event_receiver() }
11890 }
11891
11892 pub fn r#create_audio_consumer(
11896 &self,
11897 mut session_id: u64,
11898 mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
11899 ) -> Result<(), fidl::Error> {
11900 SessionAudioConsumerFactoryProxyInterface::r#create_audio_consumer(
11901 self,
11902 session_id,
11903 audio_consumer_request,
11904 )
11905 }
11906}
11907
11908impl SessionAudioConsumerFactoryProxyInterface for SessionAudioConsumerFactoryProxy {
11909 fn r#create_audio_consumer(
11910 &self,
11911 mut session_id: u64,
11912 mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
11913 ) -> Result<(), fidl::Error> {
11914 self.client.send::<SessionAudioConsumerFactoryCreateAudioConsumerRequest>(
11915 (session_id, audio_consumer_request),
11916 0x6fab96f988e7d7fb,
11917 fidl::encoding::DynamicFlags::empty(),
11918 )
11919 }
11920}
11921
11922pub struct SessionAudioConsumerFactoryEventStream {
11923 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11924}
11925
11926impl std::marker::Unpin for SessionAudioConsumerFactoryEventStream {}
11927
11928impl futures::stream::FusedStream for SessionAudioConsumerFactoryEventStream {
11929 fn is_terminated(&self) -> bool {
11930 self.event_receiver.is_terminated()
11931 }
11932}
11933
11934impl futures::Stream for SessionAudioConsumerFactoryEventStream {
11935 type Item = Result<SessionAudioConsumerFactoryEvent, fidl::Error>;
11936
11937 fn poll_next(
11938 mut self: std::pin::Pin<&mut Self>,
11939 cx: &mut std::task::Context<'_>,
11940 ) -> std::task::Poll<Option<Self::Item>> {
11941 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
11942 &mut self.event_receiver,
11943 cx
11944 )?) {
11945 Some(buf) => {
11946 std::task::Poll::Ready(Some(SessionAudioConsumerFactoryEvent::decode(buf)))
11947 }
11948 None => std::task::Poll::Ready(None),
11949 }
11950 }
11951}
11952
11953#[derive(Debug)]
11954pub enum SessionAudioConsumerFactoryEvent {}
11955
11956impl SessionAudioConsumerFactoryEvent {
11957 fn decode(
11959 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
11960 ) -> Result<SessionAudioConsumerFactoryEvent, fidl::Error> {
11961 let (bytes, _handles) = buf.split_mut();
11962 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11963 debug_assert_eq!(tx_header.tx_id, 0);
11964 match tx_header.ordinal {
11965 _ => Err(fidl::Error::UnknownOrdinal {
11966 ordinal: tx_header.ordinal,
11967 protocol_name: <SessionAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11968 })
11969 }
11970 }
11971}
11972
11973pub struct SessionAudioConsumerFactoryRequestStream {
11975 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11976 is_terminated: bool,
11977}
11978
11979impl std::marker::Unpin for SessionAudioConsumerFactoryRequestStream {}
11980
11981impl futures::stream::FusedStream for SessionAudioConsumerFactoryRequestStream {
11982 fn is_terminated(&self) -> bool {
11983 self.is_terminated
11984 }
11985}
11986
11987impl fidl::endpoints::RequestStream for SessionAudioConsumerFactoryRequestStream {
11988 type Protocol = SessionAudioConsumerFactoryMarker;
11989 type ControlHandle = SessionAudioConsumerFactoryControlHandle;
11990
11991 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11992 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11993 }
11994
11995 fn control_handle(&self) -> Self::ControlHandle {
11996 SessionAudioConsumerFactoryControlHandle { inner: self.inner.clone() }
11997 }
11998
11999 fn into_inner(
12000 self,
12001 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12002 {
12003 (self.inner, self.is_terminated)
12004 }
12005
12006 fn from_inner(
12007 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12008 is_terminated: bool,
12009 ) -> Self {
12010 Self { inner, is_terminated }
12011 }
12012}
12013
12014impl futures::Stream for SessionAudioConsumerFactoryRequestStream {
12015 type Item = Result<SessionAudioConsumerFactoryRequest, fidl::Error>;
12016
12017 fn poll_next(
12018 mut self: std::pin::Pin<&mut Self>,
12019 cx: &mut std::task::Context<'_>,
12020 ) -> std::task::Poll<Option<Self::Item>> {
12021 let this = &mut *self;
12022 if this.inner.check_shutdown(cx) {
12023 this.is_terminated = true;
12024 return std::task::Poll::Ready(None);
12025 }
12026 if this.is_terminated {
12027 panic!("polled SessionAudioConsumerFactoryRequestStream after completion");
12028 }
12029 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12030 |bytes, handles| {
12031 match this.inner.channel().read_etc(cx, bytes, handles) {
12032 std::task::Poll::Ready(Ok(())) => {}
12033 std::task::Poll::Pending => return std::task::Poll::Pending,
12034 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12035 this.is_terminated = true;
12036 return std::task::Poll::Ready(None);
12037 }
12038 std::task::Poll::Ready(Err(e)) => {
12039 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12040 e.into(),
12041 ))))
12042 }
12043 }
12044
12045 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12047
12048 std::task::Poll::Ready(Some(match header.ordinal {
12049 0x6fab96f988e7d7fb => {
12050 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12051 let mut req = fidl::new_empty!(SessionAudioConsumerFactoryCreateAudioConsumerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12052 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionAudioConsumerFactoryCreateAudioConsumerRequest>(&header, _body_bytes, handles, &mut req)?;
12053 let control_handle = SessionAudioConsumerFactoryControlHandle {
12054 inner: this.inner.clone(),
12055 };
12056 Ok(SessionAudioConsumerFactoryRequest::CreateAudioConsumer {session_id: req.session_id,
12057audio_consumer_request: req.audio_consumer_request,
12058
12059 control_handle,
12060 })
12061 }
12062 _ => Err(fidl::Error::UnknownOrdinal {
12063 ordinal: header.ordinal,
12064 protocol_name: <SessionAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12065 }),
12066 }))
12067 },
12068 )
12069 }
12070}
12071
12072#[derive(Debug)]
12074pub enum SessionAudioConsumerFactoryRequest {
12075 CreateAudioConsumer {
12079 session_id: u64,
12080 audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
12081 control_handle: SessionAudioConsumerFactoryControlHandle,
12082 },
12083}
12084
12085impl SessionAudioConsumerFactoryRequest {
12086 #[allow(irrefutable_let_patterns)]
12087 pub fn into_create_audio_consumer(
12088 self,
12089 ) -> Option<(
12090 u64,
12091 fidl::endpoints::ServerEnd<AudioConsumerMarker>,
12092 SessionAudioConsumerFactoryControlHandle,
12093 )> {
12094 if let SessionAudioConsumerFactoryRequest::CreateAudioConsumer {
12095 session_id,
12096 audio_consumer_request,
12097 control_handle,
12098 } = self
12099 {
12100 Some((session_id, audio_consumer_request, control_handle))
12101 } else {
12102 None
12103 }
12104 }
12105
12106 pub fn method_name(&self) -> &'static str {
12108 match *self {
12109 SessionAudioConsumerFactoryRequest::CreateAudioConsumer { .. } => {
12110 "create_audio_consumer"
12111 }
12112 }
12113 }
12114}
12115
12116#[derive(Debug, Clone)]
12117pub struct SessionAudioConsumerFactoryControlHandle {
12118 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12119}
12120
12121impl fidl::endpoints::ControlHandle for SessionAudioConsumerFactoryControlHandle {
12122 fn shutdown(&self) {
12123 self.inner.shutdown()
12124 }
12125 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
12126 self.inner.shutdown_with_epitaph(status)
12127 }
12128
12129 fn is_closed(&self) -> bool {
12130 self.inner.channel().is_closed()
12131 }
12132 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
12133 self.inner.channel().on_closed()
12134 }
12135
12136 #[cfg(target_os = "fuchsia")]
12137 fn signal_peer(
12138 &self,
12139 clear_mask: zx::Signals,
12140 set_mask: zx::Signals,
12141 ) -> Result<(), zx_status::Status> {
12142 use fidl::Peered;
12143 self.inner.channel().signal_peer(clear_mask, set_mask)
12144 }
12145}
12146
12147impl SessionAudioConsumerFactoryControlHandle {}
12148
12149#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
12150pub struct SimpleStreamSinkMarker;
12151
12152impl fidl::endpoints::ProtocolMarker for SimpleStreamSinkMarker {
12153 type Proxy = SimpleStreamSinkProxy;
12154 type RequestStream = SimpleStreamSinkRequestStream;
12155 #[cfg(target_os = "fuchsia")]
12156 type SynchronousProxy = SimpleStreamSinkSynchronousProxy;
12157
12158 const DEBUG_NAME: &'static str = "(anonymous) SimpleStreamSink";
12159}
12160
12161pub trait SimpleStreamSinkProxyInterface: Send + Sync {
12162 fn r#add_payload_buffer(&self, id: u32, payload_buffer: fidl::Vmo) -> Result<(), fidl::Error>;
12163 fn r#remove_payload_buffer(&self, id: u32) -> Result<(), fidl::Error>;
12164 type SendPacketResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
12165 fn r#send_packet(&self, packet: &StreamPacket) -> Self::SendPacketResponseFut;
12166 fn r#send_packet_no_reply(&self, packet: &StreamPacket) -> Result<(), fidl::Error>;
12167 fn r#end_of_stream(&self) -> Result<(), fidl::Error>;
12168 type DiscardAllPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
12169 fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut;
12170 fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error>;
12171}
12172#[derive(Debug)]
12173#[cfg(target_os = "fuchsia")]
12174pub struct SimpleStreamSinkSynchronousProxy {
12175 client: fidl::client::sync::Client,
12176}
12177
12178#[cfg(target_os = "fuchsia")]
12179impl fidl::endpoints::SynchronousProxy for SimpleStreamSinkSynchronousProxy {
12180 type Proxy = SimpleStreamSinkProxy;
12181 type Protocol = SimpleStreamSinkMarker;
12182
12183 fn from_channel(inner: fidl::Channel) -> Self {
12184 Self::new(inner)
12185 }
12186
12187 fn into_channel(self) -> fidl::Channel {
12188 self.client.into_channel()
12189 }
12190
12191 fn as_channel(&self) -> &fidl::Channel {
12192 self.client.as_channel()
12193 }
12194}
12195
12196#[cfg(target_os = "fuchsia")]
12197impl SimpleStreamSinkSynchronousProxy {
12198 pub fn new(channel: fidl::Channel) -> Self {
12199 let protocol_name = <SimpleStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12200 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
12201 }
12202
12203 pub fn into_channel(self) -> fidl::Channel {
12204 self.client.into_channel()
12205 }
12206
12207 pub fn wait_for_event(
12210 &self,
12211 deadline: zx::MonotonicInstant,
12212 ) -> Result<SimpleStreamSinkEvent, fidl::Error> {
12213 SimpleStreamSinkEvent::decode(self.client.wait_for_event(deadline)?)
12214 }
12215
12216 pub fn r#add_payload_buffer(
12223 &self,
12224 mut id: u32,
12225 mut payload_buffer: fidl::Vmo,
12226 ) -> Result<(), fidl::Error> {
12227 self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
12228 (id, payload_buffer),
12229 0x3b3a37fc34fe5b56,
12230 fidl::encoding::DynamicFlags::empty(),
12231 )
12232 }
12233
12234 pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
12240 self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
12241 (id,),
12242 0x5d1e4f74c3658262,
12243 fidl::encoding::DynamicFlags::empty(),
12244 )
12245 }
12246
12247 pub fn r#send_packet(
12253 &self,
12254 mut packet: &StreamPacket,
12255 ___deadline: zx::MonotonicInstant,
12256 ) -> Result<(), fidl::Error> {
12257 let _response =
12258 self.client.send_query::<StreamSinkSendPacketRequest, fidl::encoding::EmptyPayload>(
12259 (packet,),
12260 0x67cddd607442775f,
12261 fidl::encoding::DynamicFlags::empty(),
12262 ___deadline,
12263 )?;
12264 Ok(_response)
12265 }
12266
12267 pub fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
12274 self.client.send::<StreamSinkSendPacketNoReplyRequest>(
12275 (packet,),
12276 0x8d9b8b413ceba9d,
12277 fidl::encoding::DynamicFlags::empty(),
12278 )
12279 }
12280
12281 pub fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
12284 self.client.send::<fidl::encoding::EmptyPayload>(
12285 (),
12286 0x6180fd6f7e793b71,
12287 fidl::encoding::DynamicFlags::empty(),
12288 )
12289 }
12290
12291 pub fn r#discard_all_packets(
12295 &self,
12296 ___deadline: zx::MonotonicInstant,
12297 ) -> Result<(), fidl::Error> {
12298 let _response =
12299 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
12300 (),
12301 0x6f4dad7af2917665,
12302 fidl::encoding::DynamicFlags::empty(),
12303 ___deadline,
12304 )?;
12305 Ok(_response)
12306 }
12307
12308 pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
12311 self.client.send::<fidl::encoding::EmptyPayload>(
12312 (),
12313 0x50d36d0d23081bc4,
12314 fidl::encoding::DynamicFlags::empty(),
12315 )
12316 }
12317}
12318
12319#[cfg(target_os = "fuchsia")]
12320impl From<SimpleStreamSinkSynchronousProxy> for zx::Handle {
12321 fn from(value: SimpleStreamSinkSynchronousProxy) -> Self {
12322 value.into_channel().into()
12323 }
12324}
12325
12326#[cfg(target_os = "fuchsia")]
12327impl From<fidl::Channel> for SimpleStreamSinkSynchronousProxy {
12328 fn from(value: fidl::Channel) -> Self {
12329 Self::new(value)
12330 }
12331}
12332
12333#[derive(Debug, Clone)]
12334pub struct SimpleStreamSinkProxy {
12335 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
12336}
12337
12338impl fidl::endpoints::Proxy for SimpleStreamSinkProxy {
12339 type Protocol = SimpleStreamSinkMarker;
12340
12341 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
12342 Self::new(inner)
12343 }
12344
12345 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
12346 self.client.into_channel().map_err(|client| Self { client })
12347 }
12348
12349 fn as_channel(&self) -> &::fidl::AsyncChannel {
12350 self.client.as_channel()
12351 }
12352}
12353
12354impl SimpleStreamSinkProxy {
12355 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
12357 let protocol_name = <SimpleStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12358 Self { client: fidl::client::Client::new(channel, protocol_name) }
12359 }
12360
12361 pub fn take_event_stream(&self) -> SimpleStreamSinkEventStream {
12367 SimpleStreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
12368 }
12369
12370 pub fn r#add_payload_buffer(
12377 &self,
12378 mut id: u32,
12379 mut payload_buffer: fidl::Vmo,
12380 ) -> Result<(), fidl::Error> {
12381 SimpleStreamSinkProxyInterface::r#add_payload_buffer(self, id, payload_buffer)
12382 }
12383
12384 pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
12390 SimpleStreamSinkProxyInterface::r#remove_payload_buffer(self, id)
12391 }
12392
12393 pub fn r#send_packet(
12399 &self,
12400 mut packet: &StreamPacket,
12401 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
12402 SimpleStreamSinkProxyInterface::r#send_packet(self, packet)
12403 }
12404
12405 pub fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
12412 SimpleStreamSinkProxyInterface::r#send_packet_no_reply(self, packet)
12413 }
12414
12415 pub fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
12418 SimpleStreamSinkProxyInterface::r#end_of_stream(self)
12419 }
12420
12421 pub fn r#discard_all_packets(
12425 &self,
12426 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
12427 SimpleStreamSinkProxyInterface::r#discard_all_packets(self)
12428 }
12429
12430 pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
12433 SimpleStreamSinkProxyInterface::r#discard_all_packets_no_reply(self)
12434 }
12435}
12436
12437impl SimpleStreamSinkProxyInterface for SimpleStreamSinkProxy {
12438 fn r#add_payload_buffer(
12439 &self,
12440 mut id: u32,
12441 mut payload_buffer: fidl::Vmo,
12442 ) -> Result<(), fidl::Error> {
12443 self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
12444 (id, payload_buffer),
12445 0x3b3a37fc34fe5b56,
12446 fidl::encoding::DynamicFlags::empty(),
12447 )
12448 }
12449
12450 fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
12451 self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
12452 (id,),
12453 0x5d1e4f74c3658262,
12454 fidl::encoding::DynamicFlags::empty(),
12455 )
12456 }
12457
12458 type SendPacketResponseFut =
12459 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
12460 fn r#send_packet(&self, mut packet: &StreamPacket) -> Self::SendPacketResponseFut {
12461 fn _decode(
12462 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
12463 ) -> Result<(), fidl::Error> {
12464 let _response = fidl::client::decode_transaction_body::<
12465 fidl::encoding::EmptyPayload,
12466 fidl::encoding::DefaultFuchsiaResourceDialect,
12467 0x67cddd607442775f,
12468 >(_buf?)?;
12469 Ok(_response)
12470 }
12471 self.client.send_query_and_decode::<StreamSinkSendPacketRequest, ()>(
12472 (packet,),
12473 0x67cddd607442775f,
12474 fidl::encoding::DynamicFlags::empty(),
12475 _decode,
12476 )
12477 }
12478
12479 fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
12480 self.client.send::<StreamSinkSendPacketNoReplyRequest>(
12481 (packet,),
12482 0x8d9b8b413ceba9d,
12483 fidl::encoding::DynamicFlags::empty(),
12484 )
12485 }
12486
12487 fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
12488 self.client.send::<fidl::encoding::EmptyPayload>(
12489 (),
12490 0x6180fd6f7e793b71,
12491 fidl::encoding::DynamicFlags::empty(),
12492 )
12493 }
12494
12495 type DiscardAllPacketsResponseFut =
12496 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
12497 fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut {
12498 fn _decode(
12499 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
12500 ) -> Result<(), fidl::Error> {
12501 let _response = fidl::client::decode_transaction_body::<
12502 fidl::encoding::EmptyPayload,
12503 fidl::encoding::DefaultFuchsiaResourceDialect,
12504 0x6f4dad7af2917665,
12505 >(_buf?)?;
12506 Ok(_response)
12507 }
12508 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
12509 (),
12510 0x6f4dad7af2917665,
12511 fidl::encoding::DynamicFlags::empty(),
12512 _decode,
12513 )
12514 }
12515
12516 fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
12517 self.client.send::<fidl::encoding::EmptyPayload>(
12518 (),
12519 0x50d36d0d23081bc4,
12520 fidl::encoding::DynamicFlags::empty(),
12521 )
12522 }
12523}
12524
12525pub struct SimpleStreamSinkEventStream {
12526 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12527}
12528
12529impl std::marker::Unpin for SimpleStreamSinkEventStream {}
12530
12531impl futures::stream::FusedStream for SimpleStreamSinkEventStream {
12532 fn is_terminated(&self) -> bool {
12533 self.event_receiver.is_terminated()
12534 }
12535}
12536
12537impl futures::Stream for SimpleStreamSinkEventStream {
12538 type Item = Result<SimpleStreamSinkEvent, fidl::Error>;
12539
12540 fn poll_next(
12541 mut self: std::pin::Pin<&mut Self>,
12542 cx: &mut std::task::Context<'_>,
12543 ) -> std::task::Poll<Option<Self::Item>> {
12544 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
12545 &mut self.event_receiver,
12546 cx
12547 )?) {
12548 Some(buf) => std::task::Poll::Ready(Some(SimpleStreamSinkEvent::decode(buf))),
12549 None => std::task::Poll::Ready(None),
12550 }
12551 }
12552}
12553
12554#[derive(Debug)]
12555pub enum SimpleStreamSinkEvent {}
12556
12557impl SimpleStreamSinkEvent {
12558 fn decode(
12560 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
12561 ) -> Result<SimpleStreamSinkEvent, fidl::Error> {
12562 let (bytes, _handles) = buf.split_mut();
12563 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12564 debug_assert_eq!(tx_header.tx_id, 0);
12565 match tx_header.ordinal {
12566 _ => Err(fidl::Error::UnknownOrdinal {
12567 ordinal: tx_header.ordinal,
12568 protocol_name:
12569 <SimpleStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12570 }),
12571 }
12572 }
12573}
12574
12575pub struct SimpleStreamSinkRequestStream {
12577 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12578 is_terminated: bool,
12579}
12580
12581impl std::marker::Unpin for SimpleStreamSinkRequestStream {}
12582
12583impl futures::stream::FusedStream for SimpleStreamSinkRequestStream {
12584 fn is_terminated(&self) -> bool {
12585 self.is_terminated
12586 }
12587}
12588
12589impl fidl::endpoints::RequestStream for SimpleStreamSinkRequestStream {
12590 type Protocol = SimpleStreamSinkMarker;
12591 type ControlHandle = SimpleStreamSinkControlHandle;
12592
12593 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
12594 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
12595 }
12596
12597 fn control_handle(&self) -> Self::ControlHandle {
12598 SimpleStreamSinkControlHandle { inner: self.inner.clone() }
12599 }
12600
12601 fn into_inner(
12602 self,
12603 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12604 {
12605 (self.inner, self.is_terminated)
12606 }
12607
12608 fn from_inner(
12609 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12610 is_terminated: bool,
12611 ) -> Self {
12612 Self { inner, is_terminated }
12613 }
12614}
12615
12616impl futures::Stream for SimpleStreamSinkRequestStream {
12617 type Item = Result<SimpleStreamSinkRequest, fidl::Error>;
12618
12619 fn poll_next(
12620 mut self: std::pin::Pin<&mut Self>,
12621 cx: &mut std::task::Context<'_>,
12622 ) -> std::task::Poll<Option<Self::Item>> {
12623 let this = &mut *self;
12624 if this.inner.check_shutdown(cx) {
12625 this.is_terminated = true;
12626 return std::task::Poll::Ready(None);
12627 }
12628 if this.is_terminated {
12629 panic!("polled SimpleStreamSinkRequestStream after completion");
12630 }
12631 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12632 |bytes, handles| {
12633 match this.inner.channel().read_etc(cx, bytes, handles) {
12634 std::task::Poll::Ready(Ok(())) => {}
12635 std::task::Poll::Pending => return std::task::Poll::Pending,
12636 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12637 this.is_terminated = true;
12638 return std::task::Poll::Ready(None);
12639 }
12640 std::task::Poll::Ready(Err(e)) => {
12641 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12642 e.into(),
12643 ))))
12644 }
12645 }
12646
12647 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12649
12650 std::task::Poll::Ready(Some(match header.ordinal {
12651 0x3b3a37fc34fe5b56 => {
12652 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12653 let mut req = fidl::new_empty!(
12654 StreamBufferSetAddPayloadBufferRequest,
12655 fidl::encoding::DefaultFuchsiaResourceDialect
12656 );
12657 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetAddPayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
12658 let control_handle =
12659 SimpleStreamSinkControlHandle { inner: this.inner.clone() };
12660 Ok(SimpleStreamSinkRequest::AddPayloadBuffer {
12661 id: req.id,
12662 payload_buffer: req.payload_buffer,
12663
12664 control_handle,
12665 })
12666 }
12667 0x5d1e4f74c3658262 => {
12668 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12669 let mut req = fidl::new_empty!(
12670 StreamBufferSetRemovePayloadBufferRequest,
12671 fidl::encoding::DefaultFuchsiaResourceDialect
12672 );
12673 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetRemovePayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
12674 let control_handle =
12675 SimpleStreamSinkControlHandle { inner: this.inner.clone() };
12676 Ok(SimpleStreamSinkRequest::RemovePayloadBuffer {
12677 id: req.id,
12678
12679 control_handle,
12680 })
12681 }
12682 0x67cddd607442775f => {
12683 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12684 let mut req = fidl::new_empty!(
12685 StreamSinkSendPacketRequest,
12686 fidl::encoding::DefaultFuchsiaResourceDialect
12687 );
12688 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkSendPacketRequest>(&header, _body_bytes, handles, &mut req)?;
12689 let control_handle =
12690 SimpleStreamSinkControlHandle { inner: this.inner.clone() };
12691 Ok(SimpleStreamSinkRequest::SendPacket {
12692 packet: req.packet,
12693
12694 responder: SimpleStreamSinkSendPacketResponder {
12695 control_handle: std::mem::ManuallyDrop::new(control_handle),
12696 tx_id: header.tx_id,
12697 },
12698 })
12699 }
12700 0x8d9b8b413ceba9d => {
12701 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12702 let mut req = fidl::new_empty!(
12703 StreamSinkSendPacketNoReplyRequest,
12704 fidl::encoding::DefaultFuchsiaResourceDialect
12705 );
12706 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkSendPacketNoReplyRequest>(&header, _body_bytes, handles, &mut req)?;
12707 let control_handle =
12708 SimpleStreamSinkControlHandle { inner: this.inner.clone() };
12709 Ok(SimpleStreamSinkRequest::SendPacketNoReply {
12710 packet: req.packet,
12711
12712 control_handle,
12713 })
12714 }
12715 0x6180fd6f7e793b71 => {
12716 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12717 let mut req = fidl::new_empty!(
12718 fidl::encoding::EmptyPayload,
12719 fidl::encoding::DefaultFuchsiaResourceDialect
12720 );
12721 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12722 let control_handle =
12723 SimpleStreamSinkControlHandle { inner: this.inner.clone() };
12724 Ok(SimpleStreamSinkRequest::EndOfStream { control_handle })
12725 }
12726 0x6f4dad7af2917665 => {
12727 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12728 let mut req = fidl::new_empty!(
12729 fidl::encoding::EmptyPayload,
12730 fidl::encoding::DefaultFuchsiaResourceDialect
12731 );
12732 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12733 let control_handle =
12734 SimpleStreamSinkControlHandle { inner: this.inner.clone() };
12735 Ok(SimpleStreamSinkRequest::DiscardAllPackets {
12736 responder: SimpleStreamSinkDiscardAllPacketsResponder {
12737 control_handle: std::mem::ManuallyDrop::new(control_handle),
12738 tx_id: header.tx_id,
12739 },
12740 })
12741 }
12742 0x50d36d0d23081bc4 => {
12743 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12744 let mut req = fidl::new_empty!(
12745 fidl::encoding::EmptyPayload,
12746 fidl::encoding::DefaultFuchsiaResourceDialect
12747 );
12748 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12749 let control_handle =
12750 SimpleStreamSinkControlHandle { inner: this.inner.clone() };
12751 Ok(SimpleStreamSinkRequest::DiscardAllPacketsNoReply { control_handle })
12752 }
12753 _ => Err(fidl::Error::UnknownOrdinal {
12754 ordinal: header.ordinal,
12755 protocol_name:
12756 <SimpleStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12757 }),
12758 }))
12759 },
12760 )
12761 }
12762}
12763
12764#[derive(Debug)]
12766pub enum SimpleStreamSinkRequest {
12767 AddPayloadBuffer {
12774 id: u32,
12775 payload_buffer: fidl::Vmo,
12776 control_handle: SimpleStreamSinkControlHandle,
12777 },
12778 RemovePayloadBuffer { id: u32, control_handle: SimpleStreamSinkControlHandle },
12784 SendPacket { packet: StreamPacket, responder: SimpleStreamSinkSendPacketResponder },
12790 SendPacketNoReply { packet: StreamPacket, control_handle: SimpleStreamSinkControlHandle },
12797 EndOfStream { control_handle: SimpleStreamSinkControlHandle },
12800 DiscardAllPackets { responder: SimpleStreamSinkDiscardAllPacketsResponder },
12804 DiscardAllPacketsNoReply { control_handle: SimpleStreamSinkControlHandle },
12807}
12808
12809impl SimpleStreamSinkRequest {
12810 #[allow(irrefutable_let_patterns)]
12811 pub fn into_add_payload_buffer(
12812 self,
12813 ) -> Option<(u32, fidl::Vmo, SimpleStreamSinkControlHandle)> {
12814 if let SimpleStreamSinkRequest::AddPayloadBuffer { id, payload_buffer, control_handle } =
12815 self
12816 {
12817 Some((id, payload_buffer, control_handle))
12818 } else {
12819 None
12820 }
12821 }
12822
12823 #[allow(irrefutable_let_patterns)]
12824 pub fn into_remove_payload_buffer(self) -> Option<(u32, SimpleStreamSinkControlHandle)> {
12825 if let SimpleStreamSinkRequest::RemovePayloadBuffer { id, control_handle } = self {
12826 Some((id, control_handle))
12827 } else {
12828 None
12829 }
12830 }
12831
12832 #[allow(irrefutable_let_patterns)]
12833 pub fn into_send_packet(self) -> Option<(StreamPacket, SimpleStreamSinkSendPacketResponder)> {
12834 if let SimpleStreamSinkRequest::SendPacket { packet, responder } = self {
12835 Some((packet, responder))
12836 } else {
12837 None
12838 }
12839 }
12840
12841 #[allow(irrefutable_let_patterns)]
12842 pub fn into_send_packet_no_reply(
12843 self,
12844 ) -> Option<(StreamPacket, SimpleStreamSinkControlHandle)> {
12845 if let SimpleStreamSinkRequest::SendPacketNoReply { packet, control_handle } = self {
12846 Some((packet, control_handle))
12847 } else {
12848 None
12849 }
12850 }
12851
12852 #[allow(irrefutable_let_patterns)]
12853 pub fn into_end_of_stream(self) -> Option<(SimpleStreamSinkControlHandle)> {
12854 if let SimpleStreamSinkRequest::EndOfStream { control_handle } = self {
12855 Some((control_handle))
12856 } else {
12857 None
12858 }
12859 }
12860
12861 #[allow(irrefutable_let_patterns)]
12862 pub fn into_discard_all_packets(self) -> Option<(SimpleStreamSinkDiscardAllPacketsResponder)> {
12863 if let SimpleStreamSinkRequest::DiscardAllPackets { responder } = self {
12864 Some((responder))
12865 } else {
12866 None
12867 }
12868 }
12869
12870 #[allow(irrefutable_let_patterns)]
12871 pub fn into_discard_all_packets_no_reply(self) -> Option<(SimpleStreamSinkControlHandle)> {
12872 if let SimpleStreamSinkRequest::DiscardAllPacketsNoReply { control_handle } = self {
12873 Some((control_handle))
12874 } else {
12875 None
12876 }
12877 }
12878
12879 pub fn method_name(&self) -> &'static str {
12881 match *self {
12882 SimpleStreamSinkRequest::AddPayloadBuffer { .. } => "add_payload_buffer",
12883 SimpleStreamSinkRequest::RemovePayloadBuffer { .. } => "remove_payload_buffer",
12884 SimpleStreamSinkRequest::SendPacket { .. } => "send_packet",
12885 SimpleStreamSinkRequest::SendPacketNoReply { .. } => "send_packet_no_reply",
12886 SimpleStreamSinkRequest::EndOfStream { .. } => "end_of_stream",
12887 SimpleStreamSinkRequest::DiscardAllPackets { .. } => "discard_all_packets",
12888 SimpleStreamSinkRequest::DiscardAllPacketsNoReply { .. } => {
12889 "discard_all_packets_no_reply"
12890 }
12891 }
12892 }
12893}
12894
12895#[derive(Debug, Clone)]
12896pub struct SimpleStreamSinkControlHandle {
12897 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12898}
12899
12900impl fidl::endpoints::ControlHandle for SimpleStreamSinkControlHandle {
12901 fn shutdown(&self) {
12902 self.inner.shutdown()
12903 }
12904 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
12905 self.inner.shutdown_with_epitaph(status)
12906 }
12907
12908 fn is_closed(&self) -> bool {
12909 self.inner.channel().is_closed()
12910 }
12911 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
12912 self.inner.channel().on_closed()
12913 }
12914
12915 #[cfg(target_os = "fuchsia")]
12916 fn signal_peer(
12917 &self,
12918 clear_mask: zx::Signals,
12919 set_mask: zx::Signals,
12920 ) -> Result<(), zx_status::Status> {
12921 use fidl::Peered;
12922 self.inner.channel().signal_peer(clear_mask, set_mask)
12923 }
12924}
12925
12926impl SimpleStreamSinkControlHandle {}
12927
12928#[must_use = "FIDL methods require a response to be sent"]
12929#[derive(Debug)]
12930pub struct SimpleStreamSinkSendPacketResponder {
12931 control_handle: std::mem::ManuallyDrop<SimpleStreamSinkControlHandle>,
12932 tx_id: u32,
12933}
12934
12935impl std::ops::Drop for SimpleStreamSinkSendPacketResponder {
12939 fn drop(&mut self) {
12940 self.control_handle.shutdown();
12941 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12943 }
12944}
12945
12946impl fidl::endpoints::Responder for SimpleStreamSinkSendPacketResponder {
12947 type ControlHandle = SimpleStreamSinkControlHandle;
12948
12949 fn control_handle(&self) -> &SimpleStreamSinkControlHandle {
12950 &self.control_handle
12951 }
12952
12953 fn drop_without_shutdown(mut self) {
12954 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12956 std::mem::forget(self);
12958 }
12959}
12960
12961impl SimpleStreamSinkSendPacketResponder {
12962 pub fn send(self) -> Result<(), fidl::Error> {
12966 let _result = self.send_raw();
12967 if _result.is_err() {
12968 self.control_handle.shutdown();
12969 }
12970 self.drop_without_shutdown();
12971 _result
12972 }
12973
12974 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
12976 let _result = self.send_raw();
12977 self.drop_without_shutdown();
12978 _result
12979 }
12980
12981 fn send_raw(&self) -> Result<(), fidl::Error> {
12982 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
12983 (),
12984 self.tx_id,
12985 0x67cddd607442775f,
12986 fidl::encoding::DynamicFlags::empty(),
12987 )
12988 }
12989}
12990
12991#[must_use = "FIDL methods require a response to be sent"]
12992#[derive(Debug)]
12993pub struct SimpleStreamSinkDiscardAllPacketsResponder {
12994 control_handle: std::mem::ManuallyDrop<SimpleStreamSinkControlHandle>,
12995 tx_id: u32,
12996}
12997
12998impl std::ops::Drop for SimpleStreamSinkDiscardAllPacketsResponder {
13002 fn drop(&mut self) {
13003 self.control_handle.shutdown();
13004 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13006 }
13007}
13008
13009impl fidl::endpoints::Responder for SimpleStreamSinkDiscardAllPacketsResponder {
13010 type ControlHandle = SimpleStreamSinkControlHandle;
13011
13012 fn control_handle(&self) -> &SimpleStreamSinkControlHandle {
13013 &self.control_handle
13014 }
13015
13016 fn drop_without_shutdown(mut self) {
13017 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13019 std::mem::forget(self);
13021 }
13022}
13023
13024impl SimpleStreamSinkDiscardAllPacketsResponder {
13025 pub fn send(self) -> Result<(), fidl::Error> {
13029 let _result = self.send_raw();
13030 if _result.is_err() {
13031 self.control_handle.shutdown();
13032 }
13033 self.drop_without_shutdown();
13034 _result
13035 }
13036
13037 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
13039 let _result = self.send_raw();
13040 self.drop_without_shutdown();
13041 _result
13042 }
13043
13044 fn send_raw(&self) -> Result<(), fidl::Error> {
13045 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
13046 (),
13047 self.tx_id,
13048 0x6f4dad7af2917665,
13049 fidl::encoding::DynamicFlags::empty(),
13050 )
13051 }
13052}
13053
13054#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13055pub struct StreamBufferSetMarker;
13056
13057impl fidl::endpoints::ProtocolMarker for StreamBufferSetMarker {
13058 type Proxy = StreamBufferSetProxy;
13059 type RequestStream = StreamBufferSetRequestStream;
13060 #[cfg(target_os = "fuchsia")]
13061 type SynchronousProxy = StreamBufferSetSynchronousProxy;
13062
13063 const DEBUG_NAME: &'static str = "(anonymous) StreamBufferSet";
13064}
13065
13066pub trait StreamBufferSetProxyInterface: Send + Sync {
13067 fn r#add_payload_buffer(&self, id: u32, payload_buffer: fidl::Vmo) -> Result<(), fidl::Error>;
13068 fn r#remove_payload_buffer(&self, id: u32) -> Result<(), fidl::Error>;
13069}
13070#[derive(Debug)]
13071#[cfg(target_os = "fuchsia")]
13072pub struct StreamBufferSetSynchronousProxy {
13073 client: fidl::client::sync::Client,
13074}
13075
13076#[cfg(target_os = "fuchsia")]
13077impl fidl::endpoints::SynchronousProxy for StreamBufferSetSynchronousProxy {
13078 type Proxy = StreamBufferSetProxy;
13079 type Protocol = StreamBufferSetMarker;
13080
13081 fn from_channel(inner: fidl::Channel) -> Self {
13082 Self::new(inner)
13083 }
13084
13085 fn into_channel(self) -> fidl::Channel {
13086 self.client.into_channel()
13087 }
13088
13089 fn as_channel(&self) -> &fidl::Channel {
13090 self.client.as_channel()
13091 }
13092}
13093
13094#[cfg(target_os = "fuchsia")]
13095impl StreamBufferSetSynchronousProxy {
13096 pub fn new(channel: fidl::Channel) -> Self {
13097 let protocol_name = <StreamBufferSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
13098 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
13099 }
13100
13101 pub fn into_channel(self) -> fidl::Channel {
13102 self.client.into_channel()
13103 }
13104
13105 pub fn wait_for_event(
13108 &self,
13109 deadline: zx::MonotonicInstant,
13110 ) -> Result<StreamBufferSetEvent, fidl::Error> {
13111 StreamBufferSetEvent::decode(self.client.wait_for_event(deadline)?)
13112 }
13113
13114 pub fn r#add_payload_buffer(
13121 &self,
13122 mut id: u32,
13123 mut payload_buffer: fidl::Vmo,
13124 ) -> Result<(), fidl::Error> {
13125 self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
13126 (id, payload_buffer),
13127 0x3b3a37fc34fe5b56,
13128 fidl::encoding::DynamicFlags::empty(),
13129 )
13130 }
13131
13132 pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
13138 self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
13139 (id,),
13140 0x5d1e4f74c3658262,
13141 fidl::encoding::DynamicFlags::empty(),
13142 )
13143 }
13144}
13145
13146#[cfg(target_os = "fuchsia")]
13147impl From<StreamBufferSetSynchronousProxy> for zx::Handle {
13148 fn from(value: StreamBufferSetSynchronousProxy) -> Self {
13149 value.into_channel().into()
13150 }
13151}
13152
13153#[cfg(target_os = "fuchsia")]
13154impl From<fidl::Channel> for StreamBufferSetSynchronousProxy {
13155 fn from(value: fidl::Channel) -> Self {
13156 Self::new(value)
13157 }
13158}
13159
13160#[derive(Debug, Clone)]
13161pub struct StreamBufferSetProxy {
13162 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
13163}
13164
13165impl fidl::endpoints::Proxy for StreamBufferSetProxy {
13166 type Protocol = StreamBufferSetMarker;
13167
13168 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
13169 Self::new(inner)
13170 }
13171
13172 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
13173 self.client.into_channel().map_err(|client| Self { client })
13174 }
13175
13176 fn as_channel(&self) -> &::fidl::AsyncChannel {
13177 self.client.as_channel()
13178 }
13179}
13180
13181impl StreamBufferSetProxy {
13182 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
13184 let protocol_name = <StreamBufferSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
13185 Self { client: fidl::client::Client::new(channel, protocol_name) }
13186 }
13187
13188 pub fn take_event_stream(&self) -> StreamBufferSetEventStream {
13194 StreamBufferSetEventStream { event_receiver: self.client.take_event_receiver() }
13195 }
13196
13197 pub fn r#add_payload_buffer(
13204 &self,
13205 mut id: u32,
13206 mut payload_buffer: fidl::Vmo,
13207 ) -> Result<(), fidl::Error> {
13208 StreamBufferSetProxyInterface::r#add_payload_buffer(self, id, payload_buffer)
13209 }
13210
13211 pub fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
13217 StreamBufferSetProxyInterface::r#remove_payload_buffer(self, id)
13218 }
13219}
13220
13221impl StreamBufferSetProxyInterface for StreamBufferSetProxy {
13222 fn r#add_payload_buffer(
13223 &self,
13224 mut id: u32,
13225 mut payload_buffer: fidl::Vmo,
13226 ) -> Result<(), fidl::Error> {
13227 self.client.send::<StreamBufferSetAddPayloadBufferRequest>(
13228 (id, payload_buffer),
13229 0x3b3a37fc34fe5b56,
13230 fidl::encoding::DynamicFlags::empty(),
13231 )
13232 }
13233
13234 fn r#remove_payload_buffer(&self, mut id: u32) -> Result<(), fidl::Error> {
13235 self.client.send::<StreamBufferSetRemovePayloadBufferRequest>(
13236 (id,),
13237 0x5d1e4f74c3658262,
13238 fidl::encoding::DynamicFlags::empty(),
13239 )
13240 }
13241}
13242
13243pub struct StreamBufferSetEventStream {
13244 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
13245}
13246
13247impl std::marker::Unpin for StreamBufferSetEventStream {}
13248
13249impl futures::stream::FusedStream for StreamBufferSetEventStream {
13250 fn is_terminated(&self) -> bool {
13251 self.event_receiver.is_terminated()
13252 }
13253}
13254
13255impl futures::Stream for StreamBufferSetEventStream {
13256 type Item = Result<StreamBufferSetEvent, fidl::Error>;
13257
13258 fn poll_next(
13259 mut self: std::pin::Pin<&mut Self>,
13260 cx: &mut std::task::Context<'_>,
13261 ) -> std::task::Poll<Option<Self::Item>> {
13262 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
13263 &mut self.event_receiver,
13264 cx
13265 )?) {
13266 Some(buf) => std::task::Poll::Ready(Some(StreamBufferSetEvent::decode(buf))),
13267 None => std::task::Poll::Ready(None),
13268 }
13269 }
13270}
13271
13272#[derive(Debug)]
13273pub enum StreamBufferSetEvent {}
13274
13275impl StreamBufferSetEvent {
13276 fn decode(
13278 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
13279 ) -> Result<StreamBufferSetEvent, fidl::Error> {
13280 let (bytes, _handles) = buf.split_mut();
13281 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
13282 debug_assert_eq!(tx_header.tx_id, 0);
13283 match tx_header.ordinal {
13284 _ => Err(fidl::Error::UnknownOrdinal {
13285 ordinal: tx_header.ordinal,
13286 protocol_name:
13287 <StreamBufferSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
13288 }),
13289 }
13290 }
13291}
13292
13293pub struct StreamBufferSetRequestStream {
13295 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13296 is_terminated: bool,
13297}
13298
13299impl std::marker::Unpin for StreamBufferSetRequestStream {}
13300
13301impl futures::stream::FusedStream for StreamBufferSetRequestStream {
13302 fn is_terminated(&self) -> bool {
13303 self.is_terminated
13304 }
13305}
13306
13307impl fidl::endpoints::RequestStream for StreamBufferSetRequestStream {
13308 type Protocol = StreamBufferSetMarker;
13309 type ControlHandle = StreamBufferSetControlHandle;
13310
13311 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
13312 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
13313 }
13314
13315 fn control_handle(&self) -> Self::ControlHandle {
13316 StreamBufferSetControlHandle { inner: self.inner.clone() }
13317 }
13318
13319 fn into_inner(
13320 self,
13321 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
13322 {
13323 (self.inner, self.is_terminated)
13324 }
13325
13326 fn from_inner(
13327 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13328 is_terminated: bool,
13329 ) -> Self {
13330 Self { inner, is_terminated }
13331 }
13332}
13333
13334impl futures::Stream for StreamBufferSetRequestStream {
13335 type Item = Result<StreamBufferSetRequest, fidl::Error>;
13336
13337 fn poll_next(
13338 mut self: std::pin::Pin<&mut Self>,
13339 cx: &mut std::task::Context<'_>,
13340 ) -> std::task::Poll<Option<Self::Item>> {
13341 let this = &mut *self;
13342 if this.inner.check_shutdown(cx) {
13343 this.is_terminated = true;
13344 return std::task::Poll::Ready(None);
13345 }
13346 if this.is_terminated {
13347 panic!("polled StreamBufferSetRequestStream after completion");
13348 }
13349 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
13350 |bytes, handles| {
13351 match this.inner.channel().read_etc(cx, bytes, handles) {
13352 std::task::Poll::Ready(Ok(())) => {}
13353 std::task::Poll::Pending => return std::task::Poll::Pending,
13354 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
13355 this.is_terminated = true;
13356 return std::task::Poll::Ready(None);
13357 }
13358 std::task::Poll::Ready(Err(e)) => {
13359 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
13360 e.into(),
13361 ))))
13362 }
13363 }
13364
13365 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
13367
13368 std::task::Poll::Ready(Some(match header.ordinal {
13369 0x3b3a37fc34fe5b56 => {
13370 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
13371 let mut req = fidl::new_empty!(
13372 StreamBufferSetAddPayloadBufferRequest,
13373 fidl::encoding::DefaultFuchsiaResourceDialect
13374 );
13375 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetAddPayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
13376 let control_handle =
13377 StreamBufferSetControlHandle { inner: this.inner.clone() };
13378 Ok(StreamBufferSetRequest::AddPayloadBuffer {
13379 id: req.id,
13380 payload_buffer: req.payload_buffer,
13381
13382 control_handle,
13383 })
13384 }
13385 0x5d1e4f74c3658262 => {
13386 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
13387 let mut req = fidl::new_empty!(
13388 StreamBufferSetRemovePayloadBufferRequest,
13389 fidl::encoding::DefaultFuchsiaResourceDialect
13390 );
13391 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamBufferSetRemovePayloadBufferRequest>(&header, _body_bytes, handles, &mut req)?;
13392 let control_handle =
13393 StreamBufferSetControlHandle { inner: this.inner.clone() };
13394 Ok(StreamBufferSetRequest::RemovePayloadBuffer {
13395 id: req.id,
13396
13397 control_handle,
13398 })
13399 }
13400 _ => Err(fidl::Error::UnknownOrdinal {
13401 ordinal: header.ordinal,
13402 protocol_name:
13403 <StreamBufferSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
13404 }),
13405 }))
13406 },
13407 )
13408 }
13409}
13410
13411#[derive(Debug)]
13415pub enum StreamBufferSetRequest {
13416 AddPayloadBuffer {
13423 id: u32,
13424 payload_buffer: fidl::Vmo,
13425 control_handle: StreamBufferSetControlHandle,
13426 },
13427 RemovePayloadBuffer { id: u32, control_handle: StreamBufferSetControlHandle },
13433}
13434
13435impl StreamBufferSetRequest {
13436 #[allow(irrefutable_let_patterns)]
13437 pub fn into_add_payload_buffer(self) -> Option<(u32, fidl::Vmo, StreamBufferSetControlHandle)> {
13438 if let StreamBufferSetRequest::AddPayloadBuffer { id, payload_buffer, control_handle } =
13439 self
13440 {
13441 Some((id, payload_buffer, control_handle))
13442 } else {
13443 None
13444 }
13445 }
13446
13447 #[allow(irrefutable_let_patterns)]
13448 pub fn into_remove_payload_buffer(self) -> Option<(u32, StreamBufferSetControlHandle)> {
13449 if let StreamBufferSetRequest::RemovePayloadBuffer { id, control_handle } = self {
13450 Some((id, control_handle))
13451 } else {
13452 None
13453 }
13454 }
13455
13456 pub fn method_name(&self) -> &'static str {
13458 match *self {
13459 StreamBufferSetRequest::AddPayloadBuffer { .. } => "add_payload_buffer",
13460 StreamBufferSetRequest::RemovePayloadBuffer { .. } => "remove_payload_buffer",
13461 }
13462 }
13463}
13464
13465#[derive(Debug, Clone)]
13466pub struct StreamBufferSetControlHandle {
13467 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13468}
13469
13470impl fidl::endpoints::ControlHandle for StreamBufferSetControlHandle {
13471 fn shutdown(&self) {
13472 self.inner.shutdown()
13473 }
13474 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
13475 self.inner.shutdown_with_epitaph(status)
13476 }
13477
13478 fn is_closed(&self) -> bool {
13479 self.inner.channel().is_closed()
13480 }
13481 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
13482 self.inner.channel().on_closed()
13483 }
13484
13485 #[cfg(target_os = "fuchsia")]
13486 fn signal_peer(
13487 &self,
13488 clear_mask: zx::Signals,
13489 set_mask: zx::Signals,
13490 ) -> Result<(), zx_status::Status> {
13491 use fidl::Peered;
13492 self.inner.channel().signal_peer(clear_mask, set_mask)
13493 }
13494}
13495
13496impl StreamBufferSetControlHandle {}
13497
13498#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13499pub struct StreamProcessorMarker;
13500
13501impl fidl::endpoints::ProtocolMarker for StreamProcessorMarker {
13502 type Proxy = StreamProcessorProxy;
13503 type RequestStream = StreamProcessorRequestStream;
13504 #[cfg(target_os = "fuchsia")]
13505 type SynchronousProxy = StreamProcessorSynchronousProxy;
13506
13507 const DEBUG_NAME: &'static str = "(anonymous) StreamProcessor";
13508}
13509
13510pub trait StreamProcessorProxyInterface: Send + Sync {
13511 fn r#enable_on_stream_failed(&self) -> Result<(), fidl::Error>;
13512 fn r#set_input_buffer_partial_settings(
13513 &self,
13514 input_settings: StreamBufferPartialSettings,
13515 ) -> Result<(), fidl::Error>;
13516 fn r#set_output_buffer_partial_settings(
13517 &self,
13518 output_settings: StreamBufferPartialSettings,
13519 ) -> Result<(), fidl::Error>;
13520 fn r#complete_output_buffer_partial_settings(
13521 &self,
13522 buffer_lifetime_ordinal: u64,
13523 ) -> Result<(), fidl::Error>;
13524 fn r#flush_end_of_stream_and_close_stream(
13525 &self,
13526 stream_lifetime_ordinal: u64,
13527 ) -> Result<(), fidl::Error>;
13528 fn r#close_current_stream(
13529 &self,
13530 stream_lifetime_ordinal: u64,
13531 release_input_buffers: bool,
13532 release_output_buffers: bool,
13533 ) -> Result<(), fidl::Error>;
13534 type SyncResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
13535 fn r#sync(&self) -> Self::SyncResponseFut;
13536 fn r#recycle_output_packet(
13537 &self,
13538 available_output_packet: &PacketHeader,
13539 ) -> Result<(), fidl::Error>;
13540 fn r#queue_input_format_details(
13541 &self,
13542 stream_lifetime_ordinal: u64,
13543 format_details: &FormatDetails,
13544 ) -> Result<(), fidl::Error>;
13545 fn r#queue_input_packet(&self, packet: &Packet) -> Result<(), fidl::Error>;
13546 fn r#queue_input_end_of_stream(&self, stream_lifetime_ordinal: u64) -> Result<(), fidl::Error>;
13547}
13548#[derive(Debug)]
13549#[cfg(target_os = "fuchsia")]
13550pub struct StreamProcessorSynchronousProxy {
13551 client: fidl::client::sync::Client,
13552}
13553
13554#[cfg(target_os = "fuchsia")]
13555impl fidl::endpoints::SynchronousProxy for StreamProcessorSynchronousProxy {
13556 type Proxy = StreamProcessorProxy;
13557 type Protocol = StreamProcessorMarker;
13558
13559 fn from_channel(inner: fidl::Channel) -> Self {
13560 Self::new(inner)
13561 }
13562
13563 fn into_channel(self) -> fidl::Channel {
13564 self.client.into_channel()
13565 }
13566
13567 fn as_channel(&self) -> &fidl::Channel {
13568 self.client.as_channel()
13569 }
13570}
13571
13572#[cfg(target_os = "fuchsia")]
13573impl StreamProcessorSynchronousProxy {
13574 pub fn new(channel: fidl::Channel) -> Self {
13575 let protocol_name = <StreamProcessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
13576 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
13577 }
13578
13579 pub fn into_channel(self) -> fidl::Channel {
13580 self.client.into_channel()
13581 }
13582
13583 pub fn wait_for_event(
13586 &self,
13587 deadline: zx::MonotonicInstant,
13588 ) -> Result<StreamProcessorEvent, fidl::Error> {
13589 StreamProcessorEvent::decode(self.client.wait_for_event(deadline)?)
13590 }
13591
13592 pub fn r#enable_on_stream_failed(&self) -> Result<(), fidl::Error> {
13599 self.client.send::<fidl::encoding::EmptyPayload>(
13600 (),
13601 0x3940929617dbf02b,
13602 fidl::encoding::DynamicFlags::empty(),
13603 )
13604 }
13605
13606 pub fn r#set_input_buffer_partial_settings(
13630 &self,
13631 mut input_settings: StreamBufferPartialSettings,
13632 ) -> Result<(), fidl::Error> {
13633 self.client.send::<StreamProcessorSetInputBufferPartialSettingsRequest>(
13634 (&mut input_settings,),
13635 0xb02e0663a40e4c4,
13636 fidl::encoding::DynamicFlags::empty(),
13637 )
13638 }
13639
13640 pub fn r#set_output_buffer_partial_settings(
13664 &self,
13665 mut output_settings: StreamBufferPartialSettings,
13666 ) -> Result<(), fidl::Error> {
13667 self.client.send::<StreamProcessorSetOutputBufferPartialSettingsRequest>(
13668 (&mut output_settings,),
13669 0x118bb8c819a7bbbb,
13670 fidl::encoding::DynamicFlags::empty(),
13671 )
13672 }
13673
13674 pub fn r#complete_output_buffer_partial_settings(
13690 &self,
13691 mut buffer_lifetime_ordinal: u64,
13692 ) -> Result<(), fidl::Error> {
13693 self.client.send::<StreamProcessorCompleteOutputBufferPartialSettingsRequest>(
13694 (buffer_lifetime_ordinal,),
13695 0x50529e5c680ae3ab,
13696 fidl::encoding::DynamicFlags::empty(),
13697 )
13698 }
13699
13700 pub fn r#flush_end_of_stream_and_close_stream(
13741 &self,
13742 mut stream_lifetime_ordinal: u64,
13743 ) -> Result<(), fidl::Error> {
13744 self.client.send::<StreamProcessorFlushEndOfStreamAndCloseStreamRequest>(
13745 (stream_lifetime_ordinal,),
13746 0x2b62c3e26d0667e6,
13747 fidl::encoding::DynamicFlags::empty(),
13748 )
13749 }
13750
13751 pub fn r#close_current_stream(
13772 &self,
13773 mut stream_lifetime_ordinal: u64,
13774 mut release_input_buffers: bool,
13775 mut release_output_buffers: bool,
13776 ) -> Result<(), fidl::Error> {
13777 self.client.send::<StreamProcessorCloseCurrentStreamRequest>(
13778 (stream_lifetime_ordinal, release_input_buffers, release_output_buffers),
13779 0x1d8a67522170ca07,
13780 fidl::encoding::DynamicFlags::empty(),
13781 )
13782 }
13783
13784 pub fn r#sync(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
13811 let _response =
13812 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
13813 (),
13814 0x4b3e44300b0ec6aa,
13815 fidl::encoding::DynamicFlags::empty(),
13816 ___deadline,
13817 )?;
13818 Ok(_response)
13819 }
13820
13821 pub fn r#recycle_output_packet(
13832 &self,
13833 mut available_output_packet: &PacketHeader,
13834 ) -> Result<(), fidl::Error> {
13835 self.client.send::<StreamProcessorRecycleOutputPacketRequest>(
13836 (available_output_packet,),
13837 0x32763632b94e0bd5,
13838 fidl::encoding::DynamicFlags::empty(),
13839 )
13840 }
13841
13842 pub fn r#queue_input_format_details(
13869 &self,
13870 mut stream_lifetime_ordinal: u64,
13871 mut format_details: &FormatDetails,
13872 ) -> Result<(), fidl::Error> {
13873 self.client.send::<StreamProcessorQueueInputFormatDetailsRequest>(
13874 (stream_lifetime_ordinal, format_details),
13875 0x170dc0979d52231,
13876 fidl::encoding::DynamicFlags::empty(),
13877 )
13878 }
13879
13880 pub fn r#queue_input_packet(&self, mut packet: &Packet) -> Result<(), fidl::Error> {
13894 self.client.send::<StreamProcessorQueueInputPacketRequest>(
13895 (packet,),
13896 0x47173d2652d9df3b,
13897 fidl::encoding::DynamicFlags::empty(),
13898 )
13899 }
13900
13901 pub fn r#queue_input_end_of_stream(
13938 &self,
13939 mut stream_lifetime_ordinal: u64,
13940 ) -> Result<(), fidl::Error> {
13941 self.client.send::<StreamProcessorQueueInputEndOfStreamRequest>(
13942 (stream_lifetime_ordinal,),
13943 0x2051b6ad00f20b37,
13944 fidl::encoding::DynamicFlags::empty(),
13945 )
13946 }
13947}
13948
13949#[cfg(target_os = "fuchsia")]
13950impl From<StreamProcessorSynchronousProxy> for zx::Handle {
13951 fn from(value: StreamProcessorSynchronousProxy) -> Self {
13952 value.into_channel().into()
13953 }
13954}
13955
13956#[cfg(target_os = "fuchsia")]
13957impl From<fidl::Channel> for StreamProcessorSynchronousProxy {
13958 fn from(value: fidl::Channel) -> Self {
13959 Self::new(value)
13960 }
13961}
13962
13963#[derive(Debug, Clone)]
13964pub struct StreamProcessorProxy {
13965 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
13966}
13967
13968impl fidl::endpoints::Proxy for StreamProcessorProxy {
13969 type Protocol = StreamProcessorMarker;
13970
13971 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
13972 Self::new(inner)
13973 }
13974
13975 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
13976 self.client.into_channel().map_err(|client| Self { client })
13977 }
13978
13979 fn as_channel(&self) -> &::fidl::AsyncChannel {
13980 self.client.as_channel()
13981 }
13982}
13983
13984impl StreamProcessorProxy {
13985 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
13987 let protocol_name = <StreamProcessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
13988 Self { client: fidl::client::Client::new(channel, protocol_name) }
13989 }
13990
13991 pub fn take_event_stream(&self) -> StreamProcessorEventStream {
13997 StreamProcessorEventStream { event_receiver: self.client.take_event_receiver() }
13998 }
13999
14000 pub fn r#enable_on_stream_failed(&self) -> Result<(), fidl::Error> {
14007 StreamProcessorProxyInterface::r#enable_on_stream_failed(self)
14008 }
14009
14010 pub fn r#set_input_buffer_partial_settings(
14034 &self,
14035 mut input_settings: StreamBufferPartialSettings,
14036 ) -> Result<(), fidl::Error> {
14037 StreamProcessorProxyInterface::r#set_input_buffer_partial_settings(self, input_settings)
14038 }
14039
14040 pub fn r#set_output_buffer_partial_settings(
14064 &self,
14065 mut output_settings: StreamBufferPartialSettings,
14066 ) -> Result<(), fidl::Error> {
14067 StreamProcessorProxyInterface::r#set_output_buffer_partial_settings(self, output_settings)
14068 }
14069
14070 pub fn r#complete_output_buffer_partial_settings(
14086 &self,
14087 mut buffer_lifetime_ordinal: u64,
14088 ) -> Result<(), fidl::Error> {
14089 StreamProcessorProxyInterface::r#complete_output_buffer_partial_settings(
14090 self,
14091 buffer_lifetime_ordinal,
14092 )
14093 }
14094
14095 pub fn r#flush_end_of_stream_and_close_stream(
14136 &self,
14137 mut stream_lifetime_ordinal: u64,
14138 ) -> Result<(), fidl::Error> {
14139 StreamProcessorProxyInterface::r#flush_end_of_stream_and_close_stream(
14140 self,
14141 stream_lifetime_ordinal,
14142 )
14143 }
14144
14145 pub fn r#close_current_stream(
14166 &self,
14167 mut stream_lifetime_ordinal: u64,
14168 mut release_input_buffers: bool,
14169 mut release_output_buffers: bool,
14170 ) -> Result<(), fidl::Error> {
14171 StreamProcessorProxyInterface::r#close_current_stream(
14172 self,
14173 stream_lifetime_ordinal,
14174 release_input_buffers,
14175 release_output_buffers,
14176 )
14177 }
14178
14179 pub fn r#sync(
14206 &self,
14207 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
14208 StreamProcessorProxyInterface::r#sync(self)
14209 }
14210
14211 pub fn r#recycle_output_packet(
14222 &self,
14223 mut available_output_packet: &PacketHeader,
14224 ) -> Result<(), fidl::Error> {
14225 StreamProcessorProxyInterface::r#recycle_output_packet(self, available_output_packet)
14226 }
14227
14228 pub fn r#queue_input_format_details(
14255 &self,
14256 mut stream_lifetime_ordinal: u64,
14257 mut format_details: &FormatDetails,
14258 ) -> Result<(), fidl::Error> {
14259 StreamProcessorProxyInterface::r#queue_input_format_details(
14260 self,
14261 stream_lifetime_ordinal,
14262 format_details,
14263 )
14264 }
14265
14266 pub fn r#queue_input_packet(&self, mut packet: &Packet) -> Result<(), fidl::Error> {
14280 StreamProcessorProxyInterface::r#queue_input_packet(self, packet)
14281 }
14282
14283 pub fn r#queue_input_end_of_stream(
14320 &self,
14321 mut stream_lifetime_ordinal: u64,
14322 ) -> Result<(), fidl::Error> {
14323 StreamProcessorProxyInterface::r#queue_input_end_of_stream(self, stream_lifetime_ordinal)
14324 }
14325}
14326
14327impl StreamProcessorProxyInterface for StreamProcessorProxy {
14328 fn r#enable_on_stream_failed(&self) -> Result<(), fidl::Error> {
14329 self.client.send::<fidl::encoding::EmptyPayload>(
14330 (),
14331 0x3940929617dbf02b,
14332 fidl::encoding::DynamicFlags::empty(),
14333 )
14334 }
14335
14336 fn r#set_input_buffer_partial_settings(
14337 &self,
14338 mut input_settings: StreamBufferPartialSettings,
14339 ) -> Result<(), fidl::Error> {
14340 self.client.send::<StreamProcessorSetInputBufferPartialSettingsRequest>(
14341 (&mut input_settings,),
14342 0xb02e0663a40e4c4,
14343 fidl::encoding::DynamicFlags::empty(),
14344 )
14345 }
14346
14347 fn r#set_output_buffer_partial_settings(
14348 &self,
14349 mut output_settings: StreamBufferPartialSettings,
14350 ) -> Result<(), fidl::Error> {
14351 self.client.send::<StreamProcessorSetOutputBufferPartialSettingsRequest>(
14352 (&mut output_settings,),
14353 0x118bb8c819a7bbbb,
14354 fidl::encoding::DynamicFlags::empty(),
14355 )
14356 }
14357
14358 fn r#complete_output_buffer_partial_settings(
14359 &self,
14360 mut buffer_lifetime_ordinal: u64,
14361 ) -> Result<(), fidl::Error> {
14362 self.client.send::<StreamProcessorCompleteOutputBufferPartialSettingsRequest>(
14363 (buffer_lifetime_ordinal,),
14364 0x50529e5c680ae3ab,
14365 fidl::encoding::DynamicFlags::empty(),
14366 )
14367 }
14368
14369 fn r#flush_end_of_stream_and_close_stream(
14370 &self,
14371 mut stream_lifetime_ordinal: u64,
14372 ) -> Result<(), fidl::Error> {
14373 self.client.send::<StreamProcessorFlushEndOfStreamAndCloseStreamRequest>(
14374 (stream_lifetime_ordinal,),
14375 0x2b62c3e26d0667e6,
14376 fidl::encoding::DynamicFlags::empty(),
14377 )
14378 }
14379
14380 fn r#close_current_stream(
14381 &self,
14382 mut stream_lifetime_ordinal: u64,
14383 mut release_input_buffers: bool,
14384 mut release_output_buffers: bool,
14385 ) -> Result<(), fidl::Error> {
14386 self.client.send::<StreamProcessorCloseCurrentStreamRequest>(
14387 (stream_lifetime_ordinal, release_input_buffers, release_output_buffers),
14388 0x1d8a67522170ca07,
14389 fidl::encoding::DynamicFlags::empty(),
14390 )
14391 }
14392
14393 type SyncResponseFut =
14394 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
14395 fn r#sync(&self) -> Self::SyncResponseFut {
14396 fn _decode(
14397 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
14398 ) -> Result<(), fidl::Error> {
14399 let _response = fidl::client::decode_transaction_body::<
14400 fidl::encoding::EmptyPayload,
14401 fidl::encoding::DefaultFuchsiaResourceDialect,
14402 0x4b3e44300b0ec6aa,
14403 >(_buf?)?;
14404 Ok(_response)
14405 }
14406 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
14407 (),
14408 0x4b3e44300b0ec6aa,
14409 fidl::encoding::DynamicFlags::empty(),
14410 _decode,
14411 )
14412 }
14413
14414 fn r#recycle_output_packet(
14415 &self,
14416 mut available_output_packet: &PacketHeader,
14417 ) -> Result<(), fidl::Error> {
14418 self.client.send::<StreamProcessorRecycleOutputPacketRequest>(
14419 (available_output_packet,),
14420 0x32763632b94e0bd5,
14421 fidl::encoding::DynamicFlags::empty(),
14422 )
14423 }
14424
14425 fn r#queue_input_format_details(
14426 &self,
14427 mut stream_lifetime_ordinal: u64,
14428 mut format_details: &FormatDetails,
14429 ) -> Result<(), fidl::Error> {
14430 self.client.send::<StreamProcessorQueueInputFormatDetailsRequest>(
14431 (stream_lifetime_ordinal, format_details),
14432 0x170dc0979d52231,
14433 fidl::encoding::DynamicFlags::empty(),
14434 )
14435 }
14436
14437 fn r#queue_input_packet(&self, mut packet: &Packet) -> Result<(), fidl::Error> {
14438 self.client.send::<StreamProcessorQueueInputPacketRequest>(
14439 (packet,),
14440 0x47173d2652d9df3b,
14441 fidl::encoding::DynamicFlags::empty(),
14442 )
14443 }
14444
14445 fn r#queue_input_end_of_stream(
14446 &self,
14447 mut stream_lifetime_ordinal: u64,
14448 ) -> Result<(), fidl::Error> {
14449 self.client.send::<StreamProcessorQueueInputEndOfStreamRequest>(
14450 (stream_lifetime_ordinal,),
14451 0x2051b6ad00f20b37,
14452 fidl::encoding::DynamicFlags::empty(),
14453 )
14454 }
14455}
14456
14457pub struct StreamProcessorEventStream {
14458 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
14459}
14460
14461impl std::marker::Unpin for StreamProcessorEventStream {}
14462
14463impl futures::stream::FusedStream for StreamProcessorEventStream {
14464 fn is_terminated(&self) -> bool {
14465 self.event_receiver.is_terminated()
14466 }
14467}
14468
14469impl futures::Stream for StreamProcessorEventStream {
14470 type Item = Result<StreamProcessorEvent, fidl::Error>;
14471
14472 fn poll_next(
14473 mut self: std::pin::Pin<&mut Self>,
14474 cx: &mut std::task::Context<'_>,
14475 ) -> std::task::Poll<Option<Self::Item>> {
14476 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
14477 &mut self.event_receiver,
14478 cx
14479 )?) {
14480 Some(buf) => std::task::Poll::Ready(Some(StreamProcessorEvent::decode(buf))),
14481 None => std::task::Poll::Ready(None),
14482 }
14483 }
14484}
14485
14486#[derive(Debug)]
14487pub enum StreamProcessorEvent {
14488 OnStreamFailed {
14489 stream_lifetime_ordinal: u64,
14490 error: StreamError,
14491 },
14492 OnInputConstraints {
14493 input_constraints: StreamBufferConstraints,
14494 },
14495 OnOutputConstraints {
14496 output_config: StreamOutputConstraints,
14497 },
14498 OnOutputFormat {
14499 output_format: StreamOutputFormat,
14500 },
14501 OnOutputPacket {
14502 output_packet: Packet,
14503 error_detected_before: bool,
14504 error_detected_during: bool,
14505 },
14506 OnOutputEndOfStream {
14507 stream_lifetime_ordinal: u64,
14508 error_detected_before: bool,
14509 },
14510 OnFreeInputPacket {
14511 free_input_packet: PacketHeader,
14512 },
14513}
14514
14515impl StreamProcessorEvent {
14516 #[allow(irrefutable_let_patterns)]
14517 pub fn into_on_stream_failed(self) -> Option<(u64, StreamError)> {
14518 if let StreamProcessorEvent::OnStreamFailed { stream_lifetime_ordinal, error } = self {
14519 Some((stream_lifetime_ordinal, error))
14520 } else {
14521 None
14522 }
14523 }
14524 #[allow(irrefutable_let_patterns)]
14525 pub fn into_on_input_constraints(self) -> Option<StreamBufferConstraints> {
14526 if let StreamProcessorEvent::OnInputConstraints { input_constraints } = self {
14527 Some((input_constraints))
14528 } else {
14529 None
14530 }
14531 }
14532 #[allow(irrefutable_let_patterns)]
14533 pub fn into_on_output_constraints(self) -> Option<StreamOutputConstraints> {
14534 if let StreamProcessorEvent::OnOutputConstraints { output_config } = self {
14535 Some((output_config))
14536 } else {
14537 None
14538 }
14539 }
14540 #[allow(irrefutable_let_patterns)]
14541 pub fn into_on_output_format(self) -> Option<StreamOutputFormat> {
14542 if let StreamProcessorEvent::OnOutputFormat { output_format } = self {
14543 Some((output_format))
14544 } else {
14545 None
14546 }
14547 }
14548 #[allow(irrefutable_let_patterns)]
14549 pub fn into_on_output_packet(self) -> Option<(Packet, bool, bool)> {
14550 if let StreamProcessorEvent::OnOutputPacket {
14551 output_packet,
14552 error_detected_before,
14553 error_detected_during,
14554 } = self
14555 {
14556 Some((output_packet, error_detected_before, error_detected_during))
14557 } else {
14558 None
14559 }
14560 }
14561 #[allow(irrefutable_let_patterns)]
14562 pub fn into_on_output_end_of_stream(self) -> Option<(u64, bool)> {
14563 if let StreamProcessorEvent::OnOutputEndOfStream {
14564 stream_lifetime_ordinal,
14565 error_detected_before,
14566 } = self
14567 {
14568 Some((stream_lifetime_ordinal, error_detected_before))
14569 } else {
14570 None
14571 }
14572 }
14573 #[allow(irrefutable_let_patterns)]
14574 pub fn into_on_free_input_packet(self) -> Option<PacketHeader> {
14575 if let StreamProcessorEvent::OnFreeInputPacket { free_input_packet } = self {
14576 Some((free_input_packet))
14577 } else {
14578 None
14579 }
14580 }
14581
14582 fn decode(
14584 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
14585 ) -> Result<StreamProcessorEvent, fidl::Error> {
14586 let (bytes, _handles) = buf.split_mut();
14587 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
14588 debug_assert_eq!(tx_header.tx_id, 0);
14589 match tx_header.ordinal {
14590 0x77ccf70bb061cf8e => {
14591 let mut out = fidl::new_empty!(
14592 StreamProcessorOnStreamFailedRequest,
14593 fidl::encoding::DefaultFuchsiaResourceDialect
14594 );
14595 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnStreamFailedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
14596 Ok((StreamProcessorEvent::OnStreamFailed {
14597 stream_lifetime_ordinal: out.stream_lifetime_ordinal,
14598 error: out.error,
14599 }))
14600 }
14601 0x211da9966a8ca0 => {
14602 let mut out = fidl::new_empty!(
14603 StreamProcessorOnInputConstraintsRequest,
14604 fidl::encoding::DefaultFuchsiaResourceDialect
14605 );
14606 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnInputConstraintsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
14607 Ok((StreamProcessorEvent::OnInputConstraints {
14608 input_constraints: out.input_constraints,
14609 }))
14610 }
14611 0x40d8234504c170f3 => {
14612 let mut out = fidl::new_empty!(
14613 StreamProcessorOnOutputConstraintsRequest,
14614 fidl::encoding::DefaultFuchsiaResourceDialect
14615 );
14616 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnOutputConstraintsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
14617 Ok((StreamProcessorEvent::OnOutputConstraints { output_config: out.output_config }))
14618 }
14619 0x131b77ae120360bc => {
14620 let mut out = fidl::new_empty!(
14621 StreamProcessorOnOutputFormatRequest,
14622 fidl::encoding::DefaultFuchsiaResourceDialect
14623 );
14624 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnOutputFormatRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
14625 Ok((StreamProcessorEvent::OnOutputFormat { output_format: out.output_format }))
14626 }
14627 0x5c2029be1090ce93 => {
14628 let mut out = fidl::new_empty!(
14629 StreamProcessorOnOutputPacketRequest,
14630 fidl::encoding::DefaultFuchsiaResourceDialect
14631 );
14632 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnOutputPacketRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
14633 Ok((StreamProcessorEvent::OnOutputPacket {
14634 output_packet: out.output_packet,
14635 error_detected_before: out.error_detected_before,
14636 error_detected_during: out.error_detected_during,
14637 }))
14638 }
14639 0x3bb65d237cfa50e6 => {
14640 let mut out = fidl::new_empty!(
14641 StreamProcessorOnOutputEndOfStreamRequest,
14642 fidl::encoding::DefaultFuchsiaResourceDialect
14643 );
14644 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnOutputEndOfStreamRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
14645 Ok((StreamProcessorEvent::OnOutputEndOfStream {
14646 stream_lifetime_ordinal: out.stream_lifetime_ordinal,
14647 error_detected_before: out.error_detected_before,
14648 }))
14649 }
14650 0xeef799b28708bbd => {
14651 let mut out = fidl::new_empty!(
14652 StreamProcessorOnFreeInputPacketRequest,
14653 fidl::encoding::DefaultFuchsiaResourceDialect
14654 );
14655 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorOnFreeInputPacketRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
14656 Ok((StreamProcessorEvent::OnFreeInputPacket {
14657 free_input_packet: out.free_input_packet,
14658 }))
14659 }
14660 _ => Err(fidl::Error::UnknownOrdinal {
14661 ordinal: tx_header.ordinal,
14662 protocol_name:
14663 <StreamProcessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
14664 }),
14665 }
14666 }
14667}
14668
14669pub struct StreamProcessorRequestStream {
14671 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
14672 is_terminated: bool,
14673}
14674
14675impl std::marker::Unpin for StreamProcessorRequestStream {}
14676
14677impl futures::stream::FusedStream for StreamProcessorRequestStream {
14678 fn is_terminated(&self) -> bool {
14679 self.is_terminated
14680 }
14681}
14682
14683impl fidl::endpoints::RequestStream for StreamProcessorRequestStream {
14684 type Protocol = StreamProcessorMarker;
14685 type ControlHandle = StreamProcessorControlHandle;
14686
14687 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
14688 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
14689 }
14690
14691 fn control_handle(&self) -> Self::ControlHandle {
14692 StreamProcessorControlHandle { inner: self.inner.clone() }
14693 }
14694
14695 fn into_inner(
14696 self,
14697 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
14698 {
14699 (self.inner, self.is_terminated)
14700 }
14701
14702 fn from_inner(
14703 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
14704 is_terminated: bool,
14705 ) -> Self {
14706 Self { inner, is_terminated }
14707 }
14708}
14709
14710impl futures::Stream for StreamProcessorRequestStream {
14711 type Item = Result<StreamProcessorRequest, fidl::Error>;
14712
14713 fn poll_next(
14714 mut self: std::pin::Pin<&mut Self>,
14715 cx: &mut std::task::Context<'_>,
14716 ) -> std::task::Poll<Option<Self::Item>> {
14717 let this = &mut *self;
14718 if this.inner.check_shutdown(cx) {
14719 this.is_terminated = true;
14720 return std::task::Poll::Ready(None);
14721 }
14722 if this.is_terminated {
14723 panic!("polled StreamProcessorRequestStream after completion");
14724 }
14725 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
14726 |bytes, handles| {
14727 match this.inner.channel().read_etc(cx, bytes, handles) {
14728 std::task::Poll::Ready(Ok(())) => {}
14729 std::task::Poll::Pending => return std::task::Poll::Pending,
14730 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
14731 this.is_terminated = true;
14732 return std::task::Poll::Ready(None);
14733 }
14734 std::task::Poll::Ready(Err(e)) => {
14735 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
14736 e.into(),
14737 ))))
14738 }
14739 }
14740
14741 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
14743
14744 std::task::Poll::Ready(Some(match header.ordinal {
14745 0x3940929617dbf02b => {
14746 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
14747 let mut req = fidl::new_empty!(
14748 fidl::encoding::EmptyPayload,
14749 fidl::encoding::DefaultFuchsiaResourceDialect
14750 );
14751 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
14752 let control_handle =
14753 StreamProcessorControlHandle { inner: this.inner.clone() };
14754 Ok(StreamProcessorRequest::EnableOnStreamFailed { control_handle })
14755 }
14756 0xb02e0663a40e4c4 => {
14757 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
14758 let mut req = fidl::new_empty!(
14759 StreamProcessorSetInputBufferPartialSettingsRequest,
14760 fidl::encoding::DefaultFuchsiaResourceDialect
14761 );
14762 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorSetInputBufferPartialSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
14763 let control_handle =
14764 StreamProcessorControlHandle { inner: this.inner.clone() };
14765 Ok(StreamProcessorRequest::SetInputBufferPartialSettings {
14766 input_settings: req.input_settings,
14767
14768 control_handle,
14769 })
14770 }
14771 0x118bb8c819a7bbbb => {
14772 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
14773 let mut req = fidl::new_empty!(
14774 StreamProcessorSetOutputBufferPartialSettingsRequest,
14775 fidl::encoding::DefaultFuchsiaResourceDialect
14776 );
14777 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorSetOutputBufferPartialSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
14778 let control_handle =
14779 StreamProcessorControlHandle { inner: this.inner.clone() };
14780 Ok(StreamProcessorRequest::SetOutputBufferPartialSettings {
14781 output_settings: req.output_settings,
14782
14783 control_handle,
14784 })
14785 }
14786 0x50529e5c680ae3ab => {
14787 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
14788 let mut req = fidl::new_empty!(
14789 StreamProcessorCompleteOutputBufferPartialSettingsRequest,
14790 fidl::encoding::DefaultFuchsiaResourceDialect
14791 );
14792 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorCompleteOutputBufferPartialSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
14793 let control_handle =
14794 StreamProcessorControlHandle { inner: this.inner.clone() };
14795 Ok(StreamProcessorRequest::CompleteOutputBufferPartialSettings {
14796 buffer_lifetime_ordinal: req.buffer_lifetime_ordinal,
14797
14798 control_handle,
14799 })
14800 }
14801 0x2b62c3e26d0667e6 => {
14802 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
14803 let mut req = fidl::new_empty!(
14804 StreamProcessorFlushEndOfStreamAndCloseStreamRequest,
14805 fidl::encoding::DefaultFuchsiaResourceDialect
14806 );
14807 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorFlushEndOfStreamAndCloseStreamRequest>(&header, _body_bytes, handles, &mut req)?;
14808 let control_handle =
14809 StreamProcessorControlHandle { inner: this.inner.clone() };
14810 Ok(StreamProcessorRequest::FlushEndOfStreamAndCloseStream {
14811 stream_lifetime_ordinal: req.stream_lifetime_ordinal,
14812
14813 control_handle,
14814 })
14815 }
14816 0x1d8a67522170ca07 => {
14817 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
14818 let mut req = fidl::new_empty!(
14819 StreamProcessorCloseCurrentStreamRequest,
14820 fidl::encoding::DefaultFuchsiaResourceDialect
14821 );
14822 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorCloseCurrentStreamRequest>(&header, _body_bytes, handles, &mut req)?;
14823 let control_handle =
14824 StreamProcessorControlHandle { inner: this.inner.clone() };
14825 Ok(StreamProcessorRequest::CloseCurrentStream {
14826 stream_lifetime_ordinal: req.stream_lifetime_ordinal,
14827 release_input_buffers: req.release_input_buffers,
14828 release_output_buffers: req.release_output_buffers,
14829
14830 control_handle,
14831 })
14832 }
14833 0x4b3e44300b0ec6aa => {
14834 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
14835 let mut req = fidl::new_empty!(
14836 fidl::encoding::EmptyPayload,
14837 fidl::encoding::DefaultFuchsiaResourceDialect
14838 );
14839 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
14840 let control_handle =
14841 StreamProcessorControlHandle { inner: this.inner.clone() };
14842 Ok(StreamProcessorRequest::Sync {
14843 responder: StreamProcessorSyncResponder {
14844 control_handle: std::mem::ManuallyDrop::new(control_handle),
14845 tx_id: header.tx_id,
14846 },
14847 })
14848 }
14849 0x32763632b94e0bd5 => {
14850 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
14851 let mut req = fidl::new_empty!(
14852 StreamProcessorRecycleOutputPacketRequest,
14853 fidl::encoding::DefaultFuchsiaResourceDialect
14854 );
14855 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorRecycleOutputPacketRequest>(&header, _body_bytes, handles, &mut req)?;
14856 let control_handle =
14857 StreamProcessorControlHandle { inner: this.inner.clone() };
14858 Ok(StreamProcessorRequest::RecycleOutputPacket {
14859 available_output_packet: req.available_output_packet,
14860
14861 control_handle,
14862 })
14863 }
14864 0x170dc0979d52231 => {
14865 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
14866 let mut req = fidl::new_empty!(
14867 StreamProcessorQueueInputFormatDetailsRequest,
14868 fidl::encoding::DefaultFuchsiaResourceDialect
14869 );
14870 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorQueueInputFormatDetailsRequest>(&header, _body_bytes, handles, &mut req)?;
14871 let control_handle =
14872 StreamProcessorControlHandle { inner: this.inner.clone() };
14873 Ok(StreamProcessorRequest::QueueInputFormatDetails {
14874 stream_lifetime_ordinal: req.stream_lifetime_ordinal,
14875 format_details: req.format_details,
14876
14877 control_handle,
14878 })
14879 }
14880 0x47173d2652d9df3b => {
14881 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
14882 let mut req = fidl::new_empty!(
14883 StreamProcessorQueueInputPacketRequest,
14884 fidl::encoding::DefaultFuchsiaResourceDialect
14885 );
14886 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorQueueInputPacketRequest>(&header, _body_bytes, handles, &mut req)?;
14887 let control_handle =
14888 StreamProcessorControlHandle { inner: this.inner.clone() };
14889 Ok(StreamProcessorRequest::QueueInputPacket {
14890 packet: req.packet,
14891
14892 control_handle,
14893 })
14894 }
14895 0x2051b6ad00f20b37 => {
14896 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
14897 let mut req = fidl::new_empty!(
14898 StreamProcessorQueueInputEndOfStreamRequest,
14899 fidl::encoding::DefaultFuchsiaResourceDialect
14900 );
14901 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamProcessorQueueInputEndOfStreamRequest>(&header, _body_bytes, handles, &mut req)?;
14902 let control_handle =
14903 StreamProcessorControlHandle { inner: this.inner.clone() };
14904 Ok(StreamProcessorRequest::QueueInputEndOfStream {
14905 stream_lifetime_ordinal: req.stream_lifetime_ordinal,
14906
14907 control_handle,
14908 })
14909 }
14910 _ => Err(fidl::Error::UnknownOrdinal {
14911 ordinal: header.ordinal,
14912 protocol_name:
14913 <StreamProcessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
14914 }),
14915 }))
14916 },
14917 )
14918 }
14919}
14920
14921#[derive(Debug)]
14995pub enum StreamProcessorRequest {
14996 EnableOnStreamFailed { control_handle: StreamProcessorControlHandle },
15003 SetInputBufferPartialSettings {
15027 input_settings: StreamBufferPartialSettings,
15028 control_handle: StreamProcessorControlHandle,
15029 },
15030 SetOutputBufferPartialSettings {
15054 output_settings: StreamBufferPartialSettings,
15055 control_handle: StreamProcessorControlHandle,
15056 },
15057 CompleteOutputBufferPartialSettings {
15073 buffer_lifetime_ordinal: u64,
15074 control_handle: StreamProcessorControlHandle,
15075 },
15076 FlushEndOfStreamAndCloseStream {
15117 stream_lifetime_ordinal: u64,
15118 control_handle: StreamProcessorControlHandle,
15119 },
15120 CloseCurrentStream {
15141 stream_lifetime_ordinal: u64,
15142 release_input_buffers: bool,
15143 release_output_buffers: bool,
15144 control_handle: StreamProcessorControlHandle,
15145 },
15146 Sync { responder: StreamProcessorSyncResponder },
15173 RecycleOutputPacket {
15184 available_output_packet: PacketHeader,
15185 control_handle: StreamProcessorControlHandle,
15186 },
15187 QueueInputFormatDetails {
15214 stream_lifetime_ordinal: u64,
15215 format_details: FormatDetails,
15216 control_handle: StreamProcessorControlHandle,
15217 },
15218 QueueInputPacket { packet: Packet, control_handle: StreamProcessorControlHandle },
15232 QueueInputEndOfStream {
15269 stream_lifetime_ordinal: u64,
15270 control_handle: StreamProcessorControlHandle,
15271 },
15272}
15273
15274impl StreamProcessorRequest {
15275 #[allow(irrefutable_let_patterns)]
15276 pub fn into_enable_on_stream_failed(self) -> Option<(StreamProcessorControlHandle)> {
15277 if let StreamProcessorRequest::EnableOnStreamFailed { control_handle } = self {
15278 Some((control_handle))
15279 } else {
15280 None
15281 }
15282 }
15283
15284 #[allow(irrefutable_let_patterns)]
15285 pub fn into_set_input_buffer_partial_settings(
15286 self,
15287 ) -> Option<(StreamBufferPartialSettings, StreamProcessorControlHandle)> {
15288 if let StreamProcessorRequest::SetInputBufferPartialSettings {
15289 input_settings,
15290 control_handle,
15291 } = self
15292 {
15293 Some((input_settings, control_handle))
15294 } else {
15295 None
15296 }
15297 }
15298
15299 #[allow(irrefutable_let_patterns)]
15300 pub fn into_set_output_buffer_partial_settings(
15301 self,
15302 ) -> Option<(StreamBufferPartialSettings, StreamProcessorControlHandle)> {
15303 if let StreamProcessorRequest::SetOutputBufferPartialSettings {
15304 output_settings,
15305 control_handle,
15306 } = self
15307 {
15308 Some((output_settings, control_handle))
15309 } else {
15310 None
15311 }
15312 }
15313
15314 #[allow(irrefutable_let_patterns)]
15315 pub fn into_complete_output_buffer_partial_settings(
15316 self,
15317 ) -> Option<(u64, StreamProcessorControlHandle)> {
15318 if let StreamProcessorRequest::CompleteOutputBufferPartialSettings {
15319 buffer_lifetime_ordinal,
15320 control_handle,
15321 } = self
15322 {
15323 Some((buffer_lifetime_ordinal, control_handle))
15324 } else {
15325 None
15326 }
15327 }
15328
15329 #[allow(irrefutable_let_patterns)]
15330 pub fn into_flush_end_of_stream_and_close_stream(
15331 self,
15332 ) -> Option<(u64, StreamProcessorControlHandle)> {
15333 if let StreamProcessorRequest::FlushEndOfStreamAndCloseStream {
15334 stream_lifetime_ordinal,
15335 control_handle,
15336 } = self
15337 {
15338 Some((stream_lifetime_ordinal, control_handle))
15339 } else {
15340 None
15341 }
15342 }
15343
15344 #[allow(irrefutable_let_patterns)]
15345 pub fn into_close_current_stream(
15346 self,
15347 ) -> Option<(u64, bool, bool, StreamProcessorControlHandle)> {
15348 if let StreamProcessorRequest::CloseCurrentStream {
15349 stream_lifetime_ordinal,
15350 release_input_buffers,
15351 release_output_buffers,
15352 control_handle,
15353 } = self
15354 {
15355 Some((
15356 stream_lifetime_ordinal,
15357 release_input_buffers,
15358 release_output_buffers,
15359 control_handle,
15360 ))
15361 } else {
15362 None
15363 }
15364 }
15365
15366 #[allow(irrefutable_let_patterns)]
15367 pub fn into_sync(self) -> Option<(StreamProcessorSyncResponder)> {
15368 if let StreamProcessorRequest::Sync { responder } = self {
15369 Some((responder))
15370 } else {
15371 None
15372 }
15373 }
15374
15375 #[allow(irrefutable_let_patterns)]
15376 pub fn into_recycle_output_packet(
15377 self,
15378 ) -> Option<(PacketHeader, StreamProcessorControlHandle)> {
15379 if let StreamProcessorRequest::RecycleOutputPacket {
15380 available_output_packet,
15381 control_handle,
15382 } = self
15383 {
15384 Some((available_output_packet, control_handle))
15385 } else {
15386 None
15387 }
15388 }
15389
15390 #[allow(irrefutable_let_patterns)]
15391 pub fn into_queue_input_format_details(
15392 self,
15393 ) -> Option<(u64, FormatDetails, StreamProcessorControlHandle)> {
15394 if let StreamProcessorRequest::QueueInputFormatDetails {
15395 stream_lifetime_ordinal,
15396 format_details,
15397 control_handle,
15398 } = self
15399 {
15400 Some((stream_lifetime_ordinal, format_details, control_handle))
15401 } else {
15402 None
15403 }
15404 }
15405
15406 #[allow(irrefutable_let_patterns)]
15407 pub fn into_queue_input_packet(self) -> Option<(Packet, StreamProcessorControlHandle)> {
15408 if let StreamProcessorRequest::QueueInputPacket { packet, control_handle } = self {
15409 Some((packet, control_handle))
15410 } else {
15411 None
15412 }
15413 }
15414
15415 #[allow(irrefutable_let_patterns)]
15416 pub fn into_queue_input_end_of_stream(self) -> Option<(u64, StreamProcessorControlHandle)> {
15417 if let StreamProcessorRequest::QueueInputEndOfStream {
15418 stream_lifetime_ordinal,
15419 control_handle,
15420 } = self
15421 {
15422 Some((stream_lifetime_ordinal, control_handle))
15423 } else {
15424 None
15425 }
15426 }
15427
15428 pub fn method_name(&self) -> &'static str {
15430 match *self {
15431 StreamProcessorRequest::EnableOnStreamFailed { .. } => "enable_on_stream_failed",
15432 StreamProcessorRequest::SetInputBufferPartialSettings { .. } => {
15433 "set_input_buffer_partial_settings"
15434 }
15435 StreamProcessorRequest::SetOutputBufferPartialSettings { .. } => {
15436 "set_output_buffer_partial_settings"
15437 }
15438 StreamProcessorRequest::CompleteOutputBufferPartialSettings { .. } => {
15439 "complete_output_buffer_partial_settings"
15440 }
15441 StreamProcessorRequest::FlushEndOfStreamAndCloseStream { .. } => {
15442 "flush_end_of_stream_and_close_stream"
15443 }
15444 StreamProcessorRequest::CloseCurrentStream { .. } => "close_current_stream",
15445 StreamProcessorRequest::Sync { .. } => "sync",
15446 StreamProcessorRequest::RecycleOutputPacket { .. } => "recycle_output_packet",
15447 StreamProcessorRequest::QueueInputFormatDetails { .. } => "queue_input_format_details",
15448 StreamProcessorRequest::QueueInputPacket { .. } => "queue_input_packet",
15449 StreamProcessorRequest::QueueInputEndOfStream { .. } => "queue_input_end_of_stream",
15450 }
15451 }
15452}
15453
15454#[derive(Debug, Clone)]
15455pub struct StreamProcessorControlHandle {
15456 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
15457}
15458
15459impl fidl::endpoints::ControlHandle for StreamProcessorControlHandle {
15460 fn shutdown(&self) {
15461 self.inner.shutdown()
15462 }
15463 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
15464 self.inner.shutdown_with_epitaph(status)
15465 }
15466
15467 fn is_closed(&self) -> bool {
15468 self.inner.channel().is_closed()
15469 }
15470 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
15471 self.inner.channel().on_closed()
15472 }
15473
15474 #[cfg(target_os = "fuchsia")]
15475 fn signal_peer(
15476 &self,
15477 clear_mask: zx::Signals,
15478 set_mask: zx::Signals,
15479 ) -> Result<(), zx_status::Status> {
15480 use fidl::Peered;
15481 self.inner.channel().signal_peer(clear_mask, set_mask)
15482 }
15483}
15484
15485impl StreamProcessorControlHandle {
15486 pub fn send_on_stream_failed(
15487 &self,
15488 mut stream_lifetime_ordinal: u64,
15489 mut error: StreamError,
15490 ) -> Result<(), fidl::Error> {
15491 self.inner.send::<StreamProcessorOnStreamFailedRequest>(
15492 (stream_lifetime_ordinal, error),
15493 0,
15494 0x77ccf70bb061cf8e,
15495 fidl::encoding::DynamicFlags::empty(),
15496 )
15497 }
15498
15499 pub fn send_on_input_constraints(
15500 &self,
15501 mut input_constraints: &StreamBufferConstraints,
15502 ) -> Result<(), fidl::Error> {
15503 self.inner.send::<StreamProcessorOnInputConstraintsRequest>(
15504 (input_constraints,),
15505 0,
15506 0x211da9966a8ca0,
15507 fidl::encoding::DynamicFlags::empty(),
15508 )
15509 }
15510
15511 pub fn send_on_output_constraints(
15512 &self,
15513 mut output_config: &StreamOutputConstraints,
15514 ) -> Result<(), fidl::Error> {
15515 self.inner.send::<StreamProcessorOnOutputConstraintsRequest>(
15516 (output_config,),
15517 0,
15518 0x40d8234504c170f3,
15519 fidl::encoding::DynamicFlags::empty(),
15520 )
15521 }
15522
15523 pub fn send_on_output_format(
15524 &self,
15525 mut output_format: &StreamOutputFormat,
15526 ) -> Result<(), fidl::Error> {
15527 self.inner.send::<StreamProcessorOnOutputFormatRequest>(
15528 (output_format,),
15529 0,
15530 0x131b77ae120360bc,
15531 fidl::encoding::DynamicFlags::empty(),
15532 )
15533 }
15534
15535 pub fn send_on_output_packet(
15536 &self,
15537 mut output_packet: &Packet,
15538 mut error_detected_before: bool,
15539 mut error_detected_during: bool,
15540 ) -> Result<(), fidl::Error> {
15541 self.inner.send::<StreamProcessorOnOutputPacketRequest>(
15542 (output_packet, error_detected_before, error_detected_during),
15543 0,
15544 0x5c2029be1090ce93,
15545 fidl::encoding::DynamicFlags::empty(),
15546 )
15547 }
15548
15549 pub fn send_on_output_end_of_stream(
15550 &self,
15551 mut stream_lifetime_ordinal: u64,
15552 mut error_detected_before: bool,
15553 ) -> Result<(), fidl::Error> {
15554 self.inner.send::<StreamProcessorOnOutputEndOfStreamRequest>(
15555 (stream_lifetime_ordinal, error_detected_before),
15556 0,
15557 0x3bb65d237cfa50e6,
15558 fidl::encoding::DynamicFlags::empty(),
15559 )
15560 }
15561
15562 pub fn send_on_free_input_packet(
15563 &self,
15564 mut free_input_packet: &PacketHeader,
15565 ) -> Result<(), fidl::Error> {
15566 self.inner.send::<StreamProcessorOnFreeInputPacketRequest>(
15567 (free_input_packet,),
15568 0,
15569 0xeef799b28708bbd,
15570 fidl::encoding::DynamicFlags::empty(),
15571 )
15572 }
15573}
15574
15575#[must_use = "FIDL methods require a response to be sent"]
15576#[derive(Debug)]
15577pub struct StreamProcessorSyncResponder {
15578 control_handle: std::mem::ManuallyDrop<StreamProcessorControlHandle>,
15579 tx_id: u32,
15580}
15581
15582impl std::ops::Drop for StreamProcessorSyncResponder {
15586 fn drop(&mut self) {
15587 self.control_handle.shutdown();
15588 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
15590 }
15591}
15592
15593impl fidl::endpoints::Responder for StreamProcessorSyncResponder {
15594 type ControlHandle = StreamProcessorControlHandle;
15595
15596 fn control_handle(&self) -> &StreamProcessorControlHandle {
15597 &self.control_handle
15598 }
15599
15600 fn drop_without_shutdown(mut self) {
15601 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
15603 std::mem::forget(self);
15605 }
15606}
15607
15608impl StreamProcessorSyncResponder {
15609 pub fn send(self) -> Result<(), fidl::Error> {
15613 let _result = self.send_raw();
15614 if _result.is_err() {
15615 self.control_handle.shutdown();
15616 }
15617 self.drop_without_shutdown();
15618 _result
15619 }
15620
15621 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
15623 let _result = self.send_raw();
15624 self.drop_without_shutdown();
15625 _result
15626 }
15627
15628 fn send_raw(&self) -> Result<(), fidl::Error> {
15629 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
15630 (),
15631 self.tx_id,
15632 0x4b3e44300b0ec6aa,
15633 fidl::encoding::DynamicFlags::empty(),
15634 )
15635 }
15636}
15637
15638#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15639pub struct StreamSinkMarker;
15640
15641impl fidl::endpoints::ProtocolMarker for StreamSinkMarker {
15642 type Proxy = StreamSinkProxy;
15643 type RequestStream = StreamSinkRequestStream;
15644 #[cfg(target_os = "fuchsia")]
15645 type SynchronousProxy = StreamSinkSynchronousProxy;
15646
15647 const DEBUG_NAME: &'static str = "(anonymous) StreamSink";
15648}
15649
15650pub trait StreamSinkProxyInterface: Send + Sync {
15651 type SendPacketResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
15652 fn r#send_packet(&self, packet: &StreamPacket) -> Self::SendPacketResponseFut;
15653 fn r#send_packet_no_reply(&self, packet: &StreamPacket) -> Result<(), fidl::Error>;
15654 fn r#end_of_stream(&self) -> Result<(), fidl::Error>;
15655 type DiscardAllPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
15656 fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut;
15657 fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error>;
15658}
15659#[derive(Debug)]
15660#[cfg(target_os = "fuchsia")]
15661pub struct StreamSinkSynchronousProxy {
15662 client: fidl::client::sync::Client,
15663}
15664
15665#[cfg(target_os = "fuchsia")]
15666impl fidl::endpoints::SynchronousProxy for StreamSinkSynchronousProxy {
15667 type Proxy = StreamSinkProxy;
15668 type Protocol = StreamSinkMarker;
15669
15670 fn from_channel(inner: fidl::Channel) -> Self {
15671 Self::new(inner)
15672 }
15673
15674 fn into_channel(self) -> fidl::Channel {
15675 self.client.into_channel()
15676 }
15677
15678 fn as_channel(&self) -> &fidl::Channel {
15679 self.client.as_channel()
15680 }
15681}
15682
15683#[cfg(target_os = "fuchsia")]
15684impl StreamSinkSynchronousProxy {
15685 pub fn new(channel: fidl::Channel) -> Self {
15686 let protocol_name = <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
15687 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
15688 }
15689
15690 pub fn into_channel(self) -> fidl::Channel {
15691 self.client.into_channel()
15692 }
15693
15694 pub fn wait_for_event(
15697 &self,
15698 deadline: zx::MonotonicInstant,
15699 ) -> Result<StreamSinkEvent, fidl::Error> {
15700 StreamSinkEvent::decode(self.client.wait_for_event(deadline)?)
15701 }
15702
15703 pub fn r#send_packet(
15709 &self,
15710 mut packet: &StreamPacket,
15711 ___deadline: zx::MonotonicInstant,
15712 ) -> Result<(), fidl::Error> {
15713 let _response =
15714 self.client.send_query::<StreamSinkSendPacketRequest, fidl::encoding::EmptyPayload>(
15715 (packet,),
15716 0x67cddd607442775f,
15717 fidl::encoding::DynamicFlags::empty(),
15718 ___deadline,
15719 )?;
15720 Ok(_response)
15721 }
15722
15723 pub fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
15730 self.client.send::<StreamSinkSendPacketNoReplyRequest>(
15731 (packet,),
15732 0x8d9b8b413ceba9d,
15733 fidl::encoding::DynamicFlags::empty(),
15734 )
15735 }
15736
15737 pub fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
15740 self.client.send::<fidl::encoding::EmptyPayload>(
15741 (),
15742 0x6180fd6f7e793b71,
15743 fidl::encoding::DynamicFlags::empty(),
15744 )
15745 }
15746
15747 pub fn r#discard_all_packets(
15751 &self,
15752 ___deadline: zx::MonotonicInstant,
15753 ) -> Result<(), fidl::Error> {
15754 let _response =
15755 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
15756 (),
15757 0x6f4dad7af2917665,
15758 fidl::encoding::DynamicFlags::empty(),
15759 ___deadline,
15760 )?;
15761 Ok(_response)
15762 }
15763
15764 pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
15767 self.client.send::<fidl::encoding::EmptyPayload>(
15768 (),
15769 0x50d36d0d23081bc4,
15770 fidl::encoding::DynamicFlags::empty(),
15771 )
15772 }
15773}
15774
15775#[cfg(target_os = "fuchsia")]
15776impl From<StreamSinkSynchronousProxy> for zx::Handle {
15777 fn from(value: StreamSinkSynchronousProxy) -> Self {
15778 value.into_channel().into()
15779 }
15780}
15781
15782#[cfg(target_os = "fuchsia")]
15783impl From<fidl::Channel> for StreamSinkSynchronousProxy {
15784 fn from(value: fidl::Channel) -> Self {
15785 Self::new(value)
15786 }
15787}
15788
15789#[derive(Debug, Clone)]
15790pub struct StreamSinkProxy {
15791 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
15792}
15793
15794impl fidl::endpoints::Proxy for StreamSinkProxy {
15795 type Protocol = StreamSinkMarker;
15796
15797 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
15798 Self::new(inner)
15799 }
15800
15801 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
15802 self.client.into_channel().map_err(|client| Self { client })
15803 }
15804
15805 fn as_channel(&self) -> &::fidl::AsyncChannel {
15806 self.client.as_channel()
15807 }
15808}
15809
15810impl StreamSinkProxy {
15811 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
15813 let protocol_name = <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
15814 Self { client: fidl::client::Client::new(channel, protocol_name) }
15815 }
15816
15817 pub fn take_event_stream(&self) -> StreamSinkEventStream {
15823 StreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
15824 }
15825
15826 pub fn r#send_packet(
15832 &self,
15833 mut packet: &StreamPacket,
15834 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
15835 StreamSinkProxyInterface::r#send_packet(self, packet)
15836 }
15837
15838 pub fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
15845 StreamSinkProxyInterface::r#send_packet_no_reply(self, packet)
15846 }
15847
15848 pub fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
15851 StreamSinkProxyInterface::r#end_of_stream(self)
15852 }
15853
15854 pub fn r#discard_all_packets(
15858 &self,
15859 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
15860 StreamSinkProxyInterface::r#discard_all_packets(self)
15861 }
15862
15863 pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
15866 StreamSinkProxyInterface::r#discard_all_packets_no_reply(self)
15867 }
15868}
15869
15870impl StreamSinkProxyInterface for StreamSinkProxy {
15871 type SendPacketResponseFut =
15872 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
15873 fn r#send_packet(&self, mut packet: &StreamPacket) -> Self::SendPacketResponseFut {
15874 fn _decode(
15875 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
15876 ) -> Result<(), fidl::Error> {
15877 let _response = fidl::client::decode_transaction_body::<
15878 fidl::encoding::EmptyPayload,
15879 fidl::encoding::DefaultFuchsiaResourceDialect,
15880 0x67cddd607442775f,
15881 >(_buf?)?;
15882 Ok(_response)
15883 }
15884 self.client.send_query_and_decode::<StreamSinkSendPacketRequest, ()>(
15885 (packet,),
15886 0x67cddd607442775f,
15887 fidl::encoding::DynamicFlags::empty(),
15888 _decode,
15889 )
15890 }
15891
15892 fn r#send_packet_no_reply(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
15893 self.client.send::<StreamSinkSendPacketNoReplyRequest>(
15894 (packet,),
15895 0x8d9b8b413ceba9d,
15896 fidl::encoding::DynamicFlags::empty(),
15897 )
15898 }
15899
15900 fn r#end_of_stream(&self) -> Result<(), fidl::Error> {
15901 self.client.send::<fidl::encoding::EmptyPayload>(
15902 (),
15903 0x6180fd6f7e793b71,
15904 fidl::encoding::DynamicFlags::empty(),
15905 )
15906 }
15907
15908 type DiscardAllPacketsResponseFut =
15909 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
15910 fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut {
15911 fn _decode(
15912 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
15913 ) -> Result<(), fidl::Error> {
15914 let _response = fidl::client::decode_transaction_body::<
15915 fidl::encoding::EmptyPayload,
15916 fidl::encoding::DefaultFuchsiaResourceDialect,
15917 0x6f4dad7af2917665,
15918 >(_buf?)?;
15919 Ok(_response)
15920 }
15921 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
15922 (),
15923 0x6f4dad7af2917665,
15924 fidl::encoding::DynamicFlags::empty(),
15925 _decode,
15926 )
15927 }
15928
15929 fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
15930 self.client.send::<fidl::encoding::EmptyPayload>(
15931 (),
15932 0x50d36d0d23081bc4,
15933 fidl::encoding::DynamicFlags::empty(),
15934 )
15935 }
15936}
15937
15938pub struct StreamSinkEventStream {
15939 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
15940}
15941
15942impl std::marker::Unpin for StreamSinkEventStream {}
15943
15944impl futures::stream::FusedStream for StreamSinkEventStream {
15945 fn is_terminated(&self) -> bool {
15946 self.event_receiver.is_terminated()
15947 }
15948}
15949
15950impl futures::Stream for StreamSinkEventStream {
15951 type Item = Result<StreamSinkEvent, fidl::Error>;
15952
15953 fn poll_next(
15954 mut self: std::pin::Pin<&mut Self>,
15955 cx: &mut std::task::Context<'_>,
15956 ) -> std::task::Poll<Option<Self::Item>> {
15957 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
15958 &mut self.event_receiver,
15959 cx
15960 )?) {
15961 Some(buf) => std::task::Poll::Ready(Some(StreamSinkEvent::decode(buf))),
15962 None => std::task::Poll::Ready(None),
15963 }
15964 }
15965}
15966
15967#[derive(Debug)]
15968pub enum StreamSinkEvent {}
15969
15970impl StreamSinkEvent {
15971 fn decode(
15973 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
15974 ) -> Result<StreamSinkEvent, fidl::Error> {
15975 let (bytes, _handles) = buf.split_mut();
15976 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
15977 debug_assert_eq!(tx_header.tx_id, 0);
15978 match tx_header.ordinal {
15979 _ => Err(fidl::Error::UnknownOrdinal {
15980 ordinal: tx_header.ordinal,
15981 protocol_name: <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
15982 }),
15983 }
15984 }
15985}
15986
15987pub struct StreamSinkRequestStream {
15989 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
15990 is_terminated: bool,
15991}
15992
15993impl std::marker::Unpin for StreamSinkRequestStream {}
15994
15995impl futures::stream::FusedStream for StreamSinkRequestStream {
15996 fn is_terminated(&self) -> bool {
15997 self.is_terminated
15998 }
15999}
16000
16001impl fidl::endpoints::RequestStream for StreamSinkRequestStream {
16002 type Protocol = StreamSinkMarker;
16003 type ControlHandle = StreamSinkControlHandle;
16004
16005 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
16006 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
16007 }
16008
16009 fn control_handle(&self) -> Self::ControlHandle {
16010 StreamSinkControlHandle { inner: self.inner.clone() }
16011 }
16012
16013 fn into_inner(
16014 self,
16015 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
16016 {
16017 (self.inner, self.is_terminated)
16018 }
16019
16020 fn from_inner(
16021 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
16022 is_terminated: bool,
16023 ) -> Self {
16024 Self { inner, is_terminated }
16025 }
16026}
16027
16028impl futures::Stream for StreamSinkRequestStream {
16029 type Item = Result<StreamSinkRequest, fidl::Error>;
16030
16031 fn poll_next(
16032 mut self: std::pin::Pin<&mut Self>,
16033 cx: &mut std::task::Context<'_>,
16034 ) -> std::task::Poll<Option<Self::Item>> {
16035 let this = &mut *self;
16036 if this.inner.check_shutdown(cx) {
16037 this.is_terminated = true;
16038 return std::task::Poll::Ready(None);
16039 }
16040 if this.is_terminated {
16041 panic!("polled StreamSinkRequestStream after completion");
16042 }
16043 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
16044 |bytes, handles| {
16045 match this.inner.channel().read_etc(cx, bytes, handles) {
16046 std::task::Poll::Ready(Ok(())) => {}
16047 std::task::Poll::Pending => return std::task::Poll::Pending,
16048 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
16049 this.is_terminated = true;
16050 return std::task::Poll::Ready(None);
16051 }
16052 std::task::Poll::Ready(Err(e)) => {
16053 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
16054 e.into(),
16055 ))))
16056 }
16057 }
16058
16059 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
16061
16062 std::task::Poll::Ready(Some(match header.ordinal {
16063 0x67cddd607442775f => {
16064 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
16065 let mut req = fidl::new_empty!(
16066 StreamSinkSendPacketRequest,
16067 fidl::encoding::DefaultFuchsiaResourceDialect
16068 );
16069 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkSendPacketRequest>(&header, _body_bytes, handles, &mut req)?;
16070 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
16071 Ok(StreamSinkRequest::SendPacket {
16072 packet: req.packet,
16073
16074 responder: StreamSinkSendPacketResponder {
16075 control_handle: std::mem::ManuallyDrop::new(control_handle),
16076 tx_id: header.tx_id,
16077 },
16078 })
16079 }
16080 0x8d9b8b413ceba9d => {
16081 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
16082 let mut req = fidl::new_empty!(
16083 StreamSinkSendPacketNoReplyRequest,
16084 fidl::encoding::DefaultFuchsiaResourceDialect
16085 );
16086 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkSendPacketNoReplyRequest>(&header, _body_bytes, handles, &mut req)?;
16087 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
16088 Ok(StreamSinkRequest::SendPacketNoReply {
16089 packet: req.packet,
16090
16091 control_handle,
16092 })
16093 }
16094 0x6180fd6f7e793b71 => {
16095 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
16096 let mut req = fidl::new_empty!(
16097 fidl::encoding::EmptyPayload,
16098 fidl::encoding::DefaultFuchsiaResourceDialect
16099 );
16100 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
16101 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
16102 Ok(StreamSinkRequest::EndOfStream { control_handle })
16103 }
16104 0x6f4dad7af2917665 => {
16105 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
16106 let mut req = fidl::new_empty!(
16107 fidl::encoding::EmptyPayload,
16108 fidl::encoding::DefaultFuchsiaResourceDialect
16109 );
16110 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
16111 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
16112 Ok(StreamSinkRequest::DiscardAllPackets {
16113 responder: StreamSinkDiscardAllPacketsResponder {
16114 control_handle: std::mem::ManuallyDrop::new(control_handle),
16115 tx_id: header.tx_id,
16116 },
16117 })
16118 }
16119 0x50d36d0d23081bc4 => {
16120 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
16121 let mut req = fidl::new_empty!(
16122 fidl::encoding::EmptyPayload,
16123 fidl::encoding::DefaultFuchsiaResourceDialect
16124 );
16125 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
16126 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
16127 Ok(StreamSinkRequest::DiscardAllPacketsNoReply { control_handle })
16128 }
16129 _ => Err(fidl::Error::UnknownOrdinal {
16130 ordinal: header.ordinal,
16131 protocol_name:
16132 <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
16133 }),
16134 }))
16135 },
16136 )
16137 }
16138}
16139
16140#[derive(Debug)]
16144pub enum StreamSinkRequest {
16145 SendPacket { packet: StreamPacket, responder: StreamSinkSendPacketResponder },
16151 SendPacketNoReply { packet: StreamPacket, control_handle: StreamSinkControlHandle },
16158 EndOfStream { control_handle: StreamSinkControlHandle },
16161 DiscardAllPackets { responder: StreamSinkDiscardAllPacketsResponder },
16165 DiscardAllPacketsNoReply { control_handle: StreamSinkControlHandle },
16168}
16169
16170impl StreamSinkRequest {
16171 #[allow(irrefutable_let_patterns)]
16172 pub fn into_send_packet(self) -> Option<(StreamPacket, StreamSinkSendPacketResponder)> {
16173 if let StreamSinkRequest::SendPacket { packet, responder } = self {
16174 Some((packet, responder))
16175 } else {
16176 None
16177 }
16178 }
16179
16180 #[allow(irrefutable_let_patterns)]
16181 pub fn into_send_packet_no_reply(self) -> Option<(StreamPacket, StreamSinkControlHandle)> {
16182 if let StreamSinkRequest::SendPacketNoReply { packet, control_handle } = self {
16183 Some((packet, control_handle))
16184 } else {
16185 None
16186 }
16187 }
16188
16189 #[allow(irrefutable_let_patterns)]
16190 pub fn into_end_of_stream(self) -> Option<(StreamSinkControlHandle)> {
16191 if let StreamSinkRequest::EndOfStream { control_handle } = self {
16192 Some((control_handle))
16193 } else {
16194 None
16195 }
16196 }
16197
16198 #[allow(irrefutable_let_patterns)]
16199 pub fn into_discard_all_packets(self) -> Option<(StreamSinkDiscardAllPacketsResponder)> {
16200 if let StreamSinkRequest::DiscardAllPackets { responder } = self {
16201 Some((responder))
16202 } else {
16203 None
16204 }
16205 }
16206
16207 #[allow(irrefutable_let_patterns)]
16208 pub fn into_discard_all_packets_no_reply(self) -> Option<(StreamSinkControlHandle)> {
16209 if let StreamSinkRequest::DiscardAllPacketsNoReply { control_handle } = self {
16210 Some((control_handle))
16211 } else {
16212 None
16213 }
16214 }
16215
16216 pub fn method_name(&self) -> &'static str {
16218 match *self {
16219 StreamSinkRequest::SendPacket { .. } => "send_packet",
16220 StreamSinkRequest::SendPacketNoReply { .. } => "send_packet_no_reply",
16221 StreamSinkRequest::EndOfStream { .. } => "end_of_stream",
16222 StreamSinkRequest::DiscardAllPackets { .. } => "discard_all_packets",
16223 StreamSinkRequest::DiscardAllPacketsNoReply { .. } => "discard_all_packets_no_reply",
16224 }
16225 }
16226}
16227
16228#[derive(Debug, Clone)]
16229pub struct StreamSinkControlHandle {
16230 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
16231}
16232
16233impl fidl::endpoints::ControlHandle for StreamSinkControlHandle {
16234 fn shutdown(&self) {
16235 self.inner.shutdown()
16236 }
16237 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
16238 self.inner.shutdown_with_epitaph(status)
16239 }
16240
16241 fn is_closed(&self) -> bool {
16242 self.inner.channel().is_closed()
16243 }
16244 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
16245 self.inner.channel().on_closed()
16246 }
16247
16248 #[cfg(target_os = "fuchsia")]
16249 fn signal_peer(
16250 &self,
16251 clear_mask: zx::Signals,
16252 set_mask: zx::Signals,
16253 ) -> Result<(), zx_status::Status> {
16254 use fidl::Peered;
16255 self.inner.channel().signal_peer(clear_mask, set_mask)
16256 }
16257}
16258
16259impl StreamSinkControlHandle {}
16260
16261#[must_use = "FIDL methods require a response to be sent"]
16262#[derive(Debug)]
16263pub struct StreamSinkSendPacketResponder {
16264 control_handle: std::mem::ManuallyDrop<StreamSinkControlHandle>,
16265 tx_id: u32,
16266}
16267
16268impl std::ops::Drop for StreamSinkSendPacketResponder {
16272 fn drop(&mut self) {
16273 self.control_handle.shutdown();
16274 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
16276 }
16277}
16278
16279impl fidl::endpoints::Responder for StreamSinkSendPacketResponder {
16280 type ControlHandle = StreamSinkControlHandle;
16281
16282 fn control_handle(&self) -> &StreamSinkControlHandle {
16283 &self.control_handle
16284 }
16285
16286 fn drop_without_shutdown(mut self) {
16287 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
16289 std::mem::forget(self);
16291 }
16292}
16293
16294impl StreamSinkSendPacketResponder {
16295 pub fn send(self) -> Result<(), fidl::Error> {
16299 let _result = self.send_raw();
16300 if _result.is_err() {
16301 self.control_handle.shutdown();
16302 }
16303 self.drop_without_shutdown();
16304 _result
16305 }
16306
16307 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
16309 let _result = self.send_raw();
16310 self.drop_without_shutdown();
16311 _result
16312 }
16313
16314 fn send_raw(&self) -> Result<(), fidl::Error> {
16315 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
16316 (),
16317 self.tx_id,
16318 0x67cddd607442775f,
16319 fidl::encoding::DynamicFlags::empty(),
16320 )
16321 }
16322}
16323
16324#[must_use = "FIDL methods require a response to be sent"]
16325#[derive(Debug)]
16326pub struct StreamSinkDiscardAllPacketsResponder {
16327 control_handle: std::mem::ManuallyDrop<StreamSinkControlHandle>,
16328 tx_id: u32,
16329}
16330
16331impl std::ops::Drop for StreamSinkDiscardAllPacketsResponder {
16335 fn drop(&mut self) {
16336 self.control_handle.shutdown();
16337 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
16339 }
16340}
16341
16342impl fidl::endpoints::Responder for StreamSinkDiscardAllPacketsResponder {
16343 type ControlHandle = StreamSinkControlHandle;
16344
16345 fn control_handle(&self) -> &StreamSinkControlHandle {
16346 &self.control_handle
16347 }
16348
16349 fn drop_without_shutdown(mut self) {
16350 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
16352 std::mem::forget(self);
16354 }
16355}
16356
16357impl StreamSinkDiscardAllPacketsResponder {
16358 pub fn send(self) -> Result<(), fidl::Error> {
16362 let _result = self.send_raw();
16363 if _result.is_err() {
16364 self.control_handle.shutdown();
16365 }
16366 self.drop_without_shutdown();
16367 _result
16368 }
16369
16370 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
16372 let _result = self.send_raw();
16373 self.drop_without_shutdown();
16374 _result
16375 }
16376
16377 fn send_raw(&self) -> Result<(), fidl::Error> {
16378 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
16379 (),
16380 self.tx_id,
16381 0x6f4dad7af2917665,
16382 fidl::encoding::DynamicFlags::empty(),
16383 )
16384 }
16385}
16386
16387#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
16388pub struct StreamSourceMarker;
16389
16390impl fidl::endpoints::ProtocolMarker for StreamSourceMarker {
16391 type Proxy = StreamSourceProxy;
16392 type RequestStream = StreamSourceRequestStream;
16393 #[cfg(target_os = "fuchsia")]
16394 type SynchronousProxy = StreamSourceSynchronousProxy;
16395
16396 const DEBUG_NAME: &'static str = "(anonymous) StreamSource";
16397}
16398
16399pub trait StreamSourceProxyInterface: Send + Sync {
16400 fn r#release_packet(&self, packet: &StreamPacket) -> Result<(), fidl::Error>;
16401 type DiscardAllPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
16402 fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut;
16403 fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error>;
16404}
16405#[derive(Debug)]
16406#[cfg(target_os = "fuchsia")]
16407pub struct StreamSourceSynchronousProxy {
16408 client: fidl::client::sync::Client,
16409}
16410
16411#[cfg(target_os = "fuchsia")]
16412impl fidl::endpoints::SynchronousProxy for StreamSourceSynchronousProxy {
16413 type Proxy = StreamSourceProxy;
16414 type Protocol = StreamSourceMarker;
16415
16416 fn from_channel(inner: fidl::Channel) -> Self {
16417 Self::new(inner)
16418 }
16419
16420 fn into_channel(self) -> fidl::Channel {
16421 self.client.into_channel()
16422 }
16423
16424 fn as_channel(&self) -> &fidl::Channel {
16425 self.client.as_channel()
16426 }
16427}
16428
16429#[cfg(target_os = "fuchsia")]
16430impl StreamSourceSynchronousProxy {
16431 pub fn new(channel: fidl::Channel) -> Self {
16432 let protocol_name = <StreamSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
16433 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
16434 }
16435
16436 pub fn into_channel(self) -> fidl::Channel {
16437 self.client.into_channel()
16438 }
16439
16440 pub fn wait_for_event(
16443 &self,
16444 deadline: zx::MonotonicInstant,
16445 ) -> Result<StreamSourceEvent, fidl::Error> {
16446 StreamSourceEvent::decode(self.client.wait_for_event(deadline)?)
16447 }
16448
16449 pub fn r#release_packet(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
16452 self.client.send::<StreamSourceReleasePacketRequest>(
16453 (packet,),
16454 0x7a7b57f0f7d9e4bb,
16455 fidl::encoding::DynamicFlags::empty(),
16456 )
16457 }
16458
16459 pub fn r#discard_all_packets(
16460 &self,
16461 ___deadline: zx::MonotonicInstant,
16462 ) -> Result<(), fidl::Error> {
16463 let _response =
16464 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
16465 (),
16466 0x27afd605e97b09d2,
16467 fidl::encoding::DynamicFlags::empty(),
16468 ___deadline,
16469 )?;
16470 Ok(_response)
16471 }
16472
16473 pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
16474 self.client.send::<fidl::encoding::EmptyPayload>(
16475 (),
16476 0x35f9d721e905b831,
16477 fidl::encoding::DynamicFlags::empty(),
16478 )
16479 }
16480}
16481
16482#[cfg(target_os = "fuchsia")]
16483impl From<StreamSourceSynchronousProxy> for zx::Handle {
16484 fn from(value: StreamSourceSynchronousProxy) -> Self {
16485 value.into_channel().into()
16486 }
16487}
16488
16489#[cfg(target_os = "fuchsia")]
16490impl From<fidl::Channel> for StreamSourceSynchronousProxy {
16491 fn from(value: fidl::Channel) -> Self {
16492 Self::new(value)
16493 }
16494}
16495
16496#[derive(Debug, Clone)]
16497pub struct StreamSourceProxy {
16498 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
16499}
16500
16501impl fidl::endpoints::Proxy for StreamSourceProxy {
16502 type Protocol = StreamSourceMarker;
16503
16504 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
16505 Self::new(inner)
16506 }
16507
16508 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
16509 self.client.into_channel().map_err(|client| Self { client })
16510 }
16511
16512 fn as_channel(&self) -> &::fidl::AsyncChannel {
16513 self.client.as_channel()
16514 }
16515}
16516
16517impl StreamSourceProxy {
16518 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
16520 let protocol_name = <StreamSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
16521 Self { client: fidl::client::Client::new(channel, protocol_name) }
16522 }
16523
16524 pub fn take_event_stream(&self) -> StreamSourceEventStream {
16530 StreamSourceEventStream { event_receiver: self.client.take_event_receiver() }
16531 }
16532
16533 pub fn r#release_packet(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
16536 StreamSourceProxyInterface::r#release_packet(self, packet)
16537 }
16538
16539 pub fn r#discard_all_packets(
16540 &self,
16541 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
16542 StreamSourceProxyInterface::r#discard_all_packets(self)
16543 }
16544
16545 pub fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
16546 StreamSourceProxyInterface::r#discard_all_packets_no_reply(self)
16547 }
16548}
16549
16550impl StreamSourceProxyInterface for StreamSourceProxy {
16551 fn r#release_packet(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
16552 self.client.send::<StreamSourceReleasePacketRequest>(
16553 (packet,),
16554 0x7a7b57f0f7d9e4bb,
16555 fidl::encoding::DynamicFlags::empty(),
16556 )
16557 }
16558
16559 type DiscardAllPacketsResponseFut =
16560 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
16561 fn r#discard_all_packets(&self) -> Self::DiscardAllPacketsResponseFut {
16562 fn _decode(
16563 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
16564 ) -> Result<(), fidl::Error> {
16565 let _response = fidl::client::decode_transaction_body::<
16566 fidl::encoding::EmptyPayload,
16567 fidl::encoding::DefaultFuchsiaResourceDialect,
16568 0x27afd605e97b09d2,
16569 >(_buf?)?;
16570 Ok(_response)
16571 }
16572 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
16573 (),
16574 0x27afd605e97b09d2,
16575 fidl::encoding::DynamicFlags::empty(),
16576 _decode,
16577 )
16578 }
16579
16580 fn r#discard_all_packets_no_reply(&self) -> Result<(), fidl::Error> {
16581 self.client.send::<fidl::encoding::EmptyPayload>(
16582 (),
16583 0x35f9d721e905b831,
16584 fidl::encoding::DynamicFlags::empty(),
16585 )
16586 }
16587}
16588
16589pub struct StreamSourceEventStream {
16590 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
16591}
16592
16593impl std::marker::Unpin for StreamSourceEventStream {}
16594
16595impl futures::stream::FusedStream for StreamSourceEventStream {
16596 fn is_terminated(&self) -> bool {
16597 self.event_receiver.is_terminated()
16598 }
16599}
16600
16601impl futures::Stream for StreamSourceEventStream {
16602 type Item = Result<StreamSourceEvent, fidl::Error>;
16603
16604 fn poll_next(
16605 mut self: std::pin::Pin<&mut Self>,
16606 cx: &mut std::task::Context<'_>,
16607 ) -> std::task::Poll<Option<Self::Item>> {
16608 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
16609 &mut self.event_receiver,
16610 cx
16611 )?) {
16612 Some(buf) => std::task::Poll::Ready(Some(StreamSourceEvent::decode(buf))),
16613 None => std::task::Poll::Ready(None),
16614 }
16615 }
16616}
16617
16618#[derive(Debug)]
16619pub enum StreamSourceEvent {
16620 OnPacketProduced { packet: StreamPacket },
16621 OnEndOfStream {},
16622}
16623
16624impl StreamSourceEvent {
16625 #[allow(irrefutable_let_patterns)]
16626 pub fn into_on_packet_produced(self) -> Option<StreamPacket> {
16627 if let StreamSourceEvent::OnPacketProduced { packet } = self {
16628 Some((packet))
16629 } else {
16630 None
16631 }
16632 }
16633 #[allow(irrefutable_let_patterns)]
16634 pub fn into_on_end_of_stream(self) -> Option<()> {
16635 if let StreamSourceEvent::OnEndOfStream {} = self {
16636 Some(())
16637 } else {
16638 None
16639 }
16640 }
16641
16642 fn decode(
16644 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
16645 ) -> Result<StreamSourceEvent, fidl::Error> {
16646 let (bytes, _handles) = buf.split_mut();
16647 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
16648 debug_assert_eq!(tx_header.tx_id, 0);
16649 match tx_header.ordinal {
16650 0x6bbe69746a3c8bd9 => {
16651 let mut out = fidl::new_empty!(
16652 StreamSourceOnPacketProducedRequest,
16653 fidl::encoding::DefaultFuchsiaResourceDialect
16654 );
16655 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSourceOnPacketProducedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
16656 Ok((StreamSourceEvent::OnPacketProduced { packet: out.packet }))
16657 }
16658 0x550e69b41d03e2c2 => {
16659 let mut out = fidl::new_empty!(
16660 fidl::encoding::EmptyPayload,
16661 fidl::encoding::DefaultFuchsiaResourceDialect
16662 );
16663 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
16664 Ok((StreamSourceEvent::OnEndOfStream {}))
16665 }
16666 _ => Err(fidl::Error::UnknownOrdinal {
16667 ordinal: tx_header.ordinal,
16668 protocol_name: <StreamSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
16669 }),
16670 }
16671 }
16672}
16673
16674pub struct StreamSourceRequestStream {
16676 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
16677 is_terminated: bool,
16678}
16679
16680impl std::marker::Unpin for StreamSourceRequestStream {}
16681
16682impl futures::stream::FusedStream for StreamSourceRequestStream {
16683 fn is_terminated(&self) -> bool {
16684 self.is_terminated
16685 }
16686}
16687
16688impl fidl::endpoints::RequestStream for StreamSourceRequestStream {
16689 type Protocol = StreamSourceMarker;
16690 type ControlHandle = StreamSourceControlHandle;
16691
16692 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
16693 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
16694 }
16695
16696 fn control_handle(&self) -> Self::ControlHandle {
16697 StreamSourceControlHandle { inner: self.inner.clone() }
16698 }
16699
16700 fn into_inner(
16701 self,
16702 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
16703 {
16704 (self.inner, self.is_terminated)
16705 }
16706
16707 fn from_inner(
16708 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
16709 is_terminated: bool,
16710 ) -> Self {
16711 Self { inner, is_terminated }
16712 }
16713}
16714
16715impl futures::Stream for StreamSourceRequestStream {
16716 type Item = Result<StreamSourceRequest, fidl::Error>;
16717
16718 fn poll_next(
16719 mut self: std::pin::Pin<&mut Self>,
16720 cx: &mut std::task::Context<'_>,
16721 ) -> std::task::Poll<Option<Self::Item>> {
16722 let this = &mut *self;
16723 if this.inner.check_shutdown(cx) {
16724 this.is_terminated = true;
16725 return std::task::Poll::Ready(None);
16726 }
16727 if this.is_terminated {
16728 panic!("polled StreamSourceRequestStream after completion");
16729 }
16730 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
16731 |bytes, handles| {
16732 match this.inner.channel().read_etc(cx, bytes, handles) {
16733 std::task::Poll::Ready(Ok(())) => {}
16734 std::task::Poll::Pending => return std::task::Poll::Pending,
16735 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
16736 this.is_terminated = true;
16737 return std::task::Poll::Ready(None);
16738 }
16739 std::task::Poll::Ready(Err(e)) => {
16740 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
16741 e.into(),
16742 ))))
16743 }
16744 }
16745
16746 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
16748
16749 std::task::Poll::Ready(Some(match header.ordinal {
16750 0x7a7b57f0f7d9e4bb => {
16751 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
16752 let mut req = fidl::new_empty!(
16753 StreamSourceReleasePacketRequest,
16754 fidl::encoding::DefaultFuchsiaResourceDialect
16755 );
16756 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSourceReleasePacketRequest>(&header, _body_bytes, handles, &mut req)?;
16757 let control_handle =
16758 StreamSourceControlHandle { inner: this.inner.clone() };
16759 Ok(StreamSourceRequest::ReleasePacket {
16760 packet: req.packet,
16761
16762 control_handle,
16763 })
16764 }
16765 0x27afd605e97b09d2 => {
16766 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
16767 let mut req = fidl::new_empty!(
16768 fidl::encoding::EmptyPayload,
16769 fidl::encoding::DefaultFuchsiaResourceDialect
16770 );
16771 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
16772 let control_handle =
16773 StreamSourceControlHandle { inner: this.inner.clone() };
16774 Ok(StreamSourceRequest::DiscardAllPackets {
16775 responder: StreamSourceDiscardAllPacketsResponder {
16776 control_handle: std::mem::ManuallyDrop::new(control_handle),
16777 tx_id: header.tx_id,
16778 },
16779 })
16780 }
16781 0x35f9d721e905b831 => {
16782 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
16783 let mut req = fidl::new_empty!(
16784 fidl::encoding::EmptyPayload,
16785 fidl::encoding::DefaultFuchsiaResourceDialect
16786 );
16787 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
16788 let control_handle =
16789 StreamSourceControlHandle { inner: this.inner.clone() };
16790 Ok(StreamSourceRequest::DiscardAllPacketsNoReply { control_handle })
16791 }
16792 _ => Err(fidl::Error::UnknownOrdinal {
16793 ordinal: header.ordinal,
16794 protocol_name:
16795 <StreamSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
16796 }),
16797 }))
16798 },
16799 )
16800 }
16801}
16802
16803#[derive(Debug)]
16807pub enum StreamSourceRequest {
16808 ReleasePacket {
16811 packet: StreamPacket,
16812 control_handle: StreamSourceControlHandle,
16813 },
16814 DiscardAllPackets {
16815 responder: StreamSourceDiscardAllPacketsResponder,
16816 },
16817 DiscardAllPacketsNoReply {
16818 control_handle: StreamSourceControlHandle,
16819 },
16820}
16821
16822impl StreamSourceRequest {
16823 #[allow(irrefutable_let_patterns)]
16824 pub fn into_release_packet(self) -> Option<(StreamPacket, StreamSourceControlHandle)> {
16825 if let StreamSourceRequest::ReleasePacket { packet, control_handle } = self {
16826 Some((packet, control_handle))
16827 } else {
16828 None
16829 }
16830 }
16831
16832 #[allow(irrefutable_let_patterns)]
16833 pub fn into_discard_all_packets(self) -> Option<(StreamSourceDiscardAllPacketsResponder)> {
16834 if let StreamSourceRequest::DiscardAllPackets { responder } = self {
16835 Some((responder))
16836 } else {
16837 None
16838 }
16839 }
16840
16841 #[allow(irrefutable_let_patterns)]
16842 pub fn into_discard_all_packets_no_reply(self) -> Option<(StreamSourceControlHandle)> {
16843 if let StreamSourceRequest::DiscardAllPacketsNoReply { control_handle } = self {
16844 Some((control_handle))
16845 } else {
16846 None
16847 }
16848 }
16849
16850 pub fn method_name(&self) -> &'static str {
16852 match *self {
16853 StreamSourceRequest::ReleasePacket { .. } => "release_packet",
16854 StreamSourceRequest::DiscardAllPackets { .. } => "discard_all_packets",
16855 StreamSourceRequest::DiscardAllPacketsNoReply { .. } => "discard_all_packets_no_reply",
16856 }
16857 }
16858}
16859
16860#[derive(Debug, Clone)]
16861pub struct StreamSourceControlHandle {
16862 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
16863}
16864
16865impl fidl::endpoints::ControlHandle for StreamSourceControlHandle {
16866 fn shutdown(&self) {
16867 self.inner.shutdown()
16868 }
16869 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
16870 self.inner.shutdown_with_epitaph(status)
16871 }
16872
16873 fn is_closed(&self) -> bool {
16874 self.inner.channel().is_closed()
16875 }
16876 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
16877 self.inner.channel().on_closed()
16878 }
16879
16880 #[cfg(target_os = "fuchsia")]
16881 fn signal_peer(
16882 &self,
16883 clear_mask: zx::Signals,
16884 set_mask: zx::Signals,
16885 ) -> Result<(), zx_status::Status> {
16886 use fidl::Peered;
16887 self.inner.channel().signal_peer(clear_mask, set_mask)
16888 }
16889}
16890
16891impl StreamSourceControlHandle {
16892 pub fn send_on_packet_produced(&self, mut packet: &StreamPacket) -> Result<(), fidl::Error> {
16893 self.inner.send::<StreamSourceOnPacketProducedRequest>(
16894 (packet,),
16895 0,
16896 0x6bbe69746a3c8bd9,
16897 fidl::encoding::DynamicFlags::empty(),
16898 )
16899 }
16900
16901 pub fn send_on_end_of_stream(&self) -> Result<(), fidl::Error> {
16902 self.inner.send::<fidl::encoding::EmptyPayload>(
16903 (),
16904 0,
16905 0x550e69b41d03e2c2,
16906 fidl::encoding::DynamicFlags::empty(),
16907 )
16908 }
16909}
16910
16911#[must_use = "FIDL methods require a response to be sent"]
16912#[derive(Debug)]
16913pub struct StreamSourceDiscardAllPacketsResponder {
16914 control_handle: std::mem::ManuallyDrop<StreamSourceControlHandle>,
16915 tx_id: u32,
16916}
16917
16918impl std::ops::Drop for StreamSourceDiscardAllPacketsResponder {
16922 fn drop(&mut self) {
16923 self.control_handle.shutdown();
16924 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
16926 }
16927}
16928
16929impl fidl::endpoints::Responder for StreamSourceDiscardAllPacketsResponder {
16930 type ControlHandle = StreamSourceControlHandle;
16931
16932 fn control_handle(&self) -> &StreamSourceControlHandle {
16933 &self.control_handle
16934 }
16935
16936 fn drop_without_shutdown(mut self) {
16937 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
16939 std::mem::forget(self);
16941 }
16942}
16943
16944impl StreamSourceDiscardAllPacketsResponder {
16945 pub fn send(self) -> Result<(), fidl::Error> {
16949 let _result = self.send_raw();
16950 if _result.is_err() {
16951 self.control_handle.shutdown();
16952 }
16953 self.drop_without_shutdown();
16954 _result
16955 }
16956
16957 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
16959 let _result = self.send_raw();
16960 self.drop_without_shutdown();
16961 _result
16962 }
16963
16964 fn send_raw(&self) -> Result<(), fidl::Error> {
16965 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
16966 (),
16967 self.tx_id,
16968 0x27afd605e97b09d2,
16969 fidl::encoding::DynamicFlags::empty(),
16970 )
16971 }
16972}
16973
16974#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
16975pub struct Usage2AudioConsumerFactoryMarker;
16976
16977impl fidl::endpoints::ProtocolMarker for Usage2AudioConsumerFactoryMarker {
16978 type Proxy = Usage2AudioConsumerFactoryProxy;
16979 type RequestStream = Usage2AudioConsumerFactoryRequestStream;
16980 #[cfg(target_os = "fuchsia")]
16981 type SynchronousProxy = Usage2AudioConsumerFactorySynchronousProxy;
16982
16983 const DEBUG_NAME: &'static str = "fuchsia.media.Usage2AudioConsumerFactory";
16984}
16985impl fidl::endpoints::DiscoverableProtocolMarker for Usage2AudioConsumerFactoryMarker {}
16986
16987pub trait Usage2AudioConsumerFactoryProxyInterface: Send + Sync {
16988 fn r#create_audio_consumer(
16989 &self,
16990 usage: AudioRenderUsage2,
16991 audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
16992 ) -> Result<(), fidl::Error>;
16993}
16994#[derive(Debug)]
16995#[cfg(target_os = "fuchsia")]
16996pub struct Usage2AudioConsumerFactorySynchronousProxy {
16997 client: fidl::client::sync::Client,
16998}
16999
17000#[cfg(target_os = "fuchsia")]
17001impl fidl::endpoints::SynchronousProxy for Usage2AudioConsumerFactorySynchronousProxy {
17002 type Proxy = Usage2AudioConsumerFactoryProxy;
17003 type Protocol = Usage2AudioConsumerFactoryMarker;
17004
17005 fn from_channel(inner: fidl::Channel) -> Self {
17006 Self::new(inner)
17007 }
17008
17009 fn into_channel(self) -> fidl::Channel {
17010 self.client.into_channel()
17011 }
17012
17013 fn as_channel(&self) -> &fidl::Channel {
17014 self.client.as_channel()
17015 }
17016}
17017
17018#[cfg(target_os = "fuchsia")]
17019impl Usage2AudioConsumerFactorySynchronousProxy {
17020 pub fn new(channel: fidl::Channel) -> Self {
17021 let protocol_name =
17022 <Usage2AudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
17023 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
17024 }
17025
17026 pub fn into_channel(self) -> fidl::Channel {
17027 self.client.into_channel()
17028 }
17029
17030 pub fn wait_for_event(
17033 &self,
17034 deadline: zx::MonotonicInstant,
17035 ) -> Result<Usage2AudioConsumerFactoryEvent, fidl::Error> {
17036 Usage2AudioConsumerFactoryEvent::decode(self.client.wait_for_event(deadline)?)
17037 }
17038
17039 pub fn r#create_audio_consumer(
17042 &self,
17043 mut usage: AudioRenderUsage2,
17044 mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
17045 ) -> Result<(), fidl::Error> {
17046 self.client.send::<Usage2AudioConsumerFactoryCreateAudioConsumerRequest>(
17047 (usage, audio_consumer_request),
17048 0x767722302a171873,
17049 fidl::encoding::DynamicFlags::FLEXIBLE,
17050 )
17051 }
17052}
17053
17054#[cfg(target_os = "fuchsia")]
17055impl From<Usage2AudioConsumerFactorySynchronousProxy> for zx::Handle {
17056 fn from(value: Usage2AudioConsumerFactorySynchronousProxy) -> Self {
17057 value.into_channel().into()
17058 }
17059}
17060
17061#[cfg(target_os = "fuchsia")]
17062impl From<fidl::Channel> for Usage2AudioConsumerFactorySynchronousProxy {
17063 fn from(value: fidl::Channel) -> Self {
17064 Self::new(value)
17065 }
17066}
17067
17068#[derive(Debug, Clone)]
17069pub struct Usage2AudioConsumerFactoryProxy {
17070 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
17071}
17072
17073impl fidl::endpoints::Proxy for Usage2AudioConsumerFactoryProxy {
17074 type Protocol = Usage2AudioConsumerFactoryMarker;
17075
17076 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
17077 Self::new(inner)
17078 }
17079
17080 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
17081 self.client.into_channel().map_err(|client| Self { client })
17082 }
17083
17084 fn as_channel(&self) -> &::fidl::AsyncChannel {
17085 self.client.as_channel()
17086 }
17087}
17088
17089impl Usage2AudioConsumerFactoryProxy {
17090 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
17092 let protocol_name =
17093 <Usage2AudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
17094 Self { client: fidl::client::Client::new(channel, protocol_name) }
17095 }
17096
17097 pub fn take_event_stream(&self) -> Usage2AudioConsumerFactoryEventStream {
17103 Usage2AudioConsumerFactoryEventStream { event_receiver: self.client.take_event_receiver() }
17104 }
17105
17106 pub fn r#create_audio_consumer(
17109 &self,
17110 mut usage: AudioRenderUsage2,
17111 mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
17112 ) -> Result<(), fidl::Error> {
17113 Usage2AudioConsumerFactoryProxyInterface::r#create_audio_consumer(
17114 self,
17115 usage,
17116 audio_consumer_request,
17117 )
17118 }
17119}
17120
17121impl Usage2AudioConsumerFactoryProxyInterface for Usage2AudioConsumerFactoryProxy {
17122 fn r#create_audio_consumer(
17123 &self,
17124 mut usage: AudioRenderUsage2,
17125 mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
17126 ) -> Result<(), fidl::Error> {
17127 self.client.send::<Usage2AudioConsumerFactoryCreateAudioConsumerRequest>(
17128 (usage, audio_consumer_request),
17129 0x767722302a171873,
17130 fidl::encoding::DynamicFlags::FLEXIBLE,
17131 )
17132 }
17133}
17134
17135pub struct Usage2AudioConsumerFactoryEventStream {
17136 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
17137}
17138
17139impl std::marker::Unpin for Usage2AudioConsumerFactoryEventStream {}
17140
17141impl futures::stream::FusedStream for Usage2AudioConsumerFactoryEventStream {
17142 fn is_terminated(&self) -> bool {
17143 self.event_receiver.is_terminated()
17144 }
17145}
17146
17147impl futures::Stream for Usage2AudioConsumerFactoryEventStream {
17148 type Item = Result<Usage2AudioConsumerFactoryEvent, fidl::Error>;
17149
17150 fn poll_next(
17151 mut self: std::pin::Pin<&mut Self>,
17152 cx: &mut std::task::Context<'_>,
17153 ) -> std::task::Poll<Option<Self::Item>> {
17154 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
17155 &mut self.event_receiver,
17156 cx
17157 )?) {
17158 Some(buf) => std::task::Poll::Ready(Some(Usage2AudioConsumerFactoryEvent::decode(buf))),
17159 None => std::task::Poll::Ready(None),
17160 }
17161 }
17162}
17163
17164#[derive(Debug)]
17165pub enum Usage2AudioConsumerFactoryEvent {
17166 #[non_exhaustive]
17167 _UnknownEvent {
17168 ordinal: u64,
17170 },
17171}
17172
17173impl Usage2AudioConsumerFactoryEvent {
17174 fn decode(
17176 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
17177 ) -> Result<Usage2AudioConsumerFactoryEvent, fidl::Error> {
17178 let (bytes, _handles) = buf.split_mut();
17179 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
17180 debug_assert_eq!(tx_header.tx_id, 0);
17181 match tx_header.ordinal {
17182 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
17183 Ok(Usage2AudioConsumerFactoryEvent::_UnknownEvent {
17184 ordinal: tx_header.ordinal,
17185 })
17186 }
17187 _ => Err(fidl::Error::UnknownOrdinal {
17188 ordinal: tx_header.ordinal,
17189 protocol_name: <Usage2AudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
17190 })
17191 }
17192 }
17193}
17194
17195pub struct Usage2AudioConsumerFactoryRequestStream {
17197 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
17198 is_terminated: bool,
17199}
17200
17201impl std::marker::Unpin for Usage2AudioConsumerFactoryRequestStream {}
17202
17203impl futures::stream::FusedStream for Usage2AudioConsumerFactoryRequestStream {
17204 fn is_terminated(&self) -> bool {
17205 self.is_terminated
17206 }
17207}
17208
17209impl fidl::endpoints::RequestStream for Usage2AudioConsumerFactoryRequestStream {
17210 type Protocol = Usage2AudioConsumerFactoryMarker;
17211 type ControlHandle = Usage2AudioConsumerFactoryControlHandle;
17212
17213 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
17214 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
17215 }
17216
17217 fn control_handle(&self) -> Self::ControlHandle {
17218 Usage2AudioConsumerFactoryControlHandle { inner: self.inner.clone() }
17219 }
17220
17221 fn into_inner(
17222 self,
17223 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
17224 {
17225 (self.inner, self.is_terminated)
17226 }
17227
17228 fn from_inner(
17229 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
17230 is_terminated: bool,
17231 ) -> Self {
17232 Self { inner, is_terminated }
17233 }
17234}
17235
17236impl futures::Stream for Usage2AudioConsumerFactoryRequestStream {
17237 type Item = Result<Usage2AudioConsumerFactoryRequest, fidl::Error>;
17238
17239 fn poll_next(
17240 mut self: std::pin::Pin<&mut Self>,
17241 cx: &mut std::task::Context<'_>,
17242 ) -> std::task::Poll<Option<Self::Item>> {
17243 let this = &mut *self;
17244 if this.inner.check_shutdown(cx) {
17245 this.is_terminated = true;
17246 return std::task::Poll::Ready(None);
17247 }
17248 if this.is_terminated {
17249 panic!("polled Usage2AudioConsumerFactoryRequestStream after completion");
17250 }
17251 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
17252 |bytes, handles| {
17253 match this.inner.channel().read_etc(cx, bytes, handles) {
17254 std::task::Poll::Ready(Ok(())) => {}
17255 std::task::Poll::Pending => return std::task::Poll::Pending,
17256 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
17257 this.is_terminated = true;
17258 return std::task::Poll::Ready(None);
17259 }
17260 std::task::Poll::Ready(Err(e)) => {
17261 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
17262 e.into(),
17263 ))))
17264 }
17265 }
17266
17267 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
17269
17270 std::task::Poll::Ready(Some(match header.ordinal {
17271 0x767722302a171873 => {
17272 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
17273 let mut req = fidl::new_empty!(Usage2AudioConsumerFactoryCreateAudioConsumerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
17274 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Usage2AudioConsumerFactoryCreateAudioConsumerRequest>(&header, _body_bytes, handles, &mut req)?;
17275 let control_handle = Usage2AudioConsumerFactoryControlHandle {
17276 inner: this.inner.clone(),
17277 };
17278 Ok(Usage2AudioConsumerFactoryRequest::CreateAudioConsumer {usage: req.usage,
17279audio_consumer_request: req.audio_consumer_request,
17280
17281 control_handle,
17282 })
17283 }
17284 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
17285 Ok(Usage2AudioConsumerFactoryRequest::_UnknownMethod {
17286 ordinal: header.ordinal,
17287 control_handle: Usage2AudioConsumerFactoryControlHandle { inner: this.inner.clone() },
17288 method_type: fidl::MethodType::OneWay,
17289 })
17290 }
17291 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
17292 this.inner.send_framework_err(
17293 fidl::encoding::FrameworkErr::UnknownMethod,
17294 header.tx_id,
17295 header.ordinal,
17296 header.dynamic_flags(),
17297 (bytes, handles),
17298 )?;
17299 Ok(Usage2AudioConsumerFactoryRequest::_UnknownMethod {
17300 ordinal: header.ordinal,
17301 control_handle: Usage2AudioConsumerFactoryControlHandle { inner: this.inner.clone() },
17302 method_type: fidl::MethodType::TwoWay,
17303 })
17304 }
17305 _ => Err(fidl::Error::UnknownOrdinal {
17306 ordinal: header.ordinal,
17307 protocol_name: <Usage2AudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
17308 }),
17309 }))
17310 },
17311 )
17312 }
17313}
17314
17315#[derive(Debug)]
17317pub enum Usage2AudioConsumerFactoryRequest {
17318 CreateAudioConsumer {
17321 usage: AudioRenderUsage2,
17322 audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
17323 control_handle: Usage2AudioConsumerFactoryControlHandle,
17324 },
17325 #[non_exhaustive]
17327 _UnknownMethod {
17328 ordinal: u64,
17330 control_handle: Usage2AudioConsumerFactoryControlHandle,
17331 method_type: fidl::MethodType,
17332 },
17333}
17334
17335impl Usage2AudioConsumerFactoryRequest {
17336 #[allow(irrefutable_let_patterns)]
17337 pub fn into_create_audio_consumer(
17338 self,
17339 ) -> Option<(
17340 AudioRenderUsage2,
17341 fidl::endpoints::ServerEnd<AudioConsumerMarker>,
17342 Usage2AudioConsumerFactoryControlHandle,
17343 )> {
17344 if let Usage2AudioConsumerFactoryRequest::CreateAudioConsumer {
17345 usage,
17346 audio_consumer_request,
17347 control_handle,
17348 } = self
17349 {
17350 Some((usage, audio_consumer_request, control_handle))
17351 } else {
17352 None
17353 }
17354 }
17355
17356 pub fn method_name(&self) -> &'static str {
17358 match *self {
17359 Usage2AudioConsumerFactoryRequest::CreateAudioConsumer { .. } => {
17360 "create_audio_consumer"
17361 }
17362 Usage2AudioConsumerFactoryRequest::_UnknownMethod {
17363 method_type: fidl::MethodType::OneWay,
17364 ..
17365 } => "unknown one-way method",
17366 Usage2AudioConsumerFactoryRequest::_UnknownMethod {
17367 method_type: fidl::MethodType::TwoWay,
17368 ..
17369 } => "unknown two-way method",
17370 }
17371 }
17372}
17373
17374#[derive(Debug, Clone)]
17375pub struct Usage2AudioConsumerFactoryControlHandle {
17376 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
17377}
17378
17379impl fidl::endpoints::ControlHandle for Usage2AudioConsumerFactoryControlHandle {
17380 fn shutdown(&self) {
17381 self.inner.shutdown()
17382 }
17383 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
17384 self.inner.shutdown_with_epitaph(status)
17385 }
17386
17387 fn is_closed(&self) -> bool {
17388 self.inner.channel().is_closed()
17389 }
17390 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
17391 self.inner.channel().on_closed()
17392 }
17393
17394 #[cfg(target_os = "fuchsia")]
17395 fn signal_peer(
17396 &self,
17397 clear_mask: zx::Signals,
17398 set_mask: zx::Signals,
17399 ) -> Result<(), zx_status::Status> {
17400 use fidl::Peered;
17401 self.inner.channel().signal_peer(clear_mask, set_mask)
17402 }
17403}
17404
17405impl Usage2AudioConsumerFactoryControlHandle {}
17406
17407#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
17408pub struct UsageAudioConsumerFactoryMarker;
17409
17410impl fidl::endpoints::ProtocolMarker for UsageAudioConsumerFactoryMarker {
17411 type Proxy = UsageAudioConsumerFactoryProxy;
17412 type RequestStream = UsageAudioConsumerFactoryRequestStream;
17413 #[cfg(target_os = "fuchsia")]
17414 type SynchronousProxy = UsageAudioConsumerFactorySynchronousProxy;
17415
17416 const DEBUG_NAME: &'static str = "fuchsia.media.UsageAudioConsumerFactory";
17417}
17418impl fidl::endpoints::DiscoverableProtocolMarker for UsageAudioConsumerFactoryMarker {}
17419
17420pub trait UsageAudioConsumerFactoryProxyInterface: Send + Sync {
17421 fn r#create_audio_consumer(
17422 &self,
17423 usage: AudioRenderUsage,
17424 audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
17425 ) -> Result<(), fidl::Error>;
17426}
17427#[derive(Debug)]
17428#[cfg(target_os = "fuchsia")]
17429pub struct UsageAudioConsumerFactorySynchronousProxy {
17430 client: fidl::client::sync::Client,
17431}
17432
17433#[cfg(target_os = "fuchsia")]
17434impl fidl::endpoints::SynchronousProxy for UsageAudioConsumerFactorySynchronousProxy {
17435 type Proxy = UsageAudioConsumerFactoryProxy;
17436 type Protocol = UsageAudioConsumerFactoryMarker;
17437
17438 fn from_channel(inner: fidl::Channel) -> Self {
17439 Self::new(inner)
17440 }
17441
17442 fn into_channel(self) -> fidl::Channel {
17443 self.client.into_channel()
17444 }
17445
17446 fn as_channel(&self) -> &fidl::Channel {
17447 self.client.as_channel()
17448 }
17449}
17450
17451#[cfg(target_os = "fuchsia")]
17452impl UsageAudioConsumerFactorySynchronousProxy {
17453 pub fn new(channel: fidl::Channel) -> Self {
17454 let protocol_name =
17455 <UsageAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
17456 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
17457 }
17458
17459 pub fn into_channel(self) -> fidl::Channel {
17460 self.client.into_channel()
17461 }
17462
17463 pub fn wait_for_event(
17466 &self,
17467 deadline: zx::MonotonicInstant,
17468 ) -> Result<UsageAudioConsumerFactoryEvent, fidl::Error> {
17469 UsageAudioConsumerFactoryEvent::decode(self.client.wait_for_event(deadline)?)
17470 }
17471
17472 pub fn r#create_audio_consumer(
17473 &self,
17474 mut usage: AudioRenderUsage,
17475 mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
17476 ) -> Result<(), fidl::Error> {
17477 self.client.send::<UsageAudioConsumerFactoryCreateAudioConsumerRequest>(
17478 (usage, audio_consumer_request),
17479 0x4d975ca9b8f625a3,
17480 fidl::encoding::DynamicFlags::empty(),
17481 )
17482 }
17483}
17484
17485#[cfg(target_os = "fuchsia")]
17486impl From<UsageAudioConsumerFactorySynchronousProxy> for zx::Handle {
17487 fn from(value: UsageAudioConsumerFactorySynchronousProxy) -> Self {
17488 value.into_channel().into()
17489 }
17490}
17491
17492#[cfg(target_os = "fuchsia")]
17493impl From<fidl::Channel> for UsageAudioConsumerFactorySynchronousProxy {
17494 fn from(value: fidl::Channel) -> Self {
17495 Self::new(value)
17496 }
17497}
17498
17499#[derive(Debug, Clone)]
17500pub struct UsageAudioConsumerFactoryProxy {
17501 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
17502}
17503
17504impl fidl::endpoints::Proxy for UsageAudioConsumerFactoryProxy {
17505 type Protocol = UsageAudioConsumerFactoryMarker;
17506
17507 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
17508 Self::new(inner)
17509 }
17510
17511 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
17512 self.client.into_channel().map_err(|client| Self { client })
17513 }
17514
17515 fn as_channel(&self) -> &::fidl::AsyncChannel {
17516 self.client.as_channel()
17517 }
17518}
17519
17520impl UsageAudioConsumerFactoryProxy {
17521 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
17523 let protocol_name =
17524 <UsageAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
17525 Self { client: fidl::client::Client::new(channel, protocol_name) }
17526 }
17527
17528 pub fn take_event_stream(&self) -> UsageAudioConsumerFactoryEventStream {
17534 UsageAudioConsumerFactoryEventStream { event_receiver: self.client.take_event_receiver() }
17535 }
17536
17537 pub fn r#create_audio_consumer(
17538 &self,
17539 mut usage: AudioRenderUsage,
17540 mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
17541 ) -> Result<(), fidl::Error> {
17542 UsageAudioConsumerFactoryProxyInterface::r#create_audio_consumer(
17543 self,
17544 usage,
17545 audio_consumer_request,
17546 )
17547 }
17548}
17549
17550impl UsageAudioConsumerFactoryProxyInterface for UsageAudioConsumerFactoryProxy {
17551 fn r#create_audio_consumer(
17552 &self,
17553 mut usage: AudioRenderUsage,
17554 mut audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
17555 ) -> Result<(), fidl::Error> {
17556 self.client.send::<UsageAudioConsumerFactoryCreateAudioConsumerRequest>(
17557 (usage, audio_consumer_request),
17558 0x4d975ca9b8f625a3,
17559 fidl::encoding::DynamicFlags::empty(),
17560 )
17561 }
17562}
17563
17564pub struct UsageAudioConsumerFactoryEventStream {
17565 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
17566}
17567
17568impl std::marker::Unpin for UsageAudioConsumerFactoryEventStream {}
17569
17570impl futures::stream::FusedStream for UsageAudioConsumerFactoryEventStream {
17571 fn is_terminated(&self) -> bool {
17572 self.event_receiver.is_terminated()
17573 }
17574}
17575
17576impl futures::Stream for UsageAudioConsumerFactoryEventStream {
17577 type Item = Result<UsageAudioConsumerFactoryEvent, fidl::Error>;
17578
17579 fn poll_next(
17580 mut self: std::pin::Pin<&mut Self>,
17581 cx: &mut std::task::Context<'_>,
17582 ) -> std::task::Poll<Option<Self::Item>> {
17583 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
17584 &mut self.event_receiver,
17585 cx
17586 )?) {
17587 Some(buf) => std::task::Poll::Ready(Some(UsageAudioConsumerFactoryEvent::decode(buf))),
17588 None => std::task::Poll::Ready(None),
17589 }
17590 }
17591}
17592
17593#[derive(Debug)]
17594pub enum UsageAudioConsumerFactoryEvent {}
17595
17596impl UsageAudioConsumerFactoryEvent {
17597 fn decode(
17599 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
17600 ) -> Result<UsageAudioConsumerFactoryEvent, fidl::Error> {
17601 let (bytes, _handles) = buf.split_mut();
17602 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
17603 debug_assert_eq!(tx_header.tx_id, 0);
17604 match tx_header.ordinal {
17605 _ => Err(fidl::Error::UnknownOrdinal {
17606 ordinal: tx_header.ordinal,
17607 protocol_name:
17608 <UsageAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
17609 }),
17610 }
17611 }
17612}
17613
17614pub struct UsageAudioConsumerFactoryRequestStream {
17616 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
17617 is_terminated: bool,
17618}
17619
17620impl std::marker::Unpin for UsageAudioConsumerFactoryRequestStream {}
17621
17622impl futures::stream::FusedStream for UsageAudioConsumerFactoryRequestStream {
17623 fn is_terminated(&self) -> bool {
17624 self.is_terminated
17625 }
17626}
17627
17628impl fidl::endpoints::RequestStream for UsageAudioConsumerFactoryRequestStream {
17629 type Protocol = UsageAudioConsumerFactoryMarker;
17630 type ControlHandle = UsageAudioConsumerFactoryControlHandle;
17631
17632 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
17633 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
17634 }
17635
17636 fn control_handle(&self) -> Self::ControlHandle {
17637 UsageAudioConsumerFactoryControlHandle { inner: self.inner.clone() }
17638 }
17639
17640 fn into_inner(
17641 self,
17642 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
17643 {
17644 (self.inner, self.is_terminated)
17645 }
17646
17647 fn from_inner(
17648 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
17649 is_terminated: bool,
17650 ) -> Self {
17651 Self { inner, is_terminated }
17652 }
17653}
17654
17655impl futures::Stream for UsageAudioConsumerFactoryRequestStream {
17656 type Item = Result<UsageAudioConsumerFactoryRequest, fidl::Error>;
17657
17658 fn poll_next(
17659 mut self: std::pin::Pin<&mut Self>,
17660 cx: &mut std::task::Context<'_>,
17661 ) -> std::task::Poll<Option<Self::Item>> {
17662 let this = &mut *self;
17663 if this.inner.check_shutdown(cx) {
17664 this.is_terminated = true;
17665 return std::task::Poll::Ready(None);
17666 }
17667 if this.is_terminated {
17668 panic!("polled UsageAudioConsumerFactoryRequestStream after completion");
17669 }
17670 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
17671 |bytes, handles| {
17672 match this.inner.channel().read_etc(cx, bytes, handles) {
17673 std::task::Poll::Ready(Ok(())) => {}
17674 std::task::Poll::Pending => return std::task::Poll::Pending,
17675 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
17676 this.is_terminated = true;
17677 return std::task::Poll::Ready(None);
17678 }
17679 std::task::Poll::Ready(Err(e)) => {
17680 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
17681 e.into(),
17682 ))))
17683 }
17684 }
17685
17686 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
17688
17689 std::task::Poll::Ready(Some(match header.ordinal {
17690 0x4d975ca9b8f625a3 => {
17691 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
17692 let mut req = fidl::new_empty!(UsageAudioConsumerFactoryCreateAudioConsumerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
17693 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageAudioConsumerFactoryCreateAudioConsumerRequest>(&header, _body_bytes, handles, &mut req)?;
17694 let control_handle = UsageAudioConsumerFactoryControlHandle {
17695 inner: this.inner.clone(),
17696 };
17697 Ok(UsageAudioConsumerFactoryRequest::CreateAudioConsumer {usage: req.usage,
17698audio_consumer_request: req.audio_consumer_request,
17699
17700 control_handle,
17701 })
17702 }
17703 _ => Err(fidl::Error::UnknownOrdinal {
17704 ordinal: header.ordinal,
17705 protocol_name: <UsageAudioConsumerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
17706 }),
17707 }))
17708 },
17709 )
17710 }
17711}
17712
17713#[derive(Debug)]
17715pub enum UsageAudioConsumerFactoryRequest {
17716 CreateAudioConsumer {
17717 usage: AudioRenderUsage,
17718 audio_consumer_request: fidl::endpoints::ServerEnd<AudioConsumerMarker>,
17719 control_handle: UsageAudioConsumerFactoryControlHandle,
17720 },
17721}
17722
17723impl UsageAudioConsumerFactoryRequest {
17724 #[allow(irrefutable_let_patterns)]
17725 pub fn into_create_audio_consumer(
17726 self,
17727 ) -> Option<(
17728 AudioRenderUsage,
17729 fidl::endpoints::ServerEnd<AudioConsumerMarker>,
17730 UsageAudioConsumerFactoryControlHandle,
17731 )> {
17732 if let UsageAudioConsumerFactoryRequest::CreateAudioConsumer {
17733 usage,
17734 audio_consumer_request,
17735 control_handle,
17736 } = self
17737 {
17738 Some((usage, audio_consumer_request, control_handle))
17739 } else {
17740 None
17741 }
17742 }
17743
17744 pub fn method_name(&self) -> &'static str {
17746 match *self {
17747 UsageAudioConsumerFactoryRequest::CreateAudioConsumer { .. } => "create_audio_consumer",
17748 }
17749 }
17750}
17751
17752#[derive(Debug, Clone)]
17753pub struct UsageAudioConsumerFactoryControlHandle {
17754 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
17755}
17756
17757impl fidl::endpoints::ControlHandle for UsageAudioConsumerFactoryControlHandle {
17758 fn shutdown(&self) {
17759 self.inner.shutdown()
17760 }
17761 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
17762 self.inner.shutdown_with_epitaph(status)
17763 }
17764
17765 fn is_closed(&self) -> bool {
17766 self.inner.channel().is_closed()
17767 }
17768 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
17769 self.inner.channel().on_closed()
17770 }
17771
17772 #[cfg(target_os = "fuchsia")]
17773 fn signal_peer(
17774 &self,
17775 clear_mask: zx::Signals,
17776 set_mask: zx::Signals,
17777 ) -> Result<(), zx_status::Status> {
17778 use fidl::Peered;
17779 self.inner.channel().signal_peer(clear_mask, set_mask)
17780 }
17781}
17782
17783impl UsageAudioConsumerFactoryControlHandle {}
17784
17785#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
17786pub struct UsageGainListenerMarker;
17787
17788impl fidl::endpoints::ProtocolMarker for UsageGainListenerMarker {
17789 type Proxy = UsageGainListenerProxy;
17790 type RequestStream = UsageGainListenerRequestStream;
17791 #[cfg(target_os = "fuchsia")]
17792 type SynchronousProxy = UsageGainListenerSynchronousProxy;
17793
17794 const DEBUG_NAME: &'static str = "(anonymous) UsageGainListener";
17795}
17796
17797pub trait UsageGainListenerProxyInterface: Send + Sync {
17798 type OnGainMuteChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
17799 fn r#on_gain_mute_changed(
17800 &self,
17801 muted: bool,
17802 gain_dbfs: f32,
17803 ) -> Self::OnGainMuteChangedResponseFut;
17804}
17805#[derive(Debug)]
17806#[cfg(target_os = "fuchsia")]
17807pub struct UsageGainListenerSynchronousProxy {
17808 client: fidl::client::sync::Client,
17809}
17810
17811#[cfg(target_os = "fuchsia")]
17812impl fidl::endpoints::SynchronousProxy for UsageGainListenerSynchronousProxy {
17813 type Proxy = UsageGainListenerProxy;
17814 type Protocol = UsageGainListenerMarker;
17815
17816 fn from_channel(inner: fidl::Channel) -> Self {
17817 Self::new(inner)
17818 }
17819
17820 fn into_channel(self) -> fidl::Channel {
17821 self.client.into_channel()
17822 }
17823
17824 fn as_channel(&self) -> &fidl::Channel {
17825 self.client.as_channel()
17826 }
17827}
17828
17829#[cfg(target_os = "fuchsia")]
17830impl UsageGainListenerSynchronousProxy {
17831 pub fn new(channel: fidl::Channel) -> Self {
17832 let protocol_name =
17833 <UsageGainListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
17834 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
17835 }
17836
17837 pub fn into_channel(self) -> fidl::Channel {
17838 self.client.into_channel()
17839 }
17840
17841 pub fn wait_for_event(
17844 &self,
17845 deadline: zx::MonotonicInstant,
17846 ) -> Result<UsageGainListenerEvent, fidl::Error> {
17847 UsageGainListenerEvent::decode(self.client.wait_for_event(deadline)?)
17848 }
17849
17850 pub fn r#on_gain_mute_changed(
17858 &self,
17859 mut muted: bool,
17860 mut gain_dbfs: f32,
17861 ___deadline: zx::MonotonicInstant,
17862 ) -> Result<(), fidl::Error> {
17863 let _response = self
17864 .client
17865 .send_query::<UsageGainListenerOnGainMuteChangedRequest, fidl::encoding::EmptyPayload>(
17866 (muted, gain_dbfs),
17867 0x681570258eac3a8d,
17868 fidl::encoding::DynamicFlags::empty(),
17869 ___deadline,
17870 )?;
17871 Ok(_response)
17872 }
17873}
17874
17875#[cfg(target_os = "fuchsia")]
17876impl From<UsageGainListenerSynchronousProxy> for zx::Handle {
17877 fn from(value: UsageGainListenerSynchronousProxy) -> Self {
17878 value.into_channel().into()
17879 }
17880}
17881
17882#[cfg(target_os = "fuchsia")]
17883impl From<fidl::Channel> for UsageGainListenerSynchronousProxy {
17884 fn from(value: fidl::Channel) -> Self {
17885 Self::new(value)
17886 }
17887}
17888
17889#[derive(Debug, Clone)]
17890pub struct UsageGainListenerProxy {
17891 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
17892}
17893
17894impl fidl::endpoints::Proxy for UsageGainListenerProxy {
17895 type Protocol = UsageGainListenerMarker;
17896
17897 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
17898 Self::new(inner)
17899 }
17900
17901 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
17902 self.client.into_channel().map_err(|client| Self { client })
17903 }
17904
17905 fn as_channel(&self) -> &::fidl::AsyncChannel {
17906 self.client.as_channel()
17907 }
17908}
17909
17910impl UsageGainListenerProxy {
17911 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
17913 let protocol_name =
17914 <UsageGainListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
17915 Self { client: fidl::client::Client::new(channel, protocol_name) }
17916 }
17917
17918 pub fn take_event_stream(&self) -> UsageGainListenerEventStream {
17924 UsageGainListenerEventStream { event_receiver: self.client.take_event_receiver() }
17925 }
17926
17927 pub fn r#on_gain_mute_changed(
17935 &self,
17936 mut muted: bool,
17937 mut gain_dbfs: f32,
17938 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
17939 UsageGainListenerProxyInterface::r#on_gain_mute_changed(self, muted, gain_dbfs)
17940 }
17941}
17942
17943impl UsageGainListenerProxyInterface for UsageGainListenerProxy {
17944 type OnGainMuteChangedResponseFut =
17945 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
17946 fn r#on_gain_mute_changed(
17947 &self,
17948 mut muted: bool,
17949 mut gain_dbfs: f32,
17950 ) -> Self::OnGainMuteChangedResponseFut {
17951 fn _decode(
17952 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
17953 ) -> Result<(), fidl::Error> {
17954 let _response = fidl::client::decode_transaction_body::<
17955 fidl::encoding::EmptyPayload,
17956 fidl::encoding::DefaultFuchsiaResourceDialect,
17957 0x681570258eac3a8d,
17958 >(_buf?)?;
17959 Ok(_response)
17960 }
17961 self.client.send_query_and_decode::<UsageGainListenerOnGainMuteChangedRequest, ()>(
17962 (muted, gain_dbfs),
17963 0x681570258eac3a8d,
17964 fidl::encoding::DynamicFlags::empty(),
17965 _decode,
17966 )
17967 }
17968}
17969
17970pub struct UsageGainListenerEventStream {
17971 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
17972}
17973
17974impl std::marker::Unpin for UsageGainListenerEventStream {}
17975
17976impl futures::stream::FusedStream for UsageGainListenerEventStream {
17977 fn is_terminated(&self) -> bool {
17978 self.event_receiver.is_terminated()
17979 }
17980}
17981
17982impl futures::Stream for UsageGainListenerEventStream {
17983 type Item = Result<UsageGainListenerEvent, fidl::Error>;
17984
17985 fn poll_next(
17986 mut self: std::pin::Pin<&mut Self>,
17987 cx: &mut std::task::Context<'_>,
17988 ) -> std::task::Poll<Option<Self::Item>> {
17989 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
17990 &mut self.event_receiver,
17991 cx
17992 )?) {
17993 Some(buf) => std::task::Poll::Ready(Some(UsageGainListenerEvent::decode(buf))),
17994 None => std::task::Poll::Ready(None),
17995 }
17996 }
17997}
17998
17999#[derive(Debug)]
18000pub enum UsageGainListenerEvent {}
18001
18002impl UsageGainListenerEvent {
18003 fn decode(
18005 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
18006 ) -> Result<UsageGainListenerEvent, fidl::Error> {
18007 let (bytes, _handles) = buf.split_mut();
18008 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
18009 debug_assert_eq!(tx_header.tx_id, 0);
18010 match tx_header.ordinal {
18011 _ => Err(fidl::Error::UnknownOrdinal {
18012 ordinal: tx_header.ordinal,
18013 protocol_name:
18014 <UsageGainListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
18015 }),
18016 }
18017 }
18018}
18019
18020pub struct UsageGainListenerRequestStream {
18022 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
18023 is_terminated: bool,
18024}
18025
18026impl std::marker::Unpin for UsageGainListenerRequestStream {}
18027
18028impl futures::stream::FusedStream for UsageGainListenerRequestStream {
18029 fn is_terminated(&self) -> bool {
18030 self.is_terminated
18031 }
18032}
18033
18034impl fidl::endpoints::RequestStream for UsageGainListenerRequestStream {
18035 type Protocol = UsageGainListenerMarker;
18036 type ControlHandle = UsageGainListenerControlHandle;
18037
18038 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
18039 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
18040 }
18041
18042 fn control_handle(&self) -> Self::ControlHandle {
18043 UsageGainListenerControlHandle { inner: self.inner.clone() }
18044 }
18045
18046 fn into_inner(
18047 self,
18048 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
18049 {
18050 (self.inner, self.is_terminated)
18051 }
18052
18053 fn from_inner(
18054 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
18055 is_terminated: bool,
18056 ) -> Self {
18057 Self { inner, is_terminated }
18058 }
18059}
18060
18061impl futures::Stream for UsageGainListenerRequestStream {
18062 type Item = Result<UsageGainListenerRequest, fidl::Error>;
18063
18064 fn poll_next(
18065 mut self: std::pin::Pin<&mut Self>,
18066 cx: &mut std::task::Context<'_>,
18067 ) -> std::task::Poll<Option<Self::Item>> {
18068 let this = &mut *self;
18069 if this.inner.check_shutdown(cx) {
18070 this.is_terminated = true;
18071 return std::task::Poll::Ready(None);
18072 }
18073 if this.is_terminated {
18074 panic!("polled UsageGainListenerRequestStream after completion");
18075 }
18076 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
18077 |bytes, handles| {
18078 match this.inner.channel().read_etc(cx, bytes, handles) {
18079 std::task::Poll::Ready(Ok(())) => {}
18080 std::task::Poll::Pending => return std::task::Poll::Pending,
18081 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
18082 this.is_terminated = true;
18083 return std::task::Poll::Ready(None);
18084 }
18085 std::task::Poll::Ready(Err(e)) => {
18086 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
18087 e.into(),
18088 ))))
18089 }
18090 }
18091
18092 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
18094
18095 std::task::Poll::Ready(Some(match header.ordinal {
18096 0x681570258eac3a8d => {
18097 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
18098 let mut req = fidl::new_empty!(
18099 UsageGainListenerOnGainMuteChangedRequest,
18100 fidl::encoding::DefaultFuchsiaResourceDialect
18101 );
18102 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageGainListenerOnGainMuteChangedRequest>(&header, _body_bytes, handles, &mut req)?;
18103 let control_handle =
18104 UsageGainListenerControlHandle { inner: this.inner.clone() };
18105 Ok(UsageGainListenerRequest::OnGainMuteChanged {
18106 muted: req.muted,
18107 gain_dbfs: req.gain_dbfs,
18108
18109 responder: UsageGainListenerOnGainMuteChangedResponder {
18110 control_handle: std::mem::ManuallyDrop::new(control_handle),
18111 tx_id: header.tx_id,
18112 },
18113 })
18114 }
18115 _ => Err(fidl::Error::UnknownOrdinal {
18116 ordinal: header.ordinal,
18117 protocol_name:
18118 <UsageGainListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
18119 }),
18120 }))
18121 },
18122 )
18123 }
18124}
18125
18126#[derive(Debug)]
18130pub enum UsageGainListenerRequest {
18131 OnGainMuteChanged {
18139 muted: bool,
18140 gain_dbfs: f32,
18141 responder: UsageGainListenerOnGainMuteChangedResponder,
18142 },
18143}
18144
18145impl UsageGainListenerRequest {
18146 #[allow(irrefutable_let_patterns)]
18147 pub fn into_on_gain_mute_changed(
18148 self,
18149 ) -> Option<(bool, f32, UsageGainListenerOnGainMuteChangedResponder)> {
18150 if let UsageGainListenerRequest::OnGainMuteChanged { muted, gain_dbfs, responder } = self {
18151 Some((muted, gain_dbfs, responder))
18152 } else {
18153 None
18154 }
18155 }
18156
18157 pub fn method_name(&self) -> &'static str {
18159 match *self {
18160 UsageGainListenerRequest::OnGainMuteChanged { .. } => "on_gain_mute_changed",
18161 }
18162 }
18163}
18164
18165#[derive(Debug, Clone)]
18166pub struct UsageGainListenerControlHandle {
18167 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
18168}
18169
18170impl fidl::endpoints::ControlHandle for UsageGainListenerControlHandle {
18171 fn shutdown(&self) {
18172 self.inner.shutdown()
18173 }
18174 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
18175 self.inner.shutdown_with_epitaph(status)
18176 }
18177
18178 fn is_closed(&self) -> bool {
18179 self.inner.channel().is_closed()
18180 }
18181 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
18182 self.inner.channel().on_closed()
18183 }
18184
18185 #[cfg(target_os = "fuchsia")]
18186 fn signal_peer(
18187 &self,
18188 clear_mask: zx::Signals,
18189 set_mask: zx::Signals,
18190 ) -> Result<(), zx_status::Status> {
18191 use fidl::Peered;
18192 self.inner.channel().signal_peer(clear_mask, set_mask)
18193 }
18194}
18195
18196impl UsageGainListenerControlHandle {}
18197
18198#[must_use = "FIDL methods require a response to be sent"]
18199#[derive(Debug)]
18200pub struct UsageGainListenerOnGainMuteChangedResponder {
18201 control_handle: std::mem::ManuallyDrop<UsageGainListenerControlHandle>,
18202 tx_id: u32,
18203}
18204
18205impl std::ops::Drop for UsageGainListenerOnGainMuteChangedResponder {
18209 fn drop(&mut self) {
18210 self.control_handle.shutdown();
18211 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
18213 }
18214}
18215
18216impl fidl::endpoints::Responder for UsageGainListenerOnGainMuteChangedResponder {
18217 type ControlHandle = UsageGainListenerControlHandle;
18218
18219 fn control_handle(&self) -> &UsageGainListenerControlHandle {
18220 &self.control_handle
18221 }
18222
18223 fn drop_without_shutdown(mut self) {
18224 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
18226 std::mem::forget(self);
18228 }
18229}
18230
18231impl UsageGainListenerOnGainMuteChangedResponder {
18232 pub fn send(self) -> Result<(), fidl::Error> {
18236 let _result = self.send_raw();
18237 if _result.is_err() {
18238 self.control_handle.shutdown();
18239 }
18240 self.drop_without_shutdown();
18241 _result
18242 }
18243
18244 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
18246 let _result = self.send_raw();
18247 self.drop_without_shutdown();
18248 _result
18249 }
18250
18251 fn send_raw(&self) -> Result<(), fidl::Error> {
18252 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
18253 (),
18254 self.tx_id,
18255 0x681570258eac3a8d,
18256 fidl::encoding::DynamicFlags::empty(),
18257 )
18258 }
18259}
18260
18261#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
18262pub struct UsageGainReporterMarker;
18263
18264impl fidl::endpoints::ProtocolMarker for UsageGainReporterMarker {
18265 type Proxy = UsageGainReporterProxy;
18266 type RequestStream = UsageGainReporterRequestStream;
18267 #[cfg(target_os = "fuchsia")]
18268 type SynchronousProxy = UsageGainReporterSynchronousProxy;
18269
18270 const DEBUG_NAME: &'static str = "fuchsia.media.UsageGainReporter";
18271}
18272impl fidl::endpoints::DiscoverableProtocolMarker for UsageGainReporterMarker {}
18273
18274pub trait UsageGainReporterProxyInterface: Send + Sync {
18275 fn r#register_listener(
18276 &self,
18277 device_unique_id: &str,
18278 usage: &Usage,
18279 usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
18280 ) -> Result<(), fidl::Error>;
18281 fn r#register_listener2(
18282 &self,
18283 device_unique_id: &str,
18284 usage: &Usage2,
18285 usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
18286 ) -> Result<(), fidl::Error>;
18287}
18288#[derive(Debug)]
18289#[cfg(target_os = "fuchsia")]
18290pub struct UsageGainReporterSynchronousProxy {
18291 client: fidl::client::sync::Client,
18292}
18293
18294#[cfg(target_os = "fuchsia")]
18295impl fidl::endpoints::SynchronousProxy for UsageGainReporterSynchronousProxy {
18296 type Proxy = UsageGainReporterProxy;
18297 type Protocol = UsageGainReporterMarker;
18298
18299 fn from_channel(inner: fidl::Channel) -> Self {
18300 Self::new(inner)
18301 }
18302
18303 fn into_channel(self) -> fidl::Channel {
18304 self.client.into_channel()
18305 }
18306
18307 fn as_channel(&self) -> &fidl::Channel {
18308 self.client.as_channel()
18309 }
18310}
18311
18312#[cfg(target_os = "fuchsia")]
18313impl UsageGainReporterSynchronousProxy {
18314 pub fn new(channel: fidl::Channel) -> Self {
18315 let protocol_name =
18316 <UsageGainReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
18317 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
18318 }
18319
18320 pub fn into_channel(self) -> fidl::Channel {
18321 self.client.into_channel()
18322 }
18323
18324 pub fn wait_for_event(
18327 &self,
18328 deadline: zx::MonotonicInstant,
18329 ) -> Result<UsageGainReporterEvent, fidl::Error> {
18330 UsageGainReporterEvent::decode(self.client.wait_for_event(deadline)?)
18331 }
18332
18333 pub fn r#register_listener(
18346 &self,
18347 mut device_unique_id: &str,
18348 mut usage: &Usage,
18349 mut usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
18350 ) -> Result<(), fidl::Error> {
18351 self.client.send::<UsageGainReporterRegisterListenerRequest>(
18352 (device_unique_id, usage, usage_gain_listener),
18353 0x767107c168c226af,
18354 fidl::encoding::DynamicFlags::empty(),
18355 )
18356 }
18357
18358 pub fn r#register_listener2(
18371 &self,
18372 mut device_unique_id: &str,
18373 mut usage: &Usage2,
18374 mut usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
18375 ) -> Result<(), fidl::Error> {
18376 self.client.send::<UsageGainReporterRegisterListener2Request>(
18377 (device_unique_id, usage, usage_gain_listener),
18378 0x760a8e1c5873629c,
18379 fidl::encoding::DynamicFlags::FLEXIBLE,
18380 )
18381 }
18382}
18383
18384#[cfg(target_os = "fuchsia")]
18385impl From<UsageGainReporterSynchronousProxy> for zx::Handle {
18386 fn from(value: UsageGainReporterSynchronousProxy) -> Self {
18387 value.into_channel().into()
18388 }
18389}
18390
18391#[cfg(target_os = "fuchsia")]
18392impl From<fidl::Channel> for UsageGainReporterSynchronousProxy {
18393 fn from(value: fidl::Channel) -> Self {
18394 Self::new(value)
18395 }
18396}
18397
18398#[derive(Debug, Clone)]
18399pub struct UsageGainReporterProxy {
18400 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
18401}
18402
18403impl fidl::endpoints::Proxy for UsageGainReporterProxy {
18404 type Protocol = UsageGainReporterMarker;
18405
18406 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
18407 Self::new(inner)
18408 }
18409
18410 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
18411 self.client.into_channel().map_err(|client| Self { client })
18412 }
18413
18414 fn as_channel(&self) -> &::fidl::AsyncChannel {
18415 self.client.as_channel()
18416 }
18417}
18418
18419impl UsageGainReporterProxy {
18420 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
18422 let protocol_name =
18423 <UsageGainReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
18424 Self { client: fidl::client::Client::new(channel, protocol_name) }
18425 }
18426
18427 pub fn take_event_stream(&self) -> UsageGainReporterEventStream {
18433 UsageGainReporterEventStream { event_receiver: self.client.take_event_receiver() }
18434 }
18435
18436 pub fn r#register_listener(
18449 &self,
18450 mut device_unique_id: &str,
18451 mut usage: &Usage,
18452 mut usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
18453 ) -> Result<(), fidl::Error> {
18454 UsageGainReporterProxyInterface::r#register_listener(
18455 self,
18456 device_unique_id,
18457 usage,
18458 usage_gain_listener,
18459 )
18460 }
18461
18462 pub fn r#register_listener2(
18475 &self,
18476 mut device_unique_id: &str,
18477 mut usage: &Usage2,
18478 mut usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
18479 ) -> Result<(), fidl::Error> {
18480 UsageGainReporterProxyInterface::r#register_listener2(
18481 self,
18482 device_unique_id,
18483 usage,
18484 usage_gain_listener,
18485 )
18486 }
18487}
18488
18489impl UsageGainReporterProxyInterface for UsageGainReporterProxy {
18490 fn r#register_listener(
18491 &self,
18492 mut device_unique_id: &str,
18493 mut usage: &Usage,
18494 mut usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
18495 ) -> Result<(), fidl::Error> {
18496 self.client.send::<UsageGainReporterRegisterListenerRequest>(
18497 (device_unique_id, usage, usage_gain_listener),
18498 0x767107c168c226af,
18499 fidl::encoding::DynamicFlags::empty(),
18500 )
18501 }
18502
18503 fn r#register_listener2(
18504 &self,
18505 mut device_unique_id: &str,
18506 mut usage: &Usage2,
18507 mut usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
18508 ) -> Result<(), fidl::Error> {
18509 self.client.send::<UsageGainReporterRegisterListener2Request>(
18510 (device_unique_id, usage, usage_gain_listener),
18511 0x760a8e1c5873629c,
18512 fidl::encoding::DynamicFlags::FLEXIBLE,
18513 )
18514 }
18515}
18516
18517pub struct UsageGainReporterEventStream {
18518 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
18519}
18520
18521impl std::marker::Unpin for UsageGainReporterEventStream {}
18522
18523impl futures::stream::FusedStream for UsageGainReporterEventStream {
18524 fn is_terminated(&self) -> bool {
18525 self.event_receiver.is_terminated()
18526 }
18527}
18528
18529impl futures::Stream for UsageGainReporterEventStream {
18530 type Item = Result<UsageGainReporterEvent, fidl::Error>;
18531
18532 fn poll_next(
18533 mut self: std::pin::Pin<&mut Self>,
18534 cx: &mut std::task::Context<'_>,
18535 ) -> std::task::Poll<Option<Self::Item>> {
18536 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
18537 &mut self.event_receiver,
18538 cx
18539 )?) {
18540 Some(buf) => std::task::Poll::Ready(Some(UsageGainReporterEvent::decode(buf))),
18541 None => std::task::Poll::Ready(None),
18542 }
18543 }
18544}
18545
18546#[derive(Debug)]
18547pub enum UsageGainReporterEvent {
18548 #[non_exhaustive]
18549 _UnknownEvent {
18550 ordinal: u64,
18552 },
18553}
18554
18555impl UsageGainReporterEvent {
18556 fn decode(
18558 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
18559 ) -> Result<UsageGainReporterEvent, fidl::Error> {
18560 let (bytes, _handles) = buf.split_mut();
18561 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
18562 debug_assert_eq!(tx_header.tx_id, 0);
18563 match tx_header.ordinal {
18564 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
18565 Ok(UsageGainReporterEvent::_UnknownEvent { ordinal: tx_header.ordinal })
18566 }
18567 _ => Err(fidl::Error::UnknownOrdinal {
18568 ordinal: tx_header.ordinal,
18569 protocol_name:
18570 <UsageGainReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
18571 }),
18572 }
18573 }
18574}
18575
18576pub struct UsageGainReporterRequestStream {
18578 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
18579 is_terminated: bool,
18580}
18581
18582impl std::marker::Unpin for UsageGainReporterRequestStream {}
18583
18584impl futures::stream::FusedStream for UsageGainReporterRequestStream {
18585 fn is_terminated(&self) -> bool {
18586 self.is_terminated
18587 }
18588}
18589
18590impl fidl::endpoints::RequestStream for UsageGainReporterRequestStream {
18591 type Protocol = UsageGainReporterMarker;
18592 type ControlHandle = UsageGainReporterControlHandle;
18593
18594 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
18595 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
18596 }
18597
18598 fn control_handle(&self) -> Self::ControlHandle {
18599 UsageGainReporterControlHandle { inner: self.inner.clone() }
18600 }
18601
18602 fn into_inner(
18603 self,
18604 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
18605 {
18606 (self.inner, self.is_terminated)
18607 }
18608
18609 fn from_inner(
18610 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
18611 is_terminated: bool,
18612 ) -> Self {
18613 Self { inner, is_terminated }
18614 }
18615}
18616
18617impl futures::Stream for UsageGainReporterRequestStream {
18618 type Item = Result<UsageGainReporterRequest, fidl::Error>;
18619
18620 fn poll_next(
18621 mut self: std::pin::Pin<&mut Self>,
18622 cx: &mut std::task::Context<'_>,
18623 ) -> std::task::Poll<Option<Self::Item>> {
18624 let this = &mut *self;
18625 if this.inner.check_shutdown(cx) {
18626 this.is_terminated = true;
18627 return std::task::Poll::Ready(None);
18628 }
18629 if this.is_terminated {
18630 panic!("polled UsageGainReporterRequestStream after completion");
18631 }
18632 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
18633 |bytes, handles| {
18634 match this.inner.channel().read_etc(cx, bytes, handles) {
18635 std::task::Poll::Ready(Ok(())) => {}
18636 std::task::Poll::Pending => return std::task::Poll::Pending,
18637 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
18638 this.is_terminated = true;
18639 return std::task::Poll::Ready(None);
18640 }
18641 std::task::Poll::Ready(Err(e)) => {
18642 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
18643 e.into(),
18644 ))))
18645 }
18646 }
18647
18648 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
18650
18651 std::task::Poll::Ready(Some(match header.ordinal {
18652 0x767107c168c226af => {
18653 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
18654 let mut req = fidl::new_empty!(
18655 UsageGainReporterRegisterListenerRequest,
18656 fidl::encoding::DefaultFuchsiaResourceDialect
18657 );
18658 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageGainReporterRegisterListenerRequest>(&header, _body_bytes, handles, &mut req)?;
18659 let control_handle =
18660 UsageGainReporterControlHandle { inner: this.inner.clone() };
18661 Ok(UsageGainReporterRequest::RegisterListener {
18662 device_unique_id: req.device_unique_id,
18663 usage: req.usage,
18664 usage_gain_listener: req.usage_gain_listener,
18665
18666 control_handle,
18667 })
18668 }
18669 0x760a8e1c5873629c => {
18670 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
18671 let mut req = fidl::new_empty!(
18672 UsageGainReporterRegisterListener2Request,
18673 fidl::encoding::DefaultFuchsiaResourceDialect
18674 );
18675 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageGainReporterRegisterListener2Request>(&header, _body_bytes, handles, &mut req)?;
18676 let control_handle =
18677 UsageGainReporterControlHandle { inner: this.inner.clone() };
18678 Ok(UsageGainReporterRequest::RegisterListener2 {
18679 device_unique_id: req.device_unique_id,
18680 usage: req.usage,
18681 usage_gain_listener: req.usage_gain_listener,
18682
18683 control_handle,
18684 })
18685 }
18686 _ if header.tx_id == 0
18687 && header
18688 .dynamic_flags()
18689 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
18690 {
18691 Ok(UsageGainReporterRequest::_UnknownMethod {
18692 ordinal: header.ordinal,
18693 control_handle: UsageGainReporterControlHandle {
18694 inner: this.inner.clone(),
18695 },
18696 method_type: fidl::MethodType::OneWay,
18697 })
18698 }
18699 _ if header
18700 .dynamic_flags()
18701 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
18702 {
18703 this.inner.send_framework_err(
18704 fidl::encoding::FrameworkErr::UnknownMethod,
18705 header.tx_id,
18706 header.ordinal,
18707 header.dynamic_flags(),
18708 (bytes, handles),
18709 )?;
18710 Ok(UsageGainReporterRequest::_UnknownMethod {
18711 ordinal: header.ordinal,
18712 control_handle: UsageGainReporterControlHandle {
18713 inner: this.inner.clone(),
18714 },
18715 method_type: fidl::MethodType::TwoWay,
18716 })
18717 }
18718 _ => Err(fidl::Error::UnknownOrdinal {
18719 ordinal: header.ordinal,
18720 protocol_name:
18721 <UsageGainReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
18722 }),
18723 }))
18724 },
18725 )
18726 }
18727}
18728
18729#[derive(Debug)]
18731pub enum UsageGainReporterRequest {
18732 RegisterListener {
18745 device_unique_id: String,
18746 usage: Usage,
18747 usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
18748 control_handle: UsageGainReporterControlHandle,
18749 },
18750 RegisterListener2 {
18763 device_unique_id: String,
18764 usage: Usage2,
18765 usage_gain_listener: fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
18766 control_handle: UsageGainReporterControlHandle,
18767 },
18768 #[non_exhaustive]
18770 _UnknownMethod {
18771 ordinal: u64,
18773 control_handle: UsageGainReporterControlHandle,
18774 method_type: fidl::MethodType,
18775 },
18776}
18777
18778impl UsageGainReporterRequest {
18779 #[allow(irrefutable_let_patterns)]
18780 pub fn into_register_listener(
18781 self,
18782 ) -> Option<(
18783 String,
18784 Usage,
18785 fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
18786 UsageGainReporterControlHandle,
18787 )> {
18788 if let UsageGainReporterRequest::RegisterListener {
18789 device_unique_id,
18790 usage,
18791 usage_gain_listener,
18792 control_handle,
18793 } = self
18794 {
18795 Some((device_unique_id, usage, usage_gain_listener, control_handle))
18796 } else {
18797 None
18798 }
18799 }
18800
18801 #[allow(irrefutable_let_patterns)]
18802 pub fn into_register_listener2(
18803 self,
18804 ) -> Option<(
18805 String,
18806 Usage2,
18807 fidl::endpoints::ClientEnd<UsageGainListenerMarker>,
18808 UsageGainReporterControlHandle,
18809 )> {
18810 if let UsageGainReporterRequest::RegisterListener2 {
18811 device_unique_id,
18812 usage,
18813 usage_gain_listener,
18814 control_handle,
18815 } = self
18816 {
18817 Some((device_unique_id, usage, usage_gain_listener, control_handle))
18818 } else {
18819 None
18820 }
18821 }
18822
18823 pub fn method_name(&self) -> &'static str {
18825 match *self {
18826 UsageGainReporterRequest::RegisterListener { .. } => "register_listener",
18827 UsageGainReporterRequest::RegisterListener2 { .. } => "register_listener2",
18828 UsageGainReporterRequest::_UnknownMethod {
18829 method_type: fidl::MethodType::OneWay,
18830 ..
18831 } => "unknown one-way method",
18832 UsageGainReporterRequest::_UnknownMethod {
18833 method_type: fidl::MethodType::TwoWay,
18834 ..
18835 } => "unknown two-way method",
18836 }
18837 }
18838}
18839
18840#[derive(Debug, Clone)]
18841pub struct UsageGainReporterControlHandle {
18842 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
18843}
18844
18845impl fidl::endpoints::ControlHandle for UsageGainReporterControlHandle {
18846 fn shutdown(&self) {
18847 self.inner.shutdown()
18848 }
18849 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
18850 self.inner.shutdown_with_epitaph(status)
18851 }
18852
18853 fn is_closed(&self) -> bool {
18854 self.inner.channel().is_closed()
18855 }
18856 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
18857 self.inner.channel().on_closed()
18858 }
18859
18860 #[cfg(target_os = "fuchsia")]
18861 fn signal_peer(
18862 &self,
18863 clear_mask: zx::Signals,
18864 set_mask: zx::Signals,
18865 ) -> Result<(), zx_status::Status> {
18866 use fidl::Peered;
18867 self.inner.channel().signal_peer(clear_mask, set_mask)
18868 }
18869}
18870
18871impl UsageGainReporterControlHandle {}
18872
18873#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
18874pub struct UsageReporterMarker;
18875
18876impl fidl::endpoints::ProtocolMarker for UsageReporterMarker {
18877 type Proxy = UsageReporterProxy;
18878 type RequestStream = UsageReporterRequestStream;
18879 #[cfg(target_os = "fuchsia")]
18880 type SynchronousProxy = UsageReporterSynchronousProxy;
18881
18882 const DEBUG_NAME: &'static str = "fuchsia.media.UsageReporter";
18883}
18884impl fidl::endpoints::DiscoverableProtocolMarker for UsageReporterMarker {}
18885
18886pub trait UsageReporterProxyInterface: Send + Sync {
18887 fn r#watch(
18888 &self,
18889 usage: &Usage,
18890 usage_watcher: fidl::endpoints::ClientEnd<UsageWatcherMarker>,
18891 ) -> Result<(), fidl::Error>;
18892 fn r#watch2(
18893 &self,
18894 usage: &Usage2,
18895 usage_watcher: fidl::endpoints::ClientEnd<UsageWatcher2Marker>,
18896 ) -> Result<(), fidl::Error>;
18897}
18898#[derive(Debug)]
18899#[cfg(target_os = "fuchsia")]
18900pub struct UsageReporterSynchronousProxy {
18901 client: fidl::client::sync::Client,
18902}
18903
18904#[cfg(target_os = "fuchsia")]
18905impl fidl::endpoints::SynchronousProxy for UsageReporterSynchronousProxy {
18906 type Proxy = UsageReporterProxy;
18907 type Protocol = UsageReporterMarker;
18908
18909 fn from_channel(inner: fidl::Channel) -> Self {
18910 Self::new(inner)
18911 }
18912
18913 fn into_channel(self) -> fidl::Channel {
18914 self.client.into_channel()
18915 }
18916
18917 fn as_channel(&self) -> &fidl::Channel {
18918 self.client.as_channel()
18919 }
18920}
18921
18922#[cfg(target_os = "fuchsia")]
18923impl UsageReporterSynchronousProxy {
18924 pub fn new(channel: fidl::Channel) -> Self {
18925 let protocol_name = <UsageReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
18926 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
18927 }
18928
18929 pub fn into_channel(self) -> fidl::Channel {
18930 self.client.into_channel()
18931 }
18932
18933 pub fn wait_for_event(
18936 &self,
18937 deadline: zx::MonotonicInstant,
18938 ) -> Result<UsageReporterEvent, fidl::Error> {
18939 UsageReporterEvent::decode(self.client.wait_for_event(deadline)?)
18940 }
18941
18942 pub fn r#watch(
18943 &self,
18944 mut usage: &Usage,
18945 mut usage_watcher: fidl::endpoints::ClientEnd<UsageWatcherMarker>,
18946 ) -> Result<(), fidl::Error> {
18947 self.client.send::<UsageReporterWatchRequest>(
18948 (usage, usage_watcher),
18949 0x769e6fb17075c959,
18950 fidl::encoding::DynamicFlags::empty(),
18951 )
18952 }
18953
18954 pub fn r#watch2(
18955 &self,
18956 mut usage: &Usage2,
18957 mut usage_watcher: fidl::endpoints::ClientEnd<UsageWatcher2Marker>,
18958 ) -> Result<(), fidl::Error> {
18959 self.client.send::<UsageReporterWatch2Request>(
18960 (usage, usage_watcher),
18961 0x4a43c4c82f5d8ce8,
18962 fidl::encoding::DynamicFlags::FLEXIBLE,
18963 )
18964 }
18965}
18966
18967#[cfg(target_os = "fuchsia")]
18968impl From<UsageReporterSynchronousProxy> for zx::Handle {
18969 fn from(value: UsageReporterSynchronousProxy) -> Self {
18970 value.into_channel().into()
18971 }
18972}
18973
18974#[cfg(target_os = "fuchsia")]
18975impl From<fidl::Channel> for UsageReporterSynchronousProxy {
18976 fn from(value: fidl::Channel) -> Self {
18977 Self::new(value)
18978 }
18979}
18980
18981#[derive(Debug, Clone)]
18982pub struct UsageReporterProxy {
18983 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
18984}
18985
18986impl fidl::endpoints::Proxy for UsageReporterProxy {
18987 type Protocol = UsageReporterMarker;
18988
18989 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
18990 Self::new(inner)
18991 }
18992
18993 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
18994 self.client.into_channel().map_err(|client| Self { client })
18995 }
18996
18997 fn as_channel(&self) -> &::fidl::AsyncChannel {
18998 self.client.as_channel()
18999 }
19000}
19001
19002impl UsageReporterProxy {
19003 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
19005 let protocol_name = <UsageReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
19006 Self { client: fidl::client::Client::new(channel, protocol_name) }
19007 }
19008
19009 pub fn take_event_stream(&self) -> UsageReporterEventStream {
19015 UsageReporterEventStream { event_receiver: self.client.take_event_receiver() }
19016 }
19017
19018 pub fn r#watch(
19019 &self,
19020 mut usage: &Usage,
19021 mut usage_watcher: fidl::endpoints::ClientEnd<UsageWatcherMarker>,
19022 ) -> Result<(), fidl::Error> {
19023 UsageReporterProxyInterface::r#watch(self, usage, usage_watcher)
19024 }
19025
19026 pub fn r#watch2(
19027 &self,
19028 mut usage: &Usage2,
19029 mut usage_watcher: fidl::endpoints::ClientEnd<UsageWatcher2Marker>,
19030 ) -> Result<(), fidl::Error> {
19031 UsageReporterProxyInterface::r#watch2(self, usage, usage_watcher)
19032 }
19033}
19034
19035impl UsageReporterProxyInterface for UsageReporterProxy {
19036 fn r#watch(
19037 &self,
19038 mut usage: &Usage,
19039 mut usage_watcher: fidl::endpoints::ClientEnd<UsageWatcherMarker>,
19040 ) -> Result<(), fidl::Error> {
19041 self.client.send::<UsageReporterWatchRequest>(
19042 (usage, usage_watcher),
19043 0x769e6fb17075c959,
19044 fidl::encoding::DynamicFlags::empty(),
19045 )
19046 }
19047
19048 fn r#watch2(
19049 &self,
19050 mut usage: &Usage2,
19051 mut usage_watcher: fidl::endpoints::ClientEnd<UsageWatcher2Marker>,
19052 ) -> Result<(), fidl::Error> {
19053 self.client.send::<UsageReporterWatch2Request>(
19054 (usage, usage_watcher),
19055 0x4a43c4c82f5d8ce8,
19056 fidl::encoding::DynamicFlags::FLEXIBLE,
19057 )
19058 }
19059}
19060
19061pub struct UsageReporterEventStream {
19062 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
19063}
19064
19065impl std::marker::Unpin for UsageReporterEventStream {}
19066
19067impl futures::stream::FusedStream for UsageReporterEventStream {
19068 fn is_terminated(&self) -> bool {
19069 self.event_receiver.is_terminated()
19070 }
19071}
19072
19073impl futures::Stream for UsageReporterEventStream {
19074 type Item = Result<UsageReporterEvent, fidl::Error>;
19075
19076 fn poll_next(
19077 mut self: std::pin::Pin<&mut Self>,
19078 cx: &mut std::task::Context<'_>,
19079 ) -> std::task::Poll<Option<Self::Item>> {
19080 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
19081 &mut self.event_receiver,
19082 cx
19083 )?) {
19084 Some(buf) => std::task::Poll::Ready(Some(UsageReporterEvent::decode(buf))),
19085 None => std::task::Poll::Ready(None),
19086 }
19087 }
19088}
19089
19090#[derive(Debug)]
19091pub enum UsageReporterEvent {
19092 #[non_exhaustive]
19093 _UnknownEvent {
19094 ordinal: u64,
19096 },
19097}
19098
19099impl UsageReporterEvent {
19100 fn decode(
19102 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
19103 ) -> Result<UsageReporterEvent, fidl::Error> {
19104 let (bytes, _handles) = buf.split_mut();
19105 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
19106 debug_assert_eq!(tx_header.tx_id, 0);
19107 match tx_header.ordinal {
19108 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
19109 Ok(UsageReporterEvent::_UnknownEvent { ordinal: tx_header.ordinal })
19110 }
19111 _ => Err(fidl::Error::UnknownOrdinal {
19112 ordinal: tx_header.ordinal,
19113 protocol_name: <UsageReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
19114 }),
19115 }
19116 }
19117}
19118
19119pub struct UsageReporterRequestStream {
19121 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
19122 is_terminated: bool,
19123}
19124
19125impl std::marker::Unpin for UsageReporterRequestStream {}
19126
19127impl futures::stream::FusedStream for UsageReporterRequestStream {
19128 fn is_terminated(&self) -> bool {
19129 self.is_terminated
19130 }
19131}
19132
19133impl fidl::endpoints::RequestStream for UsageReporterRequestStream {
19134 type Protocol = UsageReporterMarker;
19135 type ControlHandle = UsageReporterControlHandle;
19136
19137 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
19138 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
19139 }
19140
19141 fn control_handle(&self) -> Self::ControlHandle {
19142 UsageReporterControlHandle { inner: self.inner.clone() }
19143 }
19144
19145 fn into_inner(
19146 self,
19147 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
19148 {
19149 (self.inner, self.is_terminated)
19150 }
19151
19152 fn from_inner(
19153 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
19154 is_terminated: bool,
19155 ) -> Self {
19156 Self { inner, is_terminated }
19157 }
19158}
19159
19160impl futures::Stream for UsageReporterRequestStream {
19161 type Item = Result<UsageReporterRequest, fidl::Error>;
19162
19163 fn poll_next(
19164 mut self: std::pin::Pin<&mut Self>,
19165 cx: &mut std::task::Context<'_>,
19166 ) -> std::task::Poll<Option<Self::Item>> {
19167 let this = &mut *self;
19168 if this.inner.check_shutdown(cx) {
19169 this.is_terminated = true;
19170 return std::task::Poll::Ready(None);
19171 }
19172 if this.is_terminated {
19173 panic!("polled UsageReporterRequestStream after completion");
19174 }
19175 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
19176 |bytes, handles| {
19177 match this.inner.channel().read_etc(cx, bytes, handles) {
19178 std::task::Poll::Ready(Ok(())) => {}
19179 std::task::Poll::Pending => return std::task::Poll::Pending,
19180 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
19181 this.is_terminated = true;
19182 return std::task::Poll::Ready(None);
19183 }
19184 std::task::Poll::Ready(Err(e)) => {
19185 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
19186 e.into(),
19187 ))))
19188 }
19189 }
19190
19191 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
19193
19194 std::task::Poll::Ready(Some(match header.ordinal {
19195 0x769e6fb17075c959 => {
19196 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
19197 let mut req = fidl::new_empty!(
19198 UsageReporterWatchRequest,
19199 fidl::encoding::DefaultFuchsiaResourceDialect
19200 );
19201 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageReporterWatchRequest>(&header, _body_bytes, handles, &mut req)?;
19202 let control_handle =
19203 UsageReporterControlHandle { inner: this.inner.clone() };
19204 Ok(UsageReporterRequest::Watch {
19205 usage: req.usage,
19206 usage_watcher: req.usage_watcher,
19207
19208 control_handle,
19209 })
19210 }
19211 0x4a43c4c82f5d8ce8 => {
19212 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
19213 let mut req = fidl::new_empty!(
19214 UsageReporterWatch2Request,
19215 fidl::encoding::DefaultFuchsiaResourceDialect
19216 );
19217 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageReporterWatch2Request>(&header, _body_bytes, handles, &mut req)?;
19218 let control_handle =
19219 UsageReporterControlHandle { inner: this.inner.clone() };
19220 Ok(UsageReporterRequest::Watch2 {
19221 usage: req.usage,
19222 usage_watcher: req.usage_watcher,
19223
19224 control_handle,
19225 })
19226 }
19227 _ if header.tx_id == 0
19228 && header
19229 .dynamic_flags()
19230 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
19231 {
19232 Ok(UsageReporterRequest::_UnknownMethod {
19233 ordinal: header.ordinal,
19234 control_handle: UsageReporterControlHandle {
19235 inner: this.inner.clone(),
19236 },
19237 method_type: fidl::MethodType::OneWay,
19238 })
19239 }
19240 _ if header
19241 .dynamic_flags()
19242 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
19243 {
19244 this.inner.send_framework_err(
19245 fidl::encoding::FrameworkErr::UnknownMethod,
19246 header.tx_id,
19247 header.ordinal,
19248 header.dynamic_flags(),
19249 (bytes, handles),
19250 )?;
19251 Ok(UsageReporterRequest::_UnknownMethod {
19252 ordinal: header.ordinal,
19253 control_handle: UsageReporterControlHandle {
19254 inner: this.inner.clone(),
19255 },
19256 method_type: fidl::MethodType::TwoWay,
19257 })
19258 }
19259 _ => Err(fidl::Error::UnknownOrdinal {
19260 ordinal: header.ordinal,
19261 protocol_name:
19262 <UsageReporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
19263 }),
19264 }))
19265 },
19266 )
19267 }
19268}
19269
19270#[derive(Debug)]
19272pub enum UsageReporterRequest {
19273 Watch {
19274 usage: Usage,
19275 usage_watcher: fidl::endpoints::ClientEnd<UsageWatcherMarker>,
19276 control_handle: UsageReporterControlHandle,
19277 },
19278 Watch2 {
19279 usage: Usage2,
19280 usage_watcher: fidl::endpoints::ClientEnd<UsageWatcher2Marker>,
19281 control_handle: UsageReporterControlHandle,
19282 },
19283 #[non_exhaustive]
19285 _UnknownMethod {
19286 ordinal: u64,
19288 control_handle: UsageReporterControlHandle,
19289 method_type: fidl::MethodType,
19290 },
19291}
19292
19293impl UsageReporterRequest {
19294 #[allow(irrefutable_let_patterns)]
19295 pub fn into_watch(
19296 self,
19297 ) -> Option<(Usage, fidl::endpoints::ClientEnd<UsageWatcherMarker>, UsageReporterControlHandle)>
19298 {
19299 if let UsageReporterRequest::Watch { usage, usage_watcher, control_handle } = self {
19300 Some((usage, usage_watcher, control_handle))
19301 } else {
19302 None
19303 }
19304 }
19305
19306 #[allow(irrefutable_let_patterns)]
19307 pub fn into_watch2(
19308 self,
19309 ) -> Option<(Usage2, fidl::endpoints::ClientEnd<UsageWatcher2Marker>, UsageReporterControlHandle)>
19310 {
19311 if let UsageReporterRequest::Watch2 { usage, usage_watcher, control_handle } = self {
19312 Some((usage, usage_watcher, control_handle))
19313 } else {
19314 None
19315 }
19316 }
19317
19318 pub fn method_name(&self) -> &'static str {
19320 match *self {
19321 UsageReporterRequest::Watch { .. } => "watch",
19322 UsageReporterRequest::Watch2 { .. } => "watch2",
19323 UsageReporterRequest::_UnknownMethod {
19324 method_type: fidl::MethodType::OneWay, ..
19325 } => "unknown one-way method",
19326 UsageReporterRequest::_UnknownMethod {
19327 method_type: fidl::MethodType::TwoWay, ..
19328 } => "unknown two-way method",
19329 }
19330 }
19331}
19332
19333#[derive(Debug, Clone)]
19334pub struct UsageReporterControlHandle {
19335 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
19336}
19337
19338impl fidl::endpoints::ControlHandle for UsageReporterControlHandle {
19339 fn shutdown(&self) {
19340 self.inner.shutdown()
19341 }
19342 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
19343 self.inner.shutdown_with_epitaph(status)
19344 }
19345
19346 fn is_closed(&self) -> bool {
19347 self.inner.channel().is_closed()
19348 }
19349 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
19350 self.inner.channel().on_closed()
19351 }
19352
19353 #[cfg(target_os = "fuchsia")]
19354 fn signal_peer(
19355 &self,
19356 clear_mask: zx::Signals,
19357 set_mask: zx::Signals,
19358 ) -> Result<(), zx_status::Status> {
19359 use fidl::Peered;
19360 self.inner.channel().signal_peer(clear_mask, set_mask)
19361 }
19362}
19363
19364impl UsageReporterControlHandle {}
19365
19366#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
19367pub struct UsageWatcherMarker;
19368
19369impl fidl::endpoints::ProtocolMarker for UsageWatcherMarker {
19370 type Proxy = UsageWatcherProxy;
19371 type RequestStream = UsageWatcherRequestStream;
19372 #[cfg(target_os = "fuchsia")]
19373 type SynchronousProxy = UsageWatcherSynchronousProxy;
19374
19375 const DEBUG_NAME: &'static str = "(anonymous) UsageWatcher";
19376}
19377
19378pub trait UsageWatcherProxyInterface: Send + Sync {
19379 type OnStateChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
19380 fn r#on_state_changed(
19381 &self,
19382 usage: &Usage,
19383 state: &UsageState,
19384 ) -> Self::OnStateChangedResponseFut;
19385}
19386#[derive(Debug)]
19387#[cfg(target_os = "fuchsia")]
19388pub struct UsageWatcherSynchronousProxy {
19389 client: fidl::client::sync::Client,
19390}
19391
19392#[cfg(target_os = "fuchsia")]
19393impl fidl::endpoints::SynchronousProxy for UsageWatcherSynchronousProxy {
19394 type Proxy = UsageWatcherProxy;
19395 type Protocol = UsageWatcherMarker;
19396
19397 fn from_channel(inner: fidl::Channel) -> Self {
19398 Self::new(inner)
19399 }
19400
19401 fn into_channel(self) -> fidl::Channel {
19402 self.client.into_channel()
19403 }
19404
19405 fn as_channel(&self) -> &fidl::Channel {
19406 self.client.as_channel()
19407 }
19408}
19409
19410#[cfg(target_os = "fuchsia")]
19411impl UsageWatcherSynchronousProxy {
19412 pub fn new(channel: fidl::Channel) -> Self {
19413 let protocol_name = <UsageWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
19414 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
19415 }
19416
19417 pub fn into_channel(self) -> fidl::Channel {
19418 self.client.into_channel()
19419 }
19420
19421 pub fn wait_for_event(
19424 &self,
19425 deadline: zx::MonotonicInstant,
19426 ) -> Result<UsageWatcherEvent, fidl::Error> {
19427 UsageWatcherEvent::decode(self.client.wait_for_event(deadline)?)
19428 }
19429
19430 pub fn r#on_state_changed(
19437 &self,
19438 mut usage: &Usage,
19439 mut state: &UsageState,
19440 ___deadline: zx::MonotonicInstant,
19441 ) -> Result<(), fidl::Error> {
19442 let _response = self
19443 .client
19444 .send_query::<UsageWatcherOnStateChangedRequest, fidl::encoding::EmptyPayload>(
19445 (usage, state),
19446 0x5b955c5768ec75c5,
19447 fidl::encoding::DynamicFlags::empty(),
19448 ___deadline,
19449 )?;
19450 Ok(_response)
19451 }
19452}
19453
19454#[cfg(target_os = "fuchsia")]
19455impl From<UsageWatcherSynchronousProxy> for zx::Handle {
19456 fn from(value: UsageWatcherSynchronousProxy) -> Self {
19457 value.into_channel().into()
19458 }
19459}
19460
19461#[cfg(target_os = "fuchsia")]
19462impl From<fidl::Channel> for UsageWatcherSynchronousProxy {
19463 fn from(value: fidl::Channel) -> Self {
19464 Self::new(value)
19465 }
19466}
19467
19468#[derive(Debug, Clone)]
19469pub struct UsageWatcherProxy {
19470 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
19471}
19472
19473impl fidl::endpoints::Proxy for UsageWatcherProxy {
19474 type Protocol = UsageWatcherMarker;
19475
19476 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
19477 Self::new(inner)
19478 }
19479
19480 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
19481 self.client.into_channel().map_err(|client| Self { client })
19482 }
19483
19484 fn as_channel(&self) -> &::fidl::AsyncChannel {
19485 self.client.as_channel()
19486 }
19487}
19488
19489impl UsageWatcherProxy {
19490 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
19492 let protocol_name = <UsageWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
19493 Self { client: fidl::client::Client::new(channel, protocol_name) }
19494 }
19495
19496 pub fn take_event_stream(&self) -> UsageWatcherEventStream {
19502 UsageWatcherEventStream { event_receiver: self.client.take_event_receiver() }
19503 }
19504
19505 pub fn r#on_state_changed(
19512 &self,
19513 mut usage: &Usage,
19514 mut state: &UsageState,
19515 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
19516 UsageWatcherProxyInterface::r#on_state_changed(self, usage, state)
19517 }
19518}
19519
19520impl UsageWatcherProxyInterface for UsageWatcherProxy {
19521 type OnStateChangedResponseFut =
19522 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
19523 fn r#on_state_changed(
19524 &self,
19525 mut usage: &Usage,
19526 mut state: &UsageState,
19527 ) -> Self::OnStateChangedResponseFut {
19528 fn _decode(
19529 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
19530 ) -> Result<(), fidl::Error> {
19531 let _response = fidl::client::decode_transaction_body::<
19532 fidl::encoding::EmptyPayload,
19533 fidl::encoding::DefaultFuchsiaResourceDialect,
19534 0x5b955c5768ec75c5,
19535 >(_buf?)?;
19536 Ok(_response)
19537 }
19538 self.client.send_query_and_decode::<UsageWatcherOnStateChangedRequest, ()>(
19539 (usage, state),
19540 0x5b955c5768ec75c5,
19541 fidl::encoding::DynamicFlags::empty(),
19542 _decode,
19543 )
19544 }
19545}
19546
19547pub struct UsageWatcherEventStream {
19548 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
19549}
19550
19551impl std::marker::Unpin for UsageWatcherEventStream {}
19552
19553impl futures::stream::FusedStream for UsageWatcherEventStream {
19554 fn is_terminated(&self) -> bool {
19555 self.event_receiver.is_terminated()
19556 }
19557}
19558
19559impl futures::Stream for UsageWatcherEventStream {
19560 type Item = Result<UsageWatcherEvent, fidl::Error>;
19561
19562 fn poll_next(
19563 mut self: std::pin::Pin<&mut Self>,
19564 cx: &mut std::task::Context<'_>,
19565 ) -> std::task::Poll<Option<Self::Item>> {
19566 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
19567 &mut self.event_receiver,
19568 cx
19569 )?) {
19570 Some(buf) => std::task::Poll::Ready(Some(UsageWatcherEvent::decode(buf))),
19571 None => std::task::Poll::Ready(None),
19572 }
19573 }
19574}
19575
19576#[derive(Debug)]
19577pub enum UsageWatcherEvent {}
19578
19579impl UsageWatcherEvent {
19580 fn decode(
19582 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
19583 ) -> Result<UsageWatcherEvent, fidl::Error> {
19584 let (bytes, _handles) = buf.split_mut();
19585 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
19586 debug_assert_eq!(tx_header.tx_id, 0);
19587 match tx_header.ordinal {
19588 _ => Err(fidl::Error::UnknownOrdinal {
19589 ordinal: tx_header.ordinal,
19590 protocol_name: <UsageWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
19591 }),
19592 }
19593 }
19594}
19595
19596pub struct UsageWatcherRequestStream {
19598 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
19599 is_terminated: bool,
19600}
19601
19602impl std::marker::Unpin for UsageWatcherRequestStream {}
19603
19604impl futures::stream::FusedStream for UsageWatcherRequestStream {
19605 fn is_terminated(&self) -> bool {
19606 self.is_terminated
19607 }
19608}
19609
19610impl fidl::endpoints::RequestStream for UsageWatcherRequestStream {
19611 type Protocol = UsageWatcherMarker;
19612 type ControlHandle = UsageWatcherControlHandle;
19613
19614 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
19615 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
19616 }
19617
19618 fn control_handle(&self) -> Self::ControlHandle {
19619 UsageWatcherControlHandle { inner: self.inner.clone() }
19620 }
19621
19622 fn into_inner(
19623 self,
19624 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
19625 {
19626 (self.inner, self.is_terminated)
19627 }
19628
19629 fn from_inner(
19630 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
19631 is_terminated: bool,
19632 ) -> Self {
19633 Self { inner, is_terminated }
19634 }
19635}
19636
19637impl futures::Stream for UsageWatcherRequestStream {
19638 type Item = Result<UsageWatcherRequest, fidl::Error>;
19639
19640 fn poll_next(
19641 mut self: std::pin::Pin<&mut Self>,
19642 cx: &mut std::task::Context<'_>,
19643 ) -> std::task::Poll<Option<Self::Item>> {
19644 let this = &mut *self;
19645 if this.inner.check_shutdown(cx) {
19646 this.is_terminated = true;
19647 return std::task::Poll::Ready(None);
19648 }
19649 if this.is_terminated {
19650 panic!("polled UsageWatcherRequestStream after completion");
19651 }
19652 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
19653 |bytes, handles| {
19654 match this.inner.channel().read_etc(cx, bytes, handles) {
19655 std::task::Poll::Ready(Ok(())) => {}
19656 std::task::Poll::Pending => return std::task::Poll::Pending,
19657 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
19658 this.is_terminated = true;
19659 return std::task::Poll::Ready(None);
19660 }
19661 std::task::Poll::Ready(Err(e)) => {
19662 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
19663 e.into(),
19664 ))))
19665 }
19666 }
19667
19668 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
19670
19671 std::task::Poll::Ready(Some(match header.ordinal {
19672 0x5b955c5768ec75c5 => {
19673 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
19674 let mut req = fidl::new_empty!(
19675 UsageWatcherOnStateChangedRequest,
19676 fidl::encoding::DefaultFuchsiaResourceDialect
19677 );
19678 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageWatcherOnStateChangedRequest>(&header, _body_bytes, handles, &mut req)?;
19679 let control_handle =
19680 UsageWatcherControlHandle { inner: this.inner.clone() };
19681 Ok(UsageWatcherRequest::OnStateChanged {
19682 usage: req.usage,
19683 state: req.state,
19684
19685 responder: UsageWatcherOnStateChangedResponder {
19686 control_handle: std::mem::ManuallyDrop::new(control_handle),
19687 tx_id: header.tx_id,
19688 },
19689 })
19690 }
19691 _ => Err(fidl::Error::UnknownOrdinal {
19692 ordinal: header.ordinal,
19693 protocol_name:
19694 <UsageWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
19695 }),
19696 }))
19697 },
19698 )
19699 }
19700}
19701
19702#[derive(Debug)]
19706pub enum UsageWatcherRequest {
19707 OnStateChanged {
19714 usage: Usage,
19715 state: UsageState,
19716 responder: UsageWatcherOnStateChangedResponder,
19717 },
19718}
19719
19720impl UsageWatcherRequest {
19721 #[allow(irrefutable_let_patterns)]
19722 pub fn into_on_state_changed(
19723 self,
19724 ) -> Option<(Usage, UsageState, UsageWatcherOnStateChangedResponder)> {
19725 if let UsageWatcherRequest::OnStateChanged { usage, state, responder } = self {
19726 Some((usage, state, responder))
19727 } else {
19728 None
19729 }
19730 }
19731
19732 pub fn method_name(&self) -> &'static str {
19734 match *self {
19735 UsageWatcherRequest::OnStateChanged { .. } => "on_state_changed",
19736 }
19737 }
19738}
19739
19740#[derive(Debug, Clone)]
19741pub struct UsageWatcherControlHandle {
19742 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
19743}
19744
19745impl fidl::endpoints::ControlHandle for UsageWatcherControlHandle {
19746 fn shutdown(&self) {
19747 self.inner.shutdown()
19748 }
19749 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
19750 self.inner.shutdown_with_epitaph(status)
19751 }
19752
19753 fn is_closed(&self) -> bool {
19754 self.inner.channel().is_closed()
19755 }
19756 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
19757 self.inner.channel().on_closed()
19758 }
19759
19760 #[cfg(target_os = "fuchsia")]
19761 fn signal_peer(
19762 &self,
19763 clear_mask: zx::Signals,
19764 set_mask: zx::Signals,
19765 ) -> Result<(), zx_status::Status> {
19766 use fidl::Peered;
19767 self.inner.channel().signal_peer(clear_mask, set_mask)
19768 }
19769}
19770
19771impl UsageWatcherControlHandle {}
19772
19773#[must_use = "FIDL methods require a response to be sent"]
19774#[derive(Debug)]
19775pub struct UsageWatcherOnStateChangedResponder {
19776 control_handle: std::mem::ManuallyDrop<UsageWatcherControlHandle>,
19777 tx_id: u32,
19778}
19779
19780impl std::ops::Drop for UsageWatcherOnStateChangedResponder {
19784 fn drop(&mut self) {
19785 self.control_handle.shutdown();
19786 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
19788 }
19789}
19790
19791impl fidl::endpoints::Responder for UsageWatcherOnStateChangedResponder {
19792 type ControlHandle = UsageWatcherControlHandle;
19793
19794 fn control_handle(&self) -> &UsageWatcherControlHandle {
19795 &self.control_handle
19796 }
19797
19798 fn drop_without_shutdown(mut self) {
19799 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
19801 std::mem::forget(self);
19803 }
19804}
19805
19806impl UsageWatcherOnStateChangedResponder {
19807 pub fn send(self) -> Result<(), fidl::Error> {
19811 let _result = self.send_raw();
19812 if _result.is_err() {
19813 self.control_handle.shutdown();
19814 }
19815 self.drop_without_shutdown();
19816 _result
19817 }
19818
19819 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
19821 let _result = self.send_raw();
19822 self.drop_without_shutdown();
19823 _result
19824 }
19825
19826 fn send_raw(&self) -> Result<(), fidl::Error> {
19827 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
19828 (),
19829 self.tx_id,
19830 0x5b955c5768ec75c5,
19831 fidl::encoding::DynamicFlags::empty(),
19832 )
19833 }
19834}
19835
19836#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
19837pub struct UsageWatcher2Marker;
19838
19839impl fidl::endpoints::ProtocolMarker for UsageWatcher2Marker {
19840 type Proxy = UsageWatcher2Proxy;
19841 type RequestStream = UsageWatcher2RequestStream;
19842 #[cfg(target_os = "fuchsia")]
19843 type SynchronousProxy = UsageWatcher2SynchronousProxy;
19844
19845 const DEBUG_NAME: &'static str = "(anonymous) UsageWatcher2";
19846}
19847
19848pub trait UsageWatcher2ProxyInterface: Send + Sync {
19849 type OnStateChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
19850 fn r#on_state_changed(
19851 &self,
19852 usage: &Usage2,
19853 state: &UsageState,
19854 ) -> Self::OnStateChangedResponseFut;
19855}
19856#[derive(Debug)]
19857#[cfg(target_os = "fuchsia")]
19858pub struct UsageWatcher2SynchronousProxy {
19859 client: fidl::client::sync::Client,
19860}
19861
19862#[cfg(target_os = "fuchsia")]
19863impl fidl::endpoints::SynchronousProxy for UsageWatcher2SynchronousProxy {
19864 type Proxy = UsageWatcher2Proxy;
19865 type Protocol = UsageWatcher2Marker;
19866
19867 fn from_channel(inner: fidl::Channel) -> Self {
19868 Self::new(inner)
19869 }
19870
19871 fn into_channel(self) -> fidl::Channel {
19872 self.client.into_channel()
19873 }
19874
19875 fn as_channel(&self) -> &fidl::Channel {
19876 self.client.as_channel()
19877 }
19878}
19879
19880#[cfg(target_os = "fuchsia")]
19881impl UsageWatcher2SynchronousProxy {
19882 pub fn new(channel: fidl::Channel) -> Self {
19883 let protocol_name = <UsageWatcher2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
19884 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
19885 }
19886
19887 pub fn into_channel(self) -> fidl::Channel {
19888 self.client.into_channel()
19889 }
19890
19891 pub fn wait_for_event(
19894 &self,
19895 deadline: zx::MonotonicInstant,
19896 ) -> Result<UsageWatcher2Event, fidl::Error> {
19897 UsageWatcher2Event::decode(self.client.wait_for_event(deadline)?)
19898 }
19899
19900 pub fn r#on_state_changed(
19907 &self,
19908 mut usage: &Usage2,
19909 mut state: &UsageState,
19910 ___deadline: zx::MonotonicInstant,
19911 ) -> Result<(), fidl::Error> {
19912 let _response = self
19913 .client
19914 .send_query::<UsageWatcher2OnStateChangedRequest, fidl::encoding::EmptyPayload>(
19915 (usage, state),
19916 0xca31a8b13c324d4,
19917 fidl::encoding::DynamicFlags::empty(),
19918 ___deadline,
19919 )?;
19920 Ok(_response)
19921 }
19922}
19923
19924#[cfg(target_os = "fuchsia")]
19925impl From<UsageWatcher2SynchronousProxy> for zx::Handle {
19926 fn from(value: UsageWatcher2SynchronousProxy) -> Self {
19927 value.into_channel().into()
19928 }
19929}
19930
19931#[cfg(target_os = "fuchsia")]
19932impl From<fidl::Channel> for UsageWatcher2SynchronousProxy {
19933 fn from(value: fidl::Channel) -> Self {
19934 Self::new(value)
19935 }
19936}
19937
19938#[derive(Debug, Clone)]
19939pub struct UsageWatcher2Proxy {
19940 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
19941}
19942
19943impl fidl::endpoints::Proxy for UsageWatcher2Proxy {
19944 type Protocol = UsageWatcher2Marker;
19945
19946 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
19947 Self::new(inner)
19948 }
19949
19950 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
19951 self.client.into_channel().map_err(|client| Self { client })
19952 }
19953
19954 fn as_channel(&self) -> &::fidl::AsyncChannel {
19955 self.client.as_channel()
19956 }
19957}
19958
19959impl UsageWatcher2Proxy {
19960 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
19962 let protocol_name = <UsageWatcher2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
19963 Self { client: fidl::client::Client::new(channel, protocol_name) }
19964 }
19965
19966 pub fn take_event_stream(&self) -> UsageWatcher2EventStream {
19972 UsageWatcher2EventStream { event_receiver: self.client.take_event_receiver() }
19973 }
19974
19975 pub fn r#on_state_changed(
19982 &self,
19983 mut usage: &Usage2,
19984 mut state: &UsageState,
19985 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
19986 UsageWatcher2ProxyInterface::r#on_state_changed(self, usage, state)
19987 }
19988}
19989
19990impl UsageWatcher2ProxyInterface for UsageWatcher2Proxy {
19991 type OnStateChangedResponseFut =
19992 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
19993 fn r#on_state_changed(
19994 &self,
19995 mut usage: &Usage2,
19996 mut state: &UsageState,
19997 ) -> Self::OnStateChangedResponseFut {
19998 fn _decode(
19999 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
20000 ) -> Result<(), fidl::Error> {
20001 let _response = fidl::client::decode_transaction_body::<
20002 fidl::encoding::EmptyPayload,
20003 fidl::encoding::DefaultFuchsiaResourceDialect,
20004 0xca31a8b13c324d4,
20005 >(_buf?)?;
20006 Ok(_response)
20007 }
20008 self.client.send_query_and_decode::<UsageWatcher2OnStateChangedRequest, ()>(
20009 (usage, state),
20010 0xca31a8b13c324d4,
20011 fidl::encoding::DynamicFlags::empty(),
20012 _decode,
20013 )
20014 }
20015}
20016
20017pub struct UsageWatcher2EventStream {
20018 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
20019}
20020
20021impl std::marker::Unpin for UsageWatcher2EventStream {}
20022
20023impl futures::stream::FusedStream for UsageWatcher2EventStream {
20024 fn is_terminated(&self) -> bool {
20025 self.event_receiver.is_terminated()
20026 }
20027}
20028
20029impl futures::Stream for UsageWatcher2EventStream {
20030 type Item = Result<UsageWatcher2Event, fidl::Error>;
20031
20032 fn poll_next(
20033 mut self: std::pin::Pin<&mut Self>,
20034 cx: &mut std::task::Context<'_>,
20035 ) -> std::task::Poll<Option<Self::Item>> {
20036 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
20037 &mut self.event_receiver,
20038 cx
20039 )?) {
20040 Some(buf) => std::task::Poll::Ready(Some(UsageWatcher2Event::decode(buf))),
20041 None => std::task::Poll::Ready(None),
20042 }
20043 }
20044}
20045
20046#[derive(Debug)]
20047pub enum UsageWatcher2Event {}
20048
20049impl UsageWatcher2Event {
20050 fn decode(
20052 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
20053 ) -> Result<UsageWatcher2Event, fidl::Error> {
20054 let (bytes, _handles) = buf.split_mut();
20055 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
20056 debug_assert_eq!(tx_header.tx_id, 0);
20057 match tx_header.ordinal {
20058 _ => Err(fidl::Error::UnknownOrdinal {
20059 ordinal: tx_header.ordinal,
20060 protocol_name: <UsageWatcher2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
20061 }),
20062 }
20063 }
20064}
20065
20066pub struct UsageWatcher2RequestStream {
20068 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
20069 is_terminated: bool,
20070}
20071
20072impl std::marker::Unpin for UsageWatcher2RequestStream {}
20073
20074impl futures::stream::FusedStream for UsageWatcher2RequestStream {
20075 fn is_terminated(&self) -> bool {
20076 self.is_terminated
20077 }
20078}
20079
20080impl fidl::endpoints::RequestStream for UsageWatcher2RequestStream {
20081 type Protocol = UsageWatcher2Marker;
20082 type ControlHandle = UsageWatcher2ControlHandle;
20083
20084 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
20085 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
20086 }
20087
20088 fn control_handle(&self) -> Self::ControlHandle {
20089 UsageWatcher2ControlHandle { inner: self.inner.clone() }
20090 }
20091
20092 fn into_inner(
20093 self,
20094 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
20095 {
20096 (self.inner, self.is_terminated)
20097 }
20098
20099 fn from_inner(
20100 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
20101 is_terminated: bool,
20102 ) -> Self {
20103 Self { inner, is_terminated }
20104 }
20105}
20106
20107impl futures::Stream for UsageWatcher2RequestStream {
20108 type Item = Result<UsageWatcher2Request, fidl::Error>;
20109
20110 fn poll_next(
20111 mut self: std::pin::Pin<&mut Self>,
20112 cx: &mut std::task::Context<'_>,
20113 ) -> std::task::Poll<Option<Self::Item>> {
20114 let this = &mut *self;
20115 if this.inner.check_shutdown(cx) {
20116 this.is_terminated = true;
20117 return std::task::Poll::Ready(None);
20118 }
20119 if this.is_terminated {
20120 panic!("polled UsageWatcher2RequestStream after completion");
20121 }
20122 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
20123 |bytes, handles| {
20124 match this.inner.channel().read_etc(cx, bytes, handles) {
20125 std::task::Poll::Ready(Ok(())) => {}
20126 std::task::Poll::Pending => return std::task::Poll::Pending,
20127 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
20128 this.is_terminated = true;
20129 return std::task::Poll::Ready(None);
20130 }
20131 std::task::Poll::Ready(Err(e)) => {
20132 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
20133 e.into(),
20134 ))))
20135 }
20136 }
20137
20138 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
20140
20141 std::task::Poll::Ready(Some(match header.ordinal {
20142 0xca31a8b13c324d4 => {
20143 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
20144 let mut req = fidl::new_empty!(
20145 UsageWatcher2OnStateChangedRequest,
20146 fidl::encoding::DefaultFuchsiaResourceDialect
20147 );
20148 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsageWatcher2OnStateChangedRequest>(&header, _body_bytes, handles, &mut req)?;
20149 let control_handle =
20150 UsageWatcher2ControlHandle { inner: this.inner.clone() };
20151 Ok(UsageWatcher2Request::OnStateChanged {
20152 usage: req.usage,
20153 state: req.state,
20154
20155 responder: UsageWatcher2OnStateChangedResponder {
20156 control_handle: std::mem::ManuallyDrop::new(control_handle),
20157 tx_id: header.tx_id,
20158 },
20159 })
20160 }
20161 _ => Err(fidl::Error::UnknownOrdinal {
20162 ordinal: header.ordinal,
20163 protocol_name:
20164 <UsageWatcher2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
20165 }),
20166 }))
20167 },
20168 )
20169 }
20170}
20171
20172#[derive(Debug)]
20173pub enum UsageWatcher2Request {
20174 OnStateChanged {
20181 usage: Usage2,
20182 state: UsageState,
20183 responder: UsageWatcher2OnStateChangedResponder,
20184 },
20185}
20186
20187impl UsageWatcher2Request {
20188 #[allow(irrefutable_let_patterns)]
20189 pub fn into_on_state_changed(
20190 self,
20191 ) -> Option<(Usage2, UsageState, UsageWatcher2OnStateChangedResponder)> {
20192 if let UsageWatcher2Request::OnStateChanged { usage, state, responder } = self {
20193 Some((usage, state, responder))
20194 } else {
20195 None
20196 }
20197 }
20198
20199 pub fn method_name(&self) -> &'static str {
20201 match *self {
20202 UsageWatcher2Request::OnStateChanged { .. } => "on_state_changed",
20203 }
20204 }
20205}
20206
20207#[derive(Debug, Clone)]
20208pub struct UsageWatcher2ControlHandle {
20209 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
20210}
20211
20212impl fidl::endpoints::ControlHandle for UsageWatcher2ControlHandle {
20213 fn shutdown(&self) {
20214 self.inner.shutdown()
20215 }
20216 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
20217 self.inner.shutdown_with_epitaph(status)
20218 }
20219
20220 fn is_closed(&self) -> bool {
20221 self.inner.channel().is_closed()
20222 }
20223 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
20224 self.inner.channel().on_closed()
20225 }
20226
20227 #[cfg(target_os = "fuchsia")]
20228 fn signal_peer(
20229 &self,
20230 clear_mask: zx::Signals,
20231 set_mask: zx::Signals,
20232 ) -> Result<(), zx_status::Status> {
20233 use fidl::Peered;
20234 self.inner.channel().signal_peer(clear_mask, set_mask)
20235 }
20236}
20237
20238impl UsageWatcher2ControlHandle {}
20239
20240#[must_use = "FIDL methods require a response to be sent"]
20241#[derive(Debug)]
20242pub struct UsageWatcher2OnStateChangedResponder {
20243 control_handle: std::mem::ManuallyDrop<UsageWatcher2ControlHandle>,
20244 tx_id: u32,
20245}
20246
20247impl std::ops::Drop for UsageWatcher2OnStateChangedResponder {
20251 fn drop(&mut self) {
20252 self.control_handle.shutdown();
20253 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
20255 }
20256}
20257
20258impl fidl::endpoints::Responder for UsageWatcher2OnStateChangedResponder {
20259 type ControlHandle = UsageWatcher2ControlHandle;
20260
20261 fn control_handle(&self) -> &UsageWatcher2ControlHandle {
20262 &self.control_handle
20263 }
20264
20265 fn drop_without_shutdown(mut self) {
20266 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
20268 std::mem::forget(self);
20270 }
20271}
20272
20273impl UsageWatcher2OnStateChangedResponder {
20274 pub fn send(self) -> Result<(), fidl::Error> {
20278 let _result = self.send_raw();
20279 if _result.is_err() {
20280 self.control_handle.shutdown();
20281 }
20282 self.drop_without_shutdown();
20283 _result
20284 }
20285
20286 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
20288 let _result = self.send_raw();
20289 self.drop_without_shutdown();
20290 _result
20291 }
20292
20293 fn send_raw(&self) -> Result<(), fidl::Error> {
20294 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
20295 (),
20296 self.tx_id,
20297 0xca31a8b13c324d4,
20298 fidl::encoding::DynamicFlags::empty(),
20299 )
20300 }
20301}
20302
20303mod internal {
20304 use super::*;
20305
20306 impl fidl::encoding::ResourceTypeMarker for AudioCapturerBindGainControlRequest {
20307 type Borrowed<'a> = &'a mut Self;
20308 fn take_or_borrow<'a>(
20309 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
20310 ) -> Self::Borrowed<'a> {
20311 value
20312 }
20313 }
20314
20315 unsafe impl fidl::encoding::TypeMarker for AudioCapturerBindGainControlRequest {
20316 type Owned = Self;
20317
20318 #[inline(always)]
20319 fn inline_align(_context: fidl::encoding::Context) -> usize {
20320 4
20321 }
20322
20323 #[inline(always)]
20324 fn inline_size(_context: fidl::encoding::Context) -> usize {
20325 4
20326 }
20327 }
20328
20329 unsafe impl
20330 fidl::encoding::Encode<
20331 AudioCapturerBindGainControlRequest,
20332 fidl::encoding::DefaultFuchsiaResourceDialect,
20333 > for &mut AudioCapturerBindGainControlRequest
20334 {
20335 #[inline]
20336 unsafe fn encode(
20337 self,
20338 encoder: &mut fidl::encoding::Encoder<
20339 '_,
20340 fidl::encoding::DefaultFuchsiaResourceDialect,
20341 >,
20342 offset: usize,
20343 _depth: fidl::encoding::Depth,
20344 ) -> fidl::Result<()> {
20345 encoder.debug_check_bounds::<AudioCapturerBindGainControlRequest>(offset);
20346 fidl::encoding::Encode::<
20348 AudioCapturerBindGainControlRequest,
20349 fidl::encoding::DefaultFuchsiaResourceDialect,
20350 >::encode(
20351 (<fidl::encoding::Endpoint<
20352 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
20353 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
20354 &mut self.gain_control_request,
20355 ),),
20356 encoder,
20357 offset,
20358 _depth,
20359 )
20360 }
20361 }
20362 unsafe impl<
20363 T0: fidl::encoding::Encode<
20364 fidl::encoding::Endpoint<
20365 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
20366 >,
20367 fidl::encoding::DefaultFuchsiaResourceDialect,
20368 >,
20369 >
20370 fidl::encoding::Encode<
20371 AudioCapturerBindGainControlRequest,
20372 fidl::encoding::DefaultFuchsiaResourceDialect,
20373 > for (T0,)
20374 {
20375 #[inline]
20376 unsafe fn encode(
20377 self,
20378 encoder: &mut fidl::encoding::Encoder<
20379 '_,
20380 fidl::encoding::DefaultFuchsiaResourceDialect,
20381 >,
20382 offset: usize,
20383 depth: fidl::encoding::Depth,
20384 ) -> fidl::Result<()> {
20385 encoder.debug_check_bounds::<AudioCapturerBindGainControlRequest>(offset);
20386 self.0.encode(encoder, offset + 0, depth)?;
20390 Ok(())
20391 }
20392 }
20393
20394 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
20395 for AudioCapturerBindGainControlRequest
20396 {
20397 #[inline(always)]
20398 fn new_empty() -> Self {
20399 Self {
20400 gain_control_request: fidl::new_empty!(
20401 fidl::encoding::Endpoint<
20402 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
20403 >,
20404 fidl::encoding::DefaultFuchsiaResourceDialect
20405 ),
20406 }
20407 }
20408
20409 #[inline]
20410 unsafe fn decode(
20411 &mut self,
20412 decoder: &mut fidl::encoding::Decoder<
20413 '_,
20414 fidl::encoding::DefaultFuchsiaResourceDialect,
20415 >,
20416 offset: usize,
20417 _depth: fidl::encoding::Depth,
20418 ) -> fidl::Result<()> {
20419 decoder.debug_check_bounds::<Self>(offset);
20420 fidl::decode!(
20422 fidl::encoding::Endpoint<
20423 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
20424 >,
20425 fidl::encoding::DefaultFuchsiaResourceDialect,
20426 &mut self.gain_control_request,
20427 decoder,
20428 offset + 0,
20429 _depth
20430 )?;
20431 Ok(())
20432 }
20433 }
20434
20435 impl fidl::encoding::ResourceTypeMarker for AudioCapturerGetReferenceClockResponse {
20436 type Borrowed<'a> = &'a mut Self;
20437 fn take_or_borrow<'a>(
20438 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
20439 ) -> Self::Borrowed<'a> {
20440 value
20441 }
20442 }
20443
20444 unsafe impl fidl::encoding::TypeMarker for AudioCapturerGetReferenceClockResponse {
20445 type Owned = Self;
20446
20447 #[inline(always)]
20448 fn inline_align(_context: fidl::encoding::Context) -> usize {
20449 4
20450 }
20451
20452 #[inline(always)]
20453 fn inline_size(_context: fidl::encoding::Context) -> usize {
20454 4
20455 }
20456 }
20457
20458 unsafe impl
20459 fidl::encoding::Encode<
20460 AudioCapturerGetReferenceClockResponse,
20461 fidl::encoding::DefaultFuchsiaResourceDialect,
20462 > for &mut AudioCapturerGetReferenceClockResponse
20463 {
20464 #[inline]
20465 unsafe fn encode(
20466 self,
20467 encoder: &mut fidl::encoding::Encoder<
20468 '_,
20469 fidl::encoding::DefaultFuchsiaResourceDialect,
20470 >,
20471 offset: usize,
20472 _depth: fidl::encoding::Depth,
20473 ) -> fidl::Result<()> {
20474 encoder.debug_check_bounds::<AudioCapturerGetReferenceClockResponse>(offset);
20475 fidl::encoding::Encode::<
20477 AudioCapturerGetReferenceClockResponse,
20478 fidl::encoding::DefaultFuchsiaResourceDialect,
20479 >::encode(
20480 (<fidl::encoding::HandleType<
20481 fidl::Clock,
20482 { fidl::ObjectType::CLOCK.into_raw() },
20483 2147483648,
20484 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
20485 &mut self.reference_clock,
20486 ),),
20487 encoder,
20488 offset,
20489 _depth,
20490 )
20491 }
20492 }
20493 unsafe impl<
20494 T0: fidl::encoding::Encode<
20495 fidl::encoding::HandleType<
20496 fidl::Clock,
20497 { fidl::ObjectType::CLOCK.into_raw() },
20498 2147483648,
20499 >,
20500 fidl::encoding::DefaultFuchsiaResourceDialect,
20501 >,
20502 >
20503 fidl::encoding::Encode<
20504 AudioCapturerGetReferenceClockResponse,
20505 fidl::encoding::DefaultFuchsiaResourceDialect,
20506 > for (T0,)
20507 {
20508 #[inline]
20509 unsafe fn encode(
20510 self,
20511 encoder: &mut fidl::encoding::Encoder<
20512 '_,
20513 fidl::encoding::DefaultFuchsiaResourceDialect,
20514 >,
20515 offset: usize,
20516 depth: fidl::encoding::Depth,
20517 ) -> fidl::Result<()> {
20518 encoder.debug_check_bounds::<AudioCapturerGetReferenceClockResponse>(offset);
20519 self.0.encode(encoder, offset + 0, depth)?;
20523 Ok(())
20524 }
20525 }
20526
20527 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
20528 for AudioCapturerGetReferenceClockResponse
20529 {
20530 #[inline(always)]
20531 fn new_empty() -> Self {
20532 Self {
20533 reference_clock: fidl::new_empty!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20534 }
20535 }
20536
20537 #[inline]
20538 unsafe fn decode(
20539 &mut self,
20540 decoder: &mut fidl::encoding::Decoder<
20541 '_,
20542 fidl::encoding::DefaultFuchsiaResourceDialect,
20543 >,
20544 offset: usize,
20545 _depth: fidl::encoding::Depth,
20546 ) -> fidl::Result<()> {
20547 decoder.debug_check_bounds::<Self>(offset);
20548 fidl::decode!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reference_clock, decoder, offset + 0, _depth)?;
20550 Ok(())
20551 }
20552 }
20553
20554 impl fidl::encoding::ResourceTypeMarker for AudioCapturerSetReferenceClockRequest {
20555 type Borrowed<'a> = &'a mut Self;
20556 fn take_or_borrow<'a>(
20557 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
20558 ) -> Self::Borrowed<'a> {
20559 value
20560 }
20561 }
20562
20563 unsafe impl fidl::encoding::TypeMarker for AudioCapturerSetReferenceClockRequest {
20564 type Owned = Self;
20565
20566 #[inline(always)]
20567 fn inline_align(_context: fidl::encoding::Context) -> usize {
20568 4
20569 }
20570
20571 #[inline(always)]
20572 fn inline_size(_context: fidl::encoding::Context) -> usize {
20573 4
20574 }
20575 }
20576
20577 unsafe impl
20578 fidl::encoding::Encode<
20579 AudioCapturerSetReferenceClockRequest,
20580 fidl::encoding::DefaultFuchsiaResourceDialect,
20581 > for &mut AudioCapturerSetReferenceClockRequest
20582 {
20583 #[inline]
20584 unsafe fn encode(
20585 self,
20586 encoder: &mut fidl::encoding::Encoder<
20587 '_,
20588 fidl::encoding::DefaultFuchsiaResourceDialect,
20589 >,
20590 offset: usize,
20591 _depth: fidl::encoding::Depth,
20592 ) -> fidl::Result<()> {
20593 encoder.debug_check_bounds::<AudioCapturerSetReferenceClockRequest>(offset);
20594 fidl::encoding::Encode::<
20596 AudioCapturerSetReferenceClockRequest,
20597 fidl::encoding::DefaultFuchsiaResourceDialect,
20598 >::encode(
20599 (<fidl::encoding::Optional<
20600 fidl::encoding::HandleType<
20601 fidl::Clock,
20602 { fidl::ObjectType::CLOCK.into_raw() },
20603 2147483648,
20604 >,
20605 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
20606 &mut self.reference_clock,
20607 ),),
20608 encoder,
20609 offset,
20610 _depth,
20611 )
20612 }
20613 }
20614 unsafe impl<
20615 T0: fidl::encoding::Encode<
20616 fidl::encoding::Optional<
20617 fidl::encoding::HandleType<
20618 fidl::Clock,
20619 { fidl::ObjectType::CLOCK.into_raw() },
20620 2147483648,
20621 >,
20622 >,
20623 fidl::encoding::DefaultFuchsiaResourceDialect,
20624 >,
20625 >
20626 fidl::encoding::Encode<
20627 AudioCapturerSetReferenceClockRequest,
20628 fidl::encoding::DefaultFuchsiaResourceDialect,
20629 > for (T0,)
20630 {
20631 #[inline]
20632 unsafe fn encode(
20633 self,
20634 encoder: &mut fidl::encoding::Encoder<
20635 '_,
20636 fidl::encoding::DefaultFuchsiaResourceDialect,
20637 >,
20638 offset: usize,
20639 depth: fidl::encoding::Depth,
20640 ) -> fidl::Result<()> {
20641 encoder.debug_check_bounds::<AudioCapturerSetReferenceClockRequest>(offset);
20642 self.0.encode(encoder, offset + 0, depth)?;
20646 Ok(())
20647 }
20648 }
20649
20650 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
20651 for AudioCapturerSetReferenceClockRequest
20652 {
20653 #[inline(always)]
20654 fn new_empty() -> Self {
20655 Self {
20656 reference_clock: fidl::new_empty!(
20657 fidl::encoding::Optional<
20658 fidl::encoding::HandleType<
20659 fidl::Clock,
20660 { fidl::ObjectType::CLOCK.into_raw() },
20661 2147483648,
20662 >,
20663 >,
20664 fidl::encoding::DefaultFuchsiaResourceDialect
20665 ),
20666 }
20667 }
20668
20669 #[inline]
20670 unsafe fn decode(
20671 &mut self,
20672 decoder: &mut fidl::encoding::Decoder<
20673 '_,
20674 fidl::encoding::DefaultFuchsiaResourceDialect,
20675 >,
20676 offset: usize,
20677 _depth: fidl::encoding::Depth,
20678 ) -> fidl::Result<()> {
20679 decoder.debug_check_bounds::<Self>(offset);
20680 fidl::decode!(
20682 fidl::encoding::Optional<
20683 fidl::encoding::HandleType<
20684 fidl::Clock,
20685 { fidl::ObjectType::CLOCK.into_raw() },
20686 2147483648,
20687 >,
20688 >,
20689 fidl::encoding::DefaultFuchsiaResourceDialect,
20690 &mut self.reference_clock,
20691 decoder,
20692 offset + 0,
20693 _depth
20694 )?;
20695 Ok(())
20696 }
20697 }
20698
20699 impl fidl::encoding::ResourceTypeMarker for AudioConsumerBindVolumeControlRequest {
20700 type Borrowed<'a> = &'a mut Self;
20701 fn take_or_borrow<'a>(
20702 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
20703 ) -> Self::Borrowed<'a> {
20704 value
20705 }
20706 }
20707
20708 unsafe impl fidl::encoding::TypeMarker for AudioConsumerBindVolumeControlRequest {
20709 type Owned = Self;
20710
20711 #[inline(always)]
20712 fn inline_align(_context: fidl::encoding::Context) -> usize {
20713 4
20714 }
20715
20716 #[inline(always)]
20717 fn inline_size(_context: fidl::encoding::Context) -> usize {
20718 4
20719 }
20720 }
20721
20722 unsafe impl
20723 fidl::encoding::Encode<
20724 AudioConsumerBindVolumeControlRequest,
20725 fidl::encoding::DefaultFuchsiaResourceDialect,
20726 > for &mut AudioConsumerBindVolumeControlRequest
20727 {
20728 #[inline]
20729 unsafe fn encode(
20730 self,
20731 encoder: &mut fidl::encoding::Encoder<
20732 '_,
20733 fidl::encoding::DefaultFuchsiaResourceDialect,
20734 >,
20735 offset: usize,
20736 _depth: fidl::encoding::Depth,
20737 ) -> fidl::Result<()> {
20738 encoder.debug_check_bounds::<AudioConsumerBindVolumeControlRequest>(offset);
20739 fidl::encoding::Encode::<
20741 AudioConsumerBindVolumeControlRequest,
20742 fidl::encoding::DefaultFuchsiaResourceDialect,
20743 >::encode(
20744 (<fidl::encoding::Endpoint<
20745 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
20746 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
20747 &mut self.volume_control_request,
20748 ),),
20749 encoder,
20750 offset,
20751 _depth,
20752 )
20753 }
20754 }
20755 unsafe impl<
20756 T0: fidl::encoding::Encode<
20757 fidl::encoding::Endpoint<
20758 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
20759 >,
20760 fidl::encoding::DefaultFuchsiaResourceDialect,
20761 >,
20762 >
20763 fidl::encoding::Encode<
20764 AudioConsumerBindVolumeControlRequest,
20765 fidl::encoding::DefaultFuchsiaResourceDialect,
20766 > for (T0,)
20767 {
20768 #[inline]
20769 unsafe fn encode(
20770 self,
20771 encoder: &mut fidl::encoding::Encoder<
20772 '_,
20773 fidl::encoding::DefaultFuchsiaResourceDialect,
20774 >,
20775 offset: usize,
20776 depth: fidl::encoding::Depth,
20777 ) -> fidl::Result<()> {
20778 encoder.debug_check_bounds::<AudioConsumerBindVolumeControlRequest>(offset);
20779 self.0.encode(encoder, offset + 0, depth)?;
20783 Ok(())
20784 }
20785 }
20786
20787 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
20788 for AudioConsumerBindVolumeControlRequest
20789 {
20790 #[inline(always)]
20791 fn new_empty() -> Self {
20792 Self {
20793 volume_control_request: fidl::new_empty!(
20794 fidl::encoding::Endpoint<
20795 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
20796 >,
20797 fidl::encoding::DefaultFuchsiaResourceDialect
20798 ),
20799 }
20800 }
20801
20802 #[inline]
20803 unsafe fn decode(
20804 &mut self,
20805 decoder: &mut fidl::encoding::Decoder<
20806 '_,
20807 fidl::encoding::DefaultFuchsiaResourceDialect,
20808 >,
20809 offset: usize,
20810 _depth: fidl::encoding::Depth,
20811 ) -> fidl::Result<()> {
20812 decoder.debug_check_bounds::<Self>(offset);
20813 fidl::decode!(
20815 fidl::encoding::Endpoint<
20816 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
20817 >,
20818 fidl::encoding::DefaultFuchsiaResourceDialect,
20819 &mut self.volume_control_request,
20820 decoder,
20821 offset + 0,
20822 _depth
20823 )?;
20824 Ok(())
20825 }
20826 }
20827
20828 impl fidl::encoding::ResourceTypeMarker for AudioConsumerCreateStreamSinkRequest {
20829 type Borrowed<'a> = &'a mut Self;
20830 fn take_or_borrow<'a>(
20831 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
20832 ) -> Self::Borrowed<'a> {
20833 value
20834 }
20835 }
20836
20837 unsafe impl fidl::encoding::TypeMarker for AudioConsumerCreateStreamSinkRequest {
20838 type Owned = Self;
20839
20840 #[inline(always)]
20841 fn inline_align(_context: fidl::encoding::Context) -> usize {
20842 8
20843 }
20844
20845 #[inline(always)]
20846 fn inline_size(_context: fidl::encoding::Context) -> usize {
20847 48
20848 }
20849 }
20850
20851 unsafe impl
20852 fidl::encoding::Encode<
20853 AudioConsumerCreateStreamSinkRequest,
20854 fidl::encoding::DefaultFuchsiaResourceDialect,
20855 > for &mut AudioConsumerCreateStreamSinkRequest
20856 {
20857 #[inline]
20858 unsafe fn encode(
20859 self,
20860 encoder: &mut fidl::encoding::Encoder<
20861 '_,
20862 fidl::encoding::DefaultFuchsiaResourceDialect,
20863 >,
20864 offset: usize,
20865 _depth: fidl::encoding::Depth,
20866 ) -> fidl::Result<()> {
20867 encoder.debug_check_bounds::<AudioConsumerCreateStreamSinkRequest>(offset);
20868 fidl::encoding::Encode::<AudioConsumerCreateStreamSinkRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
20870 (
20871 <fidl::encoding::Vector<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, 16> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffers),
20872 <AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_type),
20873 <fidl::encoding::Boxed<Compression> as fidl::encoding::ValueTypeMarker>::borrow(&self.compression),
20874 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stream_sink_request),
20875 ),
20876 encoder, offset, _depth
20877 )
20878 }
20879 }
20880 unsafe impl<
20881 T0: fidl::encoding::Encode<
20882 fidl::encoding::Vector<
20883 fidl::encoding::HandleType<
20884 fidl::Vmo,
20885 { fidl::ObjectType::VMO.into_raw() },
20886 2147483648,
20887 >,
20888 16,
20889 >,
20890 fidl::encoding::DefaultFuchsiaResourceDialect,
20891 >,
20892 T1: fidl::encoding::Encode<AudioStreamType, fidl::encoding::DefaultFuchsiaResourceDialect>,
20893 T2: fidl::encoding::Encode<
20894 fidl::encoding::Boxed<Compression>,
20895 fidl::encoding::DefaultFuchsiaResourceDialect,
20896 >,
20897 T3: fidl::encoding::Encode<
20898 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSinkMarker>>,
20899 fidl::encoding::DefaultFuchsiaResourceDialect,
20900 >,
20901 >
20902 fidl::encoding::Encode<
20903 AudioConsumerCreateStreamSinkRequest,
20904 fidl::encoding::DefaultFuchsiaResourceDialect,
20905 > for (T0, T1, T2, T3)
20906 {
20907 #[inline]
20908 unsafe fn encode(
20909 self,
20910 encoder: &mut fidl::encoding::Encoder<
20911 '_,
20912 fidl::encoding::DefaultFuchsiaResourceDialect,
20913 >,
20914 offset: usize,
20915 depth: fidl::encoding::Depth,
20916 ) -> fidl::Result<()> {
20917 encoder.debug_check_bounds::<AudioConsumerCreateStreamSinkRequest>(offset);
20918 unsafe {
20921 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
20922 (ptr as *mut u64).write_unaligned(0);
20923 }
20924 unsafe {
20925 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
20926 (ptr as *mut u64).write_unaligned(0);
20927 }
20928 self.0.encode(encoder, offset + 0, depth)?;
20930 self.1.encode(encoder, offset + 16, depth)?;
20931 self.2.encode(encoder, offset + 32, depth)?;
20932 self.3.encode(encoder, offset + 40, depth)?;
20933 Ok(())
20934 }
20935 }
20936
20937 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
20938 for AudioConsumerCreateStreamSinkRequest
20939 {
20940 #[inline(always)]
20941 fn new_empty() -> Self {
20942 Self {
20943 buffers: fidl::new_empty!(
20944 fidl::encoding::Vector<
20945 fidl::encoding::HandleType<
20946 fidl::Vmo,
20947 { fidl::ObjectType::VMO.into_raw() },
20948 2147483648,
20949 >,
20950 16,
20951 >,
20952 fidl::encoding::DefaultFuchsiaResourceDialect
20953 ),
20954 stream_type: fidl::new_empty!(
20955 AudioStreamType,
20956 fidl::encoding::DefaultFuchsiaResourceDialect
20957 ),
20958 compression: fidl::new_empty!(
20959 fidl::encoding::Boxed<Compression>,
20960 fidl::encoding::DefaultFuchsiaResourceDialect
20961 ),
20962 stream_sink_request: fidl::new_empty!(
20963 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSinkMarker>>,
20964 fidl::encoding::DefaultFuchsiaResourceDialect
20965 ),
20966 }
20967 }
20968
20969 #[inline]
20970 unsafe fn decode(
20971 &mut self,
20972 decoder: &mut fidl::encoding::Decoder<
20973 '_,
20974 fidl::encoding::DefaultFuchsiaResourceDialect,
20975 >,
20976 offset: usize,
20977 _depth: fidl::encoding::Depth,
20978 ) -> fidl::Result<()> {
20979 decoder.debug_check_bounds::<Self>(offset);
20980 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
20982 let padval = unsafe { (ptr as *const u64).read_unaligned() };
20983 let mask = 0xffffffff00000000u64;
20984 let maskedval = padval & mask;
20985 if maskedval != 0 {
20986 return Err(fidl::Error::NonZeroPadding {
20987 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
20988 });
20989 }
20990 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
20991 let padval = unsafe { (ptr as *const u64).read_unaligned() };
20992 let mask = 0xffffffff00000000u64;
20993 let maskedval = padval & mask;
20994 if maskedval != 0 {
20995 return Err(fidl::Error::NonZeroPadding {
20996 padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
20997 });
20998 }
20999 fidl::decode!(
21000 fidl::encoding::Vector<
21001 fidl::encoding::HandleType<
21002 fidl::Vmo,
21003 { fidl::ObjectType::VMO.into_raw() },
21004 2147483648,
21005 >,
21006 16,
21007 >,
21008 fidl::encoding::DefaultFuchsiaResourceDialect,
21009 &mut self.buffers,
21010 decoder,
21011 offset + 0,
21012 _depth
21013 )?;
21014 fidl::decode!(
21015 AudioStreamType,
21016 fidl::encoding::DefaultFuchsiaResourceDialect,
21017 &mut self.stream_type,
21018 decoder,
21019 offset + 16,
21020 _depth
21021 )?;
21022 fidl::decode!(
21023 fidl::encoding::Boxed<Compression>,
21024 fidl::encoding::DefaultFuchsiaResourceDialect,
21025 &mut self.compression,
21026 decoder,
21027 offset + 32,
21028 _depth
21029 )?;
21030 fidl::decode!(
21031 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSinkMarker>>,
21032 fidl::encoding::DefaultFuchsiaResourceDialect,
21033 &mut self.stream_sink_request,
21034 decoder,
21035 offset + 40,
21036 _depth
21037 )?;
21038 Ok(())
21039 }
21040 }
21041
21042 impl fidl::encoding::ResourceTypeMarker for AudioCoreBindUsageVolumeControl2Request {
21043 type Borrowed<'a> = &'a mut Self;
21044 fn take_or_borrow<'a>(
21045 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
21046 ) -> Self::Borrowed<'a> {
21047 value
21048 }
21049 }
21050
21051 unsafe impl fidl::encoding::TypeMarker for AudioCoreBindUsageVolumeControl2Request {
21052 type Owned = Self;
21053
21054 #[inline(always)]
21055 fn inline_align(_context: fidl::encoding::Context) -> usize {
21056 8
21057 }
21058
21059 #[inline(always)]
21060 fn inline_size(_context: fidl::encoding::Context) -> usize {
21061 24
21062 }
21063 }
21064
21065 unsafe impl
21066 fidl::encoding::Encode<
21067 AudioCoreBindUsageVolumeControl2Request,
21068 fidl::encoding::DefaultFuchsiaResourceDialect,
21069 > for &mut AudioCoreBindUsageVolumeControl2Request
21070 {
21071 #[inline]
21072 unsafe fn encode(
21073 self,
21074 encoder: &mut fidl::encoding::Encoder<
21075 '_,
21076 fidl::encoding::DefaultFuchsiaResourceDialect,
21077 >,
21078 offset: usize,
21079 _depth: fidl::encoding::Depth,
21080 ) -> fidl::Result<()> {
21081 encoder.debug_check_bounds::<AudioCoreBindUsageVolumeControl2Request>(offset);
21082 fidl::encoding::Encode::<
21084 AudioCoreBindUsageVolumeControl2Request,
21085 fidl::encoding::DefaultFuchsiaResourceDialect,
21086 >::encode(
21087 (
21088 <Usage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
21089 <fidl::encoding::Endpoint<
21090 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
21091 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
21092 &mut self.volume_control,
21093 ),
21094 ),
21095 encoder,
21096 offset,
21097 _depth,
21098 )
21099 }
21100 }
21101 unsafe impl<
21102 T0: fidl::encoding::Encode<Usage2, fidl::encoding::DefaultFuchsiaResourceDialect>,
21103 T1: fidl::encoding::Encode<
21104 fidl::encoding::Endpoint<
21105 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
21106 >,
21107 fidl::encoding::DefaultFuchsiaResourceDialect,
21108 >,
21109 >
21110 fidl::encoding::Encode<
21111 AudioCoreBindUsageVolumeControl2Request,
21112 fidl::encoding::DefaultFuchsiaResourceDialect,
21113 > for (T0, T1)
21114 {
21115 #[inline]
21116 unsafe fn encode(
21117 self,
21118 encoder: &mut fidl::encoding::Encoder<
21119 '_,
21120 fidl::encoding::DefaultFuchsiaResourceDialect,
21121 >,
21122 offset: usize,
21123 depth: fidl::encoding::Depth,
21124 ) -> fidl::Result<()> {
21125 encoder.debug_check_bounds::<AudioCoreBindUsageVolumeControl2Request>(offset);
21126 unsafe {
21129 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
21130 (ptr as *mut u64).write_unaligned(0);
21131 }
21132 self.0.encode(encoder, offset + 0, depth)?;
21134 self.1.encode(encoder, offset + 16, depth)?;
21135 Ok(())
21136 }
21137 }
21138
21139 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
21140 for AudioCoreBindUsageVolumeControl2Request
21141 {
21142 #[inline(always)]
21143 fn new_empty() -> Self {
21144 Self {
21145 usage: fidl::new_empty!(Usage2, fidl::encoding::DefaultFuchsiaResourceDialect),
21146 volume_control: fidl::new_empty!(
21147 fidl::encoding::Endpoint<
21148 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
21149 >,
21150 fidl::encoding::DefaultFuchsiaResourceDialect
21151 ),
21152 }
21153 }
21154
21155 #[inline]
21156 unsafe fn decode(
21157 &mut self,
21158 decoder: &mut fidl::encoding::Decoder<
21159 '_,
21160 fidl::encoding::DefaultFuchsiaResourceDialect,
21161 >,
21162 offset: usize,
21163 _depth: fidl::encoding::Depth,
21164 ) -> fidl::Result<()> {
21165 decoder.debug_check_bounds::<Self>(offset);
21166 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
21168 let padval = unsafe { (ptr as *const u64).read_unaligned() };
21169 let mask = 0xffffffff00000000u64;
21170 let maskedval = padval & mask;
21171 if maskedval != 0 {
21172 return Err(fidl::Error::NonZeroPadding {
21173 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
21174 });
21175 }
21176 fidl::decode!(
21177 Usage2,
21178 fidl::encoding::DefaultFuchsiaResourceDialect,
21179 &mut self.usage,
21180 decoder,
21181 offset + 0,
21182 _depth
21183 )?;
21184 fidl::decode!(
21185 fidl::encoding::Endpoint<
21186 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
21187 >,
21188 fidl::encoding::DefaultFuchsiaResourceDialect,
21189 &mut self.volume_control,
21190 decoder,
21191 offset + 16,
21192 _depth
21193 )?;
21194 Ok(())
21195 }
21196 }
21197
21198 impl fidl::encoding::ResourceTypeMarker for AudioCoreBindUsageVolumeControlRequest {
21199 type Borrowed<'a> = &'a mut Self;
21200 fn take_or_borrow<'a>(
21201 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
21202 ) -> Self::Borrowed<'a> {
21203 value
21204 }
21205 }
21206
21207 unsafe impl fidl::encoding::TypeMarker for AudioCoreBindUsageVolumeControlRequest {
21208 type Owned = Self;
21209
21210 #[inline(always)]
21211 fn inline_align(_context: fidl::encoding::Context) -> usize {
21212 8
21213 }
21214
21215 #[inline(always)]
21216 fn inline_size(_context: fidl::encoding::Context) -> usize {
21217 24
21218 }
21219 }
21220
21221 unsafe impl
21222 fidl::encoding::Encode<
21223 AudioCoreBindUsageVolumeControlRequest,
21224 fidl::encoding::DefaultFuchsiaResourceDialect,
21225 > for &mut AudioCoreBindUsageVolumeControlRequest
21226 {
21227 #[inline]
21228 unsafe fn encode(
21229 self,
21230 encoder: &mut fidl::encoding::Encoder<
21231 '_,
21232 fidl::encoding::DefaultFuchsiaResourceDialect,
21233 >,
21234 offset: usize,
21235 _depth: fidl::encoding::Depth,
21236 ) -> fidl::Result<()> {
21237 encoder.debug_check_bounds::<AudioCoreBindUsageVolumeControlRequest>(offset);
21238 fidl::encoding::Encode::<
21240 AudioCoreBindUsageVolumeControlRequest,
21241 fidl::encoding::DefaultFuchsiaResourceDialect,
21242 >::encode(
21243 (
21244 <Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
21245 <fidl::encoding::Endpoint<
21246 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
21247 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
21248 &mut self.volume_control,
21249 ),
21250 ),
21251 encoder,
21252 offset,
21253 _depth,
21254 )
21255 }
21256 }
21257 unsafe impl<
21258 T0: fidl::encoding::Encode<Usage, fidl::encoding::DefaultFuchsiaResourceDialect>,
21259 T1: fidl::encoding::Encode<
21260 fidl::encoding::Endpoint<
21261 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
21262 >,
21263 fidl::encoding::DefaultFuchsiaResourceDialect,
21264 >,
21265 >
21266 fidl::encoding::Encode<
21267 AudioCoreBindUsageVolumeControlRequest,
21268 fidl::encoding::DefaultFuchsiaResourceDialect,
21269 > for (T0, T1)
21270 {
21271 #[inline]
21272 unsafe fn encode(
21273 self,
21274 encoder: &mut fidl::encoding::Encoder<
21275 '_,
21276 fidl::encoding::DefaultFuchsiaResourceDialect,
21277 >,
21278 offset: usize,
21279 depth: fidl::encoding::Depth,
21280 ) -> fidl::Result<()> {
21281 encoder.debug_check_bounds::<AudioCoreBindUsageVolumeControlRequest>(offset);
21282 unsafe {
21285 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
21286 (ptr as *mut u64).write_unaligned(0);
21287 }
21288 self.0.encode(encoder, offset + 0, depth)?;
21290 self.1.encode(encoder, offset + 16, depth)?;
21291 Ok(())
21292 }
21293 }
21294
21295 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
21296 for AudioCoreBindUsageVolumeControlRequest
21297 {
21298 #[inline(always)]
21299 fn new_empty() -> Self {
21300 Self {
21301 usage: fidl::new_empty!(Usage, fidl::encoding::DefaultFuchsiaResourceDialect),
21302 volume_control: fidl::new_empty!(
21303 fidl::encoding::Endpoint<
21304 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
21305 >,
21306 fidl::encoding::DefaultFuchsiaResourceDialect
21307 ),
21308 }
21309 }
21310
21311 #[inline]
21312 unsafe fn decode(
21313 &mut self,
21314 decoder: &mut fidl::encoding::Decoder<
21315 '_,
21316 fidl::encoding::DefaultFuchsiaResourceDialect,
21317 >,
21318 offset: usize,
21319 _depth: fidl::encoding::Depth,
21320 ) -> fidl::Result<()> {
21321 decoder.debug_check_bounds::<Self>(offset);
21322 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
21324 let padval = unsafe { (ptr as *const u64).read_unaligned() };
21325 let mask = 0xffffffff00000000u64;
21326 let maskedval = padval & mask;
21327 if maskedval != 0 {
21328 return Err(fidl::Error::NonZeroPadding {
21329 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
21330 });
21331 }
21332 fidl::decode!(
21333 Usage,
21334 fidl::encoding::DefaultFuchsiaResourceDialect,
21335 &mut self.usage,
21336 decoder,
21337 offset + 0,
21338 _depth
21339 )?;
21340 fidl::decode!(
21341 fidl::encoding::Endpoint<
21342 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
21343 >,
21344 fidl::encoding::DefaultFuchsiaResourceDialect,
21345 &mut self.volume_control,
21346 decoder,
21347 offset + 16,
21348 _depth
21349 )?;
21350 Ok(())
21351 }
21352 }
21353
21354 impl fidl::encoding::ResourceTypeMarker for AudioCoreCreateAudioCapturerRequest {
21355 type Borrowed<'a> = &'a mut Self;
21356 fn take_or_borrow<'a>(
21357 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
21358 ) -> Self::Borrowed<'a> {
21359 value
21360 }
21361 }
21362
21363 unsafe impl fidl::encoding::TypeMarker for AudioCoreCreateAudioCapturerRequest {
21364 type Owned = Self;
21365
21366 #[inline(always)]
21367 fn inline_align(_context: fidl::encoding::Context) -> usize {
21368 4
21369 }
21370
21371 #[inline(always)]
21372 fn inline_size(_context: fidl::encoding::Context) -> usize {
21373 8
21374 }
21375 }
21376
21377 unsafe impl
21378 fidl::encoding::Encode<
21379 AudioCoreCreateAudioCapturerRequest,
21380 fidl::encoding::DefaultFuchsiaResourceDialect,
21381 > for &mut AudioCoreCreateAudioCapturerRequest
21382 {
21383 #[inline]
21384 unsafe fn encode(
21385 self,
21386 encoder: &mut fidl::encoding::Encoder<
21387 '_,
21388 fidl::encoding::DefaultFuchsiaResourceDialect,
21389 >,
21390 offset: usize,
21391 _depth: fidl::encoding::Depth,
21392 ) -> fidl::Result<()> {
21393 encoder.debug_check_bounds::<AudioCoreCreateAudioCapturerRequest>(offset);
21394 fidl::encoding::Encode::<AudioCoreCreateAudioCapturerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
21396 (
21397 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.loopback),
21398 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_in_request),
21399 ),
21400 encoder, offset, _depth
21401 )
21402 }
21403 }
21404 unsafe impl<
21405 T0: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
21406 T1: fidl::encoding::Encode<
21407 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
21408 fidl::encoding::DefaultFuchsiaResourceDialect,
21409 >,
21410 >
21411 fidl::encoding::Encode<
21412 AudioCoreCreateAudioCapturerRequest,
21413 fidl::encoding::DefaultFuchsiaResourceDialect,
21414 > for (T0, T1)
21415 {
21416 #[inline]
21417 unsafe fn encode(
21418 self,
21419 encoder: &mut fidl::encoding::Encoder<
21420 '_,
21421 fidl::encoding::DefaultFuchsiaResourceDialect,
21422 >,
21423 offset: usize,
21424 depth: fidl::encoding::Depth,
21425 ) -> fidl::Result<()> {
21426 encoder.debug_check_bounds::<AudioCoreCreateAudioCapturerRequest>(offset);
21427 unsafe {
21430 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
21431 (ptr as *mut u32).write_unaligned(0);
21432 }
21433 self.0.encode(encoder, offset + 0, depth)?;
21435 self.1.encode(encoder, offset + 4, depth)?;
21436 Ok(())
21437 }
21438 }
21439
21440 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
21441 for AudioCoreCreateAudioCapturerRequest
21442 {
21443 #[inline(always)]
21444 fn new_empty() -> Self {
21445 Self {
21446 loopback: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
21447 audio_in_request: fidl::new_empty!(
21448 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
21449 fidl::encoding::DefaultFuchsiaResourceDialect
21450 ),
21451 }
21452 }
21453
21454 #[inline]
21455 unsafe fn decode(
21456 &mut self,
21457 decoder: &mut fidl::encoding::Decoder<
21458 '_,
21459 fidl::encoding::DefaultFuchsiaResourceDialect,
21460 >,
21461 offset: usize,
21462 _depth: fidl::encoding::Depth,
21463 ) -> fidl::Result<()> {
21464 decoder.debug_check_bounds::<Self>(offset);
21465 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
21467 let padval = unsafe { (ptr as *const u32).read_unaligned() };
21468 let mask = 0xffffff00u32;
21469 let maskedval = padval & mask;
21470 if maskedval != 0 {
21471 return Err(fidl::Error::NonZeroPadding {
21472 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
21473 });
21474 }
21475 fidl::decode!(
21476 bool,
21477 fidl::encoding::DefaultFuchsiaResourceDialect,
21478 &mut self.loopback,
21479 decoder,
21480 offset + 0,
21481 _depth
21482 )?;
21483 fidl::decode!(
21484 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
21485 fidl::encoding::DefaultFuchsiaResourceDialect,
21486 &mut self.audio_in_request,
21487 decoder,
21488 offset + 4,
21489 _depth
21490 )?;
21491 Ok(())
21492 }
21493 }
21494
21495 impl fidl::encoding::ResourceTypeMarker for AudioCoreCreateAudioCapturerWithConfigurationRequest {
21496 type Borrowed<'a> = &'a mut Self;
21497 fn take_or_borrow<'a>(
21498 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
21499 ) -> Self::Borrowed<'a> {
21500 value
21501 }
21502 }
21503
21504 unsafe impl fidl::encoding::TypeMarker for AudioCoreCreateAudioCapturerWithConfigurationRequest {
21505 type Owned = Self;
21506
21507 #[inline(always)]
21508 fn inline_align(_context: fidl::encoding::Context) -> usize {
21509 8
21510 }
21511
21512 #[inline(always)]
21513 fn inline_size(_context: fidl::encoding::Context) -> usize {
21514 40
21515 }
21516 }
21517
21518 unsafe impl
21519 fidl::encoding::Encode<
21520 AudioCoreCreateAudioCapturerWithConfigurationRequest,
21521 fidl::encoding::DefaultFuchsiaResourceDialect,
21522 > for &mut AudioCoreCreateAudioCapturerWithConfigurationRequest
21523 {
21524 #[inline]
21525 unsafe fn encode(
21526 self,
21527 encoder: &mut fidl::encoding::Encoder<
21528 '_,
21529 fidl::encoding::DefaultFuchsiaResourceDialect,
21530 >,
21531 offset: usize,
21532 _depth: fidl::encoding::Depth,
21533 ) -> fidl::Result<()> {
21534 encoder
21535 .debug_check_bounds::<AudioCoreCreateAudioCapturerWithConfigurationRequest>(offset);
21536 fidl::encoding::Encode::<AudioCoreCreateAudioCapturerWithConfigurationRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
21538 (
21539 <AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_type),
21540 <AudioCapturerConfiguration as fidl::encoding::ValueTypeMarker>::borrow(&self.configuration),
21541 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_capturer_request),
21542 ),
21543 encoder, offset, _depth
21544 )
21545 }
21546 }
21547 unsafe impl<
21548 T0: fidl::encoding::Encode<AudioStreamType, fidl::encoding::DefaultFuchsiaResourceDialect>,
21549 T1: fidl::encoding::Encode<
21550 AudioCapturerConfiguration,
21551 fidl::encoding::DefaultFuchsiaResourceDialect,
21552 >,
21553 T2: fidl::encoding::Encode<
21554 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
21555 fidl::encoding::DefaultFuchsiaResourceDialect,
21556 >,
21557 >
21558 fidl::encoding::Encode<
21559 AudioCoreCreateAudioCapturerWithConfigurationRequest,
21560 fidl::encoding::DefaultFuchsiaResourceDialect,
21561 > for (T0, T1, T2)
21562 {
21563 #[inline]
21564 unsafe fn encode(
21565 self,
21566 encoder: &mut fidl::encoding::Encoder<
21567 '_,
21568 fidl::encoding::DefaultFuchsiaResourceDialect,
21569 >,
21570 offset: usize,
21571 depth: fidl::encoding::Depth,
21572 ) -> fidl::Result<()> {
21573 encoder
21574 .debug_check_bounds::<AudioCoreCreateAudioCapturerWithConfigurationRequest>(offset);
21575 unsafe {
21578 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
21579 (ptr as *mut u64).write_unaligned(0);
21580 }
21581 unsafe {
21582 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
21583 (ptr as *mut u64).write_unaligned(0);
21584 }
21585 self.0.encode(encoder, offset + 0, depth)?;
21587 self.1.encode(encoder, offset + 16, depth)?;
21588 self.2.encode(encoder, offset + 32, depth)?;
21589 Ok(())
21590 }
21591 }
21592
21593 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
21594 for AudioCoreCreateAudioCapturerWithConfigurationRequest
21595 {
21596 #[inline(always)]
21597 fn new_empty() -> Self {
21598 Self {
21599 stream_type: fidl::new_empty!(
21600 AudioStreamType,
21601 fidl::encoding::DefaultFuchsiaResourceDialect
21602 ),
21603 configuration: fidl::new_empty!(
21604 AudioCapturerConfiguration,
21605 fidl::encoding::DefaultFuchsiaResourceDialect
21606 ),
21607 audio_capturer_request: fidl::new_empty!(
21608 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
21609 fidl::encoding::DefaultFuchsiaResourceDialect
21610 ),
21611 }
21612 }
21613
21614 #[inline]
21615 unsafe fn decode(
21616 &mut self,
21617 decoder: &mut fidl::encoding::Decoder<
21618 '_,
21619 fidl::encoding::DefaultFuchsiaResourceDialect,
21620 >,
21621 offset: usize,
21622 _depth: fidl::encoding::Depth,
21623 ) -> fidl::Result<()> {
21624 decoder.debug_check_bounds::<Self>(offset);
21625 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
21627 let padval = unsafe { (ptr as *const u64).read_unaligned() };
21628 let mask = 0xffffffff00000000u64;
21629 let maskedval = padval & mask;
21630 if maskedval != 0 {
21631 return Err(fidl::Error::NonZeroPadding {
21632 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
21633 });
21634 }
21635 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
21636 let padval = unsafe { (ptr as *const u64).read_unaligned() };
21637 let mask = 0xffffffff00000000u64;
21638 let maskedval = padval & mask;
21639 if maskedval != 0 {
21640 return Err(fidl::Error::NonZeroPadding {
21641 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
21642 });
21643 }
21644 fidl::decode!(
21645 AudioStreamType,
21646 fidl::encoding::DefaultFuchsiaResourceDialect,
21647 &mut self.stream_type,
21648 decoder,
21649 offset + 0,
21650 _depth
21651 )?;
21652 fidl::decode!(
21653 AudioCapturerConfiguration,
21654 fidl::encoding::DefaultFuchsiaResourceDialect,
21655 &mut self.configuration,
21656 decoder,
21657 offset + 16,
21658 _depth
21659 )?;
21660 fidl::decode!(
21661 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
21662 fidl::encoding::DefaultFuchsiaResourceDialect,
21663 &mut self.audio_capturer_request,
21664 decoder,
21665 offset + 32,
21666 _depth
21667 )?;
21668 Ok(())
21669 }
21670 }
21671
21672 impl fidl::encoding::ResourceTypeMarker for AudioCoreCreateAudioRendererRequest {
21673 type Borrowed<'a> = &'a mut Self;
21674 fn take_or_borrow<'a>(
21675 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
21676 ) -> Self::Borrowed<'a> {
21677 value
21678 }
21679 }
21680
21681 unsafe impl fidl::encoding::TypeMarker for AudioCoreCreateAudioRendererRequest {
21682 type Owned = Self;
21683
21684 #[inline(always)]
21685 fn inline_align(_context: fidl::encoding::Context) -> usize {
21686 4
21687 }
21688
21689 #[inline(always)]
21690 fn inline_size(_context: fidl::encoding::Context) -> usize {
21691 4
21692 }
21693 }
21694
21695 unsafe impl
21696 fidl::encoding::Encode<
21697 AudioCoreCreateAudioRendererRequest,
21698 fidl::encoding::DefaultFuchsiaResourceDialect,
21699 > for &mut AudioCoreCreateAudioRendererRequest
21700 {
21701 #[inline]
21702 unsafe fn encode(
21703 self,
21704 encoder: &mut fidl::encoding::Encoder<
21705 '_,
21706 fidl::encoding::DefaultFuchsiaResourceDialect,
21707 >,
21708 offset: usize,
21709 _depth: fidl::encoding::Depth,
21710 ) -> fidl::Result<()> {
21711 encoder.debug_check_bounds::<AudioCoreCreateAudioRendererRequest>(offset);
21712 fidl::encoding::Encode::<AudioCoreCreateAudioRendererRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
21714 (
21715 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_out_request),
21716 ),
21717 encoder, offset, _depth
21718 )
21719 }
21720 }
21721 unsafe impl<
21722 T0: fidl::encoding::Encode<
21723 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>>,
21724 fidl::encoding::DefaultFuchsiaResourceDialect,
21725 >,
21726 >
21727 fidl::encoding::Encode<
21728 AudioCoreCreateAudioRendererRequest,
21729 fidl::encoding::DefaultFuchsiaResourceDialect,
21730 > for (T0,)
21731 {
21732 #[inline]
21733 unsafe fn encode(
21734 self,
21735 encoder: &mut fidl::encoding::Encoder<
21736 '_,
21737 fidl::encoding::DefaultFuchsiaResourceDialect,
21738 >,
21739 offset: usize,
21740 depth: fidl::encoding::Depth,
21741 ) -> fidl::Result<()> {
21742 encoder.debug_check_bounds::<AudioCoreCreateAudioRendererRequest>(offset);
21743 self.0.encode(encoder, offset + 0, depth)?;
21747 Ok(())
21748 }
21749 }
21750
21751 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
21752 for AudioCoreCreateAudioRendererRequest
21753 {
21754 #[inline(always)]
21755 fn new_empty() -> Self {
21756 Self {
21757 audio_out_request: fidl::new_empty!(
21758 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>>,
21759 fidl::encoding::DefaultFuchsiaResourceDialect
21760 ),
21761 }
21762 }
21763
21764 #[inline]
21765 unsafe fn decode(
21766 &mut self,
21767 decoder: &mut fidl::encoding::Decoder<
21768 '_,
21769 fidl::encoding::DefaultFuchsiaResourceDialect,
21770 >,
21771 offset: usize,
21772 _depth: fidl::encoding::Depth,
21773 ) -> fidl::Result<()> {
21774 decoder.debug_check_bounds::<Self>(offset);
21775 fidl::decode!(
21777 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>>,
21778 fidl::encoding::DefaultFuchsiaResourceDialect,
21779 &mut self.audio_out_request,
21780 decoder,
21781 offset + 0,
21782 _depth
21783 )?;
21784 Ok(())
21785 }
21786 }
21787
21788 impl fidl::encoding::ResourceTypeMarker for AudioCreateAudioCapturerRequest {
21789 type Borrowed<'a> = &'a mut Self;
21790 fn take_or_borrow<'a>(
21791 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
21792 ) -> Self::Borrowed<'a> {
21793 value
21794 }
21795 }
21796
21797 unsafe impl fidl::encoding::TypeMarker for AudioCreateAudioCapturerRequest {
21798 type Owned = Self;
21799
21800 #[inline(always)]
21801 fn inline_align(_context: fidl::encoding::Context) -> usize {
21802 4
21803 }
21804
21805 #[inline(always)]
21806 fn inline_size(_context: fidl::encoding::Context) -> usize {
21807 8
21808 }
21809 }
21810
21811 unsafe impl
21812 fidl::encoding::Encode<
21813 AudioCreateAudioCapturerRequest,
21814 fidl::encoding::DefaultFuchsiaResourceDialect,
21815 > for &mut AudioCreateAudioCapturerRequest
21816 {
21817 #[inline]
21818 unsafe fn encode(
21819 self,
21820 encoder: &mut fidl::encoding::Encoder<
21821 '_,
21822 fidl::encoding::DefaultFuchsiaResourceDialect,
21823 >,
21824 offset: usize,
21825 _depth: fidl::encoding::Depth,
21826 ) -> fidl::Result<()> {
21827 encoder.debug_check_bounds::<AudioCreateAudioCapturerRequest>(offset);
21828 fidl::encoding::Encode::<AudioCreateAudioCapturerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
21830 (
21831 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_capturer_request),
21832 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.loopback),
21833 ),
21834 encoder, offset, _depth
21835 )
21836 }
21837 }
21838 unsafe impl<
21839 T0: fidl::encoding::Encode<
21840 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
21841 fidl::encoding::DefaultFuchsiaResourceDialect,
21842 >,
21843 T1: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
21844 >
21845 fidl::encoding::Encode<
21846 AudioCreateAudioCapturerRequest,
21847 fidl::encoding::DefaultFuchsiaResourceDialect,
21848 > for (T0, T1)
21849 {
21850 #[inline]
21851 unsafe fn encode(
21852 self,
21853 encoder: &mut fidl::encoding::Encoder<
21854 '_,
21855 fidl::encoding::DefaultFuchsiaResourceDialect,
21856 >,
21857 offset: usize,
21858 depth: fidl::encoding::Depth,
21859 ) -> fidl::Result<()> {
21860 encoder.debug_check_bounds::<AudioCreateAudioCapturerRequest>(offset);
21861 unsafe {
21864 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
21865 (ptr as *mut u32).write_unaligned(0);
21866 }
21867 self.0.encode(encoder, offset + 0, depth)?;
21869 self.1.encode(encoder, offset + 4, depth)?;
21870 Ok(())
21871 }
21872 }
21873
21874 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
21875 for AudioCreateAudioCapturerRequest
21876 {
21877 #[inline(always)]
21878 fn new_empty() -> Self {
21879 Self {
21880 audio_capturer_request: fidl::new_empty!(
21881 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
21882 fidl::encoding::DefaultFuchsiaResourceDialect
21883 ),
21884 loopback: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
21885 }
21886 }
21887
21888 #[inline]
21889 unsafe fn decode(
21890 &mut self,
21891 decoder: &mut fidl::encoding::Decoder<
21892 '_,
21893 fidl::encoding::DefaultFuchsiaResourceDialect,
21894 >,
21895 offset: usize,
21896 _depth: fidl::encoding::Depth,
21897 ) -> fidl::Result<()> {
21898 decoder.debug_check_bounds::<Self>(offset);
21899 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
21901 let padval = unsafe { (ptr as *const u32).read_unaligned() };
21902 let mask = 0xffffff00u32;
21903 let maskedval = padval & mask;
21904 if maskedval != 0 {
21905 return Err(fidl::Error::NonZeroPadding {
21906 padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
21907 });
21908 }
21909 fidl::decode!(
21910 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioCapturerMarker>>,
21911 fidl::encoding::DefaultFuchsiaResourceDialect,
21912 &mut self.audio_capturer_request,
21913 decoder,
21914 offset + 0,
21915 _depth
21916 )?;
21917 fidl::decode!(
21918 bool,
21919 fidl::encoding::DefaultFuchsiaResourceDialect,
21920 &mut self.loopback,
21921 decoder,
21922 offset + 4,
21923 _depth
21924 )?;
21925 Ok(())
21926 }
21927 }
21928
21929 impl fidl::encoding::ResourceTypeMarker for AudioCreateAudioRendererRequest {
21930 type Borrowed<'a> = &'a mut Self;
21931 fn take_or_borrow<'a>(
21932 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
21933 ) -> Self::Borrowed<'a> {
21934 value
21935 }
21936 }
21937
21938 unsafe impl fidl::encoding::TypeMarker for AudioCreateAudioRendererRequest {
21939 type Owned = Self;
21940
21941 #[inline(always)]
21942 fn inline_align(_context: fidl::encoding::Context) -> usize {
21943 4
21944 }
21945
21946 #[inline(always)]
21947 fn inline_size(_context: fidl::encoding::Context) -> usize {
21948 4
21949 }
21950 }
21951
21952 unsafe impl
21953 fidl::encoding::Encode<
21954 AudioCreateAudioRendererRequest,
21955 fidl::encoding::DefaultFuchsiaResourceDialect,
21956 > for &mut AudioCreateAudioRendererRequest
21957 {
21958 #[inline]
21959 unsafe fn encode(
21960 self,
21961 encoder: &mut fidl::encoding::Encoder<
21962 '_,
21963 fidl::encoding::DefaultFuchsiaResourceDialect,
21964 >,
21965 offset: usize,
21966 _depth: fidl::encoding::Depth,
21967 ) -> fidl::Result<()> {
21968 encoder.debug_check_bounds::<AudioCreateAudioRendererRequest>(offset);
21969 fidl::encoding::Encode::<AudioCreateAudioRendererRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
21971 (
21972 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_renderer_request),
21973 ),
21974 encoder, offset, _depth
21975 )
21976 }
21977 }
21978 unsafe impl<
21979 T0: fidl::encoding::Encode<
21980 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>>,
21981 fidl::encoding::DefaultFuchsiaResourceDialect,
21982 >,
21983 >
21984 fidl::encoding::Encode<
21985 AudioCreateAudioRendererRequest,
21986 fidl::encoding::DefaultFuchsiaResourceDialect,
21987 > for (T0,)
21988 {
21989 #[inline]
21990 unsafe fn encode(
21991 self,
21992 encoder: &mut fidl::encoding::Encoder<
21993 '_,
21994 fidl::encoding::DefaultFuchsiaResourceDialect,
21995 >,
21996 offset: usize,
21997 depth: fidl::encoding::Depth,
21998 ) -> fidl::Result<()> {
21999 encoder.debug_check_bounds::<AudioCreateAudioRendererRequest>(offset);
22000 self.0.encode(encoder, offset + 0, depth)?;
22004 Ok(())
22005 }
22006 }
22007
22008 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
22009 for AudioCreateAudioRendererRequest
22010 {
22011 #[inline(always)]
22012 fn new_empty() -> Self {
22013 Self {
22014 audio_renderer_request: fidl::new_empty!(
22015 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>>,
22016 fidl::encoding::DefaultFuchsiaResourceDialect
22017 ),
22018 }
22019 }
22020
22021 #[inline]
22022 unsafe fn decode(
22023 &mut self,
22024 decoder: &mut fidl::encoding::Decoder<
22025 '_,
22026 fidl::encoding::DefaultFuchsiaResourceDialect,
22027 >,
22028 offset: usize,
22029 _depth: fidl::encoding::Depth,
22030 ) -> fidl::Result<()> {
22031 decoder.debug_check_bounds::<Self>(offset);
22032 fidl::decode!(
22034 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioRendererMarker>>,
22035 fidl::encoding::DefaultFuchsiaResourceDialect,
22036 &mut self.audio_renderer_request,
22037 decoder,
22038 offset + 0,
22039 _depth
22040 )?;
22041 Ok(())
22042 }
22043 }
22044
22045 impl fidl::encoding::ResourceTypeMarker for AudioDeviceEnumeratorAddDeviceByChannelRequest {
22046 type Borrowed<'a> = &'a mut Self;
22047 fn take_or_borrow<'a>(
22048 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
22049 ) -> Self::Borrowed<'a> {
22050 value
22051 }
22052 }
22053
22054 unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorAddDeviceByChannelRequest {
22055 type Owned = Self;
22056
22057 #[inline(always)]
22058 fn inline_align(_context: fidl::encoding::Context) -> usize {
22059 8
22060 }
22061
22062 #[inline(always)]
22063 fn inline_size(_context: fidl::encoding::Context) -> usize {
22064 24
22065 }
22066 }
22067
22068 unsafe impl
22069 fidl::encoding::Encode<
22070 AudioDeviceEnumeratorAddDeviceByChannelRequest,
22071 fidl::encoding::DefaultFuchsiaResourceDialect,
22072 > for &mut AudioDeviceEnumeratorAddDeviceByChannelRequest
22073 {
22074 #[inline]
22075 unsafe fn encode(
22076 self,
22077 encoder: &mut fidl::encoding::Encoder<
22078 '_,
22079 fidl::encoding::DefaultFuchsiaResourceDialect,
22080 >,
22081 offset: usize,
22082 _depth: fidl::encoding::Depth,
22083 ) -> fidl::Result<()> {
22084 encoder.debug_check_bounds::<AudioDeviceEnumeratorAddDeviceByChannelRequest>(offset);
22085 fidl::encoding::Encode::<
22087 AudioDeviceEnumeratorAddDeviceByChannelRequest,
22088 fidl::encoding::DefaultFuchsiaResourceDialect,
22089 >::encode(
22090 (
22091 <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
22092 &self.device_name,
22093 ),
22094 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_input),
22095 <fidl::encoding::Endpoint<
22096 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
22097 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
22098 &mut self.channel
22099 ),
22100 ),
22101 encoder,
22102 offset,
22103 _depth,
22104 )
22105 }
22106 }
22107 unsafe impl<
22108 T0: fidl::encoding::Encode<
22109 fidl::encoding::BoundedString<256>,
22110 fidl::encoding::DefaultFuchsiaResourceDialect,
22111 >,
22112 T1: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
22113 T2: fidl::encoding::Encode<
22114 fidl::encoding::Endpoint<
22115 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
22116 >,
22117 fidl::encoding::DefaultFuchsiaResourceDialect,
22118 >,
22119 >
22120 fidl::encoding::Encode<
22121 AudioDeviceEnumeratorAddDeviceByChannelRequest,
22122 fidl::encoding::DefaultFuchsiaResourceDialect,
22123 > for (T0, T1, T2)
22124 {
22125 #[inline]
22126 unsafe fn encode(
22127 self,
22128 encoder: &mut fidl::encoding::Encoder<
22129 '_,
22130 fidl::encoding::DefaultFuchsiaResourceDialect,
22131 >,
22132 offset: usize,
22133 depth: fidl::encoding::Depth,
22134 ) -> fidl::Result<()> {
22135 encoder.debug_check_bounds::<AudioDeviceEnumeratorAddDeviceByChannelRequest>(offset);
22136 unsafe {
22139 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
22140 (ptr as *mut u64).write_unaligned(0);
22141 }
22142 self.0.encode(encoder, offset + 0, depth)?;
22144 self.1.encode(encoder, offset + 16, depth)?;
22145 self.2.encode(encoder, offset + 20, depth)?;
22146 Ok(())
22147 }
22148 }
22149
22150 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
22151 for AudioDeviceEnumeratorAddDeviceByChannelRequest
22152 {
22153 #[inline(always)]
22154 fn new_empty() -> Self {
22155 Self {
22156 device_name: fidl::new_empty!(
22157 fidl::encoding::BoundedString<256>,
22158 fidl::encoding::DefaultFuchsiaResourceDialect
22159 ),
22160 is_input: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
22161 channel: fidl::new_empty!(
22162 fidl::encoding::Endpoint<
22163 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
22164 >,
22165 fidl::encoding::DefaultFuchsiaResourceDialect
22166 ),
22167 }
22168 }
22169
22170 #[inline]
22171 unsafe fn decode(
22172 &mut self,
22173 decoder: &mut fidl::encoding::Decoder<
22174 '_,
22175 fidl::encoding::DefaultFuchsiaResourceDialect,
22176 >,
22177 offset: usize,
22178 _depth: fidl::encoding::Depth,
22179 ) -> fidl::Result<()> {
22180 decoder.debug_check_bounds::<Self>(offset);
22181 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
22183 let padval = unsafe { (ptr as *const u64).read_unaligned() };
22184 let mask = 0xffffff00u64;
22185 let maskedval = padval & mask;
22186 if maskedval != 0 {
22187 return Err(fidl::Error::NonZeroPadding {
22188 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
22189 });
22190 }
22191 fidl::decode!(
22192 fidl::encoding::BoundedString<256>,
22193 fidl::encoding::DefaultFuchsiaResourceDialect,
22194 &mut self.device_name,
22195 decoder,
22196 offset + 0,
22197 _depth
22198 )?;
22199 fidl::decode!(
22200 bool,
22201 fidl::encoding::DefaultFuchsiaResourceDialect,
22202 &mut self.is_input,
22203 decoder,
22204 offset + 16,
22205 _depth
22206 )?;
22207 fidl::decode!(
22208 fidl::encoding::Endpoint<
22209 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::StreamConfigMarker>,
22210 >,
22211 fidl::encoding::DefaultFuchsiaResourceDialect,
22212 &mut self.channel,
22213 decoder,
22214 offset + 20,
22215 _depth
22216 )?;
22217 Ok(())
22218 }
22219 }
22220
22221 impl fidl::encoding::ResourceTypeMarker for AudioRendererBindGainControlRequest {
22222 type Borrowed<'a> = &'a mut Self;
22223 fn take_or_borrow<'a>(
22224 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
22225 ) -> Self::Borrowed<'a> {
22226 value
22227 }
22228 }
22229
22230 unsafe impl fidl::encoding::TypeMarker for AudioRendererBindGainControlRequest {
22231 type Owned = Self;
22232
22233 #[inline(always)]
22234 fn inline_align(_context: fidl::encoding::Context) -> usize {
22235 4
22236 }
22237
22238 #[inline(always)]
22239 fn inline_size(_context: fidl::encoding::Context) -> usize {
22240 4
22241 }
22242 }
22243
22244 unsafe impl
22245 fidl::encoding::Encode<
22246 AudioRendererBindGainControlRequest,
22247 fidl::encoding::DefaultFuchsiaResourceDialect,
22248 > for &mut AudioRendererBindGainControlRequest
22249 {
22250 #[inline]
22251 unsafe fn encode(
22252 self,
22253 encoder: &mut fidl::encoding::Encoder<
22254 '_,
22255 fidl::encoding::DefaultFuchsiaResourceDialect,
22256 >,
22257 offset: usize,
22258 _depth: fidl::encoding::Depth,
22259 ) -> fidl::Result<()> {
22260 encoder.debug_check_bounds::<AudioRendererBindGainControlRequest>(offset);
22261 fidl::encoding::Encode::<
22263 AudioRendererBindGainControlRequest,
22264 fidl::encoding::DefaultFuchsiaResourceDialect,
22265 >::encode(
22266 (<fidl::encoding::Endpoint<
22267 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
22268 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
22269 &mut self.gain_control_request,
22270 ),),
22271 encoder,
22272 offset,
22273 _depth,
22274 )
22275 }
22276 }
22277 unsafe impl<
22278 T0: fidl::encoding::Encode<
22279 fidl::encoding::Endpoint<
22280 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
22281 >,
22282 fidl::encoding::DefaultFuchsiaResourceDialect,
22283 >,
22284 >
22285 fidl::encoding::Encode<
22286 AudioRendererBindGainControlRequest,
22287 fidl::encoding::DefaultFuchsiaResourceDialect,
22288 > for (T0,)
22289 {
22290 #[inline]
22291 unsafe fn encode(
22292 self,
22293 encoder: &mut fidl::encoding::Encoder<
22294 '_,
22295 fidl::encoding::DefaultFuchsiaResourceDialect,
22296 >,
22297 offset: usize,
22298 depth: fidl::encoding::Depth,
22299 ) -> fidl::Result<()> {
22300 encoder.debug_check_bounds::<AudioRendererBindGainControlRequest>(offset);
22301 self.0.encode(encoder, offset + 0, depth)?;
22305 Ok(())
22306 }
22307 }
22308
22309 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
22310 for AudioRendererBindGainControlRequest
22311 {
22312 #[inline(always)]
22313 fn new_empty() -> Self {
22314 Self {
22315 gain_control_request: fidl::new_empty!(
22316 fidl::encoding::Endpoint<
22317 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
22318 >,
22319 fidl::encoding::DefaultFuchsiaResourceDialect
22320 ),
22321 }
22322 }
22323
22324 #[inline]
22325 unsafe fn decode(
22326 &mut self,
22327 decoder: &mut fidl::encoding::Decoder<
22328 '_,
22329 fidl::encoding::DefaultFuchsiaResourceDialect,
22330 >,
22331 offset: usize,
22332 _depth: fidl::encoding::Depth,
22333 ) -> fidl::Result<()> {
22334 decoder.debug_check_bounds::<Self>(offset);
22335 fidl::decode!(
22337 fidl::encoding::Endpoint<
22338 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::GainControlMarker>,
22339 >,
22340 fidl::encoding::DefaultFuchsiaResourceDialect,
22341 &mut self.gain_control_request,
22342 decoder,
22343 offset + 0,
22344 _depth
22345 )?;
22346 Ok(())
22347 }
22348 }
22349
22350 impl fidl::encoding::ResourceTypeMarker for AudioRendererGetReferenceClockResponse {
22351 type Borrowed<'a> = &'a mut Self;
22352 fn take_or_borrow<'a>(
22353 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
22354 ) -> Self::Borrowed<'a> {
22355 value
22356 }
22357 }
22358
22359 unsafe impl fidl::encoding::TypeMarker for AudioRendererGetReferenceClockResponse {
22360 type Owned = Self;
22361
22362 #[inline(always)]
22363 fn inline_align(_context: fidl::encoding::Context) -> usize {
22364 4
22365 }
22366
22367 #[inline(always)]
22368 fn inline_size(_context: fidl::encoding::Context) -> usize {
22369 4
22370 }
22371 }
22372
22373 unsafe impl
22374 fidl::encoding::Encode<
22375 AudioRendererGetReferenceClockResponse,
22376 fidl::encoding::DefaultFuchsiaResourceDialect,
22377 > for &mut AudioRendererGetReferenceClockResponse
22378 {
22379 #[inline]
22380 unsafe fn encode(
22381 self,
22382 encoder: &mut fidl::encoding::Encoder<
22383 '_,
22384 fidl::encoding::DefaultFuchsiaResourceDialect,
22385 >,
22386 offset: usize,
22387 _depth: fidl::encoding::Depth,
22388 ) -> fidl::Result<()> {
22389 encoder.debug_check_bounds::<AudioRendererGetReferenceClockResponse>(offset);
22390 fidl::encoding::Encode::<
22392 AudioRendererGetReferenceClockResponse,
22393 fidl::encoding::DefaultFuchsiaResourceDialect,
22394 >::encode(
22395 (<fidl::encoding::HandleType<
22396 fidl::Clock,
22397 { fidl::ObjectType::CLOCK.into_raw() },
22398 2147483648,
22399 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
22400 &mut self.reference_clock,
22401 ),),
22402 encoder,
22403 offset,
22404 _depth,
22405 )
22406 }
22407 }
22408 unsafe impl<
22409 T0: fidl::encoding::Encode<
22410 fidl::encoding::HandleType<
22411 fidl::Clock,
22412 { fidl::ObjectType::CLOCK.into_raw() },
22413 2147483648,
22414 >,
22415 fidl::encoding::DefaultFuchsiaResourceDialect,
22416 >,
22417 >
22418 fidl::encoding::Encode<
22419 AudioRendererGetReferenceClockResponse,
22420 fidl::encoding::DefaultFuchsiaResourceDialect,
22421 > for (T0,)
22422 {
22423 #[inline]
22424 unsafe fn encode(
22425 self,
22426 encoder: &mut fidl::encoding::Encoder<
22427 '_,
22428 fidl::encoding::DefaultFuchsiaResourceDialect,
22429 >,
22430 offset: usize,
22431 depth: fidl::encoding::Depth,
22432 ) -> fidl::Result<()> {
22433 encoder.debug_check_bounds::<AudioRendererGetReferenceClockResponse>(offset);
22434 self.0.encode(encoder, offset + 0, depth)?;
22438 Ok(())
22439 }
22440 }
22441
22442 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
22443 for AudioRendererGetReferenceClockResponse
22444 {
22445 #[inline(always)]
22446 fn new_empty() -> Self {
22447 Self {
22448 reference_clock: fidl::new_empty!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
22449 }
22450 }
22451
22452 #[inline]
22453 unsafe fn decode(
22454 &mut self,
22455 decoder: &mut fidl::encoding::Decoder<
22456 '_,
22457 fidl::encoding::DefaultFuchsiaResourceDialect,
22458 >,
22459 offset: usize,
22460 _depth: fidl::encoding::Depth,
22461 ) -> fidl::Result<()> {
22462 decoder.debug_check_bounds::<Self>(offset);
22463 fidl::decode!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reference_clock, decoder, offset + 0, _depth)?;
22465 Ok(())
22466 }
22467 }
22468
22469 impl fidl::encoding::ResourceTypeMarker for AudioRendererSetReferenceClockRequest {
22470 type Borrowed<'a> = &'a mut Self;
22471 fn take_or_borrow<'a>(
22472 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
22473 ) -> Self::Borrowed<'a> {
22474 value
22475 }
22476 }
22477
22478 unsafe impl fidl::encoding::TypeMarker for AudioRendererSetReferenceClockRequest {
22479 type Owned = Self;
22480
22481 #[inline(always)]
22482 fn inline_align(_context: fidl::encoding::Context) -> usize {
22483 4
22484 }
22485
22486 #[inline(always)]
22487 fn inline_size(_context: fidl::encoding::Context) -> usize {
22488 4
22489 }
22490 }
22491
22492 unsafe impl
22493 fidl::encoding::Encode<
22494 AudioRendererSetReferenceClockRequest,
22495 fidl::encoding::DefaultFuchsiaResourceDialect,
22496 > for &mut AudioRendererSetReferenceClockRequest
22497 {
22498 #[inline]
22499 unsafe fn encode(
22500 self,
22501 encoder: &mut fidl::encoding::Encoder<
22502 '_,
22503 fidl::encoding::DefaultFuchsiaResourceDialect,
22504 >,
22505 offset: usize,
22506 _depth: fidl::encoding::Depth,
22507 ) -> fidl::Result<()> {
22508 encoder.debug_check_bounds::<AudioRendererSetReferenceClockRequest>(offset);
22509 fidl::encoding::Encode::<
22511 AudioRendererSetReferenceClockRequest,
22512 fidl::encoding::DefaultFuchsiaResourceDialect,
22513 >::encode(
22514 (<fidl::encoding::Optional<
22515 fidl::encoding::HandleType<
22516 fidl::Clock,
22517 { fidl::ObjectType::CLOCK.into_raw() },
22518 2147483648,
22519 >,
22520 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
22521 &mut self.reference_clock,
22522 ),),
22523 encoder,
22524 offset,
22525 _depth,
22526 )
22527 }
22528 }
22529 unsafe impl<
22530 T0: fidl::encoding::Encode<
22531 fidl::encoding::Optional<
22532 fidl::encoding::HandleType<
22533 fidl::Clock,
22534 { fidl::ObjectType::CLOCK.into_raw() },
22535 2147483648,
22536 >,
22537 >,
22538 fidl::encoding::DefaultFuchsiaResourceDialect,
22539 >,
22540 >
22541 fidl::encoding::Encode<
22542 AudioRendererSetReferenceClockRequest,
22543 fidl::encoding::DefaultFuchsiaResourceDialect,
22544 > for (T0,)
22545 {
22546 #[inline]
22547 unsafe fn encode(
22548 self,
22549 encoder: &mut fidl::encoding::Encoder<
22550 '_,
22551 fidl::encoding::DefaultFuchsiaResourceDialect,
22552 >,
22553 offset: usize,
22554 depth: fidl::encoding::Depth,
22555 ) -> fidl::Result<()> {
22556 encoder.debug_check_bounds::<AudioRendererSetReferenceClockRequest>(offset);
22557 self.0.encode(encoder, offset + 0, depth)?;
22561 Ok(())
22562 }
22563 }
22564
22565 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
22566 for AudioRendererSetReferenceClockRequest
22567 {
22568 #[inline(always)]
22569 fn new_empty() -> Self {
22570 Self {
22571 reference_clock: fidl::new_empty!(
22572 fidl::encoding::Optional<
22573 fidl::encoding::HandleType<
22574 fidl::Clock,
22575 { fidl::ObjectType::CLOCK.into_raw() },
22576 2147483648,
22577 >,
22578 >,
22579 fidl::encoding::DefaultFuchsiaResourceDialect
22580 ),
22581 }
22582 }
22583
22584 #[inline]
22585 unsafe fn decode(
22586 &mut self,
22587 decoder: &mut fidl::encoding::Decoder<
22588 '_,
22589 fidl::encoding::DefaultFuchsiaResourceDialect,
22590 >,
22591 offset: usize,
22592 _depth: fidl::encoding::Depth,
22593 ) -> fidl::Result<()> {
22594 decoder.debug_check_bounds::<Self>(offset);
22595 fidl::decode!(
22597 fidl::encoding::Optional<
22598 fidl::encoding::HandleType<
22599 fidl::Clock,
22600 { fidl::ObjectType::CLOCK.into_raw() },
22601 2147483648,
22602 >,
22603 >,
22604 fidl::encoding::DefaultFuchsiaResourceDialect,
22605 &mut self.reference_clock,
22606 decoder,
22607 offset + 0,
22608 _depth
22609 )?;
22610 Ok(())
22611 }
22612 }
22613
22614 impl fidl::encoding::ResourceTypeMarker for ProfileProviderRegisterHandlerWithCapacityRequest {
22615 type Borrowed<'a> = &'a mut Self;
22616 fn take_or_borrow<'a>(
22617 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
22618 ) -> Self::Borrowed<'a> {
22619 value
22620 }
22621 }
22622
22623 unsafe impl fidl::encoding::TypeMarker for ProfileProviderRegisterHandlerWithCapacityRequest {
22624 type Owned = Self;
22625
22626 #[inline(always)]
22627 fn inline_align(_context: fidl::encoding::Context) -> usize {
22628 8
22629 }
22630
22631 #[inline(always)]
22632 fn inline_size(_context: fidl::encoding::Context) -> usize {
22633 40
22634 }
22635 }
22636
22637 unsafe impl
22638 fidl::encoding::Encode<
22639 ProfileProviderRegisterHandlerWithCapacityRequest,
22640 fidl::encoding::DefaultFuchsiaResourceDialect,
22641 > for &mut ProfileProviderRegisterHandlerWithCapacityRequest
22642 {
22643 #[inline]
22644 unsafe fn encode(
22645 self,
22646 encoder: &mut fidl::encoding::Encoder<
22647 '_,
22648 fidl::encoding::DefaultFuchsiaResourceDialect,
22649 >,
22650 offset: usize,
22651 _depth: fidl::encoding::Depth,
22652 ) -> fidl::Result<()> {
22653 encoder.debug_check_bounds::<ProfileProviderRegisterHandlerWithCapacityRequest>(offset);
22654 fidl::encoding::Encode::<
22656 ProfileProviderRegisterHandlerWithCapacityRequest,
22657 fidl::encoding::DefaultFuchsiaResourceDialect,
22658 >::encode(
22659 (
22660 <fidl::encoding::HandleType<
22661 fidl::Thread,
22662 { fidl::ObjectType::THREAD.into_raw() },
22663 2147483648,
22664 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
22665 &mut self.thread_handle,
22666 ),
22667 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
22668 &self.name,
22669 ),
22670 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.period),
22671 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.capacity),
22672 ),
22673 encoder,
22674 offset,
22675 _depth,
22676 )
22677 }
22678 }
22679 unsafe impl<
22680 T0: fidl::encoding::Encode<
22681 fidl::encoding::HandleType<
22682 fidl::Thread,
22683 { fidl::ObjectType::THREAD.into_raw() },
22684 2147483648,
22685 >,
22686 fidl::encoding::DefaultFuchsiaResourceDialect,
22687 >,
22688 T1: fidl::encoding::Encode<
22689 fidl::encoding::BoundedString<64>,
22690 fidl::encoding::DefaultFuchsiaResourceDialect,
22691 >,
22692 T2: fidl::encoding::Encode<i64, fidl::encoding::DefaultFuchsiaResourceDialect>,
22693 T3: fidl::encoding::Encode<f32, fidl::encoding::DefaultFuchsiaResourceDialect>,
22694 >
22695 fidl::encoding::Encode<
22696 ProfileProviderRegisterHandlerWithCapacityRequest,
22697 fidl::encoding::DefaultFuchsiaResourceDialect,
22698 > for (T0, T1, T2, T3)
22699 {
22700 #[inline]
22701 unsafe fn encode(
22702 self,
22703 encoder: &mut fidl::encoding::Encoder<
22704 '_,
22705 fidl::encoding::DefaultFuchsiaResourceDialect,
22706 >,
22707 offset: usize,
22708 depth: fidl::encoding::Depth,
22709 ) -> fidl::Result<()> {
22710 encoder.debug_check_bounds::<ProfileProviderRegisterHandlerWithCapacityRequest>(offset);
22711 unsafe {
22714 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
22715 (ptr as *mut u64).write_unaligned(0);
22716 }
22717 unsafe {
22718 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
22719 (ptr as *mut u64).write_unaligned(0);
22720 }
22721 self.0.encode(encoder, offset + 0, depth)?;
22723 self.1.encode(encoder, offset + 8, depth)?;
22724 self.2.encode(encoder, offset + 24, depth)?;
22725 self.3.encode(encoder, offset + 32, depth)?;
22726 Ok(())
22727 }
22728 }
22729
22730 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
22731 for ProfileProviderRegisterHandlerWithCapacityRequest
22732 {
22733 #[inline(always)]
22734 fn new_empty() -> Self {
22735 Self {
22736 thread_handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
22737 name: fidl::new_empty!(
22738 fidl::encoding::BoundedString<64>,
22739 fidl::encoding::DefaultFuchsiaResourceDialect
22740 ),
22741 period: fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect),
22742 capacity: fidl::new_empty!(f32, fidl::encoding::DefaultFuchsiaResourceDialect),
22743 }
22744 }
22745
22746 #[inline]
22747 unsafe fn decode(
22748 &mut self,
22749 decoder: &mut fidl::encoding::Decoder<
22750 '_,
22751 fidl::encoding::DefaultFuchsiaResourceDialect,
22752 >,
22753 offset: usize,
22754 _depth: fidl::encoding::Depth,
22755 ) -> fidl::Result<()> {
22756 decoder.debug_check_bounds::<Self>(offset);
22757 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
22759 let padval = unsafe { (ptr as *const u64).read_unaligned() };
22760 let mask = 0xffffffff00000000u64;
22761 let maskedval = padval & mask;
22762 if maskedval != 0 {
22763 return Err(fidl::Error::NonZeroPadding {
22764 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
22765 });
22766 }
22767 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
22768 let padval = unsafe { (ptr as *const u64).read_unaligned() };
22769 let mask = 0xffffffff00000000u64;
22770 let maskedval = padval & mask;
22771 if maskedval != 0 {
22772 return Err(fidl::Error::NonZeroPadding {
22773 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
22774 });
22775 }
22776 fidl::decode!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.thread_handle, decoder, offset + 0, _depth)?;
22777 fidl::decode!(
22778 fidl::encoding::BoundedString<64>,
22779 fidl::encoding::DefaultFuchsiaResourceDialect,
22780 &mut self.name,
22781 decoder,
22782 offset + 8,
22783 _depth
22784 )?;
22785 fidl::decode!(
22786 i64,
22787 fidl::encoding::DefaultFuchsiaResourceDialect,
22788 &mut self.period,
22789 decoder,
22790 offset + 24,
22791 _depth
22792 )?;
22793 fidl::decode!(
22794 f32,
22795 fidl::encoding::DefaultFuchsiaResourceDialect,
22796 &mut self.capacity,
22797 decoder,
22798 offset + 32,
22799 _depth
22800 )?;
22801 Ok(())
22802 }
22803 }
22804
22805 impl fidl::encoding::ResourceTypeMarker for ProfileProviderRegisterMemoryRangeRequest {
22806 type Borrowed<'a> = &'a mut Self;
22807 fn take_or_borrow<'a>(
22808 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
22809 ) -> Self::Borrowed<'a> {
22810 value
22811 }
22812 }
22813
22814 unsafe impl fidl::encoding::TypeMarker for ProfileProviderRegisterMemoryRangeRequest {
22815 type Owned = Self;
22816
22817 #[inline(always)]
22818 fn inline_align(_context: fidl::encoding::Context) -> usize {
22819 8
22820 }
22821
22822 #[inline(always)]
22823 fn inline_size(_context: fidl::encoding::Context) -> usize {
22824 24
22825 }
22826 }
22827
22828 unsafe impl
22829 fidl::encoding::Encode<
22830 ProfileProviderRegisterMemoryRangeRequest,
22831 fidl::encoding::DefaultFuchsiaResourceDialect,
22832 > for &mut ProfileProviderRegisterMemoryRangeRequest
22833 {
22834 #[inline]
22835 unsafe fn encode(
22836 self,
22837 encoder: &mut fidl::encoding::Encoder<
22838 '_,
22839 fidl::encoding::DefaultFuchsiaResourceDialect,
22840 >,
22841 offset: usize,
22842 _depth: fidl::encoding::Depth,
22843 ) -> fidl::Result<()> {
22844 encoder.debug_check_bounds::<ProfileProviderRegisterMemoryRangeRequest>(offset);
22845 fidl::encoding::Encode::<
22847 ProfileProviderRegisterMemoryRangeRequest,
22848 fidl::encoding::DefaultFuchsiaResourceDialect,
22849 >::encode(
22850 (
22851 <fidl::encoding::HandleType<
22852 fidl::Vmar,
22853 { fidl::ObjectType::VMAR.into_raw() },
22854 2147483648,
22855 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
22856 &mut self.vmar_handle
22857 ),
22858 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
22859 &self.name,
22860 ),
22861 ),
22862 encoder,
22863 offset,
22864 _depth,
22865 )
22866 }
22867 }
22868 unsafe impl<
22869 T0: fidl::encoding::Encode<
22870 fidl::encoding::HandleType<
22871 fidl::Vmar,
22872 { fidl::ObjectType::VMAR.into_raw() },
22873 2147483648,
22874 >,
22875 fidl::encoding::DefaultFuchsiaResourceDialect,
22876 >,
22877 T1: fidl::encoding::Encode<
22878 fidl::encoding::BoundedString<64>,
22879 fidl::encoding::DefaultFuchsiaResourceDialect,
22880 >,
22881 >
22882 fidl::encoding::Encode<
22883 ProfileProviderRegisterMemoryRangeRequest,
22884 fidl::encoding::DefaultFuchsiaResourceDialect,
22885 > for (T0, T1)
22886 {
22887 #[inline]
22888 unsafe fn encode(
22889 self,
22890 encoder: &mut fidl::encoding::Encoder<
22891 '_,
22892 fidl::encoding::DefaultFuchsiaResourceDialect,
22893 >,
22894 offset: usize,
22895 depth: fidl::encoding::Depth,
22896 ) -> fidl::Result<()> {
22897 encoder.debug_check_bounds::<ProfileProviderRegisterMemoryRangeRequest>(offset);
22898 unsafe {
22901 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
22902 (ptr as *mut u64).write_unaligned(0);
22903 }
22904 self.0.encode(encoder, offset + 0, depth)?;
22906 self.1.encode(encoder, offset + 8, depth)?;
22907 Ok(())
22908 }
22909 }
22910
22911 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
22912 for ProfileProviderRegisterMemoryRangeRequest
22913 {
22914 #[inline(always)]
22915 fn new_empty() -> Self {
22916 Self {
22917 vmar_handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
22918 name: fidl::new_empty!(
22919 fidl::encoding::BoundedString<64>,
22920 fidl::encoding::DefaultFuchsiaResourceDialect
22921 ),
22922 }
22923 }
22924
22925 #[inline]
22926 unsafe fn decode(
22927 &mut self,
22928 decoder: &mut fidl::encoding::Decoder<
22929 '_,
22930 fidl::encoding::DefaultFuchsiaResourceDialect,
22931 >,
22932 offset: usize,
22933 _depth: fidl::encoding::Depth,
22934 ) -> fidl::Result<()> {
22935 decoder.debug_check_bounds::<Self>(offset);
22936 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
22938 let padval = unsafe { (ptr as *const u64).read_unaligned() };
22939 let mask = 0xffffffff00000000u64;
22940 let maskedval = padval & mask;
22941 if maskedval != 0 {
22942 return Err(fidl::Error::NonZeroPadding {
22943 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
22944 });
22945 }
22946 fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmar_handle, decoder, offset + 0, _depth)?;
22947 fidl::decode!(
22948 fidl::encoding::BoundedString<64>,
22949 fidl::encoding::DefaultFuchsiaResourceDialect,
22950 &mut self.name,
22951 decoder,
22952 offset + 8,
22953 _depth
22954 )?;
22955 Ok(())
22956 }
22957 }
22958
22959 impl fidl::encoding::ResourceTypeMarker for ProfileProviderUnregisterHandlerRequest {
22960 type Borrowed<'a> = &'a mut Self;
22961 fn take_or_borrow<'a>(
22962 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
22963 ) -> Self::Borrowed<'a> {
22964 value
22965 }
22966 }
22967
22968 unsafe impl fidl::encoding::TypeMarker for ProfileProviderUnregisterHandlerRequest {
22969 type Owned = Self;
22970
22971 #[inline(always)]
22972 fn inline_align(_context: fidl::encoding::Context) -> usize {
22973 8
22974 }
22975
22976 #[inline(always)]
22977 fn inline_size(_context: fidl::encoding::Context) -> usize {
22978 24
22979 }
22980 }
22981
22982 unsafe impl
22983 fidl::encoding::Encode<
22984 ProfileProviderUnregisterHandlerRequest,
22985 fidl::encoding::DefaultFuchsiaResourceDialect,
22986 > for &mut ProfileProviderUnregisterHandlerRequest
22987 {
22988 #[inline]
22989 unsafe fn encode(
22990 self,
22991 encoder: &mut fidl::encoding::Encoder<
22992 '_,
22993 fidl::encoding::DefaultFuchsiaResourceDialect,
22994 >,
22995 offset: usize,
22996 _depth: fidl::encoding::Depth,
22997 ) -> fidl::Result<()> {
22998 encoder.debug_check_bounds::<ProfileProviderUnregisterHandlerRequest>(offset);
22999 fidl::encoding::Encode::<
23001 ProfileProviderUnregisterHandlerRequest,
23002 fidl::encoding::DefaultFuchsiaResourceDialect,
23003 >::encode(
23004 (
23005 <fidl::encoding::HandleType<
23006 fidl::Thread,
23007 { fidl::ObjectType::THREAD.into_raw() },
23008 2147483648,
23009 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
23010 &mut self.thread_handle,
23011 ),
23012 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
23013 &self.name,
23014 ),
23015 ),
23016 encoder,
23017 offset,
23018 _depth,
23019 )
23020 }
23021 }
23022 unsafe impl<
23023 T0: fidl::encoding::Encode<
23024 fidl::encoding::HandleType<
23025 fidl::Thread,
23026 { fidl::ObjectType::THREAD.into_raw() },
23027 2147483648,
23028 >,
23029 fidl::encoding::DefaultFuchsiaResourceDialect,
23030 >,
23031 T1: fidl::encoding::Encode<
23032 fidl::encoding::BoundedString<64>,
23033 fidl::encoding::DefaultFuchsiaResourceDialect,
23034 >,
23035 >
23036 fidl::encoding::Encode<
23037 ProfileProviderUnregisterHandlerRequest,
23038 fidl::encoding::DefaultFuchsiaResourceDialect,
23039 > for (T0, T1)
23040 {
23041 #[inline]
23042 unsafe fn encode(
23043 self,
23044 encoder: &mut fidl::encoding::Encoder<
23045 '_,
23046 fidl::encoding::DefaultFuchsiaResourceDialect,
23047 >,
23048 offset: usize,
23049 depth: fidl::encoding::Depth,
23050 ) -> fidl::Result<()> {
23051 encoder.debug_check_bounds::<ProfileProviderUnregisterHandlerRequest>(offset);
23052 unsafe {
23055 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
23056 (ptr as *mut u64).write_unaligned(0);
23057 }
23058 self.0.encode(encoder, offset + 0, depth)?;
23060 self.1.encode(encoder, offset + 8, depth)?;
23061 Ok(())
23062 }
23063 }
23064
23065 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
23066 for ProfileProviderUnregisterHandlerRequest
23067 {
23068 #[inline(always)]
23069 fn new_empty() -> Self {
23070 Self {
23071 thread_handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
23072 name: fidl::new_empty!(
23073 fidl::encoding::BoundedString<64>,
23074 fidl::encoding::DefaultFuchsiaResourceDialect
23075 ),
23076 }
23077 }
23078
23079 #[inline]
23080 unsafe fn decode(
23081 &mut self,
23082 decoder: &mut fidl::encoding::Decoder<
23083 '_,
23084 fidl::encoding::DefaultFuchsiaResourceDialect,
23085 >,
23086 offset: usize,
23087 _depth: fidl::encoding::Depth,
23088 ) -> fidl::Result<()> {
23089 decoder.debug_check_bounds::<Self>(offset);
23090 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
23092 let padval = unsafe { (ptr as *const u64).read_unaligned() };
23093 let mask = 0xffffffff00000000u64;
23094 let maskedval = padval & mask;
23095 if maskedval != 0 {
23096 return Err(fidl::Error::NonZeroPadding {
23097 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
23098 });
23099 }
23100 fidl::decode!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.thread_handle, decoder, offset + 0, _depth)?;
23101 fidl::decode!(
23102 fidl::encoding::BoundedString<64>,
23103 fidl::encoding::DefaultFuchsiaResourceDialect,
23104 &mut self.name,
23105 decoder,
23106 offset + 8,
23107 _depth
23108 )?;
23109 Ok(())
23110 }
23111 }
23112
23113 impl fidl::encoding::ResourceTypeMarker for ProfileProviderUnregisterMemoryRangeRequest {
23114 type Borrowed<'a> = &'a mut Self;
23115 fn take_or_borrow<'a>(
23116 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
23117 ) -> Self::Borrowed<'a> {
23118 value
23119 }
23120 }
23121
23122 unsafe impl fidl::encoding::TypeMarker for ProfileProviderUnregisterMemoryRangeRequest {
23123 type Owned = Self;
23124
23125 #[inline(always)]
23126 fn inline_align(_context: fidl::encoding::Context) -> usize {
23127 4
23128 }
23129
23130 #[inline(always)]
23131 fn inline_size(_context: fidl::encoding::Context) -> usize {
23132 4
23133 }
23134 }
23135
23136 unsafe impl
23137 fidl::encoding::Encode<
23138 ProfileProviderUnregisterMemoryRangeRequest,
23139 fidl::encoding::DefaultFuchsiaResourceDialect,
23140 > for &mut ProfileProviderUnregisterMemoryRangeRequest
23141 {
23142 #[inline]
23143 unsafe fn encode(
23144 self,
23145 encoder: &mut fidl::encoding::Encoder<
23146 '_,
23147 fidl::encoding::DefaultFuchsiaResourceDialect,
23148 >,
23149 offset: usize,
23150 _depth: fidl::encoding::Depth,
23151 ) -> fidl::Result<()> {
23152 encoder.debug_check_bounds::<ProfileProviderUnregisterMemoryRangeRequest>(offset);
23153 fidl::encoding::Encode::<
23155 ProfileProviderUnregisterMemoryRangeRequest,
23156 fidl::encoding::DefaultFuchsiaResourceDialect,
23157 >::encode(
23158 (<fidl::encoding::HandleType<
23159 fidl::Vmar,
23160 { fidl::ObjectType::VMAR.into_raw() },
23161 2147483648,
23162 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
23163 &mut self.vmar_handle
23164 ),),
23165 encoder,
23166 offset,
23167 _depth,
23168 )
23169 }
23170 }
23171 unsafe impl<
23172 T0: fidl::encoding::Encode<
23173 fidl::encoding::HandleType<
23174 fidl::Vmar,
23175 { fidl::ObjectType::VMAR.into_raw() },
23176 2147483648,
23177 >,
23178 fidl::encoding::DefaultFuchsiaResourceDialect,
23179 >,
23180 >
23181 fidl::encoding::Encode<
23182 ProfileProviderUnregisterMemoryRangeRequest,
23183 fidl::encoding::DefaultFuchsiaResourceDialect,
23184 > for (T0,)
23185 {
23186 #[inline]
23187 unsafe fn encode(
23188 self,
23189 encoder: &mut fidl::encoding::Encoder<
23190 '_,
23191 fidl::encoding::DefaultFuchsiaResourceDialect,
23192 >,
23193 offset: usize,
23194 depth: fidl::encoding::Depth,
23195 ) -> fidl::Result<()> {
23196 encoder.debug_check_bounds::<ProfileProviderUnregisterMemoryRangeRequest>(offset);
23197 self.0.encode(encoder, offset + 0, depth)?;
23201 Ok(())
23202 }
23203 }
23204
23205 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
23206 for ProfileProviderUnregisterMemoryRangeRequest
23207 {
23208 #[inline(always)]
23209 fn new_empty() -> Self {
23210 Self {
23211 vmar_handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
23212 }
23213 }
23214
23215 #[inline]
23216 unsafe fn decode(
23217 &mut self,
23218 decoder: &mut fidl::encoding::Decoder<
23219 '_,
23220 fidl::encoding::DefaultFuchsiaResourceDialect,
23221 >,
23222 offset: usize,
23223 _depth: fidl::encoding::Depth,
23224 ) -> fidl::Result<()> {
23225 decoder.debug_check_bounds::<Self>(offset);
23226 fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmar_handle, decoder, offset + 0, _depth)?;
23228 Ok(())
23229 }
23230 }
23231
23232 impl fidl::encoding::ResourceTypeMarker for SessionAudioConsumerFactoryCreateAudioConsumerRequest {
23233 type Borrowed<'a> = &'a mut Self;
23234 fn take_or_borrow<'a>(
23235 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
23236 ) -> Self::Borrowed<'a> {
23237 value
23238 }
23239 }
23240
23241 unsafe impl fidl::encoding::TypeMarker for SessionAudioConsumerFactoryCreateAudioConsumerRequest {
23242 type Owned = Self;
23243
23244 #[inline(always)]
23245 fn inline_align(_context: fidl::encoding::Context) -> usize {
23246 8
23247 }
23248
23249 #[inline(always)]
23250 fn inline_size(_context: fidl::encoding::Context) -> usize {
23251 16
23252 }
23253 }
23254
23255 unsafe impl
23256 fidl::encoding::Encode<
23257 SessionAudioConsumerFactoryCreateAudioConsumerRequest,
23258 fidl::encoding::DefaultFuchsiaResourceDialect,
23259 > for &mut SessionAudioConsumerFactoryCreateAudioConsumerRequest
23260 {
23261 #[inline]
23262 unsafe fn encode(
23263 self,
23264 encoder: &mut fidl::encoding::Encoder<
23265 '_,
23266 fidl::encoding::DefaultFuchsiaResourceDialect,
23267 >,
23268 offset: usize,
23269 _depth: fidl::encoding::Depth,
23270 ) -> fidl::Result<()> {
23271 encoder.debug_check_bounds::<SessionAudioConsumerFactoryCreateAudioConsumerRequest>(
23272 offset,
23273 );
23274 fidl::encoding::Encode::<SessionAudioConsumerFactoryCreateAudioConsumerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
23276 (
23277 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.session_id),
23278 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_consumer_request),
23279 ),
23280 encoder, offset, _depth
23281 )
23282 }
23283 }
23284 unsafe impl<
23285 T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
23286 T1: fidl::encoding::Encode<
23287 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
23288 fidl::encoding::DefaultFuchsiaResourceDialect,
23289 >,
23290 >
23291 fidl::encoding::Encode<
23292 SessionAudioConsumerFactoryCreateAudioConsumerRequest,
23293 fidl::encoding::DefaultFuchsiaResourceDialect,
23294 > for (T0, T1)
23295 {
23296 #[inline]
23297 unsafe fn encode(
23298 self,
23299 encoder: &mut fidl::encoding::Encoder<
23300 '_,
23301 fidl::encoding::DefaultFuchsiaResourceDialect,
23302 >,
23303 offset: usize,
23304 depth: fidl::encoding::Depth,
23305 ) -> fidl::Result<()> {
23306 encoder.debug_check_bounds::<SessionAudioConsumerFactoryCreateAudioConsumerRequest>(
23307 offset,
23308 );
23309 unsafe {
23312 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
23313 (ptr as *mut u64).write_unaligned(0);
23314 }
23315 self.0.encode(encoder, offset + 0, depth)?;
23317 self.1.encode(encoder, offset + 8, depth)?;
23318 Ok(())
23319 }
23320 }
23321
23322 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
23323 for SessionAudioConsumerFactoryCreateAudioConsumerRequest
23324 {
23325 #[inline(always)]
23326 fn new_empty() -> Self {
23327 Self {
23328 session_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
23329 audio_consumer_request: fidl::new_empty!(
23330 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
23331 fidl::encoding::DefaultFuchsiaResourceDialect
23332 ),
23333 }
23334 }
23335
23336 #[inline]
23337 unsafe fn decode(
23338 &mut self,
23339 decoder: &mut fidl::encoding::Decoder<
23340 '_,
23341 fidl::encoding::DefaultFuchsiaResourceDialect,
23342 >,
23343 offset: usize,
23344 _depth: fidl::encoding::Depth,
23345 ) -> fidl::Result<()> {
23346 decoder.debug_check_bounds::<Self>(offset);
23347 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
23349 let padval = unsafe { (ptr as *const u64).read_unaligned() };
23350 let mask = 0xffffffff00000000u64;
23351 let maskedval = padval & mask;
23352 if maskedval != 0 {
23353 return Err(fidl::Error::NonZeroPadding {
23354 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
23355 });
23356 }
23357 fidl::decode!(
23358 u64,
23359 fidl::encoding::DefaultFuchsiaResourceDialect,
23360 &mut self.session_id,
23361 decoder,
23362 offset + 0,
23363 _depth
23364 )?;
23365 fidl::decode!(
23366 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
23367 fidl::encoding::DefaultFuchsiaResourceDialect,
23368 &mut self.audio_consumer_request,
23369 decoder,
23370 offset + 8,
23371 _depth
23372 )?;
23373 Ok(())
23374 }
23375 }
23376
23377 impl fidl::encoding::ResourceTypeMarker for StreamBufferSetAddPayloadBufferRequest {
23378 type Borrowed<'a> = &'a mut Self;
23379 fn take_or_borrow<'a>(
23380 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
23381 ) -> Self::Borrowed<'a> {
23382 value
23383 }
23384 }
23385
23386 unsafe impl fidl::encoding::TypeMarker for StreamBufferSetAddPayloadBufferRequest {
23387 type Owned = Self;
23388
23389 #[inline(always)]
23390 fn inline_align(_context: fidl::encoding::Context) -> usize {
23391 4
23392 }
23393
23394 #[inline(always)]
23395 fn inline_size(_context: fidl::encoding::Context) -> usize {
23396 8
23397 }
23398 }
23399
23400 unsafe impl
23401 fidl::encoding::Encode<
23402 StreamBufferSetAddPayloadBufferRequest,
23403 fidl::encoding::DefaultFuchsiaResourceDialect,
23404 > for &mut StreamBufferSetAddPayloadBufferRequest
23405 {
23406 #[inline]
23407 unsafe fn encode(
23408 self,
23409 encoder: &mut fidl::encoding::Encoder<
23410 '_,
23411 fidl::encoding::DefaultFuchsiaResourceDialect,
23412 >,
23413 offset: usize,
23414 _depth: fidl::encoding::Depth,
23415 ) -> fidl::Result<()> {
23416 encoder.debug_check_bounds::<StreamBufferSetAddPayloadBufferRequest>(offset);
23417 fidl::encoding::Encode::<
23419 StreamBufferSetAddPayloadBufferRequest,
23420 fidl::encoding::DefaultFuchsiaResourceDialect,
23421 >::encode(
23422 (
23423 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
23424 <fidl::encoding::HandleType<
23425 fidl::Vmo,
23426 { fidl::ObjectType::VMO.into_raw() },
23427 2147483648,
23428 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
23429 &mut self.payload_buffer,
23430 ),
23431 ),
23432 encoder,
23433 offset,
23434 _depth,
23435 )
23436 }
23437 }
23438 unsafe impl<
23439 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
23440 T1: fidl::encoding::Encode<
23441 fidl::encoding::HandleType<
23442 fidl::Vmo,
23443 { fidl::ObjectType::VMO.into_raw() },
23444 2147483648,
23445 >,
23446 fidl::encoding::DefaultFuchsiaResourceDialect,
23447 >,
23448 >
23449 fidl::encoding::Encode<
23450 StreamBufferSetAddPayloadBufferRequest,
23451 fidl::encoding::DefaultFuchsiaResourceDialect,
23452 > for (T0, T1)
23453 {
23454 #[inline]
23455 unsafe fn encode(
23456 self,
23457 encoder: &mut fidl::encoding::Encoder<
23458 '_,
23459 fidl::encoding::DefaultFuchsiaResourceDialect,
23460 >,
23461 offset: usize,
23462 depth: fidl::encoding::Depth,
23463 ) -> fidl::Result<()> {
23464 encoder.debug_check_bounds::<StreamBufferSetAddPayloadBufferRequest>(offset);
23465 self.0.encode(encoder, offset + 0, depth)?;
23469 self.1.encode(encoder, offset + 4, depth)?;
23470 Ok(())
23471 }
23472 }
23473
23474 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
23475 for StreamBufferSetAddPayloadBufferRequest
23476 {
23477 #[inline(always)]
23478 fn new_empty() -> Self {
23479 Self {
23480 id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
23481 payload_buffer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
23482 }
23483 }
23484
23485 #[inline]
23486 unsafe fn decode(
23487 &mut self,
23488 decoder: &mut fidl::encoding::Decoder<
23489 '_,
23490 fidl::encoding::DefaultFuchsiaResourceDialect,
23491 >,
23492 offset: usize,
23493 _depth: fidl::encoding::Depth,
23494 ) -> fidl::Result<()> {
23495 decoder.debug_check_bounds::<Self>(offset);
23496 fidl::decode!(
23498 u32,
23499 fidl::encoding::DefaultFuchsiaResourceDialect,
23500 &mut self.id,
23501 decoder,
23502 offset + 0,
23503 _depth
23504 )?;
23505 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.payload_buffer, decoder, offset + 4, _depth)?;
23506 Ok(())
23507 }
23508 }
23509
23510 impl fidl::encoding::ResourceTypeMarker for StreamProcessorSetInputBufferPartialSettingsRequest {
23511 type Borrowed<'a> = &'a mut Self;
23512 fn take_or_borrow<'a>(
23513 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
23514 ) -> Self::Borrowed<'a> {
23515 value
23516 }
23517 }
23518
23519 unsafe impl fidl::encoding::TypeMarker for StreamProcessorSetInputBufferPartialSettingsRequest {
23520 type Owned = Self;
23521
23522 #[inline(always)]
23523 fn inline_align(_context: fidl::encoding::Context) -> usize {
23524 8
23525 }
23526
23527 #[inline(always)]
23528 fn inline_size(_context: fidl::encoding::Context) -> usize {
23529 16
23530 }
23531 }
23532
23533 unsafe impl
23534 fidl::encoding::Encode<
23535 StreamProcessorSetInputBufferPartialSettingsRequest,
23536 fidl::encoding::DefaultFuchsiaResourceDialect,
23537 > for &mut StreamProcessorSetInputBufferPartialSettingsRequest
23538 {
23539 #[inline]
23540 unsafe fn encode(
23541 self,
23542 encoder: &mut fidl::encoding::Encoder<
23543 '_,
23544 fidl::encoding::DefaultFuchsiaResourceDialect,
23545 >,
23546 offset: usize,
23547 _depth: fidl::encoding::Depth,
23548 ) -> fidl::Result<()> {
23549 encoder
23550 .debug_check_bounds::<StreamProcessorSetInputBufferPartialSettingsRequest>(offset);
23551 fidl::encoding::Encode::<StreamProcessorSetInputBufferPartialSettingsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
23553 (
23554 <StreamBufferPartialSettings as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.input_settings),
23555 ),
23556 encoder, offset, _depth
23557 )
23558 }
23559 }
23560 unsafe impl<
23561 T0: fidl::encoding::Encode<
23562 StreamBufferPartialSettings,
23563 fidl::encoding::DefaultFuchsiaResourceDialect,
23564 >,
23565 >
23566 fidl::encoding::Encode<
23567 StreamProcessorSetInputBufferPartialSettingsRequest,
23568 fidl::encoding::DefaultFuchsiaResourceDialect,
23569 > for (T0,)
23570 {
23571 #[inline]
23572 unsafe fn encode(
23573 self,
23574 encoder: &mut fidl::encoding::Encoder<
23575 '_,
23576 fidl::encoding::DefaultFuchsiaResourceDialect,
23577 >,
23578 offset: usize,
23579 depth: fidl::encoding::Depth,
23580 ) -> fidl::Result<()> {
23581 encoder
23582 .debug_check_bounds::<StreamProcessorSetInputBufferPartialSettingsRequest>(offset);
23583 self.0.encode(encoder, offset + 0, depth)?;
23587 Ok(())
23588 }
23589 }
23590
23591 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
23592 for StreamProcessorSetInputBufferPartialSettingsRequest
23593 {
23594 #[inline(always)]
23595 fn new_empty() -> Self {
23596 Self {
23597 input_settings: fidl::new_empty!(
23598 StreamBufferPartialSettings,
23599 fidl::encoding::DefaultFuchsiaResourceDialect
23600 ),
23601 }
23602 }
23603
23604 #[inline]
23605 unsafe fn decode(
23606 &mut self,
23607 decoder: &mut fidl::encoding::Decoder<
23608 '_,
23609 fidl::encoding::DefaultFuchsiaResourceDialect,
23610 >,
23611 offset: usize,
23612 _depth: fidl::encoding::Depth,
23613 ) -> fidl::Result<()> {
23614 decoder.debug_check_bounds::<Self>(offset);
23615 fidl::decode!(
23617 StreamBufferPartialSettings,
23618 fidl::encoding::DefaultFuchsiaResourceDialect,
23619 &mut self.input_settings,
23620 decoder,
23621 offset + 0,
23622 _depth
23623 )?;
23624 Ok(())
23625 }
23626 }
23627
23628 impl fidl::encoding::ResourceTypeMarker for StreamProcessorSetOutputBufferPartialSettingsRequest {
23629 type Borrowed<'a> = &'a mut Self;
23630 fn take_or_borrow<'a>(
23631 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
23632 ) -> Self::Borrowed<'a> {
23633 value
23634 }
23635 }
23636
23637 unsafe impl fidl::encoding::TypeMarker for StreamProcessorSetOutputBufferPartialSettingsRequest {
23638 type Owned = Self;
23639
23640 #[inline(always)]
23641 fn inline_align(_context: fidl::encoding::Context) -> usize {
23642 8
23643 }
23644
23645 #[inline(always)]
23646 fn inline_size(_context: fidl::encoding::Context) -> usize {
23647 16
23648 }
23649 }
23650
23651 unsafe impl
23652 fidl::encoding::Encode<
23653 StreamProcessorSetOutputBufferPartialSettingsRequest,
23654 fidl::encoding::DefaultFuchsiaResourceDialect,
23655 > for &mut StreamProcessorSetOutputBufferPartialSettingsRequest
23656 {
23657 #[inline]
23658 unsafe fn encode(
23659 self,
23660 encoder: &mut fidl::encoding::Encoder<
23661 '_,
23662 fidl::encoding::DefaultFuchsiaResourceDialect,
23663 >,
23664 offset: usize,
23665 _depth: fidl::encoding::Depth,
23666 ) -> fidl::Result<()> {
23667 encoder
23668 .debug_check_bounds::<StreamProcessorSetOutputBufferPartialSettingsRequest>(offset);
23669 fidl::encoding::Encode::<StreamProcessorSetOutputBufferPartialSettingsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
23671 (
23672 <StreamBufferPartialSettings as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.output_settings),
23673 ),
23674 encoder, offset, _depth
23675 )
23676 }
23677 }
23678 unsafe impl<
23679 T0: fidl::encoding::Encode<
23680 StreamBufferPartialSettings,
23681 fidl::encoding::DefaultFuchsiaResourceDialect,
23682 >,
23683 >
23684 fidl::encoding::Encode<
23685 StreamProcessorSetOutputBufferPartialSettingsRequest,
23686 fidl::encoding::DefaultFuchsiaResourceDialect,
23687 > for (T0,)
23688 {
23689 #[inline]
23690 unsafe fn encode(
23691 self,
23692 encoder: &mut fidl::encoding::Encoder<
23693 '_,
23694 fidl::encoding::DefaultFuchsiaResourceDialect,
23695 >,
23696 offset: usize,
23697 depth: fidl::encoding::Depth,
23698 ) -> fidl::Result<()> {
23699 encoder
23700 .debug_check_bounds::<StreamProcessorSetOutputBufferPartialSettingsRequest>(offset);
23701 self.0.encode(encoder, offset + 0, depth)?;
23705 Ok(())
23706 }
23707 }
23708
23709 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
23710 for StreamProcessorSetOutputBufferPartialSettingsRequest
23711 {
23712 #[inline(always)]
23713 fn new_empty() -> Self {
23714 Self {
23715 output_settings: fidl::new_empty!(
23716 StreamBufferPartialSettings,
23717 fidl::encoding::DefaultFuchsiaResourceDialect
23718 ),
23719 }
23720 }
23721
23722 #[inline]
23723 unsafe fn decode(
23724 &mut self,
23725 decoder: &mut fidl::encoding::Decoder<
23726 '_,
23727 fidl::encoding::DefaultFuchsiaResourceDialect,
23728 >,
23729 offset: usize,
23730 _depth: fidl::encoding::Depth,
23731 ) -> fidl::Result<()> {
23732 decoder.debug_check_bounds::<Self>(offset);
23733 fidl::decode!(
23735 StreamBufferPartialSettings,
23736 fidl::encoding::DefaultFuchsiaResourceDialect,
23737 &mut self.output_settings,
23738 decoder,
23739 offset + 0,
23740 _depth
23741 )?;
23742 Ok(())
23743 }
23744 }
23745
23746 impl fidl::encoding::ResourceTypeMarker for Usage2AudioConsumerFactoryCreateAudioConsumerRequest {
23747 type Borrowed<'a> = &'a mut Self;
23748 fn take_or_borrow<'a>(
23749 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
23750 ) -> Self::Borrowed<'a> {
23751 value
23752 }
23753 }
23754
23755 unsafe impl fidl::encoding::TypeMarker for Usage2AudioConsumerFactoryCreateAudioConsumerRequest {
23756 type Owned = Self;
23757
23758 #[inline(always)]
23759 fn inline_align(_context: fidl::encoding::Context) -> usize {
23760 4
23761 }
23762
23763 #[inline(always)]
23764 fn inline_size(_context: fidl::encoding::Context) -> usize {
23765 8
23766 }
23767 }
23768
23769 unsafe impl
23770 fidl::encoding::Encode<
23771 Usage2AudioConsumerFactoryCreateAudioConsumerRequest,
23772 fidl::encoding::DefaultFuchsiaResourceDialect,
23773 > for &mut Usage2AudioConsumerFactoryCreateAudioConsumerRequest
23774 {
23775 #[inline]
23776 unsafe fn encode(
23777 self,
23778 encoder: &mut fidl::encoding::Encoder<
23779 '_,
23780 fidl::encoding::DefaultFuchsiaResourceDialect,
23781 >,
23782 offset: usize,
23783 _depth: fidl::encoding::Depth,
23784 ) -> fidl::Result<()> {
23785 encoder
23786 .debug_check_bounds::<Usage2AudioConsumerFactoryCreateAudioConsumerRequest>(offset);
23787 fidl::encoding::Encode::<Usage2AudioConsumerFactoryCreateAudioConsumerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
23789 (
23790 <AudioRenderUsage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
23791 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_consumer_request),
23792 ),
23793 encoder, offset, _depth
23794 )
23795 }
23796 }
23797 unsafe impl<
23798 T0: fidl::encoding::Encode<
23799 AudioRenderUsage2,
23800 fidl::encoding::DefaultFuchsiaResourceDialect,
23801 >,
23802 T1: fidl::encoding::Encode<
23803 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
23804 fidl::encoding::DefaultFuchsiaResourceDialect,
23805 >,
23806 >
23807 fidl::encoding::Encode<
23808 Usage2AudioConsumerFactoryCreateAudioConsumerRequest,
23809 fidl::encoding::DefaultFuchsiaResourceDialect,
23810 > for (T0, T1)
23811 {
23812 #[inline]
23813 unsafe fn encode(
23814 self,
23815 encoder: &mut fidl::encoding::Encoder<
23816 '_,
23817 fidl::encoding::DefaultFuchsiaResourceDialect,
23818 >,
23819 offset: usize,
23820 depth: fidl::encoding::Depth,
23821 ) -> fidl::Result<()> {
23822 encoder
23823 .debug_check_bounds::<Usage2AudioConsumerFactoryCreateAudioConsumerRequest>(offset);
23824 self.0.encode(encoder, offset + 0, depth)?;
23828 self.1.encode(encoder, offset + 4, depth)?;
23829 Ok(())
23830 }
23831 }
23832
23833 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
23834 for Usage2AudioConsumerFactoryCreateAudioConsumerRequest
23835 {
23836 #[inline(always)]
23837 fn new_empty() -> Self {
23838 Self {
23839 usage: fidl::new_empty!(
23840 AudioRenderUsage2,
23841 fidl::encoding::DefaultFuchsiaResourceDialect
23842 ),
23843 audio_consumer_request: fidl::new_empty!(
23844 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
23845 fidl::encoding::DefaultFuchsiaResourceDialect
23846 ),
23847 }
23848 }
23849
23850 #[inline]
23851 unsafe fn decode(
23852 &mut self,
23853 decoder: &mut fidl::encoding::Decoder<
23854 '_,
23855 fidl::encoding::DefaultFuchsiaResourceDialect,
23856 >,
23857 offset: usize,
23858 _depth: fidl::encoding::Depth,
23859 ) -> fidl::Result<()> {
23860 decoder.debug_check_bounds::<Self>(offset);
23861 fidl::decode!(
23863 AudioRenderUsage2,
23864 fidl::encoding::DefaultFuchsiaResourceDialect,
23865 &mut self.usage,
23866 decoder,
23867 offset + 0,
23868 _depth
23869 )?;
23870 fidl::decode!(
23871 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
23872 fidl::encoding::DefaultFuchsiaResourceDialect,
23873 &mut self.audio_consumer_request,
23874 decoder,
23875 offset + 4,
23876 _depth
23877 )?;
23878 Ok(())
23879 }
23880 }
23881
23882 impl fidl::encoding::ResourceTypeMarker for UsageAudioConsumerFactoryCreateAudioConsumerRequest {
23883 type Borrowed<'a> = &'a mut Self;
23884 fn take_or_borrow<'a>(
23885 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
23886 ) -> Self::Borrowed<'a> {
23887 value
23888 }
23889 }
23890
23891 unsafe impl fidl::encoding::TypeMarker for UsageAudioConsumerFactoryCreateAudioConsumerRequest {
23892 type Owned = Self;
23893
23894 #[inline(always)]
23895 fn inline_align(_context: fidl::encoding::Context) -> usize {
23896 4
23897 }
23898
23899 #[inline(always)]
23900 fn inline_size(_context: fidl::encoding::Context) -> usize {
23901 8
23902 }
23903 }
23904
23905 unsafe impl
23906 fidl::encoding::Encode<
23907 UsageAudioConsumerFactoryCreateAudioConsumerRequest,
23908 fidl::encoding::DefaultFuchsiaResourceDialect,
23909 > for &mut UsageAudioConsumerFactoryCreateAudioConsumerRequest
23910 {
23911 #[inline]
23912 unsafe fn encode(
23913 self,
23914 encoder: &mut fidl::encoding::Encoder<
23915 '_,
23916 fidl::encoding::DefaultFuchsiaResourceDialect,
23917 >,
23918 offset: usize,
23919 _depth: fidl::encoding::Depth,
23920 ) -> fidl::Result<()> {
23921 encoder
23922 .debug_check_bounds::<UsageAudioConsumerFactoryCreateAudioConsumerRequest>(offset);
23923 fidl::encoding::Encode::<UsageAudioConsumerFactoryCreateAudioConsumerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
23925 (
23926 <AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
23927 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.audio_consumer_request),
23928 ),
23929 encoder, offset, _depth
23930 )
23931 }
23932 }
23933 unsafe impl<
23934 T0: fidl::encoding::Encode<AudioRenderUsage, fidl::encoding::DefaultFuchsiaResourceDialect>,
23935 T1: fidl::encoding::Encode<
23936 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
23937 fidl::encoding::DefaultFuchsiaResourceDialect,
23938 >,
23939 >
23940 fidl::encoding::Encode<
23941 UsageAudioConsumerFactoryCreateAudioConsumerRequest,
23942 fidl::encoding::DefaultFuchsiaResourceDialect,
23943 > for (T0, T1)
23944 {
23945 #[inline]
23946 unsafe fn encode(
23947 self,
23948 encoder: &mut fidl::encoding::Encoder<
23949 '_,
23950 fidl::encoding::DefaultFuchsiaResourceDialect,
23951 >,
23952 offset: usize,
23953 depth: fidl::encoding::Depth,
23954 ) -> fidl::Result<()> {
23955 encoder
23956 .debug_check_bounds::<UsageAudioConsumerFactoryCreateAudioConsumerRequest>(offset);
23957 self.0.encode(encoder, offset + 0, depth)?;
23961 self.1.encode(encoder, offset + 4, depth)?;
23962 Ok(())
23963 }
23964 }
23965
23966 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
23967 for UsageAudioConsumerFactoryCreateAudioConsumerRequest
23968 {
23969 #[inline(always)]
23970 fn new_empty() -> Self {
23971 Self {
23972 usage: fidl::new_empty!(
23973 AudioRenderUsage,
23974 fidl::encoding::DefaultFuchsiaResourceDialect
23975 ),
23976 audio_consumer_request: fidl::new_empty!(
23977 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
23978 fidl::encoding::DefaultFuchsiaResourceDialect
23979 ),
23980 }
23981 }
23982
23983 #[inline]
23984 unsafe fn decode(
23985 &mut self,
23986 decoder: &mut fidl::encoding::Decoder<
23987 '_,
23988 fidl::encoding::DefaultFuchsiaResourceDialect,
23989 >,
23990 offset: usize,
23991 _depth: fidl::encoding::Depth,
23992 ) -> fidl::Result<()> {
23993 decoder.debug_check_bounds::<Self>(offset);
23994 fidl::decode!(
23996 AudioRenderUsage,
23997 fidl::encoding::DefaultFuchsiaResourceDialect,
23998 &mut self.usage,
23999 decoder,
24000 offset + 0,
24001 _depth
24002 )?;
24003 fidl::decode!(
24004 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioConsumerMarker>>,
24005 fidl::encoding::DefaultFuchsiaResourceDialect,
24006 &mut self.audio_consumer_request,
24007 decoder,
24008 offset + 4,
24009 _depth
24010 )?;
24011 Ok(())
24012 }
24013 }
24014
24015 impl fidl::encoding::ResourceTypeMarker for UsageGainReporterRegisterListener2Request {
24016 type Borrowed<'a> = &'a mut Self;
24017 fn take_or_borrow<'a>(
24018 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
24019 ) -> Self::Borrowed<'a> {
24020 value
24021 }
24022 }
24023
24024 unsafe impl fidl::encoding::TypeMarker for UsageGainReporterRegisterListener2Request {
24025 type Owned = Self;
24026
24027 #[inline(always)]
24028 fn inline_align(_context: fidl::encoding::Context) -> usize {
24029 8
24030 }
24031
24032 #[inline(always)]
24033 fn inline_size(_context: fidl::encoding::Context) -> usize {
24034 40
24035 }
24036 }
24037
24038 unsafe impl
24039 fidl::encoding::Encode<
24040 UsageGainReporterRegisterListener2Request,
24041 fidl::encoding::DefaultFuchsiaResourceDialect,
24042 > for &mut UsageGainReporterRegisterListener2Request
24043 {
24044 #[inline]
24045 unsafe fn encode(
24046 self,
24047 encoder: &mut fidl::encoding::Encoder<
24048 '_,
24049 fidl::encoding::DefaultFuchsiaResourceDialect,
24050 >,
24051 offset: usize,
24052 _depth: fidl::encoding::Depth,
24053 ) -> fidl::Result<()> {
24054 encoder.debug_check_bounds::<UsageGainReporterRegisterListener2Request>(offset);
24055 fidl::encoding::Encode::<UsageGainReporterRegisterListener2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
24057 (
24058 <fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_unique_id),
24059 <Usage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
24060 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageGainListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.usage_gain_listener),
24061 ),
24062 encoder, offset, _depth
24063 )
24064 }
24065 }
24066 unsafe impl<
24067 T0: fidl::encoding::Encode<
24068 fidl::encoding::BoundedString<36>,
24069 fidl::encoding::DefaultFuchsiaResourceDialect,
24070 >,
24071 T1: fidl::encoding::Encode<Usage2, fidl::encoding::DefaultFuchsiaResourceDialect>,
24072 T2: fidl::encoding::Encode<
24073 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageGainListenerMarker>>,
24074 fidl::encoding::DefaultFuchsiaResourceDialect,
24075 >,
24076 >
24077 fidl::encoding::Encode<
24078 UsageGainReporterRegisterListener2Request,
24079 fidl::encoding::DefaultFuchsiaResourceDialect,
24080 > for (T0, T1, T2)
24081 {
24082 #[inline]
24083 unsafe fn encode(
24084 self,
24085 encoder: &mut fidl::encoding::Encoder<
24086 '_,
24087 fidl::encoding::DefaultFuchsiaResourceDialect,
24088 >,
24089 offset: usize,
24090 depth: fidl::encoding::Depth,
24091 ) -> fidl::Result<()> {
24092 encoder.debug_check_bounds::<UsageGainReporterRegisterListener2Request>(offset);
24093 unsafe {
24096 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
24097 (ptr as *mut u64).write_unaligned(0);
24098 }
24099 self.0.encode(encoder, offset + 0, depth)?;
24101 self.1.encode(encoder, offset + 16, depth)?;
24102 self.2.encode(encoder, offset + 32, depth)?;
24103 Ok(())
24104 }
24105 }
24106
24107 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
24108 for UsageGainReporterRegisterListener2Request
24109 {
24110 #[inline(always)]
24111 fn new_empty() -> Self {
24112 Self {
24113 device_unique_id: fidl::new_empty!(
24114 fidl::encoding::BoundedString<36>,
24115 fidl::encoding::DefaultFuchsiaResourceDialect
24116 ),
24117 usage: fidl::new_empty!(Usage2, fidl::encoding::DefaultFuchsiaResourceDialect),
24118 usage_gain_listener: fidl::new_empty!(
24119 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageGainListenerMarker>>,
24120 fidl::encoding::DefaultFuchsiaResourceDialect
24121 ),
24122 }
24123 }
24124
24125 #[inline]
24126 unsafe fn decode(
24127 &mut self,
24128 decoder: &mut fidl::encoding::Decoder<
24129 '_,
24130 fidl::encoding::DefaultFuchsiaResourceDialect,
24131 >,
24132 offset: usize,
24133 _depth: fidl::encoding::Depth,
24134 ) -> fidl::Result<()> {
24135 decoder.debug_check_bounds::<Self>(offset);
24136 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
24138 let padval = unsafe { (ptr as *const u64).read_unaligned() };
24139 let mask = 0xffffffff00000000u64;
24140 let maskedval = padval & mask;
24141 if maskedval != 0 {
24142 return Err(fidl::Error::NonZeroPadding {
24143 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
24144 });
24145 }
24146 fidl::decode!(
24147 fidl::encoding::BoundedString<36>,
24148 fidl::encoding::DefaultFuchsiaResourceDialect,
24149 &mut self.device_unique_id,
24150 decoder,
24151 offset + 0,
24152 _depth
24153 )?;
24154 fidl::decode!(
24155 Usage2,
24156 fidl::encoding::DefaultFuchsiaResourceDialect,
24157 &mut self.usage,
24158 decoder,
24159 offset + 16,
24160 _depth
24161 )?;
24162 fidl::decode!(
24163 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageGainListenerMarker>>,
24164 fidl::encoding::DefaultFuchsiaResourceDialect,
24165 &mut self.usage_gain_listener,
24166 decoder,
24167 offset + 32,
24168 _depth
24169 )?;
24170 Ok(())
24171 }
24172 }
24173
24174 impl fidl::encoding::ResourceTypeMarker for UsageGainReporterRegisterListenerRequest {
24175 type Borrowed<'a> = &'a mut Self;
24176 fn take_or_borrow<'a>(
24177 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
24178 ) -> Self::Borrowed<'a> {
24179 value
24180 }
24181 }
24182
24183 unsafe impl fidl::encoding::TypeMarker for UsageGainReporterRegisterListenerRequest {
24184 type Owned = Self;
24185
24186 #[inline(always)]
24187 fn inline_align(_context: fidl::encoding::Context) -> usize {
24188 8
24189 }
24190
24191 #[inline(always)]
24192 fn inline_size(_context: fidl::encoding::Context) -> usize {
24193 40
24194 }
24195 }
24196
24197 unsafe impl
24198 fidl::encoding::Encode<
24199 UsageGainReporterRegisterListenerRequest,
24200 fidl::encoding::DefaultFuchsiaResourceDialect,
24201 > for &mut UsageGainReporterRegisterListenerRequest
24202 {
24203 #[inline]
24204 unsafe fn encode(
24205 self,
24206 encoder: &mut fidl::encoding::Encoder<
24207 '_,
24208 fidl::encoding::DefaultFuchsiaResourceDialect,
24209 >,
24210 offset: usize,
24211 _depth: fidl::encoding::Depth,
24212 ) -> fidl::Result<()> {
24213 encoder.debug_check_bounds::<UsageGainReporterRegisterListenerRequest>(offset);
24214 fidl::encoding::Encode::<UsageGainReporterRegisterListenerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
24216 (
24217 <fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_unique_id),
24218 <Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
24219 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageGainListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.usage_gain_listener),
24220 ),
24221 encoder, offset, _depth
24222 )
24223 }
24224 }
24225 unsafe impl<
24226 T0: fidl::encoding::Encode<
24227 fidl::encoding::BoundedString<36>,
24228 fidl::encoding::DefaultFuchsiaResourceDialect,
24229 >,
24230 T1: fidl::encoding::Encode<Usage, fidl::encoding::DefaultFuchsiaResourceDialect>,
24231 T2: fidl::encoding::Encode<
24232 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageGainListenerMarker>>,
24233 fidl::encoding::DefaultFuchsiaResourceDialect,
24234 >,
24235 >
24236 fidl::encoding::Encode<
24237 UsageGainReporterRegisterListenerRequest,
24238 fidl::encoding::DefaultFuchsiaResourceDialect,
24239 > for (T0, T1, T2)
24240 {
24241 #[inline]
24242 unsafe fn encode(
24243 self,
24244 encoder: &mut fidl::encoding::Encoder<
24245 '_,
24246 fidl::encoding::DefaultFuchsiaResourceDialect,
24247 >,
24248 offset: usize,
24249 depth: fidl::encoding::Depth,
24250 ) -> fidl::Result<()> {
24251 encoder.debug_check_bounds::<UsageGainReporterRegisterListenerRequest>(offset);
24252 unsafe {
24255 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
24256 (ptr as *mut u64).write_unaligned(0);
24257 }
24258 self.0.encode(encoder, offset + 0, depth)?;
24260 self.1.encode(encoder, offset + 16, depth)?;
24261 self.2.encode(encoder, offset + 32, depth)?;
24262 Ok(())
24263 }
24264 }
24265
24266 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
24267 for UsageGainReporterRegisterListenerRequest
24268 {
24269 #[inline(always)]
24270 fn new_empty() -> Self {
24271 Self {
24272 device_unique_id: fidl::new_empty!(
24273 fidl::encoding::BoundedString<36>,
24274 fidl::encoding::DefaultFuchsiaResourceDialect
24275 ),
24276 usage: fidl::new_empty!(Usage, fidl::encoding::DefaultFuchsiaResourceDialect),
24277 usage_gain_listener: fidl::new_empty!(
24278 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageGainListenerMarker>>,
24279 fidl::encoding::DefaultFuchsiaResourceDialect
24280 ),
24281 }
24282 }
24283
24284 #[inline]
24285 unsafe fn decode(
24286 &mut self,
24287 decoder: &mut fidl::encoding::Decoder<
24288 '_,
24289 fidl::encoding::DefaultFuchsiaResourceDialect,
24290 >,
24291 offset: usize,
24292 _depth: fidl::encoding::Depth,
24293 ) -> fidl::Result<()> {
24294 decoder.debug_check_bounds::<Self>(offset);
24295 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
24297 let padval = unsafe { (ptr as *const u64).read_unaligned() };
24298 let mask = 0xffffffff00000000u64;
24299 let maskedval = padval & mask;
24300 if maskedval != 0 {
24301 return Err(fidl::Error::NonZeroPadding {
24302 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
24303 });
24304 }
24305 fidl::decode!(
24306 fidl::encoding::BoundedString<36>,
24307 fidl::encoding::DefaultFuchsiaResourceDialect,
24308 &mut self.device_unique_id,
24309 decoder,
24310 offset + 0,
24311 _depth
24312 )?;
24313 fidl::decode!(
24314 Usage,
24315 fidl::encoding::DefaultFuchsiaResourceDialect,
24316 &mut self.usage,
24317 decoder,
24318 offset + 16,
24319 _depth
24320 )?;
24321 fidl::decode!(
24322 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageGainListenerMarker>>,
24323 fidl::encoding::DefaultFuchsiaResourceDialect,
24324 &mut self.usage_gain_listener,
24325 decoder,
24326 offset + 32,
24327 _depth
24328 )?;
24329 Ok(())
24330 }
24331 }
24332
24333 impl fidl::encoding::ResourceTypeMarker for UsageReporterWatch2Request {
24334 type Borrowed<'a> = &'a mut Self;
24335 fn take_or_borrow<'a>(
24336 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
24337 ) -> Self::Borrowed<'a> {
24338 value
24339 }
24340 }
24341
24342 unsafe impl fidl::encoding::TypeMarker for UsageReporterWatch2Request {
24343 type Owned = Self;
24344
24345 #[inline(always)]
24346 fn inline_align(_context: fidl::encoding::Context) -> usize {
24347 8
24348 }
24349
24350 #[inline(always)]
24351 fn inline_size(_context: fidl::encoding::Context) -> usize {
24352 24
24353 }
24354 }
24355
24356 unsafe impl
24357 fidl::encoding::Encode<
24358 UsageReporterWatch2Request,
24359 fidl::encoding::DefaultFuchsiaResourceDialect,
24360 > for &mut UsageReporterWatch2Request
24361 {
24362 #[inline]
24363 unsafe fn encode(
24364 self,
24365 encoder: &mut fidl::encoding::Encoder<
24366 '_,
24367 fidl::encoding::DefaultFuchsiaResourceDialect,
24368 >,
24369 offset: usize,
24370 _depth: fidl::encoding::Depth,
24371 ) -> fidl::Result<()> {
24372 encoder.debug_check_bounds::<UsageReporterWatch2Request>(offset);
24373 fidl::encoding::Encode::<UsageReporterWatch2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
24375 (
24376 <Usage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
24377 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageWatcher2Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.usage_watcher),
24378 ),
24379 encoder, offset, _depth
24380 )
24381 }
24382 }
24383 unsafe impl<
24384 T0: fidl::encoding::Encode<Usage2, fidl::encoding::DefaultFuchsiaResourceDialect>,
24385 T1: fidl::encoding::Encode<
24386 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageWatcher2Marker>>,
24387 fidl::encoding::DefaultFuchsiaResourceDialect,
24388 >,
24389 >
24390 fidl::encoding::Encode<
24391 UsageReporterWatch2Request,
24392 fidl::encoding::DefaultFuchsiaResourceDialect,
24393 > for (T0, T1)
24394 {
24395 #[inline]
24396 unsafe fn encode(
24397 self,
24398 encoder: &mut fidl::encoding::Encoder<
24399 '_,
24400 fidl::encoding::DefaultFuchsiaResourceDialect,
24401 >,
24402 offset: usize,
24403 depth: fidl::encoding::Depth,
24404 ) -> fidl::Result<()> {
24405 encoder.debug_check_bounds::<UsageReporterWatch2Request>(offset);
24406 unsafe {
24409 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
24410 (ptr as *mut u64).write_unaligned(0);
24411 }
24412 self.0.encode(encoder, offset + 0, depth)?;
24414 self.1.encode(encoder, offset + 16, depth)?;
24415 Ok(())
24416 }
24417 }
24418
24419 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
24420 for UsageReporterWatch2Request
24421 {
24422 #[inline(always)]
24423 fn new_empty() -> Self {
24424 Self {
24425 usage: fidl::new_empty!(Usage2, fidl::encoding::DefaultFuchsiaResourceDialect),
24426 usage_watcher: fidl::new_empty!(
24427 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageWatcher2Marker>>,
24428 fidl::encoding::DefaultFuchsiaResourceDialect
24429 ),
24430 }
24431 }
24432
24433 #[inline]
24434 unsafe fn decode(
24435 &mut self,
24436 decoder: &mut fidl::encoding::Decoder<
24437 '_,
24438 fidl::encoding::DefaultFuchsiaResourceDialect,
24439 >,
24440 offset: usize,
24441 _depth: fidl::encoding::Depth,
24442 ) -> fidl::Result<()> {
24443 decoder.debug_check_bounds::<Self>(offset);
24444 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
24446 let padval = unsafe { (ptr as *const u64).read_unaligned() };
24447 let mask = 0xffffffff00000000u64;
24448 let maskedval = padval & mask;
24449 if maskedval != 0 {
24450 return Err(fidl::Error::NonZeroPadding {
24451 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
24452 });
24453 }
24454 fidl::decode!(
24455 Usage2,
24456 fidl::encoding::DefaultFuchsiaResourceDialect,
24457 &mut self.usage,
24458 decoder,
24459 offset + 0,
24460 _depth
24461 )?;
24462 fidl::decode!(
24463 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageWatcher2Marker>>,
24464 fidl::encoding::DefaultFuchsiaResourceDialect,
24465 &mut self.usage_watcher,
24466 decoder,
24467 offset + 16,
24468 _depth
24469 )?;
24470 Ok(())
24471 }
24472 }
24473
24474 impl fidl::encoding::ResourceTypeMarker for UsageReporterWatchRequest {
24475 type Borrowed<'a> = &'a mut Self;
24476 fn take_or_borrow<'a>(
24477 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
24478 ) -> Self::Borrowed<'a> {
24479 value
24480 }
24481 }
24482
24483 unsafe impl fidl::encoding::TypeMarker for UsageReporterWatchRequest {
24484 type Owned = Self;
24485
24486 #[inline(always)]
24487 fn inline_align(_context: fidl::encoding::Context) -> usize {
24488 8
24489 }
24490
24491 #[inline(always)]
24492 fn inline_size(_context: fidl::encoding::Context) -> usize {
24493 24
24494 }
24495 }
24496
24497 unsafe impl
24498 fidl::encoding::Encode<
24499 UsageReporterWatchRequest,
24500 fidl::encoding::DefaultFuchsiaResourceDialect,
24501 > for &mut UsageReporterWatchRequest
24502 {
24503 #[inline]
24504 unsafe fn encode(
24505 self,
24506 encoder: &mut fidl::encoding::Encoder<
24507 '_,
24508 fidl::encoding::DefaultFuchsiaResourceDialect,
24509 >,
24510 offset: usize,
24511 _depth: fidl::encoding::Depth,
24512 ) -> fidl::Result<()> {
24513 encoder.debug_check_bounds::<UsageReporterWatchRequest>(offset);
24514 fidl::encoding::Encode::<UsageReporterWatchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
24516 (
24517 <Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
24518 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.usage_watcher),
24519 ),
24520 encoder, offset, _depth
24521 )
24522 }
24523 }
24524 unsafe impl<
24525 T0: fidl::encoding::Encode<Usage, fidl::encoding::DefaultFuchsiaResourceDialect>,
24526 T1: fidl::encoding::Encode<
24527 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageWatcherMarker>>,
24528 fidl::encoding::DefaultFuchsiaResourceDialect,
24529 >,
24530 >
24531 fidl::encoding::Encode<
24532 UsageReporterWatchRequest,
24533 fidl::encoding::DefaultFuchsiaResourceDialect,
24534 > for (T0, T1)
24535 {
24536 #[inline]
24537 unsafe fn encode(
24538 self,
24539 encoder: &mut fidl::encoding::Encoder<
24540 '_,
24541 fidl::encoding::DefaultFuchsiaResourceDialect,
24542 >,
24543 offset: usize,
24544 depth: fidl::encoding::Depth,
24545 ) -> fidl::Result<()> {
24546 encoder.debug_check_bounds::<UsageReporterWatchRequest>(offset);
24547 unsafe {
24550 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
24551 (ptr as *mut u64).write_unaligned(0);
24552 }
24553 self.0.encode(encoder, offset + 0, depth)?;
24555 self.1.encode(encoder, offset + 16, depth)?;
24556 Ok(())
24557 }
24558 }
24559
24560 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
24561 for UsageReporterWatchRequest
24562 {
24563 #[inline(always)]
24564 fn new_empty() -> Self {
24565 Self {
24566 usage: fidl::new_empty!(Usage, fidl::encoding::DefaultFuchsiaResourceDialect),
24567 usage_watcher: fidl::new_empty!(
24568 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageWatcherMarker>>,
24569 fidl::encoding::DefaultFuchsiaResourceDialect
24570 ),
24571 }
24572 }
24573
24574 #[inline]
24575 unsafe fn decode(
24576 &mut self,
24577 decoder: &mut fidl::encoding::Decoder<
24578 '_,
24579 fidl::encoding::DefaultFuchsiaResourceDialect,
24580 >,
24581 offset: usize,
24582 _depth: fidl::encoding::Depth,
24583 ) -> fidl::Result<()> {
24584 decoder.debug_check_bounds::<Self>(offset);
24585 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
24587 let padval = unsafe { (ptr as *const u64).read_unaligned() };
24588 let mask = 0xffffffff00000000u64;
24589 let maskedval = padval & mask;
24590 if maskedval != 0 {
24591 return Err(fidl::Error::NonZeroPadding {
24592 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
24593 });
24594 }
24595 fidl::decode!(
24596 Usage,
24597 fidl::encoding::DefaultFuchsiaResourceDialect,
24598 &mut self.usage,
24599 decoder,
24600 offset + 0,
24601 _depth
24602 )?;
24603 fidl::decode!(
24604 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsageWatcherMarker>>,
24605 fidl::encoding::DefaultFuchsiaResourceDialect,
24606 &mut self.usage_watcher,
24607 decoder,
24608 offset + 16,
24609 _depth
24610 )?;
24611 Ok(())
24612 }
24613 }
24614
24615 impl StreamBufferPartialSettings {
24616 #[inline(always)]
24617 fn max_ordinal_present(&self) -> u64 {
24618 if let Some(_) = self.sysmem2_token {
24619 return 7;
24620 }
24621 if let Some(_) = self.sysmem_token {
24622 return 6;
24623 }
24624 if let Some(_) = self.packet_count_for_client {
24625 return 5;
24626 }
24627 if let Some(_) = self.packet_count_for_server {
24628 return 4;
24629 }
24630 if let Some(_) = self.single_buffer_mode {
24631 return 3;
24632 }
24633 if let Some(_) = self.buffer_constraints_version_ordinal {
24634 return 2;
24635 }
24636 if let Some(_) = self.buffer_lifetime_ordinal {
24637 return 1;
24638 }
24639 0
24640 }
24641 }
24642
24643 impl fidl::encoding::ResourceTypeMarker for StreamBufferPartialSettings {
24644 type Borrowed<'a> = &'a mut Self;
24645 fn take_or_borrow<'a>(
24646 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
24647 ) -> Self::Borrowed<'a> {
24648 value
24649 }
24650 }
24651
24652 unsafe impl fidl::encoding::TypeMarker for StreamBufferPartialSettings {
24653 type Owned = Self;
24654
24655 #[inline(always)]
24656 fn inline_align(_context: fidl::encoding::Context) -> usize {
24657 8
24658 }
24659
24660 #[inline(always)]
24661 fn inline_size(_context: fidl::encoding::Context) -> usize {
24662 16
24663 }
24664 }
24665
24666 unsafe impl
24667 fidl::encoding::Encode<
24668 StreamBufferPartialSettings,
24669 fidl::encoding::DefaultFuchsiaResourceDialect,
24670 > for &mut StreamBufferPartialSettings
24671 {
24672 unsafe fn encode(
24673 self,
24674 encoder: &mut fidl::encoding::Encoder<
24675 '_,
24676 fidl::encoding::DefaultFuchsiaResourceDialect,
24677 >,
24678 offset: usize,
24679 mut depth: fidl::encoding::Depth,
24680 ) -> fidl::Result<()> {
24681 encoder.debug_check_bounds::<StreamBufferPartialSettings>(offset);
24682 let max_ordinal: u64 = self.max_ordinal_present();
24684 encoder.write_num(max_ordinal, offset);
24685 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
24686 if max_ordinal == 0 {
24688 return Ok(());
24689 }
24690 depth.increment()?;
24691 let envelope_size = 8;
24692 let bytes_len = max_ordinal as usize * envelope_size;
24693 #[allow(unused_variables)]
24694 let offset = encoder.out_of_line_offset(bytes_len);
24695 let mut _prev_end_offset: usize = 0;
24696 if 1 > max_ordinal {
24697 return Ok(());
24698 }
24699
24700 let cur_offset: usize = (1 - 1) * envelope_size;
24703
24704 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
24706
24707 fidl::encoding::encode_in_envelope_optional::<
24712 u64,
24713 fidl::encoding::DefaultFuchsiaResourceDialect,
24714 >(
24715 self.buffer_lifetime_ordinal
24716 .as_ref()
24717 .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
24718 encoder,
24719 offset + cur_offset,
24720 depth,
24721 )?;
24722
24723 _prev_end_offset = cur_offset + envelope_size;
24724 if 2 > max_ordinal {
24725 return Ok(());
24726 }
24727
24728 let cur_offset: usize = (2 - 1) * envelope_size;
24731
24732 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
24734
24735 fidl::encoding::encode_in_envelope_optional::<
24740 u64,
24741 fidl::encoding::DefaultFuchsiaResourceDialect,
24742 >(
24743 self.buffer_constraints_version_ordinal
24744 .as_ref()
24745 .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
24746 encoder,
24747 offset + cur_offset,
24748 depth,
24749 )?;
24750
24751 _prev_end_offset = cur_offset + envelope_size;
24752 if 3 > max_ordinal {
24753 return Ok(());
24754 }
24755
24756 let cur_offset: usize = (3 - 1) * envelope_size;
24759
24760 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
24762
24763 fidl::encoding::encode_in_envelope_optional::<
24768 bool,
24769 fidl::encoding::DefaultFuchsiaResourceDialect,
24770 >(
24771 self.single_buffer_mode
24772 .as_ref()
24773 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
24774 encoder,
24775 offset + cur_offset,
24776 depth,
24777 )?;
24778
24779 _prev_end_offset = cur_offset + envelope_size;
24780 if 4 > max_ordinal {
24781 return Ok(());
24782 }
24783
24784 let cur_offset: usize = (4 - 1) * envelope_size;
24787
24788 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
24790
24791 fidl::encoding::encode_in_envelope_optional::<
24796 u32,
24797 fidl::encoding::DefaultFuchsiaResourceDialect,
24798 >(
24799 self.packet_count_for_server
24800 .as_ref()
24801 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
24802 encoder,
24803 offset + cur_offset,
24804 depth,
24805 )?;
24806
24807 _prev_end_offset = cur_offset + envelope_size;
24808 if 5 > max_ordinal {
24809 return Ok(());
24810 }
24811
24812 let cur_offset: usize = (5 - 1) * envelope_size;
24815
24816 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
24818
24819 fidl::encoding::encode_in_envelope_optional::<
24824 u32,
24825 fidl::encoding::DefaultFuchsiaResourceDialect,
24826 >(
24827 self.packet_count_for_client
24828 .as_ref()
24829 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
24830 encoder,
24831 offset + cur_offset,
24832 depth,
24833 )?;
24834
24835 _prev_end_offset = cur_offset + envelope_size;
24836 if 6 > max_ordinal {
24837 return Ok(());
24838 }
24839
24840 let cur_offset: usize = (6 - 1) * envelope_size;
24843
24844 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
24846
24847 fidl::encoding::encode_in_envelope_optional::<
24852 fidl::encoding::Endpoint<
24853 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
24854 >,
24855 fidl::encoding::DefaultFuchsiaResourceDialect,
24856 >(
24857 self.sysmem_token.as_mut().map(
24858 <fidl::encoding::Endpoint<
24859 fidl::endpoints::ClientEnd<
24860 fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
24861 >,
24862 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
24863 ),
24864 encoder,
24865 offset + cur_offset,
24866 depth,
24867 )?;
24868
24869 _prev_end_offset = cur_offset + envelope_size;
24870 if 7 > max_ordinal {
24871 return Ok(());
24872 }
24873
24874 let cur_offset: usize = (7 - 1) * envelope_size;
24877
24878 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
24880
24881 fidl::encoding::encode_in_envelope_optional::<
24886 fidl::encoding::Endpoint<
24887 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
24888 >,
24889 fidl::encoding::DefaultFuchsiaResourceDialect,
24890 >(
24891 self.sysmem2_token.as_mut().map(
24892 <fidl::encoding::Endpoint<
24893 fidl::endpoints::ClientEnd<
24894 fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
24895 >,
24896 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
24897 ),
24898 encoder,
24899 offset + cur_offset,
24900 depth,
24901 )?;
24902
24903 _prev_end_offset = cur_offset + envelope_size;
24904
24905 Ok(())
24906 }
24907 }
24908
24909 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
24910 for StreamBufferPartialSettings
24911 {
24912 #[inline(always)]
24913 fn new_empty() -> Self {
24914 Self::default()
24915 }
24916
24917 unsafe fn decode(
24918 &mut self,
24919 decoder: &mut fidl::encoding::Decoder<
24920 '_,
24921 fidl::encoding::DefaultFuchsiaResourceDialect,
24922 >,
24923 offset: usize,
24924 mut depth: fidl::encoding::Depth,
24925 ) -> fidl::Result<()> {
24926 decoder.debug_check_bounds::<Self>(offset);
24927 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
24928 None => return Err(fidl::Error::NotNullable),
24929 Some(len) => len,
24930 };
24931 if len == 0 {
24933 return Ok(());
24934 };
24935 depth.increment()?;
24936 let envelope_size = 8;
24937 let bytes_len = len * envelope_size;
24938 let offset = decoder.out_of_line_offset(bytes_len)?;
24939 let mut _next_ordinal_to_read = 0;
24941 let mut next_offset = offset;
24942 let end_offset = offset + bytes_len;
24943 _next_ordinal_to_read += 1;
24944 if next_offset >= end_offset {
24945 return Ok(());
24946 }
24947
24948 while _next_ordinal_to_read < 1 {
24950 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
24951 _next_ordinal_to_read += 1;
24952 next_offset += envelope_size;
24953 }
24954
24955 let next_out_of_line = decoder.next_out_of_line();
24956 let handles_before = decoder.remaining_handles();
24957 if let Some((inlined, num_bytes, num_handles)) =
24958 fidl::encoding::decode_envelope_header(decoder, next_offset)?
24959 {
24960 let member_inline_size =
24961 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
24962 if inlined != (member_inline_size <= 4) {
24963 return Err(fidl::Error::InvalidInlineBitInEnvelope);
24964 }
24965 let inner_offset;
24966 let mut inner_depth = depth.clone();
24967 if inlined {
24968 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
24969 inner_offset = next_offset;
24970 } else {
24971 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
24972 inner_depth.increment()?;
24973 }
24974 let val_ref = self.buffer_lifetime_ordinal.get_or_insert_with(|| {
24975 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
24976 });
24977 fidl::decode!(
24978 u64,
24979 fidl::encoding::DefaultFuchsiaResourceDialect,
24980 val_ref,
24981 decoder,
24982 inner_offset,
24983 inner_depth
24984 )?;
24985 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
24986 {
24987 return Err(fidl::Error::InvalidNumBytesInEnvelope);
24988 }
24989 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
24990 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
24991 }
24992 }
24993
24994 next_offset += envelope_size;
24995 _next_ordinal_to_read += 1;
24996 if next_offset >= end_offset {
24997 return Ok(());
24998 }
24999
25000 while _next_ordinal_to_read < 2 {
25002 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
25003 _next_ordinal_to_read += 1;
25004 next_offset += envelope_size;
25005 }
25006
25007 let next_out_of_line = decoder.next_out_of_line();
25008 let handles_before = decoder.remaining_handles();
25009 if let Some((inlined, num_bytes, num_handles)) =
25010 fidl::encoding::decode_envelope_header(decoder, next_offset)?
25011 {
25012 let member_inline_size =
25013 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
25014 if inlined != (member_inline_size <= 4) {
25015 return Err(fidl::Error::InvalidInlineBitInEnvelope);
25016 }
25017 let inner_offset;
25018 let mut inner_depth = depth.clone();
25019 if inlined {
25020 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
25021 inner_offset = next_offset;
25022 } else {
25023 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
25024 inner_depth.increment()?;
25025 }
25026 let val_ref = self.buffer_constraints_version_ordinal.get_or_insert_with(|| {
25027 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
25028 });
25029 fidl::decode!(
25030 u64,
25031 fidl::encoding::DefaultFuchsiaResourceDialect,
25032 val_ref,
25033 decoder,
25034 inner_offset,
25035 inner_depth
25036 )?;
25037 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
25038 {
25039 return Err(fidl::Error::InvalidNumBytesInEnvelope);
25040 }
25041 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
25042 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
25043 }
25044 }
25045
25046 next_offset += envelope_size;
25047 _next_ordinal_to_read += 1;
25048 if next_offset >= end_offset {
25049 return Ok(());
25050 }
25051
25052 while _next_ordinal_to_read < 3 {
25054 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
25055 _next_ordinal_to_read += 1;
25056 next_offset += envelope_size;
25057 }
25058
25059 let next_out_of_line = decoder.next_out_of_line();
25060 let handles_before = decoder.remaining_handles();
25061 if let Some((inlined, num_bytes, num_handles)) =
25062 fidl::encoding::decode_envelope_header(decoder, next_offset)?
25063 {
25064 let member_inline_size =
25065 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
25066 if inlined != (member_inline_size <= 4) {
25067 return Err(fidl::Error::InvalidInlineBitInEnvelope);
25068 }
25069 let inner_offset;
25070 let mut inner_depth = depth.clone();
25071 if inlined {
25072 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
25073 inner_offset = next_offset;
25074 } else {
25075 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
25076 inner_depth.increment()?;
25077 }
25078 let val_ref = self.single_buffer_mode.get_or_insert_with(|| {
25079 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
25080 });
25081 fidl::decode!(
25082 bool,
25083 fidl::encoding::DefaultFuchsiaResourceDialect,
25084 val_ref,
25085 decoder,
25086 inner_offset,
25087 inner_depth
25088 )?;
25089 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
25090 {
25091 return Err(fidl::Error::InvalidNumBytesInEnvelope);
25092 }
25093 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
25094 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
25095 }
25096 }
25097
25098 next_offset += envelope_size;
25099 _next_ordinal_to_read += 1;
25100 if next_offset >= end_offset {
25101 return Ok(());
25102 }
25103
25104 while _next_ordinal_to_read < 4 {
25106 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
25107 _next_ordinal_to_read += 1;
25108 next_offset += envelope_size;
25109 }
25110
25111 let next_out_of_line = decoder.next_out_of_line();
25112 let handles_before = decoder.remaining_handles();
25113 if let Some((inlined, num_bytes, num_handles)) =
25114 fidl::encoding::decode_envelope_header(decoder, next_offset)?
25115 {
25116 let member_inline_size =
25117 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
25118 if inlined != (member_inline_size <= 4) {
25119 return Err(fidl::Error::InvalidInlineBitInEnvelope);
25120 }
25121 let inner_offset;
25122 let mut inner_depth = depth.clone();
25123 if inlined {
25124 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
25125 inner_offset = next_offset;
25126 } else {
25127 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
25128 inner_depth.increment()?;
25129 }
25130 let val_ref = self.packet_count_for_server.get_or_insert_with(|| {
25131 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
25132 });
25133 fidl::decode!(
25134 u32,
25135 fidl::encoding::DefaultFuchsiaResourceDialect,
25136 val_ref,
25137 decoder,
25138 inner_offset,
25139 inner_depth
25140 )?;
25141 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
25142 {
25143 return Err(fidl::Error::InvalidNumBytesInEnvelope);
25144 }
25145 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
25146 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
25147 }
25148 }
25149
25150 next_offset += envelope_size;
25151 _next_ordinal_to_read += 1;
25152 if next_offset >= end_offset {
25153 return Ok(());
25154 }
25155
25156 while _next_ordinal_to_read < 5 {
25158 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
25159 _next_ordinal_to_read += 1;
25160 next_offset += envelope_size;
25161 }
25162
25163 let next_out_of_line = decoder.next_out_of_line();
25164 let handles_before = decoder.remaining_handles();
25165 if let Some((inlined, num_bytes, num_handles)) =
25166 fidl::encoding::decode_envelope_header(decoder, next_offset)?
25167 {
25168 let member_inline_size =
25169 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
25170 if inlined != (member_inline_size <= 4) {
25171 return Err(fidl::Error::InvalidInlineBitInEnvelope);
25172 }
25173 let inner_offset;
25174 let mut inner_depth = depth.clone();
25175 if inlined {
25176 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
25177 inner_offset = next_offset;
25178 } else {
25179 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
25180 inner_depth.increment()?;
25181 }
25182 let val_ref = self.packet_count_for_client.get_or_insert_with(|| {
25183 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
25184 });
25185 fidl::decode!(
25186 u32,
25187 fidl::encoding::DefaultFuchsiaResourceDialect,
25188 val_ref,
25189 decoder,
25190 inner_offset,
25191 inner_depth
25192 )?;
25193 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
25194 {
25195 return Err(fidl::Error::InvalidNumBytesInEnvelope);
25196 }
25197 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
25198 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
25199 }
25200 }
25201
25202 next_offset += envelope_size;
25203 _next_ordinal_to_read += 1;
25204 if next_offset >= end_offset {
25205 return Ok(());
25206 }
25207
25208 while _next_ordinal_to_read < 6 {
25210 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
25211 _next_ordinal_to_read += 1;
25212 next_offset += envelope_size;
25213 }
25214
25215 let next_out_of_line = decoder.next_out_of_line();
25216 let handles_before = decoder.remaining_handles();
25217 if let Some((inlined, num_bytes, num_handles)) =
25218 fidl::encoding::decode_envelope_header(decoder, next_offset)?
25219 {
25220 let member_inline_size = <fidl::encoding::Endpoint<
25221 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
25222 > as fidl::encoding::TypeMarker>::inline_size(
25223 decoder.context
25224 );
25225 if inlined != (member_inline_size <= 4) {
25226 return Err(fidl::Error::InvalidInlineBitInEnvelope);
25227 }
25228 let inner_offset;
25229 let mut inner_depth = depth.clone();
25230 if inlined {
25231 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
25232 inner_offset = next_offset;
25233 } else {
25234 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
25235 inner_depth.increment()?;
25236 }
25237 let val_ref = self.sysmem_token.get_or_insert_with(|| {
25238 fidl::new_empty!(
25239 fidl::encoding::Endpoint<
25240 fidl::endpoints::ClientEnd<
25241 fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
25242 >,
25243 >,
25244 fidl::encoding::DefaultFuchsiaResourceDialect
25245 )
25246 });
25247 fidl::decode!(
25248 fidl::encoding::Endpoint<
25249 fidl::endpoints::ClientEnd<
25250 fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
25251 >,
25252 >,
25253 fidl::encoding::DefaultFuchsiaResourceDialect,
25254 val_ref,
25255 decoder,
25256 inner_offset,
25257 inner_depth
25258 )?;
25259 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
25260 {
25261 return Err(fidl::Error::InvalidNumBytesInEnvelope);
25262 }
25263 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
25264 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
25265 }
25266 }
25267
25268 next_offset += envelope_size;
25269 _next_ordinal_to_read += 1;
25270 if next_offset >= end_offset {
25271 return Ok(());
25272 }
25273
25274 while _next_ordinal_to_read < 7 {
25276 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
25277 _next_ordinal_to_read += 1;
25278 next_offset += envelope_size;
25279 }
25280
25281 let next_out_of_line = decoder.next_out_of_line();
25282 let handles_before = decoder.remaining_handles();
25283 if let Some((inlined, num_bytes, num_handles)) =
25284 fidl::encoding::decode_envelope_header(decoder, next_offset)?
25285 {
25286 let member_inline_size = <fidl::encoding::Endpoint<
25287 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
25288 > as fidl::encoding::TypeMarker>::inline_size(
25289 decoder.context
25290 );
25291 if inlined != (member_inline_size <= 4) {
25292 return Err(fidl::Error::InvalidInlineBitInEnvelope);
25293 }
25294 let inner_offset;
25295 let mut inner_depth = depth.clone();
25296 if inlined {
25297 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
25298 inner_offset = next_offset;
25299 } else {
25300 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
25301 inner_depth.increment()?;
25302 }
25303 let val_ref = self.sysmem2_token.get_or_insert_with(|| {
25304 fidl::new_empty!(
25305 fidl::encoding::Endpoint<
25306 fidl::endpoints::ClientEnd<
25307 fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
25308 >,
25309 >,
25310 fidl::encoding::DefaultFuchsiaResourceDialect
25311 )
25312 });
25313 fidl::decode!(
25314 fidl::encoding::Endpoint<
25315 fidl::endpoints::ClientEnd<
25316 fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
25317 >,
25318 >,
25319 fidl::encoding::DefaultFuchsiaResourceDialect,
25320 val_ref,
25321 decoder,
25322 inner_offset,
25323 inner_depth
25324 )?;
25325 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
25326 {
25327 return Err(fidl::Error::InvalidNumBytesInEnvelope);
25328 }
25329 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
25330 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
25331 }
25332 }
25333
25334 next_offset += envelope_size;
25335
25336 while next_offset < end_offset {
25338 _next_ordinal_to_read += 1;
25339 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
25340 next_offset += envelope_size;
25341 }
25342
25343 Ok(())
25344 }
25345 }
25346}