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__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
96pub struct RingBuffer {
97 pub buffer: Option<fidl_fuchsia_mem::Buffer>,
102 pub format: Option<Format>,
105 pub producer_bytes: Option<u64>,
115 pub consumer_bytes: Option<u64>,
125 pub reference_clock: Option<fidl::Clock>,
129 pub reference_clock_domain: Option<u32>,
135 #[doc(hidden)]
136 pub __source_breaking: fidl::marker::SourceBreaking,
137}
138
139impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RingBuffer {}
140
141#[derive(Debug, Default, PartialEq)]
142pub struct StreamSinkPutPacketRequest {
143 pub packet: Option<Packet>,
145 pub release_fence: Option<fidl::EventPair>,
150 #[doc(hidden)]
151 pub __source_breaking: fidl::marker::SourceBreaking,
152}
153
154impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
155 for StreamSinkPutPacketRequest
156{
157}
158
159#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
160pub struct DelayWatcherMarker;
161
162impl fidl::endpoints::ProtocolMarker for DelayWatcherMarker {
163 type Proxy = DelayWatcherProxy;
164 type RequestStream = DelayWatcherRequestStream;
165 #[cfg(target_os = "fuchsia")]
166 type SynchronousProxy = DelayWatcherSynchronousProxy;
167
168 const DEBUG_NAME: &'static str = "(anonymous) DelayWatcher";
169}
170
171pub trait DelayWatcherProxyInterface: Send + Sync {
172 type WatchDelayResponseFut: std::future::Future<Output = Result<DelayWatcherWatchDelayResponse, fidl::Error>>
173 + Send;
174 fn r#watch_delay(&self, payload: &DelayWatcherWatchDelayRequest)
175 -> Self::WatchDelayResponseFut;
176}
177#[derive(Debug)]
178#[cfg(target_os = "fuchsia")]
179pub struct DelayWatcherSynchronousProxy {
180 client: fidl::client::sync::Client,
181}
182
183#[cfg(target_os = "fuchsia")]
184impl fidl::endpoints::SynchronousProxy for DelayWatcherSynchronousProxy {
185 type Proxy = DelayWatcherProxy;
186 type Protocol = DelayWatcherMarker;
187
188 fn from_channel(inner: fidl::Channel) -> Self {
189 Self::new(inner)
190 }
191
192 fn into_channel(self) -> fidl::Channel {
193 self.client.into_channel()
194 }
195
196 fn as_channel(&self) -> &fidl::Channel {
197 self.client.as_channel()
198 }
199}
200
201#[cfg(target_os = "fuchsia")]
202impl DelayWatcherSynchronousProxy {
203 pub fn new(channel: fidl::Channel) -> Self {
204 let protocol_name = <DelayWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
205 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
206 }
207
208 pub fn into_channel(self) -> fidl::Channel {
209 self.client.into_channel()
210 }
211
212 pub fn wait_for_event(
215 &self,
216 deadline: zx::MonotonicInstant,
217 ) -> Result<DelayWatcherEvent, fidl::Error> {
218 DelayWatcherEvent::decode(self.client.wait_for_event(deadline)?)
219 }
220
221 pub fn r#watch_delay(
225 &self,
226 mut payload: &DelayWatcherWatchDelayRequest,
227 ___deadline: zx::MonotonicInstant,
228 ) -> Result<DelayWatcherWatchDelayResponse, fidl::Error> {
229 let _response = self
230 .client
231 .send_query::<DelayWatcherWatchDelayRequest, DelayWatcherWatchDelayResponse>(
232 payload,
233 0x3a90c91ee2f1644c,
234 fidl::encoding::DynamicFlags::empty(),
235 ___deadline,
236 )?;
237 Ok(_response)
238 }
239}
240
241#[cfg(target_os = "fuchsia")]
242impl From<DelayWatcherSynchronousProxy> for zx::Handle {
243 fn from(value: DelayWatcherSynchronousProxy) -> Self {
244 value.into_channel().into()
245 }
246}
247
248#[cfg(target_os = "fuchsia")]
249impl From<fidl::Channel> for DelayWatcherSynchronousProxy {
250 fn from(value: fidl::Channel) -> Self {
251 Self::new(value)
252 }
253}
254
255#[cfg(target_os = "fuchsia")]
256impl fidl::endpoints::FromClient for DelayWatcherSynchronousProxy {
257 type Protocol = DelayWatcherMarker;
258
259 fn from_client(value: fidl::endpoints::ClientEnd<DelayWatcherMarker>) -> Self {
260 Self::new(value.into_channel())
261 }
262}
263
264#[derive(Debug, Clone)]
265pub struct DelayWatcherProxy {
266 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
267}
268
269impl fidl::endpoints::Proxy for DelayWatcherProxy {
270 type Protocol = DelayWatcherMarker;
271
272 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
273 Self::new(inner)
274 }
275
276 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
277 self.client.into_channel().map_err(|client| Self { client })
278 }
279
280 fn as_channel(&self) -> &::fidl::AsyncChannel {
281 self.client.as_channel()
282 }
283}
284
285impl DelayWatcherProxy {
286 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
288 let protocol_name = <DelayWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
289 Self { client: fidl::client::Client::new(channel, protocol_name) }
290 }
291
292 pub fn take_event_stream(&self) -> DelayWatcherEventStream {
298 DelayWatcherEventStream { event_receiver: self.client.take_event_receiver() }
299 }
300
301 pub fn r#watch_delay(
305 &self,
306 mut payload: &DelayWatcherWatchDelayRequest,
307 ) -> fidl::client::QueryResponseFut<
308 DelayWatcherWatchDelayResponse,
309 fidl::encoding::DefaultFuchsiaResourceDialect,
310 > {
311 DelayWatcherProxyInterface::r#watch_delay(self, payload)
312 }
313}
314
315impl DelayWatcherProxyInterface for DelayWatcherProxy {
316 type WatchDelayResponseFut = fidl::client::QueryResponseFut<
317 DelayWatcherWatchDelayResponse,
318 fidl::encoding::DefaultFuchsiaResourceDialect,
319 >;
320 fn r#watch_delay(
321 &self,
322 mut payload: &DelayWatcherWatchDelayRequest,
323 ) -> Self::WatchDelayResponseFut {
324 fn _decode(
325 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
326 ) -> Result<DelayWatcherWatchDelayResponse, fidl::Error> {
327 let _response = fidl::client::decode_transaction_body::<
328 DelayWatcherWatchDelayResponse,
329 fidl::encoding::DefaultFuchsiaResourceDialect,
330 0x3a90c91ee2f1644c,
331 >(_buf?)?;
332 Ok(_response)
333 }
334 self.client
335 .send_query_and_decode::<DelayWatcherWatchDelayRequest, DelayWatcherWatchDelayResponse>(
336 payload,
337 0x3a90c91ee2f1644c,
338 fidl::encoding::DynamicFlags::empty(),
339 _decode,
340 )
341 }
342}
343
344pub struct DelayWatcherEventStream {
345 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
346}
347
348impl std::marker::Unpin for DelayWatcherEventStream {}
349
350impl futures::stream::FusedStream for DelayWatcherEventStream {
351 fn is_terminated(&self) -> bool {
352 self.event_receiver.is_terminated()
353 }
354}
355
356impl futures::Stream for DelayWatcherEventStream {
357 type Item = Result<DelayWatcherEvent, fidl::Error>;
358
359 fn poll_next(
360 mut self: std::pin::Pin<&mut Self>,
361 cx: &mut std::task::Context<'_>,
362 ) -> std::task::Poll<Option<Self::Item>> {
363 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
364 &mut self.event_receiver,
365 cx
366 )?) {
367 Some(buf) => std::task::Poll::Ready(Some(DelayWatcherEvent::decode(buf))),
368 None => std::task::Poll::Ready(None),
369 }
370 }
371}
372
373#[derive(Debug)]
374pub enum DelayWatcherEvent {}
375
376impl DelayWatcherEvent {
377 fn decode(
379 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
380 ) -> Result<DelayWatcherEvent, fidl::Error> {
381 let (bytes, _handles) = buf.split_mut();
382 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
383 debug_assert_eq!(tx_header.tx_id, 0);
384 match tx_header.ordinal {
385 _ => Err(fidl::Error::UnknownOrdinal {
386 ordinal: tx_header.ordinal,
387 protocol_name: <DelayWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
388 }),
389 }
390 }
391}
392
393pub struct DelayWatcherRequestStream {
395 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
396 is_terminated: bool,
397}
398
399impl std::marker::Unpin for DelayWatcherRequestStream {}
400
401impl futures::stream::FusedStream for DelayWatcherRequestStream {
402 fn is_terminated(&self) -> bool {
403 self.is_terminated
404 }
405}
406
407impl fidl::endpoints::RequestStream for DelayWatcherRequestStream {
408 type Protocol = DelayWatcherMarker;
409 type ControlHandle = DelayWatcherControlHandle;
410
411 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
412 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
413 }
414
415 fn control_handle(&self) -> Self::ControlHandle {
416 DelayWatcherControlHandle { inner: self.inner.clone() }
417 }
418
419 fn into_inner(
420 self,
421 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
422 {
423 (self.inner, self.is_terminated)
424 }
425
426 fn from_inner(
427 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
428 is_terminated: bool,
429 ) -> Self {
430 Self { inner, is_terminated }
431 }
432}
433
434impl futures::Stream for DelayWatcherRequestStream {
435 type Item = Result<DelayWatcherRequest, fidl::Error>;
436
437 fn poll_next(
438 mut self: std::pin::Pin<&mut Self>,
439 cx: &mut std::task::Context<'_>,
440 ) -> std::task::Poll<Option<Self::Item>> {
441 let this = &mut *self;
442 if this.inner.check_shutdown(cx) {
443 this.is_terminated = true;
444 return std::task::Poll::Ready(None);
445 }
446 if this.is_terminated {
447 panic!("polled DelayWatcherRequestStream after completion");
448 }
449 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
450 |bytes, handles| {
451 match this.inner.channel().read_etc(cx, bytes, handles) {
452 std::task::Poll::Ready(Ok(())) => {}
453 std::task::Poll::Pending => return std::task::Poll::Pending,
454 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
455 this.is_terminated = true;
456 return std::task::Poll::Ready(None);
457 }
458 std::task::Poll::Ready(Err(e)) => {
459 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
460 e.into(),
461 ))))
462 }
463 }
464
465 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
467
468 std::task::Poll::Ready(Some(match header.ordinal {
469 0x3a90c91ee2f1644c => {
470 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
471 let mut req = fidl::new_empty!(
472 DelayWatcherWatchDelayRequest,
473 fidl::encoding::DefaultFuchsiaResourceDialect
474 );
475 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DelayWatcherWatchDelayRequest>(&header, _body_bytes, handles, &mut req)?;
476 let control_handle =
477 DelayWatcherControlHandle { inner: this.inner.clone() };
478 Ok(DelayWatcherRequest::WatchDelay {
479 payload: req,
480 responder: DelayWatcherWatchDelayResponder {
481 control_handle: std::mem::ManuallyDrop::new(control_handle),
482 tx_id: header.tx_id,
483 },
484 })
485 }
486 _ => Err(fidl::Error::UnknownOrdinal {
487 ordinal: header.ordinal,
488 protocol_name:
489 <DelayWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
490 }),
491 }))
492 },
493 )
494 }
495}
496
497#[derive(Debug)]
499pub enum DelayWatcherRequest {
500 WatchDelay {
504 payload: DelayWatcherWatchDelayRequest,
505 responder: DelayWatcherWatchDelayResponder,
506 },
507}
508
509impl DelayWatcherRequest {
510 #[allow(irrefutable_let_patterns)]
511 pub fn into_watch_delay(
512 self,
513 ) -> Option<(DelayWatcherWatchDelayRequest, DelayWatcherWatchDelayResponder)> {
514 if let DelayWatcherRequest::WatchDelay { payload, responder } = self {
515 Some((payload, responder))
516 } else {
517 None
518 }
519 }
520
521 pub fn method_name(&self) -> &'static str {
523 match *self {
524 DelayWatcherRequest::WatchDelay { .. } => "watch_delay",
525 }
526 }
527}
528
529#[derive(Debug, Clone)]
530pub struct DelayWatcherControlHandle {
531 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
532}
533
534impl fidl::endpoints::ControlHandle for DelayWatcherControlHandle {
535 fn shutdown(&self) {
536 self.inner.shutdown()
537 }
538 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
539 self.inner.shutdown_with_epitaph(status)
540 }
541
542 fn is_closed(&self) -> bool {
543 self.inner.channel().is_closed()
544 }
545 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
546 self.inner.channel().on_closed()
547 }
548
549 #[cfg(target_os = "fuchsia")]
550 fn signal_peer(
551 &self,
552 clear_mask: zx::Signals,
553 set_mask: zx::Signals,
554 ) -> Result<(), zx_status::Status> {
555 use fidl::Peered;
556 self.inner.channel().signal_peer(clear_mask, set_mask)
557 }
558}
559
560impl DelayWatcherControlHandle {}
561
562#[must_use = "FIDL methods require a response to be sent"]
563#[derive(Debug)]
564pub struct DelayWatcherWatchDelayResponder {
565 control_handle: std::mem::ManuallyDrop<DelayWatcherControlHandle>,
566 tx_id: u32,
567}
568
569impl std::ops::Drop for DelayWatcherWatchDelayResponder {
573 fn drop(&mut self) {
574 self.control_handle.shutdown();
575 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
577 }
578}
579
580impl fidl::endpoints::Responder for DelayWatcherWatchDelayResponder {
581 type ControlHandle = DelayWatcherControlHandle;
582
583 fn control_handle(&self) -> &DelayWatcherControlHandle {
584 &self.control_handle
585 }
586
587 fn drop_without_shutdown(mut self) {
588 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
590 std::mem::forget(self);
592 }
593}
594
595impl DelayWatcherWatchDelayResponder {
596 pub fn send(self, mut payload: &DelayWatcherWatchDelayResponse) -> Result<(), fidl::Error> {
600 let _result = self.send_raw(payload);
601 if _result.is_err() {
602 self.control_handle.shutdown();
603 }
604 self.drop_without_shutdown();
605 _result
606 }
607
608 pub fn send_no_shutdown_on_err(
610 self,
611 mut payload: &DelayWatcherWatchDelayResponse,
612 ) -> Result<(), fidl::Error> {
613 let _result = self.send_raw(payload);
614 self.drop_without_shutdown();
615 _result
616 }
617
618 fn send_raw(&self, mut payload: &DelayWatcherWatchDelayResponse) -> Result<(), fidl::Error> {
619 self.control_handle.inner.send::<DelayWatcherWatchDelayResponse>(
620 payload,
621 self.tx_id,
622 0x3a90c91ee2f1644c,
623 fidl::encoding::DynamicFlags::empty(),
624 )
625 }
626}
627
628#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
629pub struct GainControlMarker;
630
631impl fidl::endpoints::ProtocolMarker for GainControlMarker {
632 type Proxy = GainControlProxy;
633 type RequestStream = GainControlRequestStream;
634 #[cfg(target_os = "fuchsia")]
635 type SynchronousProxy = GainControlSynchronousProxy;
636
637 const DEBUG_NAME: &'static str = "(anonymous) GainControl";
638}
639pub type GainControlSetGainResult = Result<GainControlSetGainResponse, GainError>;
640pub type GainControlSetMuteResult = Result<GainControlSetMuteResponse, GainError>;
641
642pub trait GainControlProxyInterface: Send + Sync {
643 type SetGainResponseFut: std::future::Future<Output = Result<GainControlSetGainResult, fidl::Error>>
644 + Send;
645 fn r#set_gain(&self, payload: &GainControlSetGainRequest) -> Self::SetGainResponseFut;
646 type SetMuteResponseFut: std::future::Future<Output = Result<GainControlSetMuteResult, fidl::Error>>
647 + Send;
648 fn r#set_mute(&self, payload: &GainControlSetMuteRequest) -> Self::SetMuteResponseFut;
649}
650#[derive(Debug)]
651#[cfg(target_os = "fuchsia")]
652pub struct GainControlSynchronousProxy {
653 client: fidl::client::sync::Client,
654}
655
656#[cfg(target_os = "fuchsia")]
657impl fidl::endpoints::SynchronousProxy for GainControlSynchronousProxy {
658 type Proxy = GainControlProxy;
659 type Protocol = GainControlMarker;
660
661 fn from_channel(inner: fidl::Channel) -> Self {
662 Self::new(inner)
663 }
664
665 fn into_channel(self) -> fidl::Channel {
666 self.client.into_channel()
667 }
668
669 fn as_channel(&self) -> &fidl::Channel {
670 self.client.as_channel()
671 }
672}
673
674#[cfg(target_os = "fuchsia")]
675impl GainControlSynchronousProxy {
676 pub fn new(channel: fidl::Channel) -> Self {
677 let protocol_name = <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
678 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
679 }
680
681 pub fn into_channel(self) -> fidl::Channel {
682 self.client.into_channel()
683 }
684
685 pub fn wait_for_event(
688 &self,
689 deadline: zx::MonotonicInstant,
690 ) -> Result<GainControlEvent, fidl::Error> {
691 GainControlEvent::decode(self.client.wait_for_event(deadline)?)
692 }
693
694 pub fn r#set_gain(
696 &self,
697 mut payload: &GainControlSetGainRequest,
698 ___deadline: zx::MonotonicInstant,
699 ) -> Result<GainControlSetGainResult, fidl::Error> {
700 let _response = self.client.send_query::<
701 GainControlSetGainRequest,
702 fidl::encoding::ResultType<GainControlSetGainResponse, GainError>,
703 >(
704 payload,
705 0x6ece305e4a5823dc,
706 fidl::encoding::DynamicFlags::empty(),
707 ___deadline,
708 )?;
709 Ok(_response.map(|x| x))
710 }
711
712 pub fn r#set_mute(
714 &self,
715 mut payload: &GainControlSetMuteRequest,
716 ___deadline: zx::MonotonicInstant,
717 ) -> Result<GainControlSetMuteResult, fidl::Error> {
718 let _response = self.client.send_query::<
719 GainControlSetMuteRequest,
720 fidl::encoding::ResultType<GainControlSetMuteResponse, GainError>,
721 >(
722 payload,
723 0xed03d88ce4f8965,
724 fidl::encoding::DynamicFlags::empty(),
725 ___deadline,
726 )?;
727 Ok(_response.map(|x| x))
728 }
729}
730
731#[cfg(target_os = "fuchsia")]
732impl From<GainControlSynchronousProxy> for zx::Handle {
733 fn from(value: GainControlSynchronousProxy) -> Self {
734 value.into_channel().into()
735 }
736}
737
738#[cfg(target_os = "fuchsia")]
739impl From<fidl::Channel> for GainControlSynchronousProxy {
740 fn from(value: fidl::Channel) -> Self {
741 Self::new(value)
742 }
743}
744
745#[cfg(target_os = "fuchsia")]
746impl fidl::endpoints::FromClient for GainControlSynchronousProxy {
747 type Protocol = GainControlMarker;
748
749 fn from_client(value: fidl::endpoints::ClientEnd<GainControlMarker>) -> Self {
750 Self::new(value.into_channel())
751 }
752}
753
754#[derive(Debug, Clone)]
755pub struct GainControlProxy {
756 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
757}
758
759impl fidl::endpoints::Proxy for GainControlProxy {
760 type Protocol = GainControlMarker;
761
762 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
763 Self::new(inner)
764 }
765
766 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
767 self.client.into_channel().map_err(|client| Self { client })
768 }
769
770 fn as_channel(&self) -> &::fidl::AsyncChannel {
771 self.client.as_channel()
772 }
773}
774
775impl GainControlProxy {
776 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
778 let protocol_name = <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
779 Self { client: fidl::client::Client::new(channel, protocol_name) }
780 }
781
782 pub fn take_event_stream(&self) -> GainControlEventStream {
788 GainControlEventStream { event_receiver: self.client.take_event_receiver() }
789 }
790
791 pub fn r#set_gain(
793 &self,
794 mut payload: &GainControlSetGainRequest,
795 ) -> fidl::client::QueryResponseFut<
796 GainControlSetGainResult,
797 fidl::encoding::DefaultFuchsiaResourceDialect,
798 > {
799 GainControlProxyInterface::r#set_gain(self, payload)
800 }
801
802 pub fn r#set_mute(
804 &self,
805 mut payload: &GainControlSetMuteRequest,
806 ) -> fidl::client::QueryResponseFut<
807 GainControlSetMuteResult,
808 fidl::encoding::DefaultFuchsiaResourceDialect,
809 > {
810 GainControlProxyInterface::r#set_mute(self, payload)
811 }
812}
813
814impl GainControlProxyInterface for GainControlProxy {
815 type SetGainResponseFut = fidl::client::QueryResponseFut<
816 GainControlSetGainResult,
817 fidl::encoding::DefaultFuchsiaResourceDialect,
818 >;
819 fn r#set_gain(&self, mut payload: &GainControlSetGainRequest) -> Self::SetGainResponseFut {
820 fn _decode(
821 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
822 ) -> Result<GainControlSetGainResult, fidl::Error> {
823 let _response = fidl::client::decode_transaction_body::<
824 fidl::encoding::ResultType<GainControlSetGainResponse, GainError>,
825 fidl::encoding::DefaultFuchsiaResourceDialect,
826 0x6ece305e4a5823dc,
827 >(_buf?)?;
828 Ok(_response.map(|x| x))
829 }
830 self.client.send_query_and_decode::<GainControlSetGainRequest, GainControlSetGainResult>(
831 payload,
832 0x6ece305e4a5823dc,
833 fidl::encoding::DynamicFlags::empty(),
834 _decode,
835 )
836 }
837
838 type SetMuteResponseFut = fidl::client::QueryResponseFut<
839 GainControlSetMuteResult,
840 fidl::encoding::DefaultFuchsiaResourceDialect,
841 >;
842 fn r#set_mute(&self, mut payload: &GainControlSetMuteRequest) -> Self::SetMuteResponseFut {
843 fn _decode(
844 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
845 ) -> Result<GainControlSetMuteResult, fidl::Error> {
846 let _response = fidl::client::decode_transaction_body::<
847 fidl::encoding::ResultType<GainControlSetMuteResponse, GainError>,
848 fidl::encoding::DefaultFuchsiaResourceDialect,
849 0xed03d88ce4f8965,
850 >(_buf?)?;
851 Ok(_response.map(|x| x))
852 }
853 self.client.send_query_and_decode::<GainControlSetMuteRequest, GainControlSetMuteResult>(
854 payload,
855 0xed03d88ce4f8965,
856 fidl::encoding::DynamicFlags::empty(),
857 _decode,
858 )
859 }
860}
861
862pub struct GainControlEventStream {
863 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
864}
865
866impl std::marker::Unpin for GainControlEventStream {}
867
868impl futures::stream::FusedStream for GainControlEventStream {
869 fn is_terminated(&self) -> bool {
870 self.event_receiver.is_terminated()
871 }
872}
873
874impl futures::Stream for GainControlEventStream {
875 type Item = Result<GainControlEvent, fidl::Error>;
876
877 fn poll_next(
878 mut self: std::pin::Pin<&mut Self>,
879 cx: &mut std::task::Context<'_>,
880 ) -> std::task::Poll<Option<Self::Item>> {
881 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
882 &mut self.event_receiver,
883 cx
884 )?) {
885 Some(buf) => std::task::Poll::Ready(Some(GainControlEvent::decode(buf))),
886 None => std::task::Poll::Ready(None),
887 }
888 }
889}
890
891#[derive(Debug)]
892pub enum GainControlEvent {}
893
894impl GainControlEvent {
895 fn decode(
897 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
898 ) -> Result<GainControlEvent, fidl::Error> {
899 let (bytes, _handles) = buf.split_mut();
900 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
901 debug_assert_eq!(tx_header.tx_id, 0);
902 match tx_header.ordinal {
903 _ => Err(fidl::Error::UnknownOrdinal {
904 ordinal: tx_header.ordinal,
905 protocol_name: <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
906 }),
907 }
908 }
909}
910
911pub struct GainControlRequestStream {
913 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
914 is_terminated: bool,
915}
916
917impl std::marker::Unpin for GainControlRequestStream {}
918
919impl futures::stream::FusedStream for GainControlRequestStream {
920 fn is_terminated(&self) -> bool {
921 self.is_terminated
922 }
923}
924
925impl fidl::endpoints::RequestStream for GainControlRequestStream {
926 type Protocol = GainControlMarker;
927 type ControlHandle = GainControlControlHandle;
928
929 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
930 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
931 }
932
933 fn control_handle(&self) -> Self::ControlHandle {
934 GainControlControlHandle { inner: self.inner.clone() }
935 }
936
937 fn into_inner(
938 self,
939 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
940 {
941 (self.inner, self.is_terminated)
942 }
943
944 fn from_inner(
945 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
946 is_terminated: bool,
947 ) -> Self {
948 Self { inner, is_terminated }
949 }
950}
951
952impl futures::Stream for GainControlRequestStream {
953 type Item = Result<GainControlRequest, fidl::Error>;
954
955 fn poll_next(
956 mut self: std::pin::Pin<&mut Self>,
957 cx: &mut std::task::Context<'_>,
958 ) -> std::task::Poll<Option<Self::Item>> {
959 let this = &mut *self;
960 if this.inner.check_shutdown(cx) {
961 this.is_terminated = true;
962 return std::task::Poll::Ready(None);
963 }
964 if this.is_terminated {
965 panic!("polled GainControlRequestStream after completion");
966 }
967 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
968 |bytes, handles| {
969 match this.inner.channel().read_etc(cx, bytes, handles) {
970 std::task::Poll::Ready(Ok(())) => {}
971 std::task::Poll::Pending => return std::task::Poll::Pending,
972 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
973 this.is_terminated = true;
974 return std::task::Poll::Ready(None);
975 }
976 std::task::Poll::Ready(Err(e)) => {
977 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
978 e.into(),
979 ))))
980 }
981 }
982
983 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
985
986 std::task::Poll::Ready(Some(match header.ordinal {
987 0x6ece305e4a5823dc => {
988 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
989 let mut req = fidl::new_empty!(
990 GainControlSetGainRequest,
991 fidl::encoding::DefaultFuchsiaResourceDialect
992 );
993 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GainControlSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
994 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
995 Ok(GainControlRequest::SetGain {
996 payload: req,
997 responder: GainControlSetGainResponder {
998 control_handle: std::mem::ManuallyDrop::new(control_handle),
999 tx_id: header.tx_id,
1000 },
1001 })
1002 }
1003 0xed03d88ce4f8965 => {
1004 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1005 let mut req = fidl::new_empty!(
1006 GainControlSetMuteRequest,
1007 fidl::encoding::DefaultFuchsiaResourceDialect
1008 );
1009 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GainControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
1010 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
1011 Ok(GainControlRequest::SetMute {
1012 payload: req,
1013 responder: GainControlSetMuteResponder {
1014 control_handle: std::mem::ManuallyDrop::new(control_handle),
1015 tx_id: header.tx_id,
1016 },
1017 })
1018 }
1019 _ => Err(fidl::Error::UnknownOrdinal {
1020 ordinal: header.ordinal,
1021 protocol_name:
1022 <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1023 }),
1024 }))
1025 },
1026 )
1027 }
1028}
1029
1030#[derive(Debug)]
1060pub enum GainControlRequest {
1061 SetGain { payload: GainControlSetGainRequest, responder: GainControlSetGainResponder },
1063 SetMute { payload: GainControlSetMuteRequest, responder: GainControlSetMuteResponder },
1065}
1066
1067impl GainControlRequest {
1068 #[allow(irrefutable_let_patterns)]
1069 pub fn into_set_gain(self) -> Option<(GainControlSetGainRequest, GainControlSetGainResponder)> {
1070 if let GainControlRequest::SetGain { payload, responder } = self {
1071 Some((payload, responder))
1072 } else {
1073 None
1074 }
1075 }
1076
1077 #[allow(irrefutable_let_patterns)]
1078 pub fn into_set_mute(self) -> Option<(GainControlSetMuteRequest, GainControlSetMuteResponder)> {
1079 if let GainControlRequest::SetMute { payload, responder } = self {
1080 Some((payload, responder))
1081 } else {
1082 None
1083 }
1084 }
1085
1086 pub fn method_name(&self) -> &'static str {
1088 match *self {
1089 GainControlRequest::SetGain { .. } => "set_gain",
1090 GainControlRequest::SetMute { .. } => "set_mute",
1091 }
1092 }
1093}
1094
1095#[derive(Debug, Clone)]
1096pub struct GainControlControlHandle {
1097 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1098}
1099
1100impl fidl::endpoints::ControlHandle for GainControlControlHandle {
1101 fn shutdown(&self) {
1102 self.inner.shutdown()
1103 }
1104 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1105 self.inner.shutdown_with_epitaph(status)
1106 }
1107
1108 fn is_closed(&self) -> bool {
1109 self.inner.channel().is_closed()
1110 }
1111 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1112 self.inner.channel().on_closed()
1113 }
1114
1115 #[cfg(target_os = "fuchsia")]
1116 fn signal_peer(
1117 &self,
1118 clear_mask: zx::Signals,
1119 set_mask: zx::Signals,
1120 ) -> Result<(), zx_status::Status> {
1121 use fidl::Peered;
1122 self.inner.channel().signal_peer(clear_mask, set_mask)
1123 }
1124}
1125
1126impl GainControlControlHandle {}
1127
1128#[must_use = "FIDL methods require a response to be sent"]
1129#[derive(Debug)]
1130pub struct GainControlSetGainResponder {
1131 control_handle: std::mem::ManuallyDrop<GainControlControlHandle>,
1132 tx_id: u32,
1133}
1134
1135impl std::ops::Drop for GainControlSetGainResponder {
1139 fn drop(&mut self) {
1140 self.control_handle.shutdown();
1141 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1143 }
1144}
1145
1146impl fidl::endpoints::Responder for GainControlSetGainResponder {
1147 type ControlHandle = GainControlControlHandle;
1148
1149 fn control_handle(&self) -> &GainControlControlHandle {
1150 &self.control_handle
1151 }
1152
1153 fn drop_without_shutdown(mut self) {
1154 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1156 std::mem::forget(self);
1158 }
1159}
1160
1161impl GainControlSetGainResponder {
1162 pub fn send(
1166 self,
1167 mut result: Result<&GainControlSetGainResponse, GainError>,
1168 ) -> Result<(), fidl::Error> {
1169 let _result = self.send_raw(result);
1170 if _result.is_err() {
1171 self.control_handle.shutdown();
1172 }
1173 self.drop_without_shutdown();
1174 _result
1175 }
1176
1177 pub fn send_no_shutdown_on_err(
1179 self,
1180 mut result: Result<&GainControlSetGainResponse, GainError>,
1181 ) -> Result<(), fidl::Error> {
1182 let _result = self.send_raw(result);
1183 self.drop_without_shutdown();
1184 _result
1185 }
1186
1187 fn send_raw(
1188 &self,
1189 mut result: Result<&GainControlSetGainResponse, GainError>,
1190 ) -> Result<(), fidl::Error> {
1191 self.control_handle
1192 .inner
1193 .send::<fidl::encoding::ResultType<GainControlSetGainResponse, GainError>>(
1194 result,
1195 self.tx_id,
1196 0x6ece305e4a5823dc,
1197 fidl::encoding::DynamicFlags::empty(),
1198 )
1199 }
1200}
1201
1202#[must_use = "FIDL methods require a response to be sent"]
1203#[derive(Debug)]
1204pub struct GainControlSetMuteResponder {
1205 control_handle: std::mem::ManuallyDrop<GainControlControlHandle>,
1206 tx_id: u32,
1207}
1208
1209impl std::ops::Drop for GainControlSetMuteResponder {
1213 fn drop(&mut self) {
1214 self.control_handle.shutdown();
1215 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1217 }
1218}
1219
1220impl fidl::endpoints::Responder for GainControlSetMuteResponder {
1221 type ControlHandle = GainControlControlHandle;
1222
1223 fn control_handle(&self) -> &GainControlControlHandle {
1224 &self.control_handle
1225 }
1226
1227 fn drop_without_shutdown(mut self) {
1228 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1230 std::mem::forget(self);
1232 }
1233}
1234
1235impl GainControlSetMuteResponder {
1236 pub fn send(
1240 self,
1241 mut result: Result<&GainControlSetMuteResponse, GainError>,
1242 ) -> Result<(), fidl::Error> {
1243 let _result = self.send_raw(result);
1244 if _result.is_err() {
1245 self.control_handle.shutdown();
1246 }
1247 self.drop_without_shutdown();
1248 _result
1249 }
1250
1251 pub fn send_no_shutdown_on_err(
1253 self,
1254 mut result: Result<&GainControlSetMuteResponse, GainError>,
1255 ) -> Result<(), fidl::Error> {
1256 let _result = self.send_raw(result);
1257 self.drop_without_shutdown();
1258 _result
1259 }
1260
1261 fn send_raw(
1262 &self,
1263 mut result: Result<&GainControlSetMuteResponse, GainError>,
1264 ) -> Result<(), fidl::Error> {
1265 self.control_handle
1266 .inner
1267 .send::<fidl::encoding::ResultType<GainControlSetMuteResponse, GainError>>(
1268 result,
1269 self.tx_id,
1270 0xed03d88ce4f8965,
1271 fidl::encoding::DynamicFlags::empty(),
1272 )
1273 }
1274}
1275
1276#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1277pub struct StreamSinkMarker;
1278
1279impl fidl::endpoints::ProtocolMarker for StreamSinkMarker {
1280 type Proxy = StreamSinkProxy;
1281 type RequestStream = StreamSinkRequestStream;
1282 #[cfg(target_os = "fuchsia")]
1283 type SynchronousProxy = StreamSinkSynchronousProxy;
1284
1285 const DEBUG_NAME: &'static str = "(anonymous) StreamSink";
1286}
1287
1288pub trait StreamSinkProxyInterface: Send + Sync {
1289 fn r#put_packet(&self, payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error>;
1290 fn r#start_segment(&self, payload: &StreamSinkStartSegmentRequest) -> Result<(), fidl::Error>;
1291 fn r#end(&self) -> Result<(), fidl::Error>;
1292 fn r#will_close(&self, payload: &StreamSinkWillCloseRequest) -> Result<(), fidl::Error>;
1293}
1294#[derive(Debug)]
1295#[cfg(target_os = "fuchsia")]
1296pub struct StreamSinkSynchronousProxy {
1297 client: fidl::client::sync::Client,
1298}
1299
1300#[cfg(target_os = "fuchsia")]
1301impl fidl::endpoints::SynchronousProxy for StreamSinkSynchronousProxy {
1302 type Proxy = StreamSinkProxy;
1303 type Protocol = StreamSinkMarker;
1304
1305 fn from_channel(inner: fidl::Channel) -> Self {
1306 Self::new(inner)
1307 }
1308
1309 fn into_channel(self) -> fidl::Channel {
1310 self.client.into_channel()
1311 }
1312
1313 fn as_channel(&self) -> &fidl::Channel {
1314 self.client.as_channel()
1315 }
1316}
1317
1318#[cfg(target_os = "fuchsia")]
1319impl StreamSinkSynchronousProxy {
1320 pub fn new(channel: fidl::Channel) -> Self {
1321 let protocol_name = <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1322 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1323 }
1324
1325 pub fn into_channel(self) -> fidl::Channel {
1326 self.client.into_channel()
1327 }
1328
1329 pub fn wait_for_event(
1332 &self,
1333 deadline: zx::MonotonicInstant,
1334 ) -> Result<StreamSinkEvent, fidl::Error> {
1335 StreamSinkEvent::decode(self.client.wait_for_event(deadline)?)
1336 }
1337
1338 pub fn r#put_packet(&self, mut payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error> {
1340 self.client.send::<StreamSinkPutPacketRequest>(
1341 &mut payload,
1342 0x558d757afd726899,
1343 fidl::encoding::DynamicFlags::empty(),
1344 )
1345 }
1346
1347 pub fn r#start_segment(
1350 &self,
1351 mut payload: &StreamSinkStartSegmentRequest,
1352 ) -> Result<(), fidl::Error> {
1353 self.client.send::<StreamSinkStartSegmentRequest>(
1354 payload,
1355 0x6dd9bc66aa9f715f,
1356 fidl::encoding::DynamicFlags::empty(),
1357 )
1358 }
1359
1360 pub fn r#end(&self) -> Result<(), fidl::Error> {
1366 self.client.send::<fidl::encoding::EmptyPayload>(
1367 (),
1368 0x1a3a528e83b32f6e,
1369 fidl::encoding::DynamicFlags::empty(),
1370 )
1371 }
1372
1373 pub fn r#will_close(
1377 &self,
1378 mut payload: &StreamSinkWillCloseRequest,
1379 ) -> Result<(), fidl::Error> {
1380 self.client.send::<StreamSinkWillCloseRequest>(
1381 payload,
1382 0x6303ee33dbb0fd11,
1383 fidl::encoding::DynamicFlags::empty(),
1384 )
1385 }
1386}
1387
1388#[cfg(target_os = "fuchsia")]
1389impl From<StreamSinkSynchronousProxy> for zx::Handle {
1390 fn from(value: StreamSinkSynchronousProxy) -> Self {
1391 value.into_channel().into()
1392 }
1393}
1394
1395#[cfg(target_os = "fuchsia")]
1396impl From<fidl::Channel> for StreamSinkSynchronousProxy {
1397 fn from(value: fidl::Channel) -> Self {
1398 Self::new(value)
1399 }
1400}
1401
1402#[cfg(target_os = "fuchsia")]
1403impl fidl::endpoints::FromClient for StreamSinkSynchronousProxy {
1404 type Protocol = StreamSinkMarker;
1405
1406 fn from_client(value: fidl::endpoints::ClientEnd<StreamSinkMarker>) -> Self {
1407 Self::new(value.into_channel())
1408 }
1409}
1410
1411#[derive(Debug, Clone)]
1412pub struct StreamSinkProxy {
1413 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1414}
1415
1416impl fidl::endpoints::Proxy for StreamSinkProxy {
1417 type Protocol = StreamSinkMarker;
1418
1419 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1420 Self::new(inner)
1421 }
1422
1423 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1424 self.client.into_channel().map_err(|client| Self { client })
1425 }
1426
1427 fn as_channel(&self) -> &::fidl::AsyncChannel {
1428 self.client.as_channel()
1429 }
1430}
1431
1432impl StreamSinkProxy {
1433 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1435 let protocol_name = <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1436 Self { client: fidl::client::Client::new(channel, protocol_name) }
1437 }
1438
1439 pub fn take_event_stream(&self) -> StreamSinkEventStream {
1445 StreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
1446 }
1447
1448 pub fn r#put_packet(&self, mut payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error> {
1450 StreamSinkProxyInterface::r#put_packet(self, payload)
1451 }
1452
1453 pub fn r#start_segment(
1456 &self,
1457 mut payload: &StreamSinkStartSegmentRequest,
1458 ) -> Result<(), fidl::Error> {
1459 StreamSinkProxyInterface::r#start_segment(self, payload)
1460 }
1461
1462 pub fn r#end(&self) -> Result<(), fidl::Error> {
1468 StreamSinkProxyInterface::r#end(self)
1469 }
1470
1471 pub fn r#will_close(
1475 &self,
1476 mut payload: &StreamSinkWillCloseRequest,
1477 ) -> Result<(), fidl::Error> {
1478 StreamSinkProxyInterface::r#will_close(self, payload)
1479 }
1480}
1481
1482impl StreamSinkProxyInterface for StreamSinkProxy {
1483 fn r#put_packet(&self, mut payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error> {
1484 self.client.send::<StreamSinkPutPacketRequest>(
1485 &mut payload,
1486 0x558d757afd726899,
1487 fidl::encoding::DynamicFlags::empty(),
1488 )
1489 }
1490
1491 fn r#start_segment(
1492 &self,
1493 mut payload: &StreamSinkStartSegmentRequest,
1494 ) -> Result<(), fidl::Error> {
1495 self.client.send::<StreamSinkStartSegmentRequest>(
1496 payload,
1497 0x6dd9bc66aa9f715f,
1498 fidl::encoding::DynamicFlags::empty(),
1499 )
1500 }
1501
1502 fn r#end(&self) -> Result<(), fidl::Error> {
1503 self.client.send::<fidl::encoding::EmptyPayload>(
1504 (),
1505 0x1a3a528e83b32f6e,
1506 fidl::encoding::DynamicFlags::empty(),
1507 )
1508 }
1509
1510 fn r#will_close(&self, mut payload: &StreamSinkWillCloseRequest) -> Result<(), fidl::Error> {
1511 self.client.send::<StreamSinkWillCloseRequest>(
1512 payload,
1513 0x6303ee33dbb0fd11,
1514 fidl::encoding::DynamicFlags::empty(),
1515 )
1516 }
1517}
1518
1519pub struct StreamSinkEventStream {
1520 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1521}
1522
1523impl std::marker::Unpin for StreamSinkEventStream {}
1524
1525impl futures::stream::FusedStream for StreamSinkEventStream {
1526 fn is_terminated(&self) -> bool {
1527 self.event_receiver.is_terminated()
1528 }
1529}
1530
1531impl futures::Stream for StreamSinkEventStream {
1532 type Item = Result<StreamSinkEvent, fidl::Error>;
1533
1534 fn poll_next(
1535 mut self: std::pin::Pin<&mut Self>,
1536 cx: &mut std::task::Context<'_>,
1537 ) -> std::task::Poll<Option<Self::Item>> {
1538 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1539 &mut self.event_receiver,
1540 cx
1541 )?) {
1542 Some(buf) => std::task::Poll::Ready(Some(StreamSinkEvent::decode(buf))),
1543 None => std::task::Poll::Ready(None),
1544 }
1545 }
1546}
1547
1548#[derive(Debug)]
1549pub enum StreamSinkEvent {
1550 OnWillClose { payload: StreamSinkOnWillCloseRequest },
1551}
1552
1553impl StreamSinkEvent {
1554 #[allow(irrefutable_let_patterns)]
1555 pub fn into_on_will_close(self) -> Option<StreamSinkOnWillCloseRequest> {
1556 if let StreamSinkEvent::OnWillClose { payload } = self {
1557 Some((payload))
1558 } else {
1559 None
1560 }
1561 }
1562
1563 fn decode(
1565 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1566 ) -> Result<StreamSinkEvent, fidl::Error> {
1567 let (bytes, _handles) = buf.split_mut();
1568 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1569 debug_assert_eq!(tx_header.tx_id, 0);
1570 match tx_header.ordinal {
1571 0x77093453926bce5b => {
1572 let mut out = fidl::new_empty!(
1573 StreamSinkOnWillCloseRequest,
1574 fidl::encoding::DefaultFuchsiaResourceDialect
1575 );
1576 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkOnWillCloseRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1577 Ok((StreamSinkEvent::OnWillClose { payload: out }))
1578 }
1579 _ => Err(fidl::Error::UnknownOrdinal {
1580 ordinal: tx_header.ordinal,
1581 protocol_name: <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1582 }),
1583 }
1584 }
1585}
1586
1587pub struct StreamSinkRequestStream {
1589 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1590 is_terminated: bool,
1591}
1592
1593impl std::marker::Unpin for StreamSinkRequestStream {}
1594
1595impl futures::stream::FusedStream for StreamSinkRequestStream {
1596 fn is_terminated(&self) -> bool {
1597 self.is_terminated
1598 }
1599}
1600
1601impl fidl::endpoints::RequestStream for StreamSinkRequestStream {
1602 type Protocol = StreamSinkMarker;
1603 type ControlHandle = StreamSinkControlHandle;
1604
1605 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1606 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1607 }
1608
1609 fn control_handle(&self) -> Self::ControlHandle {
1610 StreamSinkControlHandle { inner: self.inner.clone() }
1611 }
1612
1613 fn into_inner(
1614 self,
1615 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1616 {
1617 (self.inner, self.is_terminated)
1618 }
1619
1620 fn from_inner(
1621 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1622 is_terminated: bool,
1623 ) -> Self {
1624 Self { inner, is_terminated }
1625 }
1626}
1627
1628impl futures::Stream for StreamSinkRequestStream {
1629 type Item = Result<StreamSinkRequest, fidl::Error>;
1630
1631 fn poll_next(
1632 mut self: std::pin::Pin<&mut Self>,
1633 cx: &mut std::task::Context<'_>,
1634 ) -> std::task::Poll<Option<Self::Item>> {
1635 let this = &mut *self;
1636 if this.inner.check_shutdown(cx) {
1637 this.is_terminated = true;
1638 return std::task::Poll::Ready(None);
1639 }
1640 if this.is_terminated {
1641 panic!("polled StreamSinkRequestStream after completion");
1642 }
1643 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1644 |bytes, handles| {
1645 match this.inner.channel().read_etc(cx, bytes, handles) {
1646 std::task::Poll::Ready(Ok(())) => {}
1647 std::task::Poll::Pending => return std::task::Poll::Pending,
1648 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1649 this.is_terminated = true;
1650 return std::task::Poll::Ready(None);
1651 }
1652 std::task::Poll::Ready(Err(e)) => {
1653 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1654 e.into(),
1655 ))))
1656 }
1657 }
1658
1659 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1661
1662 std::task::Poll::Ready(Some(match header.ordinal {
1663 0x558d757afd726899 => {
1664 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1665 let mut req = fidl::new_empty!(
1666 StreamSinkPutPacketRequest,
1667 fidl::encoding::DefaultFuchsiaResourceDialect
1668 );
1669 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkPutPacketRequest>(&header, _body_bytes, handles, &mut req)?;
1670 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1671 Ok(StreamSinkRequest::PutPacket { payload: req, control_handle })
1672 }
1673 0x6dd9bc66aa9f715f => {
1674 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1675 let mut req = fidl::new_empty!(
1676 StreamSinkStartSegmentRequest,
1677 fidl::encoding::DefaultFuchsiaResourceDialect
1678 );
1679 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkStartSegmentRequest>(&header, _body_bytes, handles, &mut req)?;
1680 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1681 Ok(StreamSinkRequest::StartSegment { payload: req, control_handle })
1682 }
1683 0x1a3a528e83b32f6e => {
1684 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1685 let mut req = fidl::new_empty!(
1686 fidl::encoding::EmptyPayload,
1687 fidl::encoding::DefaultFuchsiaResourceDialect
1688 );
1689 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1690 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1691 Ok(StreamSinkRequest::End { control_handle })
1692 }
1693 0x6303ee33dbb0fd11 => {
1694 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1695 let mut req = fidl::new_empty!(
1696 StreamSinkWillCloseRequest,
1697 fidl::encoding::DefaultFuchsiaResourceDialect
1698 );
1699 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkWillCloseRequest>(&header, _body_bytes, handles, &mut req)?;
1700 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1701 Ok(StreamSinkRequest::WillClose { payload: req, control_handle })
1702 }
1703 _ => Err(fidl::Error::UnknownOrdinal {
1704 ordinal: header.ordinal,
1705 protocol_name:
1706 <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1707 }),
1708 }))
1709 },
1710 )
1711 }
1712}
1713
1714#[derive(Debug)]
1717pub enum StreamSinkRequest {
1718 PutPacket { payload: StreamSinkPutPacketRequest, control_handle: StreamSinkControlHandle },
1720 StartSegment { payload: StreamSinkStartSegmentRequest, control_handle: StreamSinkControlHandle },
1723 End { control_handle: StreamSinkControlHandle },
1729 WillClose { payload: StreamSinkWillCloseRequest, control_handle: StreamSinkControlHandle },
1733}
1734
1735impl StreamSinkRequest {
1736 #[allow(irrefutable_let_patterns)]
1737 pub fn into_put_packet(self) -> Option<(StreamSinkPutPacketRequest, StreamSinkControlHandle)> {
1738 if let StreamSinkRequest::PutPacket { payload, control_handle } = self {
1739 Some((payload, control_handle))
1740 } else {
1741 None
1742 }
1743 }
1744
1745 #[allow(irrefutable_let_patterns)]
1746 pub fn into_start_segment(
1747 self,
1748 ) -> Option<(StreamSinkStartSegmentRequest, StreamSinkControlHandle)> {
1749 if let StreamSinkRequest::StartSegment { payload, control_handle } = self {
1750 Some((payload, control_handle))
1751 } else {
1752 None
1753 }
1754 }
1755
1756 #[allow(irrefutable_let_patterns)]
1757 pub fn into_end(self) -> Option<(StreamSinkControlHandle)> {
1758 if let StreamSinkRequest::End { control_handle } = self {
1759 Some((control_handle))
1760 } else {
1761 None
1762 }
1763 }
1764
1765 #[allow(irrefutable_let_patterns)]
1766 pub fn into_will_close(self) -> Option<(StreamSinkWillCloseRequest, StreamSinkControlHandle)> {
1767 if let StreamSinkRequest::WillClose { payload, control_handle } = self {
1768 Some((payload, control_handle))
1769 } else {
1770 None
1771 }
1772 }
1773
1774 pub fn method_name(&self) -> &'static str {
1776 match *self {
1777 StreamSinkRequest::PutPacket { .. } => "put_packet",
1778 StreamSinkRequest::StartSegment { .. } => "start_segment",
1779 StreamSinkRequest::End { .. } => "end",
1780 StreamSinkRequest::WillClose { .. } => "will_close",
1781 }
1782 }
1783}
1784
1785#[derive(Debug, Clone)]
1786pub struct StreamSinkControlHandle {
1787 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1788}
1789
1790impl fidl::endpoints::ControlHandle for StreamSinkControlHandle {
1791 fn shutdown(&self) {
1792 self.inner.shutdown()
1793 }
1794 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1795 self.inner.shutdown_with_epitaph(status)
1796 }
1797
1798 fn is_closed(&self) -> bool {
1799 self.inner.channel().is_closed()
1800 }
1801 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1802 self.inner.channel().on_closed()
1803 }
1804
1805 #[cfg(target_os = "fuchsia")]
1806 fn signal_peer(
1807 &self,
1808 clear_mask: zx::Signals,
1809 set_mask: zx::Signals,
1810 ) -> Result<(), zx_status::Status> {
1811 use fidl::Peered;
1812 self.inner.channel().signal_peer(clear_mask, set_mask)
1813 }
1814}
1815
1816impl StreamSinkControlHandle {
1817 pub fn send_on_will_close(
1818 &self,
1819 mut payload: &StreamSinkOnWillCloseRequest,
1820 ) -> Result<(), fidl::Error> {
1821 self.inner.send::<StreamSinkOnWillCloseRequest>(
1822 payload,
1823 0,
1824 0x77093453926bce5b,
1825 fidl::encoding::DynamicFlags::empty(),
1826 )
1827 }
1828}
1829
1830mod internal {
1831 use super::*;
1832
1833 impl RingBuffer {
1834 #[inline(always)]
1835 fn max_ordinal_present(&self) -> u64 {
1836 if let Some(_) = self.reference_clock_domain {
1837 return 6;
1838 }
1839 if let Some(_) = self.reference_clock {
1840 return 5;
1841 }
1842 if let Some(_) = self.consumer_bytes {
1843 return 4;
1844 }
1845 if let Some(_) = self.producer_bytes {
1846 return 3;
1847 }
1848 if let Some(_) = self.format {
1849 return 2;
1850 }
1851 if let Some(_) = self.buffer {
1852 return 1;
1853 }
1854 0
1855 }
1856 }
1857
1858 impl fidl::encoding::ResourceTypeMarker for RingBuffer {
1859 type Borrowed<'a> = &'a mut Self;
1860 fn take_or_borrow<'a>(
1861 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1862 ) -> Self::Borrowed<'a> {
1863 value
1864 }
1865 }
1866
1867 unsafe impl fidl::encoding::TypeMarker for RingBuffer {
1868 type Owned = Self;
1869
1870 #[inline(always)]
1871 fn inline_align(_context: fidl::encoding::Context) -> usize {
1872 8
1873 }
1874
1875 #[inline(always)]
1876 fn inline_size(_context: fidl::encoding::Context) -> usize {
1877 16
1878 }
1879 }
1880
1881 unsafe impl fidl::encoding::Encode<RingBuffer, fidl::encoding::DefaultFuchsiaResourceDialect>
1882 for &mut RingBuffer
1883 {
1884 unsafe fn encode(
1885 self,
1886 encoder: &mut fidl::encoding::Encoder<
1887 '_,
1888 fidl::encoding::DefaultFuchsiaResourceDialect,
1889 >,
1890 offset: usize,
1891 mut depth: fidl::encoding::Depth,
1892 ) -> fidl::Result<()> {
1893 encoder.debug_check_bounds::<RingBuffer>(offset);
1894 let max_ordinal: u64 = self.max_ordinal_present();
1896 encoder.write_num(max_ordinal, offset);
1897 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1898 if max_ordinal == 0 {
1900 return Ok(());
1901 }
1902 depth.increment()?;
1903 let envelope_size = 8;
1904 let bytes_len = max_ordinal as usize * envelope_size;
1905 #[allow(unused_variables)]
1906 let offset = encoder.out_of_line_offset(bytes_len);
1907 let mut _prev_end_offset: usize = 0;
1908 if 1 > max_ordinal {
1909 return Ok(());
1910 }
1911
1912 let cur_offset: usize = (1 - 1) * envelope_size;
1915
1916 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1918
1919 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
1924 self.buffer.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1925 encoder, offset + cur_offset, depth
1926 )?;
1927
1928 _prev_end_offset = cur_offset + envelope_size;
1929 if 2 > max_ordinal {
1930 return Ok(());
1931 }
1932
1933 let cur_offset: usize = (2 - 1) * envelope_size;
1936
1937 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1939
1940 fidl::encoding::encode_in_envelope_optional::<
1945 Format,
1946 fidl::encoding::DefaultFuchsiaResourceDialect,
1947 >(
1948 self.format.as_ref().map(<Format as fidl::encoding::ValueTypeMarker>::borrow),
1949 encoder,
1950 offset + cur_offset,
1951 depth,
1952 )?;
1953
1954 _prev_end_offset = cur_offset + envelope_size;
1955 if 3 > max_ordinal {
1956 return Ok(());
1957 }
1958
1959 let cur_offset: usize = (3 - 1) * envelope_size;
1962
1963 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1965
1966 fidl::encoding::encode_in_envelope_optional::<
1971 u64,
1972 fidl::encoding::DefaultFuchsiaResourceDialect,
1973 >(
1974 self.producer_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1975 encoder,
1976 offset + cur_offset,
1977 depth,
1978 )?;
1979
1980 _prev_end_offset = cur_offset + envelope_size;
1981 if 4 > max_ordinal {
1982 return Ok(());
1983 }
1984
1985 let cur_offset: usize = (4 - 1) * envelope_size;
1988
1989 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1991
1992 fidl::encoding::encode_in_envelope_optional::<
1997 u64,
1998 fidl::encoding::DefaultFuchsiaResourceDialect,
1999 >(
2000 self.consumer_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2001 encoder,
2002 offset + cur_offset,
2003 depth,
2004 )?;
2005
2006 _prev_end_offset = cur_offset + envelope_size;
2007 if 5 > max_ordinal {
2008 return Ok(());
2009 }
2010
2011 let cur_offset: usize = (5 - 1) * envelope_size;
2014
2015 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2017
2018 fidl::encoding::encode_in_envelope_optional::<
2023 fidl::encoding::HandleType<
2024 fidl::Clock,
2025 { fidl::ObjectType::CLOCK.into_raw() },
2026 2147483648,
2027 >,
2028 fidl::encoding::DefaultFuchsiaResourceDialect,
2029 >(
2030 self.reference_clock.as_mut().map(
2031 <fidl::encoding::HandleType<
2032 fidl::Clock,
2033 { fidl::ObjectType::CLOCK.into_raw() },
2034 2147483648,
2035 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2036 ),
2037 encoder,
2038 offset + cur_offset,
2039 depth,
2040 )?;
2041
2042 _prev_end_offset = cur_offset + envelope_size;
2043 if 6 > max_ordinal {
2044 return Ok(());
2045 }
2046
2047 let cur_offset: usize = (6 - 1) * envelope_size;
2050
2051 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2053
2054 fidl::encoding::encode_in_envelope_optional::<
2059 u32,
2060 fidl::encoding::DefaultFuchsiaResourceDialect,
2061 >(
2062 self.reference_clock_domain
2063 .as_ref()
2064 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2065 encoder,
2066 offset + cur_offset,
2067 depth,
2068 )?;
2069
2070 _prev_end_offset = cur_offset + envelope_size;
2071
2072 Ok(())
2073 }
2074 }
2075
2076 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RingBuffer {
2077 #[inline(always)]
2078 fn new_empty() -> Self {
2079 Self::default()
2080 }
2081
2082 unsafe fn decode(
2083 &mut self,
2084 decoder: &mut fidl::encoding::Decoder<
2085 '_,
2086 fidl::encoding::DefaultFuchsiaResourceDialect,
2087 >,
2088 offset: usize,
2089 mut depth: fidl::encoding::Depth,
2090 ) -> fidl::Result<()> {
2091 decoder.debug_check_bounds::<Self>(offset);
2092 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2093 None => return Err(fidl::Error::NotNullable),
2094 Some(len) => len,
2095 };
2096 if len == 0 {
2098 return Ok(());
2099 };
2100 depth.increment()?;
2101 let envelope_size = 8;
2102 let bytes_len = len * envelope_size;
2103 let offset = decoder.out_of_line_offset(bytes_len)?;
2104 let mut _next_ordinal_to_read = 0;
2106 let mut next_offset = offset;
2107 let end_offset = offset + bytes_len;
2108 _next_ordinal_to_read += 1;
2109 if next_offset >= end_offset {
2110 return Ok(());
2111 }
2112
2113 while _next_ordinal_to_read < 1 {
2115 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2116 _next_ordinal_to_read += 1;
2117 next_offset += envelope_size;
2118 }
2119
2120 let next_out_of_line = decoder.next_out_of_line();
2121 let handles_before = decoder.remaining_handles();
2122 if let Some((inlined, num_bytes, num_handles)) =
2123 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2124 {
2125 let member_inline_size =
2126 <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
2127 decoder.context,
2128 );
2129 if inlined != (member_inline_size <= 4) {
2130 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2131 }
2132 let inner_offset;
2133 let mut inner_depth = depth.clone();
2134 if inlined {
2135 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2136 inner_offset = next_offset;
2137 } else {
2138 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2139 inner_depth.increment()?;
2140 }
2141 let val_ref = self.buffer.get_or_insert_with(|| {
2142 fidl::new_empty!(
2143 fidl_fuchsia_mem::Buffer,
2144 fidl::encoding::DefaultFuchsiaResourceDialect
2145 )
2146 });
2147 fidl::decode!(
2148 fidl_fuchsia_mem::Buffer,
2149 fidl::encoding::DefaultFuchsiaResourceDialect,
2150 val_ref,
2151 decoder,
2152 inner_offset,
2153 inner_depth
2154 )?;
2155 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2156 {
2157 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2158 }
2159 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2160 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2161 }
2162 }
2163
2164 next_offset += envelope_size;
2165 _next_ordinal_to_read += 1;
2166 if next_offset >= end_offset {
2167 return Ok(());
2168 }
2169
2170 while _next_ordinal_to_read < 2 {
2172 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2173 _next_ordinal_to_read += 1;
2174 next_offset += envelope_size;
2175 }
2176
2177 let next_out_of_line = decoder.next_out_of_line();
2178 let handles_before = decoder.remaining_handles();
2179 if let Some((inlined, num_bytes, num_handles)) =
2180 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2181 {
2182 let member_inline_size =
2183 <Format as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2184 if inlined != (member_inline_size <= 4) {
2185 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2186 }
2187 let inner_offset;
2188 let mut inner_depth = depth.clone();
2189 if inlined {
2190 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2191 inner_offset = next_offset;
2192 } else {
2193 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2194 inner_depth.increment()?;
2195 }
2196 let val_ref = self.format.get_or_insert_with(|| {
2197 fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect)
2198 });
2199 fidl::decode!(
2200 Format,
2201 fidl::encoding::DefaultFuchsiaResourceDialect,
2202 val_ref,
2203 decoder,
2204 inner_offset,
2205 inner_depth
2206 )?;
2207 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2208 {
2209 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2210 }
2211 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2212 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2213 }
2214 }
2215
2216 next_offset += envelope_size;
2217 _next_ordinal_to_read += 1;
2218 if next_offset >= end_offset {
2219 return Ok(());
2220 }
2221
2222 while _next_ordinal_to_read < 3 {
2224 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2225 _next_ordinal_to_read += 1;
2226 next_offset += envelope_size;
2227 }
2228
2229 let next_out_of_line = decoder.next_out_of_line();
2230 let handles_before = decoder.remaining_handles();
2231 if let Some((inlined, num_bytes, num_handles)) =
2232 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2233 {
2234 let member_inline_size =
2235 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2236 if inlined != (member_inline_size <= 4) {
2237 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2238 }
2239 let inner_offset;
2240 let mut inner_depth = depth.clone();
2241 if inlined {
2242 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2243 inner_offset = next_offset;
2244 } else {
2245 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2246 inner_depth.increment()?;
2247 }
2248 let val_ref = self.producer_bytes.get_or_insert_with(|| {
2249 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
2250 });
2251 fidl::decode!(
2252 u64,
2253 fidl::encoding::DefaultFuchsiaResourceDialect,
2254 val_ref,
2255 decoder,
2256 inner_offset,
2257 inner_depth
2258 )?;
2259 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2260 {
2261 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2262 }
2263 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2264 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2265 }
2266 }
2267
2268 next_offset += envelope_size;
2269 _next_ordinal_to_read += 1;
2270 if next_offset >= end_offset {
2271 return Ok(());
2272 }
2273
2274 while _next_ordinal_to_read < 4 {
2276 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2277 _next_ordinal_to_read += 1;
2278 next_offset += envelope_size;
2279 }
2280
2281 let next_out_of_line = decoder.next_out_of_line();
2282 let handles_before = decoder.remaining_handles();
2283 if let Some((inlined, num_bytes, num_handles)) =
2284 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2285 {
2286 let member_inline_size =
2287 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2288 if inlined != (member_inline_size <= 4) {
2289 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2290 }
2291 let inner_offset;
2292 let mut inner_depth = depth.clone();
2293 if inlined {
2294 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2295 inner_offset = next_offset;
2296 } else {
2297 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2298 inner_depth.increment()?;
2299 }
2300 let val_ref = self.consumer_bytes.get_or_insert_with(|| {
2301 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
2302 });
2303 fidl::decode!(
2304 u64,
2305 fidl::encoding::DefaultFuchsiaResourceDialect,
2306 val_ref,
2307 decoder,
2308 inner_offset,
2309 inner_depth
2310 )?;
2311 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2312 {
2313 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2314 }
2315 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2316 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2317 }
2318 }
2319
2320 next_offset += envelope_size;
2321 _next_ordinal_to_read += 1;
2322 if next_offset >= end_offset {
2323 return Ok(());
2324 }
2325
2326 while _next_ordinal_to_read < 5 {
2328 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2329 _next_ordinal_to_read += 1;
2330 next_offset += envelope_size;
2331 }
2332
2333 let next_out_of_line = decoder.next_out_of_line();
2334 let handles_before = decoder.remaining_handles();
2335 if let Some((inlined, num_bytes, num_handles)) =
2336 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2337 {
2338 let member_inline_size = <fidl::encoding::HandleType<
2339 fidl::Clock,
2340 { fidl::ObjectType::CLOCK.into_raw() },
2341 2147483648,
2342 > as fidl::encoding::TypeMarker>::inline_size(
2343 decoder.context
2344 );
2345 if inlined != (member_inline_size <= 4) {
2346 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2347 }
2348 let inner_offset;
2349 let mut inner_depth = depth.clone();
2350 if inlined {
2351 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2352 inner_offset = next_offset;
2353 } else {
2354 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2355 inner_depth.increment()?;
2356 }
2357 let val_ref =
2358 self.reference_clock.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2359 fidl::decode!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2360 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2361 {
2362 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2363 }
2364 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2365 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2366 }
2367 }
2368
2369 next_offset += envelope_size;
2370 _next_ordinal_to_read += 1;
2371 if next_offset >= end_offset {
2372 return Ok(());
2373 }
2374
2375 while _next_ordinal_to_read < 6 {
2377 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2378 _next_ordinal_to_read += 1;
2379 next_offset += envelope_size;
2380 }
2381
2382 let next_out_of_line = decoder.next_out_of_line();
2383 let handles_before = decoder.remaining_handles();
2384 if let Some((inlined, num_bytes, num_handles)) =
2385 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2386 {
2387 let member_inline_size =
2388 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2389 if inlined != (member_inline_size <= 4) {
2390 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2391 }
2392 let inner_offset;
2393 let mut inner_depth = depth.clone();
2394 if inlined {
2395 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2396 inner_offset = next_offset;
2397 } else {
2398 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2399 inner_depth.increment()?;
2400 }
2401 let val_ref = self.reference_clock_domain.get_or_insert_with(|| {
2402 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
2403 });
2404 fidl::decode!(
2405 u32,
2406 fidl::encoding::DefaultFuchsiaResourceDialect,
2407 val_ref,
2408 decoder,
2409 inner_offset,
2410 inner_depth
2411 )?;
2412 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2413 {
2414 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2415 }
2416 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2417 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2418 }
2419 }
2420
2421 next_offset += envelope_size;
2422
2423 while next_offset < end_offset {
2425 _next_ordinal_to_read += 1;
2426 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2427 next_offset += envelope_size;
2428 }
2429
2430 Ok(())
2431 }
2432 }
2433
2434 impl StreamSinkPutPacketRequest {
2435 #[inline(always)]
2436 fn max_ordinal_present(&self) -> u64 {
2437 if let Some(_) = self.release_fence {
2438 return 2;
2439 }
2440 if let Some(_) = self.packet {
2441 return 1;
2442 }
2443 0
2444 }
2445 }
2446
2447 impl fidl::encoding::ResourceTypeMarker for StreamSinkPutPacketRequest {
2448 type Borrowed<'a> = &'a mut Self;
2449 fn take_or_borrow<'a>(
2450 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2451 ) -> Self::Borrowed<'a> {
2452 value
2453 }
2454 }
2455
2456 unsafe impl fidl::encoding::TypeMarker for StreamSinkPutPacketRequest {
2457 type Owned = Self;
2458
2459 #[inline(always)]
2460 fn inline_align(_context: fidl::encoding::Context) -> usize {
2461 8
2462 }
2463
2464 #[inline(always)]
2465 fn inline_size(_context: fidl::encoding::Context) -> usize {
2466 16
2467 }
2468 }
2469
2470 unsafe impl
2471 fidl::encoding::Encode<
2472 StreamSinkPutPacketRequest,
2473 fidl::encoding::DefaultFuchsiaResourceDialect,
2474 > for &mut StreamSinkPutPacketRequest
2475 {
2476 unsafe fn encode(
2477 self,
2478 encoder: &mut fidl::encoding::Encoder<
2479 '_,
2480 fidl::encoding::DefaultFuchsiaResourceDialect,
2481 >,
2482 offset: usize,
2483 mut depth: fidl::encoding::Depth,
2484 ) -> fidl::Result<()> {
2485 encoder.debug_check_bounds::<StreamSinkPutPacketRequest>(offset);
2486 let max_ordinal: u64 = self.max_ordinal_present();
2488 encoder.write_num(max_ordinal, offset);
2489 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2490 if max_ordinal == 0 {
2492 return Ok(());
2493 }
2494 depth.increment()?;
2495 let envelope_size = 8;
2496 let bytes_len = max_ordinal as usize * envelope_size;
2497 #[allow(unused_variables)]
2498 let offset = encoder.out_of_line_offset(bytes_len);
2499 let mut _prev_end_offset: usize = 0;
2500 if 1 > max_ordinal {
2501 return Ok(());
2502 }
2503
2504 let cur_offset: usize = (1 - 1) * envelope_size;
2507
2508 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2510
2511 fidl::encoding::encode_in_envelope_optional::<
2516 Packet,
2517 fidl::encoding::DefaultFuchsiaResourceDialect,
2518 >(
2519 self.packet.as_ref().map(<Packet as fidl::encoding::ValueTypeMarker>::borrow),
2520 encoder,
2521 offset + cur_offset,
2522 depth,
2523 )?;
2524
2525 _prev_end_offset = cur_offset + envelope_size;
2526 if 2 > max_ordinal {
2527 return Ok(());
2528 }
2529
2530 let cur_offset: usize = (2 - 1) * envelope_size;
2533
2534 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2536
2537 fidl::encoding::encode_in_envelope_optional::<
2542 fidl::encoding::HandleType<
2543 fidl::EventPair,
2544 { fidl::ObjectType::EVENTPAIR.into_raw() },
2545 2147483648,
2546 >,
2547 fidl::encoding::DefaultFuchsiaResourceDialect,
2548 >(
2549 self.release_fence.as_mut().map(
2550 <fidl::encoding::HandleType<
2551 fidl::EventPair,
2552 { fidl::ObjectType::EVENTPAIR.into_raw() },
2553 2147483648,
2554 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2555 ),
2556 encoder,
2557 offset + cur_offset,
2558 depth,
2559 )?;
2560
2561 _prev_end_offset = cur_offset + envelope_size;
2562
2563 Ok(())
2564 }
2565 }
2566
2567 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2568 for StreamSinkPutPacketRequest
2569 {
2570 #[inline(always)]
2571 fn new_empty() -> Self {
2572 Self::default()
2573 }
2574
2575 unsafe fn decode(
2576 &mut self,
2577 decoder: &mut fidl::encoding::Decoder<
2578 '_,
2579 fidl::encoding::DefaultFuchsiaResourceDialect,
2580 >,
2581 offset: usize,
2582 mut depth: fidl::encoding::Depth,
2583 ) -> fidl::Result<()> {
2584 decoder.debug_check_bounds::<Self>(offset);
2585 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2586 None => return Err(fidl::Error::NotNullable),
2587 Some(len) => len,
2588 };
2589 if len == 0 {
2591 return Ok(());
2592 };
2593 depth.increment()?;
2594 let envelope_size = 8;
2595 let bytes_len = len * envelope_size;
2596 let offset = decoder.out_of_line_offset(bytes_len)?;
2597 let mut _next_ordinal_to_read = 0;
2599 let mut next_offset = offset;
2600 let end_offset = offset + bytes_len;
2601 _next_ordinal_to_read += 1;
2602 if next_offset >= end_offset {
2603 return Ok(());
2604 }
2605
2606 while _next_ordinal_to_read < 1 {
2608 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2609 _next_ordinal_to_read += 1;
2610 next_offset += envelope_size;
2611 }
2612
2613 let next_out_of_line = decoder.next_out_of_line();
2614 let handles_before = decoder.remaining_handles();
2615 if let Some((inlined, num_bytes, num_handles)) =
2616 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2617 {
2618 let member_inline_size =
2619 <Packet as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2620 if inlined != (member_inline_size <= 4) {
2621 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2622 }
2623 let inner_offset;
2624 let mut inner_depth = depth.clone();
2625 if inlined {
2626 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2627 inner_offset = next_offset;
2628 } else {
2629 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2630 inner_depth.increment()?;
2631 }
2632 let val_ref = self.packet.get_or_insert_with(|| {
2633 fidl::new_empty!(Packet, fidl::encoding::DefaultFuchsiaResourceDialect)
2634 });
2635 fidl::decode!(
2636 Packet,
2637 fidl::encoding::DefaultFuchsiaResourceDialect,
2638 val_ref,
2639 decoder,
2640 inner_offset,
2641 inner_depth
2642 )?;
2643 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2644 {
2645 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2646 }
2647 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2648 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2649 }
2650 }
2651
2652 next_offset += envelope_size;
2653 _next_ordinal_to_read += 1;
2654 if next_offset >= end_offset {
2655 return Ok(());
2656 }
2657
2658 while _next_ordinal_to_read < 2 {
2660 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2661 _next_ordinal_to_read += 1;
2662 next_offset += envelope_size;
2663 }
2664
2665 let next_out_of_line = decoder.next_out_of_line();
2666 let handles_before = decoder.remaining_handles();
2667 if let Some((inlined, num_bytes, num_handles)) =
2668 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2669 {
2670 let member_inline_size = <fidl::encoding::HandleType<
2671 fidl::EventPair,
2672 { fidl::ObjectType::EVENTPAIR.into_raw() },
2673 2147483648,
2674 > as fidl::encoding::TypeMarker>::inline_size(
2675 decoder.context
2676 );
2677 if inlined != (member_inline_size <= 4) {
2678 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2679 }
2680 let inner_offset;
2681 let mut inner_depth = depth.clone();
2682 if inlined {
2683 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2684 inner_offset = next_offset;
2685 } else {
2686 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2687 inner_depth.increment()?;
2688 }
2689 let val_ref =
2690 self.release_fence.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2691 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2692 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2693 {
2694 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2695 }
2696 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2697 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2698 }
2699 }
2700
2701 next_offset += envelope_size;
2702
2703 while next_offset < end_offset {
2705 _next_ordinal_to_read += 1;
2706 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2707 next_offset += envelope_size;
2708 }
2709
2710 Ok(())
2711 }
2712 }
2713}