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::NullableHandle {
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
537 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
538 self.inner.shutdown_with_epitaph(status)
539 }
540
541 fn is_closed(&self) -> bool {
542 self.inner.channel().is_closed()
543 }
544 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
545 self.inner.channel().on_closed()
546 }
547
548 #[cfg(target_os = "fuchsia")]
549 fn signal_peer(
550 &self,
551 clear_mask: zx::Signals,
552 set_mask: zx::Signals,
553 ) -> Result<(), zx_status::Status> {
554 use fidl::Peered;
555 self.inner.channel().signal_peer(clear_mask, set_mask)
556 }
557}
558
559impl DelayWatcherControlHandle {}
560
561#[must_use = "FIDL methods require a response to be sent"]
562#[derive(Debug)]
563pub struct DelayWatcherWatchDelayResponder {
564 control_handle: std::mem::ManuallyDrop<DelayWatcherControlHandle>,
565 tx_id: u32,
566}
567
568impl std::ops::Drop for DelayWatcherWatchDelayResponder {
572 fn drop(&mut self) {
573 self.control_handle.shutdown();
574 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
576 }
577}
578
579impl fidl::endpoints::Responder for DelayWatcherWatchDelayResponder {
580 type ControlHandle = DelayWatcherControlHandle;
581
582 fn control_handle(&self) -> &DelayWatcherControlHandle {
583 &self.control_handle
584 }
585
586 fn drop_without_shutdown(mut self) {
587 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
589 std::mem::forget(self);
591 }
592}
593
594impl DelayWatcherWatchDelayResponder {
595 pub fn send(self, mut payload: &DelayWatcherWatchDelayResponse) -> Result<(), fidl::Error> {
599 let _result = self.send_raw(payload);
600 if _result.is_err() {
601 self.control_handle.shutdown();
602 }
603 self.drop_without_shutdown();
604 _result
605 }
606
607 pub fn send_no_shutdown_on_err(
609 self,
610 mut payload: &DelayWatcherWatchDelayResponse,
611 ) -> Result<(), fidl::Error> {
612 let _result = self.send_raw(payload);
613 self.drop_without_shutdown();
614 _result
615 }
616
617 fn send_raw(&self, mut payload: &DelayWatcherWatchDelayResponse) -> Result<(), fidl::Error> {
618 self.control_handle.inner.send::<DelayWatcherWatchDelayResponse>(
619 payload,
620 self.tx_id,
621 0x3a90c91ee2f1644c,
622 fidl::encoding::DynamicFlags::empty(),
623 )
624 }
625}
626
627#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
628pub struct GainControlMarker;
629
630impl fidl::endpoints::ProtocolMarker for GainControlMarker {
631 type Proxy = GainControlProxy;
632 type RequestStream = GainControlRequestStream;
633 #[cfg(target_os = "fuchsia")]
634 type SynchronousProxy = GainControlSynchronousProxy;
635
636 const DEBUG_NAME: &'static str = "(anonymous) GainControl";
637}
638pub type GainControlSetGainResult = Result<GainControlSetGainResponse, GainError>;
639pub type GainControlSetMuteResult = Result<GainControlSetMuteResponse, GainError>;
640
641pub trait GainControlProxyInterface: Send + Sync {
642 type SetGainResponseFut: std::future::Future<Output = Result<GainControlSetGainResult, fidl::Error>>
643 + Send;
644 fn r#set_gain(&self, payload: &GainControlSetGainRequest) -> Self::SetGainResponseFut;
645 type SetMuteResponseFut: std::future::Future<Output = Result<GainControlSetMuteResult, fidl::Error>>
646 + Send;
647 fn r#set_mute(&self, payload: &GainControlSetMuteRequest) -> Self::SetMuteResponseFut;
648}
649#[derive(Debug)]
650#[cfg(target_os = "fuchsia")]
651pub struct GainControlSynchronousProxy {
652 client: fidl::client::sync::Client,
653}
654
655#[cfg(target_os = "fuchsia")]
656impl fidl::endpoints::SynchronousProxy for GainControlSynchronousProxy {
657 type Proxy = GainControlProxy;
658 type Protocol = GainControlMarker;
659
660 fn from_channel(inner: fidl::Channel) -> Self {
661 Self::new(inner)
662 }
663
664 fn into_channel(self) -> fidl::Channel {
665 self.client.into_channel()
666 }
667
668 fn as_channel(&self) -> &fidl::Channel {
669 self.client.as_channel()
670 }
671}
672
673#[cfg(target_os = "fuchsia")]
674impl GainControlSynchronousProxy {
675 pub fn new(channel: fidl::Channel) -> Self {
676 let protocol_name = <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
677 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
678 }
679
680 pub fn into_channel(self) -> fidl::Channel {
681 self.client.into_channel()
682 }
683
684 pub fn wait_for_event(
687 &self,
688 deadline: zx::MonotonicInstant,
689 ) -> Result<GainControlEvent, fidl::Error> {
690 GainControlEvent::decode(self.client.wait_for_event(deadline)?)
691 }
692
693 pub fn r#set_gain(
695 &self,
696 mut payload: &GainControlSetGainRequest,
697 ___deadline: zx::MonotonicInstant,
698 ) -> Result<GainControlSetGainResult, fidl::Error> {
699 let _response = self.client.send_query::<
700 GainControlSetGainRequest,
701 fidl::encoding::ResultType<GainControlSetGainResponse, GainError>,
702 >(
703 payload,
704 0x6ece305e4a5823dc,
705 fidl::encoding::DynamicFlags::empty(),
706 ___deadline,
707 )?;
708 Ok(_response.map(|x| x))
709 }
710
711 pub fn r#set_mute(
713 &self,
714 mut payload: &GainControlSetMuteRequest,
715 ___deadline: zx::MonotonicInstant,
716 ) -> Result<GainControlSetMuteResult, fidl::Error> {
717 let _response = self.client.send_query::<
718 GainControlSetMuteRequest,
719 fidl::encoding::ResultType<GainControlSetMuteResponse, GainError>,
720 >(
721 payload,
722 0xed03d88ce4f8965,
723 fidl::encoding::DynamicFlags::empty(),
724 ___deadline,
725 )?;
726 Ok(_response.map(|x| x))
727 }
728}
729
730#[cfg(target_os = "fuchsia")]
731impl From<GainControlSynchronousProxy> for zx::NullableHandle {
732 fn from(value: GainControlSynchronousProxy) -> Self {
733 value.into_channel().into()
734 }
735}
736
737#[cfg(target_os = "fuchsia")]
738impl From<fidl::Channel> for GainControlSynchronousProxy {
739 fn from(value: fidl::Channel) -> Self {
740 Self::new(value)
741 }
742}
743
744#[cfg(target_os = "fuchsia")]
745impl fidl::endpoints::FromClient for GainControlSynchronousProxy {
746 type Protocol = GainControlMarker;
747
748 fn from_client(value: fidl::endpoints::ClientEnd<GainControlMarker>) -> Self {
749 Self::new(value.into_channel())
750 }
751}
752
753#[derive(Debug, Clone)]
754pub struct GainControlProxy {
755 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
756}
757
758impl fidl::endpoints::Proxy for GainControlProxy {
759 type Protocol = GainControlMarker;
760
761 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
762 Self::new(inner)
763 }
764
765 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
766 self.client.into_channel().map_err(|client| Self { client })
767 }
768
769 fn as_channel(&self) -> &::fidl::AsyncChannel {
770 self.client.as_channel()
771 }
772}
773
774impl GainControlProxy {
775 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
777 let protocol_name = <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
778 Self { client: fidl::client::Client::new(channel, protocol_name) }
779 }
780
781 pub fn take_event_stream(&self) -> GainControlEventStream {
787 GainControlEventStream { event_receiver: self.client.take_event_receiver() }
788 }
789
790 pub fn r#set_gain(
792 &self,
793 mut payload: &GainControlSetGainRequest,
794 ) -> fidl::client::QueryResponseFut<
795 GainControlSetGainResult,
796 fidl::encoding::DefaultFuchsiaResourceDialect,
797 > {
798 GainControlProxyInterface::r#set_gain(self, payload)
799 }
800
801 pub fn r#set_mute(
803 &self,
804 mut payload: &GainControlSetMuteRequest,
805 ) -> fidl::client::QueryResponseFut<
806 GainControlSetMuteResult,
807 fidl::encoding::DefaultFuchsiaResourceDialect,
808 > {
809 GainControlProxyInterface::r#set_mute(self, payload)
810 }
811}
812
813impl GainControlProxyInterface for GainControlProxy {
814 type SetGainResponseFut = fidl::client::QueryResponseFut<
815 GainControlSetGainResult,
816 fidl::encoding::DefaultFuchsiaResourceDialect,
817 >;
818 fn r#set_gain(&self, mut payload: &GainControlSetGainRequest) -> Self::SetGainResponseFut {
819 fn _decode(
820 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
821 ) -> Result<GainControlSetGainResult, fidl::Error> {
822 let _response = fidl::client::decode_transaction_body::<
823 fidl::encoding::ResultType<GainControlSetGainResponse, GainError>,
824 fidl::encoding::DefaultFuchsiaResourceDialect,
825 0x6ece305e4a5823dc,
826 >(_buf?)?;
827 Ok(_response.map(|x| x))
828 }
829 self.client.send_query_and_decode::<GainControlSetGainRequest, GainControlSetGainResult>(
830 payload,
831 0x6ece305e4a5823dc,
832 fidl::encoding::DynamicFlags::empty(),
833 _decode,
834 )
835 }
836
837 type SetMuteResponseFut = fidl::client::QueryResponseFut<
838 GainControlSetMuteResult,
839 fidl::encoding::DefaultFuchsiaResourceDialect,
840 >;
841 fn r#set_mute(&self, mut payload: &GainControlSetMuteRequest) -> Self::SetMuteResponseFut {
842 fn _decode(
843 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
844 ) -> Result<GainControlSetMuteResult, fidl::Error> {
845 let _response = fidl::client::decode_transaction_body::<
846 fidl::encoding::ResultType<GainControlSetMuteResponse, GainError>,
847 fidl::encoding::DefaultFuchsiaResourceDialect,
848 0xed03d88ce4f8965,
849 >(_buf?)?;
850 Ok(_response.map(|x| x))
851 }
852 self.client.send_query_and_decode::<GainControlSetMuteRequest, GainControlSetMuteResult>(
853 payload,
854 0xed03d88ce4f8965,
855 fidl::encoding::DynamicFlags::empty(),
856 _decode,
857 )
858 }
859}
860
861pub struct GainControlEventStream {
862 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
863}
864
865impl std::marker::Unpin for GainControlEventStream {}
866
867impl futures::stream::FusedStream for GainControlEventStream {
868 fn is_terminated(&self) -> bool {
869 self.event_receiver.is_terminated()
870 }
871}
872
873impl futures::Stream for GainControlEventStream {
874 type Item = Result<GainControlEvent, fidl::Error>;
875
876 fn poll_next(
877 mut self: std::pin::Pin<&mut Self>,
878 cx: &mut std::task::Context<'_>,
879 ) -> std::task::Poll<Option<Self::Item>> {
880 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
881 &mut self.event_receiver,
882 cx
883 )?) {
884 Some(buf) => std::task::Poll::Ready(Some(GainControlEvent::decode(buf))),
885 None => std::task::Poll::Ready(None),
886 }
887 }
888}
889
890#[derive(Debug)]
891pub enum GainControlEvent {}
892
893impl GainControlEvent {
894 fn decode(
896 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
897 ) -> Result<GainControlEvent, fidl::Error> {
898 let (bytes, _handles) = buf.split_mut();
899 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
900 debug_assert_eq!(tx_header.tx_id, 0);
901 match tx_header.ordinal {
902 _ => Err(fidl::Error::UnknownOrdinal {
903 ordinal: tx_header.ordinal,
904 protocol_name: <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
905 }),
906 }
907 }
908}
909
910pub struct GainControlRequestStream {
912 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
913 is_terminated: bool,
914}
915
916impl std::marker::Unpin for GainControlRequestStream {}
917
918impl futures::stream::FusedStream for GainControlRequestStream {
919 fn is_terminated(&self) -> bool {
920 self.is_terminated
921 }
922}
923
924impl fidl::endpoints::RequestStream for GainControlRequestStream {
925 type Protocol = GainControlMarker;
926 type ControlHandle = GainControlControlHandle;
927
928 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
929 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
930 }
931
932 fn control_handle(&self) -> Self::ControlHandle {
933 GainControlControlHandle { inner: self.inner.clone() }
934 }
935
936 fn into_inner(
937 self,
938 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
939 {
940 (self.inner, self.is_terminated)
941 }
942
943 fn from_inner(
944 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
945 is_terminated: bool,
946 ) -> Self {
947 Self { inner, is_terminated }
948 }
949}
950
951impl futures::Stream for GainControlRequestStream {
952 type Item = Result<GainControlRequest, fidl::Error>;
953
954 fn poll_next(
955 mut self: std::pin::Pin<&mut Self>,
956 cx: &mut std::task::Context<'_>,
957 ) -> std::task::Poll<Option<Self::Item>> {
958 let this = &mut *self;
959 if this.inner.check_shutdown(cx) {
960 this.is_terminated = true;
961 return std::task::Poll::Ready(None);
962 }
963 if this.is_terminated {
964 panic!("polled GainControlRequestStream after completion");
965 }
966 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
967 |bytes, handles| {
968 match this.inner.channel().read_etc(cx, bytes, handles) {
969 std::task::Poll::Ready(Ok(())) => {}
970 std::task::Poll::Pending => return std::task::Poll::Pending,
971 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
972 this.is_terminated = true;
973 return std::task::Poll::Ready(None);
974 }
975 std::task::Poll::Ready(Err(e)) => {
976 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
977 e.into(),
978 ))));
979 }
980 }
981
982 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
984
985 std::task::Poll::Ready(Some(match header.ordinal {
986 0x6ece305e4a5823dc => {
987 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
988 let mut req = fidl::new_empty!(
989 GainControlSetGainRequest,
990 fidl::encoding::DefaultFuchsiaResourceDialect
991 );
992 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GainControlSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
993 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
994 Ok(GainControlRequest::SetGain {
995 payload: req,
996 responder: GainControlSetGainResponder {
997 control_handle: std::mem::ManuallyDrop::new(control_handle),
998 tx_id: header.tx_id,
999 },
1000 })
1001 }
1002 0xed03d88ce4f8965 => {
1003 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1004 let mut req = fidl::new_empty!(
1005 GainControlSetMuteRequest,
1006 fidl::encoding::DefaultFuchsiaResourceDialect
1007 );
1008 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GainControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
1009 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
1010 Ok(GainControlRequest::SetMute {
1011 payload: req,
1012 responder: GainControlSetMuteResponder {
1013 control_handle: std::mem::ManuallyDrop::new(control_handle),
1014 tx_id: header.tx_id,
1015 },
1016 })
1017 }
1018 _ => Err(fidl::Error::UnknownOrdinal {
1019 ordinal: header.ordinal,
1020 protocol_name:
1021 <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1022 }),
1023 }))
1024 },
1025 )
1026 }
1027}
1028
1029#[derive(Debug)]
1057pub enum GainControlRequest {
1058 SetGain { payload: GainControlSetGainRequest, responder: GainControlSetGainResponder },
1060 SetMute { payload: GainControlSetMuteRequest, responder: GainControlSetMuteResponder },
1062}
1063
1064impl GainControlRequest {
1065 #[allow(irrefutable_let_patterns)]
1066 pub fn into_set_gain(self) -> Option<(GainControlSetGainRequest, GainControlSetGainResponder)> {
1067 if let GainControlRequest::SetGain { payload, responder } = self {
1068 Some((payload, responder))
1069 } else {
1070 None
1071 }
1072 }
1073
1074 #[allow(irrefutable_let_patterns)]
1075 pub fn into_set_mute(self) -> Option<(GainControlSetMuteRequest, GainControlSetMuteResponder)> {
1076 if let GainControlRequest::SetMute { payload, responder } = self {
1077 Some((payload, responder))
1078 } else {
1079 None
1080 }
1081 }
1082
1083 pub fn method_name(&self) -> &'static str {
1085 match *self {
1086 GainControlRequest::SetGain { .. } => "set_gain",
1087 GainControlRequest::SetMute { .. } => "set_mute",
1088 }
1089 }
1090}
1091
1092#[derive(Debug, Clone)]
1093pub struct GainControlControlHandle {
1094 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1095}
1096
1097impl fidl::endpoints::ControlHandle for GainControlControlHandle {
1098 fn shutdown(&self) {
1099 self.inner.shutdown()
1100 }
1101
1102 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1103 self.inner.shutdown_with_epitaph(status)
1104 }
1105
1106 fn is_closed(&self) -> bool {
1107 self.inner.channel().is_closed()
1108 }
1109 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1110 self.inner.channel().on_closed()
1111 }
1112
1113 #[cfg(target_os = "fuchsia")]
1114 fn signal_peer(
1115 &self,
1116 clear_mask: zx::Signals,
1117 set_mask: zx::Signals,
1118 ) -> Result<(), zx_status::Status> {
1119 use fidl::Peered;
1120 self.inner.channel().signal_peer(clear_mask, set_mask)
1121 }
1122}
1123
1124impl GainControlControlHandle {}
1125
1126#[must_use = "FIDL methods require a response to be sent"]
1127#[derive(Debug)]
1128pub struct GainControlSetGainResponder {
1129 control_handle: std::mem::ManuallyDrop<GainControlControlHandle>,
1130 tx_id: u32,
1131}
1132
1133impl std::ops::Drop for GainControlSetGainResponder {
1137 fn drop(&mut self) {
1138 self.control_handle.shutdown();
1139 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1141 }
1142}
1143
1144impl fidl::endpoints::Responder for GainControlSetGainResponder {
1145 type ControlHandle = GainControlControlHandle;
1146
1147 fn control_handle(&self) -> &GainControlControlHandle {
1148 &self.control_handle
1149 }
1150
1151 fn drop_without_shutdown(mut self) {
1152 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1154 std::mem::forget(self);
1156 }
1157}
1158
1159impl GainControlSetGainResponder {
1160 pub fn send(
1164 self,
1165 mut result: Result<&GainControlSetGainResponse, GainError>,
1166 ) -> Result<(), fidl::Error> {
1167 let _result = self.send_raw(result);
1168 if _result.is_err() {
1169 self.control_handle.shutdown();
1170 }
1171 self.drop_without_shutdown();
1172 _result
1173 }
1174
1175 pub fn send_no_shutdown_on_err(
1177 self,
1178 mut result: Result<&GainControlSetGainResponse, GainError>,
1179 ) -> Result<(), fidl::Error> {
1180 let _result = self.send_raw(result);
1181 self.drop_without_shutdown();
1182 _result
1183 }
1184
1185 fn send_raw(
1186 &self,
1187 mut result: Result<&GainControlSetGainResponse, GainError>,
1188 ) -> Result<(), fidl::Error> {
1189 self.control_handle
1190 .inner
1191 .send::<fidl::encoding::ResultType<GainControlSetGainResponse, GainError>>(
1192 result,
1193 self.tx_id,
1194 0x6ece305e4a5823dc,
1195 fidl::encoding::DynamicFlags::empty(),
1196 )
1197 }
1198}
1199
1200#[must_use = "FIDL methods require a response to be sent"]
1201#[derive(Debug)]
1202pub struct GainControlSetMuteResponder {
1203 control_handle: std::mem::ManuallyDrop<GainControlControlHandle>,
1204 tx_id: u32,
1205}
1206
1207impl std::ops::Drop for GainControlSetMuteResponder {
1211 fn drop(&mut self) {
1212 self.control_handle.shutdown();
1213 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1215 }
1216}
1217
1218impl fidl::endpoints::Responder for GainControlSetMuteResponder {
1219 type ControlHandle = GainControlControlHandle;
1220
1221 fn control_handle(&self) -> &GainControlControlHandle {
1222 &self.control_handle
1223 }
1224
1225 fn drop_without_shutdown(mut self) {
1226 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1228 std::mem::forget(self);
1230 }
1231}
1232
1233impl GainControlSetMuteResponder {
1234 pub fn send(
1238 self,
1239 mut result: Result<&GainControlSetMuteResponse, GainError>,
1240 ) -> Result<(), fidl::Error> {
1241 let _result = self.send_raw(result);
1242 if _result.is_err() {
1243 self.control_handle.shutdown();
1244 }
1245 self.drop_without_shutdown();
1246 _result
1247 }
1248
1249 pub fn send_no_shutdown_on_err(
1251 self,
1252 mut result: Result<&GainControlSetMuteResponse, GainError>,
1253 ) -> Result<(), fidl::Error> {
1254 let _result = self.send_raw(result);
1255 self.drop_without_shutdown();
1256 _result
1257 }
1258
1259 fn send_raw(
1260 &self,
1261 mut result: Result<&GainControlSetMuteResponse, GainError>,
1262 ) -> Result<(), fidl::Error> {
1263 self.control_handle
1264 .inner
1265 .send::<fidl::encoding::ResultType<GainControlSetMuteResponse, GainError>>(
1266 result,
1267 self.tx_id,
1268 0xed03d88ce4f8965,
1269 fidl::encoding::DynamicFlags::empty(),
1270 )
1271 }
1272}
1273
1274#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1275pub struct StreamSinkMarker;
1276
1277impl fidl::endpoints::ProtocolMarker for StreamSinkMarker {
1278 type Proxy = StreamSinkProxy;
1279 type RequestStream = StreamSinkRequestStream;
1280 #[cfg(target_os = "fuchsia")]
1281 type SynchronousProxy = StreamSinkSynchronousProxy;
1282
1283 const DEBUG_NAME: &'static str = "(anonymous) StreamSink";
1284}
1285
1286pub trait StreamSinkProxyInterface: Send + Sync {
1287 fn r#put_packet(&self, payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error>;
1288 fn r#start_segment(&self, payload: &StreamSinkStartSegmentRequest) -> Result<(), fidl::Error>;
1289 fn r#end(&self) -> Result<(), fidl::Error>;
1290 fn r#will_close(&self, payload: &StreamSinkWillCloseRequest) -> Result<(), fidl::Error>;
1291}
1292#[derive(Debug)]
1293#[cfg(target_os = "fuchsia")]
1294pub struct StreamSinkSynchronousProxy {
1295 client: fidl::client::sync::Client,
1296}
1297
1298#[cfg(target_os = "fuchsia")]
1299impl fidl::endpoints::SynchronousProxy for StreamSinkSynchronousProxy {
1300 type Proxy = StreamSinkProxy;
1301 type Protocol = StreamSinkMarker;
1302
1303 fn from_channel(inner: fidl::Channel) -> Self {
1304 Self::new(inner)
1305 }
1306
1307 fn into_channel(self) -> fidl::Channel {
1308 self.client.into_channel()
1309 }
1310
1311 fn as_channel(&self) -> &fidl::Channel {
1312 self.client.as_channel()
1313 }
1314}
1315
1316#[cfg(target_os = "fuchsia")]
1317impl StreamSinkSynchronousProxy {
1318 pub fn new(channel: fidl::Channel) -> Self {
1319 let protocol_name = <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1320 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1321 }
1322
1323 pub fn into_channel(self) -> fidl::Channel {
1324 self.client.into_channel()
1325 }
1326
1327 pub fn wait_for_event(
1330 &self,
1331 deadline: zx::MonotonicInstant,
1332 ) -> Result<StreamSinkEvent, fidl::Error> {
1333 StreamSinkEvent::decode(self.client.wait_for_event(deadline)?)
1334 }
1335
1336 pub fn r#put_packet(&self, mut payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error> {
1338 self.client.send::<StreamSinkPutPacketRequest>(
1339 &mut payload,
1340 0x558d757afd726899,
1341 fidl::encoding::DynamicFlags::empty(),
1342 )
1343 }
1344
1345 pub fn r#start_segment(
1348 &self,
1349 mut payload: &StreamSinkStartSegmentRequest,
1350 ) -> Result<(), fidl::Error> {
1351 self.client.send::<StreamSinkStartSegmentRequest>(
1352 payload,
1353 0x6dd9bc66aa9f715f,
1354 fidl::encoding::DynamicFlags::empty(),
1355 )
1356 }
1357
1358 pub fn r#end(&self) -> Result<(), fidl::Error> {
1364 self.client.send::<fidl::encoding::EmptyPayload>(
1365 (),
1366 0x1a3a528e83b32f6e,
1367 fidl::encoding::DynamicFlags::empty(),
1368 )
1369 }
1370
1371 pub fn r#will_close(
1375 &self,
1376 mut payload: &StreamSinkWillCloseRequest,
1377 ) -> Result<(), fidl::Error> {
1378 self.client.send::<StreamSinkWillCloseRequest>(
1379 payload,
1380 0x6303ee33dbb0fd11,
1381 fidl::encoding::DynamicFlags::empty(),
1382 )
1383 }
1384}
1385
1386#[cfg(target_os = "fuchsia")]
1387impl From<StreamSinkSynchronousProxy> for zx::NullableHandle {
1388 fn from(value: StreamSinkSynchronousProxy) -> Self {
1389 value.into_channel().into()
1390 }
1391}
1392
1393#[cfg(target_os = "fuchsia")]
1394impl From<fidl::Channel> for StreamSinkSynchronousProxy {
1395 fn from(value: fidl::Channel) -> Self {
1396 Self::new(value)
1397 }
1398}
1399
1400#[cfg(target_os = "fuchsia")]
1401impl fidl::endpoints::FromClient for StreamSinkSynchronousProxy {
1402 type Protocol = StreamSinkMarker;
1403
1404 fn from_client(value: fidl::endpoints::ClientEnd<StreamSinkMarker>) -> Self {
1405 Self::new(value.into_channel())
1406 }
1407}
1408
1409#[derive(Debug, Clone)]
1410pub struct StreamSinkProxy {
1411 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1412}
1413
1414impl fidl::endpoints::Proxy for StreamSinkProxy {
1415 type Protocol = StreamSinkMarker;
1416
1417 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1418 Self::new(inner)
1419 }
1420
1421 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1422 self.client.into_channel().map_err(|client| Self { client })
1423 }
1424
1425 fn as_channel(&self) -> &::fidl::AsyncChannel {
1426 self.client.as_channel()
1427 }
1428}
1429
1430impl StreamSinkProxy {
1431 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1433 let protocol_name = <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1434 Self { client: fidl::client::Client::new(channel, protocol_name) }
1435 }
1436
1437 pub fn take_event_stream(&self) -> StreamSinkEventStream {
1443 StreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
1444 }
1445
1446 pub fn r#put_packet(&self, mut payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error> {
1448 StreamSinkProxyInterface::r#put_packet(self, payload)
1449 }
1450
1451 pub fn r#start_segment(
1454 &self,
1455 mut payload: &StreamSinkStartSegmentRequest,
1456 ) -> Result<(), fidl::Error> {
1457 StreamSinkProxyInterface::r#start_segment(self, payload)
1458 }
1459
1460 pub fn r#end(&self) -> Result<(), fidl::Error> {
1466 StreamSinkProxyInterface::r#end(self)
1467 }
1468
1469 pub fn r#will_close(
1473 &self,
1474 mut payload: &StreamSinkWillCloseRequest,
1475 ) -> Result<(), fidl::Error> {
1476 StreamSinkProxyInterface::r#will_close(self, payload)
1477 }
1478}
1479
1480impl StreamSinkProxyInterface for StreamSinkProxy {
1481 fn r#put_packet(&self, mut payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error> {
1482 self.client.send::<StreamSinkPutPacketRequest>(
1483 &mut payload,
1484 0x558d757afd726899,
1485 fidl::encoding::DynamicFlags::empty(),
1486 )
1487 }
1488
1489 fn r#start_segment(
1490 &self,
1491 mut payload: &StreamSinkStartSegmentRequest,
1492 ) -> Result<(), fidl::Error> {
1493 self.client.send::<StreamSinkStartSegmentRequest>(
1494 payload,
1495 0x6dd9bc66aa9f715f,
1496 fidl::encoding::DynamicFlags::empty(),
1497 )
1498 }
1499
1500 fn r#end(&self) -> Result<(), fidl::Error> {
1501 self.client.send::<fidl::encoding::EmptyPayload>(
1502 (),
1503 0x1a3a528e83b32f6e,
1504 fidl::encoding::DynamicFlags::empty(),
1505 )
1506 }
1507
1508 fn r#will_close(&self, mut payload: &StreamSinkWillCloseRequest) -> Result<(), fidl::Error> {
1509 self.client.send::<StreamSinkWillCloseRequest>(
1510 payload,
1511 0x6303ee33dbb0fd11,
1512 fidl::encoding::DynamicFlags::empty(),
1513 )
1514 }
1515}
1516
1517pub struct StreamSinkEventStream {
1518 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1519}
1520
1521impl std::marker::Unpin for StreamSinkEventStream {}
1522
1523impl futures::stream::FusedStream for StreamSinkEventStream {
1524 fn is_terminated(&self) -> bool {
1525 self.event_receiver.is_terminated()
1526 }
1527}
1528
1529impl futures::Stream for StreamSinkEventStream {
1530 type Item = Result<StreamSinkEvent, fidl::Error>;
1531
1532 fn poll_next(
1533 mut self: std::pin::Pin<&mut Self>,
1534 cx: &mut std::task::Context<'_>,
1535 ) -> std::task::Poll<Option<Self::Item>> {
1536 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1537 &mut self.event_receiver,
1538 cx
1539 )?) {
1540 Some(buf) => std::task::Poll::Ready(Some(StreamSinkEvent::decode(buf))),
1541 None => std::task::Poll::Ready(None),
1542 }
1543 }
1544}
1545
1546#[derive(Debug)]
1547pub enum StreamSinkEvent {
1548 OnWillClose { payload: StreamSinkOnWillCloseRequest },
1549}
1550
1551impl StreamSinkEvent {
1552 #[allow(irrefutable_let_patterns)]
1553 pub fn into_on_will_close(self) -> Option<StreamSinkOnWillCloseRequest> {
1554 if let StreamSinkEvent::OnWillClose { payload } = self { Some((payload)) } else { None }
1555 }
1556
1557 fn decode(
1559 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1560 ) -> Result<StreamSinkEvent, fidl::Error> {
1561 let (bytes, _handles) = buf.split_mut();
1562 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1563 debug_assert_eq!(tx_header.tx_id, 0);
1564 match tx_header.ordinal {
1565 0x77093453926bce5b => {
1566 let mut out = fidl::new_empty!(
1567 StreamSinkOnWillCloseRequest,
1568 fidl::encoding::DefaultFuchsiaResourceDialect
1569 );
1570 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkOnWillCloseRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1571 Ok((StreamSinkEvent::OnWillClose { payload: out }))
1572 }
1573 _ => Err(fidl::Error::UnknownOrdinal {
1574 ordinal: tx_header.ordinal,
1575 protocol_name: <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1576 }),
1577 }
1578 }
1579}
1580
1581pub struct StreamSinkRequestStream {
1583 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1584 is_terminated: bool,
1585}
1586
1587impl std::marker::Unpin for StreamSinkRequestStream {}
1588
1589impl futures::stream::FusedStream for StreamSinkRequestStream {
1590 fn is_terminated(&self) -> bool {
1591 self.is_terminated
1592 }
1593}
1594
1595impl fidl::endpoints::RequestStream for StreamSinkRequestStream {
1596 type Protocol = StreamSinkMarker;
1597 type ControlHandle = StreamSinkControlHandle;
1598
1599 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1600 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1601 }
1602
1603 fn control_handle(&self) -> Self::ControlHandle {
1604 StreamSinkControlHandle { inner: self.inner.clone() }
1605 }
1606
1607 fn into_inner(
1608 self,
1609 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1610 {
1611 (self.inner, self.is_terminated)
1612 }
1613
1614 fn from_inner(
1615 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1616 is_terminated: bool,
1617 ) -> Self {
1618 Self { inner, is_terminated }
1619 }
1620}
1621
1622impl futures::Stream for StreamSinkRequestStream {
1623 type Item = Result<StreamSinkRequest, fidl::Error>;
1624
1625 fn poll_next(
1626 mut self: std::pin::Pin<&mut Self>,
1627 cx: &mut std::task::Context<'_>,
1628 ) -> std::task::Poll<Option<Self::Item>> {
1629 let this = &mut *self;
1630 if this.inner.check_shutdown(cx) {
1631 this.is_terminated = true;
1632 return std::task::Poll::Ready(None);
1633 }
1634 if this.is_terminated {
1635 panic!("polled StreamSinkRequestStream after completion");
1636 }
1637 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1638 |bytes, handles| {
1639 match this.inner.channel().read_etc(cx, bytes, handles) {
1640 std::task::Poll::Ready(Ok(())) => {}
1641 std::task::Poll::Pending => return std::task::Poll::Pending,
1642 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1643 this.is_terminated = true;
1644 return std::task::Poll::Ready(None);
1645 }
1646 std::task::Poll::Ready(Err(e)) => {
1647 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1648 e.into(),
1649 ))));
1650 }
1651 }
1652
1653 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1655
1656 std::task::Poll::Ready(Some(match header.ordinal {
1657 0x558d757afd726899 => {
1658 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1659 let mut req = fidl::new_empty!(
1660 StreamSinkPutPacketRequest,
1661 fidl::encoding::DefaultFuchsiaResourceDialect
1662 );
1663 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkPutPacketRequest>(&header, _body_bytes, handles, &mut req)?;
1664 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1665 Ok(StreamSinkRequest::PutPacket { payload: req, control_handle })
1666 }
1667 0x6dd9bc66aa9f715f => {
1668 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1669 let mut req = fidl::new_empty!(
1670 StreamSinkStartSegmentRequest,
1671 fidl::encoding::DefaultFuchsiaResourceDialect
1672 );
1673 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkStartSegmentRequest>(&header, _body_bytes, handles, &mut req)?;
1674 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1675 Ok(StreamSinkRequest::StartSegment { payload: req, control_handle })
1676 }
1677 0x1a3a528e83b32f6e => {
1678 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1679 let mut req = fidl::new_empty!(
1680 fidl::encoding::EmptyPayload,
1681 fidl::encoding::DefaultFuchsiaResourceDialect
1682 );
1683 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1684 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1685 Ok(StreamSinkRequest::End { control_handle })
1686 }
1687 0x6303ee33dbb0fd11 => {
1688 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1689 let mut req = fidl::new_empty!(
1690 StreamSinkWillCloseRequest,
1691 fidl::encoding::DefaultFuchsiaResourceDialect
1692 );
1693 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamSinkWillCloseRequest>(&header, _body_bytes, handles, &mut req)?;
1694 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1695 Ok(StreamSinkRequest::WillClose { payload: req, control_handle })
1696 }
1697 _ => Err(fidl::Error::UnknownOrdinal {
1698 ordinal: header.ordinal,
1699 protocol_name:
1700 <StreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1701 }),
1702 }))
1703 },
1704 )
1705 }
1706}
1707
1708#[derive(Debug)]
1711pub enum StreamSinkRequest {
1712 PutPacket { payload: StreamSinkPutPacketRequest, control_handle: StreamSinkControlHandle },
1714 StartSegment { payload: StreamSinkStartSegmentRequest, control_handle: StreamSinkControlHandle },
1717 End { control_handle: StreamSinkControlHandle },
1723 WillClose { payload: StreamSinkWillCloseRequest, control_handle: StreamSinkControlHandle },
1727}
1728
1729impl StreamSinkRequest {
1730 #[allow(irrefutable_let_patterns)]
1731 pub fn into_put_packet(self) -> Option<(StreamSinkPutPacketRequest, StreamSinkControlHandle)> {
1732 if let StreamSinkRequest::PutPacket { payload, control_handle } = self {
1733 Some((payload, control_handle))
1734 } else {
1735 None
1736 }
1737 }
1738
1739 #[allow(irrefutable_let_patterns)]
1740 pub fn into_start_segment(
1741 self,
1742 ) -> Option<(StreamSinkStartSegmentRequest, StreamSinkControlHandle)> {
1743 if let StreamSinkRequest::StartSegment { payload, control_handle } = self {
1744 Some((payload, control_handle))
1745 } else {
1746 None
1747 }
1748 }
1749
1750 #[allow(irrefutable_let_patterns)]
1751 pub fn into_end(self) -> Option<(StreamSinkControlHandle)> {
1752 if let StreamSinkRequest::End { control_handle } = self {
1753 Some((control_handle))
1754 } else {
1755 None
1756 }
1757 }
1758
1759 #[allow(irrefutable_let_patterns)]
1760 pub fn into_will_close(self) -> Option<(StreamSinkWillCloseRequest, StreamSinkControlHandle)> {
1761 if let StreamSinkRequest::WillClose { payload, control_handle } = self {
1762 Some((payload, control_handle))
1763 } else {
1764 None
1765 }
1766 }
1767
1768 pub fn method_name(&self) -> &'static str {
1770 match *self {
1771 StreamSinkRequest::PutPacket { .. } => "put_packet",
1772 StreamSinkRequest::StartSegment { .. } => "start_segment",
1773 StreamSinkRequest::End { .. } => "end",
1774 StreamSinkRequest::WillClose { .. } => "will_close",
1775 }
1776 }
1777}
1778
1779#[derive(Debug, Clone)]
1780pub struct StreamSinkControlHandle {
1781 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1782}
1783
1784impl fidl::endpoints::ControlHandle for StreamSinkControlHandle {
1785 fn shutdown(&self) {
1786 self.inner.shutdown()
1787 }
1788
1789 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1790 self.inner.shutdown_with_epitaph(status)
1791 }
1792
1793 fn is_closed(&self) -> bool {
1794 self.inner.channel().is_closed()
1795 }
1796 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1797 self.inner.channel().on_closed()
1798 }
1799
1800 #[cfg(target_os = "fuchsia")]
1801 fn signal_peer(
1802 &self,
1803 clear_mask: zx::Signals,
1804 set_mask: zx::Signals,
1805 ) -> Result<(), zx_status::Status> {
1806 use fidl::Peered;
1807 self.inner.channel().signal_peer(clear_mask, set_mask)
1808 }
1809}
1810
1811impl StreamSinkControlHandle {
1812 pub fn send_on_will_close(
1813 &self,
1814 mut payload: &StreamSinkOnWillCloseRequest,
1815 ) -> Result<(), fidl::Error> {
1816 self.inner.send::<StreamSinkOnWillCloseRequest>(
1817 payload,
1818 0,
1819 0x77093453926bce5b,
1820 fidl::encoding::DynamicFlags::empty(),
1821 )
1822 }
1823}
1824
1825mod internal {
1826 use super::*;
1827
1828 impl RingBuffer {
1829 #[inline(always)]
1830 fn max_ordinal_present(&self) -> u64 {
1831 if let Some(_) = self.reference_clock_domain {
1832 return 6;
1833 }
1834 if let Some(_) = self.reference_clock {
1835 return 5;
1836 }
1837 if let Some(_) = self.consumer_bytes {
1838 return 4;
1839 }
1840 if let Some(_) = self.producer_bytes {
1841 return 3;
1842 }
1843 if let Some(_) = self.format {
1844 return 2;
1845 }
1846 if let Some(_) = self.buffer {
1847 return 1;
1848 }
1849 0
1850 }
1851 }
1852
1853 impl fidl::encoding::ResourceTypeMarker for RingBuffer {
1854 type Borrowed<'a> = &'a mut Self;
1855 fn take_or_borrow<'a>(
1856 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1857 ) -> Self::Borrowed<'a> {
1858 value
1859 }
1860 }
1861
1862 unsafe impl fidl::encoding::TypeMarker for RingBuffer {
1863 type Owned = Self;
1864
1865 #[inline(always)]
1866 fn inline_align(_context: fidl::encoding::Context) -> usize {
1867 8
1868 }
1869
1870 #[inline(always)]
1871 fn inline_size(_context: fidl::encoding::Context) -> usize {
1872 16
1873 }
1874 }
1875
1876 unsafe impl fidl::encoding::Encode<RingBuffer, fidl::encoding::DefaultFuchsiaResourceDialect>
1877 for &mut RingBuffer
1878 {
1879 unsafe fn encode(
1880 self,
1881 encoder: &mut fidl::encoding::Encoder<
1882 '_,
1883 fidl::encoding::DefaultFuchsiaResourceDialect,
1884 >,
1885 offset: usize,
1886 mut depth: fidl::encoding::Depth,
1887 ) -> fidl::Result<()> {
1888 encoder.debug_check_bounds::<RingBuffer>(offset);
1889 let max_ordinal: u64 = self.max_ordinal_present();
1891 encoder.write_num(max_ordinal, offset);
1892 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1893 if max_ordinal == 0 {
1895 return Ok(());
1896 }
1897 depth.increment()?;
1898 let envelope_size = 8;
1899 let bytes_len = max_ordinal as usize * envelope_size;
1900 #[allow(unused_variables)]
1901 let offset = encoder.out_of_line_offset(bytes_len);
1902 let mut _prev_end_offset: usize = 0;
1903 if 1 > max_ordinal {
1904 return Ok(());
1905 }
1906
1907 let cur_offset: usize = (1 - 1) * envelope_size;
1910
1911 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1913
1914 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
1919 self.buffer.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1920 encoder, offset + cur_offset, depth
1921 )?;
1922
1923 _prev_end_offset = cur_offset + envelope_size;
1924 if 2 > max_ordinal {
1925 return Ok(());
1926 }
1927
1928 let cur_offset: usize = (2 - 1) * envelope_size;
1931
1932 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1934
1935 fidl::encoding::encode_in_envelope_optional::<
1940 Format,
1941 fidl::encoding::DefaultFuchsiaResourceDialect,
1942 >(
1943 self.format.as_ref().map(<Format as fidl::encoding::ValueTypeMarker>::borrow),
1944 encoder,
1945 offset + cur_offset,
1946 depth,
1947 )?;
1948
1949 _prev_end_offset = cur_offset + envelope_size;
1950 if 3 > max_ordinal {
1951 return Ok(());
1952 }
1953
1954 let cur_offset: usize = (3 - 1) * envelope_size;
1957
1958 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1960
1961 fidl::encoding::encode_in_envelope_optional::<
1966 u64,
1967 fidl::encoding::DefaultFuchsiaResourceDialect,
1968 >(
1969 self.producer_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1970 encoder,
1971 offset + cur_offset,
1972 depth,
1973 )?;
1974
1975 _prev_end_offset = cur_offset + envelope_size;
1976 if 4 > max_ordinal {
1977 return Ok(());
1978 }
1979
1980 let cur_offset: usize = (4 - 1) * envelope_size;
1983
1984 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1986
1987 fidl::encoding::encode_in_envelope_optional::<
1992 u64,
1993 fidl::encoding::DefaultFuchsiaResourceDialect,
1994 >(
1995 self.consumer_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1996 encoder,
1997 offset + cur_offset,
1998 depth,
1999 )?;
2000
2001 _prev_end_offset = cur_offset + envelope_size;
2002 if 5 > max_ordinal {
2003 return Ok(());
2004 }
2005
2006 let cur_offset: usize = (5 - 1) * envelope_size;
2009
2010 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2012
2013 fidl::encoding::encode_in_envelope_optional::<
2018 fidl::encoding::HandleType<
2019 fidl::Clock,
2020 { fidl::ObjectType::CLOCK.into_raw() },
2021 2147483648,
2022 >,
2023 fidl::encoding::DefaultFuchsiaResourceDialect,
2024 >(
2025 self.reference_clock.as_mut().map(
2026 <fidl::encoding::HandleType<
2027 fidl::Clock,
2028 { fidl::ObjectType::CLOCK.into_raw() },
2029 2147483648,
2030 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2031 ),
2032 encoder,
2033 offset + cur_offset,
2034 depth,
2035 )?;
2036
2037 _prev_end_offset = cur_offset + envelope_size;
2038 if 6 > max_ordinal {
2039 return Ok(());
2040 }
2041
2042 let cur_offset: usize = (6 - 1) * envelope_size;
2045
2046 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2048
2049 fidl::encoding::encode_in_envelope_optional::<
2054 u32,
2055 fidl::encoding::DefaultFuchsiaResourceDialect,
2056 >(
2057 self.reference_clock_domain
2058 .as_ref()
2059 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2060 encoder,
2061 offset + cur_offset,
2062 depth,
2063 )?;
2064
2065 _prev_end_offset = cur_offset + envelope_size;
2066
2067 Ok(())
2068 }
2069 }
2070
2071 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RingBuffer {
2072 #[inline(always)]
2073 fn new_empty() -> Self {
2074 Self::default()
2075 }
2076
2077 unsafe fn decode(
2078 &mut self,
2079 decoder: &mut fidl::encoding::Decoder<
2080 '_,
2081 fidl::encoding::DefaultFuchsiaResourceDialect,
2082 >,
2083 offset: usize,
2084 mut depth: fidl::encoding::Depth,
2085 ) -> fidl::Result<()> {
2086 decoder.debug_check_bounds::<Self>(offset);
2087 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2088 None => return Err(fidl::Error::NotNullable),
2089 Some(len) => len,
2090 };
2091 if len == 0 {
2093 return Ok(());
2094 };
2095 depth.increment()?;
2096 let envelope_size = 8;
2097 let bytes_len = len * envelope_size;
2098 let offset = decoder.out_of_line_offset(bytes_len)?;
2099 let mut _next_ordinal_to_read = 0;
2101 let mut next_offset = offset;
2102 let end_offset = offset + bytes_len;
2103 _next_ordinal_to_read += 1;
2104 if next_offset >= end_offset {
2105 return Ok(());
2106 }
2107
2108 while _next_ordinal_to_read < 1 {
2110 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2111 _next_ordinal_to_read += 1;
2112 next_offset += envelope_size;
2113 }
2114
2115 let next_out_of_line = decoder.next_out_of_line();
2116 let handles_before = decoder.remaining_handles();
2117 if let Some((inlined, num_bytes, num_handles)) =
2118 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2119 {
2120 let member_inline_size =
2121 <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
2122 decoder.context,
2123 );
2124 if inlined != (member_inline_size <= 4) {
2125 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2126 }
2127 let inner_offset;
2128 let mut inner_depth = depth.clone();
2129 if inlined {
2130 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2131 inner_offset = next_offset;
2132 } else {
2133 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2134 inner_depth.increment()?;
2135 }
2136 let val_ref = self.buffer.get_or_insert_with(|| {
2137 fidl::new_empty!(
2138 fidl_fuchsia_mem::Buffer,
2139 fidl::encoding::DefaultFuchsiaResourceDialect
2140 )
2141 });
2142 fidl::decode!(
2143 fidl_fuchsia_mem::Buffer,
2144 fidl::encoding::DefaultFuchsiaResourceDialect,
2145 val_ref,
2146 decoder,
2147 inner_offset,
2148 inner_depth
2149 )?;
2150 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2151 {
2152 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2153 }
2154 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2155 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2156 }
2157 }
2158
2159 next_offset += envelope_size;
2160 _next_ordinal_to_read += 1;
2161 if next_offset >= end_offset {
2162 return Ok(());
2163 }
2164
2165 while _next_ordinal_to_read < 2 {
2167 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2168 _next_ordinal_to_read += 1;
2169 next_offset += envelope_size;
2170 }
2171
2172 let next_out_of_line = decoder.next_out_of_line();
2173 let handles_before = decoder.remaining_handles();
2174 if let Some((inlined, num_bytes, num_handles)) =
2175 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2176 {
2177 let member_inline_size =
2178 <Format as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2179 if inlined != (member_inline_size <= 4) {
2180 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2181 }
2182 let inner_offset;
2183 let mut inner_depth = depth.clone();
2184 if inlined {
2185 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2186 inner_offset = next_offset;
2187 } else {
2188 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2189 inner_depth.increment()?;
2190 }
2191 let val_ref = self.format.get_or_insert_with(|| {
2192 fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect)
2193 });
2194 fidl::decode!(
2195 Format,
2196 fidl::encoding::DefaultFuchsiaResourceDialect,
2197 val_ref,
2198 decoder,
2199 inner_offset,
2200 inner_depth
2201 )?;
2202 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2203 {
2204 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2205 }
2206 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2207 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2208 }
2209 }
2210
2211 next_offset += envelope_size;
2212 _next_ordinal_to_read += 1;
2213 if next_offset >= end_offset {
2214 return Ok(());
2215 }
2216
2217 while _next_ordinal_to_read < 3 {
2219 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2220 _next_ordinal_to_read += 1;
2221 next_offset += envelope_size;
2222 }
2223
2224 let next_out_of_line = decoder.next_out_of_line();
2225 let handles_before = decoder.remaining_handles();
2226 if let Some((inlined, num_bytes, num_handles)) =
2227 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2228 {
2229 let member_inline_size =
2230 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2231 if inlined != (member_inline_size <= 4) {
2232 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2233 }
2234 let inner_offset;
2235 let mut inner_depth = depth.clone();
2236 if inlined {
2237 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2238 inner_offset = next_offset;
2239 } else {
2240 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2241 inner_depth.increment()?;
2242 }
2243 let val_ref = self.producer_bytes.get_or_insert_with(|| {
2244 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
2245 });
2246 fidl::decode!(
2247 u64,
2248 fidl::encoding::DefaultFuchsiaResourceDialect,
2249 val_ref,
2250 decoder,
2251 inner_offset,
2252 inner_depth
2253 )?;
2254 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2255 {
2256 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2257 }
2258 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2259 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2260 }
2261 }
2262
2263 next_offset += envelope_size;
2264 _next_ordinal_to_read += 1;
2265 if next_offset >= end_offset {
2266 return Ok(());
2267 }
2268
2269 while _next_ordinal_to_read < 4 {
2271 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2272 _next_ordinal_to_read += 1;
2273 next_offset += envelope_size;
2274 }
2275
2276 let next_out_of_line = decoder.next_out_of_line();
2277 let handles_before = decoder.remaining_handles();
2278 if let Some((inlined, num_bytes, num_handles)) =
2279 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2280 {
2281 let member_inline_size =
2282 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2283 if inlined != (member_inline_size <= 4) {
2284 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2285 }
2286 let inner_offset;
2287 let mut inner_depth = depth.clone();
2288 if inlined {
2289 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2290 inner_offset = next_offset;
2291 } else {
2292 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2293 inner_depth.increment()?;
2294 }
2295 let val_ref = self.consumer_bytes.get_or_insert_with(|| {
2296 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
2297 });
2298 fidl::decode!(
2299 u64,
2300 fidl::encoding::DefaultFuchsiaResourceDialect,
2301 val_ref,
2302 decoder,
2303 inner_offset,
2304 inner_depth
2305 )?;
2306 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2307 {
2308 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2309 }
2310 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2311 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2312 }
2313 }
2314
2315 next_offset += envelope_size;
2316 _next_ordinal_to_read += 1;
2317 if next_offset >= end_offset {
2318 return Ok(());
2319 }
2320
2321 while _next_ordinal_to_read < 5 {
2323 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2324 _next_ordinal_to_read += 1;
2325 next_offset += envelope_size;
2326 }
2327
2328 let next_out_of_line = decoder.next_out_of_line();
2329 let handles_before = decoder.remaining_handles();
2330 if let Some((inlined, num_bytes, num_handles)) =
2331 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2332 {
2333 let member_inline_size = <fidl::encoding::HandleType<
2334 fidl::Clock,
2335 { fidl::ObjectType::CLOCK.into_raw() },
2336 2147483648,
2337 > as fidl::encoding::TypeMarker>::inline_size(
2338 decoder.context
2339 );
2340 if inlined != (member_inline_size <= 4) {
2341 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2342 }
2343 let inner_offset;
2344 let mut inner_depth = depth.clone();
2345 if inlined {
2346 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2347 inner_offset = next_offset;
2348 } else {
2349 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2350 inner_depth.increment()?;
2351 }
2352 let val_ref =
2353 self.reference_clock.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2354 fidl::decode!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2355 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2356 {
2357 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2358 }
2359 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2360 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2361 }
2362 }
2363
2364 next_offset += envelope_size;
2365 _next_ordinal_to_read += 1;
2366 if next_offset >= end_offset {
2367 return Ok(());
2368 }
2369
2370 while _next_ordinal_to_read < 6 {
2372 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2373 _next_ordinal_to_read += 1;
2374 next_offset += envelope_size;
2375 }
2376
2377 let next_out_of_line = decoder.next_out_of_line();
2378 let handles_before = decoder.remaining_handles();
2379 if let Some((inlined, num_bytes, num_handles)) =
2380 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2381 {
2382 let member_inline_size =
2383 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2384 if inlined != (member_inline_size <= 4) {
2385 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2386 }
2387 let inner_offset;
2388 let mut inner_depth = depth.clone();
2389 if inlined {
2390 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2391 inner_offset = next_offset;
2392 } else {
2393 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2394 inner_depth.increment()?;
2395 }
2396 let val_ref = self.reference_clock_domain.get_or_insert_with(|| {
2397 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
2398 });
2399 fidl::decode!(
2400 u32,
2401 fidl::encoding::DefaultFuchsiaResourceDialect,
2402 val_ref,
2403 decoder,
2404 inner_offset,
2405 inner_depth
2406 )?;
2407 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2408 {
2409 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2410 }
2411 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2412 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2413 }
2414 }
2415
2416 next_offset += envelope_size;
2417
2418 while next_offset < end_offset {
2420 _next_ordinal_to_read += 1;
2421 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2422 next_offset += envelope_size;
2423 }
2424
2425 Ok(())
2426 }
2427 }
2428
2429 impl StreamSinkPutPacketRequest {
2430 #[inline(always)]
2431 fn max_ordinal_present(&self) -> u64 {
2432 if let Some(_) = self.release_fence {
2433 return 2;
2434 }
2435 if let Some(_) = self.packet {
2436 return 1;
2437 }
2438 0
2439 }
2440 }
2441
2442 impl fidl::encoding::ResourceTypeMarker for StreamSinkPutPacketRequest {
2443 type Borrowed<'a> = &'a mut Self;
2444 fn take_or_borrow<'a>(
2445 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2446 ) -> Self::Borrowed<'a> {
2447 value
2448 }
2449 }
2450
2451 unsafe impl fidl::encoding::TypeMarker for StreamSinkPutPacketRequest {
2452 type Owned = Self;
2453
2454 #[inline(always)]
2455 fn inline_align(_context: fidl::encoding::Context) -> usize {
2456 8
2457 }
2458
2459 #[inline(always)]
2460 fn inline_size(_context: fidl::encoding::Context) -> usize {
2461 16
2462 }
2463 }
2464
2465 unsafe impl
2466 fidl::encoding::Encode<
2467 StreamSinkPutPacketRequest,
2468 fidl::encoding::DefaultFuchsiaResourceDialect,
2469 > for &mut StreamSinkPutPacketRequest
2470 {
2471 unsafe fn encode(
2472 self,
2473 encoder: &mut fidl::encoding::Encoder<
2474 '_,
2475 fidl::encoding::DefaultFuchsiaResourceDialect,
2476 >,
2477 offset: usize,
2478 mut depth: fidl::encoding::Depth,
2479 ) -> fidl::Result<()> {
2480 encoder.debug_check_bounds::<StreamSinkPutPacketRequest>(offset);
2481 let max_ordinal: u64 = self.max_ordinal_present();
2483 encoder.write_num(max_ordinal, offset);
2484 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2485 if max_ordinal == 0 {
2487 return Ok(());
2488 }
2489 depth.increment()?;
2490 let envelope_size = 8;
2491 let bytes_len = max_ordinal as usize * envelope_size;
2492 #[allow(unused_variables)]
2493 let offset = encoder.out_of_line_offset(bytes_len);
2494 let mut _prev_end_offset: usize = 0;
2495 if 1 > max_ordinal {
2496 return Ok(());
2497 }
2498
2499 let cur_offset: usize = (1 - 1) * envelope_size;
2502
2503 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2505
2506 fidl::encoding::encode_in_envelope_optional::<
2511 Packet,
2512 fidl::encoding::DefaultFuchsiaResourceDialect,
2513 >(
2514 self.packet.as_ref().map(<Packet as fidl::encoding::ValueTypeMarker>::borrow),
2515 encoder,
2516 offset + cur_offset,
2517 depth,
2518 )?;
2519
2520 _prev_end_offset = cur_offset + envelope_size;
2521 if 2 > max_ordinal {
2522 return Ok(());
2523 }
2524
2525 let cur_offset: usize = (2 - 1) * envelope_size;
2528
2529 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2531
2532 fidl::encoding::encode_in_envelope_optional::<
2537 fidl::encoding::HandleType<
2538 fidl::EventPair,
2539 { fidl::ObjectType::EVENTPAIR.into_raw() },
2540 2147483648,
2541 >,
2542 fidl::encoding::DefaultFuchsiaResourceDialect,
2543 >(
2544 self.release_fence.as_mut().map(
2545 <fidl::encoding::HandleType<
2546 fidl::EventPair,
2547 { fidl::ObjectType::EVENTPAIR.into_raw() },
2548 2147483648,
2549 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2550 ),
2551 encoder,
2552 offset + cur_offset,
2553 depth,
2554 )?;
2555
2556 _prev_end_offset = cur_offset + envelope_size;
2557
2558 Ok(())
2559 }
2560 }
2561
2562 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2563 for StreamSinkPutPacketRequest
2564 {
2565 #[inline(always)]
2566 fn new_empty() -> Self {
2567 Self::default()
2568 }
2569
2570 unsafe fn decode(
2571 &mut self,
2572 decoder: &mut fidl::encoding::Decoder<
2573 '_,
2574 fidl::encoding::DefaultFuchsiaResourceDialect,
2575 >,
2576 offset: usize,
2577 mut depth: fidl::encoding::Depth,
2578 ) -> fidl::Result<()> {
2579 decoder.debug_check_bounds::<Self>(offset);
2580 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2581 None => return Err(fidl::Error::NotNullable),
2582 Some(len) => len,
2583 };
2584 if len == 0 {
2586 return Ok(());
2587 };
2588 depth.increment()?;
2589 let envelope_size = 8;
2590 let bytes_len = len * envelope_size;
2591 let offset = decoder.out_of_line_offset(bytes_len)?;
2592 let mut _next_ordinal_to_read = 0;
2594 let mut next_offset = offset;
2595 let end_offset = offset + bytes_len;
2596 _next_ordinal_to_read += 1;
2597 if next_offset >= end_offset {
2598 return Ok(());
2599 }
2600
2601 while _next_ordinal_to_read < 1 {
2603 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2604 _next_ordinal_to_read += 1;
2605 next_offset += envelope_size;
2606 }
2607
2608 let next_out_of_line = decoder.next_out_of_line();
2609 let handles_before = decoder.remaining_handles();
2610 if let Some((inlined, num_bytes, num_handles)) =
2611 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2612 {
2613 let member_inline_size =
2614 <Packet as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2615 if inlined != (member_inline_size <= 4) {
2616 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2617 }
2618 let inner_offset;
2619 let mut inner_depth = depth.clone();
2620 if inlined {
2621 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2622 inner_offset = next_offset;
2623 } else {
2624 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2625 inner_depth.increment()?;
2626 }
2627 let val_ref = self.packet.get_or_insert_with(|| {
2628 fidl::new_empty!(Packet, fidl::encoding::DefaultFuchsiaResourceDialect)
2629 });
2630 fidl::decode!(
2631 Packet,
2632 fidl::encoding::DefaultFuchsiaResourceDialect,
2633 val_ref,
2634 decoder,
2635 inner_offset,
2636 inner_depth
2637 )?;
2638 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2639 {
2640 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2641 }
2642 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2643 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2644 }
2645 }
2646
2647 next_offset += envelope_size;
2648 _next_ordinal_to_read += 1;
2649 if next_offset >= end_offset {
2650 return Ok(());
2651 }
2652
2653 while _next_ordinal_to_read < 2 {
2655 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2656 _next_ordinal_to_read += 1;
2657 next_offset += envelope_size;
2658 }
2659
2660 let next_out_of_line = decoder.next_out_of_line();
2661 let handles_before = decoder.remaining_handles();
2662 if let Some((inlined, num_bytes, num_handles)) =
2663 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2664 {
2665 let member_inline_size = <fidl::encoding::HandleType<
2666 fidl::EventPair,
2667 { fidl::ObjectType::EVENTPAIR.into_raw() },
2668 2147483648,
2669 > as fidl::encoding::TypeMarker>::inline_size(
2670 decoder.context
2671 );
2672 if inlined != (member_inline_size <= 4) {
2673 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2674 }
2675 let inner_offset;
2676 let mut inner_depth = depth.clone();
2677 if inlined {
2678 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2679 inner_offset = next_offset;
2680 } else {
2681 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2682 inner_depth.increment()?;
2683 }
2684 let val_ref =
2685 self.release_fence.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2686 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2687 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2688 {
2689 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2690 }
2691 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2692 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2693 }
2694 }
2695
2696 next_offset += envelope_size;
2697
2698 while next_offset < end_offset {
2700 _next_ordinal_to_read += 1;
2701 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2702 next_offset += envelope_size;
2703 }
2704
2705 Ok(())
2706 }
2707 }
2708}