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