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