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_audio_device_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct ControlCreateRingBufferRequest {
16 pub element_id: Option<u64>,
20 pub options: Option<RingBufferOptions>,
24 pub ring_buffer_server: Option<fidl::endpoints::ServerEnd<RingBufferMarker>>,
28 #[doc(hidden)]
29 pub __source_breaking: fidl::marker::SourceBreaking,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33 for ControlCreateRingBufferRequest
34{
35}
36
37#[derive(Debug, Default, PartialEq)]
38pub struct ControlCreatorCreateRequest {
39 pub token_id: Option<u64>,
43 pub control_server: Option<fidl::endpoints::ServerEnd<ControlMarker>>,
47 #[doc(hidden)]
48 pub __source_breaking: fidl::marker::SourceBreaking,
49}
50
51impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
52 for ControlCreatorCreateRequest
53{
54}
55
56#[derive(Debug, Default, PartialEq)]
57pub struct ControlCreateRingBufferResponse {
58 pub properties: Option<RingBufferProperties>,
60 pub ring_buffer: Option<fidl_fuchsia_audio::RingBuffer>,
64 #[doc(hidden)]
65 pub __source_breaking: fidl::marker::SourceBreaking,
66}
67
68impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
69 for ControlCreateRingBufferResponse
70{
71}
72
73#[derive(Debug, Default, PartialEq)]
74pub struct ObserverGetReferenceClockResponse {
75 pub reference_clock: Option<fidl::Clock>,
77 #[doc(hidden)]
78 pub __source_breaking: fidl::marker::SourceBreaking,
79}
80
81impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
82 for ObserverGetReferenceClockResponse
83{
84}
85
86#[derive(Debug, Default, PartialEq)]
87pub struct ProviderAddDeviceRequest {
88 pub device_name: Option<String>,
92 pub device_type: Option<DeviceType>,
96 pub driver_client: Option<DriverClient>,
107 #[doc(hidden)]
108 pub __source_breaking: fidl::marker::SourceBreaking,
109}
110
111impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProviderAddDeviceRequest {}
112
113#[derive(Debug, Default, PartialEq)]
114pub struct RegistryCreateObserverRequest {
115 pub token_id: Option<u64>,
119 pub observer_server: Option<fidl::endpoints::ServerEnd<ObserverMarker>>,
123 #[doc(hidden)]
124 pub __source_breaking: fidl::marker::SourceBreaking,
125}
126
127impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
128 for RegistryCreateObserverRequest
129{
130}
131
132#[derive(Debug)]
139pub enum DriverClient {
140 Codec(fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::CodecMarker>),
142 Composite(fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::CompositeMarker>),
144 #[doc(hidden)]
145 __SourceBreaking { unknown_ordinal: u64 },
146}
147
148#[macro_export]
150macro_rules! DriverClientUnknown {
151 () => {
152 _
153 };
154}
155
156impl PartialEq for DriverClient {
158 fn eq(&self, other: &Self) -> bool {
159 match (self, other) {
160 (Self::Codec(x), Self::Codec(y)) => *x == *y,
161 (Self::Composite(x), Self::Composite(y)) => *x == *y,
162 _ => false,
163 }
164 }
165}
166
167impl DriverClient {
168 #[inline]
169 pub fn ordinal(&self) -> u64 {
170 match *self {
171 Self::Codec(_) => 1,
172 Self::Composite(_) => 2,
173 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
174 }
175 }
176
177 #[inline]
178 pub fn unknown_variant_for_testing() -> Self {
179 Self::__SourceBreaking { unknown_ordinal: 0 }
180 }
181
182 #[inline]
183 pub fn is_unknown(&self) -> bool {
184 match self {
185 Self::__SourceBreaking { .. } => true,
186 _ => false,
187 }
188 }
189}
190
191impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverClient {}
192
193#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
194pub struct ControlMarker;
195
196impl fidl::endpoints::ProtocolMarker for ControlMarker {
197 type Proxy = ControlProxy;
198 type RequestStream = ControlRequestStream;
199 #[cfg(target_os = "fuchsia")]
200 type SynchronousProxy = ControlSynchronousProxy;
201
202 const DEBUG_NAME: &'static str = "(anonymous) Control";
203}
204pub type ControlCreateRingBufferResult =
205 Result<ControlCreateRingBufferResponse, ControlCreateRingBufferError>;
206pub type ControlSetDaiFormatResult = Result<ControlSetDaiFormatResponse, ControlSetDaiFormatError>;
207pub type ControlCodecStartResult = Result<ControlCodecStartResponse, ControlCodecStartError>;
208pub type ControlCodecStopResult = Result<ControlCodecStopResponse, ControlCodecStopError>;
209pub type ControlResetResult = Result<ControlResetResponse, ControlResetError>;
210
211pub trait ControlProxyInterface: Send + Sync {
212 type GetElementsResponseFut: std::future::Future<
213 Output = Result<
214 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResult,
215 fidl::Error,
216 >,
217 > + Send;
218 fn r#get_elements(&self) -> Self::GetElementsResponseFut;
219 type WatchElementStateResponseFut: std::future::Future<
220 Output = Result<
221 fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
222 fidl::Error,
223 >,
224 > + Send;
225 fn r#watch_element_state(
226 &self,
227 processing_element_id: u64,
228 ) -> Self::WatchElementStateResponseFut;
229 type GetTopologiesResponseFut: std::future::Future<
230 Output = Result<
231 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResult,
232 fidl::Error,
233 >,
234 > + Send;
235 fn r#get_topologies(&self) -> Self::GetTopologiesResponseFut;
236 type WatchTopologyResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
237 fn r#watch_topology(&self) -> Self::WatchTopologyResponseFut;
238 type SetElementStateResponseFut: std::future::Future<
239 Output = Result<
240 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetElementStateResult,
241 fidl::Error,
242 >,
243 > + Send;
244 fn r#set_element_state(
245 &self,
246 processing_element_id: u64,
247 state: &fidl_fuchsia_hardware_audio_signalprocessing::SettableElementState,
248 ) -> Self::SetElementStateResponseFut;
249 type SetTopologyResponseFut: std::future::Future<
250 Output = Result<
251 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetTopologyResult,
252 fidl::Error,
253 >,
254 > + Send;
255 fn r#set_topology(&self, topology_id: u64) -> Self::SetTopologyResponseFut;
256 type CreateRingBufferResponseFut: std::future::Future<Output = Result<ControlCreateRingBufferResult, fidl::Error>>
257 + Send;
258 fn r#create_ring_buffer(
259 &self,
260 payload: ControlCreateRingBufferRequest,
261 ) -> Self::CreateRingBufferResponseFut;
262 type SetDaiFormatResponseFut: std::future::Future<Output = Result<ControlSetDaiFormatResult, fidl::Error>>
263 + Send;
264 fn r#set_dai_format(
265 &self,
266 payload: &ControlSetDaiFormatRequest,
267 ) -> Self::SetDaiFormatResponseFut;
268 type CodecStartResponseFut: std::future::Future<Output = Result<ControlCodecStartResult, fidl::Error>>
269 + Send;
270 fn r#codec_start(&self) -> Self::CodecStartResponseFut;
271 type CodecStopResponseFut: std::future::Future<Output = Result<ControlCodecStopResult, fidl::Error>>
272 + Send;
273 fn r#codec_stop(&self) -> Self::CodecStopResponseFut;
274 type ResetResponseFut: std::future::Future<Output = Result<ControlResetResult, fidl::Error>>
275 + Send;
276 fn r#reset(&self) -> Self::ResetResponseFut;
277}
278#[derive(Debug)]
279#[cfg(target_os = "fuchsia")]
280pub struct ControlSynchronousProxy {
281 client: fidl::client::sync::Client,
282}
283
284#[cfg(target_os = "fuchsia")]
285impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
286 type Proxy = ControlProxy;
287 type Protocol = ControlMarker;
288
289 fn from_channel(inner: fidl::Channel) -> Self {
290 Self::new(inner)
291 }
292
293 fn into_channel(self) -> fidl::Channel {
294 self.client.into_channel()
295 }
296
297 fn as_channel(&self) -> &fidl::Channel {
298 self.client.as_channel()
299 }
300}
301
302#[cfg(target_os = "fuchsia")]
303impl ControlSynchronousProxy {
304 pub fn new(channel: fidl::Channel) -> Self {
305 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
306 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
307 }
308
309 pub fn into_channel(self) -> fidl::Channel {
310 self.client.into_channel()
311 }
312
313 pub fn wait_for_event(
316 &self,
317 deadline: zx::MonotonicInstant,
318 ) -> Result<ControlEvent, fidl::Error> {
319 ControlEvent::decode(self.client.wait_for_event(deadline)?)
320 }
321
322 pub fn r#get_elements(
327 &self,
328 ___deadline: zx::MonotonicInstant,
329 ) -> Result<fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResult, fidl::Error>
330 {
331 let _response = self
332 .client
333 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
334 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResponse,
335 i32,
336 >>(
337 (), 0x1b14ff4adf5dc6f8, fidl::encoding::DynamicFlags::empty(), ___deadline
338 )?;
339 Ok(_response.map(|x| x.processing_elements))
340 }
341
342 pub fn r#watch_element_state(
352 &self,
353 mut processing_element_id: u64,
354 ___deadline: zx::MonotonicInstant,
355 ) -> Result<fidl_fuchsia_hardware_audio_signalprocessing::ElementState, fidl::Error> {
356 let _response = self.client.send_query::<
357 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateRequest,
358 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateResponse,
359 >(
360 (processing_element_id,),
361 0x524da8772a69056f,
362 fidl::encoding::DynamicFlags::empty(),
363 ___deadline,
364 )?;
365 Ok(_response.state)
366 }
367
368 pub fn r#get_topologies(
377 &self,
378 ___deadline: zx::MonotonicInstant,
379 ) -> Result<fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResult, fidl::Error>
380 {
381 let _response = self
382 .client
383 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
384 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResponse,
385 i32,
386 >>(
387 (), 0x73ffb73af24d30b6, fidl::encoding::DynamicFlags::empty(), ___deadline
388 )?;
389 Ok(_response.map(|x| x.topologies))
390 }
391
392 pub fn r#watch_topology(&self, ___deadline: zx::MonotonicInstant) -> Result<u64, fidl::Error> {
399 let _response = self
400 .client
401 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleType<
402 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchTopologyResponse,
403 >>(
404 (), 0x66d172acdb36a729, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
405 )?
406 .into_result::<ControlMarker>("watch_topology")?;
407 Ok(_response.topology_id)
408 }
409
410 pub fn r#set_element_state(
440 &self,
441 mut processing_element_id: u64,
442 mut state: &fidl_fuchsia_hardware_audio_signalprocessing::SettableElementState,
443 ___deadline: zx::MonotonicInstant,
444 ) -> Result<
445 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetElementStateResult,
446 fidl::Error,
447 > {
448 let _response = self.client.send_query::<
449 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetElementStateRequest,
450 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
451 >(
452 (processing_element_id, state,),
453 0x38c3b2d4bae698f4,
454 fidl::encoding::DynamicFlags::empty(),
455 ___deadline,
456 )?;
457 Ok(_response.map(|x| x))
458 }
459
460 pub fn r#set_topology(
472 &self,
473 mut topology_id: u64,
474 ___deadline: zx::MonotonicInstant,
475 ) -> Result<
476 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetTopologyResult,
477 fidl::Error,
478 > {
479 let _response = self.client.send_query::<
480 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetTopologyRequest,
481 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
482 >(
483 (topology_id,),
484 0x1d9a7f9b8fee790c,
485 fidl::encoding::DynamicFlags::empty(),
486 ___deadline,
487 )?;
488 Ok(_response.map(|x| x))
489 }
490
491 pub fn r#create_ring_buffer(
496 &self,
497 mut payload: ControlCreateRingBufferRequest,
498 ___deadline: zx::MonotonicInstant,
499 ) -> Result<ControlCreateRingBufferResult, fidl::Error> {
500 let _response = self
501 .client
502 .send_query::<ControlCreateRingBufferRequest, fidl::encoding::FlexibleResultType<
503 ControlCreateRingBufferResponse,
504 ControlCreateRingBufferError,
505 >>(
506 &mut payload,
507 0x7462941cedb333db,
508 fidl::encoding::DynamicFlags::FLEXIBLE,
509 ___deadline,
510 )?
511 .into_result::<ControlMarker>("create_ring_buffer")?;
512 Ok(_response.map(|x| x))
513 }
514
515 pub fn r#set_dai_format(
522 &self,
523 mut payload: &ControlSetDaiFormatRequest,
524 ___deadline: zx::MonotonicInstant,
525 ) -> Result<ControlSetDaiFormatResult, fidl::Error> {
526 let _response = self
527 .client
528 .send_query::<ControlSetDaiFormatRequest, fidl::encoding::FlexibleResultType<
529 ControlSetDaiFormatResponse,
530 ControlSetDaiFormatError,
531 >>(
532 payload, 0x1d84f5a456a92216, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
533 )?
534 .into_result::<ControlMarker>("set_dai_format")?;
535 Ok(_response.map(|x| x))
536 }
537
538 pub fn r#codec_start(
544 &self,
545 ___deadline: zx::MonotonicInstant,
546 ) -> Result<ControlCodecStartResult, fidl::Error> {
547 let _response =
548 self.client
549 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
550 ControlCodecStartResponse,
551 ControlCodecStartError,
552 >>(
553 (), 0x2a90a9d2958b997b, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
554 )?
555 .into_result::<ControlMarker>("codec_start")?;
556 Ok(_response.map(|x| x))
557 }
558
559 pub fn r#codec_stop(
565 &self,
566 ___deadline: zx::MonotonicInstant,
567 ) -> Result<ControlCodecStopResult, fidl::Error> {
568 let _response = self.client.send_query::<
569 fidl::encoding::EmptyPayload,
570 fidl::encoding::FlexibleResultType<ControlCodecStopResponse, ControlCodecStopError>,
571 >(
572 (),
573 0x387297bb6bcad25f,
574 fidl::encoding::DynamicFlags::FLEXIBLE,
575 ___deadline,
576 )?
577 .into_result::<ControlMarker>("codec_stop")?;
578 Ok(_response.map(|x| x))
579 }
580
581 pub fn r#reset(
594 &self,
595 ___deadline: zx::MonotonicInstant,
596 ) -> Result<ControlResetResult, fidl::Error> {
597 let _response = self.client.send_query::<
598 fidl::encoding::EmptyPayload,
599 fidl::encoding::FlexibleResultType<ControlResetResponse, ControlResetError>,
600 >(
601 (),
602 0x49840db00a698996,
603 fidl::encoding::DynamicFlags::FLEXIBLE,
604 ___deadline,
605 )?
606 .into_result::<ControlMarker>("reset")?;
607 Ok(_response.map(|x| x))
608 }
609}
610
611#[cfg(target_os = "fuchsia")]
612impl From<ControlSynchronousProxy> for zx::Handle {
613 fn from(value: ControlSynchronousProxy) -> Self {
614 value.into_channel().into()
615 }
616}
617
618#[cfg(target_os = "fuchsia")]
619impl From<fidl::Channel> for ControlSynchronousProxy {
620 fn from(value: fidl::Channel) -> Self {
621 Self::new(value)
622 }
623}
624
625#[derive(Debug, Clone)]
626pub struct ControlProxy {
627 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
628}
629
630impl fidl::endpoints::Proxy for ControlProxy {
631 type Protocol = ControlMarker;
632
633 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
634 Self::new(inner)
635 }
636
637 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
638 self.client.into_channel().map_err(|client| Self { client })
639 }
640
641 fn as_channel(&self) -> &::fidl::AsyncChannel {
642 self.client.as_channel()
643 }
644}
645
646impl ControlProxy {
647 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
649 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
650 Self { client: fidl::client::Client::new(channel, protocol_name) }
651 }
652
653 pub fn take_event_stream(&self) -> ControlEventStream {
659 ControlEventStream { event_receiver: self.client.take_event_receiver() }
660 }
661
662 pub fn r#get_elements(
667 &self,
668 ) -> fidl::client::QueryResponseFut<
669 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResult,
670 fidl::encoding::DefaultFuchsiaResourceDialect,
671 > {
672 ControlProxyInterface::r#get_elements(self)
673 }
674
675 pub fn r#watch_element_state(
685 &self,
686 mut processing_element_id: u64,
687 ) -> fidl::client::QueryResponseFut<
688 fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
689 fidl::encoding::DefaultFuchsiaResourceDialect,
690 > {
691 ControlProxyInterface::r#watch_element_state(self, processing_element_id)
692 }
693
694 pub fn r#get_topologies(
703 &self,
704 ) -> fidl::client::QueryResponseFut<
705 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResult,
706 fidl::encoding::DefaultFuchsiaResourceDialect,
707 > {
708 ControlProxyInterface::r#get_topologies(self)
709 }
710
711 pub fn r#watch_topology(
718 &self,
719 ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
720 ControlProxyInterface::r#watch_topology(self)
721 }
722
723 pub fn r#set_element_state(
753 &self,
754 mut processing_element_id: u64,
755 mut state: &fidl_fuchsia_hardware_audio_signalprocessing::SettableElementState,
756 ) -> fidl::client::QueryResponseFut<
757 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetElementStateResult,
758 fidl::encoding::DefaultFuchsiaResourceDialect,
759 > {
760 ControlProxyInterface::r#set_element_state(self, processing_element_id, state)
761 }
762
763 pub fn r#set_topology(
775 &self,
776 mut topology_id: u64,
777 ) -> fidl::client::QueryResponseFut<
778 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetTopologyResult,
779 fidl::encoding::DefaultFuchsiaResourceDialect,
780 > {
781 ControlProxyInterface::r#set_topology(self, topology_id)
782 }
783
784 pub fn r#create_ring_buffer(
789 &self,
790 mut payload: ControlCreateRingBufferRequest,
791 ) -> fidl::client::QueryResponseFut<
792 ControlCreateRingBufferResult,
793 fidl::encoding::DefaultFuchsiaResourceDialect,
794 > {
795 ControlProxyInterface::r#create_ring_buffer(self, payload)
796 }
797
798 pub fn r#set_dai_format(
805 &self,
806 mut payload: &ControlSetDaiFormatRequest,
807 ) -> fidl::client::QueryResponseFut<
808 ControlSetDaiFormatResult,
809 fidl::encoding::DefaultFuchsiaResourceDialect,
810 > {
811 ControlProxyInterface::r#set_dai_format(self, payload)
812 }
813
814 pub fn r#codec_start(
820 &self,
821 ) -> fidl::client::QueryResponseFut<
822 ControlCodecStartResult,
823 fidl::encoding::DefaultFuchsiaResourceDialect,
824 > {
825 ControlProxyInterface::r#codec_start(self)
826 }
827
828 pub fn r#codec_stop(
834 &self,
835 ) -> fidl::client::QueryResponseFut<
836 ControlCodecStopResult,
837 fidl::encoding::DefaultFuchsiaResourceDialect,
838 > {
839 ControlProxyInterface::r#codec_stop(self)
840 }
841
842 pub fn r#reset(
855 &self,
856 ) -> fidl::client::QueryResponseFut<
857 ControlResetResult,
858 fidl::encoding::DefaultFuchsiaResourceDialect,
859 > {
860 ControlProxyInterface::r#reset(self)
861 }
862}
863
864impl ControlProxyInterface for ControlProxy {
865 type GetElementsResponseFut = fidl::client::QueryResponseFut<
866 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResult,
867 fidl::encoding::DefaultFuchsiaResourceDialect,
868 >;
869 fn r#get_elements(&self) -> Self::GetElementsResponseFut {
870 fn _decode(
871 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
872 ) -> Result<
873 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResult,
874 fidl::Error,
875 > {
876 let _response = fidl::client::decode_transaction_body::<
877 fidl::encoding::ResultType<
878 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResponse,
879 i32,
880 >,
881 fidl::encoding::DefaultFuchsiaResourceDialect,
882 0x1b14ff4adf5dc6f8,
883 >(_buf?)?;
884 Ok(_response.map(|x| x.processing_elements))
885 }
886 self.client.send_query_and_decode::<
887 fidl::encoding::EmptyPayload,
888 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResult,
889 >(
890 (),
891 0x1b14ff4adf5dc6f8,
892 fidl::encoding::DynamicFlags::empty(),
893 _decode,
894 )
895 }
896
897 type WatchElementStateResponseFut = fidl::client::QueryResponseFut<
898 fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
899 fidl::encoding::DefaultFuchsiaResourceDialect,
900 >;
901 fn r#watch_element_state(
902 &self,
903 mut processing_element_id: u64,
904 ) -> Self::WatchElementStateResponseFut {
905 fn _decode(
906 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
907 ) -> Result<fidl_fuchsia_hardware_audio_signalprocessing::ElementState, fidl::Error>
908 {
909 let _response = fidl::client::decode_transaction_body::<
910 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateResponse,
911 fidl::encoding::DefaultFuchsiaResourceDialect,
912 0x524da8772a69056f,
913 >(_buf?)?;
914 Ok(_response.state)
915 }
916 self.client.send_query_and_decode::<
917 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateRequest,
918 fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
919 >(
920 (processing_element_id,),
921 0x524da8772a69056f,
922 fidl::encoding::DynamicFlags::empty(),
923 _decode,
924 )
925 }
926
927 type GetTopologiesResponseFut = fidl::client::QueryResponseFut<
928 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResult,
929 fidl::encoding::DefaultFuchsiaResourceDialect,
930 >;
931 fn r#get_topologies(&self) -> Self::GetTopologiesResponseFut {
932 fn _decode(
933 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
934 ) -> Result<
935 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResult,
936 fidl::Error,
937 > {
938 let _response = fidl::client::decode_transaction_body::<
939 fidl::encoding::ResultType<
940 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResponse,
941 i32,
942 >,
943 fidl::encoding::DefaultFuchsiaResourceDialect,
944 0x73ffb73af24d30b6,
945 >(_buf?)?;
946 Ok(_response.map(|x| x.topologies))
947 }
948 self.client.send_query_and_decode::<
949 fidl::encoding::EmptyPayload,
950 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResult,
951 >(
952 (),
953 0x73ffb73af24d30b6,
954 fidl::encoding::DynamicFlags::empty(),
955 _decode,
956 )
957 }
958
959 type WatchTopologyResponseFut =
960 fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
961 fn r#watch_topology(&self) -> Self::WatchTopologyResponseFut {
962 fn _decode(
963 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
964 ) -> Result<u64, fidl::Error> {
965 let _response = fidl::client::decode_transaction_body::<
966 fidl::encoding::FlexibleType<
967 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchTopologyResponse,
968 >,
969 fidl::encoding::DefaultFuchsiaResourceDialect,
970 0x66d172acdb36a729,
971 >(_buf?)?
972 .into_result::<ControlMarker>("watch_topology")?;
973 Ok(_response.topology_id)
974 }
975 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
976 (),
977 0x66d172acdb36a729,
978 fidl::encoding::DynamicFlags::FLEXIBLE,
979 _decode,
980 )
981 }
982
983 type SetElementStateResponseFut = fidl::client::QueryResponseFut<
984 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetElementStateResult,
985 fidl::encoding::DefaultFuchsiaResourceDialect,
986 >;
987 fn r#set_element_state(
988 &self,
989 mut processing_element_id: u64,
990 mut state: &fidl_fuchsia_hardware_audio_signalprocessing::SettableElementState,
991 ) -> Self::SetElementStateResponseFut {
992 fn _decode(
993 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
994 ) -> Result<
995 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetElementStateResult,
996 fidl::Error,
997 > {
998 let _response = fidl::client::decode_transaction_body::<
999 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1000 fidl::encoding::DefaultFuchsiaResourceDialect,
1001 0x38c3b2d4bae698f4,
1002 >(_buf?)?;
1003 Ok(_response.map(|x| x))
1004 }
1005 self.client.send_query_and_decode::<
1006 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetElementStateRequest,
1007 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetElementStateResult,
1008 >(
1009 (processing_element_id, state,),
1010 0x38c3b2d4bae698f4,
1011 fidl::encoding::DynamicFlags::empty(),
1012 _decode,
1013 )
1014 }
1015
1016 type SetTopologyResponseFut = fidl::client::QueryResponseFut<
1017 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetTopologyResult,
1018 fidl::encoding::DefaultFuchsiaResourceDialect,
1019 >;
1020 fn r#set_topology(&self, mut topology_id: u64) -> Self::SetTopologyResponseFut {
1021 fn _decode(
1022 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1023 ) -> Result<
1024 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetTopologyResult,
1025 fidl::Error,
1026 > {
1027 let _response = fidl::client::decode_transaction_body::<
1028 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1029 fidl::encoding::DefaultFuchsiaResourceDialect,
1030 0x1d9a7f9b8fee790c,
1031 >(_buf?)?;
1032 Ok(_response.map(|x| x))
1033 }
1034 self.client.send_query_and_decode::<
1035 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetTopologyRequest,
1036 fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetTopologyResult,
1037 >(
1038 (topology_id,),
1039 0x1d9a7f9b8fee790c,
1040 fidl::encoding::DynamicFlags::empty(),
1041 _decode,
1042 )
1043 }
1044
1045 type CreateRingBufferResponseFut = fidl::client::QueryResponseFut<
1046 ControlCreateRingBufferResult,
1047 fidl::encoding::DefaultFuchsiaResourceDialect,
1048 >;
1049 fn r#create_ring_buffer(
1050 &self,
1051 mut payload: ControlCreateRingBufferRequest,
1052 ) -> Self::CreateRingBufferResponseFut {
1053 fn _decode(
1054 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1055 ) -> Result<ControlCreateRingBufferResult, fidl::Error> {
1056 let _response = fidl::client::decode_transaction_body::<
1057 fidl::encoding::FlexibleResultType<
1058 ControlCreateRingBufferResponse,
1059 ControlCreateRingBufferError,
1060 >,
1061 fidl::encoding::DefaultFuchsiaResourceDialect,
1062 0x7462941cedb333db,
1063 >(_buf?)?
1064 .into_result::<ControlMarker>("create_ring_buffer")?;
1065 Ok(_response.map(|x| x))
1066 }
1067 self.client
1068 .send_query_and_decode::<ControlCreateRingBufferRequest, ControlCreateRingBufferResult>(
1069 &mut payload,
1070 0x7462941cedb333db,
1071 fidl::encoding::DynamicFlags::FLEXIBLE,
1072 _decode,
1073 )
1074 }
1075
1076 type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
1077 ControlSetDaiFormatResult,
1078 fidl::encoding::DefaultFuchsiaResourceDialect,
1079 >;
1080 fn r#set_dai_format(
1081 &self,
1082 mut payload: &ControlSetDaiFormatRequest,
1083 ) -> Self::SetDaiFormatResponseFut {
1084 fn _decode(
1085 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1086 ) -> Result<ControlSetDaiFormatResult, fidl::Error> {
1087 let _response = fidl::client::decode_transaction_body::<
1088 fidl::encoding::FlexibleResultType<
1089 ControlSetDaiFormatResponse,
1090 ControlSetDaiFormatError,
1091 >,
1092 fidl::encoding::DefaultFuchsiaResourceDialect,
1093 0x1d84f5a456a92216,
1094 >(_buf?)?
1095 .into_result::<ControlMarker>("set_dai_format")?;
1096 Ok(_response.map(|x| x))
1097 }
1098 self.client.send_query_and_decode::<ControlSetDaiFormatRequest, ControlSetDaiFormatResult>(
1099 payload,
1100 0x1d84f5a456a92216,
1101 fidl::encoding::DynamicFlags::FLEXIBLE,
1102 _decode,
1103 )
1104 }
1105
1106 type CodecStartResponseFut = fidl::client::QueryResponseFut<
1107 ControlCodecStartResult,
1108 fidl::encoding::DefaultFuchsiaResourceDialect,
1109 >;
1110 fn r#codec_start(&self) -> Self::CodecStartResponseFut {
1111 fn _decode(
1112 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1113 ) -> Result<ControlCodecStartResult, fidl::Error> {
1114 let _response = fidl::client::decode_transaction_body::<
1115 fidl::encoding::FlexibleResultType<
1116 ControlCodecStartResponse,
1117 ControlCodecStartError,
1118 >,
1119 fidl::encoding::DefaultFuchsiaResourceDialect,
1120 0x2a90a9d2958b997b,
1121 >(_buf?)?
1122 .into_result::<ControlMarker>("codec_start")?;
1123 Ok(_response.map(|x| x))
1124 }
1125 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControlCodecStartResult>(
1126 (),
1127 0x2a90a9d2958b997b,
1128 fidl::encoding::DynamicFlags::FLEXIBLE,
1129 _decode,
1130 )
1131 }
1132
1133 type CodecStopResponseFut = fidl::client::QueryResponseFut<
1134 ControlCodecStopResult,
1135 fidl::encoding::DefaultFuchsiaResourceDialect,
1136 >;
1137 fn r#codec_stop(&self) -> Self::CodecStopResponseFut {
1138 fn _decode(
1139 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1140 ) -> Result<ControlCodecStopResult, fidl::Error> {
1141 let _response = fidl::client::decode_transaction_body::<
1142 fidl::encoding::FlexibleResultType<ControlCodecStopResponse, ControlCodecStopError>,
1143 fidl::encoding::DefaultFuchsiaResourceDialect,
1144 0x387297bb6bcad25f,
1145 >(_buf?)?
1146 .into_result::<ControlMarker>("codec_stop")?;
1147 Ok(_response.map(|x| x))
1148 }
1149 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControlCodecStopResult>(
1150 (),
1151 0x387297bb6bcad25f,
1152 fidl::encoding::DynamicFlags::FLEXIBLE,
1153 _decode,
1154 )
1155 }
1156
1157 type ResetResponseFut = fidl::client::QueryResponseFut<
1158 ControlResetResult,
1159 fidl::encoding::DefaultFuchsiaResourceDialect,
1160 >;
1161 fn r#reset(&self) -> Self::ResetResponseFut {
1162 fn _decode(
1163 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1164 ) -> Result<ControlResetResult, fidl::Error> {
1165 let _response = fidl::client::decode_transaction_body::<
1166 fidl::encoding::FlexibleResultType<ControlResetResponse, ControlResetError>,
1167 fidl::encoding::DefaultFuchsiaResourceDialect,
1168 0x49840db00a698996,
1169 >(_buf?)?
1170 .into_result::<ControlMarker>("reset")?;
1171 Ok(_response.map(|x| x))
1172 }
1173 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControlResetResult>(
1174 (),
1175 0x49840db00a698996,
1176 fidl::encoding::DynamicFlags::FLEXIBLE,
1177 _decode,
1178 )
1179 }
1180}
1181
1182pub struct ControlEventStream {
1183 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1184}
1185
1186impl std::marker::Unpin for ControlEventStream {}
1187
1188impl futures::stream::FusedStream for ControlEventStream {
1189 fn is_terminated(&self) -> bool {
1190 self.event_receiver.is_terminated()
1191 }
1192}
1193
1194impl futures::Stream for ControlEventStream {
1195 type Item = Result<ControlEvent, fidl::Error>;
1196
1197 fn poll_next(
1198 mut self: std::pin::Pin<&mut Self>,
1199 cx: &mut std::task::Context<'_>,
1200 ) -> std::task::Poll<Option<Self::Item>> {
1201 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1202 &mut self.event_receiver,
1203 cx
1204 )?) {
1205 Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
1206 None => std::task::Poll::Ready(None),
1207 }
1208 }
1209}
1210
1211#[derive(Debug)]
1212pub enum ControlEvent {
1213 #[non_exhaustive]
1214 _UnknownEvent {
1215 ordinal: u64,
1217 },
1218}
1219
1220impl ControlEvent {
1221 fn decode(
1223 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1224 ) -> Result<ControlEvent, fidl::Error> {
1225 let (bytes, _handles) = buf.split_mut();
1226 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1227 debug_assert_eq!(tx_header.tx_id, 0);
1228 match tx_header.ordinal {
1229 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1230 Ok(ControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1231 }
1232 _ => Err(fidl::Error::UnknownOrdinal {
1233 ordinal: tx_header.ordinal,
1234 protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1235 }),
1236 }
1237 }
1238}
1239
1240pub struct ControlRequestStream {
1242 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1243 is_terminated: bool,
1244}
1245
1246impl std::marker::Unpin for ControlRequestStream {}
1247
1248impl futures::stream::FusedStream for ControlRequestStream {
1249 fn is_terminated(&self) -> bool {
1250 self.is_terminated
1251 }
1252}
1253
1254impl fidl::endpoints::RequestStream for ControlRequestStream {
1255 type Protocol = ControlMarker;
1256 type ControlHandle = ControlControlHandle;
1257
1258 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1259 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1260 }
1261
1262 fn control_handle(&self) -> Self::ControlHandle {
1263 ControlControlHandle { inner: self.inner.clone() }
1264 }
1265
1266 fn into_inner(
1267 self,
1268 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1269 {
1270 (self.inner, self.is_terminated)
1271 }
1272
1273 fn from_inner(
1274 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1275 is_terminated: bool,
1276 ) -> Self {
1277 Self { inner, is_terminated }
1278 }
1279}
1280
1281impl futures::Stream for ControlRequestStream {
1282 type Item = Result<ControlRequest, fidl::Error>;
1283
1284 fn poll_next(
1285 mut self: std::pin::Pin<&mut Self>,
1286 cx: &mut std::task::Context<'_>,
1287 ) -> std::task::Poll<Option<Self::Item>> {
1288 let this = &mut *self;
1289 if this.inner.check_shutdown(cx) {
1290 this.is_terminated = true;
1291 return std::task::Poll::Ready(None);
1292 }
1293 if this.is_terminated {
1294 panic!("polled ControlRequestStream after completion");
1295 }
1296 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1297 |bytes, handles| {
1298 match this.inner.channel().read_etc(cx, bytes, handles) {
1299 std::task::Poll::Ready(Ok(())) => {}
1300 std::task::Poll::Pending => return std::task::Poll::Pending,
1301 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1302 this.is_terminated = true;
1303 return std::task::Poll::Ready(None);
1304 }
1305 std::task::Poll::Ready(Err(e)) => {
1306 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1307 e.into(),
1308 ))))
1309 }
1310 }
1311
1312 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1314
1315 std::task::Poll::Ready(Some(match header.ordinal {
1316 0x1b14ff4adf5dc6f8 => {
1317 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1318 let mut req = fidl::new_empty!(
1319 fidl::encoding::EmptyPayload,
1320 fidl::encoding::DefaultFuchsiaResourceDialect
1321 );
1322 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1323 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1324 Ok(ControlRequest::GetElements {
1325 responder: ControlGetElementsResponder {
1326 control_handle: std::mem::ManuallyDrop::new(control_handle),
1327 tx_id: header.tx_id,
1328 },
1329 })
1330 }
1331 0x524da8772a69056f => {
1332 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1333 let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1334 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateRequest>(&header, _body_bytes, handles, &mut req)?;
1335 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1336 Ok(ControlRequest::WatchElementState {
1337 processing_element_id: req.processing_element_id,
1338
1339 responder: ControlWatchElementStateResponder {
1340 control_handle: std::mem::ManuallyDrop::new(control_handle),
1341 tx_id: header.tx_id,
1342 },
1343 })
1344 }
1345 0x73ffb73af24d30b6 => {
1346 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1347 let mut req = fidl::new_empty!(
1348 fidl::encoding::EmptyPayload,
1349 fidl::encoding::DefaultFuchsiaResourceDialect
1350 );
1351 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1352 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1353 Ok(ControlRequest::GetTopologies {
1354 responder: ControlGetTopologiesResponder {
1355 control_handle: std::mem::ManuallyDrop::new(control_handle),
1356 tx_id: header.tx_id,
1357 },
1358 })
1359 }
1360 0x66d172acdb36a729 => {
1361 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1362 let mut req = fidl::new_empty!(
1363 fidl::encoding::EmptyPayload,
1364 fidl::encoding::DefaultFuchsiaResourceDialect
1365 );
1366 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1367 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1368 Ok(ControlRequest::WatchTopology {
1369 responder: ControlWatchTopologyResponder {
1370 control_handle: std::mem::ManuallyDrop::new(control_handle),
1371 tx_id: header.tx_id,
1372 },
1373 })
1374 }
1375 0x38c3b2d4bae698f4 => {
1376 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1377 let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetElementStateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1378 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetElementStateRequest>(&header, _body_bytes, handles, &mut req)?;
1379 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1380 Ok(ControlRequest::SetElementState {
1381 processing_element_id: req.processing_element_id,
1382 state: req.state,
1383
1384 responder: ControlSetElementStateResponder {
1385 control_handle: std::mem::ManuallyDrop::new(control_handle),
1386 tx_id: header.tx_id,
1387 },
1388 })
1389 }
1390 0x1d9a7f9b8fee790c => {
1391 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1392 let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetTopologyRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1393 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingSetTopologyRequest>(&header, _body_bytes, handles, &mut req)?;
1394 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1395 Ok(ControlRequest::SetTopology {
1396 topology_id: req.topology_id,
1397
1398 responder: ControlSetTopologyResponder {
1399 control_handle: std::mem::ManuallyDrop::new(control_handle),
1400 tx_id: header.tx_id,
1401 },
1402 })
1403 }
1404 0x7462941cedb333db => {
1405 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1406 let mut req = fidl::new_empty!(
1407 ControlCreateRingBufferRequest,
1408 fidl::encoding::DefaultFuchsiaResourceDialect
1409 );
1410 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
1411 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1412 Ok(ControlRequest::CreateRingBuffer {
1413 payload: req,
1414 responder: ControlCreateRingBufferResponder {
1415 control_handle: std::mem::ManuallyDrop::new(control_handle),
1416 tx_id: header.tx_id,
1417 },
1418 })
1419 }
1420 0x1d84f5a456a92216 => {
1421 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1422 let mut req = fidl::new_empty!(
1423 ControlSetDaiFormatRequest,
1424 fidl::encoding::DefaultFuchsiaResourceDialect
1425 );
1426 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
1427 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1428 Ok(ControlRequest::SetDaiFormat {
1429 payload: req,
1430 responder: ControlSetDaiFormatResponder {
1431 control_handle: std::mem::ManuallyDrop::new(control_handle),
1432 tx_id: header.tx_id,
1433 },
1434 })
1435 }
1436 0x2a90a9d2958b997b => {
1437 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1438 let mut req = fidl::new_empty!(
1439 fidl::encoding::EmptyPayload,
1440 fidl::encoding::DefaultFuchsiaResourceDialect
1441 );
1442 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1443 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1444 Ok(ControlRequest::CodecStart {
1445 responder: ControlCodecStartResponder {
1446 control_handle: std::mem::ManuallyDrop::new(control_handle),
1447 tx_id: header.tx_id,
1448 },
1449 })
1450 }
1451 0x387297bb6bcad25f => {
1452 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1453 let mut req = fidl::new_empty!(
1454 fidl::encoding::EmptyPayload,
1455 fidl::encoding::DefaultFuchsiaResourceDialect
1456 );
1457 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1458 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1459 Ok(ControlRequest::CodecStop {
1460 responder: ControlCodecStopResponder {
1461 control_handle: std::mem::ManuallyDrop::new(control_handle),
1462 tx_id: header.tx_id,
1463 },
1464 })
1465 }
1466 0x49840db00a698996 => {
1467 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1468 let mut req = fidl::new_empty!(
1469 fidl::encoding::EmptyPayload,
1470 fidl::encoding::DefaultFuchsiaResourceDialect
1471 );
1472 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1473 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1474 Ok(ControlRequest::Reset {
1475 responder: ControlResetResponder {
1476 control_handle: std::mem::ManuallyDrop::new(control_handle),
1477 tx_id: header.tx_id,
1478 },
1479 })
1480 }
1481 _ if header.tx_id == 0
1482 && header
1483 .dynamic_flags()
1484 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1485 {
1486 Ok(ControlRequest::_UnknownMethod {
1487 ordinal: header.ordinal,
1488 control_handle: ControlControlHandle { inner: this.inner.clone() },
1489 method_type: fidl::MethodType::OneWay,
1490 })
1491 }
1492 _ if header
1493 .dynamic_flags()
1494 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1495 {
1496 this.inner.send_framework_err(
1497 fidl::encoding::FrameworkErr::UnknownMethod,
1498 header.tx_id,
1499 header.ordinal,
1500 header.dynamic_flags(),
1501 (bytes, handles),
1502 )?;
1503 Ok(ControlRequest::_UnknownMethod {
1504 ordinal: header.ordinal,
1505 control_handle: ControlControlHandle { inner: this.inner.clone() },
1506 method_type: fidl::MethodType::TwoWay,
1507 })
1508 }
1509 _ => Err(fidl::Error::UnknownOrdinal {
1510 ordinal: header.ordinal,
1511 protocol_name:
1512 <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1513 }),
1514 }))
1515 },
1516 )
1517 }
1518}
1519
1520#[derive(Debug)]
1526pub enum ControlRequest {
1527 GetElements { responder: ControlGetElementsResponder },
1532 WatchElementState { processing_element_id: u64, responder: ControlWatchElementStateResponder },
1542 GetTopologies { responder: ControlGetTopologiesResponder },
1551 WatchTopology { responder: ControlWatchTopologyResponder },
1558 SetElementState {
1588 processing_element_id: u64,
1589 state: fidl_fuchsia_hardware_audio_signalprocessing::SettableElementState,
1590 responder: ControlSetElementStateResponder,
1591 },
1592 SetTopology { topology_id: u64, responder: ControlSetTopologyResponder },
1604 CreateRingBuffer {
1609 payload: ControlCreateRingBufferRequest,
1610 responder: ControlCreateRingBufferResponder,
1611 },
1612 SetDaiFormat { payload: ControlSetDaiFormatRequest, responder: ControlSetDaiFormatResponder },
1619 CodecStart { responder: ControlCodecStartResponder },
1625 CodecStop { responder: ControlCodecStopResponder },
1631 Reset { responder: ControlResetResponder },
1644 #[non_exhaustive]
1646 _UnknownMethod {
1647 ordinal: u64,
1649 control_handle: ControlControlHandle,
1650 method_type: fidl::MethodType,
1651 },
1652}
1653
1654impl ControlRequest {
1655 #[allow(irrefutable_let_patterns)]
1656 pub fn into_get_elements(self) -> Option<(ControlGetElementsResponder)> {
1657 if let ControlRequest::GetElements { responder } = self {
1658 Some((responder))
1659 } else {
1660 None
1661 }
1662 }
1663
1664 #[allow(irrefutable_let_patterns)]
1665 pub fn into_watch_element_state(self) -> Option<(u64, ControlWatchElementStateResponder)> {
1666 if let ControlRequest::WatchElementState { processing_element_id, responder } = self {
1667 Some((processing_element_id, responder))
1668 } else {
1669 None
1670 }
1671 }
1672
1673 #[allow(irrefutable_let_patterns)]
1674 pub fn into_get_topologies(self) -> Option<(ControlGetTopologiesResponder)> {
1675 if let ControlRequest::GetTopologies { responder } = self {
1676 Some((responder))
1677 } else {
1678 None
1679 }
1680 }
1681
1682 #[allow(irrefutable_let_patterns)]
1683 pub fn into_watch_topology(self) -> Option<(ControlWatchTopologyResponder)> {
1684 if let ControlRequest::WatchTopology { responder } = self {
1685 Some((responder))
1686 } else {
1687 None
1688 }
1689 }
1690
1691 #[allow(irrefutable_let_patterns)]
1692 pub fn into_set_element_state(
1693 self,
1694 ) -> Option<(
1695 u64,
1696 fidl_fuchsia_hardware_audio_signalprocessing::SettableElementState,
1697 ControlSetElementStateResponder,
1698 )> {
1699 if let ControlRequest::SetElementState { processing_element_id, state, responder } = self {
1700 Some((processing_element_id, state, responder))
1701 } else {
1702 None
1703 }
1704 }
1705
1706 #[allow(irrefutable_let_patterns)]
1707 pub fn into_set_topology(self) -> Option<(u64, ControlSetTopologyResponder)> {
1708 if let ControlRequest::SetTopology { topology_id, responder } = self {
1709 Some((topology_id, responder))
1710 } else {
1711 None
1712 }
1713 }
1714
1715 #[allow(irrefutable_let_patterns)]
1716 pub fn into_create_ring_buffer(
1717 self,
1718 ) -> Option<(ControlCreateRingBufferRequest, ControlCreateRingBufferResponder)> {
1719 if let ControlRequest::CreateRingBuffer { payload, responder } = self {
1720 Some((payload, responder))
1721 } else {
1722 None
1723 }
1724 }
1725
1726 #[allow(irrefutable_let_patterns)]
1727 pub fn into_set_dai_format(
1728 self,
1729 ) -> Option<(ControlSetDaiFormatRequest, ControlSetDaiFormatResponder)> {
1730 if let ControlRequest::SetDaiFormat { payload, responder } = self {
1731 Some((payload, responder))
1732 } else {
1733 None
1734 }
1735 }
1736
1737 #[allow(irrefutable_let_patterns)]
1738 pub fn into_codec_start(self) -> Option<(ControlCodecStartResponder)> {
1739 if let ControlRequest::CodecStart { responder } = self {
1740 Some((responder))
1741 } else {
1742 None
1743 }
1744 }
1745
1746 #[allow(irrefutable_let_patterns)]
1747 pub fn into_codec_stop(self) -> Option<(ControlCodecStopResponder)> {
1748 if let ControlRequest::CodecStop { responder } = self {
1749 Some((responder))
1750 } else {
1751 None
1752 }
1753 }
1754
1755 #[allow(irrefutable_let_patterns)]
1756 pub fn into_reset(self) -> Option<(ControlResetResponder)> {
1757 if let ControlRequest::Reset { responder } = self {
1758 Some((responder))
1759 } else {
1760 None
1761 }
1762 }
1763
1764 pub fn method_name(&self) -> &'static str {
1766 match *self {
1767 ControlRequest::GetElements { .. } => "get_elements",
1768 ControlRequest::WatchElementState { .. } => "watch_element_state",
1769 ControlRequest::GetTopologies { .. } => "get_topologies",
1770 ControlRequest::WatchTopology { .. } => "watch_topology",
1771 ControlRequest::SetElementState { .. } => "set_element_state",
1772 ControlRequest::SetTopology { .. } => "set_topology",
1773 ControlRequest::CreateRingBuffer { .. } => "create_ring_buffer",
1774 ControlRequest::SetDaiFormat { .. } => "set_dai_format",
1775 ControlRequest::CodecStart { .. } => "codec_start",
1776 ControlRequest::CodecStop { .. } => "codec_stop",
1777 ControlRequest::Reset { .. } => "reset",
1778 ControlRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1779 "unknown one-way method"
1780 }
1781 ControlRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1782 "unknown two-way method"
1783 }
1784 }
1785 }
1786}
1787
1788#[derive(Debug, Clone)]
1789pub struct ControlControlHandle {
1790 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1791}
1792
1793impl fidl::endpoints::ControlHandle for ControlControlHandle {
1794 fn shutdown(&self) {
1795 self.inner.shutdown()
1796 }
1797 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1798 self.inner.shutdown_with_epitaph(status)
1799 }
1800
1801 fn is_closed(&self) -> bool {
1802 self.inner.channel().is_closed()
1803 }
1804 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1805 self.inner.channel().on_closed()
1806 }
1807
1808 #[cfg(target_os = "fuchsia")]
1809 fn signal_peer(
1810 &self,
1811 clear_mask: zx::Signals,
1812 set_mask: zx::Signals,
1813 ) -> Result<(), zx_status::Status> {
1814 use fidl::Peered;
1815 self.inner.channel().signal_peer(clear_mask, set_mask)
1816 }
1817}
1818
1819impl ControlControlHandle {}
1820
1821#[must_use = "FIDL methods require a response to be sent"]
1822#[derive(Debug)]
1823pub struct ControlGetElementsResponder {
1824 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1825 tx_id: u32,
1826}
1827
1828impl std::ops::Drop for ControlGetElementsResponder {
1832 fn drop(&mut self) {
1833 self.control_handle.shutdown();
1834 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1836 }
1837}
1838
1839impl fidl::endpoints::Responder for ControlGetElementsResponder {
1840 type ControlHandle = ControlControlHandle;
1841
1842 fn control_handle(&self) -> &ControlControlHandle {
1843 &self.control_handle
1844 }
1845
1846 fn drop_without_shutdown(mut self) {
1847 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1849 std::mem::forget(self);
1851 }
1852}
1853
1854impl ControlGetElementsResponder {
1855 pub fn send(
1859 self,
1860 mut result: Result<&[fidl_fuchsia_hardware_audio_signalprocessing::Element], i32>,
1861 ) -> Result<(), fidl::Error> {
1862 let _result = self.send_raw(result);
1863 if _result.is_err() {
1864 self.control_handle.shutdown();
1865 }
1866 self.drop_without_shutdown();
1867 _result
1868 }
1869
1870 pub fn send_no_shutdown_on_err(
1872 self,
1873 mut result: Result<&[fidl_fuchsia_hardware_audio_signalprocessing::Element], i32>,
1874 ) -> Result<(), fidl::Error> {
1875 let _result = self.send_raw(result);
1876 self.drop_without_shutdown();
1877 _result
1878 }
1879
1880 fn send_raw(
1881 &self,
1882 mut result: Result<&[fidl_fuchsia_hardware_audio_signalprocessing::Element], i32>,
1883 ) -> Result<(), fidl::Error> {
1884 self.control_handle.inner.send::<fidl::encoding::ResultType<
1885 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResponse,
1886 i32,
1887 >>(
1888 result.map(|processing_elements| (processing_elements,)),
1889 self.tx_id,
1890 0x1b14ff4adf5dc6f8,
1891 fidl::encoding::DynamicFlags::empty(),
1892 )
1893 }
1894}
1895
1896#[must_use = "FIDL methods require a response to be sent"]
1897#[derive(Debug)]
1898pub struct ControlWatchElementStateResponder {
1899 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1900 tx_id: u32,
1901}
1902
1903impl std::ops::Drop for ControlWatchElementStateResponder {
1907 fn drop(&mut self) {
1908 self.control_handle.shutdown();
1909 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1911 }
1912}
1913
1914impl fidl::endpoints::Responder for ControlWatchElementStateResponder {
1915 type ControlHandle = ControlControlHandle;
1916
1917 fn control_handle(&self) -> &ControlControlHandle {
1918 &self.control_handle
1919 }
1920
1921 fn drop_without_shutdown(mut self) {
1922 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1924 std::mem::forget(self);
1926 }
1927}
1928
1929impl ControlWatchElementStateResponder {
1930 pub fn send(
1934 self,
1935 mut state: &fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
1936 ) -> Result<(), fidl::Error> {
1937 let _result = self.send_raw(state);
1938 if _result.is_err() {
1939 self.control_handle.shutdown();
1940 }
1941 self.drop_without_shutdown();
1942 _result
1943 }
1944
1945 pub fn send_no_shutdown_on_err(
1947 self,
1948 mut state: &fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
1949 ) -> Result<(), fidl::Error> {
1950 let _result = self.send_raw(state);
1951 self.drop_without_shutdown();
1952 _result
1953 }
1954
1955 fn send_raw(
1956 &self,
1957 mut state: &fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
1958 ) -> Result<(), fidl::Error> {
1959 self.control_handle
1960 .inner
1961 .send::<fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateResponse>(
1962 (state,),
1963 self.tx_id,
1964 0x524da8772a69056f,
1965 fidl::encoding::DynamicFlags::empty(),
1966 )
1967 }
1968}
1969
1970#[must_use = "FIDL methods require a response to be sent"]
1971#[derive(Debug)]
1972pub struct ControlGetTopologiesResponder {
1973 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1974 tx_id: u32,
1975}
1976
1977impl std::ops::Drop for ControlGetTopologiesResponder {
1981 fn drop(&mut self) {
1982 self.control_handle.shutdown();
1983 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1985 }
1986}
1987
1988impl fidl::endpoints::Responder for ControlGetTopologiesResponder {
1989 type ControlHandle = ControlControlHandle;
1990
1991 fn control_handle(&self) -> &ControlControlHandle {
1992 &self.control_handle
1993 }
1994
1995 fn drop_without_shutdown(mut self) {
1996 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1998 std::mem::forget(self);
2000 }
2001}
2002
2003impl ControlGetTopologiesResponder {
2004 pub fn send(
2008 self,
2009 mut result: Result<&[fidl_fuchsia_hardware_audio_signalprocessing::Topology], i32>,
2010 ) -> Result<(), fidl::Error> {
2011 let _result = self.send_raw(result);
2012 if _result.is_err() {
2013 self.control_handle.shutdown();
2014 }
2015 self.drop_without_shutdown();
2016 _result
2017 }
2018
2019 pub fn send_no_shutdown_on_err(
2021 self,
2022 mut result: Result<&[fidl_fuchsia_hardware_audio_signalprocessing::Topology], i32>,
2023 ) -> Result<(), fidl::Error> {
2024 let _result = self.send_raw(result);
2025 self.drop_without_shutdown();
2026 _result
2027 }
2028
2029 fn send_raw(
2030 &self,
2031 mut result: Result<&[fidl_fuchsia_hardware_audio_signalprocessing::Topology], i32>,
2032 ) -> Result<(), fidl::Error> {
2033 self.control_handle.inner.send::<fidl::encoding::ResultType<
2034 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResponse,
2035 i32,
2036 >>(
2037 result.map(|topologies| (topologies,)),
2038 self.tx_id,
2039 0x73ffb73af24d30b6,
2040 fidl::encoding::DynamicFlags::empty(),
2041 )
2042 }
2043}
2044
2045#[must_use = "FIDL methods require a response to be sent"]
2046#[derive(Debug)]
2047pub struct ControlWatchTopologyResponder {
2048 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2049 tx_id: u32,
2050}
2051
2052impl std::ops::Drop for ControlWatchTopologyResponder {
2056 fn drop(&mut self) {
2057 self.control_handle.shutdown();
2058 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2060 }
2061}
2062
2063impl fidl::endpoints::Responder for ControlWatchTopologyResponder {
2064 type ControlHandle = ControlControlHandle;
2065
2066 fn control_handle(&self) -> &ControlControlHandle {
2067 &self.control_handle
2068 }
2069
2070 fn drop_without_shutdown(mut self) {
2071 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2073 std::mem::forget(self);
2075 }
2076}
2077
2078impl ControlWatchTopologyResponder {
2079 pub fn send(self, mut topology_id: u64) -> Result<(), fidl::Error> {
2083 let _result = self.send_raw(topology_id);
2084 if _result.is_err() {
2085 self.control_handle.shutdown();
2086 }
2087 self.drop_without_shutdown();
2088 _result
2089 }
2090
2091 pub fn send_no_shutdown_on_err(self, mut topology_id: u64) -> Result<(), fidl::Error> {
2093 let _result = self.send_raw(topology_id);
2094 self.drop_without_shutdown();
2095 _result
2096 }
2097
2098 fn send_raw(&self, mut topology_id: u64) -> Result<(), fidl::Error> {
2099 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
2100 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchTopologyResponse,
2101 >>(
2102 fidl::encoding::Flexible::new((topology_id,)),
2103 self.tx_id,
2104 0x66d172acdb36a729,
2105 fidl::encoding::DynamicFlags::FLEXIBLE,
2106 )
2107 }
2108}
2109
2110#[must_use = "FIDL methods require a response to be sent"]
2111#[derive(Debug)]
2112pub struct ControlSetElementStateResponder {
2113 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2114 tx_id: u32,
2115}
2116
2117impl std::ops::Drop for ControlSetElementStateResponder {
2121 fn drop(&mut self) {
2122 self.control_handle.shutdown();
2123 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2125 }
2126}
2127
2128impl fidl::endpoints::Responder for ControlSetElementStateResponder {
2129 type ControlHandle = ControlControlHandle;
2130
2131 fn control_handle(&self) -> &ControlControlHandle {
2132 &self.control_handle
2133 }
2134
2135 fn drop_without_shutdown(mut self) {
2136 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2138 std::mem::forget(self);
2140 }
2141}
2142
2143impl ControlSetElementStateResponder {
2144 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2148 let _result = self.send_raw(result);
2149 if _result.is_err() {
2150 self.control_handle.shutdown();
2151 }
2152 self.drop_without_shutdown();
2153 _result
2154 }
2155
2156 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2158 let _result = self.send_raw(result);
2159 self.drop_without_shutdown();
2160 _result
2161 }
2162
2163 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2164 self.control_handle
2165 .inner
2166 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2167 result,
2168 self.tx_id,
2169 0x38c3b2d4bae698f4,
2170 fidl::encoding::DynamicFlags::empty(),
2171 )
2172 }
2173}
2174
2175#[must_use = "FIDL methods require a response to be sent"]
2176#[derive(Debug)]
2177pub struct ControlSetTopologyResponder {
2178 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2179 tx_id: u32,
2180}
2181
2182impl std::ops::Drop for ControlSetTopologyResponder {
2186 fn drop(&mut self) {
2187 self.control_handle.shutdown();
2188 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2190 }
2191}
2192
2193impl fidl::endpoints::Responder for ControlSetTopologyResponder {
2194 type ControlHandle = ControlControlHandle;
2195
2196 fn control_handle(&self) -> &ControlControlHandle {
2197 &self.control_handle
2198 }
2199
2200 fn drop_without_shutdown(mut self) {
2201 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2203 std::mem::forget(self);
2205 }
2206}
2207
2208impl ControlSetTopologyResponder {
2209 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2213 let _result = self.send_raw(result);
2214 if _result.is_err() {
2215 self.control_handle.shutdown();
2216 }
2217 self.drop_without_shutdown();
2218 _result
2219 }
2220
2221 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2223 let _result = self.send_raw(result);
2224 self.drop_without_shutdown();
2225 _result
2226 }
2227
2228 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2229 self.control_handle
2230 .inner
2231 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2232 result,
2233 self.tx_id,
2234 0x1d9a7f9b8fee790c,
2235 fidl::encoding::DynamicFlags::empty(),
2236 )
2237 }
2238}
2239
2240#[must_use = "FIDL methods require a response to be sent"]
2241#[derive(Debug)]
2242pub struct ControlCreateRingBufferResponder {
2243 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2244 tx_id: u32,
2245}
2246
2247impl std::ops::Drop for ControlCreateRingBufferResponder {
2251 fn drop(&mut self) {
2252 self.control_handle.shutdown();
2253 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2255 }
2256}
2257
2258impl fidl::endpoints::Responder for ControlCreateRingBufferResponder {
2259 type ControlHandle = ControlControlHandle;
2260
2261 fn control_handle(&self) -> &ControlControlHandle {
2262 &self.control_handle
2263 }
2264
2265 fn drop_without_shutdown(mut self) {
2266 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2268 std::mem::forget(self);
2270 }
2271}
2272
2273impl ControlCreateRingBufferResponder {
2274 pub fn send(
2278 self,
2279 mut result: Result<ControlCreateRingBufferResponse, ControlCreateRingBufferError>,
2280 ) -> Result<(), fidl::Error> {
2281 let _result = self.send_raw(result);
2282 if _result.is_err() {
2283 self.control_handle.shutdown();
2284 }
2285 self.drop_without_shutdown();
2286 _result
2287 }
2288
2289 pub fn send_no_shutdown_on_err(
2291 self,
2292 mut result: Result<ControlCreateRingBufferResponse, ControlCreateRingBufferError>,
2293 ) -> Result<(), fidl::Error> {
2294 let _result = self.send_raw(result);
2295 self.drop_without_shutdown();
2296 _result
2297 }
2298
2299 fn send_raw(
2300 &self,
2301 mut result: Result<ControlCreateRingBufferResponse, ControlCreateRingBufferError>,
2302 ) -> Result<(), fidl::Error> {
2303 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2304 ControlCreateRingBufferResponse,
2305 ControlCreateRingBufferError,
2306 >>(
2307 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
2308 self.tx_id,
2309 0x7462941cedb333db,
2310 fidl::encoding::DynamicFlags::FLEXIBLE,
2311 )
2312 }
2313}
2314
2315#[must_use = "FIDL methods require a response to be sent"]
2316#[derive(Debug)]
2317pub struct ControlSetDaiFormatResponder {
2318 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2319 tx_id: u32,
2320}
2321
2322impl std::ops::Drop for ControlSetDaiFormatResponder {
2326 fn drop(&mut self) {
2327 self.control_handle.shutdown();
2328 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2330 }
2331}
2332
2333impl fidl::endpoints::Responder for ControlSetDaiFormatResponder {
2334 type ControlHandle = ControlControlHandle;
2335
2336 fn control_handle(&self) -> &ControlControlHandle {
2337 &self.control_handle
2338 }
2339
2340 fn drop_without_shutdown(mut self) {
2341 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2343 std::mem::forget(self);
2345 }
2346}
2347
2348impl ControlSetDaiFormatResponder {
2349 pub fn send(
2353 self,
2354 mut result: Result<&ControlSetDaiFormatResponse, ControlSetDaiFormatError>,
2355 ) -> Result<(), fidl::Error> {
2356 let _result = self.send_raw(result);
2357 if _result.is_err() {
2358 self.control_handle.shutdown();
2359 }
2360 self.drop_without_shutdown();
2361 _result
2362 }
2363
2364 pub fn send_no_shutdown_on_err(
2366 self,
2367 mut result: Result<&ControlSetDaiFormatResponse, ControlSetDaiFormatError>,
2368 ) -> Result<(), fidl::Error> {
2369 let _result = self.send_raw(result);
2370 self.drop_without_shutdown();
2371 _result
2372 }
2373
2374 fn send_raw(
2375 &self,
2376 mut result: Result<&ControlSetDaiFormatResponse, ControlSetDaiFormatError>,
2377 ) -> Result<(), fidl::Error> {
2378 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2379 ControlSetDaiFormatResponse,
2380 ControlSetDaiFormatError,
2381 >>(
2382 fidl::encoding::FlexibleResult::new(result),
2383 self.tx_id,
2384 0x1d84f5a456a92216,
2385 fidl::encoding::DynamicFlags::FLEXIBLE,
2386 )
2387 }
2388}
2389
2390#[must_use = "FIDL methods require a response to be sent"]
2391#[derive(Debug)]
2392pub struct ControlCodecStartResponder {
2393 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2394 tx_id: u32,
2395}
2396
2397impl std::ops::Drop for ControlCodecStartResponder {
2401 fn drop(&mut self) {
2402 self.control_handle.shutdown();
2403 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2405 }
2406}
2407
2408impl fidl::endpoints::Responder for ControlCodecStartResponder {
2409 type ControlHandle = ControlControlHandle;
2410
2411 fn control_handle(&self) -> &ControlControlHandle {
2412 &self.control_handle
2413 }
2414
2415 fn drop_without_shutdown(mut self) {
2416 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2418 std::mem::forget(self);
2420 }
2421}
2422
2423impl ControlCodecStartResponder {
2424 pub fn send(
2428 self,
2429 mut result: Result<&ControlCodecStartResponse, ControlCodecStartError>,
2430 ) -> Result<(), fidl::Error> {
2431 let _result = self.send_raw(result);
2432 if _result.is_err() {
2433 self.control_handle.shutdown();
2434 }
2435 self.drop_without_shutdown();
2436 _result
2437 }
2438
2439 pub fn send_no_shutdown_on_err(
2441 self,
2442 mut result: Result<&ControlCodecStartResponse, ControlCodecStartError>,
2443 ) -> Result<(), fidl::Error> {
2444 let _result = self.send_raw(result);
2445 self.drop_without_shutdown();
2446 _result
2447 }
2448
2449 fn send_raw(
2450 &self,
2451 mut result: Result<&ControlCodecStartResponse, ControlCodecStartError>,
2452 ) -> Result<(), fidl::Error> {
2453 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2454 ControlCodecStartResponse,
2455 ControlCodecStartError,
2456 >>(
2457 fidl::encoding::FlexibleResult::new(result),
2458 self.tx_id,
2459 0x2a90a9d2958b997b,
2460 fidl::encoding::DynamicFlags::FLEXIBLE,
2461 )
2462 }
2463}
2464
2465#[must_use = "FIDL methods require a response to be sent"]
2466#[derive(Debug)]
2467pub struct ControlCodecStopResponder {
2468 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2469 tx_id: u32,
2470}
2471
2472impl std::ops::Drop for ControlCodecStopResponder {
2476 fn drop(&mut self) {
2477 self.control_handle.shutdown();
2478 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2480 }
2481}
2482
2483impl fidl::endpoints::Responder for ControlCodecStopResponder {
2484 type ControlHandle = ControlControlHandle;
2485
2486 fn control_handle(&self) -> &ControlControlHandle {
2487 &self.control_handle
2488 }
2489
2490 fn drop_without_shutdown(mut self) {
2491 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2493 std::mem::forget(self);
2495 }
2496}
2497
2498impl ControlCodecStopResponder {
2499 pub fn send(
2503 self,
2504 mut result: Result<&ControlCodecStopResponse, ControlCodecStopError>,
2505 ) -> Result<(), fidl::Error> {
2506 let _result = self.send_raw(result);
2507 if _result.is_err() {
2508 self.control_handle.shutdown();
2509 }
2510 self.drop_without_shutdown();
2511 _result
2512 }
2513
2514 pub fn send_no_shutdown_on_err(
2516 self,
2517 mut result: Result<&ControlCodecStopResponse, ControlCodecStopError>,
2518 ) -> Result<(), fidl::Error> {
2519 let _result = self.send_raw(result);
2520 self.drop_without_shutdown();
2521 _result
2522 }
2523
2524 fn send_raw(
2525 &self,
2526 mut result: Result<&ControlCodecStopResponse, ControlCodecStopError>,
2527 ) -> Result<(), fidl::Error> {
2528 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2529 ControlCodecStopResponse,
2530 ControlCodecStopError,
2531 >>(
2532 fidl::encoding::FlexibleResult::new(result),
2533 self.tx_id,
2534 0x387297bb6bcad25f,
2535 fidl::encoding::DynamicFlags::FLEXIBLE,
2536 )
2537 }
2538}
2539
2540#[must_use = "FIDL methods require a response to be sent"]
2541#[derive(Debug)]
2542pub struct ControlResetResponder {
2543 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2544 tx_id: u32,
2545}
2546
2547impl std::ops::Drop for ControlResetResponder {
2551 fn drop(&mut self) {
2552 self.control_handle.shutdown();
2553 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2555 }
2556}
2557
2558impl fidl::endpoints::Responder for ControlResetResponder {
2559 type ControlHandle = ControlControlHandle;
2560
2561 fn control_handle(&self) -> &ControlControlHandle {
2562 &self.control_handle
2563 }
2564
2565 fn drop_without_shutdown(mut self) {
2566 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2568 std::mem::forget(self);
2570 }
2571}
2572
2573impl ControlResetResponder {
2574 pub fn send(
2578 self,
2579 mut result: Result<&ControlResetResponse, ControlResetError>,
2580 ) -> Result<(), fidl::Error> {
2581 let _result = self.send_raw(result);
2582 if _result.is_err() {
2583 self.control_handle.shutdown();
2584 }
2585 self.drop_without_shutdown();
2586 _result
2587 }
2588
2589 pub fn send_no_shutdown_on_err(
2591 self,
2592 mut result: Result<&ControlResetResponse, ControlResetError>,
2593 ) -> Result<(), fidl::Error> {
2594 let _result = self.send_raw(result);
2595 self.drop_without_shutdown();
2596 _result
2597 }
2598
2599 fn send_raw(
2600 &self,
2601 mut result: Result<&ControlResetResponse, ControlResetError>,
2602 ) -> Result<(), fidl::Error> {
2603 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2604 ControlResetResponse,
2605 ControlResetError,
2606 >>(
2607 fidl::encoding::FlexibleResult::new(result),
2608 self.tx_id,
2609 0x49840db00a698996,
2610 fidl::encoding::DynamicFlags::FLEXIBLE,
2611 )
2612 }
2613}
2614
2615#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2616pub struct ControlCreatorMarker;
2617
2618impl fidl::endpoints::ProtocolMarker for ControlCreatorMarker {
2619 type Proxy = ControlCreatorProxy;
2620 type RequestStream = ControlCreatorRequestStream;
2621 #[cfg(target_os = "fuchsia")]
2622 type SynchronousProxy = ControlCreatorSynchronousProxy;
2623
2624 const DEBUG_NAME: &'static str = "fuchsia.audio.device.ControlCreator";
2625}
2626impl fidl::endpoints::DiscoverableProtocolMarker for ControlCreatorMarker {}
2627pub type ControlCreatorCreateResult = Result<ControlCreatorCreateResponse, ControlCreatorError>;
2628
2629pub trait ControlCreatorProxyInterface: Send + Sync {
2630 type CreateResponseFut: std::future::Future<Output = Result<ControlCreatorCreateResult, fidl::Error>>
2631 + Send;
2632 fn r#create(&self, payload: ControlCreatorCreateRequest) -> Self::CreateResponseFut;
2633}
2634#[derive(Debug)]
2635#[cfg(target_os = "fuchsia")]
2636pub struct ControlCreatorSynchronousProxy {
2637 client: fidl::client::sync::Client,
2638}
2639
2640#[cfg(target_os = "fuchsia")]
2641impl fidl::endpoints::SynchronousProxy for ControlCreatorSynchronousProxy {
2642 type Proxy = ControlCreatorProxy;
2643 type Protocol = ControlCreatorMarker;
2644
2645 fn from_channel(inner: fidl::Channel) -> Self {
2646 Self::new(inner)
2647 }
2648
2649 fn into_channel(self) -> fidl::Channel {
2650 self.client.into_channel()
2651 }
2652
2653 fn as_channel(&self) -> &fidl::Channel {
2654 self.client.as_channel()
2655 }
2656}
2657
2658#[cfg(target_os = "fuchsia")]
2659impl ControlCreatorSynchronousProxy {
2660 pub fn new(channel: fidl::Channel) -> Self {
2661 let protocol_name = <ControlCreatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2662 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2663 }
2664
2665 pub fn into_channel(self) -> fidl::Channel {
2666 self.client.into_channel()
2667 }
2668
2669 pub fn wait_for_event(
2672 &self,
2673 deadline: zx::MonotonicInstant,
2674 ) -> Result<ControlCreatorEvent, fidl::Error> {
2675 ControlCreatorEvent::decode(self.client.wait_for_event(deadline)?)
2676 }
2677
2678 pub fn r#create(
2680 &self,
2681 mut payload: ControlCreatorCreateRequest,
2682 ___deadline: zx::MonotonicInstant,
2683 ) -> Result<ControlCreatorCreateResult, fidl::Error> {
2684 let _response =
2685 self.client
2686 .send_query::<ControlCreatorCreateRequest, fidl::encoding::FlexibleResultType<
2687 ControlCreatorCreateResponse,
2688 ControlCreatorError,
2689 >>(
2690 &mut payload,
2691 0x341bdc9f49103a31,
2692 fidl::encoding::DynamicFlags::FLEXIBLE,
2693 ___deadline,
2694 )?
2695 .into_result::<ControlCreatorMarker>("create")?;
2696 Ok(_response.map(|x| x))
2697 }
2698}
2699
2700#[cfg(target_os = "fuchsia")]
2701impl From<ControlCreatorSynchronousProxy> for zx::Handle {
2702 fn from(value: ControlCreatorSynchronousProxy) -> Self {
2703 value.into_channel().into()
2704 }
2705}
2706
2707#[cfg(target_os = "fuchsia")]
2708impl From<fidl::Channel> for ControlCreatorSynchronousProxy {
2709 fn from(value: fidl::Channel) -> Self {
2710 Self::new(value)
2711 }
2712}
2713
2714#[derive(Debug, Clone)]
2715pub struct ControlCreatorProxy {
2716 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2717}
2718
2719impl fidl::endpoints::Proxy for ControlCreatorProxy {
2720 type Protocol = ControlCreatorMarker;
2721
2722 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2723 Self::new(inner)
2724 }
2725
2726 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2727 self.client.into_channel().map_err(|client| Self { client })
2728 }
2729
2730 fn as_channel(&self) -> &::fidl::AsyncChannel {
2731 self.client.as_channel()
2732 }
2733}
2734
2735impl ControlCreatorProxy {
2736 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2738 let protocol_name = <ControlCreatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2739 Self { client: fidl::client::Client::new(channel, protocol_name) }
2740 }
2741
2742 pub fn take_event_stream(&self) -> ControlCreatorEventStream {
2748 ControlCreatorEventStream { event_receiver: self.client.take_event_receiver() }
2749 }
2750
2751 pub fn r#create(
2753 &self,
2754 mut payload: ControlCreatorCreateRequest,
2755 ) -> fidl::client::QueryResponseFut<
2756 ControlCreatorCreateResult,
2757 fidl::encoding::DefaultFuchsiaResourceDialect,
2758 > {
2759 ControlCreatorProxyInterface::r#create(self, payload)
2760 }
2761}
2762
2763impl ControlCreatorProxyInterface for ControlCreatorProxy {
2764 type CreateResponseFut = fidl::client::QueryResponseFut<
2765 ControlCreatorCreateResult,
2766 fidl::encoding::DefaultFuchsiaResourceDialect,
2767 >;
2768 fn r#create(&self, mut payload: ControlCreatorCreateRequest) -> Self::CreateResponseFut {
2769 fn _decode(
2770 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2771 ) -> Result<ControlCreatorCreateResult, fidl::Error> {
2772 let _response = fidl::client::decode_transaction_body::<
2773 fidl::encoding::FlexibleResultType<
2774 ControlCreatorCreateResponse,
2775 ControlCreatorError,
2776 >,
2777 fidl::encoding::DefaultFuchsiaResourceDialect,
2778 0x341bdc9f49103a31,
2779 >(_buf?)?
2780 .into_result::<ControlCreatorMarker>("create")?;
2781 Ok(_response.map(|x| x))
2782 }
2783 self.client
2784 .send_query_and_decode::<ControlCreatorCreateRequest, ControlCreatorCreateResult>(
2785 &mut payload,
2786 0x341bdc9f49103a31,
2787 fidl::encoding::DynamicFlags::FLEXIBLE,
2788 _decode,
2789 )
2790 }
2791}
2792
2793pub struct ControlCreatorEventStream {
2794 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2795}
2796
2797impl std::marker::Unpin for ControlCreatorEventStream {}
2798
2799impl futures::stream::FusedStream for ControlCreatorEventStream {
2800 fn is_terminated(&self) -> bool {
2801 self.event_receiver.is_terminated()
2802 }
2803}
2804
2805impl futures::Stream for ControlCreatorEventStream {
2806 type Item = Result<ControlCreatorEvent, fidl::Error>;
2807
2808 fn poll_next(
2809 mut self: std::pin::Pin<&mut Self>,
2810 cx: &mut std::task::Context<'_>,
2811 ) -> std::task::Poll<Option<Self::Item>> {
2812 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2813 &mut self.event_receiver,
2814 cx
2815 )?) {
2816 Some(buf) => std::task::Poll::Ready(Some(ControlCreatorEvent::decode(buf))),
2817 None => std::task::Poll::Ready(None),
2818 }
2819 }
2820}
2821
2822#[derive(Debug)]
2823pub enum ControlCreatorEvent {
2824 #[non_exhaustive]
2825 _UnknownEvent {
2826 ordinal: u64,
2828 },
2829}
2830
2831impl ControlCreatorEvent {
2832 fn decode(
2834 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2835 ) -> Result<ControlCreatorEvent, fidl::Error> {
2836 let (bytes, _handles) = buf.split_mut();
2837 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2838 debug_assert_eq!(tx_header.tx_id, 0);
2839 match tx_header.ordinal {
2840 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2841 Ok(ControlCreatorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2842 }
2843 _ => Err(fidl::Error::UnknownOrdinal {
2844 ordinal: tx_header.ordinal,
2845 protocol_name:
2846 <ControlCreatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2847 }),
2848 }
2849 }
2850}
2851
2852pub struct ControlCreatorRequestStream {
2854 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2855 is_terminated: bool,
2856}
2857
2858impl std::marker::Unpin for ControlCreatorRequestStream {}
2859
2860impl futures::stream::FusedStream for ControlCreatorRequestStream {
2861 fn is_terminated(&self) -> bool {
2862 self.is_terminated
2863 }
2864}
2865
2866impl fidl::endpoints::RequestStream for ControlCreatorRequestStream {
2867 type Protocol = ControlCreatorMarker;
2868 type ControlHandle = ControlCreatorControlHandle;
2869
2870 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2871 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2872 }
2873
2874 fn control_handle(&self) -> Self::ControlHandle {
2875 ControlCreatorControlHandle { inner: self.inner.clone() }
2876 }
2877
2878 fn into_inner(
2879 self,
2880 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2881 {
2882 (self.inner, self.is_terminated)
2883 }
2884
2885 fn from_inner(
2886 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2887 is_terminated: bool,
2888 ) -> Self {
2889 Self { inner, is_terminated }
2890 }
2891}
2892
2893impl futures::Stream for ControlCreatorRequestStream {
2894 type Item = Result<ControlCreatorRequest, fidl::Error>;
2895
2896 fn poll_next(
2897 mut self: std::pin::Pin<&mut Self>,
2898 cx: &mut std::task::Context<'_>,
2899 ) -> std::task::Poll<Option<Self::Item>> {
2900 let this = &mut *self;
2901 if this.inner.check_shutdown(cx) {
2902 this.is_terminated = true;
2903 return std::task::Poll::Ready(None);
2904 }
2905 if this.is_terminated {
2906 panic!("polled ControlCreatorRequestStream after completion");
2907 }
2908 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2909 |bytes, handles| {
2910 match this.inner.channel().read_etc(cx, bytes, handles) {
2911 std::task::Poll::Ready(Ok(())) => {}
2912 std::task::Poll::Pending => return std::task::Poll::Pending,
2913 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2914 this.is_terminated = true;
2915 return std::task::Poll::Ready(None);
2916 }
2917 std::task::Poll::Ready(Err(e)) => {
2918 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2919 e.into(),
2920 ))))
2921 }
2922 }
2923
2924 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2926
2927 std::task::Poll::Ready(Some(match header.ordinal {
2928 0x341bdc9f49103a31 => {
2929 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2930 let mut req = fidl::new_empty!(
2931 ControlCreatorCreateRequest,
2932 fidl::encoding::DefaultFuchsiaResourceDialect
2933 );
2934 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlCreatorCreateRequest>(&header, _body_bytes, handles, &mut req)?;
2935 let control_handle =
2936 ControlCreatorControlHandle { inner: this.inner.clone() };
2937 Ok(ControlCreatorRequest::Create {
2938 payload: req,
2939 responder: ControlCreatorCreateResponder {
2940 control_handle: std::mem::ManuallyDrop::new(control_handle),
2941 tx_id: header.tx_id,
2942 },
2943 })
2944 }
2945 _ if header.tx_id == 0
2946 && header
2947 .dynamic_flags()
2948 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2949 {
2950 Ok(ControlCreatorRequest::_UnknownMethod {
2951 ordinal: header.ordinal,
2952 control_handle: ControlCreatorControlHandle {
2953 inner: this.inner.clone(),
2954 },
2955 method_type: fidl::MethodType::OneWay,
2956 })
2957 }
2958 _ if header
2959 .dynamic_flags()
2960 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2961 {
2962 this.inner.send_framework_err(
2963 fidl::encoding::FrameworkErr::UnknownMethod,
2964 header.tx_id,
2965 header.ordinal,
2966 header.dynamic_flags(),
2967 (bytes, handles),
2968 )?;
2969 Ok(ControlCreatorRequest::_UnknownMethod {
2970 ordinal: header.ordinal,
2971 control_handle: ControlCreatorControlHandle {
2972 inner: this.inner.clone(),
2973 },
2974 method_type: fidl::MethodType::TwoWay,
2975 })
2976 }
2977 _ => Err(fidl::Error::UnknownOrdinal {
2978 ordinal: header.ordinal,
2979 protocol_name:
2980 <ControlCreatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2981 }),
2982 }))
2983 },
2984 )
2985 }
2986}
2987
2988#[derive(Debug)]
2991pub enum ControlCreatorRequest {
2992 Create { payload: ControlCreatorCreateRequest, responder: ControlCreatorCreateResponder },
2994 #[non_exhaustive]
2996 _UnknownMethod {
2997 ordinal: u64,
2999 control_handle: ControlCreatorControlHandle,
3000 method_type: fidl::MethodType,
3001 },
3002}
3003
3004impl ControlCreatorRequest {
3005 #[allow(irrefutable_let_patterns)]
3006 pub fn into_create(
3007 self,
3008 ) -> Option<(ControlCreatorCreateRequest, ControlCreatorCreateResponder)> {
3009 if let ControlCreatorRequest::Create { payload, responder } = self {
3010 Some((payload, responder))
3011 } else {
3012 None
3013 }
3014 }
3015
3016 pub fn method_name(&self) -> &'static str {
3018 match *self {
3019 ControlCreatorRequest::Create { .. } => "create",
3020 ControlCreatorRequest::_UnknownMethod {
3021 method_type: fidl::MethodType::OneWay, ..
3022 } => "unknown one-way method",
3023 ControlCreatorRequest::_UnknownMethod {
3024 method_type: fidl::MethodType::TwoWay, ..
3025 } => "unknown two-way method",
3026 }
3027 }
3028}
3029
3030#[derive(Debug, Clone)]
3031pub struct ControlCreatorControlHandle {
3032 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3033}
3034
3035impl fidl::endpoints::ControlHandle for ControlCreatorControlHandle {
3036 fn shutdown(&self) {
3037 self.inner.shutdown()
3038 }
3039 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3040 self.inner.shutdown_with_epitaph(status)
3041 }
3042
3043 fn is_closed(&self) -> bool {
3044 self.inner.channel().is_closed()
3045 }
3046 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3047 self.inner.channel().on_closed()
3048 }
3049
3050 #[cfg(target_os = "fuchsia")]
3051 fn signal_peer(
3052 &self,
3053 clear_mask: zx::Signals,
3054 set_mask: zx::Signals,
3055 ) -> Result<(), zx_status::Status> {
3056 use fidl::Peered;
3057 self.inner.channel().signal_peer(clear_mask, set_mask)
3058 }
3059}
3060
3061impl ControlCreatorControlHandle {}
3062
3063#[must_use = "FIDL methods require a response to be sent"]
3064#[derive(Debug)]
3065pub struct ControlCreatorCreateResponder {
3066 control_handle: std::mem::ManuallyDrop<ControlCreatorControlHandle>,
3067 tx_id: u32,
3068}
3069
3070impl std::ops::Drop for ControlCreatorCreateResponder {
3074 fn drop(&mut self) {
3075 self.control_handle.shutdown();
3076 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3078 }
3079}
3080
3081impl fidl::endpoints::Responder for ControlCreatorCreateResponder {
3082 type ControlHandle = ControlCreatorControlHandle;
3083
3084 fn control_handle(&self) -> &ControlCreatorControlHandle {
3085 &self.control_handle
3086 }
3087
3088 fn drop_without_shutdown(mut self) {
3089 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3091 std::mem::forget(self);
3093 }
3094}
3095
3096impl ControlCreatorCreateResponder {
3097 pub fn send(
3101 self,
3102 mut result: Result<&ControlCreatorCreateResponse, ControlCreatorError>,
3103 ) -> Result<(), fidl::Error> {
3104 let _result = self.send_raw(result);
3105 if _result.is_err() {
3106 self.control_handle.shutdown();
3107 }
3108 self.drop_without_shutdown();
3109 _result
3110 }
3111
3112 pub fn send_no_shutdown_on_err(
3114 self,
3115 mut result: Result<&ControlCreatorCreateResponse, ControlCreatorError>,
3116 ) -> Result<(), fidl::Error> {
3117 let _result = self.send_raw(result);
3118 self.drop_without_shutdown();
3119 _result
3120 }
3121
3122 fn send_raw(
3123 &self,
3124 mut result: Result<&ControlCreatorCreateResponse, ControlCreatorError>,
3125 ) -> Result<(), fidl::Error> {
3126 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3127 ControlCreatorCreateResponse,
3128 ControlCreatorError,
3129 >>(
3130 fidl::encoding::FlexibleResult::new(result),
3131 self.tx_id,
3132 0x341bdc9f49103a31,
3133 fidl::encoding::DynamicFlags::FLEXIBLE,
3134 )
3135 }
3136}
3137
3138#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3139pub struct ObserverMarker;
3140
3141impl fidl::endpoints::ProtocolMarker for ObserverMarker {
3142 type Proxy = ObserverProxy;
3143 type RequestStream = ObserverRequestStream;
3144 #[cfg(target_os = "fuchsia")]
3145 type SynchronousProxy = ObserverSynchronousProxy;
3146
3147 const DEBUG_NAME: &'static str = "(anonymous) Observer";
3148}
3149pub type ObserverWatchPlugStateResult =
3150 Result<ObserverWatchPlugStateResponse, ObserverWatchPlugStateError>;
3151pub type ObserverGetReferenceClockResult =
3152 Result<ObserverGetReferenceClockResponse, ObserverGetReferenceClockError>;
3153
3154pub trait ObserverProxyInterface: Send + Sync {
3155 type GetElementsResponseFut: std::future::Future<
3156 Output = Result<
3157 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResult,
3158 fidl::Error,
3159 >,
3160 > + Send;
3161 fn r#get_elements(&self) -> Self::GetElementsResponseFut;
3162 type WatchElementStateResponseFut: std::future::Future<
3163 Output = Result<
3164 fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
3165 fidl::Error,
3166 >,
3167 > + Send;
3168 fn r#watch_element_state(
3169 &self,
3170 processing_element_id: u64,
3171 ) -> Self::WatchElementStateResponseFut;
3172 type GetTopologiesResponseFut: std::future::Future<
3173 Output = Result<
3174 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResult,
3175 fidl::Error,
3176 >,
3177 > + Send;
3178 fn r#get_topologies(&self) -> Self::GetTopologiesResponseFut;
3179 type WatchTopologyResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
3180 fn r#watch_topology(&self) -> Self::WatchTopologyResponseFut;
3181 type WatchPlugStateResponseFut: std::future::Future<Output = Result<ObserverWatchPlugStateResult, fidl::Error>>
3182 + Send;
3183 fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
3184 type GetReferenceClockResponseFut: std::future::Future<Output = Result<ObserverGetReferenceClockResult, fidl::Error>>
3185 + Send;
3186 fn r#get_reference_clock(&self) -> Self::GetReferenceClockResponseFut;
3187}
3188#[derive(Debug)]
3189#[cfg(target_os = "fuchsia")]
3190pub struct ObserverSynchronousProxy {
3191 client: fidl::client::sync::Client,
3192}
3193
3194#[cfg(target_os = "fuchsia")]
3195impl fidl::endpoints::SynchronousProxy for ObserverSynchronousProxy {
3196 type Proxy = ObserverProxy;
3197 type Protocol = ObserverMarker;
3198
3199 fn from_channel(inner: fidl::Channel) -> Self {
3200 Self::new(inner)
3201 }
3202
3203 fn into_channel(self) -> fidl::Channel {
3204 self.client.into_channel()
3205 }
3206
3207 fn as_channel(&self) -> &fidl::Channel {
3208 self.client.as_channel()
3209 }
3210}
3211
3212#[cfg(target_os = "fuchsia")]
3213impl ObserverSynchronousProxy {
3214 pub fn new(channel: fidl::Channel) -> Self {
3215 let protocol_name = <ObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3216 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3217 }
3218
3219 pub fn into_channel(self) -> fidl::Channel {
3220 self.client.into_channel()
3221 }
3222
3223 pub fn wait_for_event(
3226 &self,
3227 deadline: zx::MonotonicInstant,
3228 ) -> Result<ObserverEvent, fidl::Error> {
3229 ObserverEvent::decode(self.client.wait_for_event(deadline)?)
3230 }
3231
3232 pub fn r#get_elements(
3237 &self,
3238 ___deadline: zx::MonotonicInstant,
3239 ) -> Result<fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResult, fidl::Error>
3240 {
3241 let _response = self
3242 .client
3243 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
3244 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResponse,
3245 i32,
3246 >>(
3247 (), 0x1b14ff4adf5dc6f8, fidl::encoding::DynamicFlags::empty(), ___deadline
3248 )?;
3249 Ok(_response.map(|x| x.processing_elements))
3250 }
3251
3252 pub fn r#watch_element_state(
3262 &self,
3263 mut processing_element_id: u64,
3264 ___deadline: zx::MonotonicInstant,
3265 ) -> Result<fidl_fuchsia_hardware_audio_signalprocessing::ElementState, fidl::Error> {
3266 let _response = self.client.send_query::<
3267 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateRequest,
3268 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateResponse,
3269 >(
3270 (processing_element_id,),
3271 0x524da8772a69056f,
3272 fidl::encoding::DynamicFlags::empty(),
3273 ___deadline,
3274 )?;
3275 Ok(_response.state)
3276 }
3277
3278 pub fn r#get_topologies(
3287 &self,
3288 ___deadline: zx::MonotonicInstant,
3289 ) -> Result<fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResult, fidl::Error>
3290 {
3291 let _response = self
3292 .client
3293 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
3294 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResponse,
3295 i32,
3296 >>(
3297 (), 0x73ffb73af24d30b6, fidl::encoding::DynamicFlags::empty(), ___deadline
3298 )?;
3299 Ok(_response.map(|x| x.topologies))
3300 }
3301
3302 pub fn r#watch_topology(&self, ___deadline: zx::MonotonicInstant) -> Result<u64, fidl::Error> {
3309 let _response = self
3310 .client
3311 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleType<
3312 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchTopologyResponse,
3313 >>(
3314 (), 0x66d172acdb36a729, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
3315 )?
3316 .into_result::<ObserverMarker>("watch_topology")?;
3317 Ok(_response.topology_id)
3318 }
3319
3320 pub fn r#watch_plug_state(
3325 &self,
3326 ___deadline: zx::MonotonicInstant,
3327 ) -> Result<ObserverWatchPlugStateResult, fidl::Error> {
3328 let _response = self
3329 .client
3330 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
3331 ObserverWatchPlugStateResponse,
3332 ObserverWatchPlugStateError,
3333 >>(
3334 (), 0x6312bce495d2907a, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
3335 )?
3336 .into_result::<ObserverMarker>("watch_plug_state")?;
3337 Ok(_response.map(|x| x))
3338 }
3339
3340 pub fn r#get_reference_clock(
3346 &self,
3347 ___deadline: zx::MonotonicInstant,
3348 ) -> Result<ObserverGetReferenceClockResult, fidl::Error> {
3349 let _response = self
3350 .client
3351 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
3352 ObserverGetReferenceClockResponse,
3353 ObserverGetReferenceClockError,
3354 >>(
3355 (), 0x3819c5e0f9574c39, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
3356 )?
3357 .into_result::<ObserverMarker>("get_reference_clock")?;
3358 Ok(_response.map(|x| x))
3359 }
3360}
3361
3362#[cfg(target_os = "fuchsia")]
3363impl From<ObserverSynchronousProxy> for zx::Handle {
3364 fn from(value: ObserverSynchronousProxy) -> Self {
3365 value.into_channel().into()
3366 }
3367}
3368
3369#[cfg(target_os = "fuchsia")]
3370impl From<fidl::Channel> for ObserverSynchronousProxy {
3371 fn from(value: fidl::Channel) -> Self {
3372 Self::new(value)
3373 }
3374}
3375
3376#[derive(Debug, Clone)]
3377pub struct ObserverProxy {
3378 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3379}
3380
3381impl fidl::endpoints::Proxy for ObserverProxy {
3382 type Protocol = ObserverMarker;
3383
3384 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3385 Self::new(inner)
3386 }
3387
3388 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3389 self.client.into_channel().map_err(|client| Self { client })
3390 }
3391
3392 fn as_channel(&self) -> &::fidl::AsyncChannel {
3393 self.client.as_channel()
3394 }
3395}
3396
3397impl ObserverProxy {
3398 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3400 let protocol_name = <ObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3401 Self { client: fidl::client::Client::new(channel, protocol_name) }
3402 }
3403
3404 pub fn take_event_stream(&self) -> ObserverEventStream {
3410 ObserverEventStream { event_receiver: self.client.take_event_receiver() }
3411 }
3412
3413 pub fn r#get_elements(
3418 &self,
3419 ) -> fidl::client::QueryResponseFut<
3420 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResult,
3421 fidl::encoding::DefaultFuchsiaResourceDialect,
3422 > {
3423 ObserverProxyInterface::r#get_elements(self)
3424 }
3425
3426 pub fn r#watch_element_state(
3436 &self,
3437 mut processing_element_id: u64,
3438 ) -> fidl::client::QueryResponseFut<
3439 fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
3440 fidl::encoding::DefaultFuchsiaResourceDialect,
3441 > {
3442 ObserverProxyInterface::r#watch_element_state(self, processing_element_id)
3443 }
3444
3445 pub fn r#get_topologies(
3454 &self,
3455 ) -> fidl::client::QueryResponseFut<
3456 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResult,
3457 fidl::encoding::DefaultFuchsiaResourceDialect,
3458 > {
3459 ObserverProxyInterface::r#get_topologies(self)
3460 }
3461
3462 pub fn r#watch_topology(
3469 &self,
3470 ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
3471 ObserverProxyInterface::r#watch_topology(self)
3472 }
3473
3474 pub fn r#watch_plug_state(
3479 &self,
3480 ) -> fidl::client::QueryResponseFut<
3481 ObserverWatchPlugStateResult,
3482 fidl::encoding::DefaultFuchsiaResourceDialect,
3483 > {
3484 ObserverProxyInterface::r#watch_plug_state(self)
3485 }
3486
3487 pub fn r#get_reference_clock(
3493 &self,
3494 ) -> fidl::client::QueryResponseFut<
3495 ObserverGetReferenceClockResult,
3496 fidl::encoding::DefaultFuchsiaResourceDialect,
3497 > {
3498 ObserverProxyInterface::r#get_reference_clock(self)
3499 }
3500}
3501
3502impl ObserverProxyInterface for ObserverProxy {
3503 type GetElementsResponseFut = fidl::client::QueryResponseFut<
3504 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResult,
3505 fidl::encoding::DefaultFuchsiaResourceDialect,
3506 >;
3507 fn r#get_elements(&self) -> Self::GetElementsResponseFut {
3508 fn _decode(
3509 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3510 ) -> Result<
3511 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResult,
3512 fidl::Error,
3513 > {
3514 let _response = fidl::client::decode_transaction_body::<
3515 fidl::encoding::ResultType<
3516 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResponse,
3517 i32,
3518 >,
3519 fidl::encoding::DefaultFuchsiaResourceDialect,
3520 0x1b14ff4adf5dc6f8,
3521 >(_buf?)?;
3522 Ok(_response.map(|x| x.processing_elements))
3523 }
3524 self.client.send_query_and_decode::<
3525 fidl::encoding::EmptyPayload,
3526 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResult,
3527 >(
3528 (),
3529 0x1b14ff4adf5dc6f8,
3530 fidl::encoding::DynamicFlags::empty(),
3531 _decode,
3532 )
3533 }
3534
3535 type WatchElementStateResponseFut = fidl::client::QueryResponseFut<
3536 fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
3537 fidl::encoding::DefaultFuchsiaResourceDialect,
3538 >;
3539 fn r#watch_element_state(
3540 &self,
3541 mut processing_element_id: u64,
3542 ) -> Self::WatchElementStateResponseFut {
3543 fn _decode(
3544 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3545 ) -> Result<fidl_fuchsia_hardware_audio_signalprocessing::ElementState, fidl::Error>
3546 {
3547 let _response = fidl::client::decode_transaction_body::<
3548 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateResponse,
3549 fidl::encoding::DefaultFuchsiaResourceDialect,
3550 0x524da8772a69056f,
3551 >(_buf?)?;
3552 Ok(_response.state)
3553 }
3554 self.client.send_query_and_decode::<
3555 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateRequest,
3556 fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
3557 >(
3558 (processing_element_id,),
3559 0x524da8772a69056f,
3560 fidl::encoding::DynamicFlags::empty(),
3561 _decode,
3562 )
3563 }
3564
3565 type GetTopologiesResponseFut = fidl::client::QueryResponseFut<
3566 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResult,
3567 fidl::encoding::DefaultFuchsiaResourceDialect,
3568 >;
3569 fn r#get_topologies(&self) -> Self::GetTopologiesResponseFut {
3570 fn _decode(
3571 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3572 ) -> Result<
3573 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResult,
3574 fidl::Error,
3575 > {
3576 let _response = fidl::client::decode_transaction_body::<
3577 fidl::encoding::ResultType<
3578 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResponse,
3579 i32,
3580 >,
3581 fidl::encoding::DefaultFuchsiaResourceDialect,
3582 0x73ffb73af24d30b6,
3583 >(_buf?)?;
3584 Ok(_response.map(|x| x.topologies))
3585 }
3586 self.client.send_query_and_decode::<
3587 fidl::encoding::EmptyPayload,
3588 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResult,
3589 >(
3590 (),
3591 0x73ffb73af24d30b6,
3592 fidl::encoding::DynamicFlags::empty(),
3593 _decode,
3594 )
3595 }
3596
3597 type WatchTopologyResponseFut =
3598 fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
3599 fn r#watch_topology(&self) -> Self::WatchTopologyResponseFut {
3600 fn _decode(
3601 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3602 ) -> Result<u64, fidl::Error> {
3603 let _response = fidl::client::decode_transaction_body::<
3604 fidl::encoding::FlexibleType<
3605 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchTopologyResponse,
3606 >,
3607 fidl::encoding::DefaultFuchsiaResourceDialect,
3608 0x66d172acdb36a729,
3609 >(_buf?)?
3610 .into_result::<ObserverMarker>("watch_topology")?;
3611 Ok(_response.topology_id)
3612 }
3613 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
3614 (),
3615 0x66d172acdb36a729,
3616 fidl::encoding::DynamicFlags::FLEXIBLE,
3617 _decode,
3618 )
3619 }
3620
3621 type WatchPlugStateResponseFut = fidl::client::QueryResponseFut<
3622 ObserverWatchPlugStateResult,
3623 fidl::encoding::DefaultFuchsiaResourceDialect,
3624 >;
3625 fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
3626 fn _decode(
3627 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3628 ) -> Result<ObserverWatchPlugStateResult, fidl::Error> {
3629 let _response = fidl::client::decode_transaction_body::<
3630 fidl::encoding::FlexibleResultType<
3631 ObserverWatchPlugStateResponse,
3632 ObserverWatchPlugStateError,
3633 >,
3634 fidl::encoding::DefaultFuchsiaResourceDialect,
3635 0x6312bce495d2907a,
3636 >(_buf?)?
3637 .into_result::<ObserverMarker>("watch_plug_state")?;
3638 Ok(_response.map(|x| x))
3639 }
3640 self.client
3641 .send_query_and_decode::<fidl::encoding::EmptyPayload, ObserverWatchPlugStateResult>(
3642 (),
3643 0x6312bce495d2907a,
3644 fidl::encoding::DynamicFlags::FLEXIBLE,
3645 _decode,
3646 )
3647 }
3648
3649 type GetReferenceClockResponseFut = fidl::client::QueryResponseFut<
3650 ObserverGetReferenceClockResult,
3651 fidl::encoding::DefaultFuchsiaResourceDialect,
3652 >;
3653 fn r#get_reference_clock(&self) -> Self::GetReferenceClockResponseFut {
3654 fn _decode(
3655 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3656 ) -> Result<ObserverGetReferenceClockResult, fidl::Error> {
3657 let _response = fidl::client::decode_transaction_body::<
3658 fidl::encoding::FlexibleResultType<
3659 ObserverGetReferenceClockResponse,
3660 ObserverGetReferenceClockError,
3661 >,
3662 fidl::encoding::DefaultFuchsiaResourceDialect,
3663 0x3819c5e0f9574c39,
3664 >(_buf?)?
3665 .into_result::<ObserverMarker>("get_reference_clock")?;
3666 Ok(_response.map(|x| x))
3667 }
3668 self.client
3669 .send_query_and_decode::<fidl::encoding::EmptyPayload, ObserverGetReferenceClockResult>(
3670 (),
3671 0x3819c5e0f9574c39,
3672 fidl::encoding::DynamicFlags::FLEXIBLE,
3673 _decode,
3674 )
3675 }
3676}
3677
3678pub struct ObserverEventStream {
3679 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3680}
3681
3682impl std::marker::Unpin for ObserverEventStream {}
3683
3684impl futures::stream::FusedStream for ObserverEventStream {
3685 fn is_terminated(&self) -> bool {
3686 self.event_receiver.is_terminated()
3687 }
3688}
3689
3690impl futures::Stream for ObserverEventStream {
3691 type Item = Result<ObserverEvent, fidl::Error>;
3692
3693 fn poll_next(
3694 mut self: std::pin::Pin<&mut Self>,
3695 cx: &mut std::task::Context<'_>,
3696 ) -> std::task::Poll<Option<Self::Item>> {
3697 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3698 &mut self.event_receiver,
3699 cx
3700 )?) {
3701 Some(buf) => std::task::Poll::Ready(Some(ObserverEvent::decode(buf))),
3702 None => std::task::Poll::Ready(None),
3703 }
3704 }
3705}
3706
3707#[derive(Debug)]
3708pub enum ObserverEvent {
3709 #[non_exhaustive]
3710 _UnknownEvent {
3711 ordinal: u64,
3713 },
3714}
3715
3716impl ObserverEvent {
3717 fn decode(
3719 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3720 ) -> Result<ObserverEvent, fidl::Error> {
3721 let (bytes, _handles) = buf.split_mut();
3722 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3723 debug_assert_eq!(tx_header.tx_id, 0);
3724 match tx_header.ordinal {
3725 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3726 Ok(ObserverEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3727 }
3728 _ => Err(fidl::Error::UnknownOrdinal {
3729 ordinal: tx_header.ordinal,
3730 protocol_name: <ObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3731 }),
3732 }
3733 }
3734}
3735
3736pub struct ObserverRequestStream {
3738 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3739 is_terminated: bool,
3740}
3741
3742impl std::marker::Unpin for ObserverRequestStream {}
3743
3744impl futures::stream::FusedStream for ObserverRequestStream {
3745 fn is_terminated(&self) -> bool {
3746 self.is_terminated
3747 }
3748}
3749
3750impl fidl::endpoints::RequestStream for ObserverRequestStream {
3751 type Protocol = ObserverMarker;
3752 type ControlHandle = ObserverControlHandle;
3753
3754 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3755 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3756 }
3757
3758 fn control_handle(&self) -> Self::ControlHandle {
3759 ObserverControlHandle { inner: self.inner.clone() }
3760 }
3761
3762 fn into_inner(
3763 self,
3764 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3765 {
3766 (self.inner, self.is_terminated)
3767 }
3768
3769 fn from_inner(
3770 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3771 is_terminated: bool,
3772 ) -> Self {
3773 Self { inner, is_terminated }
3774 }
3775}
3776
3777impl futures::Stream for ObserverRequestStream {
3778 type Item = Result<ObserverRequest, fidl::Error>;
3779
3780 fn poll_next(
3781 mut self: std::pin::Pin<&mut Self>,
3782 cx: &mut std::task::Context<'_>,
3783 ) -> std::task::Poll<Option<Self::Item>> {
3784 let this = &mut *self;
3785 if this.inner.check_shutdown(cx) {
3786 this.is_terminated = true;
3787 return std::task::Poll::Ready(None);
3788 }
3789 if this.is_terminated {
3790 panic!("polled ObserverRequestStream after completion");
3791 }
3792 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3793 |bytes, handles| {
3794 match this.inner.channel().read_etc(cx, bytes, handles) {
3795 std::task::Poll::Ready(Ok(())) => {}
3796 std::task::Poll::Pending => return std::task::Poll::Pending,
3797 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3798 this.is_terminated = true;
3799 return std::task::Poll::Ready(None);
3800 }
3801 std::task::Poll::Ready(Err(e)) => {
3802 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3803 e.into(),
3804 ))))
3805 }
3806 }
3807
3808 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3810
3811 std::task::Poll::Ready(Some(match header.ordinal {
3812 0x1b14ff4adf5dc6f8 => {
3813 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3814 let mut req = fidl::new_empty!(
3815 fidl::encoding::EmptyPayload,
3816 fidl::encoding::DefaultFuchsiaResourceDialect
3817 );
3818 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3819 let control_handle = ObserverControlHandle { inner: this.inner.clone() };
3820 Ok(ObserverRequest::GetElements {
3821 responder: ObserverGetElementsResponder {
3822 control_handle: std::mem::ManuallyDrop::new(control_handle),
3823 tx_id: header.tx_id,
3824 },
3825 })
3826 }
3827 0x524da8772a69056f => {
3828 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3829 let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3830 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateRequest>(&header, _body_bytes, handles, &mut req)?;
3831 let control_handle = ObserverControlHandle { inner: this.inner.clone() };
3832 Ok(ObserverRequest::WatchElementState {
3833 processing_element_id: req.processing_element_id,
3834
3835 responder: ObserverWatchElementStateResponder {
3836 control_handle: std::mem::ManuallyDrop::new(control_handle),
3837 tx_id: header.tx_id,
3838 },
3839 })
3840 }
3841 0x73ffb73af24d30b6 => {
3842 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3843 let mut req = fidl::new_empty!(
3844 fidl::encoding::EmptyPayload,
3845 fidl::encoding::DefaultFuchsiaResourceDialect
3846 );
3847 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3848 let control_handle = ObserverControlHandle { inner: this.inner.clone() };
3849 Ok(ObserverRequest::GetTopologies {
3850 responder: ObserverGetTopologiesResponder {
3851 control_handle: std::mem::ManuallyDrop::new(control_handle),
3852 tx_id: header.tx_id,
3853 },
3854 })
3855 }
3856 0x66d172acdb36a729 => {
3857 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3858 let mut req = fidl::new_empty!(
3859 fidl::encoding::EmptyPayload,
3860 fidl::encoding::DefaultFuchsiaResourceDialect
3861 );
3862 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3863 let control_handle = ObserverControlHandle { inner: this.inner.clone() };
3864 Ok(ObserverRequest::WatchTopology {
3865 responder: ObserverWatchTopologyResponder {
3866 control_handle: std::mem::ManuallyDrop::new(control_handle),
3867 tx_id: header.tx_id,
3868 },
3869 })
3870 }
3871 0x6312bce495d2907a => {
3872 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3873 let mut req = fidl::new_empty!(
3874 fidl::encoding::EmptyPayload,
3875 fidl::encoding::DefaultFuchsiaResourceDialect
3876 );
3877 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3878 let control_handle = ObserverControlHandle { inner: this.inner.clone() };
3879 Ok(ObserverRequest::WatchPlugState {
3880 responder: ObserverWatchPlugStateResponder {
3881 control_handle: std::mem::ManuallyDrop::new(control_handle),
3882 tx_id: header.tx_id,
3883 },
3884 })
3885 }
3886 0x3819c5e0f9574c39 => {
3887 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3888 let mut req = fidl::new_empty!(
3889 fidl::encoding::EmptyPayload,
3890 fidl::encoding::DefaultFuchsiaResourceDialect
3891 );
3892 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3893 let control_handle = ObserverControlHandle { inner: this.inner.clone() };
3894 Ok(ObserverRequest::GetReferenceClock {
3895 responder: ObserverGetReferenceClockResponder {
3896 control_handle: std::mem::ManuallyDrop::new(control_handle),
3897 tx_id: header.tx_id,
3898 },
3899 })
3900 }
3901 _ if header.tx_id == 0
3902 && header
3903 .dynamic_flags()
3904 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3905 {
3906 Ok(ObserverRequest::_UnknownMethod {
3907 ordinal: header.ordinal,
3908 control_handle: ObserverControlHandle { inner: this.inner.clone() },
3909 method_type: fidl::MethodType::OneWay,
3910 })
3911 }
3912 _ if header
3913 .dynamic_flags()
3914 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3915 {
3916 this.inner.send_framework_err(
3917 fidl::encoding::FrameworkErr::UnknownMethod,
3918 header.tx_id,
3919 header.ordinal,
3920 header.dynamic_flags(),
3921 (bytes, handles),
3922 )?;
3923 Ok(ObserverRequest::_UnknownMethod {
3924 ordinal: header.ordinal,
3925 control_handle: ObserverControlHandle { inner: this.inner.clone() },
3926 method_type: fidl::MethodType::TwoWay,
3927 })
3928 }
3929 _ => Err(fidl::Error::UnknownOrdinal {
3930 ordinal: header.ordinal,
3931 protocol_name:
3932 <ObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3933 }),
3934 }))
3935 },
3936 )
3937 }
3938}
3939
3940#[derive(Debug)]
3945pub enum ObserverRequest {
3946 GetElements { responder: ObserverGetElementsResponder },
3951 WatchElementState { processing_element_id: u64, responder: ObserverWatchElementStateResponder },
3961 GetTopologies { responder: ObserverGetTopologiesResponder },
3970 WatchTopology { responder: ObserverWatchTopologyResponder },
3977 WatchPlugState { responder: ObserverWatchPlugStateResponder },
3982 GetReferenceClock { responder: ObserverGetReferenceClockResponder },
3988 #[non_exhaustive]
3990 _UnknownMethod {
3991 ordinal: u64,
3993 control_handle: ObserverControlHandle,
3994 method_type: fidl::MethodType,
3995 },
3996}
3997
3998impl ObserverRequest {
3999 #[allow(irrefutable_let_patterns)]
4000 pub fn into_get_elements(self) -> Option<(ObserverGetElementsResponder)> {
4001 if let ObserverRequest::GetElements { responder } = self {
4002 Some((responder))
4003 } else {
4004 None
4005 }
4006 }
4007
4008 #[allow(irrefutable_let_patterns)]
4009 pub fn into_watch_element_state(self) -> Option<(u64, ObserverWatchElementStateResponder)> {
4010 if let ObserverRequest::WatchElementState { processing_element_id, responder } = self {
4011 Some((processing_element_id, responder))
4012 } else {
4013 None
4014 }
4015 }
4016
4017 #[allow(irrefutable_let_patterns)]
4018 pub fn into_get_topologies(self) -> Option<(ObserverGetTopologiesResponder)> {
4019 if let ObserverRequest::GetTopologies { responder } = self {
4020 Some((responder))
4021 } else {
4022 None
4023 }
4024 }
4025
4026 #[allow(irrefutable_let_patterns)]
4027 pub fn into_watch_topology(self) -> Option<(ObserverWatchTopologyResponder)> {
4028 if let ObserverRequest::WatchTopology { responder } = self {
4029 Some((responder))
4030 } else {
4031 None
4032 }
4033 }
4034
4035 #[allow(irrefutable_let_patterns)]
4036 pub fn into_watch_plug_state(self) -> Option<(ObserverWatchPlugStateResponder)> {
4037 if let ObserverRequest::WatchPlugState { responder } = self {
4038 Some((responder))
4039 } else {
4040 None
4041 }
4042 }
4043
4044 #[allow(irrefutable_let_patterns)]
4045 pub fn into_get_reference_clock(self) -> Option<(ObserverGetReferenceClockResponder)> {
4046 if let ObserverRequest::GetReferenceClock { responder } = self {
4047 Some((responder))
4048 } else {
4049 None
4050 }
4051 }
4052
4053 pub fn method_name(&self) -> &'static str {
4055 match *self {
4056 ObserverRequest::GetElements { .. } => "get_elements",
4057 ObserverRequest::WatchElementState { .. } => "watch_element_state",
4058 ObserverRequest::GetTopologies { .. } => "get_topologies",
4059 ObserverRequest::WatchTopology { .. } => "watch_topology",
4060 ObserverRequest::WatchPlugState { .. } => "watch_plug_state",
4061 ObserverRequest::GetReferenceClock { .. } => "get_reference_clock",
4062 ObserverRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4063 "unknown one-way method"
4064 }
4065 ObserverRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4066 "unknown two-way method"
4067 }
4068 }
4069 }
4070}
4071
4072#[derive(Debug, Clone)]
4073pub struct ObserverControlHandle {
4074 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4075}
4076
4077impl fidl::endpoints::ControlHandle for ObserverControlHandle {
4078 fn shutdown(&self) {
4079 self.inner.shutdown()
4080 }
4081 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4082 self.inner.shutdown_with_epitaph(status)
4083 }
4084
4085 fn is_closed(&self) -> bool {
4086 self.inner.channel().is_closed()
4087 }
4088 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4089 self.inner.channel().on_closed()
4090 }
4091
4092 #[cfg(target_os = "fuchsia")]
4093 fn signal_peer(
4094 &self,
4095 clear_mask: zx::Signals,
4096 set_mask: zx::Signals,
4097 ) -> Result<(), zx_status::Status> {
4098 use fidl::Peered;
4099 self.inner.channel().signal_peer(clear_mask, set_mask)
4100 }
4101}
4102
4103impl ObserverControlHandle {}
4104
4105#[must_use = "FIDL methods require a response to be sent"]
4106#[derive(Debug)]
4107pub struct ObserverGetElementsResponder {
4108 control_handle: std::mem::ManuallyDrop<ObserverControlHandle>,
4109 tx_id: u32,
4110}
4111
4112impl std::ops::Drop for ObserverGetElementsResponder {
4116 fn drop(&mut self) {
4117 self.control_handle.shutdown();
4118 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4120 }
4121}
4122
4123impl fidl::endpoints::Responder for ObserverGetElementsResponder {
4124 type ControlHandle = ObserverControlHandle;
4125
4126 fn control_handle(&self) -> &ObserverControlHandle {
4127 &self.control_handle
4128 }
4129
4130 fn drop_without_shutdown(mut self) {
4131 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4133 std::mem::forget(self);
4135 }
4136}
4137
4138impl ObserverGetElementsResponder {
4139 pub fn send(
4143 self,
4144 mut result: Result<&[fidl_fuchsia_hardware_audio_signalprocessing::Element], i32>,
4145 ) -> Result<(), fidl::Error> {
4146 let _result = self.send_raw(result);
4147 if _result.is_err() {
4148 self.control_handle.shutdown();
4149 }
4150 self.drop_without_shutdown();
4151 _result
4152 }
4153
4154 pub fn send_no_shutdown_on_err(
4156 self,
4157 mut result: Result<&[fidl_fuchsia_hardware_audio_signalprocessing::Element], i32>,
4158 ) -> Result<(), fidl::Error> {
4159 let _result = self.send_raw(result);
4160 self.drop_without_shutdown();
4161 _result
4162 }
4163
4164 fn send_raw(
4165 &self,
4166 mut result: Result<&[fidl_fuchsia_hardware_audio_signalprocessing::Element], i32>,
4167 ) -> Result<(), fidl::Error> {
4168 self.control_handle.inner.send::<fidl::encoding::ResultType<
4169 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetElementsResponse,
4170 i32,
4171 >>(
4172 result.map(|processing_elements| (processing_elements,)),
4173 self.tx_id,
4174 0x1b14ff4adf5dc6f8,
4175 fidl::encoding::DynamicFlags::empty(),
4176 )
4177 }
4178}
4179
4180#[must_use = "FIDL methods require a response to be sent"]
4181#[derive(Debug)]
4182pub struct ObserverWatchElementStateResponder {
4183 control_handle: std::mem::ManuallyDrop<ObserverControlHandle>,
4184 tx_id: u32,
4185}
4186
4187impl std::ops::Drop for ObserverWatchElementStateResponder {
4191 fn drop(&mut self) {
4192 self.control_handle.shutdown();
4193 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4195 }
4196}
4197
4198impl fidl::endpoints::Responder for ObserverWatchElementStateResponder {
4199 type ControlHandle = ObserverControlHandle;
4200
4201 fn control_handle(&self) -> &ObserverControlHandle {
4202 &self.control_handle
4203 }
4204
4205 fn drop_without_shutdown(mut self) {
4206 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4208 std::mem::forget(self);
4210 }
4211}
4212
4213impl ObserverWatchElementStateResponder {
4214 pub fn send(
4218 self,
4219 mut state: &fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
4220 ) -> Result<(), fidl::Error> {
4221 let _result = self.send_raw(state);
4222 if _result.is_err() {
4223 self.control_handle.shutdown();
4224 }
4225 self.drop_without_shutdown();
4226 _result
4227 }
4228
4229 pub fn send_no_shutdown_on_err(
4231 self,
4232 mut state: &fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
4233 ) -> Result<(), fidl::Error> {
4234 let _result = self.send_raw(state);
4235 self.drop_without_shutdown();
4236 _result
4237 }
4238
4239 fn send_raw(
4240 &self,
4241 mut state: &fidl_fuchsia_hardware_audio_signalprocessing::ElementState,
4242 ) -> Result<(), fidl::Error> {
4243 self.control_handle
4244 .inner
4245 .send::<fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchElementStateResponse>(
4246 (state,),
4247 self.tx_id,
4248 0x524da8772a69056f,
4249 fidl::encoding::DynamicFlags::empty(),
4250 )
4251 }
4252}
4253
4254#[must_use = "FIDL methods require a response to be sent"]
4255#[derive(Debug)]
4256pub struct ObserverGetTopologiesResponder {
4257 control_handle: std::mem::ManuallyDrop<ObserverControlHandle>,
4258 tx_id: u32,
4259}
4260
4261impl std::ops::Drop for ObserverGetTopologiesResponder {
4265 fn drop(&mut self) {
4266 self.control_handle.shutdown();
4267 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4269 }
4270}
4271
4272impl fidl::endpoints::Responder for ObserverGetTopologiesResponder {
4273 type ControlHandle = ObserverControlHandle;
4274
4275 fn control_handle(&self) -> &ObserverControlHandle {
4276 &self.control_handle
4277 }
4278
4279 fn drop_without_shutdown(mut self) {
4280 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4282 std::mem::forget(self);
4284 }
4285}
4286
4287impl ObserverGetTopologiesResponder {
4288 pub fn send(
4292 self,
4293 mut result: Result<&[fidl_fuchsia_hardware_audio_signalprocessing::Topology], i32>,
4294 ) -> Result<(), fidl::Error> {
4295 let _result = self.send_raw(result);
4296 if _result.is_err() {
4297 self.control_handle.shutdown();
4298 }
4299 self.drop_without_shutdown();
4300 _result
4301 }
4302
4303 pub fn send_no_shutdown_on_err(
4305 self,
4306 mut result: Result<&[fidl_fuchsia_hardware_audio_signalprocessing::Topology], i32>,
4307 ) -> Result<(), fidl::Error> {
4308 let _result = self.send_raw(result);
4309 self.drop_without_shutdown();
4310 _result
4311 }
4312
4313 fn send_raw(
4314 &self,
4315 mut result: Result<&[fidl_fuchsia_hardware_audio_signalprocessing::Topology], i32>,
4316 ) -> Result<(), fidl::Error> {
4317 self.control_handle.inner.send::<fidl::encoding::ResultType<
4318 fidl_fuchsia_hardware_audio_signalprocessing::ReaderGetTopologiesResponse,
4319 i32,
4320 >>(
4321 result.map(|topologies| (topologies,)),
4322 self.tx_id,
4323 0x73ffb73af24d30b6,
4324 fidl::encoding::DynamicFlags::empty(),
4325 )
4326 }
4327}
4328
4329#[must_use = "FIDL methods require a response to be sent"]
4330#[derive(Debug)]
4331pub struct ObserverWatchTopologyResponder {
4332 control_handle: std::mem::ManuallyDrop<ObserverControlHandle>,
4333 tx_id: u32,
4334}
4335
4336impl std::ops::Drop for ObserverWatchTopologyResponder {
4340 fn drop(&mut self) {
4341 self.control_handle.shutdown();
4342 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4344 }
4345}
4346
4347impl fidl::endpoints::Responder for ObserverWatchTopologyResponder {
4348 type ControlHandle = ObserverControlHandle;
4349
4350 fn control_handle(&self) -> &ObserverControlHandle {
4351 &self.control_handle
4352 }
4353
4354 fn drop_without_shutdown(mut self) {
4355 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4357 std::mem::forget(self);
4359 }
4360}
4361
4362impl ObserverWatchTopologyResponder {
4363 pub fn send(self, mut topology_id: u64) -> Result<(), fidl::Error> {
4367 let _result = self.send_raw(topology_id);
4368 if _result.is_err() {
4369 self.control_handle.shutdown();
4370 }
4371 self.drop_without_shutdown();
4372 _result
4373 }
4374
4375 pub fn send_no_shutdown_on_err(self, mut topology_id: u64) -> Result<(), fidl::Error> {
4377 let _result = self.send_raw(topology_id);
4378 self.drop_without_shutdown();
4379 _result
4380 }
4381
4382 fn send_raw(&self, mut topology_id: u64) -> Result<(), fidl::Error> {
4383 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
4384 fidl_fuchsia_hardware_audio_signalprocessing::ReaderWatchTopologyResponse,
4385 >>(
4386 fidl::encoding::Flexible::new((topology_id,)),
4387 self.tx_id,
4388 0x66d172acdb36a729,
4389 fidl::encoding::DynamicFlags::FLEXIBLE,
4390 )
4391 }
4392}
4393
4394#[must_use = "FIDL methods require a response to be sent"]
4395#[derive(Debug)]
4396pub struct ObserverWatchPlugStateResponder {
4397 control_handle: std::mem::ManuallyDrop<ObserverControlHandle>,
4398 tx_id: u32,
4399}
4400
4401impl std::ops::Drop for ObserverWatchPlugStateResponder {
4405 fn drop(&mut self) {
4406 self.control_handle.shutdown();
4407 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4409 }
4410}
4411
4412impl fidl::endpoints::Responder for ObserverWatchPlugStateResponder {
4413 type ControlHandle = ObserverControlHandle;
4414
4415 fn control_handle(&self) -> &ObserverControlHandle {
4416 &self.control_handle
4417 }
4418
4419 fn drop_without_shutdown(mut self) {
4420 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4422 std::mem::forget(self);
4424 }
4425}
4426
4427impl ObserverWatchPlugStateResponder {
4428 pub fn send(
4432 self,
4433 mut result: Result<&ObserverWatchPlugStateResponse, ObserverWatchPlugStateError>,
4434 ) -> Result<(), fidl::Error> {
4435 let _result = self.send_raw(result);
4436 if _result.is_err() {
4437 self.control_handle.shutdown();
4438 }
4439 self.drop_without_shutdown();
4440 _result
4441 }
4442
4443 pub fn send_no_shutdown_on_err(
4445 self,
4446 mut result: Result<&ObserverWatchPlugStateResponse, ObserverWatchPlugStateError>,
4447 ) -> Result<(), fidl::Error> {
4448 let _result = self.send_raw(result);
4449 self.drop_without_shutdown();
4450 _result
4451 }
4452
4453 fn send_raw(
4454 &self,
4455 mut result: Result<&ObserverWatchPlugStateResponse, ObserverWatchPlugStateError>,
4456 ) -> Result<(), fidl::Error> {
4457 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4458 ObserverWatchPlugStateResponse,
4459 ObserverWatchPlugStateError,
4460 >>(
4461 fidl::encoding::FlexibleResult::new(result),
4462 self.tx_id,
4463 0x6312bce495d2907a,
4464 fidl::encoding::DynamicFlags::FLEXIBLE,
4465 )
4466 }
4467}
4468
4469#[must_use = "FIDL methods require a response to be sent"]
4470#[derive(Debug)]
4471pub struct ObserverGetReferenceClockResponder {
4472 control_handle: std::mem::ManuallyDrop<ObserverControlHandle>,
4473 tx_id: u32,
4474}
4475
4476impl std::ops::Drop for ObserverGetReferenceClockResponder {
4480 fn drop(&mut self) {
4481 self.control_handle.shutdown();
4482 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4484 }
4485}
4486
4487impl fidl::endpoints::Responder for ObserverGetReferenceClockResponder {
4488 type ControlHandle = ObserverControlHandle;
4489
4490 fn control_handle(&self) -> &ObserverControlHandle {
4491 &self.control_handle
4492 }
4493
4494 fn drop_without_shutdown(mut self) {
4495 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4497 std::mem::forget(self);
4499 }
4500}
4501
4502impl ObserverGetReferenceClockResponder {
4503 pub fn send(
4507 self,
4508 mut result: Result<ObserverGetReferenceClockResponse, ObserverGetReferenceClockError>,
4509 ) -> Result<(), fidl::Error> {
4510 let _result = self.send_raw(result);
4511 if _result.is_err() {
4512 self.control_handle.shutdown();
4513 }
4514 self.drop_without_shutdown();
4515 _result
4516 }
4517
4518 pub fn send_no_shutdown_on_err(
4520 self,
4521 mut result: Result<ObserverGetReferenceClockResponse, ObserverGetReferenceClockError>,
4522 ) -> Result<(), fidl::Error> {
4523 let _result = self.send_raw(result);
4524 self.drop_without_shutdown();
4525 _result
4526 }
4527
4528 fn send_raw(
4529 &self,
4530 mut result: Result<ObserverGetReferenceClockResponse, ObserverGetReferenceClockError>,
4531 ) -> Result<(), fidl::Error> {
4532 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4533 ObserverGetReferenceClockResponse,
4534 ObserverGetReferenceClockError,
4535 >>(
4536 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
4537 self.tx_id,
4538 0x3819c5e0f9574c39,
4539 fidl::encoding::DynamicFlags::FLEXIBLE,
4540 )
4541 }
4542}
4543
4544#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4545pub struct ProviderMarker;
4546
4547impl fidl::endpoints::ProtocolMarker for ProviderMarker {
4548 type Proxy = ProviderProxy;
4549 type RequestStream = ProviderRequestStream;
4550 #[cfg(target_os = "fuchsia")]
4551 type SynchronousProxy = ProviderSynchronousProxy;
4552
4553 const DEBUG_NAME: &'static str = "fuchsia.audio.device.Provider";
4554}
4555impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
4556pub type ProviderAddDeviceResult = Result<ProviderAddDeviceResponse, ProviderAddDeviceError>;
4557
4558pub trait ProviderProxyInterface: Send + Sync {
4559 type AddDeviceResponseFut: std::future::Future<Output = Result<ProviderAddDeviceResult, fidl::Error>>
4560 + Send;
4561 fn r#add_device(&self, payload: ProviderAddDeviceRequest) -> Self::AddDeviceResponseFut;
4562}
4563#[derive(Debug)]
4564#[cfg(target_os = "fuchsia")]
4565pub struct ProviderSynchronousProxy {
4566 client: fidl::client::sync::Client,
4567}
4568
4569#[cfg(target_os = "fuchsia")]
4570impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
4571 type Proxy = ProviderProxy;
4572 type Protocol = ProviderMarker;
4573
4574 fn from_channel(inner: fidl::Channel) -> Self {
4575 Self::new(inner)
4576 }
4577
4578 fn into_channel(self) -> fidl::Channel {
4579 self.client.into_channel()
4580 }
4581
4582 fn as_channel(&self) -> &fidl::Channel {
4583 self.client.as_channel()
4584 }
4585}
4586
4587#[cfg(target_os = "fuchsia")]
4588impl ProviderSynchronousProxy {
4589 pub fn new(channel: fidl::Channel) -> Self {
4590 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4591 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4592 }
4593
4594 pub fn into_channel(self) -> fidl::Channel {
4595 self.client.into_channel()
4596 }
4597
4598 pub fn wait_for_event(
4601 &self,
4602 deadline: zx::MonotonicInstant,
4603 ) -> Result<ProviderEvent, fidl::Error> {
4604 ProviderEvent::decode(self.client.wait_for_event(deadline)?)
4605 }
4606
4607 pub fn r#add_device(
4608 &self,
4609 mut payload: ProviderAddDeviceRequest,
4610 ___deadline: zx::MonotonicInstant,
4611 ) -> Result<ProviderAddDeviceResult, fidl::Error> {
4612 let _response =
4613 self.client
4614 .send_query::<ProviderAddDeviceRequest, fidl::encoding::FlexibleResultType<
4615 ProviderAddDeviceResponse,
4616 ProviderAddDeviceError,
4617 >>(
4618 &mut payload,
4619 0x685fdfd91937758b,
4620 fidl::encoding::DynamicFlags::FLEXIBLE,
4621 ___deadline,
4622 )?
4623 .into_result::<ProviderMarker>("add_device")?;
4624 Ok(_response.map(|x| x))
4625 }
4626}
4627
4628#[cfg(target_os = "fuchsia")]
4629impl From<ProviderSynchronousProxy> for zx::Handle {
4630 fn from(value: ProviderSynchronousProxy) -> Self {
4631 value.into_channel().into()
4632 }
4633}
4634
4635#[cfg(target_os = "fuchsia")]
4636impl From<fidl::Channel> for ProviderSynchronousProxy {
4637 fn from(value: fidl::Channel) -> Self {
4638 Self::new(value)
4639 }
4640}
4641
4642#[derive(Debug, Clone)]
4643pub struct ProviderProxy {
4644 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4645}
4646
4647impl fidl::endpoints::Proxy for ProviderProxy {
4648 type Protocol = ProviderMarker;
4649
4650 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4651 Self::new(inner)
4652 }
4653
4654 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4655 self.client.into_channel().map_err(|client| Self { client })
4656 }
4657
4658 fn as_channel(&self) -> &::fidl::AsyncChannel {
4659 self.client.as_channel()
4660 }
4661}
4662
4663impl ProviderProxy {
4664 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4666 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4667 Self { client: fidl::client::Client::new(channel, protocol_name) }
4668 }
4669
4670 pub fn take_event_stream(&self) -> ProviderEventStream {
4676 ProviderEventStream { event_receiver: self.client.take_event_receiver() }
4677 }
4678
4679 pub fn r#add_device(
4680 &self,
4681 mut payload: ProviderAddDeviceRequest,
4682 ) -> fidl::client::QueryResponseFut<
4683 ProviderAddDeviceResult,
4684 fidl::encoding::DefaultFuchsiaResourceDialect,
4685 > {
4686 ProviderProxyInterface::r#add_device(self, payload)
4687 }
4688}
4689
4690impl ProviderProxyInterface for ProviderProxy {
4691 type AddDeviceResponseFut = fidl::client::QueryResponseFut<
4692 ProviderAddDeviceResult,
4693 fidl::encoding::DefaultFuchsiaResourceDialect,
4694 >;
4695 fn r#add_device(&self, mut payload: ProviderAddDeviceRequest) -> Self::AddDeviceResponseFut {
4696 fn _decode(
4697 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4698 ) -> Result<ProviderAddDeviceResult, fidl::Error> {
4699 let _response = fidl::client::decode_transaction_body::<
4700 fidl::encoding::FlexibleResultType<
4701 ProviderAddDeviceResponse,
4702 ProviderAddDeviceError,
4703 >,
4704 fidl::encoding::DefaultFuchsiaResourceDialect,
4705 0x685fdfd91937758b,
4706 >(_buf?)?
4707 .into_result::<ProviderMarker>("add_device")?;
4708 Ok(_response.map(|x| x))
4709 }
4710 self.client.send_query_and_decode::<ProviderAddDeviceRequest, ProviderAddDeviceResult>(
4711 &mut payload,
4712 0x685fdfd91937758b,
4713 fidl::encoding::DynamicFlags::FLEXIBLE,
4714 _decode,
4715 )
4716 }
4717}
4718
4719pub struct ProviderEventStream {
4720 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4721}
4722
4723impl std::marker::Unpin for ProviderEventStream {}
4724
4725impl futures::stream::FusedStream for ProviderEventStream {
4726 fn is_terminated(&self) -> bool {
4727 self.event_receiver.is_terminated()
4728 }
4729}
4730
4731impl futures::Stream for ProviderEventStream {
4732 type Item = Result<ProviderEvent, fidl::Error>;
4733
4734 fn poll_next(
4735 mut self: std::pin::Pin<&mut Self>,
4736 cx: &mut std::task::Context<'_>,
4737 ) -> std::task::Poll<Option<Self::Item>> {
4738 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4739 &mut self.event_receiver,
4740 cx
4741 )?) {
4742 Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
4743 None => std::task::Poll::Ready(None),
4744 }
4745 }
4746}
4747
4748#[derive(Debug)]
4749pub enum ProviderEvent {
4750 #[non_exhaustive]
4751 _UnknownEvent {
4752 ordinal: u64,
4754 },
4755}
4756
4757impl ProviderEvent {
4758 fn decode(
4760 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4761 ) -> Result<ProviderEvent, fidl::Error> {
4762 let (bytes, _handles) = buf.split_mut();
4763 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4764 debug_assert_eq!(tx_header.tx_id, 0);
4765 match tx_header.ordinal {
4766 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4767 Ok(ProviderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4768 }
4769 _ => Err(fidl::Error::UnknownOrdinal {
4770 ordinal: tx_header.ordinal,
4771 protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4772 }),
4773 }
4774 }
4775}
4776
4777pub struct ProviderRequestStream {
4779 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4780 is_terminated: bool,
4781}
4782
4783impl std::marker::Unpin for ProviderRequestStream {}
4784
4785impl futures::stream::FusedStream for ProviderRequestStream {
4786 fn is_terminated(&self) -> bool {
4787 self.is_terminated
4788 }
4789}
4790
4791impl fidl::endpoints::RequestStream for ProviderRequestStream {
4792 type Protocol = ProviderMarker;
4793 type ControlHandle = ProviderControlHandle;
4794
4795 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4796 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4797 }
4798
4799 fn control_handle(&self) -> Self::ControlHandle {
4800 ProviderControlHandle { inner: self.inner.clone() }
4801 }
4802
4803 fn into_inner(
4804 self,
4805 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4806 {
4807 (self.inner, self.is_terminated)
4808 }
4809
4810 fn from_inner(
4811 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4812 is_terminated: bool,
4813 ) -> Self {
4814 Self { inner, is_terminated }
4815 }
4816}
4817
4818impl futures::Stream for ProviderRequestStream {
4819 type Item = Result<ProviderRequest, fidl::Error>;
4820
4821 fn poll_next(
4822 mut self: std::pin::Pin<&mut Self>,
4823 cx: &mut std::task::Context<'_>,
4824 ) -> std::task::Poll<Option<Self::Item>> {
4825 let this = &mut *self;
4826 if this.inner.check_shutdown(cx) {
4827 this.is_terminated = true;
4828 return std::task::Poll::Ready(None);
4829 }
4830 if this.is_terminated {
4831 panic!("polled ProviderRequestStream after completion");
4832 }
4833 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4834 |bytes, handles| {
4835 match this.inner.channel().read_etc(cx, bytes, handles) {
4836 std::task::Poll::Ready(Ok(())) => {}
4837 std::task::Poll::Pending => return std::task::Poll::Pending,
4838 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4839 this.is_terminated = true;
4840 return std::task::Poll::Ready(None);
4841 }
4842 std::task::Poll::Ready(Err(e)) => {
4843 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4844 e.into(),
4845 ))))
4846 }
4847 }
4848
4849 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4851
4852 std::task::Poll::Ready(Some(match header.ordinal {
4853 0x685fdfd91937758b => {
4854 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4855 let mut req = fidl::new_empty!(
4856 ProviderAddDeviceRequest,
4857 fidl::encoding::DefaultFuchsiaResourceDialect
4858 );
4859 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderAddDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
4860 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
4861 Ok(ProviderRequest::AddDevice {
4862 payload: req,
4863 responder: ProviderAddDeviceResponder {
4864 control_handle: std::mem::ManuallyDrop::new(control_handle),
4865 tx_id: header.tx_id,
4866 },
4867 })
4868 }
4869 _ if header.tx_id == 0
4870 && header
4871 .dynamic_flags()
4872 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4873 {
4874 Ok(ProviderRequest::_UnknownMethod {
4875 ordinal: header.ordinal,
4876 control_handle: ProviderControlHandle { inner: this.inner.clone() },
4877 method_type: fidl::MethodType::OneWay,
4878 })
4879 }
4880 _ if header
4881 .dynamic_flags()
4882 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4883 {
4884 this.inner.send_framework_err(
4885 fidl::encoding::FrameworkErr::UnknownMethod,
4886 header.tx_id,
4887 header.ordinal,
4888 header.dynamic_flags(),
4889 (bytes, handles),
4890 )?;
4891 Ok(ProviderRequest::_UnknownMethod {
4892 ordinal: header.ordinal,
4893 control_handle: ProviderControlHandle { inner: this.inner.clone() },
4894 method_type: fidl::MethodType::TwoWay,
4895 })
4896 }
4897 _ => Err(fidl::Error::UnknownOrdinal {
4898 ordinal: header.ordinal,
4899 protocol_name:
4900 <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4901 }),
4902 }))
4903 },
4904 )
4905 }
4906}
4907
4908#[derive(Debug)]
4911pub enum ProviderRequest {
4912 AddDevice {
4913 payload: ProviderAddDeviceRequest,
4914 responder: ProviderAddDeviceResponder,
4915 },
4916 #[non_exhaustive]
4918 _UnknownMethod {
4919 ordinal: u64,
4921 control_handle: ProviderControlHandle,
4922 method_type: fidl::MethodType,
4923 },
4924}
4925
4926impl ProviderRequest {
4927 #[allow(irrefutable_let_patterns)]
4928 pub fn into_add_device(self) -> Option<(ProviderAddDeviceRequest, ProviderAddDeviceResponder)> {
4929 if let ProviderRequest::AddDevice { payload, responder } = self {
4930 Some((payload, responder))
4931 } else {
4932 None
4933 }
4934 }
4935
4936 pub fn method_name(&self) -> &'static str {
4938 match *self {
4939 ProviderRequest::AddDevice { .. } => "add_device",
4940 ProviderRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4941 "unknown one-way method"
4942 }
4943 ProviderRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4944 "unknown two-way method"
4945 }
4946 }
4947 }
4948}
4949
4950#[derive(Debug, Clone)]
4951pub struct ProviderControlHandle {
4952 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4953}
4954
4955impl fidl::endpoints::ControlHandle for ProviderControlHandle {
4956 fn shutdown(&self) {
4957 self.inner.shutdown()
4958 }
4959 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4960 self.inner.shutdown_with_epitaph(status)
4961 }
4962
4963 fn is_closed(&self) -> bool {
4964 self.inner.channel().is_closed()
4965 }
4966 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4967 self.inner.channel().on_closed()
4968 }
4969
4970 #[cfg(target_os = "fuchsia")]
4971 fn signal_peer(
4972 &self,
4973 clear_mask: zx::Signals,
4974 set_mask: zx::Signals,
4975 ) -> Result<(), zx_status::Status> {
4976 use fidl::Peered;
4977 self.inner.channel().signal_peer(clear_mask, set_mask)
4978 }
4979}
4980
4981impl ProviderControlHandle {}
4982
4983#[must_use = "FIDL methods require a response to be sent"]
4984#[derive(Debug)]
4985pub struct ProviderAddDeviceResponder {
4986 control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
4987 tx_id: u32,
4988}
4989
4990impl std::ops::Drop for ProviderAddDeviceResponder {
4994 fn drop(&mut self) {
4995 self.control_handle.shutdown();
4996 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4998 }
4999}
5000
5001impl fidl::endpoints::Responder for ProviderAddDeviceResponder {
5002 type ControlHandle = ProviderControlHandle;
5003
5004 fn control_handle(&self) -> &ProviderControlHandle {
5005 &self.control_handle
5006 }
5007
5008 fn drop_without_shutdown(mut self) {
5009 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5011 std::mem::forget(self);
5013 }
5014}
5015
5016impl ProviderAddDeviceResponder {
5017 pub fn send(
5021 self,
5022 mut result: Result<&ProviderAddDeviceResponse, ProviderAddDeviceError>,
5023 ) -> Result<(), fidl::Error> {
5024 let _result = self.send_raw(result);
5025 if _result.is_err() {
5026 self.control_handle.shutdown();
5027 }
5028 self.drop_without_shutdown();
5029 _result
5030 }
5031
5032 pub fn send_no_shutdown_on_err(
5034 self,
5035 mut result: Result<&ProviderAddDeviceResponse, ProviderAddDeviceError>,
5036 ) -> Result<(), fidl::Error> {
5037 let _result = self.send_raw(result);
5038 self.drop_without_shutdown();
5039 _result
5040 }
5041
5042 fn send_raw(
5043 &self,
5044 mut result: Result<&ProviderAddDeviceResponse, ProviderAddDeviceError>,
5045 ) -> Result<(), fidl::Error> {
5046 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5047 ProviderAddDeviceResponse,
5048 ProviderAddDeviceError,
5049 >>(
5050 fidl::encoding::FlexibleResult::new(result),
5051 self.tx_id,
5052 0x685fdfd91937758b,
5053 fidl::encoding::DynamicFlags::FLEXIBLE,
5054 )
5055 }
5056}
5057
5058#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5059pub struct RegistryMarker;
5060
5061impl fidl::endpoints::ProtocolMarker for RegistryMarker {
5062 type Proxy = RegistryProxy;
5063 type RequestStream = RegistryRequestStream;
5064 #[cfg(target_os = "fuchsia")]
5065 type SynchronousProxy = RegistrySynchronousProxy;
5066
5067 const DEBUG_NAME: &'static str = "fuchsia.audio.device.Registry";
5068}
5069impl fidl::endpoints::DiscoverableProtocolMarker for RegistryMarker {}
5070pub type RegistryWatchDevicesAddedResult =
5071 Result<RegistryWatchDevicesAddedResponse, RegistryWatchDevicesAddedError>;
5072pub type RegistryWatchDeviceRemovedResult =
5073 Result<RegistryWatchDeviceRemovedResponse, RegistryWatchDeviceRemovedError>;
5074pub type RegistryCreateObserverResult =
5075 Result<RegistryCreateObserverResponse, RegistryCreateObserverError>;
5076
5077pub trait RegistryProxyInterface: Send + Sync {
5078 type WatchDevicesAddedResponseFut: std::future::Future<Output = Result<RegistryWatchDevicesAddedResult, fidl::Error>>
5079 + Send;
5080 fn r#watch_devices_added(&self) -> Self::WatchDevicesAddedResponseFut;
5081 type WatchDeviceRemovedResponseFut: std::future::Future<Output = Result<RegistryWatchDeviceRemovedResult, fidl::Error>>
5082 + Send;
5083 fn r#watch_device_removed(&self) -> Self::WatchDeviceRemovedResponseFut;
5084 type CreateObserverResponseFut: std::future::Future<Output = Result<RegistryCreateObserverResult, fidl::Error>>
5085 + Send;
5086 fn r#create_observer(
5087 &self,
5088 payload: RegistryCreateObserverRequest,
5089 ) -> Self::CreateObserverResponseFut;
5090}
5091#[derive(Debug)]
5092#[cfg(target_os = "fuchsia")]
5093pub struct RegistrySynchronousProxy {
5094 client: fidl::client::sync::Client,
5095}
5096
5097#[cfg(target_os = "fuchsia")]
5098impl fidl::endpoints::SynchronousProxy for RegistrySynchronousProxy {
5099 type Proxy = RegistryProxy;
5100 type Protocol = RegistryMarker;
5101
5102 fn from_channel(inner: fidl::Channel) -> Self {
5103 Self::new(inner)
5104 }
5105
5106 fn into_channel(self) -> fidl::Channel {
5107 self.client.into_channel()
5108 }
5109
5110 fn as_channel(&self) -> &fidl::Channel {
5111 self.client.as_channel()
5112 }
5113}
5114
5115#[cfg(target_os = "fuchsia")]
5116impl RegistrySynchronousProxy {
5117 pub fn new(channel: fidl::Channel) -> Self {
5118 let protocol_name = <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5119 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5120 }
5121
5122 pub fn into_channel(self) -> fidl::Channel {
5123 self.client.into_channel()
5124 }
5125
5126 pub fn wait_for_event(
5129 &self,
5130 deadline: zx::MonotonicInstant,
5131 ) -> Result<RegistryEvent, fidl::Error> {
5132 RegistryEvent::decode(self.client.wait_for_event(deadline)?)
5133 }
5134
5135 pub fn r#watch_devices_added(
5138 &self,
5139 ___deadline: zx::MonotonicInstant,
5140 ) -> Result<RegistryWatchDevicesAddedResult, fidl::Error> {
5141 let _response = self
5142 .client
5143 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
5144 RegistryWatchDevicesAddedResponse,
5145 RegistryWatchDevicesAddedError,
5146 >>(
5147 (), 0x562ca31f7c149def, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
5148 )?
5149 .into_result::<RegistryMarker>("watch_devices_added")?;
5150 Ok(_response.map(|x| x))
5151 }
5152
5153 pub fn r#watch_device_removed(
5159 &self,
5160 ___deadline: zx::MonotonicInstant,
5161 ) -> Result<RegistryWatchDeviceRemovedResult, fidl::Error> {
5162 let _response = self
5163 .client
5164 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
5165 RegistryWatchDeviceRemovedResponse,
5166 RegistryWatchDeviceRemovedError,
5167 >>(
5168 (), 0x6e67aabc99a502af, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
5169 )?
5170 .into_result::<RegistryMarker>("watch_device_removed")?;
5171 Ok(_response.map(|x| x))
5172 }
5173
5174 pub fn r#create_observer(
5176 &self,
5177 mut payload: RegistryCreateObserverRequest,
5178 ___deadline: zx::MonotonicInstant,
5179 ) -> Result<RegistryCreateObserverResult, fidl::Error> {
5180 let _response = self
5181 .client
5182 .send_query::<RegistryCreateObserverRequest, fidl::encoding::FlexibleResultType<
5183 RegistryCreateObserverResponse,
5184 RegistryCreateObserverError,
5185 >>(
5186 &mut payload,
5187 0x577bc322eb8d2bd1,
5188 fidl::encoding::DynamicFlags::FLEXIBLE,
5189 ___deadline,
5190 )?
5191 .into_result::<RegistryMarker>("create_observer")?;
5192 Ok(_response.map(|x| x))
5193 }
5194}
5195
5196#[cfg(target_os = "fuchsia")]
5197impl From<RegistrySynchronousProxy> for zx::Handle {
5198 fn from(value: RegistrySynchronousProxy) -> Self {
5199 value.into_channel().into()
5200 }
5201}
5202
5203#[cfg(target_os = "fuchsia")]
5204impl From<fidl::Channel> for RegistrySynchronousProxy {
5205 fn from(value: fidl::Channel) -> Self {
5206 Self::new(value)
5207 }
5208}
5209
5210#[derive(Debug, Clone)]
5211pub struct RegistryProxy {
5212 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5213}
5214
5215impl fidl::endpoints::Proxy for RegistryProxy {
5216 type Protocol = RegistryMarker;
5217
5218 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5219 Self::new(inner)
5220 }
5221
5222 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5223 self.client.into_channel().map_err(|client| Self { client })
5224 }
5225
5226 fn as_channel(&self) -> &::fidl::AsyncChannel {
5227 self.client.as_channel()
5228 }
5229}
5230
5231impl RegistryProxy {
5232 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5234 let protocol_name = <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5235 Self { client: fidl::client::Client::new(channel, protocol_name) }
5236 }
5237
5238 pub fn take_event_stream(&self) -> RegistryEventStream {
5244 RegistryEventStream { event_receiver: self.client.take_event_receiver() }
5245 }
5246
5247 pub fn r#watch_devices_added(
5250 &self,
5251 ) -> fidl::client::QueryResponseFut<
5252 RegistryWatchDevicesAddedResult,
5253 fidl::encoding::DefaultFuchsiaResourceDialect,
5254 > {
5255 RegistryProxyInterface::r#watch_devices_added(self)
5256 }
5257
5258 pub fn r#watch_device_removed(
5264 &self,
5265 ) -> fidl::client::QueryResponseFut<
5266 RegistryWatchDeviceRemovedResult,
5267 fidl::encoding::DefaultFuchsiaResourceDialect,
5268 > {
5269 RegistryProxyInterface::r#watch_device_removed(self)
5270 }
5271
5272 pub fn r#create_observer(
5274 &self,
5275 mut payload: RegistryCreateObserverRequest,
5276 ) -> fidl::client::QueryResponseFut<
5277 RegistryCreateObserverResult,
5278 fidl::encoding::DefaultFuchsiaResourceDialect,
5279 > {
5280 RegistryProxyInterface::r#create_observer(self, payload)
5281 }
5282}
5283
5284impl RegistryProxyInterface for RegistryProxy {
5285 type WatchDevicesAddedResponseFut = fidl::client::QueryResponseFut<
5286 RegistryWatchDevicesAddedResult,
5287 fidl::encoding::DefaultFuchsiaResourceDialect,
5288 >;
5289 fn r#watch_devices_added(&self) -> Self::WatchDevicesAddedResponseFut {
5290 fn _decode(
5291 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5292 ) -> Result<RegistryWatchDevicesAddedResult, fidl::Error> {
5293 let _response = fidl::client::decode_transaction_body::<
5294 fidl::encoding::FlexibleResultType<
5295 RegistryWatchDevicesAddedResponse,
5296 RegistryWatchDevicesAddedError,
5297 >,
5298 fidl::encoding::DefaultFuchsiaResourceDialect,
5299 0x562ca31f7c149def,
5300 >(_buf?)?
5301 .into_result::<RegistryMarker>("watch_devices_added")?;
5302 Ok(_response.map(|x| x))
5303 }
5304 self.client
5305 .send_query_and_decode::<fidl::encoding::EmptyPayload, RegistryWatchDevicesAddedResult>(
5306 (),
5307 0x562ca31f7c149def,
5308 fidl::encoding::DynamicFlags::FLEXIBLE,
5309 _decode,
5310 )
5311 }
5312
5313 type WatchDeviceRemovedResponseFut = fidl::client::QueryResponseFut<
5314 RegistryWatchDeviceRemovedResult,
5315 fidl::encoding::DefaultFuchsiaResourceDialect,
5316 >;
5317 fn r#watch_device_removed(&self) -> Self::WatchDeviceRemovedResponseFut {
5318 fn _decode(
5319 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5320 ) -> Result<RegistryWatchDeviceRemovedResult, fidl::Error> {
5321 let _response = fidl::client::decode_transaction_body::<
5322 fidl::encoding::FlexibleResultType<
5323 RegistryWatchDeviceRemovedResponse,
5324 RegistryWatchDeviceRemovedError,
5325 >,
5326 fidl::encoding::DefaultFuchsiaResourceDialect,
5327 0x6e67aabc99a502af,
5328 >(_buf?)?
5329 .into_result::<RegistryMarker>("watch_device_removed")?;
5330 Ok(_response.map(|x| x))
5331 }
5332 self.client.send_query_and_decode::<
5333 fidl::encoding::EmptyPayload,
5334 RegistryWatchDeviceRemovedResult,
5335 >(
5336 (),
5337 0x6e67aabc99a502af,
5338 fidl::encoding::DynamicFlags::FLEXIBLE,
5339 _decode,
5340 )
5341 }
5342
5343 type CreateObserverResponseFut = fidl::client::QueryResponseFut<
5344 RegistryCreateObserverResult,
5345 fidl::encoding::DefaultFuchsiaResourceDialect,
5346 >;
5347 fn r#create_observer(
5348 &self,
5349 mut payload: RegistryCreateObserverRequest,
5350 ) -> Self::CreateObserverResponseFut {
5351 fn _decode(
5352 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5353 ) -> Result<RegistryCreateObserverResult, fidl::Error> {
5354 let _response = fidl::client::decode_transaction_body::<
5355 fidl::encoding::FlexibleResultType<
5356 RegistryCreateObserverResponse,
5357 RegistryCreateObserverError,
5358 >,
5359 fidl::encoding::DefaultFuchsiaResourceDialect,
5360 0x577bc322eb8d2bd1,
5361 >(_buf?)?
5362 .into_result::<RegistryMarker>("create_observer")?;
5363 Ok(_response.map(|x| x))
5364 }
5365 self.client
5366 .send_query_and_decode::<RegistryCreateObserverRequest, RegistryCreateObserverResult>(
5367 &mut payload,
5368 0x577bc322eb8d2bd1,
5369 fidl::encoding::DynamicFlags::FLEXIBLE,
5370 _decode,
5371 )
5372 }
5373}
5374
5375pub struct RegistryEventStream {
5376 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5377}
5378
5379impl std::marker::Unpin for RegistryEventStream {}
5380
5381impl futures::stream::FusedStream for RegistryEventStream {
5382 fn is_terminated(&self) -> bool {
5383 self.event_receiver.is_terminated()
5384 }
5385}
5386
5387impl futures::Stream for RegistryEventStream {
5388 type Item = Result<RegistryEvent, fidl::Error>;
5389
5390 fn poll_next(
5391 mut self: std::pin::Pin<&mut Self>,
5392 cx: &mut std::task::Context<'_>,
5393 ) -> std::task::Poll<Option<Self::Item>> {
5394 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5395 &mut self.event_receiver,
5396 cx
5397 )?) {
5398 Some(buf) => std::task::Poll::Ready(Some(RegistryEvent::decode(buf))),
5399 None => std::task::Poll::Ready(None),
5400 }
5401 }
5402}
5403
5404#[derive(Debug)]
5405pub enum RegistryEvent {
5406 #[non_exhaustive]
5407 _UnknownEvent {
5408 ordinal: u64,
5410 },
5411}
5412
5413impl RegistryEvent {
5414 fn decode(
5416 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5417 ) -> Result<RegistryEvent, fidl::Error> {
5418 let (bytes, _handles) = buf.split_mut();
5419 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5420 debug_assert_eq!(tx_header.tx_id, 0);
5421 match tx_header.ordinal {
5422 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5423 Ok(RegistryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5424 }
5425 _ => Err(fidl::Error::UnknownOrdinal {
5426 ordinal: tx_header.ordinal,
5427 protocol_name: <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5428 }),
5429 }
5430 }
5431}
5432
5433pub struct RegistryRequestStream {
5435 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5436 is_terminated: bool,
5437}
5438
5439impl std::marker::Unpin for RegistryRequestStream {}
5440
5441impl futures::stream::FusedStream for RegistryRequestStream {
5442 fn is_terminated(&self) -> bool {
5443 self.is_terminated
5444 }
5445}
5446
5447impl fidl::endpoints::RequestStream for RegistryRequestStream {
5448 type Protocol = RegistryMarker;
5449 type ControlHandle = RegistryControlHandle;
5450
5451 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5452 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5453 }
5454
5455 fn control_handle(&self) -> Self::ControlHandle {
5456 RegistryControlHandle { inner: self.inner.clone() }
5457 }
5458
5459 fn into_inner(
5460 self,
5461 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5462 {
5463 (self.inner, self.is_terminated)
5464 }
5465
5466 fn from_inner(
5467 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5468 is_terminated: bool,
5469 ) -> Self {
5470 Self { inner, is_terminated }
5471 }
5472}
5473
5474impl futures::Stream for RegistryRequestStream {
5475 type Item = Result<RegistryRequest, fidl::Error>;
5476
5477 fn poll_next(
5478 mut self: std::pin::Pin<&mut Self>,
5479 cx: &mut std::task::Context<'_>,
5480 ) -> std::task::Poll<Option<Self::Item>> {
5481 let this = &mut *self;
5482 if this.inner.check_shutdown(cx) {
5483 this.is_terminated = true;
5484 return std::task::Poll::Ready(None);
5485 }
5486 if this.is_terminated {
5487 panic!("polled RegistryRequestStream after completion");
5488 }
5489 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5490 |bytes, handles| {
5491 match this.inner.channel().read_etc(cx, bytes, handles) {
5492 std::task::Poll::Ready(Ok(())) => {}
5493 std::task::Poll::Pending => return std::task::Poll::Pending,
5494 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5495 this.is_terminated = true;
5496 return std::task::Poll::Ready(None);
5497 }
5498 std::task::Poll::Ready(Err(e)) => {
5499 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5500 e.into(),
5501 ))))
5502 }
5503 }
5504
5505 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5507
5508 std::task::Poll::Ready(Some(match header.ordinal {
5509 0x562ca31f7c149def => {
5510 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5511 let mut req = fidl::new_empty!(
5512 fidl::encoding::EmptyPayload,
5513 fidl::encoding::DefaultFuchsiaResourceDialect
5514 );
5515 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5516 let control_handle = RegistryControlHandle { inner: this.inner.clone() };
5517 Ok(RegistryRequest::WatchDevicesAdded {
5518 responder: RegistryWatchDevicesAddedResponder {
5519 control_handle: std::mem::ManuallyDrop::new(control_handle),
5520 tx_id: header.tx_id,
5521 },
5522 })
5523 }
5524 0x6e67aabc99a502af => {
5525 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5526 let mut req = fidl::new_empty!(
5527 fidl::encoding::EmptyPayload,
5528 fidl::encoding::DefaultFuchsiaResourceDialect
5529 );
5530 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5531 let control_handle = RegistryControlHandle { inner: this.inner.clone() };
5532 Ok(RegistryRequest::WatchDeviceRemoved {
5533 responder: RegistryWatchDeviceRemovedResponder {
5534 control_handle: std::mem::ManuallyDrop::new(control_handle),
5535 tx_id: header.tx_id,
5536 },
5537 })
5538 }
5539 0x577bc322eb8d2bd1 => {
5540 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5541 let mut req = fidl::new_empty!(
5542 RegistryCreateObserverRequest,
5543 fidl::encoding::DefaultFuchsiaResourceDialect
5544 );
5545 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryCreateObserverRequest>(&header, _body_bytes, handles, &mut req)?;
5546 let control_handle = RegistryControlHandle { inner: this.inner.clone() };
5547 Ok(RegistryRequest::CreateObserver {
5548 payload: req,
5549 responder: RegistryCreateObserverResponder {
5550 control_handle: std::mem::ManuallyDrop::new(control_handle),
5551 tx_id: header.tx_id,
5552 },
5553 })
5554 }
5555 _ if header.tx_id == 0
5556 && header
5557 .dynamic_flags()
5558 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5559 {
5560 Ok(RegistryRequest::_UnknownMethod {
5561 ordinal: header.ordinal,
5562 control_handle: RegistryControlHandle { inner: this.inner.clone() },
5563 method_type: fidl::MethodType::OneWay,
5564 })
5565 }
5566 _ if header
5567 .dynamic_flags()
5568 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5569 {
5570 this.inner.send_framework_err(
5571 fidl::encoding::FrameworkErr::UnknownMethod,
5572 header.tx_id,
5573 header.ordinal,
5574 header.dynamic_flags(),
5575 (bytes, handles),
5576 )?;
5577 Ok(RegistryRequest::_UnknownMethod {
5578 ordinal: header.ordinal,
5579 control_handle: RegistryControlHandle { inner: this.inner.clone() },
5580 method_type: fidl::MethodType::TwoWay,
5581 })
5582 }
5583 _ => Err(fidl::Error::UnknownOrdinal {
5584 ordinal: header.ordinal,
5585 protocol_name:
5586 <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5587 }),
5588 }))
5589 },
5590 )
5591 }
5592}
5593
5594#[derive(Debug)]
5597pub enum RegistryRequest {
5598 WatchDevicesAdded { responder: RegistryWatchDevicesAddedResponder },
5601 WatchDeviceRemoved { responder: RegistryWatchDeviceRemovedResponder },
5607 CreateObserver {
5609 payload: RegistryCreateObserverRequest,
5610 responder: RegistryCreateObserverResponder,
5611 },
5612 #[non_exhaustive]
5614 _UnknownMethod {
5615 ordinal: u64,
5617 control_handle: RegistryControlHandle,
5618 method_type: fidl::MethodType,
5619 },
5620}
5621
5622impl RegistryRequest {
5623 #[allow(irrefutable_let_patterns)]
5624 pub fn into_watch_devices_added(self) -> Option<(RegistryWatchDevicesAddedResponder)> {
5625 if let RegistryRequest::WatchDevicesAdded { responder } = self {
5626 Some((responder))
5627 } else {
5628 None
5629 }
5630 }
5631
5632 #[allow(irrefutable_let_patterns)]
5633 pub fn into_watch_device_removed(self) -> Option<(RegistryWatchDeviceRemovedResponder)> {
5634 if let RegistryRequest::WatchDeviceRemoved { responder } = self {
5635 Some((responder))
5636 } else {
5637 None
5638 }
5639 }
5640
5641 #[allow(irrefutable_let_patterns)]
5642 pub fn into_create_observer(
5643 self,
5644 ) -> Option<(RegistryCreateObserverRequest, RegistryCreateObserverResponder)> {
5645 if let RegistryRequest::CreateObserver { payload, responder } = self {
5646 Some((payload, responder))
5647 } else {
5648 None
5649 }
5650 }
5651
5652 pub fn method_name(&self) -> &'static str {
5654 match *self {
5655 RegistryRequest::WatchDevicesAdded { .. } => "watch_devices_added",
5656 RegistryRequest::WatchDeviceRemoved { .. } => "watch_device_removed",
5657 RegistryRequest::CreateObserver { .. } => "create_observer",
5658 RegistryRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
5659 "unknown one-way method"
5660 }
5661 RegistryRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
5662 "unknown two-way method"
5663 }
5664 }
5665 }
5666}
5667
5668#[derive(Debug, Clone)]
5669pub struct RegistryControlHandle {
5670 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5671}
5672
5673impl fidl::endpoints::ControlHandle for RegistryControlHandle {
5674 fn shutdown(&self) {
5675 self.inner.shutdown()
5676 }
5677 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5678 self.inner.shutdown_with_epitaph(status)
5679 }
5680
5681 fn is_closed(&self) -> bool {
5682 self.inner.channel().is_closed()
5683 }
5684 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5685 self.inner.channel().on_closed()
5686 }
5687
5688 #[cfg(target_os = "fuchsia")]
5689 fn signal_peer(
5690 &self,
5691 clear_mask: zx::Signals,
5692 set_mask: zx::Signals,
5693 ) -> Result<(), zx_status::Status> {
5694 use fidl::Peered;
5695 self.inner.channel().signal_peer(clear_mask, set_mask)
5696 }
5697}
5698
5699impl RegistryControlHandle {}
5700
5701#[must_use = "FIDL methods require a response to be sent"]
5702#[derive(Debug)]
5703pub struct RegistryWatchDevicesAddedResponder {
5704 control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
5705 tx_id: u32,
5706}
5707
5708impl std::ops::Drop for RegistryWatchDevicesAddedResponder {
5712 fn drop(&mut self) {
5713 self.control_handle.shutdown();
5714 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5716 }
5717}
5718
5719impl fidl::endpoints::Responder for RegistryWatchDevicesAddedResponder {
5720 type ControlHandle = RegistryControlHandle;
5721
5722 fn control_handle(&self) -> &RegistryControlHandle {
5723 &self.control_handle
5724 }
5725
5726 fn drop_without_shutdown(mut self) {
5727 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5729 std::mem::forget(self);
5731 }
5732}
5733
5734impl RegistryWatchDevicesAddedResponder {
5735 pub fn send(
5739 self,
5740 mut result: Result<&RegistryWatchDevicesAddedResponse, RegistryWatchDevicesAddedError>,
5741 ) -> Result<(), fidl::Error> {
5742 let _result = self.send_raw(result);
5743 if _result.is_err() {
5744 self.control_handle.shutdown();
5745 }
5746 self.drop_without_shutdown();
5747 _result
5748 }
5749
5750 pub fn send_no_shutdown_on_err(
5752 self,
5753 mut result: Result<&RegistryWatchDevicesAddedResponse, RegistryWatchDevicesAddedError>,
5754 ) -> Result<(), fidl::Error> {
5755 let _result = self.send_raw(result);
5756 self.drop_without_shutdown();
5757 _result
5758 }
5759
5760 fn send_raw(
5761 &self,
5762 mut result: Result<&RegistryWatchDevicesAddedResponse, RegistryWatchDevicesAddedError>,
5763 ) -> Result<(), fidl::Error> {
5764 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5765 RegistryWatchDevicesAddedResponse,
5766 RegistryWatchDevicesAddedError,
5767 >>(
5768 fidl::encoding::FlexibleResult::new(result),
5769 self.tx_id,
5770 0x562ca31f7c149def,
5771 fidl::encoding::DynamicFlags::FLEXIBLE,
5772 )
5773 }
5774}
5775
5776#[must_use = "FIDL methods require a response to be sent"]
5777#[derive(Debug)]
5778pub struct RegistryWatchDeviceRemovedResponder {
5779 control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
5780 tx_id: u32,
5781}
5782
5783impl std::ops::Drop for RegistryWatchDeviceRemovedResponder {
5787 fn drop(&mut self) {
5788 self.control_handle.shutdown();
5789 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5791 }
5792}
5793
5794impl fidl::endpoints::Responder for RegistryWatchDeviceRemovedResponder {
5795 type ControlHandle = RegistryControlHandle;
5796
5797 fn control_handle(&self) -> &RegistryControlHandle {
5798 &self.control_handle
5799 }
5800
5801 fn drop_without_shutdown(mut self) {
5802 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5804 std::mem::forget(self);
5806 }
5807}
5808
5809impl RegistryWatchDeviceRemovedResponder {
5810 pub fn send(
5814 self,
5815 mut result: Result<&RegistryWatchDeviceRemovedResponse, RegistryWatchDeviceRemovedError>,
5816 ) -> Result<(), fidl::Error> {
5817 let _result = self.send_raw(result);
5818 if _result.is_err() {
5819 self.control_handle.shutdown();
5820 }
5821 self.drop_without_shutdown();
5822 _result
5823 }
5824
5825 pub fn send_no_shutdown_on_err(
5827 self,
5828 mut result: Result<&RegistryWatchDeviceRemovedResponse, RegistryWatchDeviceRemovedError>,
5829 ) -> Result<(), fidl::Error> {
5830 let _result = self.send_raw(result);
5831 self.drop_without_shutdown();
5832 _result
5833 }
5834
5835 fn send_raw(
5836 &self,
5837 mut result: Result<&RegistryWatchDeviceRemovedResponse, RegistryWatchDeviceRemovedError>,
5838 ) -> Result<(), fidl::Error> {
5839 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5840 RegistryWatchDeviceRemovedResponse,
5841 RegistryWatchDeviceRemovedError,
5842 >>(
5843 fidl::encoding::FlexibleResult::new(result),
5844 self.tx_id,
5845 0x6e67aabc99a502af,
5846 fidl::encoding::DynamicFlags::FLEXIBLE,
5847 )
5848 }
5849}
5850
5851#[must_use = "FIDL methods require a response to be sent"]
5852#[derive(Debug)]
5853pub struct RegistryCreateObserverResponder {
5854 control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
5855 tx_id: u32,
5856}
5857
5858impl std::ops::Drop for RegistryCreateObserverResponder {
5862 fn drop(&mut self) {
5863 self.control_handle.shutdown();
5864 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5866 }
5867}
5868
5869impl fidl::endpoints::Responder for RegistryCreateObserverResponder {
5870 type ControlHandle = RegistryControlHandle;
5871
5872 fn control_handle(&self) -> &RegistryControlHandle {
5873 &self.control_handle
5874 }
5875
5876 fn drop_without_shutdown(mut self) {
5877 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5879 std::mem::forget(self);
5881 }
5882}
5883
5884impl RegistryCreateObserverResponder {
5885 pub fn send(
5889 self,
5890 mut result: Result<&RegistryCreateObserverResponse, RegistryCreateObserverError>,
5891 ) -> Result<(), fidl::Error> {
5892 let _result = self.send_raw(result);
5893 if _result.is_err() {
5894 self.control_handle.shutdown();
5895 }
5896 self.drop_without_shutdown();
5897 _result
5898 }
5899
5900 pub fn send_no_shutdown_on_err(
5902 self,
5903 mut result: Result<&RegistryCreateObserverResponse, RegistryCreateObserverError>,
5904 ) -> Result<(), fidl::Error> {
5905 let _result = self.send_raw(result);
5906 self.drop_without_shutdown();
5907 _result
5908 }
5909
5910 fn send_raw(
5911 &self,
5912 mut result: Result<&RegistryCreateObserverResponse, RegistryCreateObserverError>,
5913 ) -> Result<(), fidl::Error> {
5914 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5915 RegistryCreateObserverResponse,
5916 RegistryCreateObserverError,
5917 >>(
5918 fidl::encoding::FlexibleResult::new(result),
5919 self.tx_id,
5920 0x577bc322eb8d2bd1,
5921 fidl::encoding::DynamicFlags::FLEXIBLE,
5922 )
5923 }
5924}
5925
5926#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5927pub struct RingBufferMarker;
5928
5929impl fidl::endpoints::ProtocolMarker for RingBufferMarker {
5930 type Proxy = RingBufferProxy;
5931 type RequestStream = RingBufferRequestStream;
5932 #[cfg(target_os = "fuchsia")]
5933 type SynchronousProxy = RingBufferSynchronousProxy;
5934
5935 const DEBUG_NAME: &'static str = "(anonymous) RingBuffer";
5936}
5937pub type RingBufferSetActiveChannelsResult =
5938 Result<RingBufferSetActiveChannelsResponse, RingBufferSetActiveChannelsError>;
5939pub type RingBufferStartResult = Result<RingBufferStartResponse, RingBufferStartError>;
5940pub type RingBufferStopResult = Result<RingBufferStopResponse, RingBufferStopError>;
5941pub type RingBufferWatchDelayInfoResult =
5942 Result<RingBufferWatchDelayInfoResponse, RingBufferWatchDelayInfoError>;
5943
5944pub trait RingBufferProxyInterface: Send + Sync {
5945 type SetActiveChannelsResponseFut: std::future::Future<Output = Result<RingBufferSetActiveChannelsResult, fidl::Error>>
5946 + Send;
5947 fn r#set_active_channels(
5948 &self,
5949 payload: &RingBufferSetActiveChannelsRequest,
5950 ) -> Self::SetActiveChannelsResponseFut;
5951 type StartResponseFut: std::future::Future<Output = Result<RingBufferStartResult, fidl::Error>>
5952 + Send;
5953 fn r#start(&self, payload: &RingBufferStartRequest) -> Self::StartResponseFut;
5954 type StopResponseFut: std::future::Future<Output = Result<RingBufferStopResult, fidl::Error>>
5955 + Send;
5956 fn r#stop(&self, payload: &RingBufferStopRequest) -> Self::StopResponseFut;
5957 type WatchDelayInfoResponseFut: std::future::Future<Output = Result<RingBufferWatchDelayInfoResult, fidl::Error>>
5958 + Send;
5959 fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut;
5960}
5961#[derive(Debug)]
5962#[cfg(target_os = "fuchsia")]
5963pub struct RingBufferSynchronousProxy {
5964 client: fidl::client::sync::Client,
5965}
5966
5967#[cfg(target_os = "fuchsia")]
5968impl fidl::endpoints::SynchronousProxy for RingBufferSynchronousProxy {
5969 type Proxy = RingBufferProxy;
5970 type Protocol = RingBufferMarker;
5971
5972 fn from_channel(inner: fidl::Channel) -> Self {
5973 Self::new(inner)
5974 }
5975
5976 fn into_channel(self) -> fidl::Channel {
5977 self.client.into_channel()
5978 }
5979
5980 fn as_channel(&self) -> &fidl::Channel {
5981 self.client.as_channel()
5982 }
5983}
5984
5985#[cfg(target_os = "fuchsia")]
5986impl RingBufferSynchronousProxy {
5987 pub fn new(channel: fidl::Channel) -> Self {
5988 let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5989 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5990 }
5991
5992 pub fn into_channel(self) -> fidl::Channel {
5993 self.client.into_channel()
5994 }
5995
5996 pub fn wait_for_event(
5999 &self,
6000 deadline: zx::MonotonicInstant,
6001 ) -> Result<RingBufferEvent, fidl::Error> {
6002 RingBufferEvent::decode(self.client.wait_for_event(deadline)?)
6003 }
6004
6005 pub fn r#set_active_channels(
6020 &self,
6021 mut payload: &RingBufferSetActiveChannelsRequest,
6022 ___deadline: zx::MonotonicInstant,
6023 ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
6024 let _response = self
6025 .client
6026 .send_query::<RingBufferSetActiveChannelsRequest, fidl::encoding::FlexibleResultType<
6027 RingBufferSetActiveChannelsResponse,
6028 RingBufferSetActiveChannelsError,
6029 >>(
6030 payload, 0x4276c43e4a3b59ee, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
6031 )?
6032 .into_result::<RingBufferMarker>("set_active_channels")?;
6033 Ok(_response.map(|x| x))
6034 }
6035
6036 pub fn r#start(
6038 &self,
6039 mut payload: &RingBufferStartRequest,
6040 ___deadline: zx::MonotonicInstant,
6041 ) -> Result<RingBufferStartResult, fidl::Error> {
6042 let _response = self.client.send_query::<
6043 RingBufferStartRequest,
6044 fidl::encoding::FlexibleResultType<RingBufferStartResponse, RingBufferStartError>,
6045 >(
6046 payload,
6047 0x5365a8609dc2dc5,
6048 fidl::encoding::DynamicFlags::FLEXIBLE,
6049 ___deadline,
6050 )?
6051 .into_result::<RingBufferMarker>("start")?;
6052 Ok(_response.map(|x| x))
6053 }
6054
6055 pub fn r#stop(
6057 &self,
6058 mut payload: &RingBufferStopRequest,
6059 ___deadline: zx::MonotonicInstant,
6060 ) -> Result<RingBufferStopResult, fidl::Error> {
6061 let _response = self.client.send_query::<
6062 RingBufferStopRequest,
6063 fidl::encoding::FlexibleResultType<RingBufferStopResponse, RingBufferStopError>,
6064 >(
6065 payload,
6066 0x5a238810af11e6e1,
6067 fidl::encoding::DynamicFlags::FLEXIBLE,
6068 ___deadline,
6069 )?
6070 .into_result::<RingBufferMarker>("stop")?;
6071 Ok(_response.map(|x| x))
6072 }
6073
6074 pub fn r#watch_delay_info(
6079 &self,
6080 ___deadline: zx::MonotonicInstant,
6081 ) -> Result<RingBufferWatchDelayInfoResult, fidl::Error> {
6082 let _response = self
6083 .client
6084 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
6085 RingBufferWatchDelayInfoResponse,
6086 RingBufferWatchDelayInfoError,
6087 >>(
6088 (), 0x6d1dc5a928f38ad6, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
6089 )?
6090 .into_result::<RingBufferMarker>("watch_delay_info")?;
6091 Ok(_response.map(|x| x))
6092 }
6093}
6094
6095#[cfg(target_os = "fuchsia")]
6096impl From<RingBufferSynchronousProxy> for zx::Handle {
6097 fn from(value: RingBufferSynchronousProxy) -> Self {
6098 value.into_channel().into()
6099 }
6100}
6101
6102#[cfg(target_os = "fuchsia")]
6103impl From<fidl::Channel> for RingBufferSynchronousProxy {
6104 fn from(value: fidl::Channel) -> Self {
6105 Self::new(value)
6106 }
6107}
6108
6109#[derive(Debug, Clone)]
6110pub struct RingBufferProxy {
6111 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6112}
6113
6114impl fidl::endpoints::Proxy for RingBufferProxy {
6115 type Protocol = RingBufferMarker;
6116
6117 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6118 Self::new(inner)
6119 }
6120
6121 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6122 self.client.into_channel().map_err(|client| Self { client })
6123 }
6124
6125 fn as_channel(&self) -> &::fidl::AsyncChannel {
6126 self.client.as_channel()
6127 }
6128}
6129
6130impl RingBufferProxy {
6131 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6133 let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6134 Self { client: fidl::client::Client::new(channel, protocol_name) }
6135 }
6136
6137 pub fn take_event_stream(&self) -> RingBufferEventStream {
6143 RingBufferEventStream { event_receiver: self.client.take_event_receiver() }
6144 }
6145
6146 pub fn r#set_active_channels(
6161 &self,
6162 mut payload: &RingBufferSetActiveChannelsRequest,
6163 ) -> fidl::client::QueryResponseFut<
6164 RingBufferSetActiveChannelsResult,
6165 fidl::encoding::DefaultFuchsiaResourceDialect,
6166 > {
6167 RingBufferProxyInterface::r#set_active_channels(self, payload)
6168 }
6169
6170 pub fn r#start(
6172 &self,
6173 mut payload: &RingBufferStartRequest,
6174 ) -> fidl::client::QueryResponseFut<
6175 RingBufferStartResult,
6176 fidl::encoding::DefaultFuchsiaResourceDialect,
6177 > {
6178 RingBufferProxyInterface::r#start(self, payload)
6179 }
6180
6181 pub fn r#stop(
6183 &self,
6184 mut payload: &RingBufferStopRequest,
6185 ) -> fidl::client::QueryResponseFut<
6186 RingBufferStopResult,
6187 fidl::encoding::DefaultFuchsiaResourceDialect,
6188 > {
6189 RingBufferProxyInterface::r#stop(self, payload)
6190 }
6191
6192 pub fn r#watch_delay_info(
6197 &self,
6198 ) -> fidl::client::QueryResponseFut<
6199 RingBufferWatchDelayInfoResult,
6200 fidl::encoding::DefaultFuchsiaResourceDialect,
6201 > {
6202 RingBufferProxyInterface::r#watch_delay_info(self)
6203 }
6204}
6205
6206impl RingBufferProxyInterface for RingBufferProxy {
6207 type SetActiveChannelsResponseFut = fidl::client::QueryResponseFut<
6208 RingBufferSetActiveChannelsResult,
6209 fidl::encoding::DefaultFuchsiaResourceDialect,
6210 >;
6211 fn r#set_active_channels(
6212 &self,
6213 mut payload: &RingBufferSetActiveChannelsRequest,
6214 ) -> Self::SetActiveChannelsResponseFut {
6215 fn _decode(
6216 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6217 ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
6218 let _response = fidl::client::decode_transaction_body::<
6219 fidl::encoding::FlexibleResultType<
6220 RingBufferSetActiveChannelsResponse,
6221 RingBufferSetActiveChannelsError,
6222 >,
6223 fidl::encoding::DefaultFuchsiaResourceDialect,
6224 0x4276c43e4a3b59ee,
6225 >(_buf?)?
6226 .into_result::<RingBufferMarker>("set_active_channels")?;
6227 Ok(_response.map(|x| x))
6228 }
6229 self.client.send_query_and_decode::<
6230 RingBufferSetActiveChannelsRequest,
6231 RingBufferSetActiveChannelsResult,
6232 >(
6233 payload,
6234 0x4276c43e4a3b59ee,
6235 fidl::encoding::DynamicFlags::FLEXIBLE,
6236 _decode,
6237 )
6238 }
6239
6240 type StartResponseFut = fidl::client::QueryResponseFut<
6241 RingBufferStartResult,
6242 fidl::encoding::DefaultFuchsiaResourceDialect,
6243 >;
6244 fn r#start(&self, mut payload: &RingBufferStartRequest) -> Self::StartResponseFut {
6245 fn _decode(
6246 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6247 ) -> Result<RingBufferStartResult, fidl::Error> {
6248 let _response = fidl::client::decode_transaction_body::<
6249 fidl::encoding::FlexibleResultType<RingBufferStartResponse, RingBufferStartError>,
6250 fidl::encoding::DefaultFuchsiaResourceDialect,
6251 0x5365a8609dc2dc5,
6252 >(_buf?)?
6253 .into_result::<RingBufferMarker>("start")?;
6254 Ok(_response.map(|x| x))
6255 }
6256 self.client.send_query_and_decode::<RingBufferStartRequest, RingBufferStartResult>(
6257 payload,
6258 0x5365a8609dc2dc5,
6259 fidl::encoding::DynamicFlags::FLEXIBLE,
6260 _decode,
6261 )
6262 }
6263
6264 type StopResponseFut = fidl::client::QueryResponseFut<
6265 RingBufferStopResult,
6266 fidl::encoding::DefaultFuchsiaResourceDialect,
6267 >;
6268 fn r#stop(&self, mut payload: &RingBufferStopRequest) -> Self::StopResponseFut {
6269 fn _decode(
6270 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6271 ) -> Result<RingBufferStopResult, fidl::Error> {
6272 let _response = fidl::client::decode_transaction_body::<
6273 fidl::encoding::FlexibleResultType<RingBufferStopResponse, RingBufferStopError>,
6274 fidl::encoding::DefaultFuchsiaResourceDialect,
6275 0x5a238810af11e6e1,
6276 >(_buf?)?
6277 .into_result::<RingBufferMarker>("stop")?;
6278 Ok(_response.map(|x| x))
6279 }
6280 self.client.send_query_and_decode::<RingBufferStopRequest, RingBufferStopResult>(
6281 payload,
6282 0x5a238810af11e6e1,
6283 fidl::encoding::DynamicFlags::FLEXIBLE,
6284 _decode,
6285 )
6286 }
6287
6288 type WatchDelayInfoResponseFut = fidl::client::QueryResponseFut<
6289 RingBufferWatchDelayInfoResult,
6290 fidl::encoding::DefaultFuchsiaResourceDialect,
6291 >;
6292 fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut {
6293 fn _decode(
6294 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6295 ) -> Result<RingBufferWatchDelayInfoResult, fidl::Error> {
6296 let _response = fidl::client::decode_transaction_body::<
6297 fidl::encoding::FlexibleResultType<
6298 RingBufferWatchDelayInfoResponse,
6299 RingBufferWatchDelayInfoError,
6300 >,
6301 fidl::encoding::DefaultFuchsiaResourceDialect,
6302 0x6d1dc5a928f38ad6,
6303 >(_buf?)?
6304 .into_result::<RingBufferMarker>("watch_delay_info")?;
6305 Ok(_response.map(|x| x))
6306 }
6307 self.client
6308 .send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferWatchDelayInfoResult>(
6309 (),
6310 0x6d1dc5a928f38ad6,
6311 fidl::encoding::DynamicFlags::FLEXIBLE,
6312 _decode,
6313 )
6314 }
6315}
6316
6317pub struct RingBufferEventStream {
6318 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6319}
6320
6321impl std::marker::Unpin for RingBufferEventStream {}
6322
6323impl futures::stream::FusedStream for RingBufferEventStream {
6324 fn is_terminated(&self) -> bool {
6325 self.event_receiver.is_terminated()
6326 }
6327}
6328
6329impl futures::Stream for RingBufferEventStream {
6330 type Item = Result<RingBufferEvent, fidl::Error>;
6331
6332 fn poll_next(
6333 mut self: std::pin::Pin<&mut Self>,
6334 cx: &mut std::task::Context<'_>,
6335 ) -> std::task::Poll<Option<Self::Item>> {
6336 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6337 &mut self.event_receiver,
6338 cx
6339 )?) {
6340 Some(buf) => std::task::Poll::Ready(Some(RingBufferEvent::decode(buf))),
6341 None => std::task::Poll::Ready(None),
6342 }
6343 }
6344}
6345
6346#[derive(Debug)]
6347pub enum RingBufferEvent {
6348 #[non_exhaustive]
6349 _UnknownEvent {
6350 ordinal: u64,
6352 },
6353}
6354
6355impl RingBufferEvent {
6356 fn decode(
6358 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6359 ) -> Result<RingBufferEvent, fidl::Error> {
6360 let (bytes, _handles) = buf.split_mut();
6361 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6362 debug_assert_eq!(tx_header.tx_id, 0);
6363 match tx_header.ordinal {
6364 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6365 Ok(RingBufferEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6366 }
6367 _ => Err(fidl::Error::UnknownOrdinal {
6368 ordinal: tx_header.ordinal,
6369 protocol_name: <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6370 }),
6371 }
6372 }
6373}
6374
6375pub struct RingBufferRequestStream {
6377 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6378 is_terminated: bool,
6379}
6380
6381impl std::marker::Unpin for RingBufferRequestStream {}
6382
6383impl futures::stream::FusedStream for RingBufferRequestStream {
6384 fn is_terminated(&self) -> bool {
6385 self.is_terminated
6386 }
6387}
6388
6389impl fidl::endpoints::RequestStream for RingBufferRequestStream {
6390 type Protocol = RingBufferMarker;
6391 type ControlHandle = RingBufferControlHandle;
6392
6393 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6394 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6395 }
6396
6397 fn control_handle(&self) -> Self::ControlHandle {
6398 RingBufferControlHandle { inner: self.inner.clone() }
6399 }
6400
6401 fn into_inner(
6402 self,
6403 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6404 {
6405 (self.inner, self.is_terminated)
6406 }
6407
6408 fn from_inner(
6409 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6410 is_terminated: bool,
6411 ) -> Self {
6412 Self { inner, is_terminated }
6413 }
6414}
6415
6416impl futures::Stream for RingBufferRequestStream {
6417 type Item = Result<RingBufferRequest, fidl::Error>;
6418
6419 fn poll_next(
6420 mut self: std::pin::Pin<&mut Self>,
6421 cx: &mut std::task::Context<'_>,
6422 ) -> std::task::Poll<Option<Self::Item>> {
6423 let this = &mut *self;
6424 if this.inner.check_shutdown(cx) {
6425 this.is_terminated = true;
6426 return std::task::Poll::Ready(None);
6427 }
6428 if this.is_terminated {
6429 panic!("polled RingBufferRequestStream after completion");
6430 }
6431 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6432 |bytes, handles| {
6433 match this.inner.channel().read_etc(cx, bytes, handles) {
6434 std::task::Poll::Ready(Ok(())) => {}
6435 std::task::Poll::Pending => return std::task::Poll::Pending,
6436 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6437 this.is_terminated = true;
6438 return std::task::Poll::Ready(None);
6439 }
6440 std::task::Poll::Ready(Err(e)) => {
6441 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6442 e.into(),
6443 ))))
6444 }
6445 }
6446
6447 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6449
6450 std::task::Poll::Ready(Some(match header.ordinal {
6451 0x4276c43e4a3b59ee => {
6452 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6453 let mut req = fidl::new_empty!(
6454 RingBufferSetActiveChannelsRequest,
6455 fidl::encoding::DefaultFuchsiaResourceDialect
6456 );
6457 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferSetActiveChannelsRequest>(&header, _body_bytes, handles, &mut req)?;
6458 let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
6459 Ok(RingBufferRequest::SetActiveChannels {
6460 payload: req,
6461 responder: RingBufferSetActiveChannelsResponder {
6462 control_handle: std::mem::ManuallyDrop::new(control_handle),
6463 tx_id: header.tx_id,
6464 },
6465 })
6466 }
6467 0x5365a8609dc2dc5 => {
6468 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6469 let mut req = fidl::new_empty!(
6470 RingBufferStartRequest,
6471 fidl::encoding::DefaultFuchsiaResourceDialect
6472 );
6473 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferStartRequest>(&header, _body_bytes, handles, &mut req)?;
6474 let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
6475 Ok(RingBufferRequest::Start {
6476 payload: req,
6477 responder: RingBufferStartResponder {
6478 control_handle: std::mem::ManuallyDrop::new(control_handle),
6479 tx_id: header.tx_id,
6480 },
6481 })
6482 }
6483 0x5a238810af11e6e1 => {
6484 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6485 let mut req = fidl::new_empty!(
6486 RingBufferStopRequest,
6487 fidl::encoding::DefaultFuchsiaResourceDialect
6488 );
6489 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferStopRequest>(&header, _body_bytes, handles, &mut req)?;
6490 let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
6491 Ok(RingBufferRequest::Stop {
6492 payload: req,
6493 responder: RingBufferStopResponder {
6494 control_handle: std::mem::ManuallyDrop::new(control_handle),
6495 tx_id: header.tx_id,
6496 },
6497 })
6498 }
6499 0x6d1dc5a928f38ad6 => {
6500 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6501 let mut req = fidl::new_empty!(
6502 fidl::encoding::EmptyPayload,
6503 fidl::encoding::DefaultFuchsiaResourceDialect
6504 );
6505 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6506 let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
6507 Ok(RingBufferRequest::WatchDelayInfo {
6508 responder: RingBufferWatchDelayInfoResponder {
6509 control_handle: std::mem::ManuallyDrop::new(control_handle),
6510 tx_id: header.tx_id,
6511 },
6512 })
6513 }
6514 _ if header.tx_id == 0
6515 && header
6516 .dynamic_flags()
6517 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6518 {
6519 Ok(RingBufferRequest::_UnknownMethod {
6520 ordinal: header.ordinal,
6521 control_handle: RingBufferControlHandle { inner: this.inner.clone() },
6522 method_type: fidl::MethodType::OneWay,
6523 })
6524 }
6525 _ if header
6526 .dynamic_flags()
6527 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6528 {
6529 this.inner.send_framework_err(
6530 fidl::encoding::FrameworkErr::UnknownMethod,
6531 header.tx_id,
6532 header.ordinal,
6533 header.dynamic_flags(),
6534 (bytes, handles),
6535 )?;
6536 Ok(RingBufferRequest::_UnknownMethod {
6537 ordinal: header.ordinal,
6538 control_handle: RingBufferControlHandle { inner: this.inner.clone() },
6539 method_type: fidl::MethodType::TwoWay,
6540 })
6541 }
6542 _ => Err(fidl::Error::UnknownOrdinal {
6543 ordinal: header.ordinal,
6544 protocol_name:
6545 <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6546 }),
6547 }))
6548 },
6549 )
6550 }
6551}
6552
6553#[derive(Debug)]
6555pub enum RingBufferRequest {
6556 SetActiveChannels {
6571 payload: RingBufferSetActiveChannelsRequest,
6572 responder: RingBufferSetActiveChannelsResponder,
6573 },
6574 Start { payload: RingBufferStartRequest, responder: RingBufferStartResponder },
6576 Stop { payload: RingBufferStopRequest, responder: RingBufferStopResponder },
6578 WatchDelayInfo { responder: RingBufferWatchDelayInfoResponder },
6583 #[non_exhaustive]
6585 _UnknownMethod {
6586 ordinal: u64,
6588 control_handle: RingBufferControlHandle,
6589 method_type: fidl::MethodType,
6590 },
6591}
6592
6593impl RingBufferRequest {
6594 #[allow(irrefutable_let_patterns)]
6595 pub fn into_set_active_channels(
6596 self,
6597 ) -> Option<(RingBufferSetActiveChannelsRequest, RingBufferSetActiveChannelsResponder)> {
6598 if let RingBufferRequest::SetActiveChannels { payload, responder } = self {
6599 Some((payload, responder))
6600 } else {
6601 None
6602 }
6603 }
6604
6605 #[allow(irrefutable_let_patterns)]
6606 pub fn into_start(self) -> Option<(RingBufferStartRequest, RingBufferStartResponder)> {
6607 if let RingBufferRequest::Start { payload, responder } = self {
6608 Some((payload, responder))
6609 } else {
6610 None
6611 }
6612 }
6613
6614 #[allow(irrefutable_let_patterns)]
6615 pub fn into_stop(self) -> Option<(RingBufferStopRequest, RingBufferStopResponder)> {
6616 if let RingBufferRequest::Stop { payload, responder } = self {
6617 Some((payload, responder))
6618 } else {
6619 None
6620 }
6621 }
6622
6623 #[allow(irrefutable_let_patterns)]
6624 pub fn into_watch_delay_info(self) -> Option<(RingBufferWatchDelayInfoResponder)> {
6625 if let RingBufferRequest::WatchDelayInfo { responder } = self {
6626 Some((responder))
6627 } else {
6628 None
6629 }
6630 }
6631
6632 pub fn method_name(&self) -> &'static str {
6634 match *self {
6635 RingBufferRequest::SetActiveChannels { .. } => "set_active_channels",
6636 RingBufferRequest::Start { .. } => "start",
6637 RingBufferRequest::Stop { .. } => "stop",
6638 RingBufferRequest::WatchDelayInfo { .. } => "watch_delay_info",
6639 RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
6640 "unknown one-way method"
6641 }
6642 RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
6643 "unknown two-way method"
6644 }
6645 }
6646 }
6647}
6648
6649#[derive(Debug, Clone)]
6650pub struct RingBufferControlHandle {
6651 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6652}
6653
6654impl fidl::endpoints::ControlHandle for RingBufferControlHandle {
6655 fn shutdown(&self) {
6656 self.inner.shutdown()
6657 }
6658 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6659 self.inner.shutdown_with_epitaph(status)
6660 }
6661
6662 fn is_closed(&self) -> bool {
6663 self.inner.channel().is_closed()
6664 }
6665 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6666 self.inner.channel().on_closed()
6667 }
6668
6669 #[cfg(target_os = "fuchsia")]
6670 fn signal_peer(
6671 &self,
6672 clear_mask: zx::Signals,
6673 set_mask: zx::Signals,
6674 ) -> Result<(), zx_status::Status> {
6675 use fidl::Peered;
6676 self.inner.channel().signal_peer(clear_mask, set_mask)
6677 }
6678}
6679
6680impl RingBufferControlHandle {}
6681
6682#[must_use = "FIDL methods require a response to be sent"]
6683#[derive(Debug)]
6684pub struct RingBufferSetActiveChannelsResponder {
6685 control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
6686 tx_id: u32,
6687}
6688
6689impl std::ops::Drop for RingBufferSetActiveChannelsResponder {
6693 fn drop(&mut self) {
6694 self.control_handle.shutdown();
6695 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6697 }
6698}
6699
6700impl fidl::endpoints::Responder for RingBufferSetActiveChannelsResponder {
6701 type ControlHandle = RingBufferControlHandle;
6702
6703 fn control_handle(&self) -> &RingBufferControlHandle {
6704 &self.control_handle
6705 }
6706
6707 fn drop_without_shutdown(mut self) {
6708 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6710 std::mem::forget(self);
6712 }
6713}
6714
6715impl RingBufferSetActiveChannelsResponder {
6716 pub fn send(
6720 self,
6721 mut result: Result<&RingBufferSetActiveChannelsResponse, RingBufferSetActiveChannelsError>,
6722 ) -> Result<(), fidl::Error> {
6723 let _result = self.send_raw(result);
6724 if _result.is_err() {
6725 self.control_handle.shutdown();
6726 }
6727 self.drop_without_shutdown();
6728 _result
6729 }
6730
6731 pub fn send_no_shutdown_on_err(
6733 self,
6734 mut result: Result<&RingBufferSetActiveChannelsResponse, RingBufferSetActiveChannelsError>,
6735 ) -> Result<(), fidl::Error> {
6736 let _result = self.send_raw(result);
6737 self.drop_without_shutdown();
6738 _result
6739 }
6740
6741 fn send_raw(
6742 &self,
6743 mut result: Result<&RingBufferSetActiveChannelsResponse, RingBufferSetActiveChannelsError>,
6744 ) -> Result<(), fidl::Error> {
6745 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6746 RingBufferSetActiveChannelsResponse,
6747 RingBufferSetActiveChannelsError,
6748 >>(
6749 fidl::encoding::FlexibleResult::new(result),
6750 self.tx_id,
6751 0x4276c43e4a3b59ee,
6752 fidl::encoding::DynamicFlags::FLEXIBLE,
6753 )
6754 }
6755}
6756
6757#[must_use = "FIDL methods require a response to be sent"]
6758#[derive(Debug)]
6759pub struct RingBufferStartResponder {
6760 control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
6761 tx_id: u32,
6762}
6763
6764impl std::ops::Drop for RingBufferStartResponder {
6768 fn drop(&mut self) {
6769 self.control_handle.shutdown();
6770 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6772 }
6773}
6774
6775impl fidl::endpoints::Responder for RingBufferStartResponder {
6776 type ControlHandle = RingBufferControlHandle;
6777
6778 fn control_handle(&self) -> &RingBufferControlHandle {
6779 &self.control_handle
6780 }
6781
6782 fn drop_without_shutdown(mut self) {
6783 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6785 std::mem::forget(self);
6787 }
6788}
6789
6790impl RingBufferStartResponder {
6791 pub fn send(
6795 self,
6796 mut result: Result<&RingBufferStartResponse, RingBufferStartError>,
6797 ) -> Result<(), fidl::Error> {
6798 let _result = self.send_raw(result);
6799 if _result.is_err() {
6800 self.control_handle.shutdown();
6801 }
6802 self.drop_without_shutdown();
6803 _result
6804 }
6805
6806 pub fn send_no_shutdown_on_err(
6808 self,
6809 mut result: Result<&RingBufferStartResponse, RingBufferStartError>,
6810 ) -> Result<(), fidl::Error> {
6811 let _result = self.send_raw(result);
6812 self.drop_without_shutdown();
6813 _result
6814 }
6815
6816 fn send_raw(
6817 &self,
6818 mut result: Result<&RingBufferStartResponse, RingBufferStartError>,
6819 ) -> Result<(), fidl::Error> {
6820 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6821 RingBufferStartResponse,
6822 RingBufferStartError,
6823 >>(
6824 fidl::encoding::FlexibleResult::new(result),
6825 self.tx_id,
6826 0x5365a8609dc2dc5,
6827 fidl::encoding::DynamicFlags::FLEXIBLE,
6828 )
6829 }
6830}
6831
6832#[must_use = "FIDL methods require a response to be sent"]
6833#[derive(Debug)]
6834pub struct RingBufferStopResponder {
6835 control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
6836 tx_id: u32,
6837}
6838
6839impl std::ops::Drop for RingBufferStopResponder {
6843 fn drop(&mut self) {
6844 self.control_handle.shutdown();
6845 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6847 }
6848}
6849
6850impl fidl::endpoints::Responder for RingBufferStopResponder {
6851 type ControlHandle = RingBufferControlHandle;
6852
6853 fn control_handle(&self) -> &RingBufferControlHandle {
6854 &self.control_handle
6855 }
6856
6857 fn drop_without_shutdown(mut self) {
6858 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6860 std::mem::forget(self);
6862 }
6863}
6864
6865impl RingBufferStopResponder {
6866 pub fn send(
6870 self,
6871 mut result: Result<&RingBufferStopResponse, RingBufferStopError>,
6872 ) -> Result<(), fidl::Error> {
6873 let _result = self.send_raw(result);
6874 if _result.is_err() {
6875 self.control_handle.shutdown();
6876 }
6877 self.drop_without_shutdown();
6878 _result
6879 }
6880
6881 pub fn send_no_shutdown_on_err(
6883 self,
6884 mut result: Result<&RingBufferStopResponse, RingBufferStopError>,
6885 ) -> Result<(), fidl::Error> {
6886 let _result = self.send_raw(result);
6887 self.drop_without_shutdown();
6888 _result
6889 }
6890
6891 fn send_raw(
6892 &self,
6893 mut result: Result<&RingBufferStopResponse, RingBufferStopError>,
6894 ) -> Result<(), fidl::Error> {
6895 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6896 RingBufferStopResponse,
6897 RingBufferStopError,
6898 >>(
6899 fidl::encoding::FlexibleResult::new(result),
6900 self.tx_id,
6901 0x5a238810af11e6e1,
6902 fidl::encoding::DynamicFlags::FLEXIBLE,
6903 )
6904 }
6905}
6906
6907#[must_use = "FIDL methods require a response to be sent"]
6908#[derive(Debug)]
6909pub struct RingBufferWatchDelayInfoResponder {
6910 control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
6911 tx_id: u32,
6912}
6913
6914impl std::ops::Drop for RingBufferWatchDelayInfoResponder {
6918 fn drop(&mut self) {
6919 self.control_handle.shutdown();
6920 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6922 }
6923}
6924
6925impl fidl::endpoints::Responder for RingBufferWatchDelayInfoResponder {
6926 type ControlHandle = RingBufferControlHandle;
6927
6928 fn control_handle(&self) -> &RingBufferControlHandle {
6929 &self.control_handle
6930 }
6931
6932 fn drop_without_shutdown(mut self) {
6933 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6935 std::mem::forget(self);
6937 }
6938}
6939
6940impl RingBufferWatchDelayInfoResponder {
6941 pub fn send(
6945 self,
6946 mut result: Result<&RingBufferWatchDelayInfoResponse, RingBufferWatchDelayInfoError>,
6947 ) -> Result<(), fidl::Error> {
6948 let _result = self.send_raw(result);
6949 if _result.is_err() {
6950 self.control_handle.shutdown();
6951 }
6952 self.drop_without_shutdown();
6953 _result
6954 }
6955
6956 pub fn send_no_shutdown_on_err(
6958 self,
6959 mut result: Result<&RingBufferWatchDelayInfoResponse, RingBufferWatchDelayInfoError>,
6960 ) -> Result<(), fidl::Error> {
6961 let _result = self.send_raw(result);
6962 self.drop_without_shutdown();
6963 _result
6964 }
6965
6966 fn send_raw(
6967 &self,
6968 mut result: Result<&RingBufferWatchDelayInfoResponse, RingBufferWatchDelayInfoError>,
6969 ) -> Result<(), fidl::Error> {
6970 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6971 RingBufferWatchDelayInfoResponse,
6972 RingBufferWatchDelayInfoError,
6973 >>(
6974 fidl::encoding::FlexibleResult::new(result),
6975 self.tx_id,
6976 0x6d1dc5a928f38ad6,
6977 fidl::encoding::DynamicFlags::FLEXIBLE,
6978 )
6979 }
6980}
6981
6982mod internal {
6983 use super::*;
6984
6985 impl ControlCreateRingBufferRequest {
6986 #[inline(always)]
6987 fn max_ordinal_present(&self) -> u64 {
6988 if let Some(_) = self.ring_buffer_server {
6989 return 3;
6990 }
6991 if let Some(_) = self.options {
6992 return 2;
6993 }
6994 if let Some(_) = self.element_id {
6995 return 1;
6996 }
6997 0
6998 }
6999 }
7000
7001 impl fidl::encoding::ResourceTypeMarker for ControlCreateRingBufferRequest {
7002 type Borrowed<'a> = &'a mut Self;
7003 fn take_or_borrow<'a>(
7004 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7005 ) -> Self::Borrowed<'a> {
7006 value
7007 }
7008 }
7009
7010 unsafe impl fidl::encoding::TypeMarker for ControlCreateRingBufferRequest {
7011 type Owned = Self;
7012
7013 #[inline(always)]
7014 fn inline_align(_context: fidl::encoding::Context) -> usize {
7015 8
7016 }
7017
7018 #[inline(always)]
7019 fn inline_size(_context: fidl::encoding::Context) -> usize {
7020 16
7021 }
7022 }
7023
7024 unsafe impl
7025 fidl::encoding::Encode<
7026 ControlCreateRingBufferRequest,
7027 fidl::encoding::DefaultFuchsiaResourceDialect,
7028 > for &mut ControlCreateRingBufferRequest
7029 {
7030 unsafe fn encode(
7031 self,
7032 encoder: &mut fidl::encoding::Encoder<
7033 '_,
7034 fidl::encoding::DefaultFuchsiaResourceDialect,
7035 >,
7036 offset: usize,
7037 mut depth: fidl::encoding::Depth,
7038 ) -> fidl::Result<()> {
7039 encoder.debug_check_bounds::<ControlCreateRingBufferRequest>(offset);
7040 let max_ordinal: u64 = self.max_ordinal_present();
7042 encoder.write_num(max_ordinal, offset);
7043 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7044 if max_ordinal == 0 {
7046 return Ok(());
7047 }
7048 depth.increment()?;
7049 let envelope_size = 8;
7050 let bytes_len = max_ordinal as usize * envelope_size;
7051 #[allow(unused_variables)]
7052 let offset = encoder.out_of_line_offset(bytes_len);
7053 let mut _prev_end_offset: usize = 0;
7054 if 1 > max_ordinal {
7055 return Ok(());
7056 }
7057
7058 let cur_offset: usize = (1 - 1) * envelope_size;
7061
7062 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7064
7065 fidl::encoding::encode_in_envelope_optional::<
7070 u64,
7071 fidl::encoding::DefaultFuchsiaResourceDialect,
7072 >(
7073 self.element_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
7074 encoder,
7075 offset + cur_offset,
7076 depth,
7077 )?;
7078
7079 _prev_end_offset = cur_offset + envelope_size;
7080 if 2 > max_ordinal {
7081 return Ok(());
7082 }
7083
7084 let cur_offset: usize = (2 - 1) * envelope_size;
7087
7088 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7090
7091 fidl::encoding::encode_in_envelope_optional::<
7096 RingBufferOptions,
7097 fidl::encoding::DefaultFuchsiaResourceDialect,
7098 >(
7099 self.options
7100 .as_ref()
7101 .map(<RingBufferOptions as fidl::encoding::ValueTypeMarker>::borrow),
7102 encoder,
7103 offset + cur_offset,
7104 depth,
7105 )?;
7106
7107 _prev_end_offset = cur_offset + envelope_size;
7108 if 3 > max_ordinal {
7109 return Ok(());
7110 }
7111
7112 let cur_offset: usize = (3 - 1) * envelope_size;
7115
7116 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7118
7119 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7124 self.ring_buffer_server.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7125 encoder, offset + cur_offset, depth
7126 )?;
7127
7128 _prev_end_offset = cur_offset + envelope_size;
7129
7130 Ok(())
7131 }
7132 }
7133
7134 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7135 for ControlCreateRingBufferRequest
7136 {
7137 #[inline(always)]
7138 fn new_empty() -> Self {
7139 Self::default()
7140 }
7141
7142 unsafe fn decode(
7143 &mut self,
7144 decoder: &mut fidl::encoding::Decoder<
7145 '_,
7146 fidl::encoding::DefaultFuchsiaResourceDialect,
7147 >,
7148 offset: usize,
7149 mut depth: fidl::encoding::Depth,
7150 ) -> fidl::Result<()> {
7151 decoder.debug_check_bounds::<Self>(offset);
7152 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7153 None => return Err(fidl::Error::NotNullable),
7154 Some(len) => len,
7155 };
7156 if len == 0 {
7158 return Ok(());
7159 };
7160 depth.increment()?;
7161 let envelope_size = 8;
7162 let bytes_len = len * envelope_size;
7163 let offset = decoder.out_of_line_offset(bytes_len)?;
7164 let mut _next_ordinal_to_read = 0;
7166 let mut next_offset = offset;
7167 let end_offset = offset + bytes_len;
7168 _next_ordinal_to_read += 1;
7169 if next_offset >= end_offset {
7170 return Ok(());
7171 }
7172
7173 while _next_ordinal_to_read < 1 {
7175 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7176 _next_ordinal_to_read += 1;
7177 next_offset += envelope_size;
7178 }
7179
7180 let next_out_of_line = decoder.next_out_of_line();
7181 let handles_before = decoder.remaining_handles();
7182 if let Some((inlined, num_bytes, num_handles)) =
7183 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7184 {
7185 let member_inline_size =
7186 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7187 if inlined != (member_inline_size <= 4) {
7188 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7189 }
7190 let inner_offset;
7191 let mut inner_depth = depth.clone();
7192 if inlined {
7193 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7194 inner_offset = next_offset;
7195 } else {
7196 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7197 inner_depth.increment()?;
7198 }
7199 let val_ref = self.element_id.get_or_insert_with(|| {
7200 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
7201 });
7202 fidl::decode!(
7203 u64,
7204 fidl::encoding::DefaultFuchsiaResourceDialect,
7205 val_ref,
7206 decoder,
7207 inner_offset,
7208 inner_depth
7209 )?;
7210 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7211 {
7212 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7213 }
7214 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7215 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7216 }
7217 }
7218
7219 next_offset += envelope_size;
7220 _next_ordinal_to_read += 1;
7221 if next_offset >= end_offset {
7222 return Ok(());
7223 }
7224
7225 while _next_ordinal_to_read < 2 {
7227 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7228 _next_ordinal_to_read += 1;
7229 next_offset += envelope_size;
7230 }
7231
7232 let next_out_of_line = decoder.next_out_of_line();
7233 let handles_before = decoder.remaining_handles();
7234 if let Some((inlined, num_bytes, num_handles)) =
7235 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7236 {
7237 let member_inline_size =
7238 <RingBufferOptions as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7239 if inlined != (member_inline_size <= 4) {
7240 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7241 }
7242 let inner_offset;
7243 let mut inner_depth = depth.clone();
7244 if inlined {
7245 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7246 inner_offset = next_offset;
7247 } else {
7248 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7249 inner_depth.increment()?;
7250 }
7251 let val_ref = self.options.get_or_insert_with(|| {
7252 fidl::new_empty!(
7253 RingBufferOptions,
7254 fidl::encoding::DefaultFuchsiaResourceDialect
7255 )
7256 });
7257 fidl::decode!(
7258 RingBufferOptions,
7259 fidl::encoding::DefaultFuchsiaResourceDialect,
7260 val_ref,
7261 decoder,
7262 inner_offset,
7263 inner_depth
7264 )?;
7265 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7266 {
7267 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7268 }
7269 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7270 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7271 }
7272 }
7273
7274 next_offset += envelope_size;
7275 _next_ordinal_to_read += 1;
7276 if next_offset >= end_offset {
7277 return Ok(());
7278 }
7279
7280 while _next_ordinal_to_read < 3 {
7282 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7283 _next_ordinal_to_read += 1;
7284 next_offset += envelope_size;
7285 }
7286
7287 let next_out_of_line = decoder.next_out_of_line();
7288 let handles_before = decoder.remaining_handles();
7289 if let Some((inlined, num_bytes, num_handles)) =
7290 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7291 {
7292 let member_inline_size = <fidl::encoding::Endpoint<
7293 fidl::endpoints::ServerEnd<RingBufferMarker>,
7294 > as fidl::encoding::TypeMarker>::inline_size(
7295 decoder.context
7296 );
7297 if inlined != (member_inline_size <= 4) {
7298 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7299 }
7300 let inner_offset;
7301 let mut inner_depth = depth.clone();
7302 if inlined {
7303 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7304 inner_offset = next_offset;
7305 } else {
7306 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7307 inner_depth.increment()?;
7308 }
7309 let val_ref = self.ring_buffer_server.get_or_insert_with(|| {
7310 fidl::new_empty!(
7311 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
7312 fidl::encoding::DefaultFuchsiaResourceDialect
7313 )
7314 });
7315 fidl::decode!(
7316 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
7317 fidl::encoding::DefaultFuchsiaResourceDialect,
7318 val_ref,
7319 decoder,
7320 inner_offset,
7321 inner_depth
7322 )?;
7323 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7324 {
7325 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7326 }
7327 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7328 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7329 }
7330 }
7331
7332 next_offset += envelope_size;
7333
7334 while next_offset < end_offset {
7336 _next_ordinal_to_read += 1;
7337 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7338 next_offset += envelope_size;
7339 }
7340
7341 Ok(())
7342 }
7343 }
7344
7345 impl ControlCreatorCreateRequest {
7346 #[inline(always)]
7347 fn max_ordinal_present(&self) -> u64 {
7348 if let Some(_) = self.control_server {
7349 return 2;
7350 }
7351 if let Some(_) = self.token_id {
7352 return 1;
7353 }
7354 0
7355 }
7356 }
7357
7358 impl fidl::encoding::ResourceTypeMarker for ControlCreatorCreateRequest {
7359 type Borrowed<'a> = &'a mut Self;
7360 fn take_or_borrow<'a>(
7361 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7362 ) -> Self::Borrowed<'a> {
7363 value
7364 }
7365 }
7366
7367 unsafe impl fidl::encoding::TypeMarker for ControlCreatorCreateRequest {
7368 type Owned = Self;
7369
7370 #[inline(always)]
7371 fn inline_align(_context: fidl::encoding::Context) -> usize {
7372 8
7373 }
7374
7375 #[inline(always)]
7376 fn inline_size(_context: fidl::encoding::Context) -> usize {
7377 16
7378 }
7379 }
7380
7381 unsafe impl
7382 fidl::encoding::Encode<
7383 ControlCreatorCreateRequest,
7384 fidl::encoding::DefaultFuchsiaResourceDialect,
7385 > for &mut ControlCreatorCreateRequest
7386 {
7387 unsafe fn encode(
7388 self,
7389 encoder: &mut fidl::encoding::Encoder<
7390 '_,
7391 fidl::encoding::DefaultFuchsiaResourceDialect,
7392 >,
7393 offset: usize,
7394 mut depth: fidl::encoding::Depth,
7395 ) -> fidl::Result<()> {
7396 encoder.debug_check_bounds::<ControlCreatorCreateRequest>(offset);
7397 let max_ordinal: u64 = self.max_ordinal_present();
7399 encoder.write_num(max_ordinal, offset);
7400 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7401 if max_ordinal == 0 {
7403 return Ok(());
7404 }
7405 depth.increment()?;
7406 let envelope_size = 8;
7407 let bytes_len = max_ordinal as usize * envelope_size;
7408 #[allow(unused_variables)]
7409 let offset = encoder.out_of_line_offset(bytes_len);
7410 let mut _prev_end_offset: usize = 0;
7411 if 1 > max_ordinal {
7412 return Ok(());
7413 }
7414
7415 let cur_offset: usize = (1 - 1) * envelope_size;
7418
7419 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7421
7422 fidl::encoding::encode_in_envelope_optional::<
7427 u64,
7428 fidl::encoding::DefaultFuchsiaResourceDialect,
7429 >(
7430 self.token_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
7431 encoder,
7432 offset + cur_offset,
7433 depth,
7434 )?;
7435
7436 _prev_end_offset = cur_offset + envelope_size;
7437 if 2 > max_ordinal {
7438 return Ok(());
7439 }
7440
7441 let cur_offset: usize = (2 - 1) * envelope_size;
7444
7445 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7447
7448 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7453 self.control_server.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7454 encoder, offset + cur_offset, depth
7455 )?;
7456
7457 _prev_end_offset = cur_offset + envelope_size;
7458
7459 Ok(())
7460 }
7461 }
7462
7463 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7464 for ControlCreatorCreateRequest
7465 {
7466 #[inline(always)]
7467 fn new_empty() -> Self {
7468 Self::default()
7469 }
7470
7471 unsafe fn decode(
7472 &mut self,
7473 decoder: &mut fidl::encoding::Decoder<
7474 '_,
7475 fidl::encoding::DefaultFuchsiaResourceDialect,
7476 >,
7477 offset: usize,
7478 mut depth: fidl::encoding::Depth,
7479 ) -> fidl::Result<()> {
7480 decoder.debug_check_bounds::<Self>(offset);
7481 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7482 None => return Err(fidl::Error::NotNullable),
7483 Some(len) => len,
7484 };
7485 if len == 0 {
7487 return Ok(());
7488 };
7489 depth.increment()?;
7490 let envelope_size = 8;
7491 let bytes_len = len * envelope_size;
7492 let offset = decoder.out_of_line_offset(bytes_len)?;
7493 let mut _next_ordinal_to_read = 0;
7495 let mut next_offset = offset;
7496 let end_offset = offset + bytes_len;
7497 _next_ordinal_to_read += 1;
7498 if next_offset >= end_offset {
7499 return Ok(());
7500 }
7501
7502 while _next_ordinal_to_read < 1 {
7504 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7505 _next_ordinal_to_read += 1;
7506 next_offset += envelope_size;
7507 }
7508
7509 let next_out_of_line = decoder.next_out_of_line();
7510 let handles_before = decoder.remaining_handles();
7511 if let Some((inlined, num_bytes, num_handles)) =
7512 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7513 {
7514 let member_inline_size =
7515 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7516 if inlined != (member_inline_size <= 4) {
7517 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7518 }
7519 let inner_offset;
7520 let mut inner_depth = depth.clone();
7521 if inlined {
7522 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7523 inner_offset = next_offset;
7524 } else {
7525 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7526 inner_depth.increment()?;
7527 }
7528 let val_ref = self.token_id.get_or_insert_with(|| {
7529 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
7530 });
7531 fidl::decode!(
7532 u64,
7533 fidl::encoding::DefaultFuchsiaResourceDialect,
7534 val_ref,
7535 decoder,
7536 inner_offset,
7537 inner_depth
7538 )?;
7539 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7540 {
7541 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7542 }
7543 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7544 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7545 }
7546 }
7547
7548 next_offset += envelope_size;
7549 _next_ordinal_to_read += 1;
7550 if next_offset >= end_offset {
7551 return Ok(());
7552 }
7553
7554 while _next_ordinal_to_read < 2 {
7556 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7557 _next_ordinal_to_read += 1;
7558 next_offset += envelope_size;
7559 }
7560
7561 let next_out_of_line = decoder.next_out_of_line();
7562 let handles_before = decoder.remaining_handles();
7563 if let Some((inlined, num_bytes, num_handles)) =
7564 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7565 {
7566 let member_inline_size = <fidl::encoding::Endpoint<
7567 fidl::endpoints::ServerEnd<ControlMarker>,
7568 > as fidl::encoding::TypeMarker>::inline_size(
7569 decoder.context
7570 );
7571 if inlined != (member_inline_size <= 4) {
7572 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7573 }
7574 let inner_offset;
7575 let mut inner_depth = depth.clone();
7576 if inlined {
7577 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7578 inner_offset = next_offset;
7579 } else {
7580 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7581 inner_depth.increment()?;
7582 }
7583 let val_ref = self.control_server.get_or_insert_with(|| {
7584 fidl::new_empty!(
7585 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
7586 fidl::encoding::DefaultFuchsiaResourceDialect
7587 )
7588 });
7589 fidl::decode!(
7590 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
7591 fidl::encoding::DefaultFuchsiaResourceDialect,
7592 val_ref,
7593 decoder,
7594 inner_offset,
7595 inner_depth
7596 )?;
7597 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7598 {
7599 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7600 }
7601 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7602 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7603 }
7604 }
7605
7606 next_offset += envelope_size;
7607
7608 while next_offset < end_offset {
7610 _next_ordinal_to_read += 1;
7611 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7612 next_offset += envelope_size;
7613 }
7614
7615 Ok(())
7616 }
7617 }
7618
7619 impl ControlCreateRingBufferResponse {
7620 #[inline(always)]
7621 fn max_ordinal_present(&self) -> u64 {
7622 if let Some(_) = self.ring_buffer {
7623 return 2;
7624 }
7625 if let Some(_) = self.properties {
7626 return 1;
7627 }
7628 0
7629 }
7630 }
7631
7632 impl fidl::encoding::ResourceTypeMarker for ControlCreateRingBufferResponse {
7633 type Borrowed<'a> = &'a mut Self;
7634 fn take_or_borrow<'a>(
7635 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7636 ) -> Self::Borrowed<'a> {
7637 value
7638 }
7639 }
7640
7641 unsafe impl fidl::encoding::TypeMarker for ControlCreateRingBufferResponse {
7642 type Owned = Self;
7643
7644 #[inline(always)]
7645 fn inline_align(_context: fidl::encoding::Context) -> usize {
7646 8
7647 }
7648
7649 #[inline(always)]
7650 fn inline_size(_context: fidl::encoding::Context) -> usize {
7651 16
7652 }
7653 }
7654
7655 unsafe impl
7656 fidl::encoding::Encode<
7657 ControlCreateRingBufferResponse,
7658 fidl::encoding::DefaultFuchsiaResourceDialect,
7659 > for &mut ControlCreateRingBufferResponse
7660 {
7661 unsafe fn encode(
7662 self,
7663 encoder: &mut fidl::encoding::Encoder<
7664 '_,
7665 fidl::encoding::DefaultFuchsiaResourceDialect,
7666 >,
7667 offset: usize,
7668 mut depth: fidl::encoding::Depth,
7669 ) -> fidl::Result<()> {
7670 encoder.debug_check_bounds::<ControlCreateRingBufferResponse>(offset);
7671 let max_ordinal: u64 = self.max_ordinal_present();
7673 encoder.write_num(max_ordinal, offset);
7674 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7675 if max_ordinal == 0 {
7677 return Ok(());
7678 }
7679 depth.increment()?;
7680 let envelope_size = 8;
7681 let bytes_len = max_ordinal as usize * envelope_size;
7682 #[allow(unused_variables)]
7683 let offset = encoder.out_of_line_offset(bytes_len);
7684 let mut _prev_end_offset: usize = 0;
7685 if 1 > max_ordinal {
7686 return Ok(());
7687 }
7688
7689 let cur_offset: usize = (1 - 1) * envelope_size;
7692
7693 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7695
7696 fidl::encoding::encode_in_envelope_optional::<
7701 RingBufferProperties,
7702 fidl::encoding::DefaultFuchsiaResourceDialect,
7703 >(
7704 self.properties
7705 .as_ref()
7706 .map(<RingBufferProperties as fidl::encoding::ValueTypeMarker>::borrow),
7707 encoder,
7708 offset + cur_offset,
7709 depth,
7710 )?;
7711
7712 _prev_end_offset = cur_offset + envelope_size;
7713 if 2 > max_ordinal {
7714 return Ok(());
7715 }
7716
7717 let cur_offset: usize = (2 - 1) * envelope_size;
7720
7721 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7723
7724 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_audio::RingBuffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
7729 self.ring_buffer.as_mut().map(<fidl_fuchsia_audio::RingBuffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7730 encoder, offset + cur_offset, depth
7731 )?;
7732
7733 _prev_end_offset = cur_offset + envelope_size;
7734
7735 Ok(())
7736 }
7737 }
7738
7739 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7740 for ControlCreateRingBufferResponse
7741 {
7742 #[inline(always)]
7743 fn new_empty() -> Self {
7744 Self::default()
7745 }
7746
7747 unsafe fn decode(
7748 &mut self,
7749 decoder: &mut fidl::encoding::Decoder<
7750 '_,
7751 fidl::encoding::DefaultFuchsiaResourceDialect,
7752 >,
7753 offset: usize,
7754 mut depth: fidl::encoding::Depth,
7755 ) -> fidl::Result<()> {
7756 decoder.debug_check_bounds::<Self>(offset);
7757 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7758 None => return Err(fidl::Error::NotNullable),
7759 Some(len) => len,
7760 };
7761 if len == 0 {
7763 return Ok(());
7764 };
7765 depth.increment()?;
7766 let envelope_size = 8;
7767 let bytes_len = len * envelope_size;
7768 let offset = decoder.out_of_line_offset(bytes_len)?;
7769 let mut _next_ordinal_to_read = 0;
7771 let mut next_offset = offset;
7772 let end_offset = offset + bytes_len;
7773 _next_ordinal_to_read += 1;
7774 if next_offset >= end_offset {
7775 return Ok(());
7776 }
7777
7778 while _next_ordinal_to_read < 1 {
7780 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7781 _next_ordinal_to_read += 1;
7782 next_offset += envelope_size;
7783 }
7784
7785 let next_out_of_line = decoder.next_out_of_line();
7786 let handles_before = decoder.remaining_handles();
7787 if let Some((inlined, num_bytes, num_handles)) =
7788 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7789 {
7790 let member_inline_size =
7791 <RingBufferProperties as fidl::encoding::TypeMarker>::inline_size(
7792 decoder.context,
7793 );
7794 if inlined != (member_inline_size <= 4) {
7795 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7796 }
7797 let inner_offset;
7798 let mut inner_depth = depth.clone();
7799 if inlined {
7800 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7801 inner_offset = next_offset;
7802 } else {
7803 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7804 inner_depth.increment()?;
7805 }
7806 let val_ref = self.properties.get_or_insert_with(|| {
7807 fidl::new_empty!(
7808 RingBufferProperties,
7809 fidl::encoding::DefaultFuchsiaResourceDialect
7810 )
7811 });
7812 fidl::decode!(
7813 RingBufferProperties,
7814 fidl::encoding::DefaultFuchsiaResourceDialect,
7815 val_ref,
7816 decoder,
7817 inner_offset,
7818 inner_depth
7819 )?;
7820 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7821 {
7822 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7823 }
7824 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7825 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7826 }
7827 }
7828
7829 next_offset += envelope_size;
7830 _next_ordinal_to_read += 1;
7831 if next_offset >= end_offset {
7832 return Ok(());
7833 }
7834
7835 while _next_ordinal_to_read < 2 {
7837 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7838 _next_ordinal_to_read += 1;
7839 next_offset += envelope_size;
7840 }
7841
7842 let next_out_of_line = decoder.next_out_of_line();
7843 let handles_before = decoder.remaining_handles();
7844 if let Some((inlined, num_bytes, num_handles)) =
7845 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7846 {
7847 let member_inline_size =
7848 <fidl_fuchsia_audio::RingBuffer as fidl::encoding::TypeMarker>::inline_size(
7849 decoder.context,
7850 );
7851 if inlined != (member_inline_size <= 4) {
7852 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7853 }
7854 let inner_offset;
7855 let mut inner_depth = depth.clone();
7856 if inlined {
7857 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7858 inner_offset = next_offset;
7859 } else {
7860 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7861 inner_depth.increment()?;
7862 }
7863 let val_ref = self.ring_buffer.get_or_insert_with(|| {
7864 fidl::new_empty!(
7865 fidl_fuchsia_audio::RingBuffer,
7866 fidl::encoding::DefaultFuchsiaResourceDialect
7867 )
7868 });
7869 fidl::decode!(
7870 fidl_fuchsia_audio::RingBuffer,
7871 fidl::encoding::DefaultFuchsiaResourceDialect,
7872 val_ref,
7873 decoder,
7874 inner_offset,
7875 inner_depth
7876 )?;
7877 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7878 {
7879 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7880 }
7881 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7882 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7883 }
7884 }
7885
7886 next_offset += envelope_size;
7887
7888 while next_offset < end_offset {
7890 _next_ordinal_to_read += 1;
7891 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7892 next_offset += envelope_size;
7893 }
7894
7895 Ok(())
7896 }
7897 }
7898
7899 impl ObserverGetReferenceClockResponse {
7900 #[inline(always)]
7901 fn max_ordinal_present(&self) -> u64 {
7902 if let Some(_) = self.reference_clock {
7903 return 1;
7904 }
7905 0
7906 }
7907 }
7908
7909 impl fidl::encoding::ResourceTypeMarker for ObserverGetReferenceClockResponse {
7910 type Borrowed<'a> = &'a mut Self;
7911 fn take_or_borrow<'a>(
7912 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7913 ) -> Self::Borrowed<'a> {
7914 value
7915 }
7916 }
7917
7918 unsafe impl fidl::encoding::TypeMarker for ObserverGetReferenceClockResponse {
7919 type Owned = Self;
7920
7921 #[inline(always)]
7922 fn inline_align(_context: fidl::encoding::Context) -> usize {
7923 8
7924 }
7925
7926 #[inline(always)]
7927 fn inline_size(_context: fidl::encoding::Context) -> usize {
7928 16
7929 }
7930 }
7931
7932 unsafe impl
7933 fidl::encoding::Encode<
7934 ObserverGetReferenceClockResponse,
7935 fidl::encoding::DefaultFuchsiaResourceDialect,
7936 > for &mut ObserverGetReferenceClockResponse
7937 {
7938 unsafe fn encode(
7939 self,
7940 encoder: &mut fidl::encoding::Encoder<
7941 '_,
7942 fidl::encoding::DefaultFuchsiaResourceDialect,
7943 >,
7944 offset: usize,
7945 mut depth: fidl::encoding::Depth,
7946 ) -> fidl::Result<()> {
7947 encoder.debug_check_bounds::<ObserverGetReferenceClockResponse>(offset);
7948 let max_ordinal: u64 = self.max_ordinal_present();
7950 encoder.write_num(max_ordinal, offset);
7951 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7952 if max_ordinal == 0 {
7954 return Ok(());
7955 }
7956 depth.increment()?;
7957 let envelope_size = 8;
7958 let bytes_len = max_ordinal as usize * envelope_size;
7959 #[allow(unused_variables)]
7960 let offset = encoder.out_of_line_offset(bytes_len);
7961 let mut _prev_end_offset: usize = 0;
7962 if 1 > max_ordinal {
7963 return Ok(());
7964 }
7965
7966 let cur_offset: usize = (1 - 1) * envelope_size;
7969
7970 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7972
7973 fidl::encoding::encode_in_envelope_optional::<
7978 fidl::encoding::HandleType<
7979 fidl::Clock,
7980 { fidl::ObjectType::CLOCK.into_raw() },
7981 2147483648,
7982 >,
7983 fidl::encoding::DefaultFuchsiaResourceDialect,
7984 >(
7985 self.reference_clock.as_mut().map(
7986 <fidl::encoding::HandleType<
7987 fidl::Clock,
7988 { fidl::ObjectType::CLOCK.into_raw() },
7989 2147483648,
7990 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7991 ),
7992 encoder,
7993 offset + cur_offset,
7994 depth,
7995 )?;
7996
7997 _prev_end_offset = cur_offset + envelope_size;
7998
7999 Ok(())
8000 }
8001 }
8002
8003 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8004 for ObserverGetReferenceClockResponse
8005 {
8006 #[inline(always)]
8007 fn new_empty() -> Self {
8008 Self::default()
8009 }
8010
8011 unsafe fn decode(
8012 &mut self,
8013 decoder: &mut fidl::encoding::Decoder<
8014 '_,
8015 fidl::encoding::DefaultFuchsiaResourceDialect,
8016 >,
8017 offset: usize,
8018 mut depth: fidl::encoding::Depth,
8019 ) -> fidl::Result<()> {
8020 decoder.debug_check_bounds::<Self>(offset);
8021 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8022 None => return Err(fidl::Error::NotNullable),
8023 Some(len) => len,
8024 };
8025 if len == 0 {
8027 return Ok(());
8028 };
8029 depth.increment()?;
8030 let envelope_size = 8;
8031 let bytes_len = len * envelope_size;
8032 let offset = decoder.out_of_line_offset(bytes_len)?;
8033 let mut _next_ordinal_to_read = 0;
8035 let mut next_offset = offset;
8036 let end_offset = offset + bytes_len;
8037 _next_ordinal_to_read += 1;
8038 if next_offset >= end_offset {
8039 return Ok(());
8040 }
8041
8042 while _next_ordinal_to_read < 1 {
8044 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8045 _next_ordinal_to_read += 1;
8046 next_offset += envelope_size;
8047 }
8048
8049 let next_out_of_line = decoder.next_out_of_line();
8050 let handles_before = decoder.remaining_handles();
8051 if let Some((inlined, num_bytes, num_handles)) =
8052 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8053 {
8054 let member_inline_size = <fidl::encoding::HandleType<
8055 fidl::Clock,
8056 { fidl::ObjectType::CLOCK.into_raw() },
8057 2147483648,
8058 > as fidl::encoding::TypeMarker>::inline_size(
8059 decoder.context
8060 );
8061 if inlined != (member_inline_size <= 4) {
8062 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8063 }
8064 let inner_offset;
8065 let mut inner_depth = depth.clone();
8066 if inlined {
8067 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8068 inner_offset = next_offset;
8069 } else {
8070 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8071 inner_depth.increment()?;
8072 }
8073 let val_ref =
8074 self.reference_clock.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
8075 fidl::decode!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8076 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8077 {
8078 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8079 }
8080 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8081 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8082 }
8083 }
8084
8085 next_offset += envelope_size;
8086
8087 while next_offset < end_offset {
8089 _next_ordinal_to_read += 1;
8090 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8091 next_offset += envelope_size;
8092 }
8093
8094 Ok(())
8095 }
8096 }
8097
8098 impl ProviderAddDeviceRequest {
8099 #[inline(always)]
8100 fn max_ordinal_present(&self) -> u64 {
8101 if let Some(_) = self.driver_client {
8102 return 3;
8103 }
8104 if let Some(_) = self.device_type {
8105 return 2;
8106 }
8107 if let Some(_) = self.device_name {
8108 return 1;
8109 }
8110 0
8111 }
8112 }
8113
8114 impl fidl::encoding::ResourceTypeMarker for ProviderAddDeviceRequest {
8115 type Borrowed<'a> = &'a mut Self;
8116 fn take_or_borrow<'a>(
8117 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8118 ) -> Self::Borrowed<'a> {
8119 value
8120 }
8121 }
8122
8123 unsafe impl fidl::encoding::TypeMarker for ProviderAddDeviceRequest {
8124 type Owned = Self;
8125
8126 #[inline(always)]
8127 fn inline_align(_context: fidl::encoding::Context) -> usize {
8128 8
8129 }
8130
8131 #[inline(always)]
8132 fn inline_size(_context: fidl::encoding::Context) -> usize {
8133 16
8134 }
8135 }
8136
8137 unsafe impl
8138 fidl::encoding::Encode<
8139 ProviderAddDeviceRequest,
8140 fidl::encoding::DefaultFuchsiaResourceDialect,
8141 > for &mut ProviderAddDeviceRequest
8142 {
8143 unsafe fn encode(
8144 self,
8145 encoder: &mut fidl::encoding::Encoder<
8146 '_,
8147 fidl::encoding::DefaultFuchsiaResourceDialect,
8148 >,
8149 offset: usize,
8150 mut depth: fidl::encoding::Depth,
8151 ) -> fidl::Result<()> {
8152 encoder.debug_check_bounds::<ProviderAddDeviceRequest>(offset);
8153 let max_ordinal: u64 = self.max_ordinal_present();
8155 encoder.write_num(max_ordinal, offset);
8156 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8157 if max_ordinal == 0 {
8159 return Ok(());
8160 }
8161 depth.increment()?;
8162 let envelope_size = 8;
8163 let bytes_len = max_ordinal as usize * envelope_size;
8164 #[allow(unused_variables)]
8165 let offset = encoder.out_of_line_offset(bytes_len);
8166 let mut _prev_end_offset: usize = 0;
8167 if 1 > max_ordinal {
8168 return Ok(());
8169 }
8170
8171 let cur_offset: usize = (1 - 1) * envelope_size;
8174
8175 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8177
8178 fidl::encoding::encode_in_envelope_optional::<
8183 fidl::encoding::BoundedString<256>,
8184 fidl::encoding::DefaultFuchsiaResourceDialect,
8185 >(
8186 self.device_name.as_ref().map(
8187 <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
8188 ),
8189 encoder,
8190 offset + cur_offset,
8191 depth,
8192 )?;
8193
8194 _prev_end_offset = cur_offset + envelope_size;
8195 if 2 > max_ordinal {
8196 return Ok(());
8197 }
8198
8199 let cur_offset: usize = (2 - 1) * envelope_size;
8202
8203 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8205
8206 fidl::encoding::encode_in_envelope_optional::<
8211 DeviceType,
8212 fidl::encoding::DefaultFuchsiaResourceDialect,
8213 >(
8214 self.device_type
8215 .as_ref()
8216 .map(<DeviceType as fidl::encoding::ValueTypeMarker>::borrow),
8217 encoder,
8218 offset + cur_offset,
8219 depth,
8220 )?;
8221
8222 _prev_end_offset = cur_offset + envelope_size;
8223 if 3 > max_ordinal {
8224 return Ok(());
8225 }
8226
8227 let cur_offset: usize = (3 - 1) * envelope_size;
8230
8231 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8233
8234 fidl::encoding::encode_in_envelope_optional::<
8239 DriverClient,
8240 fidl::encoding::DefaultFuchsiaResourceDialect,
8241 >(
8242 self.driver_client
8243 .as_mut()
8244 .map(<DriverClient as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8245 encoder,
8246 offset + cur_offset,
8247 depth,
8248 )?;
8249
8250 _prev_end_offset = cur_offset + envelope_size;
8251
8252 Ok(())
8253 }
8254 }
8255
8256 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8257 for ProviderAddDeviceRequest
8258 {
8259 #[inline(always)]
8260 fn new_empty() -> Self {
8261 Self::default()
8262 }
8263
8264 unsafe fn decode(
8265 &mut self,
8266 decoder: &mut fidl::encoding::Decoder<
8267 '_,
8268 fidl::encoding::DefaultFuchsiaResourceDialect,
8269 >,
8270 offset: usize,
8271 mut depth: fidl::encoding::Depth,
8272 ) -> fidl::Result<()> {
8273 decoder.debug_check_bounds::<Self>(offset);
8274 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8275 None => return Err(fidl::Error::NotNullable),
8276 Some(len) => len,
8277 };
8278 if len == 0 {
8280 return Ok(());
8281 };
8282 depth.increment()?;
8283 let envelope_size = 8;
8284 let bytes_len = len * envelope_size;
8285 let offset = decoder.out_of_line_offset(bytes_len)?;
8286 let mut _next_ordinal_to_read = 0;
8288 let mut next_offset = offset;
8289 let end_offset = offset + bytes_len;
8290 _next_ordinal_to_read += 1;
8291 if next_offset >= end_offset {
8292 return Ok(());
8293 }
8294
8295 while _next_ordinal_to_read < 1 {
8297 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8298 _next_ordinal_to_read += 1;
8299 next_offset += envelope_size;
8300 }
8301
8302 let next_out_of_line = decoder.next_out_of_line();
8303 let handles_before = decoder.remaining_handles();
8304 if let Some((inlined, num_bytes, num_handles)) =
8305 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8306 {
8307 let member_inline_size =
8308 <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
8309 decoder.context,
8310 );
8311 if inlined != (member_inline_size <= 4) {
8312 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8313 }
8314 let inner_offset;
8315 let mut inner_depth = depth.clone();
8316 if inlined {
8317 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8318 inner_offset = next_offset;
8319 } else {
8320 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8321 inner_depth.increment()?;
8322 }
8323 let val_ref = self.device_name.get_or_insert_with(|| {
8324 fidl::new_empty!(
8325 fidl::encoding::BoundedString<256>,
8326 fidl::encoding::DefaultFuchsiaResourceDialect
8327 )
8328 });
8329 fidl::decode!(
8330 fidl::encoding::BoundedString<256>,
8331 fidl::encoding::DefaultFuchsiaResourceDialect,
8332 val_ref,
8333 decoder,
8334 inner_offset,
8335 inner_depth
8336 )?;
8337 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8338 {
8339 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8340 }
8341 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8342 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8343 }
8344 }
8345
8346 next_offset += envelope_size;
8347 _next_ordinal_to_read += 1;
8348 if next_offset >= end_offset {
8349 return Ok(());
8350 }
8351
8352 while _next_ordinal_to_read < 2 {
8354 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8355 _next_ordinal_to_read += 1;
8356 next_offset += envelope_size;
8357 }
8358
8359 let next_out_of_line = decoder.next_out_of_line();
8360 let handles_before = decoder.remaining_handles();
8361 if let Some((inlined, num_bytes, num_handles)) =
8362 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8363 {
8364 let member_inline_size =
8365 <DeviceType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8366 if inlined != (member_inline_size <= 4) {
8367 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8368 }
8369 let inner_offset;
8370 let mut inner_depth = depth.clone();
8371 if inlined {
8372 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8373 inner_offset = next_offset;
8374 } else {
8375 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8376 inner_depth.increment()?;
8377 }
8378 let val_ref = self.device_type.get_or_insert_with(|| {
8379 fidl::new_empty!(DeviceType, fidl::encoding::DefaultFuchsiaResourceDialect)
8380 });
8381 fidl::decode!(
8382 DeviceType,
8383 fidl::encoding::DefaultFuchsiaResourceDialect,
8384 val_ref,
8385 decoder,
8386 inner_offset,
8387 inner_depth
8388 )?;
8389 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8390 {
8391 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8392 }
8393 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8394 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8395 }
8396 }
8397
8398 next_offset += envelope_size;
8399 _next_ordinal_to_read += 1;
8400 if next_offset >= end_offset {
8401 return Ok(());
8402 }
8403
8404 while _next_ordinal_to_read < 3 {
8406 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8407 _next_ordinal_to_read += 1;
8408 next_offset += envelope_size;
8409 }
8410
8411 let next_out_of_line = decoder.next_out_of_line();
8412 let handles_before = decoder.remaining_handles();
8413 if let Some((inlined, num_bytes, num_handles)) =
8414 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8415 {
8416 let member_inline_size =
8417 <DriverClient as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8418 if inlined != (member_inline_size <= 4) {
8419 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8420 }
8421 let inner_offset;
8422 let mut inner_depth = depth.clone();
8423 if inlined {
8424 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8425 inner_offset = next_offset;
8426 } else {
8427 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8428 inner_depth.increment()?;
8429 }
8430 let val_ref = self.driver_client.get_or_insert_with(|| {
8431 fidl::new_empty!(DriverClient, fidl::encoding::DefaultFuchsiaResourceDialect)
8432 });
8433 fidl::decode!(
8434 DriverClient,
8435 fidl::encoding::DefaultFuchsiaResourceDialect,
8436 val_ref,
8437 decoder,
8438 inner_offset,
8439 inner_depth
8440 )?;
8441 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8442 {
8443 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8444 }
8445 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8446 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8447 }
8448 }
8449
8450 next_offset += envelope_size;
8451
8452 while next_offset < end_offset {
8454 _next_ordinal_to_read += 1;
8455 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8456 next_offset += envelope_size;
8457 }
8458
8459 Ok(())
8460 }
8461 }
8462
8463 impl RegistryCreateObserverRequest {
8464 #[inline(always)]
8465 fn max_ordinal_present(&self) -> u64 {
8466 if let Some(_) = self.observer_server {
8467 return 2;
8468 }
8469 if let Some(_) = self.token_id {
8470 return 1;
8471 }
8472 0
8473 }
8474 }
8475
8476 impl fidl::encoding::ResourceTypeMarker for RegistryCreateObserverRequest {
8477 type Borrowed<'a> = &'a mut Self;
8478 fn take_or_borrow<'a>(
8479 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8480 ) -> Self::Borrowed<'a> {
8481 value
8482 }
8483 }
8484
8485 unsafe impl fidl::encoding::TypeMarker for RegistryCreateObserverRequest {
8486 type Owned = Self;
8487
8488 #[inline(always)]
8489 fn inline_align(_context: fidl::encoding::Context) -> usize {
8490 8
8491 }
8492
8493 #[inline(always)]
8494 fn inline_size(_context: fidl::encoding::Context) -> usize {
8495 16
8496 }
8497 }
8498
8499 unsafe impl
8500 fidl::encoding::Encode<
8501 RegistryCreateObserverRequest,
8502 fidl::encoding::DefaultFuchsiaResourceDialect,
8503 > for &mut RegistryCreateObserverRequest
8504 {
8505 unsafe fn encode(
8506 self,
8507 encoder: &mut fidl::encoding::Encoder<
8508 '_,
8509 fidl::encoding::DefaultFuchsiaResourceDialect,
8510 >,
8511 offset: usize,
8512 mut depth: fidl::encoding::Depth,
8513 ) -> fidl::Result<()> {
8514 encoder.debug_check_bounds::<RegistryCreateObserverRequest>(offset);
8515 let max_ordinal: u64 = self.max_ordinal_present();
8517 encoder.write_num(max_ordinal, offset);
8518 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8519 if max_ordinal == 0 {
8521 return Ok(());
8522 }
8523 depth.increment()?;
8524 let envelope_size = 8;
8525 let bytes_len = max_ordinal as usize * envelope_size;
8526 #[allow(unused_variables)]
8527 let offset = encoder.out_of_line_offset(bytes_len);
8528 let mut _prev_end_offset: usize = 0;
8529 if 1 > max_ordinal {
8530 return Ok(());
8531 }
8532
8533 let cur_offset: usize = (1 - 1) * envelope_size;
8536
8537 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8539
8540 fidl::encoding::encode_in_envelope_optional::<
8545 u64,
8546 fidl::encoding::DefaultFuchsiaResourceDialect,
8547 >(
8548 self.token_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
8549 encoder,
8550 offset + cur_offset,
8551 depth,
8552 )?;
8553
8554 _prev_end_offset = cur_offset + envelope_size;
8555 if 2 > max_ordinal {
8556 return Ok(());
8557 }
8558
8559 let cur_offset: usize = (2 - 1) * envelope_size;
8562
8563 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8565
8566 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ObserverMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8571 self.observer_server.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ObserverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8572 encoder, offset + cur_offset, depth
8573 )?;
8574
8575 _prev_end_offset = cur_offset + envelope_size;
8576
8577 Ok(())
8578 }
8579 }
8580
8581 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8582 for RegistryCreateObserverRequest
8583 {
8584 #[inline(always)]
8585 fn new_empty() -> Self {
8586 Self::default()
8587 }
8588
8589 unsafe fn decode(
8590 &mut self,
8591 decoder: &mut fidl::encoding::Decoder<
8592 '_,
8593 fidl::encoding::DefaultFuchsiaResourceDialect,
8594 >,
8595 offset: usize,
8596 mut depth: fidl::encoding::Depth,
8597 ) -> fidl::Result<()> {
8598 decoder.debug_check_bounds::<Self>(offset);
8599 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8600 None => return Err(fidl::Error::NotNullable),
8601 Some(len) => len,
8602 };
8603 if len == 0 {
8605 return Ok(());
8606 };
8607 depth.increment()?;
8608 let envelope_size = 8;
8609 let bytes_len = len * envelope_size;
8610 let offset = decoder.out_of_line_offset(bytes_len)?;
8611 let mut _next_ordinal_to_read = 0;
8613 let mut next_offset = offset;
8614 let end_offset = offset + bytes_len;
8615 _next_ordinal_to_read += 1;
8616 if next_offset >= end_offset {
8617 return Ok(());
8618 }
8619
8620 while _next_ordinal_to_read < 1 {
8622 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8623 _next_ordinal_to_read += 1;
8624 next_offset += envelope_size;
8625 }
8626
8627 let next_out_of_line = decoder.next_out_of_line();
8628 let handles_before = decoder.remaining_handles();
8629 if let Some((inlined, num_bytes, num_handles)) =
8630 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8631 {
8632 let member_inline_size =
8633 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8634 if inlined != (member_inline_size <= 4) {
8635 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8636 }
8637 let inner_offset;
8638 let mut inner_depth = depth.clone();
8639 if inlined {
8640 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8641 inner_offset = next_offset;
8642 } else {
8643 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8644 inner_depth.increment()?;
8645 }
8646 let val_ref = self.token_id.get_or_insert_with(|| {
8647 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
8648 });
8649 fidl::decode!(
8650 u64,
8651 fidl::encoding::DefaultFuchsiaResourceDialect,
8652 val_ref,
8653 decoder,
8654 inner_offset,
8655 inner_depth
8656 )?;
8657 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8658 {
8659 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8660 }
8661 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8662 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8663 }
8664 }
8665
8666 next_offset += envelope_size;
8667 _next_ordinal_to_read += 1;
8668 if next_offset >= end_offset {
8669 return Ok(());
8670 }
8671
8672 while _next_ordinal_to_read < 2 {
8674 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8675 _next_ordinal_to_read += 1;
8676 next_offset += envelope_size;
8677 }
8678
8679 let next_out_of_line = decoder.next_out_of_line();
8680 let handles_before = decoder.remaining_handles();
8681 if let Some((inlined, num_bytes, num_handles)) =
8682 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8683 {
8684 let member_inline_size = <fidl::encoding::Endpoint<
8685 fidl::endpoints::ServerEnd<ObserverMarker>,
8686 > as fidl::encoding::TypeMarker>::inline_size(
8687 decoder.context
8688 );
8689 if inlined != (member_inline_size <= 4) {
8690 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8691 }
8692 let inner_offset;
8693 let mut inner_depth = depth.clone();
8694 if inlined {
8695 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8696 inner_offset = next_offset;
8697 } else {
8698 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8699 inner_depth.increment()?;
8700 }
8701 let val_ref = self.observer_server.get_or_insert_with(|| {
8702 fidl::new_empty!(
8703 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ObserverMarker>>,
8704 fidl::encoding::DefaultFuchsiaResourceDialect
8705 )
8706 });
8707 fidl::decode!(
8708 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ObserverMarker>>,
8709 fidl::encoding::DefaultFuchsiaResourceDialect,
8710 val_ref,
8711 decoder,
8712 inner_offset,
8713 inner_depth
8714 )?;
8715 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8716 {
8717 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8718 }
8719 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8720 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8721 }
8722 }
8723
8724 next_offset += envelope_size;
8725
8726 while next_offset < end_offset {
8728 _next_ordinal_to_read += 1;
8729 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8730 next_offset += envelope_size;
8731 }
8732
8733 Ok(())
8734 }
8735 }
8736
8737 impl fidl::encoding::ResourceTypeMarker for DriverClient {
8738 type Borrowed<'a> = &'a mut Self;
8739 fn take_or_borrow<'a>(
8740 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8741 ) -> Self::Borrowed<'a> {
8742 value
8743 }
8744 }
8745
8746 unsafe impl fidl::encoding::TypeMarker for DriverClient {
8747 type Owned = Self;
8748
8749 #[inline(always)]
8750 fn inline_align(_context: fidl::encoding::Context) -> usize {
8751 8
8752 }
8753
8754 #[inline(always)]
8755 fn inline_size(_context: fidl::encoding::Context) -> usize {
8756 16
8757 }
8758 }
8759
8760 unsafe impl fidl::encoding::Encode<DriverClient, fidl::encoding::DefaultFuchsiaResourceDialect>
8761 for &mut DriverClient
8762 {
8763 #[inline]
8764 unsafe fn encode(
8765 self,
8766 encoder: &mut fidl::encoding::Encoder<
8767 '_,
8768 fidl::encoding::DefaultFuchsiaResourceDialect,
8769 >,
8770 offset: usize,
8771 _depth: fidl::encoding::Depth,
8772 ) -> fidl::Result<()> {
8773 encoder.debug_check_bounds::<DriverClient>(offset);
8774 encoder.write_num::<u64>(self.ordinal(), offset);
8775 match self {
8776 DriverClient::Codec(ref mut val) => fidl::encoding::encode_in_envelope::<
8777 fidl::encoding::Endpoint<
8778 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::CodecMarker>,
8779 >,
8780 fidl::encoding::DefaultFuchsiaResourceDialect,
8781 >(
8782 <fidl::encoding::Endpoint<
8783 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::CodecMarker>,
8784 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8785 val
8786 ),
8787 encoder,
8788 offset + 8,
8789 _depth,
8790 ),
8791 DriverClient::Composite(ref mut val) => fidl::encoding::encode_in_envelope::<
8792 fidl::encoding::Endpoint<
8793 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::CompositeMarker>,
8794 >,
8795 fidl::encoding::DefaultFuchsiaResourceDialect,
8796 >(
8797 <fidl::encoding::Endpoint<
8798 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::CompositeMarker>,
8799 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8800 val
8801 ),
8802 encoder,
8803 offset + 8,
8804 _depth,
8805 ),
8806 DriverClient::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
8807 }
8808 }
8809 }
8810
8811 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DriverClient {
8812 #[inline(always)]
8813 fn new_empty() -> Self {
8814 Self::__SourceBreaking { unknown_ordinal: 0 }
8815 }
8816
8817 #[inline]
8818 unsafe fn decode(
8819 &mut self,
8820 decoder: &mut fidl::encoding::Decoder<
8821 '_,
8822 fidl::encoding::DefaultFuchsiaResourceDialect,
8823 >,
8824 offset: usize,
8825 mut depth: fidl::encoding::Depth,
8826 ) -> fidl::Result<()> {
8827 decoder.debug_check_bounds::<Self>(offset);
8828 #[allow(unused_variables)]
8829 let next_out_of_line = decoder.next_out_of_line();
8830 let handles_before = decoder.remaining_handles();
8831 let (ordinal, inlined, num_bytes, num_handles) =
8832 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
8833
8834 let member_inline_size = match ordinal {
8835 1 => <fidl::encoding::Endpoint<
8836 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::CodecMarker>,
8837 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8838 2 => <fidl::encoding::Endpoint<
8839 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_audio::CompositeMarker>,
8840 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8841 0 => return Err(fidl::Error::UnknownUnionTag),
8842 _ => num_bytes as usize,
8843 };
8844
8845 if inlined != (member_inline_size <= 4) {
8846 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8847 }
8848 let _inner_offset;
8849 if inlined {
8850 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
8851 _inner_offset = offset + 8;
8852 } else {
8853 depth.increment()?;
8854 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8855 }
8856 match ordinal {
8857 1 => {
8858 #[allow(irrefutable_let_patterns)]
8859 if let DriverClient::Codec(_) = self {
8860 } else {
8862 *self = DriverClient::Codec(fidl::new_empty!(
8864 fidl::encoding::Endpoint<
8865 fidl::endpoints::ClientEnd<
8866 fidl_fuchsia_hardware_audio::CodecMarker,
8867 >,
8868 >,
8869 fidl::encoding::DefaultFuchsiaResourceDialect
8870 ));
8871 }
8872 #[allow(irrefutable_let_patterns)]
8873 if let DriverClient::Codec(ref mut val) = self {
8874 fidl::decode!(
8875 fidl::encoding::Endpoint<
8876 fidl::endpoints::ClientEnd<
8877 fidl_fuchsia_hardware_audio::CodecMarker,
8878 >,
8879 >,
8880 fidl::encoding::DefaultFuchsiaResourceDialect,
8881 val,
8882 decoder,
8883 _inner_offset,
8884 depth
8885 )?;
8886 } else {
8887 unreachable!()
8888 }
8889 }
8890 2 => {
8891 #[allow(irrefutable_let_patterns)]
8892 if let DriverClient::Composite(_) = self {
8893 } else {
8895 *self = DriverClient::Composite(fidl::new_empty!(
8897 fidl::encoding::Endpoint<
8898 fidl::endpoints::ClientEnd<
8899 fidl_fuchsia_hardware_audio::CompositeMarker,
8900 >,
8901 >,
8902 fidl::encoding::DefaultFuchsiaResourceDialect
8903 ));
8904 }
8905 #[allow(irrefutable_let_patterns)]
8906 if let DriverClient::Composite(ref mut val) = self {
8907 fidl::decode!(
8908 fidl::encoding::Endpoint<
8909 fidl::endpoints::ClientEnd<
8910 fidl_fuchsia_hardware_audio::CompositeMarker,
8911 >,
8912 >,
8913 fidl::encoding::DefaultFuchsiaResourceDialect,
8914 val,
8915 decoder,
8916 _inner_offset,
8917 depth
8918 )?;
8919 } else {
8920 unreachable!()
8921 }
8922 }
8923 #[allow(deprecated)]
8924 ordinal => {
8925 for _ in 0..num_handles {
8926 decoder.drop_next_handle()?;
8927 }
8928 *self = DriverClient::__SourceBreaking { unknown_ordinal: ordinal };
8929 }
8930 }
8931 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
8932 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8933 }
8934 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8935 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8936 }
8937 Ok(())
8938 }
8939 }
8940}