1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_bluetooth_internal_a2dp__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ControllerSuspendRequest {
16 pub peer_id: Option<Box<fidl_fuchsia_bluetooth::PeerId>>,
17 pub token: fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerSuspendRequest {}
21
22#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
23pub struct ControllerMarker;
24
25impl fidl::endpoints::ProtocolMarker for ControllerMarker {
26 type Proxy = ControllerProxy;
27 type RequestStream = ControllerRequestStream;
28 #[cfg(target_os = "fuchsia")]
29 type SynchronousProxy = ControllerSynchronousProxy;
30
31 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.internal.a2dp.Controller";
32}
33impl fidl::endpoints::DiscoverableProtocolMarker for ControllerMarker {}
34
35pub trait ControllerProxyInterface: Send + Sync {
36 type SuspendResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
37 fn r#suspend(
38 &self,
39 peer_id: Option<&fidl_fuchsia_bluetooth::PeerId>,
40 token: fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
41 ) -> Self::SuspendResponseFut;
42}
43#[derive(Debug)]
44#[cfg(target_os = "fuchsia")]
45pub struct ControllerSynchronousProxy {
46 client: fidl::client::sync::Client,
47}
48
49#[cfg(target_os = "fuchsia")]
50impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
51 type Proxy = ControllerProxy;
52 type Protocol = ControllerMarker;
53
54 fn from_channel(inner: fidl::Channel) -> Self {
55 Self::new(inner)
56 }
57
58 fn into_channel(self) -> fidl::Channel {
59 self.client.into_channel()
60 }
61
62 fn as_channel(&self) -> &fidl::Channel {
63 self.client.as_channel()
64 }
65}
66
67#[cfg(target_os = "fuchsia")]
68impl ControllerSynchronousProxy {
69 pub fn new(channel: fidl::Channel) -> Self {
70 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
71 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
72 }
73
74 pub fn into_channel(self) -> fidl::Channel {
75 self.client.into_channel()
76 }
77
78 pub fn wait_for_event(
81 &self,
82 deadline: zx::MonotonicInstant,
83 ) -> Result<ControllerEvent, fidl::Error> {
84 ControllerEvent::decode(self.client.wait_for_event(deadline)?)
85 }
86
87 pub fn r#suspend(
108 &self,
109 mut peer_id: Option<&fidl_fuchsia_bluetooth::PeerId>,
110 mut token: fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
111 ___deadline: zx::MonotonicInstant,
112 ) -> Result<(), fidl::Error> {
113 let _response =
114 self.client.send_query::<ControllerSuspendRequest, fidl::encoding::EmptyPayload>(
115 (peer_id, token),
116 0xe68646aaf69cb61,
117 fidl::encoding::DynamicFlags::empty(),
118 ___deadline,
119 )?;
120 Ok(_response)
121 }
122}
123
124#[cfg(target_os = "fuchsia")]
125impl From<ControllerSynchronousProxy> for zx::Handle {
126 fn from(value: ControllerSynchronousProxy) -> Self {
127 value.into_channel().into()
128 }
129}
130
131#[cfg(target_os = "fuchsia")]
132impl From<fidl::Channel> for ControllerSynchronousProxy {
133 fn from(value: fidl::Channel) -> Self {
134 Self::new(value)
135 }
136}
137
138#[cfg(target_os = "fuchsia")]
139impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
140 type Protocol = ControllerMarker;
141
142 fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
143 Self::new(value.into_channel())
144 }
145}
146
147#[derive(Debug, Clone)]
148pub struct ControllerProxy {
149 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
150}
151
152impl fidl::endpoints::Proxy for ControllerProxy {
153 type Protocol = ControllerMarker;
154
155 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
156 Self::new(inner)
157 }
158
159 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
160 self.client.into_channel().map_err(|client| Self { client })
161 }
162
163 fn as_channel(&self) -> &::fidl::AsyncChannel {
164 self.client.as_channel()
165 }
166}
167
168impl ControllerProxy {
169 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
171 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
172 Self { client: fidl::client::Client::new(channel, protocol_name) }
173 }
174
175 pub fn take_event_stream(&self) -> ControllerEventStream {
181 ControllerEventStream { event_receiver: self.client.take_event_receiver() }
182 }
183
184 pub fn r#suspend(
205 &self,
206 mut peer_id: Option<&fidl_fuchsia_bluetooth::PeerId>,
207 mut token: fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
208 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
209 ControllerProxyInterface::r#suspend(self, peer_id, token)
210 }
211}
212
213impl ControllerProxyInterface for ControllerProxy {
214 type SuspendResponseFut =
215 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
216 fn r#suspend(
217 &self,
218 mut peer_id: Option<&fidl_fuchsia_bluetooth::PeerId>,
219 mut token: fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
220 ) -> Self::SuspendResponseFut {
221 fn _decode(
222 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
223 ) -> Result<(), fidl::Error> {
224 let _response = fidl::client::decode_transaction_body::<
225 fidl::encoding::EmptyPayload,
226 fidl::encoding::DefaultFuchsiaResourceDialect,
227 0xe68646aaf69cb61,
228 >(_buf?)?;
229 Ok(_response)
230 }
231 self.client.send_query_and_decode::<ControllerSuspendRequest, ()>(
232 (peer_id, token),
233 0xe68646aaf69cb61,
234 fidl::encoding::DynamicFlags::empty(),
235 _decode,
236 )
237 }
238}
239
240pub struct ControllerEventStream {
241 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
242}
243
244impl std::marker::Unpin for ControllerEventStream {}
245
246impl futures::stream::FusedStream for ControllerEventStream {
247 fn is_terminated(&self) -> bool {
248 self.event_receiver.is_terminated()
249 }
250}
251
252impl futures::Stream for ControllerEventStream {
253 type Item = Result<ControllerEvent, fidl::Error>;
254
255 fn poll_next(
256 mut self: std::pin::Pin<&mut Self>,
257 cx: &mut std::task::Context<'_>,
258 ) -> std::task::Poll<Option<Self::Item>> {
259 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
260 &mut self.event_receiver,
261 cx
262 )?) {
263 Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
264 None => std::task::Poll::Ready(None),
265 }
266 }
267}
268
269#[derive(Debug)]
270pub enum ControllerEvent {}
271
272impl ControllerEvent {
273 fn decode(
275 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
276 ) -> Result<ControllerEvent, fidl::Error> {
277 let (bytes, _handles) = buf.split_mut();
278 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
279 debug_assert_eq!(tx_header.tx_id, 0);
280 match tx_header.ordinal {
281 _ => Err(fidl::Error::UnknownOrdinal {
282 ordinal: tx_header.ordinal,
283 protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
284 }),
285 }
286 }
287}
288
289pub struct ControllerRequestStream {
291 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
292 is_terminated: bool,
293}
294
295impl std::marker::Unpin for ControllerRequestStream {}
296
297impl futures::stream::FusedStream for ControllerRequestStream {
298 fn is_terminated(&self) -> bool {
299 self.is_terminated
300 }
301}
302
303impl fidl::endpoints::RequestStream for ControllerRequestStream {
304 type Protocol = ControllerMarker;
305 type ControlHandle = ControllerControlHandle;
306
307 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
308 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
309 }
310
311 fn control_handle(&self) -> Self::ControlHandle {
312 ControllerControlHandle { inner: self.inner.clone() }
313 }
314
315 fn into_inner(
316 self,
317 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
318 {
319 (self.inner, self.is_terminated)
320 }
321
322 fn from_inner(
323 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
324 is_terminated: bool,
325 ) -> Self {
326 Self { inner, is_terminated }
327 }
328}
329
330impl futures::Stream for ControllerRequestStream {
331 type Item = Result<ControllerRequest, fidl::Error>;
332
333 fn poll_next(
334 mut self: std::pin::Pin<&mut Self>,
335 cx: &mut std::task::Context<'_>,
336 ) -> std::task::Poll<Option<Self::Item>> {
337 let this = &mut *self;
338 if this.inner.check_shutdown(cx) {
339 this.is_terminated = true;
340 return std::task::Poll::Ready(None);
341 }
342 if this.is_terminated {
343 panic!("polled ControllerRequestStream after completion");
344 }
345 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
346 |bytes, handles| {
347 match this.inner.channel().read_etc(cx, bytes, handles) {
348 std::task::Poll::Ready(Ok(())) => {}
349 std::task::Poll::Pending => return std::task::Poll::Pending,
350 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
351 this.is_terminated = true;
352 return std::task::Poll::Ready(None);
353 }
354 std::task::Poll::Ready(Err(e)) => {
355 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
356 e.into(),
357 ))))
358 }
359 }
360
361 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
363
364 std::task::Poll::Ready(Some(match header.ordinal {
365 0xe68646aaf69cb61 => {
366 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
367 let mut req = fidl::new_empty!(
368 ControllerSuspendRequest,
369 fidl::encoding::DefaultFuchsiaResourceDialect
370 );
371 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSuspendRequest>(&header, _body_bytes, handles, &mut req)?;
372 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
373 Ok(ControllerRequest::Suspend {
374 peer_id: req.peer_id,
375 token: req.token,
376
377 responder: ControllerSuspendResponder {
378 control_handle: std::mem::ManuallyDrop::new(control_handle),
379 tx_id: header.tx_id,
380 },
381 })
382 }
383 _ => Err(fidl::Error::UnknownOrdinal {
384 ordinal: header.ordinal,
385 protocol_name:
386 <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
387 }),
388 }))
389 },
390 )
391 }
392}
393
394#[derive(Debug)]
396pub enum ControllerRequest {
397 Suspend {
418 peer_id: Option<Box<fidl_fuchsia_bluetooth::PeerId>>,
419 token: fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
420 responder: ControllerSuspendResponder,
421 },
422}
423
424impl ControllerRequest {
425 #[allow(irrefutable_let_patterns)]
426 pub fn into_suspend(
427 self,
428 ) -> Option<(
429 Option<Box<fidl_fuchsia_bluetooth::PeerId>>,
430 fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
431 ControllerSuspendResponder,
432 )> {
433 if let ControllerRequest::Suspend { peer_id, token, responder } = self {
434 Some((peer_id, token, responder))
435 } else {
436 None
437 }
438 }
439
440 pub fn method_name(&self) -> &'static str {
442 match *self {
443 ControllerRequest::Suspend { .. } => "suspend",
444 }
445 }
446}
447
448#[derive(Debug, Clone)]
449pub struct ControllerControlHandle {
450 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
451}
452
453impl fidl::endpoints::ControlHandle for ControllerControlHandle {
454 fn shutdown(&self) {
455 self.inner.shutdown()
456 }
457 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
458 self.inner.shutdown_with_epitaph(status)
459 }
460
461 fn is_closed(&self) -> bool {
462 self.inner.channel().is_closed()
463 }
464 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
465 self.inner.channel().on_closed()
466 }
467
468 #[cfg(target_os = "fuchsia")]
469 fn signal_peer(
470 &self,
471 clear_mask: zx::Signals,
472 set_mask: zx::Signals,
473 ) -> Result<(), zx_status::Status> {
474 use fidl::Peered;
475 self.inner.channel().signal_peer(clear_mask, set_mask)
476 }
477}
478
479impl ControllerControlHandle {}
480
481#[must_use = "FIDL methods require a response to be sent"]
482#[derive(Debug)]
483pub struct ControllerSuspendResponder {
484 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
485 tx_id: u32,
486}
487
488impl std::ops::Drop for ControllerSuspendResponder {
492 fn drop(&mut self) {
493 self.control_handle.shutdown();
494 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
496 }
497}
498
499impl fidl::endpoints::Responder for ControllerSuspendResponder {
500 type ControlHandle = ControllerControlHandle;
501
502 fn control_handle(&self) -> &ControllerControlHandle {
503 &self.control_handle
504 }
505
506 fn drop_without_shutdown(mut self) {
507 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
509 std::mem::forget(self);
511 }
512}
513
514impl ControllerSuspendResponder {
515 pub fn send(self) -> Result<(), fidl::Error> {
519 let _result = self.send_raw();
520 if _result.is_err() {
521 self.control_handle.shutdown();
522 }
523 self.drop_without_shutdown();
524 _result
525 }
526
527 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
529 let _result = self.send_raw();
530 self.drop_without_shutdown();
531 _result
532 }
533
534 fn send_raw(&self) -> Result<(), fidl::Error> {
535 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
536 (),
537 self.tx_id,
538 0xe68646aaf69cb61,
539 fidl::encoding::DynamicFlags::empty(),
540 )
541 }
542}
543
544#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
545pub struct StreamSuspenderMarker;
546
547impl fidl::endpoints::ProtocolMarker for StreamSuspenderMarker {
548 type Proxy = StreamSuspenderProxy;
549 type RequestStream = StreamSuspenderRequestStream;
550 #[cfg(target_os = "fuchsia")]
551 type SynchronousProxy = StreamSuspenderSynchronousProxy;
552
553 const DEBUG_NAME: &'static str = "(anonymous) StreamSuspender";
554}
555
556pub trait StreamSuspenderProxyInterface: Send + Sync {}
557#[derive(Debug)]
558#[cfg(target_os = "fuchsia")]
559pub struct StreamSuspenderSynchronousProxy {
560 client: fidl::client::sync::Client,
561}
562
563#[cfg(target_os = "fuchsia")]
564impl fidl::endpoints::SynchronousProxy for StreamSuspenderSynchronousProxy {
565 type Proxy = StreamSuspenderProxy;
566 type Protocol = StreamSuspenderMarker;
567
568 fn from_channel(inner: fidl::Channel) -> Self {
569 Self::new(inner)
570 }
571
572 fn into_channel(self) -> fidl::Channel {
573 self.client.into_channel()
574 }
575
576 fn as_channel(&self) -> &fidl::Channel {
577 self.client.as_channel()
578 }
579}
580
581#[cfg(target_os = "fuchsia")]
582impl StreamSuspenderSynchronousProxy {
583 pub fn new(channel: fidl::Channel) -> Self {
584 let protocol_name = <StreamSuspenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
585 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
586 }
587
588 pub fn into_channel(self) -> fidl::Channel {
589 self.client.into_channel()
590 }
591
592 pub fn wait_for_event(
595 &self,
596 deadline: zx::MonotonicInstant,
597 ) -> Result<StreamSuspenderEvent, fidl::Error> {
598 StreamSuspenderEvent::decode(self.client.wait_for_event(deadline)?)
599 }
600}
601
602#[cfg(target_os = "fuchsia")]
603impl From<StreamSuspenderSynchronousProxy> for zx::Handle {
604 fn from(value: StreamSuspenderSynchronousProxy) -> Self {
605 value.into_channel().into()
606 }
607}
608
609#[cfg(target_os = "fuchsia")]
610impl From<fidl::Channel> for StreamSuspenderSynchronousProxy {
611 fn from(value: fidl::Channel) -> Self {
612 Self::new(value)
613 }
614}
615
616#[cfg(target_os = "fuchsia")]
617impl fidl::endpoints::FromClient for StreamSuspenderSynchronousProxy {
618 type Protocol = StreamSuspenderMarker;
619
620 fn from_client(value: fidl::endpoints::ClientEnd<StreamSuspenderMarker>) -> Self {
621 Self::new(value.into_channel())
622 }
623}
624
625#[derive(Debug, Clone)]
626pub struct StreamSuspenderProxy {
627 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
628}
629
630impl fidl::endpoints::Proxy for StreamSuspenderProxy {
631 type Protocol = StreamSuspenderMarker;
632
633 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
634 Self::new(inner)
635 }
636
637 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
638 self.client.into_channel().map_err(|client| Self { client })
639 }
640
641 fn as_channel(&self) -> &::fidl::AsyncChannel {
642 self.client.as_channel()
643 }
644}
645
646impl StreamSuspenderProxy {
647 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
649 let protocol_name = <StreamSuspenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
650 Self { client: fidl::client::Client::new(channel, protocol_name) }
651 }
652
653 pub fn take_event_stream(&self) -> StreamSuspenderEventStream {
659 StreamSuspenderEventStream { event_receiver: self.client.take_event_receiver() }
660 }
661}
662
663impl StreamSuspenderProxyInterface for StreamSuspenderProxy {}
664
665pub struct StreamSuspenderEventStream {
666 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
667}
668
669impl std::marker::Unpin for StreamSuspenderEventStream {}
670
671impl futures::stream::FusedStream for StreamSuspenderEventStream {
672 fn is_terminated(&self) -> bool {
673 self.event_receiver.is_terminated()
674 }
675}
676
677impl futures::Stream for StreamSuspenderEventStream {
678 type Item = Result<StreamSuspenderEvent, fidl::Error>;
679
680 fn poll_next(
681 mut self: std::pin::Pin<&mut Self>,
682 cx: &mut std::task::Context<'_>,
683 ) -> std::task::Poll<Option<Self::Item>> {
684 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
685 &mut self.event_receiver,
686 cx
687 )?) {
688 Some(buf) => std::task::Poll::Ready(Some(StreamSuspenderEvent::decode(buf))),
689 None => std::task::Poll::Ready(None),
690 }
691 }
692}
693
694#[derive(Debug)]
695pub enum StreamSuspenderEvent {
696 OnSuspended {},
697}
698
699impl StreamSuspenderEvent {
700 #[allow(irrefutable_let_patterns)]
701 pub fn into_on_suspended(self) -> Option<()> {
702 if let StreamSuspenderEvent::OnSuspended {} = self {
703 Some(())
704 } else {
705 None
706 }
707 }
708
709 fn decode(
711 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
712 ) -> Result<StreamSuspenderEvent, fidl::Error> {
713 let (bytes, _handles) = buf.split_mut();
714 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
715 debug_assert_eq!(tx_header.tx_id, 0);
716 match tx_header.ordinal {
717 0x3f927abc531cba34 => {
718 let mut out = fidl::new_empty!(
719 fidl::encoding::EmptyPayload,
720 fidl::encoding::DefaultFuchsiaResourceDialect
721 );
722 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
723 Ok((StreamSuspenderEvent::OnSuspended {}))
724 }
725 _ => Err(fidl::Error::UnknownOrdinal {
726 ordinal: tx_header.ordinal,
727 protocol_name:
728 <StreamSuspenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
729 }),
730 }
731 }
732}
733
734pub struct StreamSuspenderRequestStream {
736 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
737 is_terminated: bool,
738}
739
740impl std::marker::Unpin for StreamSuspenderRequestStream {}
741
742impl futures::stream::FusedStream for StreamSuspenderRequestStream {
743 fn is_terminated(&self) -> bool {
744 self.is_terminated
745 }
746}
747
748impl fidl::endpoints::RequestStream for StreamSuspenderRequestStream {
749 type Protocol = StreamSuspenderMarker;
750 type ControlHandle = StreamSuspenderControlHandle;
751
752 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
753 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
754 }
755
756 fn control_handle(&self) -> Self::ControlHandle {
757 StreamSuspenderControlHandle { inner: self.inner.clone() }
758 }
759
760 fn into_inner(
761 self,
762 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
763 {
764 (self.inner, self.is_terminated)
765 }
766
767 fn from_inner(
768 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
769 is_terminated: bool,
770 ) -> Self {
771 Self { inner, is_terminated }
772 }
773}
774
775impl futures::Stream for StreamSuspenderRequestStream {
776 type Item = Result<StreamSuspenderRequest, fidl::Error>;
777
778 fn poll_next(
779 mut self: std::pin::Pin<&mut Self>,
780 cx: &mut std::task::Context<'_>,
781 ) -> std::task::Poll<Option<Self::Item>> {
782 let this = &mut *self;
783 if this.inner.check_shutdown(cx) {
784 this.is_terminated = true;
785 return std::task::Poll::Ready(None);
786 }
787 if this.is_terminated {
788 panic!("polled StreamSuspenderRequestStream after completion");
789 }
790 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
791 |bytes, handles| {
792 match this.inner.channel().read_etc(cx, bytes, handles) {
793 std::task::Poll::Ready(Ok(())) => {}
794 std::task::Poll::Pending => return std::task::Poll::Pending,
795 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
796 this.is_terminated = true;
797 return std::task::Poll::Ready(None);
798 }
799 std::task::Poll::Ready(Err(e)) => {
800 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
801 e.into(),
802 ))))
803 }
804 }
805
806 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
808
809 std::task::Poll::Ready(Some(match header.ordinal {
810 _ => Err(fidl::Error::UnknownOrdinal {
811 ordinal: header.ordinal,
812 protocol_name:
813 <StreamSuspenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
814 }),
815 }))
816 },
817 )
818 }
819}
820
821#[derive(Debug)]
823pub enum StreamSuspenderRequest {}
824
825impl StreamSuspenderRequest {
826 pub fn method_name(&self) -> &'static str {
828 match *self {}
829 }
830}
831
832#[derive(Debug, Clone)]
833pub struct StreamSuspenderControlHandle {
834 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
835}
836
837impl fidl::endpoints::ControlHandle for StreamSuspenderControlHandle {
838 fn shutdown(&self) {
839 self.inner.shutdown()
840 }
841 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
842 self.inner.shutdown_with_epitaph(status)
843 }
844
845 fn is_closed(&self) -> bool {
846 self.inner.channel().is_closed()
847 }
848 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
849 self.inner.channel().on_closed()
850 }
851
852 #[cfg(target_os = "fuchsia")]
853 fn signal_peer(
854 &self,
855 clear_mask: zx::Signals,
856 set_mask: zx::Signals,
857 ) -> Result<(), zx_status::Status> {
858 use fidl::Peered;
859 self.inner.channel().signal_peer(clear_mask, set_mask)
860 }
861}
862
863impl StreamSuspenderControlHandle {
864 pub fn send_on_suspended(&self) -> Result<(), fidl::Error> {
865 self.inner.send::<fidl::encoding::EmptyPayload>(
866 (),
867 0,
868 0x3f927abc531cba34,
869 fidl::encoding::DynamicFlags::empty(),
870 )
871 }
872}
873
874mod internal {
875 use super::*;
876
877 impl fidl::encoding::ResourceTypeMarker for ControllerSuspendRequest {
878 type Borrowed<'a> = &'a mut Self;
879 fn take_or_borrow<'a>(
880 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
881 ) -> Self::Borrowed<'a> {
882 value
883 }
884 }
885
886 unsafe impl fidl::encoding::TypeMarker for ControllerSuspendRequest {
887 type Owned = Self;
888
889 #[inline(always)]
890 fn inline_align(_context: fidl::encoding::Context) -> usize {
891 8
892 }
893
894 #[inline(always)]
895 fn inline_size(_context: fidl::encoding::Context) -> usize {
896 16
897 }
898 }
899
900 unsafe impl
901 fidl::encoding::Encode<
902 ControllerSuspendRequest,
903 fidl::encoding::DefaultFuchsiaResourceDialect,
904 > for &mut ControllerSuspendRequest
905 {
906 #[inline]
907 unsafe fn encode(
908 self,
909 encoder: &mut fidl::encoding::Encoder<
910 '_,
911 fidl::encoding::DefaultFuchsiaResourceDialect,
912 >,
913 offset: usize,
914 _depth: fidl::encoding::Depth,
915 ) -> fidl::Result<()> {
916 encoder.debug_check_bounds::<ControllerSuspendRequest>(offset);
917 fidl::encoding::Encode::<ControllerSuspendRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
919 (
920 <fidl::encoding::Boxed<fidl_fuchsia_bluetooth::PeerId> as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
921 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSuspenderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
922 ),
923 encoder, offset, _depth
924 )
925 }
926 }
927 unsafe impl<
928 T0: fidl::encoding::Encode<
929 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::PeerId>,
930 fidl::encoding::DefaultFuchsiaResourceDialect,
931 >,
932 T1: fidl::encoding::Encode<
933 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSuspenderMarker>>,
934 fidl::encoding::DefaultFuchsiaResourceDialect,
935 >,
936 >
937 fidl::encoding::Encode<
938 ControllerSuspendRequest,
939 fidl::encoding::DefaultFuchsiaResourceDialect,
940 > for (T0, T1)
941 {
942 #[inline]
943 unsafe fn encode(
944 self,
945 encoder: &mut fidl::encoding::Encoder<
946 '_,
947 fidl::encoding::DefaultFuchsiaResourceDialect,
948 >,
949 offset: usize,
950 depth: fidl::encoding::Depth,
951 ) -> fidl::Result<()> {
952 encoder.debug_check_bounds::<ControllerSuspendRequest>(offset);
953 unsafe {
956 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
957 (ptr as *mut u64).write_unaligned(0);
958 }
959 self.0.encode(encoder, offset + 0, depth)?;
961 self.1.encode(encoder, offset + 8, depth)?;
962 Ok(())
963 }
964 }
965
966 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
967 for ControllerSuspendRequest
968 {
969 #[inline(always)]
970 fn new_empty() -> Self {
971 Self {
972 peer_id: fidl::new_empty!(
973 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::PeerId>,
974 fidl::encoding::DefaultFuchsiaResourceDialect
975 ),
976 token: fidl::new_empty!(
977 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSuspenderMarker>>,
978 fidl::encoding::DefaultFuchsiaResourceDialect
979 ),
980 }
981 }
982
983 #[inline]
984 unsafe fn decode(
985 &mut self,
986 decoder: &mut fidl::encoding::Decoder<
987 '_,
988 fidl::encoding::DefaultFuchsiaResourceDialect,
989 >,
990 offset: usize,
991 _depth: fidl::encoding::Depth,
992 ) -> fidl::Result<()> {
993 decoder.debug_check_bounds::<Self>(offset);
994 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
996 let padval = unsafe { (ptr as *const u64).read_unaligned() };
997 let mask = 0xffffffff00000000u64;
998 let maskedval = padval & mask;
999 if maskedval != 0 {
1000 return Err(fidl::Error::NonZeroPadding {
1001 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1002 });
1003 }
1004 fidl::decode!(
1005 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::PeerId>,
1006 fidl::encoding::DefaultFuchsiaResourceDialect,
1007 &mut self.peer_id,
1008 decoder,
1009 offset + 0,
1010 _depth
1011 )?;
1012 fidl::decode!(
1013 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSuspenderMarker>>,
1014 fidl::encoding::DefaultFuchsiaResourceDialect,
1015 &mut self.token,
1016 decoder,
1017 offset + 8,
1018 _depth
1019 )?;
1020 Ok(())
1021 }
1022 }
1023}