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 fdomain_client::fidl::ControlHandle for DelayWatcherControlHandle {
443 fn shutdown(&self) {
444 self.inner.shutdown()
445 }
446
447 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
448 self.inner.shutdown_with_epitaph(status)
449 }
450
451 fn is_closed(&self) -> bool {
452 self.inner.channel().is_closed()
453 }
454 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
455 self.inner.channel().on_closed()
456 }
457}
458
459impl DelayWatcherControlHandle {}
460
461#[must_use = "FIDL methods require a response to be sent"]
462#[derive(Debug)]
463pub struct DelayWatcherWatchDelayResponder {
464 control_handle: std::mem::ManuallyDrop<DelayWatcherControlHandle>,
465 tx_id: u32,
466}
467
468impl std::ops::Drop for DelayWatcherWatchDelayResponder {
472 fn drop(&mut self) {
473 self.control_handle.shutdown();
474 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
476 }
477}
478
479impl fdomain_client::fidl::Responder for DelayWatcherWatchDelayResponder {
480 type ControlHandle = DelayWatcherControlHandle;
481
482 fn control_handle(&self) -> &DelayWatcherControlHandle {
483 &self.control_handle
484 }
485
486 fn drop_without_shutdown(mut self) {
487 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
489 std::mem::forget(self);
491 }
492}
493
494impl DelayWatcherWatchDelayResponder {
495 pub fn send(self, mut payload: &DelayWatcherWatchDelayResponse) -> Result<(), fidl::Error> {
499 let _result = self.send_raw(payload);
500 if _result.is_err() {
501 self.control_handle.shutdown();
502 }
503 self.drop_without_shutdown();
504 _result
505 }
506
507 pub fn send_no_shutdown_on_err(
509 self,
510 mut payload: &DelayWatcherWatchDelayResponse,
511 ) -> Result<(), fidl::Error> {
512 let _result = self.send_raw(payload);
513 self.drop_without_shutdown();
514 _result
515 }
516
517 fn send_raw(&self, mut payload: &DelayWatcherWatchDelayResponse) -> Result<(), fidl::Error> {
518 self.control_handle.inner.send::<DelayWatcherWatchDelayResponse>(
519 payload,
520 self.tx_id,
521 0x3a90c91ee2f1644c,
522 fidl::encoding::DynamicFlags::empty(),
523 )
524 }
525}
526
527#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
528pub struct GainControlMarker;
529
530impl fdomain_client::fidl::ProtocolMarker for GainControlMarker {
531 type Proxy = GainControlProxy;
532 type RequestStream = GainControlRequestStream;
533
534 const DEBUG_NAME: &'static str = "(anonymous) GainControl";
535}
536pub type GainControlSetGainResult = Result<GainControlSetGainResponse, GainError>;
537pub type GainControlSetMuteResult = Result<GainControlSetMuteResponse, GainError>;
538
539pub trait GainControlProxyInterface: Send + Sync {
540 type SetGainResponseFut: std::future::Future<Output = Result<GainControlSetGainResult, fidl::Error>>
541 + Send;
542 fn r#set_gain(&self, payload: &GainControlSetGainRequest) -> Self::SetGainResponseFut;
543 type SetMuteResponseFut: std::future::Future<Output = Result<GainControlSetMuteResult, fidl::Error>>
544 + Send;
545 fn r#set_mute(&self, payload: &GainControlSetMuteRequest) -> Self::SetMuteResponseFut;
546}
547
548#[derive(Debug, Clone)]
549pub struct GainControlProxy {
550 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
551}
552
553impl fdomain_client::fidl::Proxy for GainControlProxy {
554 type Protocol = GainControlMarker;
555
556 fn from_channel(inner: fdomain_client::Channel) -> Self {
557 Self::new(inner)
558 }
559
560 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
561 self.client.into_channel().map_err(|client| Self { client })
562 }
563
564 fn as_channel(&self) -> &fdomain_client::Channel {
565 self.client.as_channel()
566 }
567}
568
569impl GainControlProxy {
570 pub fn new(channel: fdomain_client::Channel) -> Self {
572 let protocol_name = <GainControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
573 Self { client: fidl::client::Client::new(channel, protocol_name) }
574 }
575
576 pub fn take_event_stream(&self) -> GainControlEventStream {
582 GainControlEventStream { event_receiver: self.client.take_event_receiver() }
583 }
584
585 pub fn r#set_gain(
587 &self,
588 mut payload: &GainControlSetGainRequest,
589 ) -> fidl::client::QueryResponseFut<
590 GainControlSetGainResult,
591 fdomain_client::fidl::FDomainResourceDialect,
592 > {
593 GainControlProxyInterface::r#set_gain(self, payload)
594 }
595
596 pub fn r#set_mute(
598 &self,
599 mut payload: &GainControlSetMuteRequest,
600 ) -> fidl::client::QueryResponseFut<
601 GainControlSetMuteResult,
602 fdomain_client::fidl::FDomainResourceDialect,
603 > {
604 GainControlProxyInterface::r#set_mute(self, payload)
605 }
606}
607
608impl GainControlProxyInterface for GainControlProxy {
609 type SetGainResponseFut = fidl::client::QueryResponseFut<
610 GainControlSetGainResult,
611 fdomain_client::fidl::FDomainResourceDialect,
612 >;
613 fn r#set_gain(&self, mut payload: &GainControlSetGainRequest) -> Self::SetGainResponseFut {
614 fn _decode(
615 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
616 ) -> Result<GainControlSetGainResult, fidl::Error> {
617 let _response = fidl::client::decode_transaction_body::<
618 fidl::encoding::ResultType<GainControlSetGainResponse, GainError>,
619 fdomain_client::fidl::FDomainResourceDialect,
620 0x6ece305e4a5823dc,
621 >(_buf?)?;
622 Ok(_response.map(|x| x))
623 }
624 self.client.send_query_and_decode::<GainControlSetGainRequest, GainControlSetGainResult>(
625 payload,
626 0x6ece305e4a5823dc,
627 fidl::encoding::DynamicFlags::empty(),
628 _decode,
629 )
630 }
631
632 type SetMuteResponseFut = fidl::client::QueryResponseFut<
633 GainControlSetMuteResult,
634 fdomain_client::fidl::FDomainResourceDialect,
635 >;
636 fn r#set_mute(&self, mut payload: &GainControlSetMuteRequest) -> Self::SetMuteResponseFut {
637 fn _decode(
638 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
639 ) -> Result<GainControlSetMuteResult, fidl::Error> {
640 let _response = fidl::client::decode_transaction_body::<
641 fidl::encoding::ResultType<GainControlSetMuteResponse, GainError>,
642 fdomain_client::fidl::FDomainResourceDialect,
643 0xed03d88ce4f8965,
644 >(_buf?)?;
645 Ok(_response.map(|x| x))
646 }
647 self.client.send_query_and_decode::<GainControlSetMuteRequest, GainControlSetMuteResult>(
648 payload,
649 0xed03d88ce4f8965,
650 fidl::encoding::DynamicFlags::empty(),
651 _decode,
652 )
653 }
654}
655
656pub struct GainControlEventStream {
657 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
658}
659
660impl std::marker::Unpin for GainControlEventStream {}
661
662impl futures::stream::FusedStream for GainControlEventStream {
663 fn is_terminated(&self) -> bool {
664 self.event_receiver.is_terminated()
665 }
666}
667
668impl futures::Stream for GainControlEventStream {
669 type Item = Result<GainControlEvent, fidl::Error>;
670
671 fn poll_next(
672 mut self: std::pin::Pin<&mut Self>,
673 cx: &mut std::task::Context<'_>,
674 ) -> std::task::Poll<Option<Self::Item>> {
675 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
676 &mut self.event_receiver,
677 cx
678 )?) {
679 Some(buf) => std::task::Poll::Ready(Some(GainControlEvent::decode(buf))),
680 None => std::task::Poll::Ready(None),
681 }
682 }
683}
684
685#[derive(Debug)]
686pub enum GainControlEvent {}
687
688impl GainControlEvent {
689 fn decode(
691 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
692 ) -> Result<GainControlEvent, fidl::Error> {
693 let (bytes, _handles) = buf.split_mut();
694 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
695 debug_assert_eq!(tx_header.tx_id, 0);
696 match tx_header.ordinal {
697 _ => Err(fidl::Error::UnknownOrdinal {
698 ordinal: tx_header.ordinal,
699 protocol_name:
700 <GainControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
701 }),
702 }
703 }
704}
705
706pub struct GainControlRequestStream {
708 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
709 is_terminated: bool,
710}
711
712impl std::marker::Unpin for GainControlRequestStream {}
713
714impl futures::stream::FusedStream for GainControlRequestStream {
715 fn is_terminated(&self) -> bool {
716 self.is_terminated
717 }
718}
719
720impl fdomain_client::fidl::RequestStream for GainControlRequestStream {
721 type Protocol = GainControlMarker;
722 type ControlHandle = GainControlControlHandle;
723
724 fn from_channel(channel: fdomain_client::Channel) -> Self {
725 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
726 }
727
728 fn control_handle(&self) -> Self::ControlHandle {
729 GainControlControlHandle { inner: self.inner.clone() }
730 }
731
732 fn into_inner(
733 self,
734 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
735 {
736 (self.inner, self.is_terminated)
737 }
738
739 fn from_inner(
740 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
741 is_terminated: bool,
742 ) -> Self {
743 Self { inner, is_terminated }
744 }
745}
746
747impl futures::Stream for GainControlRequestStream {
748 type Item = Result<GainControlRequest, fidl::Error>;
749
750 fn poll_next(
751 mut self: std::pin::Pin<&mut Self>,
752 cx: &mut std::task::Context<'_>,
753 ) -> std::task::Poll<Option<Self::Item>> {
754 let this = &mut *self;
755 if this.inner.check_shutdown(cx) {
756 this.is_terminated = true;
757 return std::task::Poll::Ready(None);
758 }
759 if this.is_terminated {
760 panic!("polled GainControlRequestStream after completion");
761 }
762 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
763 |bytes, handles| {
764 match this.inner.channel().read_etc(cx, bytes, handles) {
765 std::task::Poll::Ready(Ok(())) => {}
766 std::task::Poll::Pending => return std::task::Poll::Pending,
767 std::task::Poll::Ready(Err(None)) => {
768 this.is_terminated = true;
769 return std::task::Poll::Ready(None);
770 }
771 std::task::Poll::Ready(Err(Some(e))) => {
772 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
773 e.into(),
774 ))));
775 }
776 }
777
778 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
780
781 std::task::Poll::Ready(Some(match header.ordinal {
782 0x6ece305e4a5823dc => {
783 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
784 let mut req = fidl::new_empty!(
785 GainControlSetGainRequest,
786 fdomain_client::fidl::FDomainResourceDialect
787 );
788 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<GainControlSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
789 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
790 Ok(GainControlRequest::SetGain {
791 payload: req,
792 responder: GainControlSetGainResponder {
793 control_handle: std::mem::ManuallyDrop::new(control_handle),
794 tx_id: header.tx_id,
795 },
796 })
797 }
798 0xed03d88ce4f8965 => {
799 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
800 let mut req = fidl::new_empty!(
801 GainControlSetMuteRequest,
802 fdomain_client::fidl::FDomainResourceDialect
803 );
804 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<GainControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
805 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
806 Ok(GainControlRequest::SetMute {
807 payload: req,
808 responder: GainControlSetMuteResponder {
809 control_handle: std::mem::ManuallyDrop::new(control_handle),
810 tx_id: header.tx_id,
811 },
812 })
813 }
814 _ => Err(fidl::Error::UnknownOrdinal {
815 ordinal: header.ordinal,
816 protocol_name:
817 <GainControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
818 }),
819 }))
820 },
821 )
822 }
823}
824
825#[derive(Debug)]
853pub enum GainControlRequest {
854 SetGain { payload: GainControlSetGainRequest, responder: GainControlSetGainResponder },
856 SetMute { payload: GainControlSetMuteRequest, responder: GainControlSetMuteResponder },
858}
859
860impl GainControlRequest {
861 #[allow(irrefutable_let_patterns)]
862 pub fn into_set_gain(self) -> Option<(GainControlSetGainRequest, GainControlSetGainResponder)> {
863 if let GainControlRequest::SetGain { payload, responder } = self {
864 Some((payload, responder))
865 } else {
866 None
867 }
868 }
869
870 #[allow(irrefutable_let_patterns)]
871 pub fn into_set_mute(self) -> Option<(GainControlSetMuteRequest, GainControlSetMuteResponder)> {
872 if let GainControlRequest::SetMute { payload, responder } = self {
873 Some((payload, responder))
874 } else {
875 None
876 }
877 }
878
879 pub fn method_name(&self) -> &'static str {
881 match *self {
882 GainControlRequest::SetGain { .. } => "set_gain",
883 GainControlRequest::SetMute { .. } => "set_mute",
884 }
885 }
886}
887
888#[derive(Debug, Clone)]
889pub struct GainControlControlHandle {
890 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
891}
892
893impl fdomain_client::fidl::ControlHandle for GainControlControlHandle {
894 fn shutdown(&self) {
895 self.inner.shutdown()
896 }
897
898 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
899 self.inner.shutdown_with_epitaph(status)
900 }
901
902 fn is_closed(&self) -> bool {
903 self.inner.channel().is_closed()
904 }
905 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
906 self.inner.channel().on_closed()
907 }
908}
909
910impl GainControlControlHandle {}
911
912#[must_use = "FIDL methods require a response to be sent"]
913#[derive(Debug)]
914pub struct GainControlSetGainResponder {
915 control_handle: std::mem::ManuallyDrop<GainControlControlHandle>,
916 tx_id: u32,
917}
918
919impl std::ops::Drop for GainControlSetGainResponder {
923 fn drop(&mut self) {
924 self.control_handle.shutdown();
925 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
927 }
928}
929
930impl fdomain_client::fidl::Responder for GainControlSetGainResponder {
931 type ControlHandle = GainControlControlHandle;
932
933 fn control_handle(&self) -> &GainControlControlHandle {
934 &self.control_handle
935 }
936
937 fn drop_without_shutdown(mut self) {
938 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
940 std::mem::forget(self);
942 }
943}
944
945impl GainControlSetGainResponder {
946 pub fn send(
950 self,
951 mut result: Result<&GainControlSetGainResponse, GainError>,
952 ) -> Result<(), fidl::Error> {
953 let _result = self.send_raw(result);
954 if _result.is_err() {
955 self.control_handle.shutdown();
956 }
957 self.drop_without_shutdown();
958 _result
959 }
960
961 pub fn send_no_shutdown_on_err(
963 self,
964 mut result: Result<&GainControlSetGainResponse, GainError>,
965 ) -> Result<(), fidl::Error> {
966 let _result = self.send_raw(result);
967 self.drop_without_shutdown();
968 _result
969 }
970
971 fn send_raw(
972 &self,
973 mut result: Result<&GainControlSetGainResponse, GainError>,
974 ) -> Result<(), fidl::Error> {
975 self.control_handle
976 .inner
977 .send::<fidl::encoding::ResultType<GainControlSetGainResponse, GainError>>(
978 result,
979 self.tx_id,
980 0x6ece305e4a5823dc,
981 fidl::encoding::DynamicFlags::empty(),
982 )
983 }
984}
985
986#[must_use = "FIDL methods require a response to be sent"]
987#[derive(Debug)]
988pub struct GainControlSetMuteResponder {
989 control_handle: std::mem::ManuallyDrop<GainControlControlHandle>,
990 tx_id: u32,
991}
992
993impl std::ops::Drop for GainControlSetMuteResponder {
997 fn drop(&mut self) {
998 self.control_handle.shutdown();
999 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1001 }
1002}
1003
1004impl fdomain_client::fidl::Responder for GainControlSetMuteResponder {
1005 type ControlHandle = GainControlControlHandle;
1006
1007 fn control_handle(&self) -> &GainControlControlHandle {
1008 &self.control_handle
1009 }
1010
1011 fn drop_without_shutdown(mut self) {
1012 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1014 std::mem::forget(self);
1016 }
1017}
1018
1019impl GainControlSetMuteResponder {
1020 pub fn send(
1024 self,
1025 mut result: Result<&GainControlSetMuteResponse, GainError>,
1026 ) -> Result<(), fidl::Error> {
1027 let _result = self.send_raw(result);
1028 if _result.is_err() {
1029 self.control_handle.shutdown();
1030 }
1031 self.drop_without_shutdown();
1032 _result
1033 }
1034
1035 pub fn send_no_shutdown_on_err(
1037 self,
1038 mut result: Result<&GainControlSetMuteResponse, GainError>,
1039 ) -> Result<(), fidl::Error> {
1040 let _result = self.send_raw(result);
1041 self.drop_without_shutdown();
1042 _result
1043 }
1044
1045 fn send_raw(
1046 &self,
1047 mut result: Result<&GainControlSetMuteResponse, GainError>,
1048 ) -> Result<(), fidl::Error> {
1049 self.control_handle
1050 .inner
1051 .send::<fidl::encoding::ResultType<GainControlSetMuteResponse, GainError>>(
1052 result,
1053 self.tx_id,
1054 0xed03d88ce4f8965,
1055 fidl::encoding::DynamicFlags::empty(),
1056 )
1057 }
1058}
1059
1060#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1061pub struct StreamSinkMarker;
1062
1063impl fdomain_client::fidl::ProtocolMarker for StreamSinkMarker {
1064 type Proxy = StreamSinkProxy;
1065 type RequestStream = StreamSinkRequestStream;
1066
1067 const DEBUG_NAME: &'static str = "(anonymous) StreamSink";
1068}
1069
1070pub trait StreamSinkProxyInterface: Send + Sync {
1071 fn r#put_packet(&self, payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error>;
1072 fn r#start_segment(&self, payload: &StreamSinkStartSegmentRequest) -> Result<(), fidl::Error>;
1073 fn r#end(&self) -> Result<(), fidl::Error>;
1074 fn r#will_close(&self, payload: &StreamSinkWillCloseRequest) -> Result<(), fidl::Error>;
1075}
1076
1077#[derive(Debug, Clone)]
1078pub struct StreamSinkProxy {
1079 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1080}
1081
1082impl fdomain_client::fidl::Proxy for StreamSinkProxy {
1083 type Protocol = StreamSinkMarker;
1084
1085 fn from_channel(inner: fdomain_client::Channel) -> Self {
1086 Self::new(inner)
1087 }
1088
1089 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1090 self.client.into_channel().map_err(|client| Self { client })
1091 }
1092
1093 fn as_channel(&self) -> &fdomain_client::Channel {
1094 self.client.as_channel()
1095 }
1096}
1097
1098impl StreamSinkProxy {
1099 pub fn new(channel: fdomain_client::Channel) -> Self {
1101 let protocol_name = <StreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1102 Self { client: fidl::client::Client::new(channel, protocol_name) }
1103 }
1104
1105 pub fn take_event_stream(&self) -> StreamSinkEventStream {
1111 StreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
1112 }
1113
1114 pub fn r#put_packet(&self, mut payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error> {
1116 StreamSinkProxyInterface::r#put_packet(self, payload)
1117 }
1118
1119 pub fn r#start_segment(
1122 &self,
1123 mut payload: &StreamSinkStartSegmentRequest,
1124 ) -> Result<(), fidl::Error> {
1125 StreamSinkProxyInterface::r#start_segment(self, payload)
1126 }
1127
1128 pub fn r#end(&self) -> Result<(), fidl::Error> {
1134 StreamSinkProxyInterface::r#end(self)
1135 }
1136
1137 pub fn r#will_close(
1141 &self,
1142 mut payload: &StreamSinkWillCloseRequest,
1143 ) -> Result<(), fidl::Error> {
1144 StreamSinkProxyInterface::r#will_close(self, payload)
1145 }
1146}
1147
1148impl StreamSinkProxyInterface for StreamSinkProxy {
1149 fn r#put_packet(&self, mut payload: StreamSinkPutPacketRequest) -> Result<(), fidl::Error> {
1150 self.client.send::<StreamSinkPutPacketRequest>(
1151 &mut payload,
1152 0x558d757afd726899,
1153 fidl::encoding::DynamicFlags::empty(),
1154 )
1155 }
1156
1157 fn r#start_segment(
1158 &self,
1159 mut payload: &StreamSinkStartSegmentRequest,
1160 ) -> Result<(), fidl::Error> {
1161 self.client.send::<StreamSinkStartSegmentRequest>(
1162 payload,
1163 0x6dd9bc66aa9f715f,
1164 fidl::encoding::DynamicFlags::empty(),
1165 )
1166 }
1167
1168 fn r#end(&self) -> Result<(), fidl::Error> {
1169 self.client.send::<fidl::encoding::EmptyPayload>(
1170 (),
1171 0x1a3a528e83b32f6e,
1172 fidl::encoding::DynamicFlags::empty(),
1173 )
1174 }
1175
1176 fn r#will_close(&self, mut payload: &StreamSinkWillCloseRequest) -> Result<(), fidl::Error> {
1177 self.client.send::<StreamSinkWillCloseRequest>(
1178 payload,
1179 0x6303ee33dbb0fd11,
1180 fidl::encoding::DynamicFlags::empty(),
1181 )
1182 }
1183}
1184
1185pub struct StreamSinkEventStream {
1186 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1187}
1188
1189impl std::marker::Unpin for StreamSinkEventStream {}
1190
1191impl futures::stream::FusedStream for StreamSinkEventStream {
1192 fn is_terminated(&self) -> bool {
1193 self.event_receiver.is_terminated()
1194 }
1195}
1196
1197impl futures::Stream for StreamSinkEventStream {
1198 type Item = Result<StreamSinkEvent, fidl::Error>;
1199
1200 fn poll_next(
1201 mut self: std::pin::Pin<&mut Self>,
1202 cx: &mut std::task::Context<'_>,
1203 ) -> std::task::Poll<Option<Self::Item>> {
1204 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1205 &mut self.event_receiver,
1206 cx
1207 )?) {
1208 Some(buf) => std::task::Poll::Ready(Some(StreamSinkEvent::decode(buf))),
1209 None => std::task::Poll::Ready(None),
1210 }
1211 }
1212}
1213
1214#[derive(Debug)]
1215pub enum StreamSinkEvent {
1216 OnWillClose { payload: StreamSinkOnWillCloseRequest },
1217}
1218
1219impl StreamSinkEvent {
1220 #[allow(irrefutable_let_patterns)]
1221 pub fn into_on_will_close(self) -> Option<StreamSinkOnWillCloseRequest> {
1222 if let StreamSinkEvent::OnWillClose { payload } = self { Some((payload)) } else { None }
1223 }
1224
1225 fn decode(
1227 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1228 ) -> Result<StreamSinkEvent, fidl::Error> {
1229 let (bytes, _handles) = buf.split_mut();
1230 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1231 debug_assert_eq!(tx_header.tx_id, 0);
1232 match tx_header.ordinal {
1233 0x77093453926bce5b => {
1234 let mut out = fidl::new_empty!(
1235 StreamSinkOnWillCloseRequest,
1236 fdomain_client::fidl::FDomainResourceDialect
1237 );
1238 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamSinkOnWillCloseRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1239 Ok((StreamSinkEvent::OnWillClose { payload: out }))
1240 }
1241 _ => Err(fidl::Error::UnknownOrdinal {
1242 ordinal: tx_header.ordinal,
1243 protocol_name:
1244 <StreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1245 }),
1246 }
1247 }
1248}
1249
1250pub struct StreamSinkRequestStream {
1252 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1253 is_terminated: bool,
1254}
1255
1256impl std::marker::Unpin for StreamSinkRequestStream {}
1257
1258impl futures::stream::FusedStream for StreamSinkRequestStream {
1259 fn is_terminated(&self) -> bool {
1260 self.is_terminated
1261 }
1262}
1263
1264impl fdomain_client::fidl::RequestStream for StreamSinkRequestStream {
1265 type Protocol = StreamSinkMarker;
1266 type ControlHandle = StreamSinkControlHandle;
1267
1268 fn from_channel(channel: fdomain_client::Channel) -> Self {
1269 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1270 }
1271
1272 fn control_handle(&self) -> Self::ControlHandle {
1273 StreamSinkControlHandle { inner: self.inner.clone() }
1274 }
1275
1276 fn into_inner(
1277 self,
1278 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1279 {
1280 (self.inner, self.is_terminated)
1281 }
1282
1283 fn from_inner(
1284 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1285 is_terminated: bool,
1286 ) -> Self {
1287 Self { inner, is_terminated }
1288 }
1289}
1290
1291impl futures::Stream for StreamSinkRequestStream {
1292 type Item = Result<StreamSinkRequest, fidl::Error>;
1293
1294 fn poll_next(
1295 mut self: std::pin::Pin<&mut Self>,
1296 cx: &mut std::task::Context<'_>,
1297 ) -> std::task::Poll<Option<Self::Item>> {
1298 let this = &mut *self;
1299 if this.inner.check_shutdown(cx) {
1300 this.is_terminated = true;
1301 return std::task::Poll::Ready(None);
1302 }
1303 if this.is_terminated {
1304 panic!("polled StreamSinkRequestStream after completion");
1305 }
1306 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1307 |bytes, handles| {
1308 match this.inner.channel().read_etc(cx, bytes, handles) {
1309 std::task::Poll::Ready(Ok(())) => {}
1310 std::task::Poll::Pending => return std::task::Poll::Pending,
1311 std::task::Poll::Ready(Err(None)) => {
1312 this.is_terminated = true;
1313 return std::task::Poll::Ready(None);
1314 }
1315 std::task::Poll::Ready(Err(Some(e))) => {
1316 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1317 e.into(),
1318 ))));
1319 }
1320 }
1321
1322 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1324
1325 std::task::Poll::Ready(Some(match header.ordinal {
1326 0x558d757afd726899 => {
1327 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1328 let mut req = fidl::new_empty!(
1329 StreamSinkPutPacketRequest,
1330 fdomain_client::fidl::FDomainResourceDialect
1331 );
1332 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamSinkPutPacketRequest>(&header, _body_bytes, handles, &mut req)?;
1333 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1334 Ok(StreamSinkRequest::PutPacket { payload: req, control_handle })
1335 }
1336 0x6dd9bc66aa9f715f => {
1337 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1338 let mut req = fidl::new_empty!(
1339 StreamSinkStartSegmentRequest,
1340 fdomain_client::fidl::FDomainResourceDialect
1341 );
1342 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamSinkStartSegmentRequest>(&header, _body_bytes, handles, &mut req)?;
1343 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1344 Ok(StreamSinkRequest::StartSegment { payload: req, control_handle })
1345 }
1346 0x1a3a528e83b32f6e => {
1347 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1348 let mut req = fidl::new_empty!(
1349 fidl::encoding::EmptyPayload,
1350 fdomain_client::fidl::FDomainResourceDialect
1351 );
1352 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1353 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1354 Ok(StreamSinkRequest::End { control_handle })
1355 }
1356 0x6303ee33dbb0fd11 => {
1357 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1358 let mut req = fidl::new_empty!(
1359 StreamSinkWillCloseRequest,
1360 fdomain_client::fidl::FDomainResourceDialect
1361 );
1362 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamSinkWillCloseRequest>(&header, _body_bytes, handles, &mut req)?;
1363 let control_handle = StreamSinkControlHandle { inner: this.inner.clone() };
1364 Ok(StreamSinkRequest::WillClose { payload: req, control_handle })
1365 }
1366 _ => Err(fidl::Error::UnknownOrdinal {
1367 ordinal: header.ordinal,
1368 protocol_name:
1369 <StreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1370 }),
1371 }))
1372 },
1373 )
1374 }
1375}
1376
1377#[derive(Debug)]
1380pub enum StreamSinkRequest {
1381 PutPacket { payload: StreamSinkPutPacketRequest, control_handle: StreamSinkControlHandle },
1383 StartSegment { payload: StreamSinkStartSegmentRequest, control_handle: StreamSinkControlHandle },
1386 End { control_handle: StreamSinkControlHandle },
1392 WillClose { payload: StreamSinkWillCloseRequest, control_handle: StreamSinkControlHandle },
1396}
1397
1398impl StreamSinkRequest {
1399 #[allow(irrefutable_let_patterns)]
1400 pub fn into_put_packet(self) -> Option<(StreamSinkPutPacketRequest, StreamSinkControlHandle)> {
1401 if let StreamSinkRequest::PutPacket { payload, control_handle } = self {
1402 Some((payload, control_handle))
1403 } else {
1404 None
1405 }
1406 }
1407
1408 #[allow(irrefutable_let_patterns)]
1409 pub fn into_start_segment(
1410 self,
1411 ) -> Option<(StreamSinkStartSegmentRequest, StreamSinkControlHandle)> {
1412 if let StreamSinkRequest::StartSegment { payload, control_handle } = self {
1413 Some((payload, control_handle))
1414 } else {
1415 None
1416 }
1417 }
1418
1419 #[allow(irrefutable_let_patterns)]
1420 pub fn into_end(self) -> Option<(StreamSinkControlHandle)> {
1421 if let StreamSinkRequest::End { control_handle } = self {
1422 Some((control_handle))
1423 } else {
1424 None
1425 }
1426 }
1427
1428 #[allow(irrefutable_let_patterns)]
1429 pub fn into_will_close(self) -> Option<(StreamSinkWillCloseRequest, StreamSinkControlHandle)> {
1430 if let StreamSinkRequest::WillClose { payload, control_handle } = self {
1431 Some((payload, control_handle))
1432 } else {
1433 None
1434 }
1435 }
1436
1437 pub fn method_name(&self) -> &'static str {
1439 match *self {
1440 StreamSinkRequest::PutPacket { .. } => "put_packet",
1441 StreamSinkRequest::StartSegment { .. } => "start_segment",
1442 StreamSinkRequest::End { .. } => "end",
1443 StreamSinkRequest::WillClose { .. } => "will_close",
1444 }
1445 }
1446}
1447
1448#[derive(Debug, Clone)]
1449pub struct StreamSinkControlHandle {
1450 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1451}
1452
1453impl fdomain_client::fidl::ControlHandle for StreamSinkControlHandle {
1454 fn shutdown(&self) {
1455 self.inner.shutdown()
1456 }
1457
1458 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1459 self.inner.shutdown_with_epitaph(status)
1460 }
1461
1462 fn is_closed(&self) -> bool {
1463 self.inner.channel().is_closed()
1464 }
1465 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1466 self.inner.channel().on_closed()
1467 }
1468}
1469
1470impl StreamSinkControlHandle {
1471 pub fn send_on_will_close(
1472 &self,
1473 mut payload: &StreamSinkOnWillCloseRequest,
1474 ) -> Result<(), fidl::Error> {
1475 self.inner.send::<StreamSinkOnWillCloseRequest>(
1476 payload,
1477 0,
1478 0x77093453926bce5b,
1479 fidl::encoding::DynamicFlags::empty(),
1480 )
1481 }
1482}
1483
1484mod internal {
1485 use super::*;
1486
1487 impl RingBuffer {
1488 #[inline(always)]
1489 fn max_ordinal_present(&self) -> u64 {
1490 if let Some(_) = self.reference_clock_domain {
1491 return 6;
1492 }
1493 if let Some(_) = self.reference_clock {
1494 return 5;
1495 }
1496 if let Some(_) = self.consumer_bytes {
1497 return 4;
1498 }
1499 if let Some(_) = self.producer_bytes {
1500 return 3;
1501 }
1502 if let Some(_) = self.format {
1503 return 2;
1504 }
1505 if let Some(_) = self.buffer {
1506 return 1;
1507 }
1508 0
1509 }
1510 }
1511
1512 impl fidl::encoding::ResourceTypeMarker for RingBuffer {
1513 type Borrowed<'a> = &'a mut Self;
1514 fn take_or_borrow<'a>(
1515 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1516 ) -> Self::Borrowed<'a> {
1517 value
1518 }
1519 }
1520
1521 unsafe impl fidl::encoding::TypeMarker for RingBuffer {
1522 type Owned = Self;
1523
1524 #[inline(always)]
1525 fn inline_align(_context: fidl::encoding::Context) -> usize {
1526 8
1527 }
1528
1529 #[inline(always)]
1530 fn inline_size(_context: fidl::encoding::Context) -> usize {
1531 16
1532 }
1533 }
1534
1535 unsafe impl fidl::encoding::Encode<RingBuffer, fdomain_client::fidl::FDomainResourceDialect>
1536 for &mut RingBuffer
1537 {
1538 unsafe fn encode(
1539 self,
1540 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1541 offset: usize,
1542 mut depth: fidl::encoding::Depth,
1543 ) -> fidl::Result<()> {
1544 encoder.debug_check_bounds::<RingBuffer>(offset);
1545 let max_ordinal: u64 = self.max_ordinal_present();
1547 encoder.write_num(max_ordinal, offset);
1548 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1549 if max_ordinal == 0 {
1551 return Ok(());
1552 }
1553 depth.increment()?;
1554 let envelope_size = 8;
1555 let bytes_len = max_ordinal as usize * envelope_size;
1556 #[allow(unused_variables)]
1557 let offset = encoder.out_of_line_offset(bytes_len);
1558 let mut _prev_end_offset: usize = 0;
1559 if 1 > max_ordinal {
1560 return Ok(());
1561 }
1562
1563 let cur_offset: usize = (1 - 1) * envelope_size;
1566
1567 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1569
1570 fidl::encoding::encode_in_envelope_optional::<fdomain_fuchsia_mem::Buffer, fdomain_client::fidl::FDomainResourceDialect>(
1575 self.buffer.as_mut().map(<fdomain_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1576 encoder, offset + cur_offset, depth
1577 )?;
1578
1579 _prev_end_offset = cur_offset + envelope_size;
1580 if 2 > max_ordinal {
1581 return Ok(());
1582 }
1583
1584 let cur_offset: usize = (2 - 1) * envelope_size;
1587
1588 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1590
1591 fidl::encoding::encode_in_envelope_optional::<
1596 Format,
1597 fdomain_client::fidl::FDomainResourceDialect,
1598 >(
1599 self.format.as_ref().map(<Format as fidl::encoding::ValueTypeMarker>::borrow),
1600 encoder,
1601 offset + cur_offset,
1602 depth,
1603 )?;
1604
1605 _prev_end_offset = cur_offset + envelope_size;
1606 if 3 > max_ordinal {
1607 return Ok(());
1608 }
1609
1610 let cur_offset: usize = (3 - 1) * envelope_size;
1613
1614 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1616
1617 fidl::encoding::encode_in_envelope_optional::<
1622 u64,
1623 fdomain_client::fidl::FDomainResourceDialect,
1624 >(
1625 self.producer_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1626 encoder,
1627 offset + cur_offset,
1628 depth,
1629 )?;
1630
1631 _prev_end_offset = cur_offset + envelope_size;
1632 if 4 > max_ordinal {
1633 return Ok(());
1634 }
1635
1636 let cur_offset: usize = (4 - 1) * envelope_size;
1639
1640 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1642
1643 fidl::encoding::encode_in_envelope_optional::<
1648 u64,
1649 fdomain_client::fidl::FDomainResourceDialect,
1650 >(
1651 self.consumer_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1652 encoder,
1653 offset + cur_offset,
1654 depth,
1655 )?;
1656
1657 _prev_end_offset = cur_offset + envelope_size;
1658 if 5 > max_ordinal {
1659 return Ok(());
1660 }
1661
1662 let cur_offset: usize = (5 - 1) * envelope_size;
1665
1666 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1668
1669 fidl::encoding::encode_in_envelope_optional::<
1674 fidl::encoding::HandleType<
1675 fdomain_client::Clock,
1676 { fidl::ObjectType::CLOCK.into_raw() },
1677 2147483648,
1678 >,
1679 fdomain_client::fidl::FDomainResourceDialect,
1680 >(
1681 self.reference_clock.as_mut().map(
1682 <fidl::encoding::HandleType<
1683 fdomain_client::Clock,
1684 { fidl::ObjectType::CLOCK.into_raw() },
1685 2147483648,
1686 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1687 ),
1688 encoder,
1689 offset + cur_offset,
1690 depth,
1691 )?;
1692
1693 _prev_end_offset = cur_offset + envelope_size;
1694 if 6 > max_ordinal {
1695 return Ok(());
1696 }
1697
1698 let cur_offset: usize = (6 - 1) * envelope_size;
1701
1702 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1704
1705 fidl::encoding::encode_in_envelope_optional::<
1710 u32,
1711 fdomain_client::fidl::FDomainResourceDialect,
1712 >(
1713 self.reference_clock_domain
1714 .as_ref()
1715 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1716 encoder,
1717 offset + cur_offset,
1718 depth,
1719 )?;
1720
1721 _prev_end_offset = cur_offset + envelope_size;
1722
1723 Ok(())
1724 }
1725 }
1726
1727 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for RingBuffer {
1728 #[inline(always)]
1729 fn new_empty() -> Self {
1730 Self::default()
1731 }
1732
1733 unsafe fn decode(
1734 &mut self,
1735 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1736 offset: usize,
1737 mut depth: fidl::encoding::Depth,
1738 ) -> fidl::Result<()> {
1739 decoder.debug_check_bounds::<Self>(offset);
1740 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1741 None => return Err(fidl::Error::NotNullable),
1742 Some(len) => len,
1743 };
1744 if len == 0 {
1746 return Ok(());
1747 };
1748 depth.increment()?;
1749 let envelope_size = 8;
1750 let bytes_len = len * envelope_size;
1751 let offset = decoder.out_of_line_offset(bytes_len)?;
1752 let mut _next_ordinal_to_read = 0;
1754 let mut next_offset = offset;
1755 let end_offset = offset + bytes_len;
1756 _next_ordinal_to_read += 1;
1757 if next_offset >= end_offset {
1758 return Ok(());
1759 }
1760
1761 while _next_ordinal_to_read < 1 {
1763 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1764 _next_ordinal_to_read += 1;
1765 next_offset += envelope_size;
1766 }
1767
1768 let next_out_of_line = decoder.next_out_of_line();
1769 let handles_before = decoder.remaining_handles();
1770 if let Some((inlined, num_bytes, num_handles)) =
1771 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1772 {
1773 let member_inline_size =
1774 <fdomain_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
1775 decoder.context,
1776 );
1777 if inlined != (member_inline_size <= 4) {
1778 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1779 }
1780 let inner_offset;
1781 let mut inner_depth = depth.clone();
1782 if inlined {
1783 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1784 inner_offset = next_offset;
1785 } else {
1786 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1787 inner_depth.increment()?;
1788 }
1789 let val_ref = self.buffer.get_or_insert_with(|| {
1790 fidl::new_empty!(
1791 fdomain_fuchsia_mem::Buffer,
1792 fdomain_client::fidl::FDomainResourceDialect
1793 )
1794 });
1795 fidl::decode!(
1796 fdomain_fuchsia_mem::Buffer,
1797 fdomain_client::fidl::FDomainResourceDialect,
1798 val_ref,
1799 decoder,
1800 inner_offset,
1801 inner_depth
1802 )?;
1803 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1804 {
1805 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1806 }
1807 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1808 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1809 }
1810 }
1811
1812 next_offset += envelope_size;
1813 _next_ordinal_to_read += 1;
1814 if next_offset >= end_offset {
1815 return Ok(());
1816 }
1817
1818 while _next_ordinal_to_read < 2 {
1820 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1821 _next_ordinal_to_read += 1;
1822 next_offset += envelope_size;
1823 }
1824
1825 let next_out_of_line = decoder.next_out_of_line();
1826 let handles_before = decoder.remaining_handles();
1827 if let Some((inlined, num_bytes, num_handles)) =
1828 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1829 {
1830 let member_inline_size =
1831 <Format as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1832 if inlined != (member_inline_size <= 4) {
1833 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1834 }
1835 let inner_offset;
1836 let mut inner_depth = depth.clone();
1837 if inlined {
1838 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1839 inner_offset = next_offset;
1840 } else {
1841 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1842 inner_depth.increment()?;
1843 }
1844 let val_ref = self.format.get_or_insert_with(|| {
1845 fidl::new_empty!(Format, fdomain_client::fidl::FDomainResourceDialect)
1846 });
1847 fidl::decode!(
1848 Format,
1849 fdomain_client::fidl::FDomainResourceDialect,
1850 val_ref,
1851 decoder,
1852 inner_offset,
1853 inner_depth
1854 )?;
1855 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1856 {
1857 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1858 }
1859 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1860 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1861 }
1862 }
1863
1864 next_offset += envelope_size;
1865 _next_ordinal_to_read += 1;
1866 if next_offset >= end_offset {
1867 return Ok(());
1868 }
1869
1870 while _next_ordinal_to_read < 3 {
1872 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1873 _next_ordinal_to_read += 1;
1874 next_offset += envelope_size;
1875 }
1876
1877 let next_out_of_line = decoder.next_out_of_line();
1878 let handles_before = decoder.remaining_handles();
1879 if let Some((inlined, num_bytes, num_handles)) =
1880 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1881 {
1882 let member_inline_size =
1883 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1884 if inlined != (member_inline_size <= 4) {
1885 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1886 }
1887 let inner_offset;
1888 let mut inner_depth = depth.clone();
1889 if inlined {
1890 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1891 inner_offset = next_offset;
1892 } else {
1893 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1894 inner_depth.increment()?;
1895 }
1896 let val_ref = self.producer_bytes.get_or_insert_with(|| {
1897 fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
1898 });
1899 fidl::decode!(
1900 u64,
1901 fdomain_client::fidl::FDomainResourceDialect,
1902 val_ref,
1903 decoder,
1904 inner_offset,
1905 inner_depth
1906 )?;
1907 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1908 {
1909 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1910 }
1911 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1912 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1913 }
1914 }
1915
1916 next_offset += envelope_size;
1917 _next_ordinal_to_read += 1;
1918 if next_offset >= end_offset {
1919 return Ok(());
1920 }
1921
1922 while _next_ordinal_to_read < 4 {
1924 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1925 _next_ordinal_to_read += 1;
1926 next_offset += envelope_size;
1927 }
1928
1929 let next_out_of_line = decoder.next_out_of_line();
1930 let handles_before = decoder.remaining_handles();
1931 if let Some((inlined, num_bytes, num_handles)) =
1932 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1933 {
1934 let member_inline_size =
1935 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1936 if inlined != (member_inline_size <= 4) {
1937 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1938 }
1939 let inner_offset;
1940 let mut inner_depth = depth.clone();
1941 if inlined {
1942 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1943 inner_offset = next_offset;
1944 } else {
1945 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1946 inner_depth.increment()?;
1947 }
1948 let val_ref = self.consumer_bytes.get_or_insert_with(|| {
1949 fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
1950 });
1951 fidl::decode!(
1952 u64,
1953 fdomain_client::fidl::FDomainResourceDialect,
1954 val_ref,
1955 decoder,
1956 inner_offset,
1957 inner_depth
1958 )?;
1959 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1960 {
1961 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1962 }
1963 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1964 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1965 }
1966 }
1967
1968 next_offset += envelope_size;
1969 _next_ordinal_to_read += 1;
1970 if next_offset >= end_offset {
1971 return Ok(());
1972 }
1973
1974 while _next_ordinal_to_read < 5 {
1976 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1977 _next_ordinal_to_read += 1;
1978 next_offset += envelope_size;
1979 }
1980
1981 let next_out_of_line = decoder.next_out_of_line();
1982 let handles_before = decoder.remaining_handles();
1983 if let Some((inlined, num_bytes, num_handles)) =
1984 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1985 {
1986 let member_inline_size = <fidl::encoding::HandleType<
1987 fdomain_client::Clock,
1988 { fidl::ObjectType::CLOCK.into_raw() },
1989 2147483648,
1990 > as fidl::encoding::TypeMarker>::inline_size(
1991 decoder.context
1992 );
1993 if inlined != (member_inline_size <= 4) {
1994 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1995 }
1996 let inner_offset;
1997 let mut inner_depth = depth.clone();
1998 if inlined {
1999 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2000 inner_offset = next_offset;
2001 } else {
2002 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2003 inner_depth.increment()?;
2004 }
2005 let val_ref =
2006 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));
2007 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)?;
2008 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2009 {
2010 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2011 }
2012 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2013 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2014 }
2015 }
2016
2017 next_offset += envelope_size;
2018 _next_ordinal_to_read += 1;
2019 if next_offset >= end_offset {
2020 return Ok(());
2021 }
2022
2023 while _next_ordinal_to_read < 6 {
2025 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2026 _next_ordinal_to_read += 1;
2027 next_offset += envelope_size;
2028 }
2029
2030 let next_out_of_line = decoder.next_out_of_line();
2031 let handles_before = decoder.remaining_handles();
2032 if let Some((inlined, num_bytes, num_handles)) =
2033 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2034 {
2035 let member_inline_size =
2036 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2037 if inlined != (member_inline_size <= 4) {
2038 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2039 }
2040 let inner_offset;
2041 let mut inner_depth = depth.clone();
2042 if inlined {
2043 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2044 inner_offset = next_offset;
2045 } else {
2046 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2047 inner_depth.increment()?;
2048 }
2049 let val_ref = self.reference_clock_domain.get_or_insert_with(|| {
2050 fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect)
2051 });
2052 fidl::decode!(
2053 u32,
2054 fdomain_client::fidl::FDomainResourceDialect,
2055 val_ref,
2056 decoder,
2057 inner_offset,
2058 inner_depth
2059 )?;
2060 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2061 {
2062 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2063 }
2064 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2065 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2066 }
2067 }
2068
2069 next_offset += envelope_size;
2070
2071 while next_offset < end_offset {
2073 _next_ordinal_to_read += 1;
2074 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2075 next_offset += envelope_size;
2076 }
2077
2078 Ok(())
2079 }
2080 }
2081
2082 impl StreamSinkPutPacketRequest {
2083 #[inline(always)]
2084 fn max_ordinal_present(&self) -> u64 {
2085 if let Some(_) = self.release_fence {
2086 return 2;
2087 }
2088 if let Some(_) = self.packet {
2089 return 1;
2090 }
2091 0
2092 }
2093 }
2094
2095 impl fidl::encoding::ResourceTypeMarker for StreamSinkPutPacketRequest {
2096 type Borrowed<'a> = &'a mut Self;
2097 fn take_or_borrow<'a>(
2098 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2099 ) -> Self::Borrowed<'a> {
2100 value
2101 }
2102 }
2103
2104 unsafe impl fidl::encoding::TypeMarker for StreamSinkPutPacketRequest {
2105 type Owned = Self;
2106
2107 #[inline(always)]
2108 fn inline_align(_context: fidl::encoding::Context) -> usize {
2109 8
2110 }
2111
2112 #[inline(always)]
2113 fn inline_size(_context: fidl::encoding::Context) -> usize {
2114 16
2115 }
2116 }
2117
2118 unsafe impl
2119 fidl::encoding::Encode<
2120 StreamSinkPutPacketRequest,
2121 fdomain_client::fidl::FDomainResourceDialect,
2122 > for &mut StreamSinkPutPacketRequest
2123 {
2124 unsafe fn encode(
2125 self,
2126 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2127 offset: usize,
2128 mut depth: fidl::encoding::Depth,
2129 ) -> fidl::Result<()> {
2130 encoder.debug_check_bounds::<StreamSinkPutPacketRequest>(offset);
2131 let max_ordinal: u64 = self.max_ordinal_present();
2133 encoder.write_num(max_ordinal, offset);
2134 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2135 if max_ordinal == 0 {
2137 return Ok(());
2138 }
2139 depth.increment()?;
2140 let envelope_size = 8;
2141 let bytes_len = max_ordinal as usize * envelope_size;
2142 #[allow(unused_variables)]
2143 let offset = encoder.out_of_line_offset(bytes_len);
2144 let mut _prev_end_offset: usize = 0;
2145 if 1 > max_ordinal {
2146 return Ok(());
2147 }
2148
2149 let cur_offset: usize = (1 - 1) * envelope_size;
2152
2153 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2155
2156 fidl::encoding::encode_in_envelope_optional::<
2161 Packet,
2162 fdomain_client::fidl::FDomainResourceDialect,
2163 >(
2164 self.packet.as_ref().map(<Packet as fidl::encoding::ValueTypeMarker>::borrow),
2165 encoder,
2166 offset + cur_offset,
2167 depth,
2168 )?;
2169
2170 _prev_end_offset = cur_offset + envelope_size;
2171 if 2 > max_ordinal {
2172 return Ok(());
2173 }
2174
2175 let cur_offset: usize = (2 - 1) * envelope_size;
2178
2179 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2181
2182 fidl::encoding::encode_in_envelope_optional::<
2187 fidl::encoding::HandleType<
2188 fdomain_client::EventPair,
2189 { fidl::ObjectType::EVENTPAIR.into_raw() },
2190 2147483648,
2191 >,
2192 fdomain_client::fidl::FDomainResourceDialect,
2193 >(
2194 self.release_fence.as_mut().map(
2195 <fidl::encoding::HandleType<
2196 fdomain_client::EventPair,
2197 { fidl::ObjectType::EVENTPAIR.into_raw() },
2198 2147483648,
2199 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2200 ),
2201 encoder,
2202 offset + cur_offset,
2203 depth,
2204 )?;
2205
2206 _prev_end_offset = cur_offset + envelope_size;
2207
2208 Ok(())
2209 }
2210 }
2211
2212 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2213 for StreamSinkPutPacketRequest
2214 {
2215 #[inline(always)]
2216 fn new_empty() -> Self {
2217 Self::default()
2218 }
2219
2220 unsafe fn decode(
2221 &mut self,
2222 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2223 offset: usize,
2224 mut depth: fidl::encoding::Depth,
2225 ) -> fidl::Result<()> {
2226 decoder.debug_check_bounds::<Self>(offset);
2227 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2228 None => return Err(fidl::Error::NotNullable),
2229 Some(len) => len,
2230 };
2231 if len == 0 {
2233 return Ok(());
2234 };
2235 depth.increment()?;
2236 let envelope_size = 8;
2237 let bytes_len = len * envelope_size;
2238 let offset = decoder.out_of_line_offset(bytes_len)?;
2239 let mut _next_ordinal_to_read = 0;
2241 let mut next_offset = offset;
2242 let end_offset = offset + bytes_len;
2243 _next_ordinal_to_read += 1;
2244 if next_offset >= end_offset {
2245 return Ok(());
2246 }
2247
2248 while _next_ordinal_to_read < 1 {
2250 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2251 _next_ordinal_to_read += 1;
2252 next_offset += envelope_size;
2253 }
2254
2255 let next_out_of_line = decoder.next_out_of_line();
2256 let handles_before = decoder.remaining_handles();
2257 if let Some((inlined, num_bytes, num_handles)) =
2258 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2259 {
2260 let member_inline_size =
2261 <Packet as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2262 if inlined != (member_inline_size <= 4) {
2263 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2264 }
2265 let inner_offset;
2266 let mut inner_depth = depth.clone();
2267 if inlined {
2268 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2269 inner_offset = next_offset;
2270 } else {
2271 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2272 inner_depth.increment()?;
2273 }
2274 let val_ref = self.packet.get_or_insert_with(|| {
2275 fidl::new_empty!(Packet, fdomain_client::fidl::FDomainResourceDialect)
2276 });
2277 fidl::decode!(
2278 Packet,
2279 fdomain_client::fidl::FDomainResourceDialect,
2280 val_ref,
2281 decoder,
2282 inner_offset,
2283 inner_depth
2284 )?;
2285 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2286 {
2287 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2288 }
2289 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2290 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2291 }
2292 }
2293
2294 next_offset += envelope_size;
2295 _next_ordinal_to_read += 1;
2296 if next_offset >= end_offset {
2297 return Ok(());
2298 }
2299
2300 while _next_ordinal_to_read < 2 {
2302 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2303 _next_ordinal_to_read += 1;
2304 next_offset += envelope_size;
2305 }
2306
2307 let next_out_of_line = decoder.next_out_of_line();
2308 let handles_before = decoder.remaining_handles();
2309 if let Some((inlined, num_bytes, num_handles)) =
2310 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2311 {
2312 let member_inline_size = <fidl::encoding::HandleType<
2313 fdomain_client::EventPair,
2314 { fidl::ObjectType::EVENTPAIR.into_raw() },
2315 2147483648,
2316 > as fidl::encoding::TypeMarker>::inline_size(
2317 decoder.context
2318 );
2319 if inlined != (member_inline_size <= 4) {
2320 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2321 }
2322 let inner_offset;
2323 let mut inner_depth = depth.clone();
2324 if inlined {
2325 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2326 inner_offset = next_offset;
2327 } else {
2328 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2329 inner_depth.increment()?;
2330 }
2331 let val_ref =
2332 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));
2333 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)?;
2334 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2335 {
2336 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2337 }
2338 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2339 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2340 }
2341 }
2342
2343 next_offset += envelope_size;
2344
2345 while next_offset < end_offset {
2347 _next_ordinal_to_read += 1;
2348 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2349 next_offset += envelope_size;
2350 }
2351
2352 Ok(())
2353 }
2354 }
2355}