1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_audio_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Default, PartialEq)]
95pub struct RingBuffer {
96 pub buffer: Option<fdomain_fuchsia_mem::Buffer>,
101 pub format: Option<Format>,
104 pub producer_bytes: Option<u64>,
114 pub consumer_bytes: Option<u64>,
124 pub reference_clock: Option<fdomain_client::Clock>,
128 pub reference_clock_domain: Option<u32>,
132 #[doc(hidden)]
133 pub __source_breaking: fidl::marker::SourceBreaking,
134}
135
136impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RingBuffer {}
137
138#[derive(Debug, Default, PartialEq)]
139pub struct StreamSinkPutPacketRequest {
140 pub packet: Option<Packet>,
142 pub release_fence: Option<fdomain_client::EventPair>,
147 #[doc(hidden)]
148 pub __source_breaking: fidl::marker::SourceBreaking,
149}
150
151impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for StreamSinkPutPacketRequest {}
152
153#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
154pub struct DelayWatcherMarker;
155
156impl fdomain_client::fidl::ProtocolMarker for DelayWatcherMarker {
157 type Proxy = DelayWatcherProxy;
158 type RequestStream = DelayWatcherRequestStream;
159
160 const DEBUG_NAME: &'static str = "(anonymous) DelayWatcher";
161}
162
163pub trait DelayWatcherProxyInterface: Send + Sync {
164 type WatchDelayResponseFut: std::future::Future<Output = Result<DelayWatcherWatchDelayResponse, fidl::Error>>
165 + Send;
166 fn r#watch_delay(&self, payload: &DelayWatcherWatchDelayRequest)
167 -> Self::WatchDelayResponseFut;
168}
169
170#[derive(Debug, Clone)]
171pub struct DelayWatcherProxy {
172 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
173}
174
175impl fdomain_client::fidl::Proxy for DelayWatcherProxy {
176 type Protocol = DelayWatcherMarker;
177
178 fn from_channel(inner: fdomain_client::Channel) -> Self {
179 Self::new(inner)
180 }
181
182 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
183 self.client.into_channel().map_err(|client| Self { client })
184 }
185
186 fn as_channel(&self) -> &fdomain_client::Channel {
187 self.client.as_channel()
188 }
189}
190
191impl DelayWatcherProxy {
192 pub fn new(channel: fdomain_client::Channel) -> Self {
194 let protocol_name =
195 <DelayWatcherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
196 Self { client: fidl::client::Client::new(channel, protocol_name) }
197 }
198
199 pub fn take_event_stream(&self) -> DelayWatcherEventStream {
205 DelayWatcherEventStream { event_receiver: self.client.take_event_receiver() }
206 }
207
208 pub fn r#watch_delay(
212 &self,
213 mut payload: &DelayWatcherWatchDelayRequest,
214 ) -> fidl::client::QueryResponseFut<
215 DelayWatcherWatchDelayResponse,
216 fdomain_client::fidl::FDomainResourceDialect,
217 > {
218 DelayWatcherProxyInterface::r#watch_delay(self, payload)
219 }
220}
221
222impl DelayWatcherProxyInterface for DelayWatcherProxy {
223 type WatchDelayResponseFut = fidl::client::QueryResponseFut<
224 DelayWatcherWatchDelayResponse,
225 fdomain_client::fidl::FDomainResourceDialect,
226 >;
227 fn r#watch_delay(
228 &self,
229 mut payload: &DelayWatcherWatchDelayRequest,
230 ) -> Self::WatchDelayResponseFut {
231 fn _decode(
232 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
233 ) -> Result<DelayWatcherWatchDelayResponse, fidl::Error> {
234 let _response = fidl::client::decode_transaction_body::<
235 DelayWatcherWatchDelayResponse,
236 fdomain_client::fidl::FDomainResourceDialect,
237 0x3a90c91ee2f1644c,
238 >(_buf?)?;
239 Ok(_response)
240 }
241 self.client
242 .send_query_and_decode::<DelayWatcherWatchDelayRequest, DelayWatcherWatchDelayResponse>(
243 payload,
244 0x3a90c91ee2f1644c,
245 fidl::encoding::DynamicFlags::empty(),
246 _decode,
247 )
248 }
249}
250
251pub struct DelayWatcherEventStream {
252 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
253}
254
255impl std::marker::Unpin for DelayWatcherEventStream {}
256
257impl futures::stream::FusedStream for DelayWatcherEventStream {
258 fn is_terminated(&self) -> bool {
259 self.event_receiver.is_terminated()
260 }
261}
262
263impl futures::Stream for DelayWatcherEventStream {
264 type Item = Result<DelayWatcherEvent, fidl::Error>;
265
266 fn poll_next(
267 mut self: std::pin::Pin<&mut Self>,
268 cx: &mut std::task::Context<'_>,
269 ) -> std::task::Poll<Option<Self::Item>> {
270 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
271 &mut self.event_receiver,
272 cx
273 )?) {
274 Some(buf) => std::task::Poll::Ready(Some(DelayWatcherEvent::decode(buf))),
275 None => std::task::Poll::Ready(None),
276 }
277 }
278}
279
280#[derive(Debug)]
281pub enum DelayWatcherEvent {}
282
283impl DelayWatcherEvent {
284 fn decode(
286 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
287 ) -> Result<DelayWatcherEvent, fidl::Error> {
288 let (bytes, _handles) = buf.split_mut();
289 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
290 debug_assert_eq!(tx_header.tx_id, 0);
291 match tx_header.ordinal {
292 _ => Err(fidl::Error::UnknownOrdinal {
293 ordinal: tx_header.ordinal,
294 protocol_name:
295 <DelayWatcherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
296 }),
297 }
298 }
299}
300
301pub struct DelayWatcherRequestStream {
303 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
304 is_terminated: bool,
305}
306
307impl std::marker::Unpin for DelayWatcherRequestStream {}
308
309impl futures::stream::FusedStream for DelayWatcherRequestStream {
310 fn is_terminated(&self) -> bool {
311 self.is_terminated
312 }
313}
314
315impl fdomain_client::fidl::RequestStream for DelayWatcherRequestStream {
316 type Protocol = DelayWatcherMarker;
317 type ControlHandle = DelayWatcherControlHandle;
318
319 fn from_channel(channel: fdomain_client::Channel) -> Self {
320 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
321 }
322
323 fn control_handle(&self) -> Self::ControlHandle {
324 DelayWatcherControlHandle { inner: self.inner.clone() }
325 }
326
327 fn into_inner(
328 self,
329 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
330 {
331 (self.inner, self.is_terminated)
332 }
333
334 fn from_inner(
335 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
336 is_terminated: bool,
337 ) -> Self {
338 Self { inner, is_terminated }
339 }
340}
341
342impl futures::Stream for DelayWatcherRequestStream {
343 type Item = Result<DelayWatcherRequest, fidl::Error>;
344
345 fn poll_next(
346 mut self: std::pin::Pin<&mut Self>,
347 cx: &mut std::task::Context<'_>,
348 ) -> std::task::Poll<Option<Self::Item>> {
349 let this = &mut *self;
350 if this.inner.check_shutdown(cx) {
351 this.is_terminated = true;
352 return std::task::Poll::Ready(None);
353 }
354 if this.is_terminated {
355 panic!("polled DelayWatcherRequestStream after completion");
356 }
357 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
358 |bytes, handles| {
359 match this.inner.channel().read_etc(cx, bytes, handles) {
360 std::task::Poll::Ready(Ok(())) => {}
361 std::task::Poll::Pending => return std::task::Poll::Pending,
362 std::task::Poll::Ready(Err(None)) => {
363 this.is_terminated = true;
364 return std::task::Poll::Ready(None);
365 }
366 std::task::Poll::Ready(Err(Some(e))) => {
367 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
368 e.into(),
369 ))));
370 }
371 }
372
373 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
375
376 std::task::Poll::Ready(Some(match header.ordinal {
377 0x3a90c91ee2f1644c => {
378 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
379 let mut req = fidl::new_empty!(
380 DelayWatcherWatchDelayRequest,
381 fdomain_client::fidl::FDomainResourceDialect
382 );
383 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<DelayWatcherWatchDelayRequest>(&header, _body_bytes, handles, &mut req)?;
384 let control_handle =
385 DelayWatcherControlHandle { inner: this.inner.clone() };
386 Ok(DelayWatcherRequest::WatchDelay {
387 payload: req,
388 responder: DelayWatcherWatchDelayResponder {
389 control_handle: std::mem::ManuallyDrop::new(control_handle),
390 tx_id: header.tx_id,
391 },
392 })
393 }
394 _ => Err(fidl::Error::UnknownOrdinal {
395 ordinal: header.ordinal,
396 protocol_name:
397 <DelayWatcherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
398 }),
399 }))
400 },
401 )
402 }
403}
404
405#[derive(Debug)]
407pub enum DelayWatcherRequest {
408 WatchDelay {
412 payload: DelayWatcherWatchDelayRequest,
413 responder: DelayWatcherWatchDelayResponder,
414 },
415}
416
417impl DelayWatcherRequest {
418 #[allow(irrefutable_let_patterns)]
419 pub fn into_watch_delay(
420 self,
421 ) -> Option<(DelayWatcherWatchDelayRequest, DelayWatcherWatchDelayResponder)> {
422 if let DelayWatcherRequest::WatchDelay { payload, responder } = self {
423 Some((payload, responder))
424 } else {
425 None
426 }
427 }
428
429 pub fn method_name(&self) -> &'static str {
431 match *self {
432 DelayWatcherRequest::WatchDelay { .. } => "watch_delay",
433 }
434 }
435}
436
437#[derive(Debug, Clone)]
438pub struct DelayWatcherControlHandle {
439 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
440}
441
442impl DelayWatcherControlHandle {
443 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
444 self.inner.shutdown_with_epitaph(status.into())
445 }
446}
447
448impl fdomain_client::fidl::ControlHandle for DelayWatcherControlHandle {
449 fn shutdown(&self) {
450 self.inner.shutdown()
451 }
452
453 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
454 self.inner.shutdown_with_epitaph(status)
455 }
456
457 fn is_closed(&self) -> bool {
458 self.inner.channel().is_closed()
459 }
460 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
461 self.inner.channel().on_closed()
462 }
463}
464
465impl DelayWatcherControlHandle {}
466
467#[must_use = "FIDL methods require a response to be sent"]
468#[derive(Debug)]
469pub struct DelayWatcherWatchDelayResponder {
470 control_handle: std::mem::ManuallyDrop<DelayWatcherControlHandle>,
471 tx_id: u32,
472}
473
474impl std::ops::Drop for DelayWatcherWatchDelayResponder {
478 fn drop(&mut self) {
479 self.control_handle.shutdown();
480 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
482 }
483}
484
485impl fdomain_client::fidl::Responder for DelayWatcherWatchDelayResponder {
486 type ControlHandle = DelayWatcherControlHandle;
487
488 fn control_handle(&self) -> &DelayWatcherControlHandle {
489 &self.control_handle
490 }
491
492 fn drop_without_shutdown(mut self) {
493 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
495 std::mem::forget(self);
497 }
498}
499
500impl DelayWatcherWatchDelayResponder {
501 pub fn send(self, mut payload: &DelayWatcherWatchDelayResponse) -> Result<(), fidl::Error> {
505 let _result = self.send_raw(payload);
506 if _result.is_err() {
507 self.control_handle.shutdown();
508 }
509 self.drop_without_shutdown();
510 _result
511 }
512
513 pub fn send_no_shutdown_on_err(
515 self,
516 mut payload: &DelayWatcherWatchDelayResponse,
517 ) -> Result<(), fidl::Error> {
518 let _result = self.send_raw(payload);
519 self.drop_without_shutdown();
520 _result
521 }
522
523 fn send_raw(&self, mut payload: &DelayWatcherWatchDelayResponse) -> Result<(), fidl::Error> {
524 self.control_handle.inner.send::<DelayWatcherWatchDelayResponse>(
525 payload,
526 self.tx_id,
527 0x3a90c91ee2f1644c,
528 fidl::encoding::DynamicFlags::empty(),
529 )
530 }
531}
532
533#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
534pub struct GainControlMarker;
535
536impl fdomain_client::fidl::ProtocolMarker for GainControlMarker {
537 type Proxy = GainControlProxy;
538 type RequestStream = GainControlRequestStream;
539
540 const DEBUG_NAME: &'static str = "(anonymous) GainControl";
541}
542pub type GainControlSetGainResult = Result<GainControlSetGainResponse, GainError>;
543pub type GainControlSetMuteResult = Result<GainControlSetMuteResponse, GainError>;
544
545pub trait GainControlProxyInterface: Send + Sync {
546 type SetGainResponseFut: std::future::Future<Output = Result<GainControlSetGainResult, fidl::Error>>
547 + Send;
548 fn r#set_gain(&self, payload: &GainControlSetGainRequest) -> Self::SetGainResponseFut;
549 type SetMuteResponseFut: std::future::Future<Output = Result<GainControlSetMuteResult, fidl::Error>>
550 + Send;
551 fn r#set_mute(&self, payload: &GainControlSetMuteRequest) -> Self::SetMuteResponseFut;
552}
553
554#[derive(Debug, Clone)]
555pub struct GainControlProxy {
556 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
557}
558
559impl fdomain_client::fidl::Proxy for GainControlProxy {
560 type Protocol = GainControlMarker;
561
562 fn from_channel(inner: fdomain_client::Channel) -> Self {
563 Self::new(inner)
564 }
565
566 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
567 self.client.into_channel().map_err(|client| Self { client })
568 }
569
570 fn as_channel(&self) -> &fdomain_client::Channel {
571 self.client.as_channel()
572 }
573}
574
575impl GainControlProxy {
576 pub fn new(channel: fdomain_client::Channel) -> Self {
578 let protocol_name = <GainControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
579 Self { client: fidl::client::Client::new(channel, protocol_name) }
580 }
581
582 pub fn take_event_stream(&self) -> GainControlEventStream {
588 GainControlEventStream { event_receiver: self.client.take_event_receiver() }
589 }
590
591 pub fn r#set_gain(
593 &self,
594 mut payload: &GainControlSetGainRequest,
595 ) -> fidl::client::QueryResponseFut<
596 GainControlSetGainResult,
597 fdomain_client::fidl::FDomainResourceDialect,
598 > {
599 GainControlProxyInterface::r#set_gain(self, payload)
600 }
601
602 pub fn r#set_mute(
604 &self,
605 mut payload: &GainControlSetMuteRequest,
606 ) -> fidl::client::QueryResponseFut<
607 GainControlSetMuteResult,
608 fdomain_client::fidl::FDomainResourceDialect,
609 > {
610 GainControlProxyInterface::r#set_mute(self, payload)
611 }
612}
613
614impl GainControlProxyInterface for GainControlProxy {
615 type SetGainResponseFut = fidl::client::QueryResponseFut<
616 GainControlSetGainResult,
617 fdomain_client::fidl::FDomainResourceDialect,
618 >;
619 fn r#set_gain(&self, mut payload: &GainControlSetGainRequest) -> Self::SetGainResponseFut {
620 fn _decode(
621 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
622 ) -> Result<GainControlSetGainResult, fidl::Error> {
623 let _response = fidl::client::decode_transaction_body::<
624 fidl::encoding::ResultType<GainControlSetGainResponse, GainError>,
625 fdomain_client::fidl::FDomainResourceDialect,
626 0x6ece305e4a5823dc,
627 >(_buf?)?;
628 Ok(_response.map(|x| x))
629 }
630 self.client.send_query_and_decode::<GainControlSetGainRequest, GainControlSetGainResult>(
631 payload,
632 0x6ece305e4a5823dc,
633 fidl::encoding::DynamicFlags::empty(),
634 _decode,
635 )
636 }
637
638 type SetMuteResponseFut = fidl::client::QueryResponseFut<
639 GainControlSetMuteResult,
640 fdomain_client::fidl::FDomainResourceDialect,
641 >;
642 fn r#set_mute(&self, mut payload: &GainControlSetMuteRequest) -> Self::SetMuteResponseFut {
643 fn _decode(
644 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
645 ) -> Result<GainControlSetMuteResult, fidl::Error> {
646 let _response = fidl::client::decode_transaction_body::<
647 fidl::encoding::ResultType<GainControlSetMuteResponse, GainError>,
648 fdomain_client::fidl::FDomainResourceDialect,
649 0xed03d88ce4f8965,
650 >(_buf?)?;
651 Ok(_response.map(|x| x))
652 }
653 self.client.send_query_and_decode::<GainControlSetMuteRequest, GainControlSetMuteResult>(
654 payload,
655 0xed03d88ce4f8965,
656 fidl::encoding::DynamicFlags::empty(),
657 _decode,
658 )
659 }
660}
661
662pub struct GainControlEventStream {
663 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
664}
665
666impl std::marker::Unpin for GainControlEventStream {}
667
668impl futures::stream::FusedStream for GainControlEventStream {
669 fn is_terminated(&self) -> bool {
670 self.event_receiver.is_terminated()
671 }
672}
673
674impl futures::Stream for GainControlEventStream {
675 type Item = Result<GainControlEvent, fidl::Error>;
676
677 fn poll_next(
678 mut self: std::pin::Pin<&mut Self>,
679 cx: &mut std::task::Context<'_>,
680 ) -> std::task::Poll<Option<Self::Item>> {
681 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
682 &mut self.event_receiver,
683 cx
684 )?) {
685 Some(buf) => std::task::Poll::Ready(Some(GainControlEvent::decode(buf))),
686 None => std::task::Poll::Ready(None),
687 }
688 }
689}
690
691#[derive(Debug)]
692pub enum GainControlEvent {}
693
694impl GainControlEvent {
695 fn decode(
697 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
698 ) -> Result<GainControlEvent, fidl::Error> {
699 let (bytes, _handles) = buf.split_mut();
700 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
701 debug_assert_eq!(tx_header.tx_id, 0);
702 match tx_header.ordinal {
703 _ => Err(fidl::Error::UnknownOrdinal {
704 ordinal: tx_header.ordinal,
705 protocol_name:
706 <GainControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
707 }),
708 }
709 }
710}
711
712pub struct GainControlRequestStream {
714 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
715 is_terminated: bool,
716}
717
718impl std::marker::Unpin for GainControlRequestStream {}
719
720impl futures::stream::FusedStream for GainControlRequestStream {
721 fn is_terminated(&self) -> bool {
722 self.is_terminated
723 }
724}
725
726impl fdomain_client::fidl::RequestStream for GainControlRequestStream {
727 type Protocol = GainControlMarker;
728 type ControlHandle = GainControlControlHandle;
729
730 fn from_channel(channel: fdomain_client::Channel) -> Self {
731 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
732 }
733
734 fn control_handle(&self) -> Self::ControlHandle {
735 GainControlControlHandle { inner: self.inner.clone() }
736 }
737
738 fn into_inner(
739 self,
740 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
741 {
742 (self.inner, self.is_terminated)
743 }
744
745 fn from_inner(
746 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
747 is_terminated: bool,
748 ) -> Self {
749 Self { inner, is_terminated }
750 }
751}
752
753impl futures::Stream for GainControlRequestStream {
754 type Item = Result<GainControlRequest, fidl::Error>;
755
756 fn poll_next(
757 mut self: std::pin::Pin<&mut Self>,
758 cx: &mut std::task::Context<'_>,
759 ) -> std::task::Poll<Option<Self::Item>> {
760 let this = &mut *self;
761 if this.inner.check_shutdown(cx) {
762 this.is_terminated = true;
763 return std::task::Poll::Ready(None);
764 }
765 if this.is_terminated {
766 panic!("polled GainControlRequestStream after completion");
767 }
768 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
769 |bytes, handles| {
770 match this.inner.channel().read_etc(cx, bytes, handles) {
771 std::task::Poll::Ready(Ok(())) => {}
772 std::task::Poll::Pending => return std::task::Poll::Pending,
773 std::task::Poll::Ready(Err(None)) => {
774 this.is_terminated = true;
775 return std::task::Poll::Ready(None);
776 }
777 std::task::Poll::Ready(Err(Some(e))) => {
778 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
779 e.into(),
780 ))));
781 }
782 }
783
784 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
786
787 std::task::Poll::Ready(Some(match header.ordinal {
788 0x6ece305e4a5823dc => {
789 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
790 let mut req = fidl::new_empty!(
791 GainControlSetGainRequest,
792 fdomain_client::fidl::FDomainResourceDialect
793 );
794 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<GainControlSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
795 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
796 Ok(GainControlRequest::SetGain {
797 payload: req,
798 responder: GainControlSetGainResponder {
799 control_handle: std::mem::ManuallyDrop::new(control_handle),
800 tx_id: header.tx_id,
801 },
802 })
803 }
804 0xed03d88ce4f8965 => {
805 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
806 let mut req = fidl::new_empty!(
807 GainControlSetMuteRequest,
808 fdomain_client::fidl::FDomainResourceDialect
809 );
810 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<GainControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
811 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
812 Ok(GainControlRequest::SetMute {
813 payload: req,
814 responder: GainControlSetMuteResponder {
815 control_handle: std::mem::ManuallyDrop::new(control_handle),
816 tx_id: header.tx_id,
817 },
818 })
819 }
820 _ => Err(fidl::Error::UnknownOrdinal {
821 ordinal: header.ordinal,
822 protocol_name:
823 <GainControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
824 }),
825 }))
826 },
827 )
828 }
829}
830
831#[derive(Debug)]
859pub enum GainControlRequest {
860 SetGain { payload: GainControlSetGainRequest, responder: GainControlSetGainResponder },
862 SetMute { payload: GainControlSetMuteRequest, responder: GainControlSetMuteResponder },
864}
865
866impl GainControlRequest {
867 #[allow(irrefutable_let_patterns)]
868 pub fn into_set_gain(self) -> Option<(GainControlSetGainRequest, GainControlSetGainResponder)> {
869 if let GainControlRequest::SetGain { payload, responder } = self {
870 Some((payload, responder))
871 } else {
872 None
873 }
874 }
875
876 #[allow(irrefutable_let_patterns)]
877 pub fn into_set_mute(self) -> Option<(GainControlSetMuteRequest, GainControlSetMuteResponder)> {
878 if let GainControlRequest::SetMute { payload, responder } = self {
879 Some((payload, responder))
880 } else {
881 None
882 }
883 }
884
885 pub fn method_name(&self) -> &'static str {
887 match *self {
888 GainControlRequest::SetGain { .. } => "set_gain",
889 GainControlRequest::SetMute { .. } => "set_mute",
890 }
891 }
892}
893
894#[derive(Debug, Clone)]
895pub struct GainControlControlHandle {
896 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
897}
898
899impl GainControlControlHandle {
900 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
901 self.inner.shutdown_with_epitaph(status.into())
902 }
903}
904
905impl fdomain_client::fidl::ControlHandle for GainControlControlHandle {
906 fn shutdown(&self) {
907 self.inner.shutdown()
908 }
909
910 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
911 self.inner.shutdown_with_epitaph(status)
912 }
913
914 fn is_closed(&self) -> bool {
915 self.inner.channel().is_closed()
916 }
917 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
918 self.inner.channel().on_closed()
919 }
920}
921
922impl GainControlControlHandle {}
923
924#[must_use = "FIDL methods require a response to be sent"]
925#[derive(Debug)]
926pub struct GainControlSetGainResponder {
927 control_handle: std::mem::ManuallyDrop<GainControlControlHandle>,
928 tx_id: u32,
929}
930
931impl std::ops::Drop for GainControlSetGainResponder {
935 fn drop(&mut self) {
936 self.control_handle.shutdown();
937 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
939 }
940}
941
942impl fdomain_client::fidl::Responder for GainControlSetGainResponder {
943 type ControlHandle = GainControlControlHandle;
944
945 fn control_handle(&self) -> &GainControlControlHandle {
946 &self.control_handle
947 }
948
949 fn drop_without_shutdown(mut self) {
950 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
952 std::mem::forget(self);
954 }
955}
956
957impl GainControlSetGainResponder {
958 pub fn send(
962 self,
963 mut result: Result<&GainControlSetGainResponse, GainError>,
964 ) -> Result<(), fidl::Error> {
965 let _result = self.send_raw(result);
966 if _result.is_err() {
967 self.control_handle.shutdown();
968 }
969 self.drop_without_shutdown();
970 _result
971 }
972
973 pub fn send_no_shutdown_on_err(
975 self,
976 mut result: Result<&GainControlSetGainResponse, GainError>,
977 ) -> Result<(), fidl::Error> {
978 let _result = self.send_raw(result);
979 self.drop_without_shutdown();
980 _result
981 }
982
983 fn send_raw(
984 &self,
985 mut result: Result<&GainControlSetGainResponse, GainError>,
986 ) -> Result<(), fidl::Error> {
987 self.control_handle
988 .inner
989 .send::<fidl::encoding::ResultType<GainControlSetGainResponse, GainError>>(
990 result,
991 self.tx_id,
992 0x6ece305e4a5823dc,
993 fidl::encoding::DynamicFlags::empty(),
994 )
995 }
996}
997
998#[must_use = "FIDL methods require a response to be sent"]
999#[derive(Debug)]
1000pub struct GainControlSetMuteResponder {
1001 control_handle: std::mem::ManuallyDrop<GainControlControlHandle>,
1002 tx_id: u32,
1003}
1004
1005impl std::ops::Drop for GainControlSetMuteResponder {
1009 fn drop(&mut self) {
1010 self.control_handle.shutdown();
1011 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1013 }
1014}
1015
1016impl fdomain_client::fidl::Responder for GainControlSetMuteResponder {
1017 type ControlHandle = GainControlControlHandle;
1018
1019 fn control_handle(&self) -> &GainControlControlHandle {
1020 &self.control_handle
1021 }
1022
1023 fn drop_without_shutdown(mut self) {
1024 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1026 std::mem::forget(self);
1028 }
1029}
1030
1031impl GainControlSetMuteResponder {
1032 pub fn send(
1036 self,
1037 mut result: Result<&GainControlSetMuteResponse, GainError>,
1038 ) -> Result<(), fidl::Error> {
1039 let _result = self.send_raw(result);
1040 if _result.is_err() {
1041 self.control_handle.shutdown();
1042 }
1043 self.drop_without_shutdown();
1044 _result
1045 }
1046
1047 pub fn send_no_shutdown_on_err(
1049 self,
1050 mut result: Result<&GainControlSetMuteResponse, GainError>,
1051 ) -> Result<(), fidl::Error> {
1052 let _result = self.send_raw(result);
1053 self.drop_without_shutdown();
1054 _result
1055 }
1056
1057 fn send_raw(
1058 &self,
1059 mut result: Result<&GainControlSetMuteResponse, GainError>,
1060 ) -> Result<(), fidl::Error> {
1061 self.control_handle
1062 .inner
1063 .send::<fidl::encoding::ResultType<GainControlSetMuteResponse, GainError>>(
1064 result,
1065 self.tx_id,
1066 0xed03d88ce4f8965,
1067 fidl::encoding::DynamicFlags::empty(),
1068 )
1069 }
1070}
1071
1072#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1073pub struct StreamSinkMarker;
1074
1075impl fdomain_client::fidl::ProtocolMarker for StreamSinkMarker {
1076 type Proxy = StreamSinkProxy;
1077 type RequestStream = StreamSinkRequestStream;
1078
1079 const DEBUG_NAME: &'static str = "(anonymous) StreamSink";
1080}
1081
1082pub trait StreamSinkProxyInterface: Send + Sync {
1083 fn r#put_packet(&self, payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error>;
1084 fn r#start_segment(&self, payload: &StreamSinkStartSegmentRequest) -> Result<(), fidl::Error>;
1085 fn r#end(&self) -> Result<(), fidl::Error>;
1086 fn r#will_close(&self, payload: &StreamSinkWillCloseRequest) -> Result<(), fidl::Error>;
1087}
1088
1089#[derive(Debug, Clone)]
1090pub struct StreamSinkProxy {
1091 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1092}
1093
1094impl fdomain_client::fidl::Proxy for StreamSinkProxy {
1095 type Protocol = StreamSinkMarker;
1096
1097 fn from_channel(inner: fdomain_client::Channel) -> Self {
1098 Self::new(inner)
1099 }
1100
1101 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1102 self.client.into_channel().map_err(|client| Self { client })
1103 }
1104
1105 fn as_channel(&self) -> &fdomain_client::Channel {
1106 self.client.as_channel()
1107 }
1108}
1109
1110impl StreamSinkProxy {
1111 pub fn new(channel: fdomain_client::Channel) -> Self {
1113 let protocol_name = <StreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1114 Self { client: fidl::client::Client::new(channel, protocol_name) }
1115 }
1116
1117 pub fn take_event_stream(&self) -> StreamSinkEventStream {
1123 StreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
1124 }
1125
1126 pub fn r#put_packet(&self, mut payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error> {
1128 StreamSinkProxyInterface::r#put_packet(self, payload)
1129 }
1130
1131 pub fn r#start_segment(
1134 &self,
1135 mut payload: &StreamSinkStartSegmentRequest,
1136 ) -> Result<(), fidl::Error> {
1137 StreamSinkProxyInterface::r#start_segment(self, payload)
1138 }
1139
1140 pub fn r#end(&self) -> Result<(), fidl::Error> {
1146 StreamSinkProxyInterface::r#end(self)
1147 }
1148
1149 pub fn r#will_close(
1153 &self,
1154 mut payload: &StreamSinkWillCloseRequest,
1155 ) -> Result<(), fidl::Error> {
1156 StreamSinkProxyInterface::r#will_close(self, payload)
1157 }
1158}
1159
1160impl StreamSinkProxyInterface for StreamSinkProxy {
1161 fn r#put_packet(&self, mut payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error> {
1162 self.client.send::<StreamSinkPutPacketRequest>(
1163 &mut payload,
1164 0x558d757afd726899,
1165 fidl::encoding::DynamicFlags::empty(),
1166 )
1167 }
1168
1169 fn r#start_segment(
1170 &self,
1171 mut payload: &StreamSinkStartSegmentRequest,
1172 ) -> Result<(), fidl::Error> {
1173 self.client.send::<StreamSinkStartSegmentRequest>(
1174 payload,
1175 0x6dd9bc66aa9f715f,
1176 fidl::encoding::DynamicFlags::empty(),
1177 )
1178 }
1179
1180 fn r#end(&self) -> Result<(), fidl::Error> {
1181 self.client.send::<fidl::encoding::EmptyPayload>(
1182 (),
1183 0x1a3a528e83b32f6e,
1184 fidl::encoding::DynamicFlags::empty(),
1185 )
1186 }
1187
1188 fn r#will_close(&self, mut payload: &StreamSinkWillCloseRequest) -> Result<(), fidl::Error> {
1189 self.client.send::<StreamSinkWillCloseRequest>(
1190 payload,
1191 0x6303ee33dbb0fd11,
1192 fidl::encoding::DynamicFlags::empty(),
1193 )
1194 }
1195}
1196
1197pub struct StreamSinkEventStream {
1198 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1199}
1200
1201impl std::marker::Unpin for StreamSinkEventStream {}
1202
1203impl futures::stream::FusedStream for StreamSinkEventStream {
1204 fn is_terminated(&self) -> bool {
1205 self.event_receiver.is_terminated()
1206 }
1207}
1208
1209impl futures::Stream for StreamSinkEventStream {
1210 type Item = Result<StreamSinkEvent, fidl::Error>;
1211
1212 fn poll_next(
1213 mut self: std::pin::Pin<&mut Self>,
1214 cx: &mut std::task::Context<'_>,
1215 ) -> std::task::Poll<Option<Self::Item>> {
1216 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1217 &mut self.event_receiver,
1218 cx
1219 )?) {
1220 Some(buf) => std::task::Poll::Ready(Some(StreamSinkEvent::decode(buf))),
1221 None => std::task::Poll::Ready(None),
1222 }
1223 }
1224}
1225
1226#[derive(Debug)]
1227pub enum StreamSinkEvent {
1228 OnWillClose { payload: StreamSinkOnWillCloseRequest },
1229}
1230
1231impl StreamSinkEvent {
1232 #[allow(irrefutable_let_patterns)]
1233 pub fn into_on_will_close(self) -> Option<StreamSinkOnWillCloseRequest> {
1234 if let StreamSinkEvent::OnWillClose { payload } = self { Some((payload)) } else { None }
1235 }
1236
1237 fn decode(
1239 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1240 ) -> Result<StreamSinkEvent, fidl::Error> {
1241 let (bytes, _handles) = buf.split_mut();
1242 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1243 debug_assert_eq!(tx_header.tx_id, 0);
1244 match tx_header.ordinal {
1245 0x77093453926bce5b => {
1246 let mut out = fidl::new_empty!(
1247 StreamSinkOnWillCloseRequest,
1248 fdomain_client::fidl::FDomainResourceDialect
1249 );
1250 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamSinkOnWillCloseRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1251 Ok((StreamSinkEvent::OnWillClose { payload: out }))
1252 }
1253 _ => Err(fidl::Error::UnknownOrdinal {
1254 ordinal: tx_header.ordinal,
1255 protocol_name:
1256 <StreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1257 }),
1258 }
1259 }
1260}
1261
1262pub struct StreamSinkRequestStream {
1264 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1265 is_terminated: bool,
1266}
1267
1268impl std::marker::Unpin for StreamSinkRequestStream {}
1269
1270impl futures::stream::FusedStream for StreamSinkRequestStream {
1271 fn is_terminated(&self) -> bool {
1272 self.is_terminated
1273 }
1274}
1275
1276impl fdomain_client::fidl::RequestStream for StreamSinkRequestStream {
1277 type Protocol = StreamSinkMarker;
1278 type ControlHandle = StreamSinkControlHandle;
1279
1280 fn from_channel(channel: fdomain_client::Channel) -> Self {
1281 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1282 }
1283
1284 fn control_handle(&self) -> Self::ControlHandle {
1285 StreamSinkControlHandle { inner: self.inner.clone() }
1286 }
1287
1288 fn into_inner(
1289 self,
1290 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1291 {
1292 (self.inner, self.is_terminated)
1293 }
1294
1295 fn from_inner(
1296 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1297 is_terminated: bool,
1298 ) -> Self {
1299 Self { inner, is_terminated }
1300 }
1301}
1302
1303impl futures::Stream for StreamSinkRequestStream {
1304 type Item = Result<StreamSinkRequest, fidl::Error>;
1305
1306 fn poll_next(
1307 mut self: std::pin::Pin<&mut Self>,
1308 cx: &mut std::task::Context<'_>,
1309 ) -> std::task::Poll<Option<Self::Item>> {
1310 let this = &mut *self;
1311 if this.inner.check_shutdown(cx) {
1312 this.is_terminated = true;
1313 return std::task::Poll::Ready(None);
1314 }
1315 if this.is_terminated {
1316 panic!("polled StreamSinkRequestStream after completion");
1317 }
1318 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1319 |bytes, handles| {
1320 match this.inner.channel().read_etc(cx, bytes, handles) {
1321 std::task::Poll::Ready(Ok(())) => {}
1322 std::task::Poll::Pending => return std::task::Poll::Pending,
1323 std::task::Poll::Ready(Err(None)) => {
1324 this.is_terminated = true;
1325 return std::task::Poll::Ready(None);
1326 }
1327 std::task::Poll::Ready(Err(Some(e))) => {
1328 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1329 e.into(),
1330 ))));
1331 }
1332 }
1333
1334 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1336
1337 std::task::Poll::Ready(Some(match header.ordinal {
1338 0x558d757afd726899 => {
1339 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1340 let mut req = fidl::new_empty!(
1341 StreamSinkPutPacketRequest,
1342 fdomain_client::fidl::FDomainResourceDialect
1343 );
1344 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamSinkPutPacketRequest>(&header, _body_bytes, handles, &mut req)?;
1345 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1346 Ok(StreamSinkRequest::PutPacket { payload: req, control_handle })
1347 }
1348 0x6dd9bc66aa9f715f => {
1349 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1350 let mut req = fidl::new_empty!(
1351 StreamSinkStartSegmentRequest,
1352 fdomain_client::fidl::FDomainResourceDialect
1353 );
1354 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamSinkStartSegmentRequest>(&header, _body_bytes, handles, &mut req)?;
1355 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1356 Ok(StreamSinkRequest::StartSegment { payload: req, control_handle })
1357 }
1358 0x1a3a528e83b32f6e => {
1359 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1360 let mut req = fidl::new_empty!(
1361 fidl::encoding::EmptyPayload,
1362 fdomain_client::fidl::FDomainResourceDialect
1363 );
1364 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1365 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1366 Ok(StreamSinkRequest::End { control_handle })
1367 }
1368 0x6303ee33dbb0fd11 => {
1369 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1370 let mut req = fidl::new_empty!(
1371 StreamSinkWillCloseRequest,
1372 fdomain_client::fidl::FDomainResourceDialect
1373 );
1374 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamSinkWillCloseRequest>(&header, _body_bytes, handles, &mut req)?;
1375 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1376 Ok(StreamSinkRequest::WillClose { payload: req, control_handle })
1377 }
1378 _ => Err(fidl::Error::UnknownOrdinal {
1379 ordinal: header.ordinal,
1380 protocol_name:
1381 <StreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1382 }),
1383 }))
1384 },
1385 )
1386 }
1387}
1388
1389#[derive(Debug)]
1392pub enum StreamSinkRequest {
1393 PutPacket { payload: StreamSinkPutPacketRequest, control_handle: StreamSinkControlHandle },
1395 StartSegment { payload: StreamSinkStartSegmentRequest, control_handle: StreamSinkControlHandle },
1398 End { control_handle: StreamSinkControlHandle },
1404 WillClose { payload: StreamSinkWillCloseRequest, control_handle: StreamSinkControlHandle },
1408}
1409
1410impl StreamSinkRequest {
1411 #[allow(irrefutable_let_patterns)]
1412 pub fn into_put_packet(self) -> Option<(StreamSinkPutPacketRequest, StreamSinkControlHandle)> {
1413 if let StreamSinkRequest::PutPacket { payload, control_handle } = self {
1414 Some((payload, control_handle))
1415 } else {
1416 None
1417 }
1418 }
1419
1420 #[allow(irrefutable_let_patterns)]
1421 pub fn into_start_segment(
1422 self,
1423 ) -> Option<(StreamSinkStartSegmentRequest, StreamSinkControlHandle)> {
1424 if let StreamSinkRequest::StartSegment { payload, control_handle } = self {
1425 Some((payload, control_handle))
1426 } else {
1427 None
1428 }
1429 }
1430
1431 #[allow(irrefutable_let_patterns)]
1432 pub fn into_end(self) -> Option<(StreamSinkControlHandle)> {
1433 if let StreamSinkRequest::End { control_handle } = self {
1434 Some((control_handle))
1435 } else {
1436 None
1437 }
1438 }
1439
1440 #[allow(irrefutable_let_patterns)]
1441 pub fn into_will_close(self) -> Option<(StreamSinkWillCloseRequest, StreamSinkControlHandle)> {
1442 if let StreamSinkRequest::WillClose { payload, control_handle } = self {
1443 Some((payload, control_handle))
1444 } else {
1445 None
1446 }
1447 }
1448
1449 pub fn method_name(&self) -> &'static str {
1451 match *self {
1452 StreamSinkRequest::PutPacket { .. } => "put_packet",
1453 StreamSinkRequest::StartSegment { .. } => "start_segment",
1454 StreamSinkRequest::End { .. } => "end",
1455 StreamSinkRequest::WillClose { .. } => "will_close",
1456 }
1457 }
1458}
1459
1460#[derive(Debug, Clone)]
1461pub struct StreamSinkControlHandle {
1462 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1463}
1464
1465impl StreamSinkControlHandle {
1466 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1467 self.inner.shutdown_with_epitaph(status.into())
1468 }
1469}
1470
1471impl fdomain_client::fidl::ControlHandle for StreamSinkControlHandle {
1472 fn shutdown(&self) {
1473 self.inner.shutdown()
1474 }
1475
1476 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1477 self.inner.shutdown_with_epitaph(status)
1478 }
1479
1480 fn is_closed(&self) -> bool {
1481 self.inner.channel().is_closed()
1482 }
1483 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1484 self.inner.channel().on_closed()
1485 }
1486}
1487
1488impl StreamSinkControlHandle {
1489 pub fn send_on_will_close(
1490 &self,
1491 mut payload: &StreamSinkOnWillCloseRequest,
1492 ) -> Result<(), fidl::Error> {
1493 self.inner.send::<StreamSinkOnWillCloseRequest>(
1494 payload,
1495 0,
1496 0x77093453926bce5b,
1497 fidl::encoding::DynamicFlags::empty(),
1498 )
1499 }
1500}
1501
1502mod internal {
1503 use super::*;
1504
1505 impl RingBuffer {
1506 #[inline(always)]
1507 fn max_ordinal_present(&self) -> u64 {
1508 if let Some(_) = self.reference_clock_domain {
1509 return 6;
1510 }
1511 if let Some(_) = self.reference_clock {
1512 return 5;
1513 }
1514 if let Some(_) = self.consumer_bytes {
1515 return 4;
1516 }
1517 if let Some(_) = self.producer_bytes {
1518 return 3;
1519 }
1520 if let Some(_) = self.format {
1521 return 2;
1522 }
1523 if let Some(_) = self.buffer {
1524 return 1;
1525 }
1526 0
1527 }
1528 }
1529
1530 impl fidl::encoding::ResourceTypeMarker for RingBuffer {
1531 type Borrowed<'a> = &'a mut Self;
1532 fn take_or_borrow<'a>(
1533 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1534 ) -> Self::Borrowed<'a> {
1535 value
1536 }
1537 }
1538
1539 unsafe impl fidl::encoding::TypeMarker for RingBuffer {
1540 type Owned = Self;
1541
1542 #[inline(always)]
1543 fn inline_align(_context: fidl::encoding::Context) -> usize {
1544 8
1545 }
1546
1547 #[inline(always)]
1548 fn inline_size(_context: fidl::encoding::Context) -> usize {
1549 16
1550 }
1551 }
1552
1553 unsafe impl fidl::encoding::Encode<RingBuffer, fdomain_client::fidl::FDomainResourceDialect>
1554 for &mut RingBuffer
1555 {
1556 unsafe fn encode(
1557 self,
1558 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1559 offset: usize,
1560 mut depth: fidl::encoding::Depth,
1561 ) -> fidl::Result<()> {
1562 encoder.debug_check_bounds::<RingBuffer>(offset);
1563 let max_ordinal: u64 = self.max_ordinal_present();
1565 encoder.write_num(max_ordinal, offset);
1566 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1567 if max_ordinal == 0 {
1569 return Ok(());
1570 }
1571 depth.increment()?;
1572 let envelope_size = 8;
1573 let bytes_len = max_ordinal as usize * envelope_size;
1574 #[allow(unused_variables)]
1575 let offset = encoder.out_of_line_offset(bytes_len);
1576 let mut _prev_end_offset: usize = 0;
1577 if 1 > max_ordinal {
1578 return Ok(());
1579 }
1580
1581 let cur_offset: usize = (1 - 1) * envelope_size;
1584
1585 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1587
1588 fidl::encoding::encode_in_envelope_optional::<fdomain_fuchsia_mem::Buffer, fdomain_client::fidl::FDomainResourceDialect>(
1593 self.buffer.as_mut().map(<fdomain_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1594 encoder, offset + cur_offset, depth
1595 )?;
1596
1597 _prev_end_offset = cur_offset + envelope_size;
1598 if 2 > max_ordinal {
1599 return Ok(());
1600 }
1601
1602 let cur_offset: usize = (2 - 1) * envelope_size;
1605
1606 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1608
1609 fidl::encoding::encode_in_envelope_optional::<
1614 Format,
1615 fdomain_client::fidl::FDomainResourceDialect,
1616 >(
1617 self.format.as_ref().map(<Format as fidl::encoding::ValueTypeMarker>::borrow),
1618 encoder,
1619 offset + cur_offset,
1620 depth,
1621 )?;
1622
1623 _prev_end_offset = cur_offset + envelope_size;
1624 if 3 > max_ordinal {
1625 return Ok(());
1626 }
1627
1628 let cur_offset: usize = (3 - 1) * envelope_size;
1631
1632 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1634
1635 fidl::encoding::encode_in_envelope_optional::<
1640 u64,
1641 fdomain_client::fidl::FDomainResourceDialect,
1642 >(
1643 self.producer_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1644 encoder,
1645 offset + cur_offset,
1646 depth,
1647 )?;
1648
1649 _prev_end_offset = cur_offset + envelope_size;
1650 if 4 > max_ordinal {
1651 return Ok(());
1652 }
1653
1654 let cur_offset: usize = (4 - 1) * envelope_size;
1657
1658 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1660
1661 fidl::encoding::encode_in_envelope_optional::<
1666 u64,
1667 fdomain_client::fidl::FDomainResourceDialect,
1668 >(
1669 self.consumer_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1670 encoder,
1671 offset + cur_offset,
1672 depth,
1673 )?;
1674
1675 _prev_end_offset = cur_offset + envelope_size;
1676 if 5 > max_ordinal {
1677 return Ok(());
1678 }
1679
1680 let cur_offset: usize = (5 - 1) * envelope_size;
1683
1684 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1686
1687 fidl::encoding::encode_in_envelope_optional::<
1692 fidl::encoding::HandleType<
1693 fdomain_client::Clock,
1694 { fidl::ObjectType::CLOCK.into_raw() },
1695 2147483648,
1696 >,
1697 fdomain_client::fidl::FDomainResourceDialect,
1698 >(
1699 self.reference_clock.as_mut().map(
1700 <fidl::encoding::HandleType<
1701 fdomain_client::Clock,
1702 { fidl::ObjectType::CLOCK.into_raw() },
1703 2147483648,
1704 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1705 ),
1706 encoder,
1707 offset + cur_offset,
1708 depth,
1709 )?;
1710
1711 _prev_end_offset = cur_offset + envelope_size;
1712 if 6 > max_ordinal {
1713 return Ok(());
1714 }
1715
1716 let cur_offset: usize = (6 - 1) * envelope_size;
1719
1720 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1722
1723 fidl::encoding::encode_in_envelope_optional::<
1728 u32,
1729 fdomain_client::fidl::FDomainResourceDialect,
1730 >(
1731 self.reference_clock_domain
1732 .as_ref()
1733 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1734 encoder,
1735 offset + cur_offset,
1736 depth,
1737 )?;
1738
1739 _prev_end_offset = cur_offset + envelope_size;
1740
1741 Ok(())
1742 }
1743 }
1744
1745 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for RingBuffer {
1746 #[inline(always)]
1747 fn new_empty() -> Self {
1748 Self::default()
1749 }
1750
1751 unsafe fn decode(
1752 &mut self,
1753 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1754 offset: usize,
1755 mut depth: fidl::encoding::Depth,
1756 ) -> fidl::Result<()> {
1757 decoder.debug_check_bounds::<Self>(offset);
1758 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1759 None => return Err(fidl::Error::NotNullable),
1760 Some(len) => len,
1761 };
1762 if len == 0 {
1764 return Ok(());
1765 };
1766 depth.increment()?;
1767 let envelope_size = 8;
1768 let bytes_len = len * envelope_size;
1769 let offset = decoder.out_of_line_offset(bytes_len)?;
1770 let mut _next_ordinal_to_read = 0;
1772 let mut next_offset = offset;
1773 let end_offset = offset + bytes_len;
1774 _next_ordinal_to_read += 1;
1775 if next_offset >= end_offset {
1776 return Ok(());
1777 }
1778
1779 while _next_ordinal_to_read < 1 {
1781 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1782 _next_ordinal_to_read += 1;
1783 next_offset += envelope_size;
1784 }
1785
1786 let next_out_of_line = decoder.next_out_of_line();
1787 let handles_before = decoder.remaining_handles();
1788 if let Some((inlined, num_bytes, num_handles)) =
1789 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1790 {
1791 let member_inline_size =
1792 <fdomain_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
1793 decoder.context,
1794 );
1795 if inlined != (member_inline_size <= 4) {
1796 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1797 }
1798 let inner_offset;
1799 let mut inner_depth = depth.clone();
1800 if inlined {
1801 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1802 inner_offset = next_offset;
1803 } else {
1804 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1805 inner_depth.increment()?;
1806 }
1807 let val_ref = self.buffer.get_or_insert_with(|| {
1808 fidl::new_empty!(
1809 fdomain_fuchsia_mem::Buffer,
1810 fdomain_client::fidl::FDomainResourceDialect
1811 )
1812 });
1813 fidl::decode!(
1814 fdomain_fuchsia_mem::Buffer,
1815 fdomain_client::fidl::FDomainResourceDialect,
1816 val_ref,
1817 decoder,
1818 inner_offset,
1819 inner_depth
1820 )?;
1821 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1822 {
1823 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1824 }
1825 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1826 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1827 }
1828 }
1829
1830 next_offset += envelope_size;
1831 _next_ordinal_to_read += 1;
1832 if next_offset >= end_offset {
1833 return Ok(());
1834 }
1835
1836 while _next_ordinal_to_read < 2 {
1838 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1839 _next_ordinal_to_read += 1;
1840 next_offset += envelope_size;
1841 }
1842
1843 let next_out_of_line = decoder.next_out_of_line();
1844 let handles_before = decoder.remaining_handles();
1845 if let Some((inlined, num_bytes, num_handles)) =
1846 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1847 {
1848 let member_inline_size =
1849 <Format as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1850 if inlined != (member_inline_size <= 4) {
1851 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1852 }
1853 let inner_offset;
1854 let mut inner_depth = depth.clone();
1855 if inlined {
1856 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1857 inner_offset = next_offset;
1858 } else {
1859 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1860 inner_depth.increment()?;
1861 }
1862 let val_ref = self.format.get_or_insert_with(|| {
1863 fidl::new_empty!(Format, fdomain_client::fidl::FDomainResourceDialect)
1864 });
1865 fidl::decode!(
1866 Format,
1867 fdomain_client::fidl::FDomainResourceDialect,
1868 val_ref,
1869 decoder,
1870 inner_offset,
1871 inner_depth
1872 )?;
1873 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1874 {
1875 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1876 }
1877 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1878 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1879 }
1880 }
1881
1882 next_offset += envelope_size;
1883 _next_ordinal_to_read += 1;
1884 if next_offset >= end_offset {
1885 return Ok(());
1886 }
1887
1888 while _next_ordinal_to_read < 3 {
1890 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1891 _next_ordinal_to_read += 1;
1892 next_offset += envelope_size;
1893 }
1894
1895 let next_out_of_line = decoder.next_out_of_line();
1896 let handles_before = decoder.remaining_handles();
1897 if let Some((inlined, num_bytes, num_handles)) =
1898 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1899 {
1900 let member_inline_size =
1901 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1902 if inlined != (member_inline_size <= 4) {
1903 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1904 }
1905 let inner_offset;
1906 let mut inner_depth = depth.clone();
1907 if inlined {
1908 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1909 inner_offset = next_offset;
1910 } else {
1911 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1912 inner_depth.increment()?;
1913 }
1914 let val_ref = self.producer_bytes.get_or_insert_with(|| {
1915 fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
1916 });
1917 fidl::decode!(
1918 u64,
1919 fdomain_client::fidl::FDomainResourceDialect,
1920 val_ref,
1921 decoder,
1922 inner_offset,
1923 inner_depth
1924 )?;
1925 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1926 {
1927 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1928 }
1929 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1930 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1931 }
1932 }
1933
1934 next_offset += envelope_size;
1935 _next_ordinal_to_read += 1;
1936 if next_offset >= end_offset {
1937 return Ok(());
1938 }
1939
1940 while _next_ordinal_to_read < 4 {
1942 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1943 _next_ordinal_to_read += 1;
1944 next_offset += envelope_size;
1945 }
1946
1947 let next_out_of_line = decoder.next_out_of_line();
1948 let handles_before = decoder.remaining_handles();
1949 if let Some((inlined, num_bytes, num_handles)) =
1950 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1951 {
1952 let member_inline_size =
1953 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1954 if inlined != (member_inline_size <= 4) {
1955 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1956 }
1957 let inner_offset;
1958 let mut inner_depth = depth.clone();
1959 if inlined {
1960 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1961 inner_offset = next_offset;
1962 } else {
1963 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1964 inner_depth.increment()?;
1965 }
1966 let val_ref = self.consumer_bytes.get_or_insert_with(|| {
1967 fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
1968 });
1969 fidl::decode!(
1970 u64,
1971 fdomain_client::fidl::FDomainResourceDialect,
1972 val_ref,
1973 decoder,
1974 inner_offset,
1975 inner_depth
1976 )?;
1977 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1978 {
1979 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1980 }
1981 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1982 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1983 }
1984 }
1985
1986 next_offset += envelope_size;
1987 _next_ordinal_to_read += 1;
1988 if next_offset >= end_offset {
1989 return Ok(());
1990 }
1991
1992 while _next_ordinal_to_read < 5 {
1994 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1995 _next_ordinal_to_read += 1;
1996 next_offset += envelope_size;
1997 }
1998
1999 let next_out_of_line = decoder.next_out_of_line();
2000 let handles_before = decoder.remaining_handles();
2001 if let Some((inlined, num_bytes, num_handles)) =
2002 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2003 {
2004 let member_inline_size = <fidl::encoding::HandleType<
2005 fdomain_client::Clock,
2006 { fidl::ObjectType::CLOCK.into_raw() },
2007 2147483648,
2008 > as fidl::encoding::TypeMarker>::inline_size(
2009 decoder.context
2010 );
2011 if inlined != (member_inline_size <= 4) {
2012 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2013 }
2014 let inner_offset;
2015 let mut inner_depth = depth.clone();
2016 if inlined {
2017 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2018 inner_offset = next_offset;
2019 } else {
2020 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2021 inner_depth.increment()?;
2022 }
2023 let val_ref =
2024 self.reference_clock.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect));
2025 fidl::decode!(fidl::encoding::HandleType<fdomain_client::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2026 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2027 {
2028 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2029 }
2030 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2031 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2032 }
2033 }
2034
2035 next_offset += envelope_size;
2036 _next_ordinal_to_read += 1;
2037 if next_offset >= end_offset {
2038 return Ok(());
2039 }
2040
2041 while _next_ordinal_to_read < 6 {
2043 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2044 _next_ordinal_to_read += 1;
2045 next_offset += envelope_size;
2046 }
2047
2048 let next_out_of_line = decoder.next_out_of_line();
2049 let handles_before = decoder.remaining_handles();
2050 if let Some((inlined, num_bytes, num_handles)) =
2051 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2052 {
2053 let member_inline_size =
2054 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2055 if inlined != (member_inline_size <= 4) {
2056 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2057 }
2058 let inner_offset;
2059 let mut inner_depth = depth.clone();
2060 if inlined {
2061 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2062 inner_offset = next_offset;
2063 } else {
2064 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2065 inner_depth.increment()?;
2066 }
2067 let val_ref = self.reference_clock_domain.get_or_insert_with(|| {
2068 fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect)
2069 });
2070 fidl::decode!(
2071 u32,
2072 fdomain_client::fidl::FDomainResourceDialect,
2073 val_ref,
2074 decoder,
2075 inner_offset,
2076 inner_depth
2077 )?;
2078 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2079 {
2080 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2081 }
2082 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2083 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2084 }
2085 }
2086
2087 next_offset += envelope_size;
2088
2089 while next_offset < end_offset {
2091 _next_ordinal_to_read += 1;
2092 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2093 next_offset += envelope_size;
2094 }
2095
2096 Ok(())
2097 }
2098 }
2099
2100 impl StreamSinkPutPacketRequest {
2101 #[inline(always)]
2102 fn max_ordinal_present(&self) -> u64 {
2103 if let Some(_) = self.release_fence {
2104 return 2;
2105 }
2106 if let Some(_) = self.packet {
2107 return 1;
2108 }
2109 0
2110 }
2111 }
2112
2113 impl fidl::encoding::ResourceTypeMarker for StreamSinkPutPacketRequest {
2114 type Borrowed<'a> = &'a mut Self;
2115 fn take_or_borrow<'a>(
2116 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2117 ) -> Self::Borrowed<'a> {
2118 value
2119 }
2120 }
2121
2122 unsafe impl fidl::encoding::TypeMarker for StreamSinkPutPacketRequest {
2123 type Owned = Self;
2124
2125 #[inline(always)]
2126 fn inline_align(_context: fidl::encoding::Context) -> usize {
2127 8
2128 }
2129
2130 #[inline(always)]
2131 fn inline_size(_context: fidl::encoding::Context) -> usize {
2132 16
2133 }
2134 }
2135
2136 unsafe impl
2137 fidl::encoding::Encode<
2138 StreamSinkPutPacketRequest,
2139 fdomain_client::fidl::FDomainResourceDialect,
2140 > for &mut StreamSinkPutPacketRequest
2141 {
2142 unsafe fn encode(
2143 self,
2144 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2145 offset: usize,
2146 mut depth: fidl::encoding::Depth,
2147 ) -> fidl::Result<()> {
2148 encoder.debug_check_bounds::<StreamSinkPutPacketRequest>(offset);
2149 let max_ordinal: u64 = self.max_ordinal_present();
2151 encoder.write_num(max_ordinal, offset);
2152 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2153 if max_ordinal == 0 {
2155 return Ok(());
2156 }
2157 depth.increment()?;
2158 let envelope_size = 8;
2159 let bytes_len = max_ordinal as usize * envelope_size;
2160 #[allow(unused_variables)]
2161 let offset = encoder.out_of_line_offset(bytes_len);
2162 let mut _prev_end_offset: usize = 0;
2163 if 1 > max_ordinal {
2164 return Ok(());
2165 }
2166
2167 let cur_offset: usize = (1 - 1) * envelope_size;
2170
2171 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2173
2174 fidl::encoding::encode_in_envelope_optional::<
2179 Packet,
2180 fdomain_client::fidl::FDomainResourceDialect,
2181 >(
2182 self.packet.as_ref().map(<Packet as fidl::encoding::ValueTypeMarker>::borrow),
2183 encoder,
2184 offset + cur_offset,
2185 depth,
2186 )?;
2187
2188 _prev_end_offset = cur_offset + envelope_size;
2189 if 2 > max_ordinal {
2190 return Ok(());
2191 }
2192
2193 let cur_offset: usize = (2 - 1) * envelope_size;
2196
2197 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2199
2200 fidl::encoding::encode_in_envelope_optional::<
2205 fidl::encoding::HandleType<
2206 fdomain_client::EventPair,
2207 { fidl::ObjectType::EVENTPAIR.into_raw() },
2208 2147483648,
2209 >,
2210 fdomain_client::fidl::FDomainResourceDialect,
2211 >(
2212 self.release_fence.as_mut().map(
2213 <fidl::encoding::HandleType<
2214 fdomain_client::EventPair,
2215 { fidl::ObjectType::EVENTPAIR.into_raw() },
2216 2147483648,
2217 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2218 ),
2219 encoder,
2220 offset + cur_offset,
2221 depth,
2222 )?;
2223
2224 _prev_end_offset = cur_offset + envelope_size;
2225
2226 Ok(())
2227 }
2228 }
2229
2230 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2231 for StreamSinkPutPacketRequest
2232 {
2233 #[inline(always)]
2234 fn new_empty() -> Self {
2235 Self::default()
2236 }
2237
2238 unsafe fn decode(
2239 &mut self,
2240 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2241 offset: usize,
2242 mut depth: fidl::encoding::Depth,
2243 ) -> fidl::Result<()> {
2244 decoder.debug_check_bounds::<Self>(offset);
2245 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2246 None => return Err(fidl::Error::NotNullable),
2247 Some(len) => len,
2248 };
2249 if len == 0 {
2251 return Ok(());
2252 };
2253 depth.increment()?;
2254 let envelope_size = 8;
2255 let bytes_len = len * envelope_size;
2256 let offset = decoder.out_of_line_offset(bytes_len)?;
2257 let mut _next_ordinal_to_read = 0;
2259 let mut next_offset = offset;
2260 let end_offset = offset + bytes_len;
2261 _next_ordinal_to_read += 1;
2262 if next_offset >= end_offset {
2263 return Ok(());
2264 }
2265
2266 while _next_ordinal_to_read < 1 {
2268 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2269 _next_ordinal_to_read += 1;
2270 next_offset += envelope_size;
2271 }
2272
2273 let next_out_of_line = decoder.next_out_of_line();
2274 let handles_before = decoder.remaining_handles();
2275 if let Some((inlined, num_bytes, num_handles)) =
2276 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2277 {
2278 let member_inline_size =
2279 <Packet as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2280 if inlined != (member_inline_size <= 4) {
2281 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2282 }
2283 let inner_offset;
2284 let mut inner_depth = depth.clone();
2285 if inlined {
2286 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2287 inner_offset = next_offset;
2288 } else {
2289 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2290 inner_depth.increment()?;
2291 }
2292 let val_ref = self.packet.get_or_insert_with(|| {
2293 fidl::new_empty!(Packet, fdomain_client::fidl::FDomainResourceDialect)
2294 });
2295 fidl::decode!(
2296 Packet,
2297 fdomain_client::fidl::FDomainResourceDialect,
2298 val_ref,
2299 decoder,
2300 inner_offset,
2301 inner_depth
2302 )?;
2303 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2304 {
2305 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2306 }
2307 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2308 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2309 }
2310 }
2311
2312 next_offset += envelope_size;
2313 _next_ordinal_to_read += 1;
2314 if next_offset >= end_offset {
2315 return Ok(());
2316 }
2317
2318 while _next_ordinal_to_read < 2 {
2320 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2321 _next_ordinal_to_read += 1;
2322 next_offset += envelope_size;
2323 }
2324
2325 let next_out_of_line = decoder.next_out_of_line();
2326 let handles_before = decoder.remaining_handles();
2327 if let Some((inlined, num_bytes, num_handles)) =
2328 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2329 {
2330 let member_inline_size = <fidl::encoding::HandleType<
2331 fdomain_client::EventPair,
2332 { fidl::ObjectType::EVENTPAIR.into_raw() },
2333 2147483648,
2334 > as fidl::encoding::TypeMarker>::inline_size(
2335 decoder.context
2336 );
2337 if inlined != (member_inline_size <= 4) {
2338 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2339 }
2340 let inner_offset;
2341 let mut inner_depth = depth.clone();
2342 if inlined {
2343 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2344 inner_offset = next_offset;
2345 } else {
2346 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2347 inner_depth.increment()?;
2348 }
2349 let val_ref =
2350 self.release_fence.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect));
2351 fidl::decode!(fidl::encoding::HandleType<fdomain_client::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2352 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2353 {
2354 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2355 }
2356 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2357 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2358 }
2359 }
2360
2361 next_offset += envelope_size;
2362
2363 while next_offset < end_offset {
2365 _next_ordinal_to_read += 1;
2366 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2367 next_offset += envelope_size;
2368 }
2369
2370 Ok(())
2371 }
2372 }
2373}