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