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_media_sessions2__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ActiveSessionWatchActiveSessionResponse {
16 pub session: Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for ActiveSessionWatchActiveSessionResponse
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct DiscoveryConnectToSessionRequest {
26 pub session_id: u64,
27 pub session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for DiscoveryConnectToSessionRequest
32{
33}
34
35#[derive(Debug, PartialEq)]
36pub struct DiscoveryWatchSessionsRequest {
37 pub watch_options: WatchOptions,
38 pub session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
39}
40
41impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
42 for DiscoveryWatchSessionsRequest
43{
44}
45
46#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub struct ObserverDiscoveryConnectToSessionRequest {
48 pub session_id: u64,
49 pub session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
53 for ObserverDiscoveryConnectToSessionRequest
54{
55}
56
57#[derive(Debug, PartialEq)]
58pub struct ObserverDiscoveryWatchSessionsRequest {
59 pub watch_options: WatchOptions,
60 pub sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
64 for ObserverDiscoveryWatchSessionsRequest
65{
66}
67
68#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
69pub struct PlayerControlBindVolumeControlRequest {
70 pub volume_control_request:
71 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
72}
73
74impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
75 for PlayerControlBindVolumeControlRequest
76{
77}
78
79#[derive(Debug, PartialEq)]
80pub struct PublisherPublishRequest {
81 pub player: fidl::endpoints::ClientEnd<PlayerMarker>,
82 pub registration: PlayerRegistration,
83}
84
85impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PublisherPublishRequest {}
86
87#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
88pub struct SessionControlBindVolumeControlRequest {
89 pub volume_control_request:
90 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
91}
92
93impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
94 for SessionControlBindVolumeControlRequest
95{
96}
97
98#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
99pub struct ActiveSessionMarker;
100
101impl fidl::endpoints::ProtocolMarker for ActiveSessionMarker {
102 type Proxy = ActiveSessionProxy;
103 type RequestStream = ActiveSessionRequestStream;
104 #[cfg(target_os = "fuchsia")]
105 type SynchronousProxy = ActiveSessionSynchronousProxy;
106
107 const DEBUG_NAME: &'static str = "fuchsia.media.sessions2.ActiveSession";
108}
109impl fidl::endpoints::DiscoverableProtocolMarker for ActiveSessionMarker {}
110
111pub trait ActiveSessionProxyInterface: Send + Sync {
112 type WatchActiveSessionResponseFut: std::future::Future<
113 Output = Result<Option<fidl::endpoints::ClientEnd<SessionControlMarker>>, fidl::Error>,
114 > + Send;
115 fn r#watch_active_session(&self) -> Self::WatchActiveSessionResponseFut;
116}
117#[derive(Debug)]
118#[cfg(target_os = "fuchsia")]
119pub struct ActiveSessionSynchronousProxy {
120 client: fidl::client::sync::Client,
121}
122
123#[cfg(target_os = "fuchsia")]
124impl fidl::endpoints::SynchronousProxy for ActiveSessionSynchronousProxy {
125 type Proxy = ActiveSessionProxy;
126 type Protocol = ActiveSessionMarker;
127
128 fn from_channel(inner: fidl::Channel) -> Self {
129 Self::new(inner)
130 }
131
132 fn into_channel(self) -> fidl::Channel {
133 self.client.into_channel()
134 }
135
136 fn as_channel(&self) -> &fidl::Channel {
137 self.client.as_channel()
138 }
139}
140
141#[cfg(target_os = "fuchsia")]
142impl ActiveSessionSynchronousProxy {
143 pub fn new(channel: fidl::Channel) -> Self {
144 Self { client: fidl::client::sync::Client::new(channel) }
145 }
146
147 pub fn into_channel(self) -> fidl::Channel {
148 self.client.into_channel()
149 }
150
151 pub fn wait_for_event(
154 &self,
155 deadline: zx::MonotonicInstant,
156 ) -> Result<ActiveSessionEvent, fidl::Error> {
157 ActiveSessionEvent::decode(self.client.wait_for_event::<ActiveSessionMarker>(deadline)?)
158 }
159
160 pub fn r#watch_active_session(
164 &self,
165 ___deadline: zx::MonotonicInstant,
166 ) -> Result<Option<fidl::endpoints::ClientEnd<SessionControlMarker>>, fidl::Error> {
167 let _response = self.client.send_query::<
168 fidl::encoding::EmptyPayload,
169 ActiveSessionWatchActiveSessionResponse,
170 ActiveSessionMarker,
171 >(
172 (),
173 0xc072168d525fff8,
174 fidl::encoding::DynamicFlags::empty(),
175 ___deadline,
176 )?;
177 Ok(_response.session)
178 }
179}
180
181#[cfg(target_os = "fuchsia")]
182impl From<ActiveSessionSynchronousProxy> for zx::NullableHandle {
183 fn from(value: ActiveSessionSynchronousProxy) -> Self {
184 value.into_channel().into()
185 }
186}
187
188#[cfg(target_os = "fuchsia")]
189impl From<fidl::Channel> for ActiveSessionSynchronousProxy {
190 fn from(value: fidl::Channel) -> Self {
191 Self::new(value)
192 }
193}
194
195#[cfg(target_os = "fuchsia")]
196impl fidl::endpoints::FromClient for ActiveSessionSynchronousProxy {
197 type Protocol = ActiveSessionMarker;
198
199 fn from_client(value: fidl::endpoints::ClientEnd<ActiveSessionMarker>) -> Self {
200 Self::new(value.into_channel())
201 }
202}
203
204#[derive(Debug, Clone)]
205pub struct ActiveSessionProxy {
206 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
207}
208
209impl fidl::endpoints::Proxy for ActiveSessionProxy {
210 type Protocol = ActiveSessionMarker;
211
212 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
213 Self::new(inner)
214 }
215
216 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
217 self.client.into_channel().map_err(|client| Self { client })
218 }
219
220 fn as_channel(&self) -> &::fidl::AsyncChannel {
221 self.client.as_channel()
222 }
223}
224
225impl ActiveSessionProxy {
226 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
228 let protocol_name = <ActiveSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
229 Self { client: fidl::client::Client::new(channel, protocol_name) }
230 }
231
232 pub fn take_event_stream(&self) -> ActiveSessionEventStream {
238 ActiveSessionEventStream { event_receiver: self.client.take_event_receiver() }
239 }
240
241 pub fn r#watch_active_session(
245 &self,
246 ) -> fidl::client::QueryResponseFut<
247 Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
248 fidl::encoding::DefaultFuchsiaResourceDialect,
249 > {
250 ActiveSessionProxyInterface::r#watch_active_session(self)
251 }
252}
253
254impl ActiveSessionProxyInterface for ActiveSessionProxy {
255 type WatchActiveSessionResponseFut = fidl::client::QueryResponseFut<
256 Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
257 fidl::encoding::DefaultFuchsiaResourceDialect,
258 >;
259 fn r#watch_active_session(&self) -> Self::WatchActiveSessionResponseFut {
260 fn _decode(
261 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
262 ) -> Result<Option<fidl::endpoints::ClientEnd<SessionControlMarker>>, fidl::Error> {
263 let _response = fidl::client::decode_transaction_body::<
264 ActiveSessionWatchActiveSessionResponse,
265 fidl::encoding::DefaultFuchsiaResourceDialect,
266 0xc072168d525fff8,
267 >(_buf?)?;
268 Ok(_response.session)
269 }
270 self.client.send_query_and_decode::<
271 fidl::encoding::EmptyPayload,
272 Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
273 >(
274 (),
275 0xc072168d525fff8,
276 fidl::encoding::DynamicFlags::empty(),
277 _decode,
278 )
279 }
280}
281
282pub struct ActiveSessionEventStream {
283 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
284}
285
286impl std::marker::Unpin for ActiveSessionEventStream {}
287
288impl futures::stream::FusedStream for ActiveSessionEventStream {
289 fn is_terminated(&self) -> bool {
290 self.event_receiver.is_terminated()
291 }
292}
293
294impl futures::Stream for ActiveSessionEventStream {
295 type Item = Result<ActiveSessionEvent, fidl::Error>;
296
297 fn poll_next(
298 mut self: std::pin::Pin<&mut Self>,
299 cx: &mut std::task::Context<'_>,
300 ) -> std::task::Poll<Option<Self::Item>> {
301 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
302 &mut self.event_receiver,
303 cx
304 )?) {
305 Some(buf) => std::task::Poll::Ready(Some(ActiveSessionEvent::decode(buf))),
306 None => std::task::Poll::Ready(None),
307 }
308 }
309}
310
311#[derive(Debug)]
312pub enum ActiveSessionEvent {}
313
314impl ActiveSessionEvent {
315 fn decode(
317 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
318 ) -> Result<ActiveSessionEvent, fidl::Error> {
319 let (bytes, _handles) = buf.split_mut();
320 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
321 debug_assert_eq!(tx_header.tx_id, 0);
322 match tx_header.ordinal {
323 _ => Err(fidl::Error::UnknownOrdinal {
324 ordinal: tx_header.ordinal,
325 protocol_name: <ActiveSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
326 }),
327 }
328 }
329}
330
331pub struct ActiveSessionRequestStream {
333 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
334 is_terminated: bool,
335}
336
337impl std::marker::Unpin for ActiveSessionRequestStream {}
338
339impl futures::stream::FusedStream for ActiveSessionRequestStream {
340 fn is_terminated(&self) -> bool {
341 self.is_terminated
342 }
343}
344
345impl fidl::endpoints::RequestStream for ActiveSessionRequestStream {
346 type Protocol = ActiveSessionMarker;
347 type ControlHandle = ActiveSessionControlHandle;
348
349 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
350 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
351 }
352
353 fn control_handle(&self) -> Self::ControlHandle {
354 ActiveSessionControlHandle { inner: self.inner.clone() }
355 }
356
357 fn into_inner(
358 self,
359 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
360 {
361 (self.inner, self.is_terminated)
362 }
363
364 fn from_inner(
365 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
366 is_terminated: bool,
367 ) -> Self {
368 Self { inner, is_terminated }
369 }
370}
371
372impl futures::Stream for ActiveSessionRequestStream {
373 type Item = Result<ActiveSessionRequest, fidl::Error>;
374
375 fn poll_next(
376 mut self: std::pin::Pin<&mut Self>,
377 cx: &mut std::task::Context<'_>,
378 ) -> std::task::Poll<Option<Self::Item>> {
379 let this = &mut *self;
380 if this.inner.check_shutdown(cx) {
381 this.is_terminated = true;
382 return std::task::Poll::Ready(None);
383 }
384 if this.is_terminated {
385 panic!("polled ActiveSessionRequestStream after completion");
386 }
387 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
388 |bytes, handles| {
389 match this.inner.channel().read_etc(cx, bytes, handles) {
390 std::task::Poll::Ready(Ok(())) => {}
391 std::task::Poll::Pending => return std::task::Poll::Pending,
392 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
393 this.is_terminated = true;
394 return std::task::Poll::Ready(None);
395 }
396 std::task::Poll::Ready(Err(e)) => {
397 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
398 e.into(),
399 ))));
400 }
401 }
402
403 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
405
406 std::task::Poll::Ready(Some(match header.ordinal {
407 0xc072168d525fff8 => {
408 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
409 let mut req = fidl::new_empty!(
410 fidl::encoding::EmptyPayload,
411 fidl::encoding::DefaultFuchsiaResourceDialect
412 );
413 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
414 let control_handle =
415 ActiveSessionControlHandle { inner: this.inner.clone() };
416 Ok(ActiveSessionRequest::WatchActiveSession {
417 responder: ActiveSessionWatchActiveSessionResponder {
418 control_handle: std::mem::ManuallyDrop::new(control_handle),
419 tx_id: header.tx_id,
420 },
421 })
422 }
423 _ => Err(fidl::Error::UnknownOrdinal {
424 ordinal: header.ordinal,
425 protocol_name:
426 <ActiveSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
427 }),
428 }))
429 },
430 )
431 }
432}
433
434#[derive(Debug)]
439pub enum ActiveSessionRequest {
440 WatchActiveSession { responder: ActiveSessionWatchActiveSessionResponder },
444}
445
446impl ActiveSessionRequest {
447 #[allow(irrefutable_let_patterns)]
448 pub fn into_watch_active_session(self) -> Option<(ActiveSessionWatchActiveSessionResponder)> {
449 if let ActiveSessionRequest::WatchActiveSession { responder } = self {
450 Some((responder))
451 } else {
452 None
453 }
454 }
455
456 pub fn method_name(&self) -> &'static str {
458 match *self {
459 ActiveSessionRequest::WatchActiveSession { .. } => "watch_active_session",
460 }
461 }
462}
463
464#[derive(Debug, Clone)]
465pub struct ActiveSessionControlHandle {
466 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
467}
468
469impl fidl::endpoints::ControlHandle for ActiveSessionControlHandle {
470 fn shutdown(&self) {
471 self.inner.shutdown()
472 }
473
474 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
475 self.inner.shutdown_with_epitaph(status)
476 }
477
478 fn is_closed(&self) -> bool {
479 self.inner.channel().is_closed()
480 }
481 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
482 self.inner.channel().on_closed()
483 }
484
485 #[cfg(target_os = "fuchsia")]
486 fn signal_peer(
487 &self,
488 clear_mask: zx::Signals,
489 set_mask: zx::Signals,
490 ) -> Result<(), zx_status::Status> {
491 use fidl::Peered;
492 self.inner.channel().signal_peer(clear_mask, set_mask)
493 }
494}
495
496impl ActiveSessionControlHandle {}
497
498#[must_use = "FIDL methods require a response to be sent"]
499#[derive(Debug)]
500pub struct ActiveSessionWatchActiveSessionResponder {
501 control_handle: std::mem::ManuallyDrop<ActiveSessionControlHandle>,
502 tx_id: u32,
503}
504
505impl std::ops::Drop for ActiveSessionWatchActiveSessionResponder {
509 fn drop(&mut self) {
510 self.control_handle.shutdown();
511 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
513 }
514}
515
516impl fidl::endpoints::Responder for ActiveSessionWatchActiveSessionResponder {
517 type ControlHandle = ActiveSessionControlHandle;
518
519 fn control_handle(&self) -> &ActiveSessionControlHandle {
520 &self.control_handle
521 }
522
523 fn drop_without_shutdown(mut self) {
524 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
526 std::mem::forget(self);
528 }
529}
530
531impl ActiveSessionWatchActiveSessionResponder {
532 pub fn send(
536 self,
537 mut session: Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
538 ) -> Result<(), fidl::Error> {
539 let _result = self.send_raw(session);
540 if _result.is_err() {
541 self.control_handle.shutdown();
542 }
543 self.drop_without_shutdown();
544 _result
545 }
546
547 pub fn send_no_shutdown_on_err(
549 self,
550 mut session: Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
551 ) -> Result<(), fidl::Error> {
552 let _result = self.send_raw(session);
553 self.drop_without_shutdown();
554 _result
555 }
556
557 fn send_raw(
558 &self,
559 mut session: Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
560 ) -> Result<(), fidl::Error> {
561 self.control_handle.inner.send::<ActiveSessionWatchActiveSessionResponse>(
562 (session,),
563 self.tx_id,
564 0xc072168d525fff8,
565 fidl::encoding::DynamicFlags::empty(),
566 )
567 }
568}
569
570#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
571pub struct DiscoveryMarker;
572
573impl fidl::endpoints::ProtocolMarker for DiscoveryMarker {
574 type Proxy = DiscoveryProxy;
575 type RequestStream = DiscoveryRequestStream;
576 #[cfg(target_os = "fuchsia")]
577 type SynchronousProxy = DiscoverySynchronousProxy;
578
579 const DEBUG_NAME: &'static str = "fuchsia.media.sessions2.Discovery";
580}
581impl fidl::endpoints::DiscoverableProtocolMarker for DiscoveryMarker {}
582
583pub trait DiscoveryProxyInterface: Send + Sync {
584 fn r#watch_sessions(
585 &self,
586 watch_options: &WatchOptions,
587 session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
588 ) -> Result<(), fidl::Error>;
589 fn r#connect_to_session(
590 &self,
591 session_id: u64,
592 session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
593 ) -> Result<(), fidl::Error>;
594}
595#[derive(Debug)]
596#[cfg(target_os = "fuchsia")]
597pub struct DiscoverySynchronousProxy {
598 client: fidl::client::sync::Client,
599}
600
601#[cfg(target_os = "fuchsia")]
602impl fidl::endpoints::SynchronousProxy for DiscoverySynchronousProxy {
603 type Proxy = DiscoveryProxy;
604 type Protocol = DiscoveryMarker;
605
606 fn from_channel(inner: fidl::Channel) -> Self {
607 Self::new(inner)
608 }
609
610 fn into_channel(self) -> fidl::Channel {
611 self.client.into_channel()
612 }
613
614 fn as_channel(&self) -> &fidl::Channel {
615 self.client.as_channel()
616 }
617}
618
619#[cfg(target_os = "fuchsia")]
620impl DiscoverySynchronousProxy {
621 pub fn new(channel: fidl::Channel) -> Self {
622 Self { client: fidl::client::sync::Client::new(channel) }
623 }
624
625 pub fn into_channel(self) -> fidl::Channel {
626 self.client.into_channel()
627 }
628
629 pub fn wait_for_event(
632 &self,
633 deadline: zx::MonotonicInstant,
634 ) -> Result<DiscoveryEvent, fidl::Error> {
635 DiscoveryEvent::decode(self.client.wait_for_event::<DiscoveryMarker>(deadline)?)
636 }
637
638 pub fn r#watch_sessions(
640 &self,
641 mut watch_options: &WatchOptions,
642 mut session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
643 ) -> Result<(), fidl::Error> {
644 self.client.send::<DiscoveryWatchSessionsRequest>(
645 (watch_options, session_watcher),
646 0x4231b30d98dcd2fe,
647 fidl::encoding::DynamicFlags::empty(),
648 )
649 }
650
651 pub fn r#connect_to_session(
654 &self,
655 mut session_id: u64,
656 mut session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
657 ) -> Result<(), fidl::Error> {
658 self.client.send::<DiscoveryConnectToSessionRequest>(
659 (session_id, session_control_request),
660 0x37da54e09f63ca3d,
661 fidl::encoding::DynamicFlags::empty(),
662 )
663 }
664}
665
666#[cfg(target_os = "fuchsia")]
667impl From<DiscoverySynchronousProxy> for zx::NullableHandle {
668 fn from(value: DiscoverySynchronousProxy) -> Self {
669 value.into_channel().into()
670 }
671}
672
673#[cfg(target_os = "fuchsia")]
674impl From<fidl::Channel> for DiscoverySynchronousProxy {
675 fn from(value: fidl::Channel) -> Self {
676 Self::new(value)
677 }
678}
679
680#[cfg(target_os = "fuchsia")]
681impl fidl::endpoints::FromClient for DiscoverySynchronousProxy {
682 type Protocol = DiscoveryMarker;
683
684 fn from_client(value: fidl::endpoints::ClientEnd<DiscoveryMarker>) -> Self {
685 Self::new(value.into_channel())
686 }
687}
688
689#[derive(Debug, Clone)]
690pub struct DiscoveryProxy {
691 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
692}
693
694impl fidl::endpoints::Proxy for DiscoveryProxy {
695 type Protocol = DiscoveryMarker;
696
697 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
698 Self::new(inner)
699 }
700
701 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
702 self.client.into_channel().map_err(|client| Self { client })
703 }
704
705 fn as_channel(&self) -> &::fidl::AsyncChannel {
706 self.client.as_channel()
707 }
708}
709
710impl DiscoveryProxy {
711 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
713 let protocol_name = <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
714 Self { client: fidl::client::Client::new(channel, protocol_name) }
715 }
716
717 pub fn take_event_stream(&self) -> DiscoveryEventStream {
723 DiscoveryEventStream { event_receiver: self.client.take_event_receiver() }
724 }
725
726 pub fn r#watch_sessions(
728 &self,
729 mut watch_options: &WatchOptions,
730 mut session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
731 ) -> Result<(), fidl::Error> {
732 DiscoveryProxyInterface::r#watch_sessions(self, watch_options, session_watcher)
733 }
734
735 pub fn r#connect_to_session(
738 &self,
739 mut session_id: u64,
740 mut session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
741 ) -> Result<(), fidl::Error> {
742 DiscoveryProxyInterface::r#connect_to_session(self, session_id, session_control_request)
743 }
744}
745
746impl DiscoveryProxyInterface for DiscoveryProxy {
747 fn r#watch_sessions(
748 &self,
749 mut watch_options: &WatchOptions,
750 mut session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
751 ) -> Result<(), fidl::Error> {
752 self.client.send::<DiscoveryWatchSessionsRequest>(
753 (watch_options, session_watcher),
754 0x4231b30d98dcd2fe,
755 fidl::encoding::DynamicFlags::empty(),
756 )
757 }
758
759 fn r#connect_to_session(
760 &self,
761 mut session_id: u64,
762 mut session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
763 ) -> Result<(), fidl::Error> {
764 self.client.send::<DiscoveryConnectToSessionRequest>(
765 (session_id, session_control_request),
766 0x37da54e09f63ca3d,
767 fidl::encoding::DynamicFlags::empty(),
768 )
769 }
770}
771
772pub struct DiscoveryEventStream {
773 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
774}
775
776impl std::marker::Unpin for DiscoveryEventStream {}
777
778impl futures::stream::FusedStream for DiscoveryEventStream {
779 fn is_terminated(&self) -> bool {
780 self.event_receiver.is_terminated()
781 }
782}
783
784impl futures::Stream for DiscoveryEventStream {
785 type Item = Result<DiscoveryEvent, fidl::Error>;
786
787 fn poll_next(
788 mut self: std::pin::Pin<&mut Self>,
789 cx: &mut std::task::Context<'_>,
790 ) -> std::task::Poll<Option<Self::Item>> {
791 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
792 &mut self.event_receiver,
793 cx
794 )?) {
795 Some(buf) => std::task::Poll::Ready(Some(DiscoveryEvent::decode(buf))),
796 None => std::task::Poll::Ready(None),
797 }
798 }
799}
800
801#[derive(Debug)]
802pub enum DiscoveryEvent {}
803
804impl DiscoveryEvent {
805 fn decode(
807 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
808 ) -> Result<DiscoveryEvent, fidl::Error> {
809 let (bytes, _handles) = buf.split_mut();
810 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
811 debug_assert_eq!(tx_header.tx_id, 0);
812 match tx_header.ordinal {
813 _ => Err(fidl::Error::UnknownOrdinal {
814 ordinal: tx_header.ordinal,
815 protocol_name: <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
816 }),
817 }
818 }
819}
820
821pub struct DiscoveryRequestStream {
823 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
824 is_terminated: bool,
825}
826
827impl std::marker::Unpin for DiscoveryRequestStream {}
828
829impl futures::stream::FusedStream for DiscoveryRequestStream {
830 fn is_terminated(&self) -> bool {
831 self.is_terminated
832 }
833}
834
835impl fidl::endpoints::RequestStream for DiscoveryRequestStream {
836 type Protocol = DiscoveryMarker;
837 type ControlHandle = DiscoveryControlHandle;
838
839 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
840 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
841 }
842
843 fn control_handle(&self) -> Self::ControlHandle {
844 DiscoveryControlHandle { inner: self.inner.clone() }
845 }
846
847 fn into_inner(
848 self,
849 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
850 {
851 (self.inner, self.is_terminated)
852 }
853
854 fn from_inner(
855 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
856 is_terminated: bool,
857 ) -> Self {
858 Self { inner, is_terminated }
859 }
860}
861
862impl futures::Stream for DiscoveryRequestStream {
863 type Item = Result<DiscoveryRequest, fidl::Error>;
864
865 fn poll_next(
866 mut self: std::pin::Pin<&mut Self>,
867 cx: &mut std::task::Context<'_>,
868 ) -> std::task::Poll<Option<Self::Item>> {
869 let this = &mut *self;
870 if this.inner.check_shutdown(cx) {
871 this.is_terminated = true;
872 return std::task::Poll::Ready(None);
873 }
874 if this.is_terminated {
875 panic!("polled DiscoveryRequestStream after completion");
876 }
877 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
878 |bytes, handles| {
879 match this.inner.channel().read_etc(cx, bytes, handles) {
880 std::task::Poll::Ready(Ok(())) => {}
881 std::task::Poll::Pending => return std::task::Poll::Pending,
882 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
883 this.is_terminated = true;
884 return std::task::Poll::Ready(None);
885 }
886 std::task::Poll::Ready(Err(e)) => {
887 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
888 e.into(),
889 ))));
890 }
891 }
892
893 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
895
896 std::task::Poll::Ready(Some(match header.ordinal {
897 0x4231b30d98dcd2fe => {
898 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
899 let mut req = fidl::new_empty!(
900 DiscoveryWatchSessionsRequest,
901 fidl::encoding::DefaultFuchsiaResourceDialect
902 );
903 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiscoveryWatchSessionsRequest>(&header, _body_bytes, handles, &mut req)?;
904 let control_handle = DiscoveryControlHandle { inner: this.inner.clone() };
905 Ok(DiscoveryRequest::WatchSessions {
906 watch_options: req.watch_options,
907 session_watcher: req.session_watcher,
908
909 control_handle,
910 })
911 }
912 0x37da54e09f63ca3d => {
913 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
914 let mut req = fidl::new_empty!(
915 DiscoveryConnectToSessionRequest,
916 fidl::encoding::DefaultFuchsiaResourceDialect
917 );
918 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiscoveryConnectToSessionRequest>(&header, _body_bytes, handles, &mut req)?;
919 let control_handle = DiscoveryControlHandle { inner: this.inner.clone() };
920 Ok(DiscoveryRequest::ConnectToSession {
921 session_id: req.session_id,
922 session_control_request: req.session_control_request,
923
924 control_handle,
925 })
926 }
927 _ => Err(fidl::Error::UnknownOrdinal {
928 ordinal: header.ordinal,
929 protocol_name:
930 <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
931 }),
932 }))
933 },
934 )
935 }
936}
937
938#[derive(Debug)]
941pub enum DiscoveryRequest {
942 WatchSessions {
944 watch_options: WatchOptions,
945 session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
946 control_handle: DiscoveryControlHandle,
947 },
948 ConnectToSession {
951 session_id: u64,
952 session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
953 control_handle: DiscoveryControlHandle,
954 },
955}
956
957impl DiscoveryRequest {
958 #[allow(irrefutable_let_patterns)]
959 pub fn into_watch_sessions(
960 self,
961 ) -> Option<(
962 WatchOptions,
963 fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
964 DiscoveryControlHandle,
965 )> {
966 if let DiscoveryRequest::WatchSessions { watch_options, session_watcher, control_handle } =
967 self
968 {
969 Some((watch_options, session_watcher, control_handle))
970 } else {
971 None
972 }
973 }
974
975 #[allow(irrefutable_let_patterns)]
976 pub fn into_connect_to_session(
977 self,
978 ) -> Option<(u64, fidl::endpoints::ServerEnd<SessionControlMarker>, DiscoveryControlHandle)>
979 {
980 if let DiscoveryRequest::ConnectToSession {
981 session_id,
982 session_control_request,
983 control_handle,
984 } = self
985 {
986 Some((session_id, session_control_request, control_handle))
987 } else {
988 None
989 }
990 }
991
992 pub fn method_name(&self) -> &'static str {
994 match *self {
995 DiscoveryRequest::WatchSessions { .. } => "watch_sessions",
996 DiscoveryRequest::ConnectToSession { .. } => "connect_to_session",
997 }
998 }
999}
1000
1001#[derive(Debug, Clone)]
1002pub struct DiscoveryControlHandle {
1003 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1004}
1005
1006impl fidl::endpoints::ControlHandle for DiscoveryControlHandle {
1007 fn shutdown(&self) {
1008 self.inner.shutdown()
1009 }
1010
1011 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1012 self.inner.shutdown_with_epitaph(status)
1013 }
1014
1015 fn is_closed(&self) -> bool {
1016 self.inner.channel().is_closed()
1017 }
1018 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1019 self.inner.channel().on_closed()
1020 }
1021
1022 #[cfg(target_os = "fuchsia")]
1023 fn signal_peer(
1024 &self,
1025 clear_mask: zx::Signals,
1026 set_mask: zx::Signals,
1027 ) -> Result<(), zx_status::Status> {
1028 use fidl::Peered;
1029 self.inner.channel().signal_peer(clear_mask, set_mask)
1030 }
1031}
1032
1033impl DiscoveryControlHandle {}
1034
1035#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1036pub struct ObserverDiscoveryMarker;
1037
1038impl fidl::endpoints::ProtocolMarker for ObserverDiscoveryMarker {
1039 type Proxy = ObserverDiscoveryProxy;
1040 type RequestStream = ObserverDiscoveryRequestStream;
1041 #[cfg(target_os = "fuchsia")]
1042 type SynchronousProxy = ObserverDiscoverySynchronousProxy;
1043
1044 const DEBUG_NAME: &'static str = "fuchsia.media.sessions2.ObserverDiscovery";
1045}
1046impl fidl::endpoints::DiscoverableProtocolMarker for ObserverDiscoveryMarker {}
1047
1048pub trait ObserverDiscoveryProxyInterface: Send + Sync {
1049 fn r#watch_sessions(
1050 &self,
1051 watch_options: &WatchOptions,
1052 sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1053 ) -> Result<(), fidl::Error>;
1054 fn r#connect_to_session(
1055 &self,
1056 session_id: u64,
1057 session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
1058 ) -> Result<(), fidl::Error>;
1059}
1060#[derive(Debug)]
1061#[cfg(target_os = "fuchsia")]
1062pub struct ObserverDiscoverySynchronousProxy {
1063 client: fidl::client::sync::Client,
1064}
1065
1066#[cfg(target_os = "fuchsia")]
1067impl fidl::endpoints::SynchronousProxy for ObserverDiscoverySynchronousProxy {
1068 type Proxy = ObserverDiscoveryProxy;
1069 type Protocol = ObserverDiscoveryMarker;
1070
1071 fn from_channel(inner: fidl::Channel) -> Self {
1072 Self::new(inner)
1073 }
1074
1075 fn into_channel(self) -> fidl::Channel {
1076 self.client.into_channel()
1077 }
1078
1079 fn as_channel(&self) -> &fidl::Channel {
1080 self.client.as_channel()
1081 }
1082}
1083
1084#[cfg(target_os = "fuchsia")]
1085impl ObserverDiscoverySynchronousProxy {
1086 pub fn new(channel: fidl::Channel) -> Self {
1087 Self { client: fidl::client::sync::Client::new(channel) }
1088 }
1089
1090 pub fn into_channel(self) -> fidl::Channel {
1091 self.client.into_channel()
1092 }
1093
1094 pub fn wait_for_event(
1097 &self,
1098 deadline: zx::MonotonicInstant,
1099 ) -> Result<ObserverDiscoveryEvent, fidl::Error> {
1100 ObserverDiscoveryEvent::decode(
1101 self.client.wait_for_event::<ObserverDiscoveryMarker>(deadline)?,
1102 )
1103 }
1104
1105 pub fn r#watch_sessions(
1107 &self,
1108 mut watch_options: &WatchOptions,
1109 mut sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1110 ) -> Result<(), fidl::Error> {
1111 self.client.send::<ObserverDiscoveryWatchSessionsRequest>(
1112 (watch_options, sessions_watcher),
1113 0x3d95eaa20624a1fe,
1114 fidl::encoding::DynamicFlags::empty(),
1115 )
1116 }
1117
1118 pub fn r#connect_to_session(
1121 &self,
1122 mut session_id: u64,
1123 mut session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
1124 ) -> Result<(), fidl::Error> {
1125 self.client.send::<ObserverDiscoveryConnectToSessionRequest>(
1126 (session_id, session_request),
1127 0x2c9b99aacfaac87a,
1128 fidl::encoding::DynamicFlags::empty(),
1129 )
1130 }
1131}
1132
1133#[cfg(target_os = "fuchsia")]
1134impl From<ObserverDiscoverySynchronousProxy> for zx::NullableHandle {
1135 fn from(value: ObserverDiscoverySynchronousProxy) -> Self {
1136 value.into_channel().into()
1137 }
1138}
1139
1140#[cfg(target_os = "fuchsia")]
1141impl From<fidl::Channel> for ObserverDiscoverySynchronousProxy {
1142 fn from(value: fidl::Channel) -> Self {
1143 Self::new(value)
1144 }
1145}
1146
1147#[cfg(target_os = "fuchsia")]
1148impl fidl::endpoints::FromClient for ObserverDiscoverySynchronousProxy {
1149 type Protocol = ObserverDiscoveryMarker;
1150
1151 fn from_client(value: fidl::endpoints::ClientEnd<ObserverDiscoveryMarker>) -> Self {
1152 Self::new(value.into_channel())
1153 }
1154}
1155
1156#[derive(Debug, Clone)]
1157pub struct ObserverDiscoveryProxy {
1158 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1159}
1160
1161impl fidl::endpoints::Proxy for ObserverDiscoveryProxy {
1162 type Protocol = ObserverDiscoveryMarker;
1163
1164 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1165 Self::new(inner)
1166 }
1167
1168 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1169 self.client.into_channel().map_err(|client| Self { client })
1170 }
1171
1172 fn as_channel(&self) -> &::fidl::AsyncChannel {
1173 self.client.as_channel()
1174 }
1175}
1176
1177impl ObserverDiscoveryProxy {
1178 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1180 let protocol_name =
1181 <ObserverDiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1182 Self { client: fidl::client::Client::new(channel, protocol_name) }
1183 }
1184
1185 pub fn take_event_stream(&self) -> ObserverDiscoveryEventStream {
1191 ObserverDiscoveryEventStream { event_receiver: self.client.take_event_receiver() }
1192 }
1193
1194 pub fn r#watch_sessions(
1196 &self,
1197 mut watch_options: &WatchOptions,
1198 mut sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1199 ) -> Result<(), fidl::Error> {
1200 ObserverDiscoveryProxyInterface::r#watch_sessions(self, watch_options, sessions_watcher)
1201 }
1202
1203 pub fn r#connect_to_session(
1206 &self,
1207 mut session_id: u64,
1208 mut session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
1209 ) -> Result<(), fidl::Error> {
1210 ObserverDiscoveryProxyInterface::r#connect_to_session(self, session_id, session_request)
1211 }
1212}
1213
1214impl ObserverDiscoveryProxyInterface for ObserverDiscoveryProxy {
1215 fn r#watch_sessions(
1216 &self,
1217 mut watch_options: &WatchOptions,
1218 mut sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1219 ) -> Result<(), fidl::Error> {
1220 self.client.send::<ObserverDiscoveryWatchSessionsRequest>(
1221 (watch_options, sessions_watcher),
1222 0x3d95eaa20624a1fe,
1223 fidl::encoding::DynamicFlags::empty(),
1224 )
1225 }
1226
1227 fn r#connect_to_session(
1228 &self,
1229 mut session_id: u64,
1230 mut session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
1231 ) -> Result<(), fidl::Error> {
1232 self.client.send::<ObserverDiscoveryConnectToSessionRequest>(
1233 (session_id, session_request),
1234 0x2c9b99aacfaac87a,
1235 fidl::encoding::DynamicFlags::empty(),
1236 )
1237 }
1238}
1239
1240pub struct ObserverDiscoveryEventStream {
1241 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1242}
1243
1244impl std::marker::Unpin for ObserverDiscoveryEventStream {}
1245
1246impl futures::stream::FusedStream for ObserverDiscoveryEventStream {
1247 fn is_terminated(&self) -> bool {
1248 self.event_receiver.is_terminated()
1249 }
1250}
1251
1252impl futures::Stream for ObserverDiscoveryEventStream {
1253 type Item = Result<ObserverDiscoveryEvent, fidl::Error>;
1254
1255 fn poll_next(
1256 mut self: std::pin::Pin<&mut Self>,
1257 cx: &mut std::task::Context<'_>,
1258 ) -> std::task::Poll<Option<Self::Item>> {
1259 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1260 &mut self.event_receiver,
1261 cx
1262 )?) {
1263 Some(buf) => std::task::Poll::Ready(Some(ObserverDiscoveryEvent::decode(buf))),
1264 None => std::task::Poll::Ready(None),
1265 }
1266 }
1267}
1268
1269#[derive(Debug)]
1270pub enum ObserverDiscoveryEvent {}
1271
1272impl ObserverDiscoveryEvent {
1273 fn decode(
1275 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1276 ) -> Result<ObserverDiscoveryEvent, fidl::Error> {
1277 let (bytes, _handles) = buf.split_mut();
1278 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1279 debug_assert_eq!(tx_header.tx_id, 0);
1280 match tx_header.ordinal {
1281 _ => Err(fidl::Error::UnknownOrdinal {
1282 ordinal: tx_header.ordinal,
1283 protocol_name:
1284 <ObserverDiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1285 }),
1286 }
1287 }
1288}
1289
1290pub struct ObserverDiscoveryRequestStream {
1292 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1293 is_terminated: bool,
1294}
1295
1296impl std::marker::Unpin for ObserverDiscoveryRequestStream {}
1297
1298impl futures::stream::FusedStream for ObserverDiscoveryRequestStream {
1299 fn is_terminated(&self) -> bool {
1300 self.is_terminated
1301 }
1302}
1303
1304impl fidl::endpoints::RequestStream for ObserverDiscoveryRequestStream {
1305 type Protocol = ObserverDiscoveryMarker;
1306 type ControlHandle = ObserverDiscoveryControlHandle;
1307
1308 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1309 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1310 }
1311
1312 fn control_handle(&self) -> Self::ControlHandle {
1313 ObserverDiscoveryControlHandle { inner: self.inner.clone() }
1314 }
1315
1316 fn into_inner(
1317 self,
1318 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1319 {
1320 (self.inner, self.is_terminated)
1321 }
1322
1323 fn from_inner(
1324 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1325 is_terminated: bool,
1326 ) -> Self {
1327 Self { inner, is_terminated }
1328 }
1329}
1330
1331impl futures::Stream for ObserverDiscoveryRequestStream {
1332 type Item = Result<ObserverDiscoveryRequest, fidl::Error>;
1333
1334 fn poll_next(
1335 mut self: std::pin::Pin<&mut Self>,
1336 cx: &mut std::task::Context<'_>,
1337 ) -> std::task::Poll<Option<Self::Item>> {
1338 let this = &mut *self;
1339 if this.inner.check_shutdown(cx) {
1340 this.is_terminated = true;
1341 return std::task::Poll::Ready(None);
1342 }
1343 if this.is_terminated {
1344 panic!("polled ObserverDiscoveryRequestStream after completion");
1345 }
1346 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1347 |bytes, handles| {
1348 match this.inner.channel().read_etc(cx, bytes, handles) {
1349 std::task::Poll::Ready(Ok(())) => {}
1350 std::task::Poll::Pending => return std::task::Poll::Pending,
1351 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1352 this.is_terminated = true;
1353 return std::task::Poll::Ready(None);
1354 }
1355 std::task::Poll::Ready(Err(e)) => {
1356 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1357 e.into(),
1358 ))));
1359 }
1360 }
1361
1362 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1364
1365 std::task::Poll::Ready(Some(match header.ordinal {
1366 0x3d95eaa20624a1fe => {
1367 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1368 let mut req = fidl::new_empty!(
1369 ObserverDiscoveryWatchSessionsRequest,
1370 fidl::encoding::DefaultFuchsiaResourceDialect
1371 );
1372 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ObserverDiscoveryWatchSessionsRequest>(&header, _body_bytes, handles, &mut req)?;
1373 let control_handle =
1374 ObserverDiscoveryControlHandle { inner: this.inner.clone() };
1375 Ok(ObserverDiscoveryRequest::WatchSessions {
1376 watch_options: req.watch_options,
1377 sessions_watcher: req.sessions_watcher,
1378
1379 control_handle,
1380 })
1381 }
1382 0x2c9b99aacfaac87a => {
1383 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1384 let mut req = fidl::new_empty!(
1385 ObserverDiscoveryConnectToSessionRequest,
1386 fidl::encoding::DefaultFuchsiaResourceDialect
1387 );
1388 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ObserverDiscoveryConnectToSessionRequest>(&header, _body_bytes, handles, &mut req)?;
1389 let control_handle =
1390 ObserverDiscoveryControlHandle { inner: this.inner.clone() };
1391 Ok(ObserverDiscoveryRequest::ConnectToSession {
1392 session_id: req.session_id,
1393 session_request: req.session_request,
1394
1395 control_handle,
1396 })
1397 }
1398 _ => Err(fidl::Error::UnknownOrdinal {
1399 ordinal: header.ordinal,
1400 protocol_name:
1401 <ObserverDiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1402 }),
1403 }))
1404 },
1405 )
1406 }
1407}
1408
1409#[derive(Debug)]
1412pub enum ObserverDiscoveryRequest {
1413 WatchSessions {
1415 watch_options: WatchOptions,
1416 sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1417 control_handle: ObserverDiscoveryControlHandle,
1418 },
1419 ConnectToSession {
1422 session_id: u64,
1423 session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
1424 control_handle: ObserverDiscoveryControlHandle,
1425 },
1426}
1427
1428impl ObserverDiscoveryRequest {
1429 #[allow(irrefutable_let_patterns)]
1430 pub fn into_watch_sessions(
1431 self,
1432 ) -> Option<(
1433 WatchOptions,
1434 fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1435 ObserverDiscoveryControlHandle,
1436 )> {
1437 if let ObserverDiscoveryRequest::WatchSessions {
1438 watch_options,
1439 sessions_watcher,
1440 control_handle,
1441 } = self
1442 {
1443 Some((watch_options, sessions_watcher, control_handle))
1444 } else {
1445 None
1446 }
1447 }
1448
1449 #[allow(irrefutable_let_patterns)]
1450 pub fn into_connect_to_session(
1451 self,
1452 ) -> Option<(
1453 u64,
1454 fidl::endpoints::ServerEnd<SessionObserverMarker>,
1455 ObserverDiscoveryControlHandle,
1456 )> {
1457 if let ObserverDiscoveryRequest::ConnectToSession {
1458 session_id,
1459 session_request,
1460 control_handle,
1461 } = self
1462 {
1463 Some((session_id, session_request, control_handle))
1464 } else {
1465 None
1466 }
1467 }
1468
1469 pub fn method_name(&self) -> &'static str {
1471 match *self {
1472 ObserverDiscoveryRequest::WatchSessions { .. } => "watch_sessions",
1473 ObserverDiscoveryRequest::ConnectToSession { .. } => "connect_to_session",
1474 }
1475 }
1476}
1477
1478#[derive(Debug, Clone)]
1479pub struct ObserverDiscoveryControlHandle {
1480 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1481}
1482
1483impl fidl::endpoints::ControlHandle for ObserverDiscoveryControlHandle {
1484 fn shutdown(&self) {
1485 self.inner.shutdown()
1486 }
1487
1488 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1489 self.inner.shutdown_with_epitaph(status)
1490 }
1491
1492 fn is_closed(&self) -> bool {
1493 self.inner.channel().is_closed()
1494 }
1495 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1496 self.inner.channel().on_closed()
1497 }
1498
1499 #[cfg(target_os = "fuchsia")]
1500 fn signal_peer(
1501 &self,
1502 clear_mask: zx::Signals,
1503 set_mask: zx::Signals,
1504 ) -> Result<(), zx_status::Status> {
1505 use fidl::Peered;
1506 self.inner.channel().signal_peer(clear_mask, set_mask)
1507 }
1508}
1509
1510impl ObserverDiscoveryControlHandle {}
1511
1512#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1513pub struct PlayerMarker;
1514
1515impl fidl::endpoints::ProtocolMarker for PlayerMarker {
1516 type Proxy = PlayerProxy;
1517 type RequestStream = PlayerRequestStream;
1518 #[cfg(target_os = "fuchsia")]
1519 type SynchronousProxy = PlayerSynchronousProxy;
1520
1521 const DEBUG_NAME: &'static str = "(anonymous) Player";
1522}
1523
1524pub trait PlayerProxyInterface: Send + Sync {
1525 fn r#play(&self) -> Result<(), fidl::Error>;
1526 fn r#pause(&self) -> Result<(), fidl::Error>;
1527 fn r#stop(&self) -> Result<(), fidl::Error>;
1528 fn r#seek(&self, position: i64) -> Result<(), fidl::Error>;
1529 fn r#skip_forward(&self) -> Result<(), fidl::Error>;
1530 fn r#skip_reverse(&self) -> Result<(), fidl::Error>;
1531 fn r#next_item(&self) -> Result<(), fidl::Error>;
1532 fn r#prev_item(&self) -> Result<(), fidl::Error>;
1533 fn r#set_playback_rate(&self, playback_rate: f32) -> Result<(), fidl::Error>;
1534 fn r#set_repeat_mode(&self, repeat_mode: RepeatMode) -> Result<(), fidl::Error>;
1535 fn r#set_shuffle_mode(&self, shuffle_on: bool) -> Result<(), fidl::Error>;
1536 fn r#bind_volume_control(
1537 &self,
1538 volume_control_request: fidl::endpoints::ServerEnd<
1539 fidl_fuchsia_media_audio::VolumeControlMarker,
1540 >,
1541 ) -> Result<(), fidl::Error>;
1542 type WatchInfoChangeResponseFut: std::future::Future<Output = Result<PlayerInfoDelta, fidl::Error>>
1543 + Send;
1544 fn r#watch_info_change(&self) -> Self::WatchInfoChangeResponseFut;
1545}
1546#[derive(Debug)]
1547#[cfg(target_os = "fuchsia")]
1548pub struct PlayerSynchronousProxy {
1549 client: fidl::client::sync::Client,
1550}
1551
1552#[cfg(target_os = "fuchsia")]
1553impl fidl::endpoints::SynchronousProxy for PlayerSynchronousProxy {
1554 type Proxy = PlayerProxy;
1555 type Protocol = PlayerMarker;
1556
1557 fn from_channel(inner: fidl::Channel) -> Self {
1558 Self::new(inner)
1559 }
1560
1561 fn into_channel(self) -> fidl::Channel {
1562 self.client.into_channel()
1563 }
1564
1565 fn as_channel(&self) -> &fidl::Channel {
1566 self.client.as_channel()
1567 }
1568}
1569
1570#[cfg(target_os = "fuchsia")]
1571impl PlayerSynchronousProxy {
1572 pub fn new(channel: fidl::Channel) -> Self {
1573 Self { client: fidl::client::sync::Client::new(channel) }
1574 }
1575
1576 pub fn into_channel(self) -> fidl::Channel {
1577 self.client.into_channel()
1578 }
1579
1580 pub fn wait_for_event(
1583 &self,
1584 deadline: zx::MonotonicInstant,
1585 ) -> Result<PlayerEvent, fidl::Error> {
1586 PlayerEvent::decode(self.client.wait_for_event::<PlayerMarker>(deadline)?)
1587 }
1588
1589 pub fn r#play(&self) -> Result<(), fidl::Error> {
1592 self.client.send::<fidl::encoding::EmptyPayload>(
1593 (),
1594 0x164120d5bdb26f8e,
1595 fidl::encoding::DynamicFlags::empty(),
1596 )
1597 }
1598
1599 pub fn r#pause(&self) -> Result<(), fidl::Error> {
1602 self.client.send::<fidl::encoding::EmptyPayload>(
1603 (),
1604 0x1536d16f202ece1,
1605 fidl::encoding::DynamicFlags::empty(),
1606 )
1607 }
1608
1609 pub fn r#stop(&self) -> Result<(), fidl::Error> {
1611 self.client.send::<fidl::encoding::EmptyPayload>(
1612 (),
1613 0x1946e5fc6c2362ae,
1614 fidl::encoding::DynamicFlags::empty(),
1615 )
1616 }
1617
1618 pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
1623 self.client.send::<PlayerControlSeekRequest>(
1624 (position,),
1625 0x4e7237d293e22125,
1626 fidl::encoding::DynamicFlags::empty(),
1627 )
1628 }
1629
1630 pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
1634 self.client.send::<fidl::encoding::EmptyPayload>(
1635 (),
1636 0x6ee04477076dac1b,
1637 fidl::encoding::DynamicFlags::empty(),
1638 )
1639 }
1640
1641 pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
1645 self.client.send::<fidl::encoding::EmptyPayload>(
1646 (),
1647 0xa4e05644ce33a28,
1648 fidl::encoding::DynamicFlags::empty(),
1649 )
1650 }
1651
1652 pub fn r#next_item(&self) -> Result<(), fidl::Error> {
1656 self.client.send::<fidl::encoding::EmptyPayload>(
1657 (),
1658 0x73307b32e35ff260,
1659 fidl::encoding::DynamicFlags::empty(),
1660 )
1661 }
1662
1663 pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
1667 self.client.send::<fidl::encoding::EmptyPayload>(
1668 (),
1669 0x680444f03a759a3c,
1670 fidl::encoding::DynamicFlags::empty(),
1671 )
1672 }
1673
1674 pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
1678 self.client.send::<PlayerControlSetPlaybackRateRequest>(
1679 (playback_rate,),
1680 0x3831b8b161e1bccf,
1681 fidl::encoding::DynamicFlags::empty(),
1682 )
1683 }
1684
1685 pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
1691 self.client.send::<PlayerControlSetRepeatModeRequest>(
1692 (repeat_mode,),
1693 0x21b9b1b17b7f01c2,
1694 fidl::encoding::DynamicFlags::empty(),
1695 )
1696 }
1697
1698 pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
1701 self.client.send::<PlayerControlSetShuffleModeRequest>(
1702 (shuffle_on,),
1703 0x7451a349ddb543c,
1704 fidl::encoding::DynamicFlags::empty(),
1705 )
1706 }
1707
1708 pub fn r#bind_volume_control(
1713 &self,
1714 mut volume_control_request: fidl::endpoints::ServerEnd<
1715 fidl_fuchsia_media_audio::VolumeControlMarker,
1716 >,
1717 ) -> Result<(), fidl::Error> {
1718 self.client.send::<PlayerControlBindVolumeControlRequest>(
1719 (volume_control_request,),
1720 0x11d61e878cf808bc,
1721 fidl::encoding::DynamicFlags::empty(),
1722 )
1723 }
1724
1725 pub fn r#watch_info_change(
1727 &self,
1728 ___deadline: zx::MonotonicInstant,
1729 ) -> Result<PlayerInfoDelta, fidl::Error> {
1730 let _response = self.client.send_query::<
1731 fidl::encoding::EmptyPayload,
1732 PlayerWatchInfoChangeResponse,
1733 PlayerMarker,
1734 >(
1735 (),
1736 0x69196e240c62a732,
1737 fidl::encoding::DynamicFlags::empty(),
1738 ___deadline,
1739 )?;
1740 Ok(_response.player_info_delta)
1741 }
1742}
1743
1744#[cfg(target_os = "fuchsia")]
1745impl From<PlayerSynchronousProxy> for zx::NullableHandle {
1746 fn from(value: PlayerSynchronousProxy) -> Self {
1747 value.into_channel().into()
1748 }
1749}
1750
1751#[cfg(target_os = "fuchsia")]
1752impl From<fidl::Channel> for PlayerSynchronousProxy {
1753 fn from(value: fidl::Channel) -> Self {
1754 Self::new(value)
1755 }
1756}
1757
1758#[cfg(target_os = "fuchsia")]
1759impl fidl::endpoints::FromClient for PlayerSynchronousProxy {
1760 type Protocol = PlayerMarker;
1761
1762 fn from_client(value: fidl::endpoints::ClientEnd<PlayerMarker>) -> Self {
1763 Self::new(value.into_channel())
1764 }
1765}
1766
1767#[derive(Debug, Clone)]
1768pub struct PlayerProxy {
1769 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1770}
1771
1772impl fidl::endpoints::Proxy for PlayerProxy {
1773 type Protocol = PlayerMarker;
1774
1775 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1776 Self::new(inner)
1777 }
1778
1779 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1780 self.client.into_channel().map_err(|client| Self { client })
1781 }
1782
1783 fn as_channel(&self) -> &::fidl::AsyncChannel {
1784 self.client.as_channel()
1785 }
1786}
1787
1788impl PlayerProxy {
1789 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1791 let protocol_name = <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1792 Self { client: fidl::client::Client::new(channel, protocol_name) }
1793 }
1794
1795 pub fn take_event_stream(&self) -> PlayerEventStream {
1801 PlayerEventStream { event_receiver: self.client.take_event_receiver() }
1802 }
1803
1804 pub fn r#play(&self) -> Result<(), fidl::Error> {
1807 PlayerProxyInterface::r#play(self)
1808 }
1809
1810 pub fn r#pause(&self) -> Result<(), fidl::Error> {
1813 PlayerProxyInterface::r#pause(self)
1814 }
1815
1816 pub fn r#stop(&self) -> Result<(), fidl::Error> {
1818 PlayerProxyInterface::r#stop(self)
1819 }
1820
1821 pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
1826 PlayerProxyInterface::r#seek(self, position)
1827 }
1828
1829 pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
1833 PlayerProxyInterface::r#skip_forward(self)
1834 }
1835
1836 pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
1840 PlayerProxyInterface::r#skip_reverse(self)
1841 }
1842
1843 pub fn r#next_item(&self) -> Result<(), fidl::Error> {
1847 PlayerProxyInterface::r#next_item(self)
1848 }
1849
1850 pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
1854 PlayerProxyInterface::r#prev_item(self)
1855 }
1856
1857 pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
1861 PlayerProxyInterface::r#set_playback_rate(self, playback_rate)
1862 }
1863
1864 pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
1870 PlayerProxyInterface::r#set_repeat_mode(self, repeat_mode)
1871 }
1872
1873 pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
1876 PlayerProxyInterface::r#set_shuffle_mode(self, shuffle_on)
1877 }
1878
1879 pub fn r#bind_volume_control(
1884 &self,
1885 mut volume_control_request: fidl::endpoints::ServerEnd<
1886 fidl_fuchsia_media_audio::VolumeControlMarker,
1887 >,
1888 ) -> Result<(), fidl::Error> {
1889 PlayerProxyInterface::r#bind_volume_control(self, volume_control_request)
1890 }
1891
1892 pub fn r#watch_info_change(
1894 &self,
1895 ) -> fidl::client::QueryResponseFut<
1896 PlayerInfoDelta,
1897 fidl::encoding::DefaultFuchsiaResourceDialect,
1898 > {
1899 PlayerProxyInterface::r#watch_info_change(self)
1900 }
1901}
1902
1903impl PlayerProxyInterface for PlayerProxy {
1904 fn r#play(&self) -> Result<(), fidl::Error> {
1905 self.client.send::<fidl::encoding::EmptyPayload>(
1906 (),
1907 0x164120d5bdb26f8e,
1908 fidl::encoding::DynamicFlags::empty(),
1909 )
1910 }
1911
1912 fn r#pause(&self) -> Result<(), fidl::Error> {
1913 self.client.send::<fidl::encoding::EmptyPayload>(
1914 (),
1915 0x1536d16f202ece1,
1916 fidl::encoding::DynamicFlags::empty(),
1917 )
1918 }
1919
1920 fn r#stop(&self) -> Result<(), fidl::Error> {
1921 self.client.send::<fidl::encoding::EmptyPayload>(
1922 (),
1923 0x1946e5fc6c2362ae,
1924 fidl::encoding::DynamicFlags::empty(),
1925 )
1926 }
1927
1928 fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
1929 self.client.send::<PlayerControlSeekRequest>(
1930 (position,),
1931 0x4e7237d293e22125,
1932 fidl::encoding::DynamicFlags::empty(),
1933 )
1934 }
1935
1936 fn r#skip_forward(&self) -> Result<(), fidl::Error> {
1937 self.client.send::<fidl::encoding::EmptyPayload>(
1938 (),
1939 0x6ee04477076dac1b,
1940 fidl::encoding::DynamicFlags::empty(),
1941 )
1942 }
1943
1944 fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
1945 self.client.send::<fidl::encoding::EmptyPayload>(
1946 (),
1947 0xa4e05644ce33a28,
1948 fidl::encoding::DynamicFlags::empty(),
1949 )
1950 }
1951
1952 fn r#next_item(&self) -> Result<(), fidl::Error> {
1953 self.client.send::<fidl::encoding::EmptyPayload>(
1954 (),
1955 0x73307b32e35ff260,
1956 fidl::encoding::DynamicFlags::empty(),
1957 )
1958 }
1959
1960 fn r#prev_item(&self) -> Result<(), fidl::Error> {
1961 self.client.send::<fidl::encoding::EmptyPayload>(
1962 (),
1963 0x680444f03a759a3c,
1964 fidl::encoding::DynamicFlags::empty(),
1965 )
1966 }
1967
1968 fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
1969 self.client.send::<PlayerControlSetPlaybackRateRequest>(
1970 (playback_rate,),
1971 0x3831b8b161e1bccf,
1972 fidl::encoding::DynamicFlags::empty(),
1973 )
1974 }
1975
1976 fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
1977 self.client.send::<PlayerControlSetRepeatModeRequest>(
1978 (repeat_mode,),
1979 0x21b9b1b17b7f01c2,
1980 fidl::encoding::DynamicFlags::empty(),
1981 )
1982 }
1983
1984 fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
1985 self.client.send::<PlayerControlSetShuffleModeRequest>(
1986 (shuffle_on,),
1987 0x7451a349ddb543c,
1988 fidl::encoding::DynamicFlags::empty(),
1989 )
1990 }
1991
1992 fn r#bind_volume_control(
1993 &self,
1994 mut volume_control_request: fidl::endpoints::ServerEnd<
1995 fidl_fuchsia_media_audio::VolumeControlMarker,
1996 >,
1997 ) -> Result<(), fidl::Error> {
1998 self.client.send::<PlayerControlBindVolumeControlRequest>(
1999 (volume_control_request,),
2000 0x11d61e878cf808bc,
2001 fidl::encoding::DynamicFlags::empty(),
2002 )
2003 }
2004
2005 type WatchInfoChangeResponseFut = fidl::client::QueryResponseFut<
2006 PlayerInfoDelta,
2007 fidl::encoding::DefaultFuchsiaResourceDialect,
2008 >;
2009 fn r#watch_info_change(&self) -> Self::WatchInfoChangeResponseFut {
2010 fn _decode(
2011 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2012 ) -> Result<PlayerInfoDelta, fidl::Error> {
2013 let _response = fidl::client::decode_transaction_body::<
2014 PlayerWatchInfoChangeResponse,
2015 fidl::encoding::DefaultFuchsiaResourceDialect,
2016 0x69196e240c62a732,
2017 >(_buf?)?;
2018 Ok(_response.player_info_delta)
2019 }
2020 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlayerInfoDelta>(
2021 (),
2022 0x69196e240c62a732,
2023 fidl::encoding::DynamicFlags::empty(),
2024 _decode,
2025 )
2026 }
2027}
2028
2029pub struct PlayerEventStream {
2030 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2031}
2032
2033impl std::marker::Unpin for PlayerEventStream {}
2034
2035impl futures::stream::FusedStream for PlayerEventStream {
2036 fn is_terminated(&self) -> bool {
2037 self.event_receiver.is_terminated()
2038 }
2039}
2040
2041impl futures::Stream for PlayerEventStream {
2042 type Item = Result<PlayerEvent, fidl::Error>;
2043
2044 fn poll_next(
2045 mut self: std::pin::Pin<&mut Self>,
2046 cx: &mut std::task::Context<'_>,
2047 ) -> std::task::Poll<Option<Self::Item>> {
2048 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2049 &mut self.event_receiver,
2050 cx
2051 )?) {
2052 Some(buf) => std::task::Poll::Ready(Some(PlayerEvent::decode(buf))),
2053 None => std::task::Poll::Ready(None),
2054 }
2055 }
2056}
2057
2058#[derive(Debug)]
2059pub enum PlayerEvent {}
2060
2061impl PlayerEvent {
2062 fn decode(
2064 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2065 ) -> Result<PlayerEvent, fidl::Error> {
2066 let (bytes, _handles) = buf.split_mut();
2067 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2068 debug_assert_eq!(tx_header.tx_id, 0);
2069 match tx_header.ordinal {
2070 _ => Err(fidl::Error::UnknownOrdinal {
2071 ordinal: tx_header.ordinal,
2072 protocol_name: <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2073 }),
2074 }
2075 }
2076}
2077
2078pub struct PlayerRequestStream {
2080 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2081 is_terminated: bool,
2082}
2083
2084impl std::marker::Unpin for PlayerRequestStream {}
2085
2086impl futures::stream::FusedStream for PlayerRequestStream {
2087 fn is_terminated(&self) -> bool {
2088 self.is_terminated
2089 }
2090}
2091
2092impl fidl::endpoints::RequestStream for PlayerRequestStream {
2093 type Protocol = PlayerMarker;
2094 type ControlHandle = PlayerControlHandle;
2095
2096 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2097 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2098 }
2099
2100 fn control_handle(&self) -> Self::ControlHandle {
2101 PlayerControlHandle { inner: self.inner.clone() }
2102 }
2103
2104 fn into_inner(
2105 self,
2106 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2107 {
2108 (self.inner, self.is_terminated)
2109 }
2110
2111 fn from_inner(
2112 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2113 is_terminated: bool,
2114 ) -> Self {
2115 Self { inner, is_terminated }
2116 }
2117}
2118
2119impl futures::Stream for PlayerRequestStream {
2120 type Item = Result<PlayerRequest, fidl::Error>;
2121
2122 fn poll_next(
2123 mut self: std::pin::Pin<&mut Self>,
2124 cx: &mut std::task::Context<'_>,
2125 ) -> std::task::Poll<Option<Self::Item>> {
2126 let this = &mut *self;
2127 if this.inner.check_shutdown(cx) {
2128 this.is_terminated = true;
2129 return std::task::Poll::Ready(None);
2130 }
2131 if this.is_terminated {
2132 panic!("polled PlayerRequestStream after completion");
2133 }
2134 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2135 |bytes, handles| {
2136 match this.inner.channel().read_etc(cx, bytes, handles) {
2137 std::task::Poll::Ready(Ok(())) => {}
2138 std::task::Poll::Pending => return std::task::Poll::Pending,
2139 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2140 this.is_terminated = true;
2141 return std::task::Poll::Ready(None);
2142 }
2143 std::task::Poll::Ready(Err(e)) => {
2144 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2145 e.into(),
2146 ))));
2147 }
2148 }
2149
2150 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2152
2153 std::task::Poll::Ready(Some(match header.ordinal {
2154 0x164120d5bdb26f8e => {
2155 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2156 let mut req = fidl::new_empty!(
2157 fidl::encoding::EmptyPayload,
2158 fidl::encoding::DefaultFuchsiaResourceDialect
2159 );
2160 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2161 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2162 Ok(PlayerRequest::Play { control_handle })
2163 }
2164 0x1536d16f202ece1 => {
2165 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2166 let mut req = fidl::new_empty!(
2167 fidl::encoding::EmptyPayload,
2168 fidl::encoding::DefaultFuchsiaResourceDialect
2169 );
2170 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2171 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2172 Ok(PlayerRequest::Pause { control_handle })
2173 }
2174 0x1946e5fc6c2362ae => {
2175 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2176 let mut req = fidl::new_empty!(
2177 fidl::encoding::EmptyPayload,
2178 fidl::encoding::DefaultFuchsiaResourceDialect
2179 );
2180 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2181 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2182 Ok(PlayerRequest::Stop { control_handle })
2183 }
2184 0x4e7237d293e22125 => {
2185 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2186 let mut req = fidl::new_empty!(
2187 PlayerControlSeekRequest,
2188 fidl::encoding::DefaultFuchsiaResourceDialect
2189 );
2190 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSeekRequest>(&header, _body_bytes, handles, &mut req)?;
2191 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2192 Ok(PlayerRequest::Seek { position: req.position, control_handle })
2193 }
2194 0x6ee04477076dac1b => {
2195 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2196 let mut req = fidl::new_empty!(
2197 fidl::encoding::EmptyPayload,
2198 fidl::encoding::DefaultFuchsiaResourceDialect
2199 );
2200 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2201 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2202 Ok(PlayerRequest::SkipForward { control_handle })
2203 }
2204 0xa4e05644ce33a28 => {
2205 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2206 let mut req = fidl::new_empty!(
2207 fidl::encoding::EmptyPayload,
2208 fidl::encoding::DefaultFuchsiaResourceDialect
2209 );
2210 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2211 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2212 Ok(PlayerRequest::SkipReverse { control_handle })
2213 }
2214 0x73307b32e35ff260 => {
2215 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2216 let mut req = fidl::new_empty!(
2217 fidl::encoding::EmptyPayload,
2218 fidl::encoding::DefaultFuchsiaResourceDialect
2219 );
2220 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2221 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2222 Ok(PlayerRequest::NextItem { control_handle })
2223 }
2224 0x680444f03a759a3c => {
2225 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2226 let mut req = fidl::new_empty!(
2227 fidl::encoding::EmptyPayload,
2228 fidl::encoding::DefaultFuchsiaResourceDialect
2229 );
2230 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2231 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2232 Ok(PlayerRequest::PrevItem { control_handle })
2233 }
2234 0x3831b8b161e1bccf => {
2235 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2236 let mut req = fidl::new_empty!(
2237 PlayerControlSetPlaybackRateRequest,
2238 fidl::encoding::DefaultFuchsiaResourceDialect
2239 );
2240 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetPlaybackRateRequest>(&header, _body_bytes, handles, &mut req)?;
2241 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2242 Ok(PlayerRequest::SetPlaybackRate {
2243 playback_rate: req.playback_rate,
2244
2245 control_handle,
2246 })
2247 }
2248 0x21b9b1b17b7f01c2 => {
2249 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2250 let mut req = fidl::new_empty!(
2251 PlayerControlSetRepeatModeRequest,
2252 fidl::encoding::DefaultFuchsiaResourceDialect
2253 );
2254 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetRepeatModeRequest>(&header, _body_bytes, handles, &mut req)?;
2255 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2256 Ok(PlayerRequest::SetRepeatMode {
2257 repeat_mode: req.repeat_mode,
2258
2259 control_handle,
2260 })
2261 }
2262 0x7451a349ddb543c => {
2263 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2264 let mut req = fidl::new_empty!(
2265 PlayerControlSetShuffleModeRequest,
2266 fidl::encoding::DefaultFuchsiaResourceDialect
2267 );
2268 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetShuffleModeRequest>(&header, _body_bytes, handles, &mut req)?;
2269 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2270 Ok(PlayerRequest::SetShuffleMode {
2271 shuffle_on: req.shuffle_on,
2272
2273 control_handle,
2274 })
2275 }
2276 0x11d61e878cf808bc => {
2277 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2278 let mut req = fidl::new_empty!(
2279 PlayerControlBindVolumeControlRequest,
2280 fidl::encoding::DefaultFuchsiaResourceDialect
2281 );
2282 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlBindVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
2283 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2284 Ok(PlayerRequest::BindVolumeControl {
2285 volume_control_request: req.volume_control_request,
2286
2287 control_handle,
2288 })
2289 }
2290 0x69196e240c62a732 => {
2291 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2292 let mut req = fidl::new_empty!(
2293 fidl::encoding::EmptyPayload,
2294 fidl::encoding::DefaultFuchsiaResourceDialect
2295 );
2296 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2297 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2298 Ok(PlayerRequest::WatchInfoChange {
2299 responder: PlayerWatchInfoChangeResponder {
2300 control_handle: std::mem::ManuallyDrop::new(control_handle),
2301 tx_id: header.tx_id,
2302 },
2303 })
2304 }
2305 _ => Err(fidl::Error::UnknownOrdinal {
2306 ordinal: header.ordinal,
2307 protocol_name:
2308 <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2309 }),
2310 }))
2311 },
2312 )
2313 }
2314}
2315
2316#[derive(Debug)]
2320pub enum PlayerRequest {
2321 Play { control_handle: PlayerControlHandle },
2324 Pause { control_handle: PlayerControlHandle },
2327 Stop { control_handle: PlayerControlHandle },
2329 Seek { position: i64, control_handle: PlayerControlHandle },
2334 SkipForward { control_handle: PlayerControlHandle },
2338 SkipReverse { control_handle: PlayerControlHandle },
2342 NextItem { control_handle: PlayerControlHandle },
2346 PrevItem { control_handle: PlayerControlHandle },
2350 SetPlaybackRate { playback_rate: f32, control_handle: PlayerControlHandle },
2354 SetRepeatMode { repeat_mode: RepeatMode, control_handle: PlayerControlHandle },
2360 SetShuffleMode { shuffle_on: bool, control_handle: PlayerControlHandle },
2363 BindVolumeControl {
2368 volume_control_request:
2369 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
2370 control_handle: PlayerControlHandle,
2371 },
2372 WatchInfoChange { responder: PlayerWatchInfoChangeResponder },
2374}
2375
2376impl PlayerRequest {
2377 #[allow(irrefutable_let_patterns)]
2378 pub fn into_play(self) -> Option<(PlayerControlHandle)> {
2379 if let PlayerRequest::Play { control_handle } = self {
2380 Some((control_handle))
2381 } else {
2382 None
2383 }
2384 }
2385
2386 #[allow(irrefutable_let_patterns)]
2387 pub fn into_pause(self) -> Option<(PlayerControlHandle)> {
2388 if let PlayerRequest::Pause { control_handle } = self {
2389 Some((control_handle))
2390 } else {
2391 None
2392 }
2393 }
2394
2395 #[allow(irrefutable_let_patterns)]
2396 pub fn into_stop(self) -> Option<(PlayerControlHandle)> {
2397 if let PlayerRequest::Stop { control_handle } = self {
2398 Some((control_handle))
2399 } else {
2400 None
2401 }
2402 }
2403
2404 #[allow(irrefutable_let_patterns)]
2405 pub fn into_seek(self) -> Option<(i64, PlayerControlHandle)> {
2406 if let PlayerRequest::Seek { position, control_handle } = self {
2407 Some((position, control_handle))
2408 } else {
2409 None
2410 }
2411 }
2412
2413 #[allow(irrefutable_let_patterns)]
2414 pub fn into_skip_forward(self) -> Option<(PlayerControlHandle)> {
2415 if let PlayerRequest::SkipForward { control_handle } = self {
2416 Some((control_handle))
2417 } else {
2418 None
2419 }
2420 }
2421
2422 #[allow(irrefutable_let_patterns)]
2423 pub fn into_skip_reverse(self) -> Option<(PlayerControlHandle)> {
2424 if let PlayerRequest::SkipReverse { control_handle } = self {
2425 Some((control_handle))
2426 } else {
2427 None
2428 }
2429 }
2430
2431 #[allow(irrefutable_let_patterns)]
2432 pub fn into_next_item(self) -> Option<(PlayerControlHandle)> {
2433 if let PlayerRequest::NextItem { control_handle } = self {
2434 Some((control_handle))
2435 } else {
2436 None
2437 }
2438 }
2439
2440 #[allow(irrefutable_let_patterns)]
2441 pub fn into_prev_item(self) -> Option<(PlayerControlHandle)> {
2442 if let PlayerRequest::PrevItem { control_handle } = self {
2443 Some((control_handle))
2444 } else {
2445 None
2446 }
2447 }
2448
2449 #[allow(irrefutable_let_patterns)]
2450 pub fn into_set_playback_rate(self) -> Option<(f32, PlayerControlHandle)> {
2451 if let PlayerRequest::SetPlaybackRate { playback_rate, control_handle } = self {
2452 Some((playback_rate, control_handle))
2453 } else {
2454 None
2455 }
2456 }
2457
2458 #[allow(irrefutable_let_patterns)]
2459 pub fn into_set_repeat_mode(self) -> Option<(RepeatMode, PlayerControlHandle)> {
2460 if let PlayerRequest::SetRepeatMode { repeat_mode, control_handle } = self {
2461 Some((repeat_mode, control_handle))
2462 } else {
2463 None
2464 }
2465 }
2466
2467 #[allow(irrefutable_let_patterns)]
2468 pub fn into_set_shuffle_mode(self) -> Option<(bool, PlayerControlHandle)> {
2469 if let PlayerRequest::SetShuffleMode { shuffle_on, control_handle } = self {
2470 Some((shuffle_on, control_handle))
2471 } else {
2472 None
2473 }
2474 }
2475
2476 #[allow(irrefutable_let_patterns)]
2477 pub fn into_bind_volume_control(
2478 self,
2479 ) -> Option<(
2480 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
2481 PlayerControlHandle,
2482 )> {
2483 if let PlayerRequest::BindVolumeControl { volume_control_request, control_handle } = self {
2484 Some((volume_control_request, control_handle))
2485 } else {
2486 None
2487 }
2488 }
2489
2490 #[allow(irrefutable_let_patterns)]
2491 pub fn into_watch_info_change(self) -> Option<(PlayerWatchInfoChangeResponder)> {
2492 if let PlayerRequest::WatchInfoChange { responder } = self {
2493 Some((responder))
2494 } else {
2495 None
2496 }
2497 }
2498
2499 pub fn method_name(&self) -> &'static str {
2501 match *self {
2502 PlayerRequest::Play { .. } => "play",
2503 PlayerRequest::Pause { .. } => "pause",
2504 PlayerRequest::Stop { .. } => "stop",
2505 PlayerRequest::Seek { .. } => "seek",
2506 PlayerRequest::SkipForward { .. } => "skip_forward",
2507 PlayerRequest::SkipReverse { .. } => "skip_reverse",
2508 PlayerRequest::NextItem { .. } => "next_item",
2509 PlayerRequest::PrevItem { .. } => "prev_item",
2510 PlayerRequest::SetPlaybackRate { .. } => "set_playback_rate",
2511 PlayerRequest::SetRepeatMode { .. } => "set_repeat_mode",
2512 PlayerRequest::SetShuffleMode { .. } => "set_shuffle_mode",
2513 PlayerRequest::BindVolumeControl { .. } => "bind_volume_control",
2514 PlayerRequest::WatchInfoChange { .. } => "watch_info_change",
2515 }
2516 }
2517}
2518
2519#[derive(Debug, Clone)]
2520pub struct PlayerControlHandle {
2521 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2522}
2523
2524impl fidl::endpoints::ControlHandle for PlayerControlHandle {
2525 fn shutdown(&self) {
2526 self.inner.shutdown()
2527 }
2528
2529 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2530 self.inner.shutdown_with_epitaph(status)
2531 }
2532
2533 fn is_closed(&self) -> bool {
2534 self.inner.channel().is_closed()
2535 }
2536 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2537 self.inner.channel().on_closed()
2538 }
2539
2540 #[cfg(target_os = "fuchsia")]
2541 fn signal_peer(
2542 &self,
2543 clear_mask: zx::Signals,
2544 set_mask: zx::Signals,
2545 ) -> Result<(), zx_status::Status> {
2546 use fidl::Peered;
2547 self.inner.channel().signal_peer(clear_mask, set_mask)
2548 }
2549}
2550
2551impl PlayerControlHandle {}
2552
2553#[must_use = "FIDL methods require a response to be sent"]
2554#[derive(Debug)]
2555pub struct PlayerWatchInfoChangeResponder {
2556 control_handle: std::mem::ManuallyDrop<PlayerControlHandle>,
2557 tx_id: u32,
2558}
2559
2560impl std::ops::Drop for PlayerWatchInfoChangeResponder {
2564 fn drop(&mut self) {
2565 self.control_handle.shutdown();
2566 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2568 }
2569}
2570
2571impl fidl::endpoints::Responder for PlayerWatchInfoChangeResponder {
2572 type ControlHandle = PlayerControlHandle;
2573
2574 fn control_handle(&self) -> &PlayerControlHandle {
2575 &self.control_handle
2576 }
2577
2578 fn drop_without_shutdown(mut self) {
2579 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2581 std::mem::forget(self);
2583 }
2584}
2585
2586impl PlayerWatchInfoChangeResponder {
2587 pub fn send(self, mut player_info_delta: &PlayerInfoDelta) -> Result<(), fidl::Error> {
2591 let _result = self.send_raw(player_info_delta);
2592 if _result.is_err() {
2593 self.control_handle.shutdown();
2594 }
2595 self.drop_without_shutdown();
2596 _result
2597 }
2598
2599 pub fn send_no_shutdown_on_err(
2601 self,
2602 mut player_info_delta: &PlayerInfoDelta,
2603 ) -> Result<(), fidl::Error> {
2604 let _result = self.send_raw(player_info_delta);
2605 self.drop_without_shutdown();
2606 _result
2607 }
2608
2609 fn send_raw(&self, mut player_info_delta: &PlayerInfoDelta) -> Result<(), fidl::Error> {
2610 self.control_handle.inner.send::<PlayerWatchInfoChangeResponse>(
2611 (player_info_delta,),
2612 self.tx_id,
2613 0x69196e240c62a732,
2614 fidl::encoding::DynamicFlags::empty(),
2615 )
2616 }
2617}
2618
2619#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2620pub struct PlayerControlMarker;
2621
2622impl fidl::endpoints::ProtocolMarker for PlayerControlMarker {
2623 type Proxy = PlayerControlProxy;
2624 type RequestStream = PlayerControlRequestStream;
2625 #[cfg(target_os = "fuchsia")]
2626 type SynchronousProxy = PlayerControlSynchronousProxy;
2627
2628 const DEBUG_NAME: &'static str = "(anonymous) PlayerControl";
2629}
2630
2631pub trait PlayerControlProxyInterface: Send + Sync {
2632 fn r#play(&self) -> Result<(), fidl::Error>;
2633 fn r#pause(&self) -> Result<(), fidl::Error>;
2634 fn r#stop(&self) -> Result<(), fidl::Error>;
2635 fn r#seek(&self, position: i64) -> Result<(), fidl::Error>;
2636 fn r#skip_forward(&self) -> Result<(), fidl::Error>;
2637 fn r#skip_reverse(&self) -> Result<(), fidl::Error>;
2638 fn r#next_item(&self) -> Result<(), fidl::Error>;
2639 fn r#prev_item(&self) -> Result<(), fidl::Error>;
2640 fn r#set_playback_rate(&self, playback_rate: f32) -> Result<(), fidl::Error>;
2641 fn r#set_repeat_mode(&self, repeat_mode: RepeatMode) -> Result<(), fidl::Error>;
2642 fn r#set_shuffle_mode(&self, shuffle_on: bool) -> Result<(), fidl::Error>;
2643 fn r#bind_volume_control(
2644 &self,
2645 volume_control_request: fidl::endpoints::ServerEnd<
2646 fidl_fuchsia_media_audio::VolumeControlMarker,
2647 >,
2648 ) -> Result<(), fidl::Error>;
2649}
2650#[derive(Debug)]
2651#[cfg(target_os = "fuchsia")]
2652pub struct PlayerControlSynchronousProxy {
2653 client: fidl::client::sync::Client,
2654}
2655
2656#[cfg(target_os = "fuchsia")]
2657impl fidl::endpoints::SynchronousProxy for PlayerControlSynchronousProxy {
2658 type Proxy = PlayerControlProxy;
2659 type Protocol = PlayerControlMarker;
2660
2661 fn from_channel(inner: fidl::Channel) -> Self {
2662 Self::new(inner)
2663 }
2664
2665 fn into_channel(self) -> fidl::Channel {
2666 self.client.into_channel()
2667 }
2668
2669 fn as_channel(&self) -> &fidl::Channel {
2670 self.client.as_channel()
2671 }
2672}
2673
2674#[cfg(target_os = "fuchsia")]
2675impl PlayerControlSynchronousProxy {
2676 pub fn new(channel: fidl::Channel) -> Self {
2677 Self { client: fidl::client::sync::Client::new(channel) }
2678 }
2679
2680 pub fn into_channel(self) -> fidl::Channel {
2681 self.client.into_channel()
2682 }
2683
2684 pub fn wait_for_event(
2687 &self,
2688 deadline: zx::MonotonicInstant,
2689 ) -> Result<PlayerControlEvent, fidl::Error> {
2690 PlayerControlEvent::decode(self.client.wait_for_event::<PlayerControlMarker>(deadline)?)
2691 }
2692
2693 pub fn r#play(&self) -> Result<(), fidl::Error> {
2696 self.client.send::<fidl::encoding::EmptyPayload>(
2697 (),
2698 0x164120d5bdb26f8e,
2699 fidl::encoding::DynamicFlags::empty(),
2700 )
2701 }
2702
2703 pub fn r#pause(&self) -> Result<(), fidl::Error> {
2706 self.client.send::<fidl::encoding::EmptyPayload>(
2707 (),
2708 0x1536d16f202ece1,
2709 fidl::encoding::DynamicFlags::empty(),
2710 )
2711 }
2712
2713 pub fn r#stop(&self) -> Result<(), fidl::Error> {
2715 self.client.send::<fidl::encoding::EmptyPayload>(
2716 (),
2717 0x1946e5fc6c2362ae,
2718 fidl::encoding::DynamicFlags::empty(),
2719 )
2720 }
2721
2722 pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
2727 self.client.send::<PlayerControlSeekRequest>(
2728 (position,),
2729 0x4e7237d293e22125,
2730 fidl::encoding::DynamicFlags::empty(),
2731 )
2732 }
2733
2734 pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
2738 self.client.send::<fidl::encoding::EmptyPayload>(
2739 (),
2740 0x6ee04477076dac1b,
2741 fidl::encoding::DynamicFlags::empty(),
2742 )
2743 }
2744
2745 pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
2749 self.client.send::<fidl::encoding::EmptyPayload>(
2750 (),
2751 0xa4e05644ce33a28,
2752 fidl::encoding::DynamicFlags::empty(),
2753 )
2754 }
2755
2756 pub fn r#next_item(&self) -> Result<(), fidl::Error> {
2760 self.client.send::<fidl::encoding::EmptyPayload>(
2761 (),
2762 0x73307b32e35ff260,
2763 fidl::encoding::DynamicFlags::empty(),
2764 )
2765 }
2766
2767 pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
2771 self.client.send::<fidl::encoding::EmptyPayload>(
2772 (),
2773 0x680444f03a759a3c,
2774 fidl::encoding::DynamicFlags::empty(),
2775 )
2776 }
2777
2778 pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
2782 self.client.send::<PlayerControlSetPlaybackRateRequest>(
2783 (playback_rate,),
2784 0x3831b8b161e1bccf,
2785 fidl::encoding::DynamicFlags::empty(),
2786 )
2787 }
2788
2789 pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
2795 self.client.send::<PlayerControlSetRepeatModeRequest>(
2796 (repeat_mode,),
2797 0x21b9b1b17b7f01c2,
2798 fidl::encoding::DynamicFlags::empty(),
2799 )
2800 }
2801
2802 pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
2805 self.client.send::<PlayerControlSetShuffleModeRequest>(
2806 (shuffle_on,),
2807 0x7451a349ddb543c,
2808 fidl::encoding::DynamicFlags::empty(),
2809 )
2810 }
2811
2812 pub fn r#bind_volume_control(
2817 &self,
2818 mut volume_control_request: fidl::endpoints::ServerEnd<
2819 fidl_fuchsia_media_audio::VolumeControlMarker,
2820 >,
2821 ) -> Result<(), fidl::Error> {
2822 self.client.send::<PlayerControlBindVolumeControlRequest>(
2823 (volume_control_request,),
2824 0x11d61e878cf808bc,
2825 fidl::encoding::DynamicFlags::empty(),
2826 )
2827 }
2828}
2829
2830#[cfg(target_os = "fuchsia")]
2831impl From<PlayerControlSynchronousProxy> for zx::NullableHandle {
2832 fn from(value: PlayerControlSynchronousProxy) -> Self {
2833 value.into_channel().into()
2834 }
2835}
2836
2837#[cfg(target_os = "fuchsia")]
2838impl From<fidl::Channel> for PlayerControlSynchronousProxy {
2839 fn from(value: fidl::Channel) -> Self {
2840 Self::new(value)
2841 }
2842}
2843
2844#[cfg(target_os = "fuchsia")]
2845impl fidl::endpoints::FromClient for PlayerControlSynchronousProxy {
2846 type Protocol = PlayerControlMarker;
2847
2848 fn from_client(value: fidl::endpoints::ClientEnd<PlayerControlMarker>) -> Self {
2849 Self::new(value.into_channel())
2850 }
2851}
2852
2853#[derive(Debug, Clone)]
2854pub struct PlayerControlProxy {
2855 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2856}
2857
2858impl fidl::endpoints::Proxy for PlayerControlProxy {
2859 type Protocol = PlayerControlMarker;
2860
2861 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2862 Self::new(inner)
2863 }
2864
2865 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2866 self.client.into_channel().map_err(|client| Self { client })
2867 }
2868
2869 fn as_channel(&self) -> &::fidl::AsyncChannel {
2870 self.client.as_channel()
2871 }
2872}
2873
2874impl PlayerControlProxy {
2875 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2877 let protocol_name = <PlayerControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2878 Self { client: fidl::client::Client::new(channel, protocol_name) }
2879 }
2880
2881 pub fn take_event_stream(&self) -> PlayerControlEventStream {
2887 PlayerControlEventStream { event_receiver: self.client.take_event_receiver() }
2888 }
2889
2890 pub fn r#play(&self) -> Result<(), fidl::Error> {
2893 PlayerControlProxyInterface::r#play(self)
2894 }
2895
2896 pub fn r#pause(&self) -> Result<(), fidl::Error> {
2899 PlayerControlProxyInterface::r#pause(self)
2900 }
2901
2902 pub fn r#stop(&self) -> Result<(), fidl::Error> {
2904 PlayerControlProxyInterface::r#stop(self)
2905 }
2906
2907 pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
2912 PlayerControlProxyInterface::r#seek(self, position)
2913 }
2914
2915 pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
2919 PlayerControlProxyInterface::r#skip_forward(self)
2920 }
2921
2922 pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
2926 PlayerControlProxyInterface::r#skip_reverse(self)
2927 }
2928
2929 pub fn r#next_item(&self) -> Result<(), fidl::Error> {
2933 PlayerControlProxyInterface::r#next_item(self)
2934 }
2935
2936 pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
2940 PlayerControlProxyInterface::r#prev_item(self)
2941 }
2942
2943 pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
2947 PlayerControlProxyInterface::r#set_playback_rate(self, playback_rate)
2948 }
2949
2950 pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
2956 PlayerControlProxyInterface::r#set_repeat_mode(self, repeat_mode)
2957 }
2958
2959 pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
2962 PlayerControlProxyInterface::r#set_shuffle_mode(self, shuffle_on)
2963 }
2964
2965 pub fn r#bind_volume_control(
2970 &self,
2971 mut volume_control_request: fidl::endpoints::ServerEnd<
2972 fidl_fuchsia_media_audio::VolumeControlMarker,
2973 >,
2974 ) -> Result<(), fidl::Error> {
2975 PlayerControlProxyInterface::r#bind_volume_control(self, volume_control_request)
2976 }
2977}
2978
2979impl PlayerControlProxyInterface for PlayerControlProxy {
2980 fn r#play(&self) -> Result<(), fidl::Error> {
2981 self.client.send::<fidl::encoding::EmptyPayload>(
2982 (),
2983 0x164120d5bdb26f8e,
2984 fidl::encoding::DynamicFlags::empty(),
2985 )
2986 }
2987
2988 fn r#pause(&self) -> Result<(), fidl::Error> {
2989 self.client.send::<fidl::encoding::EmptyPayload>(
2990 (),
2991 0x1536d16f202ece1,
2992 fidl::encoding::DynamicFlags::empty(),
2993 )
2994 }
2995
2996 fn r#stop(&self) -> Result<(), fidl::Error> {
2997 self.client.send::<fidl::encoding::EmptyPayload>(
2998 (),
2999 0x1946e5fc6c2362ae,
3000 fidl::encoding::DynamicFlags::empty(),
3001 )
3002 }
3003
3004 fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
3005 self.client.send::<PlayerControlSeekRequest>(
3006 (position,),
3007 0x4e7237d293e22125,
3008 fidl::encoding::DynamicFlags::empty(),
3009 )
3010 }
3011
3012 fn r#skip_forward(&self) -> Result<(), fidl::Error> {
3013 self.client.send::<fidl::encoding::EmptyPayload>(
3014 (),
3015 0x6ee04477076dac1b,
3016 fidl::encoding::DynamicFlags::empty(),
3017 )
3018 }
3019
3020 fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
3021 self.client.send::<fidl::encoding::EmptyPayload>(
3022 (),
3023 0xa4e05644ce33a28,
3024 fidl::encoding::DynamicFlags::empty(),
3025 )
3026 }
3027
3028 fn r#next_item(&self) -> Result<(), fidl::Error> {
3029 self.client.send::<fidl::encoding::EmptyPayload>(
3030 (),
3031 0x73307b32e35ff260,
3032 fidl::encoding::DynamicFlags::empty(),
3033 )
3034 }
3035
3036 fn r#prev_item(&self) -> Result<(), fidl::Error> {
3037 self.client.send::<fidl::encoding::EmptyPayload>(
3038 (),
3039 0x680444f03a759a3c,
3040 fidl::encoding::DynamicFlags::empty(),
3041 )
3042 }
3043
3044 fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
3045 self.client.send::<PlayerControlSetPlaybackRateRequest>(
3046 (playback_rate,),
3047 0x3831b8b161e1bccf,
3048 fidl::encoding::DynamicFlags::empty(),
3049 )
3050 }
3051
3052 fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
3053 self.client.send::<PlayerControlSetRepeatModeRequest>(
3054 (repeat_mode,),
3055 0x21b9b1b17b7f01c2,
3056 fidl::encoding::DynamicFlags::empty(),
3057 )
3058 }
3059
3060 fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
3061 self.client.send::<PlayerControlSetShuffleModeRequest>(
3062 (shuffle_on,),
3063 0x7451a349ddb543c,
3064 fidl::encoding::DynamicFlags::empty(),
3065 )
3066 }
3067
3068 fn r#bind_volume_control(
3069 &self,
3070 mut volume_control_request: fidl::endpoints::ServerEnd<
3071 fidl_fuchsia_media_audio::VolumeControlMarker,
3072 >,
3073 ) -> Result<(), fidl::Error> {
3074 self.client.send::<PlayerControlBindVolumeControlRequest>(
3075 (volume_control_request,),
3076 0x11d61e878cf808bc,
3077 fidl::encoding::DynamicFlags::empty(),
3078 )
3079 }
3080}
3081
3082pub struct PlayerControlEventStream {
3083 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3084}
3085
3086impl std::marker::Unpin for PlayerControlEventStream {}
3087
3088impl futures::stream::FusedStream for PlayerControlEventStream {
3089 fn is_terminated(&self) -> bool {
3090 self.event_receiver.is_terminated()
3091 }
3092}
3093
3094impl futures::Stream for PlayerControlEventStream {
3095 type Item = Result<PlayerControlEvent, fidl::Error>;
3096
3097 fn poll_next(
3098 mut self: std::pin::Pin<&mut Self>,
3099 cx: &mut std::task::Context<'_>,
3100 ) -> std::task::Poll<Option<Self::Item>> {
3101 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3102 &mut self.event_receiver,
3103 cx
3104 )?) {
3105 Some(buf) => std::task::Poll::Ready(Some(PlayerControlEvent::decode(buf))),
3106 None => std::task::Poll::Ready(None),
3107 }
3108 }
3109}
3110
3111#[derive(Debug)]
3112pub enum PlayerControlEvent {}
3113
3114impl PlayerControlEvent {
3115 fn decode(
3117 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3118 ) -> Result<PlayerControlEvent, fidl::Error> {
3119 let (bytes, _handles) = buf.split_mut();
3120 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3121 debug_assert_eq!(tx_header.tx_id, 0);
3122 match tx_header.ordinal {
3123 _ => Err(fidl::Error::UnknownOrdinal {
3124 ordinal: tx_header.ordinal,
3125 protocol_name: <PlayerControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3126 }),
3127 }
3128 }
3129}
3130
3131pub struct PlayerControlRequestStream {
3133 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3134 is_terminated: bool,
3135}
3136
3137impl std::marker::Unpin for PlayerControlRequestStream {}
3138
3139impl futures::stream::FusedStream for PlayerControlRequestStream {
3140 fn is_terminated(&self) -> bool {
3141 self.is_terminated
3142 }
3143}
3144
3145impl fidl::endpoints::RequestStream for PlayerControlRequestStream {
3146 type Protocol = PlayerControlMarker;
3147 type ControlHandle = PlayerControlControlHandle;
3148
3149 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3150 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3151 }
3152
3153 fn control_handle(&self) -> Self::ControlHandle {
3154 PlayerControlControlHandle { inner: self.inner.clone() }
3155 }
3156
3157 fn into_inner(
3158 self,
3159 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3160 {
3161 (self.inner, self.is_terminated)
3162 }
3163
3164 fn from_inner(
3165 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3166 is_terminated: bool,
3167 ) -> Self {
3168 Self { inner, is_terminated }
3169 }
3170}
3171
3172impl futures::Stream for PlayerControlRequestStream {
3173 type Item = Result<PlayerControlRequest, fidl::Error>;
3174
3175 fn poll_next(
3176 mut self: std::pin::Pin<&mut Self>,
3177 cx: &mut std::task::Context<'_>,
3178 ) -> std::task::Poll<Option<Self::Item>> {
3179 let this = &mut *self;
3180 if this.inner.check_shutdown(cx) {
3181 this.is_terminated = true;
3182 return std::task::Poll::Ready(None);
3183 }
3184 if this.is_terminated {
3185 panic!("polled PlayerControlRequestStream after completion");
3186 }
3187 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3188 |bytes, handles| {
3189 match this.inner.channel().read_etc(cx, bytes, handles) {
3190 std::task::Poll::Ready(Ok(())) => {}
3191 std::task::Poll::Pending => return std::task::Poll::Pending,
3192 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3193 this.is_terminated = true;
3194 return std::task::Poll::Ready(None);
3195 }
3196 std::task::Poll::Ready(Err(e)) => {
3197 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3198 e.into(),
3199 ))));
3200 }
3201 }
3202
3203 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3205
3206 std::task::Poll::Ready(Some(match header.ordinal {
3207 0x164120d5bdb26f8e => {
3208 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3209 let mut req = fidl::new_empty!(
3210 fidl::encoding::EmptyPayload,
3211 fidl::encoding::DefaultFuchsiaResourceDialect
3212 );
3213 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3214 let control_handle =
3215 PlayerControlControlHandle { inner: this.inner.clone() };
3216 Ok(PlayerControlRequest::Play { control_handle })
3217 }
3218 0x1536d16f202ece1 => {
3219 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3220 let mut req = fidl::new_empty!(
3221 fidl::encoding::EmptyPayload,
3222 fidl::encoding::DefaultFuchsiaResourceDialect
3223 );
3224 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3225 let control_handle =
3226 PlayerControlControlHandle { inner: this.inner.clone() };
3227 Ok(PlayerControlRequest::Pause { control_handle })
3228 }
3229 0x1946e5fc6c2362ae => {
3230 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3231 let mut req = fidl::new_empty!(
3232 fidl::encoding::EmptyPayload,
3233 fidl::encoding::DefaultFuchsiaResourceDialect
3234 );
3235 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3236 let control_handle =
3237 PlayerControlControlHandle { inner: this.inner.clone() };
3238 Ok(PlayerControlRequest::Stop { control_handle })
3239 }
3240 0x4e7237d293e22125 => {
3241 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3242 let mut req = fidl::new_empty!(
3243 PlayerControlSeekRequest,
3244 fidl::encoding::DefaultFuchsiaResourceDialect
3245 );
3246 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSeekRequest>(&header, _body_bytes, handles, &mut req)?;
3247 let control_handle =
3248 PlayerControlControlHandle { inner: this.inner.clone() };
3249 Ok(PlayerControlRequest::Seek { position: req.position, control_handle })
3250 }
3251 0x6ee04477076dac1b => {
3252 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3253 let mut req = fidl::new_empty!(
3254 fidl::encoding::EmptyPayload,
3255 fidl::encoding::DefaultFuchsiaResourceDialect
3256 );
3257 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3258 let control_handle =
3259 PlayerControlControlHandle { inner: this.inner.clone() };
3260 Ok(PlayerControlRequest::SkipForward { control_handle })
3261 }
3262 0xa4e05644ce33a28 => {
3263 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3264 let mut req = fidl::new_empty!(
3265 fidl::encoding::EmptyPayload,
3266 fidl::encoding::DefaultFuchsiaResourceDialect
3267 );
3268 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3269 let control_handle =
3270 PlayerControlControlHandle { inner: this.inner.clone() };
3271 Ok(PlayerControlRequest::SkipReverse { control_handle })
3272 }
3273 0x73307b32e35ff260 => {
3274 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3275 let mut req = fidl::new_empty!(
3276 fidl::encoding::EmptyPayload,
3277 fidl::encoding::DefaultFuchsiaResourceDialect
3278 );
3279 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3280 let control_handle =
3281 PlayerControlControlHandle { inner: this.inner.clone() };
3282 Ok(PlayerControlRequest::NextItem { control_handle })
3283 }
3284 0x680444f03a759a3c => {
3285 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3286 let mut req = fidl::new_empty!(
3287 fidl::encoding::EmptyPayload,
3288 fidl::encoding::DefaultFuchsiaResourceDialect
3289 );
3290 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3291 let control_handle =
3292 PlayerControlControlHandle { inner: this.inner.clone() };
3293 Ok(PlayerControlRequest::PrevItem { control_handle })
3294 }
3295 0x3831b8b161e1bccf => {
3296 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3297 let mut req = fidl::new_empty!(
3298 PlayerControlSetPlaybackRateRequest,
3299 fidl::encoding::DefaultFuchsiaResourceDialect
3300 );
3301 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetPlaybackRateRequest>(&header, _body_bytes, handles, &mut req)?;
3302 let control_handle =
3303 PlayerControlControlHandle { inner: this.inner.clone() };
3304 Ok(PlayerControlRequest::SetPlaybackRate {
3305 playback_rate: req.playback_rate,
3306
3307 control_handle,
3308 })
3309 }
3310 0x21b9b1b17b7f01c2 => {
3311 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3312 let mut req = fidl::new_empty!(
3313 PlayerControlSetRepeatModeRequest,
3314 fidl::encoding::DefaultFuchsiaResourceDialect
3315 );
3316 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetRepeatModeRequest>(&header, _body_bytes, handles, &mut req)?;
3317 let control_handle =
3318 PlayerControlControlHandle { inner: this.inner.clone() };
3319 Ok(PlayerControlRequest::SetRepeatMode {
3320 repeat_mode: req.repeat_mode,
3321
3322 control_handle,
3323 })
3324 }
3325 0x7451a349ddb543c => {
3326 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3327 let mut req = fidl::new_empty!(
3328 PlayerControlSetShuffleModeRequest,
3329 fidl::encoding::DefaultFuchsiaResourceDialect
3330 );
3331 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetShuffleModeRequest>(&header, _body_bytes, handles, &mut req)?;
3332 let control_handle =
3333 PlayerControlControlHandle { inner: this.inner.clone() };
3334 Ok(PlayerControlRequest::SetShuffleMode {
3335 shuffle_on: req.shuffle_on,
3336
3337 control_handle,
3338 })
3339 }
3340 0x11d61e878cf808bc => {
3341 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3342 let mut req = fidl::new_empty!(
3343 PlayerControlBindVolumeControlRequest,
3344 fidl::encoding::DefaultFuchsiaResourceDialect
3345 );
3346 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlBindVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
3347 let control_handle =
3348 PlayerControlControlHandle { inner: this.inner.clone() };
3349 Ok(PlayerControlRequest::BindVolumeControl {
3350 volume_control_request: req.volume_control_request,
3351
3352 control_handle,
3353 })
3354 }
3355 _ => Err(fidl::Error::UnknownOrdinal {
3356 ordinal: header.ordinal,
3357 protocol_name:
3358 <PlayerControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3359 }),
3360 }))
3361 },
3362 )
3363 }
3364}
3365
3366#[derive(Debug)]
3372pub enum PlayerControlRequest {
3373 Play { control_handle: PlayerControlControlHandle },
3376 Pause { control_handle: PlayerControlControlHandle },
3379 Stop { control_handle: PlayerControlControlHandle },
3381 Seek { position: i64, control_handle: PlayerControlControlHandle },
3386 SkipForward { control_handle: PlayerControlControlHandle },
3390 SkipReverse { control_handle: PlayerControlControlHandle },
3394 NextItem { control_handle: PlayerControlControlHandle },
3398 PrevItem { control_handle: PlayerControlControlHandle },
3402 SetPlaybackRate { playback_rate: f32, control_handle: PlayerControlControlHandle },
3406 SetRepeatMode { repeat_mode: RepeatMode, control_handle: PlayerControlControlHandle },
3412 SetShuffleMode { shuffle_on: bool, control_handle: PlayerControlControlHandle },
3415 BindVolumeControl {
3420 volume_control_request:
3421 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
3422 control_handle: PlayerControlControlHandle,
3423 },
3424}
3425
3426impl PlayerControlRequest {
3427 #[allow(irrefutable_let_patterns)]
3428 pub fn into_play(self) -> Option<(PlayerControlControlHandle)> {
3429 if let PlayerControlRequest::Play { control_handle } = self {
3430 Some((control_handle))
3431 } else {
3432 None
3433 }
3434 }
3435
3436 #[allow(irrefutable_let_patterns)]
3437 pub fn into_pause(self) -> Option<(PlayerControlControlHandle)> {
3438 if let PlayerControlRequest::Pause { control_handle } = self {
3439 Some((control_handle))
3440 } else {
3441 None
3442 }
3443 }
3444
3445 #[allow(irrefutable_let_patterns)]
3446 pub fn into_stop(self) -> Option<(PlayerControlControlHandle)> {
3447 if let PlayerControlRequest::Stop { control_handle } = self {
3448 Some((control_handle))
3449 } else {
3450 None
3451 }
3452 }
3453
3454 #[allow(irrefutable_let_patterns)]
3455 pub fn into_seek(self) -> Option<(i64, PlayerControlControlHandle)> {
3456 if let PlayerControlRequest::Seek { position, control_handle } = self {
3457 Some((position, control_handle))
3458 } else {
3459 None
3460 }
3461 }
3462
3463 #[allow(irrefutable_let_patterns)]
3464 pub fn into_skip_forward(self) -> Option<(PlayerControlControlHandle)> {
3465 if let PlayerControlRequest::SkipForward { control_handle } = self {
3466 Some((control_handle))
3467 } else {
3468 None
3469 }
3470 }
3471
3472 #[allow(irrefutable_let_patterns)]
3473 pub fn into_skip_reverse(self) -> Option<(PlayerControlControlHandle)> {
3474 if let PlayerControlRequest::SkipReverse { control_handle } = self {
3475 Some((control_handle))
3476 } else {
3477 None
3478 }
3479 }
3480
3481 #[allow(irrefutable_let_patterns)]
3482 pub fn into_next_item(self) -> Option<(PlayerControlControlHandle)> {
3483 if let PlayerControlRequest::NextItem { control_handle } = self {
3484 Some((control_handle))
3485 } else {
3486 None
3487 }
3488 }
3489
3490 #[allow(irrefutable_let_patterns)]
3491 pub fn into_prev_item(self) -> Option<(PlayerControlControlHandle)> {
3492 if let PlayerControlRequest::PrevItem { control_handle } = self {
3493 Some((control_handle))
3494 } else {
3495 None
3496 }
3497 }
3498
3499 #[allow(irrefutable_let_patterns)]
3500 pub fn into_set_playback_rate(self) -> Option<(f32, PlayerControlControlHandle)> {
3501 if let PlayerControlRequest::SetPlaybackRate { playback_rate, control_handle } = self {
3502 Some((playback_rate, control_handle))
3503 } else {
3504 None
3505 }
3506 }
3507
3508 #[allow(irrefutable_let_patterns)]
3509 pub fn into_set_repeat_mode(self) -> Option<(RepeatMode, PlayerControlControlHandle)> {
3510 if let PlayerControlRequest::SetRepeatMode { repeat_mode, control_handle } = self {
3511 Some((repeat_mode, control_handle))
3512 } else {
3513 None
3514 }
3515 }
3516
3517 #[allow(irrefutable_let_patterns)]
3518 pub fn into_set_shuffle_mode(self) -> Option<(bool, PlayerControlControlHandle)> {
3519 if let PlayerControlRequest::SetShuffleMode { shuffle_on, control_handle } = self {
3520 Some((shuffle_on, control_handle))
3521 } else {
3522 None
3523 }
3524 }
3525
3526 #[allow(irrefutable_let_patterns)]
3527 pub fn into_bind_volume_control(
3528 self,
3529 ) -> Option<(
3530 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
3531 PlayerControlControlHandle,
3532 )> {
3533 if let PlayerControlRequest::BindVolumeControl { volume_control_request, control_handle } =
3534 self
3535 {
3536 Some((volume_control_request, control_handle))
3537 } else {
3538 None
3539 }
3540 }
3541
3542 pub fn method_name(&self) -> &'static str {
3544 match *self {
3545 PlayerControlRequest::Play { .. } => "play",
3546 PlayerControlRequest::Pause { .. } => "pause",
3547 PlayerControlRequest::Stop { .. } => "stop",
3548 PlayerControlRequest::Seek { .. } => "seek",
3549 PlayerControlRequest::SkipForward { .. } => "skip_forward",
3550 PlayerControlRequest::SkipReverse { .. } => "skip_reverse",
3551 PlayerControlRequest::NextItem { .. } => "next_item",
3552 PlayerControlRequest::PrevItem { .. } => "prev_item",
3553 PlayerControlRequest::SetPlaybackRate { .. } => "set_playback_rate",
3554 PlayerControlRequest::SetRepeatMode { .. } => "set_repeat_mode",
3555 PlayerControlRequest::SetShuffleMode { .. } => "set_shuffle_mode",
3556 PlayerControlRequest::BindVolumeControl { .. } => "bind_volume_control",
3557 }
3558 }
3559}
3560
3561#[derive(Debug, Clone)]
3562pub struct PlayerControlControlHandle {
3563 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3564}
3565
3566impl fidl::endpoints::ControlHandle for PlayerControlControlHandle {
3567 fn shutdown(&self) {
3568 self.inner.shutdown()
3569 }
3570
3571 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3572 self.inner.shutdown_with_epitaph(status)
3573 }
3574
3575 fn is_closed(&self) -> bool {
3576 self.inner.channel().is_closed()
3577 }
3578 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3579 self.inner.channel().on_closed()
3580 }
3581
3582 #[cfg(target_os = "fuchsia")]
3583 fn signal_peer(
3584 &self,
3585 clear_mask: zx::Signals,
3586 set_mask: zx::Signals,
3587 ) -> Result<(), zx_status::Status> {
3588 use fidl::Peered;
3589 self.inner.channel().signal_peer(clear_mask, set_mask)
3590 }
3591}
3592
3593impl PlayerControlControlHandle {}
3594
3595#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3596pub struct PublisherMarker;
3597
3598impl fidl::endpoints::ProtocolMarker for PublisherMarker {
3599 type Proxy = PublisherProxy;
3600 type RequestStream = PublisherRequestStream;
3601 #[cfg(target_os = "fuchsia")]
3602 type SynchronousProxy = PublisherSynchronousProxy;
3603
3604 const DEBUG_NAME: &'static str = "fuchsia.media.sessions2.Publisher";
3605}
3606impl fidl::endpoints::DiscoverableProtocolMarker for PublisherMarker {}
3607
3608pub trait PublisherProxyInterface: Send + Sync {
3609 type PublishResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
3610 fn r#publish(
3611 &self,
3612 player: fidl::endpoints::ClientEnd<PlayerMarker>,
3613 registration: &PlayerRegistration,
3614 ) -> Self::PublishResponseFut;
3615}
3616#[derive(Debug)]
3617#[cfg(target_os = "fuchsia")]
3618pub struct PublisherSynchronousProxy {
3619 client: fidl::client::sync::Client,
3620}
3621
3622#[cfg(target_os = "fuchsia")]
3623impl fidl::endpoints::SynchronousProxy for PublisherSynchronousProxy {
3624 type Proxy = PublisherProxy;
3625 type Protocol = PublisherMarker;
3626
3627 fn from_channel(inner: fidl::Channel) -> Self {
3628 Self::new(inner)
3629 }
3630
3631 fn into_channel(self) -> fidl::Channel {
3632 self.client.into_channel()
3633 }
3634
3635 fn as_channel(&self) -> &fidl::Channel {
3636 self.client.as_channel()
3637 }
3638}
3639
3640#[cfg(target_os = "fuchsia")]
3641impl PublisherSynchronousProxy {
3642 pub fn new(channel: fidl::Channel) -> Self {
3643 Self { client: fidl::client::sync::Client::new(channel) }
3644 }
3645
3646 pub fn into_channel(self) -> fidl::Channel {
3647 self.client.into_channel()
3648 }
3649
3650 pub fn wait_for_event(
3653 &self,
3654 deadline: zx::MonotonicInstant,
3655 ) -> Result<PublisherEvent, fidl::Error> {
3656 PublisherEvent::decode(self.client.wait_for_event::<PublisherMarker>(deadline)?)
3657 }
3658
3659 pub fn r#publish(
3660 &self,
3661 mut player: fidl::endpoints::ClientEnd<PlayerMarker>,
3662 mut registration: &PlayerRegistration,
3663 ___deadline: zx::MonotonicInstant,
3664 ) -> Result<u64, fidl::Error> {
3665 let _response = self
3666 .client
3667 .send_query::<PublisherPublishRequest, PublisherPublishResponse, PublisherMarker>(
3668 (player, registration),
3669 0x2e4a501ede5a1ad3,
3670 fidl::encoding::DynamicFlags::empty(),
3671 ___deadline,
3672 )?;
3673 Ok(_response.session_id)
3674 }
3675}
3676
3677#[cfg(target_os = "fuchsia")]
3678impl From<PublisherSynchronousProxy> for zx::NullableHandle {
3679 fn from(value: PublisherSynchronousProxy) -> Self {
3680 value.into_channel().into()
3681 }
3682}
3683
3684#[cfg(target_os = "fuchsia")]
3685impl From<fidl::Channel> for PublisherSynchronousProxy {
3686 fn from(value: fidl::Channel) -> Self {
3687 Self::new(value)
3688 }
3689}
3690
3691#[cfg(target_os = "fuchsia")]
3692impl fidl::endpoints::FromClient for PublisherSynchronousProxy {
3693 type Protocol = PublisherMarker;
3694
3695 fn from_client(value: fidl::endpoints::ClientEnd<PublisherMarker>) -> Self {
3696 Self::new(value.into_channel())
3697 }
3698}
3699
3700#[derive(Debug, Clone)]
3701pub struct PublisherProxy {
3702 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3703}
3704
3705impl fidl::endpoints::Proxy for PublisherProxy {
3706 type Protocol = PublisherMarker;
3707
3708 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3709 Self::new(inner)
3710 }
3711
3712 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3713 self.client.into_channel().map_err(|client| Self { client })
3714 }
3715
3716 fn as_channel(&self) -> &::fidl::AsyncChannel {
3717 self.client.as_channel()
3718 }
3719}
3720
3721impl PublisherProxy {
3722 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3724 let protocol_name = <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3725 Self { client: fidl::client::Client::new(channel, protocol_name) }
3726 }
3727
3728 pub fn take_event_stream(&self) -> PublisherEventStream {
3734 PublisherEventStream { event_receiver: self.client.take_event_receiver() }
3735 }
3736
3737 pub fn r#publish(
3738 &self,
3739 mut player: fidl::endpoints::ClientEnd<PlayerMarker>,
3740 mut registration: &PlayerRegistration,
3741 ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
3742 PublisherProxyInterface::r#publish(self, player, registration)
3743 }
3744}
3745
3746impl PublisherProxyInterface for PublisherProxy {
3747 type PublishResponseFut =
3748 fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
3749 fn r#publish(
3750 &self,
3751 mut player: fidl::endpoints::ClientEnd<PlayerMarker>,
3752 mut registration: &PlayerRegistration,
3753 ) -> Self::PublishResponseFut {
3754 fn _decode(
3755 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3756 ) -> Result<u64, fidl::Error> {
3757 let _response = fidl::client::decode_transaction_body::<
3758 PublisherPublishResponse,
3759 fidl::encoding::DefaultFuchsiaResourceDialect,
3760 0x2e4a501ede5a1ad3,
3761 >(_buf?)?;
3762 Ok(_response.session_id)
3763 }
3764 self.client.send_query_and_decode::<PublisherPublishRequest, u64>(
3765 (player, registration),
3766 0x2e4a501ede5a1ad3,
3767 fidl::encoding::DynamicFlags::empty(),
3768 _decode,
3769 )
3770 }
3771}
3772
3773pub struct PublisherEventStream {
3774 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3775}
3776
3777impl std::marker::Unpin for PublisherEventStream {}
3778
3779impl futures::stream::FusedStream for PublisherEventStream {
3780 fn is_terminated(&self) -> bool {
3781 self.event_receiver.is_terminated()
3782 }
3783}
3784
3785impl futures::Stream for PublisherEventStream {
3786 type Item = Result<PublisherEvent, fidl::Error>;
3787
3788 fn poll_next(
3789 mut self: std::pin::Pin<&mut Self>,
3790 cx: &mut std::task::Context<'_>,
3791 ) -> std::task::Poll<Option<Self::Item>> {
3792 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3793 &mut self.event_receiver,
3794 cx
3795 )?) {
3796 Some(buf) => std::task::Poll::Ready(Some(PublisherEvent::decode(buf))),
3797 None => std::task::Poll::Ready(None),
3798 }
3799 }
3800}
3801
3802#[derive(Debug)]
3803pub enum PublisherEvent {}
3804
3805impl PublisherEvent {
3806 fn decode(
3808 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3809 ) -> Result<PublisherEvent, fidl::Error> {
3810 let (bytes, _handles) = buf.split_mut();
3811 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3812 debug_assert_eq!(tx_header.tx_id, 0);
3813 match tx_header.ordinal {
3814 _ => Err(fidl::Error::UnknownOrdinal {
3815 ordinal: tx_header.ordinal,
3816 protocol_name: <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3817 }),
3818 }
3819 }
3820}
3821
3822pub struct PublisherRequestStream {
3824 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3825 is_terminated: bool,
3826}
3827
3828impl std::marker::Unpin for PublisherRequestStream {}
3829
3830impl futures::stream::FusedStream for PublisherRequestStream {
3831 fn is_terminated(&self) -> bool {
3832 self.is_terminated
3833 }
3834}
3835
3836impl fidl::endpoints::RequestStream for PublisherRequestStream {
3837 type Protocol = PublisherMarker;
3838 type ControlHandle = PublisherControlHandle;
3839
3840 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3841 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3842 }
3843
3844 fn control_handle(&self) -> Self::ControlHandle {
3845 PublisherControlHandle { inner: self.inner.clone() }
3846 }
3847
3848 fn into_inner(
3849 self,
3850 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3851 {
3852 (self.inner, self.is_terminated)
3853 }
3854
3855 fn from_inner(
3856 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3857 is_terminated: bool,
3858 ) -> Self {
3859 Self { inner, is_terminated }
3860 }
3861}
3862
3863impl futures::Stream for PublisherRequestStream {
3864 type Item = Result<PublisherRequest, fidl::Error>;
3865
3866 fn poll_next(
3867 mut self: std::pin::Pin<&mut Self>,
3868 cx: &mut std::task::Context<'_>,
3869 ) -> std::task::Poll<Option<Self::Item>> {
3870 let this = &mut *self;
3871 if this.inner.check_shutdown(cx) {
3872 this.is_terminated = true;
3873 return std::task::Poll::Ready(None);
3874 }
3875 if this.is_terminated {
3876 panic!("polled PublisherRequestStream after completion");
3877 }
3878 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3879 |bytes, handles| {
3880 match this.inner.channel().read_etc(cx, bytes, handles) {
3881 std::task::Poll::Ready(Ok(())) => {}
3882 std::task::Poll::Pending => return std::task::Poll::Pending,
3883 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3884 this.is_terminated = true;
3885 return std::task::Poll::Ready(None);
3886 }
3887 std::task::Poll::Ready(Err(e)) => {
3888 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3889 e.into(),
3890 ))));
3891 }
3892 }
3893
3894 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3896
3897 std::task::Poll::Ready(Some(match header.ordinal {
3898 0x2e4a501ede5a1ad3 => {
3899 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3900 let mut req = fidl::new_empty!(
3901 PublisherPublishRequest,
3902 fidl::encoding::DefaultFuchsiaResourceDialect
3903 );
3904 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublisherPublishRequest>(&header, _body_bytes, handles, &mut req)?;
3905 let control_handle = PublisherControlHandle { inner: this.inner.clone() };
3906 Ok(PublisherRequest::Publish {
3907 player: req.player,
3908 registration: req.registration,
3909
3910 responder: PublisherPublishResponder {
3911 control_handle: std::mem::ManuallyDrop::new(control_handle),
3912 tx_id: header.tx_id,
3913 },
3914 })
3915 }
3916 _ => Err(fidl::Error::UnknownOrdinal {
3917 ordinal: header.ordinal,
3918 protocol_name:
3919 <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3920 }),
3921 }))
3922 },
3923 )
3924 }
3925}
3926
3927#[derive(Debug)]
3930pub enum PublisherRequest {
3931 Publish {
3932 player: fidl::endpoints::ClientEnd<PlayerMarker>,
3933 registration: PlayerRegistration,
3934 responder: PublisherPublishResponder,
3935 },
3936}
3937
3938impl PublisherRequest {
3939 #[allow(irrefutable_let_patterns)]
3940 pub fn into_publish(
3941 self,
3942 ) -> Option<(
3943 fidl::endpoints::ClientEnd<PlayerMarker>,
3944 PlayerRegistration,
3945 PublisherPublishResponder,
3946 )> {
3947 if let PublisherRequest::Publish { player, registration, responder } = self {
3948 Some((player, registration, responder))
3949 } else {
3950 None
3951 }
3952 }
3953
3954 pub fn method_name(&self) -> &'static str {
3956 match *self {
3957 PublisherRequest::Publish { .. } => "publish",
3958 }
3959 }
3960}
3961
3962#[derive(Debug, Clone)]
3963pub struct PublisherControlHandle {
3964 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3965}
3966
3967impl fidl::endpoints::ControlHandle for PublisherControlHandle {
3968 fn shutdown(&self) {
3969 self.inner.shutdown()
3970 }
3971
3972 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3973 self.inner.shutdown_with_epitaph(status)
3974 }
3975
3976 fn is_closed(&self) -> bool {
3977 self.inner.channel().is_closed()
3978 }
3979 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3980 self.inner.channel().on_closed()
3981 }
3982
3983 #[cfg(target_os = "fuchsia")]
3984 fn signal_peer(
3985 &self,
3986 clear_mask: zx::Signals,
3987 set_mask: zx::Signals,
3988 ) -> Result<(), zx_status::Status> {
3989 use fidl::Peered;
3990 self.inner.channel().signal_peer(clear_mask, set_mask)
3991 }
3992}
3993
3994impl PublisherControlHandle {}
3995
3996#[must_use = "FIDL methods require a response to be sent"]
3997#[derive(Debug)]
3998pub struct PublisherPublishResponder {
3999 control_handle: std::mem::ManuallyDrop<PublisherControlHandle>,
4000 tx_id: u32,
4001}
4002
4003impl std::ops::Drop for PublisherPublishResponder {
4007 fn drop(&mut self) {
4008 self.control_handle.shutdown();
4009 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4011 }
4012}
4013
4014impl fidl::endpoints::Responder for PublisherPublishResponder {
4015 type ControlHandle = PublisherControlHandle;
4016
4017 fn control_handle(&self) -> &PublisherControlHandle {
4018 &self.control_handle
4019 }
4020
4021 fn drop_without_shutdown(mut self) {
4022 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4024 std::mem::forget(self);
4026 }
4027}
4028
4029impl PublisherPublishResponder {
4030 pub fn send(self, mut session_id: u64) -> Result<(), fidl::Error> {
4034 let _result = self.send_raw(session_id);
4035 if _result.is_err() {
4036 self.control_handle.shutdown();
4037 }
4038 self.drop_without_shutdown();
4039 _result
4040 }
4041
4042 pub fn send_no_shutdown_on_err(self, mut session_id: u64) -> Result<(), fidl::Error> {
4044 let _result = self.send_raw(session_id);
4045 self.drop_without_shutdown();
4046 _result
4047 }
4048
4049 fn send_raw(&self, mut session_id: u64) -> Result<(), fidl::Error> {
4050 self.control_handle.inner.send::<PublisherPublishResponse>(
4051 (session_id,),
4052 self.tx_id,
4053 0x2e4a501ede5a1ad3,
4054 fidl::encoding::DynamicFlags::empty(),
4055 )
4056 }
4057}
4058
4059#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4060pub struct SessionControlMarker;
4061
4062impl fidl::endpoints::ProtocolMarker for SessionControlMarker {
4063 type Proxy = SessionControlProxy;
4064 type RequestStream = SessionControlRequestStream;
4065 #[cfg(target_os = "fuchsia")]
4066 type SynchronousProxy = SessionControlSynchronousProxy;
4067
4068 const DEBUG_NAME: &'static str = "(anonymous) SessionControl";
4069}
4070
4071pub trait SessionControlProxyInterface: Send + Sync {
4072 fn r#play(&self) -> Result<(), fidl::Error>;
4073 fn r#pause(&self) -> Result<(), fidl::Error>;
4074 fn r#stop(&self) -> Result<(), fidl::Error>;
4075 fn r#seek(&self, position: i64) -> Result<(), fidl::Error>;
4076 fn r#skip_forward(&self) -> Result<(), fidl::Error>;
4077 fn r#skip_reverse(&self) -> Result<(), fidl::Error>;
4078 fn r#next_item(&self) -> Result<(), fidl::Error>;
4079 fn r#prev_item(&self) -> Result<(), fidl::Error>;
4080 fn r#set_playback_rate(&self, playback_rate: f32) -> Result<(), fidl::Error>;
4081 fn r#set_repeat_mode(&self, repeat_mode: RepeatMode) -> Result<(), fidl::Error>;
4082 fn r#set_shuffle_mode(&self, shuffle_on: bool) -> Result<(), fidl::Error>;
4083 fn r#bind_volume_control(
4084 &self,
4085 volume_control_request: fidl::endpoints::ServerEnd<
4086 fidl_fuchsia_media_audio::VolumeControlMarker,
4087 >,
4088 ) -> Result<(), fidl::Error>;
4089 type WatchStatusResponseFut: std::future::Future<Output = Result<SessionInfoDelta, fidl::Error>>
4090 + Send;
4091 fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
4092}
4093#[derive(Debug)]
4094#[cfg(target_os = "fuchsia")]
4095pub struct SessionControlSynchronousProxy {
4096 client: fidl::client::sync::Client,
4097}
4098
4099#[cfg(target_os = "fuchsia")]
4100impl fidl::endpoints::SynchronousProxy for SessionControlSynchronousProxy {
4101 type Proxy = SessionControlProxy;
4102 type Protocol = SessionControlMarker;
4103
4104 fn from_channel(inner: fidl::Channel) -> Self {
4105 Self::new(inner)
4106 }
4107
4108 fn into_channel(self) -> fidl::Channel {
4109 self.client.into_channel()
4110 }
4111
4112 fn as_channel(&self) -> &fidl::Channel {
4113 self.client.as_channel()
4114 }
4115}
4116
4117#[cfg(target_os = "fuchsia")]
4118impl SessionControlSynchronousProxy {
4119 pub fn new(channel: fidl::Channel) -> Self {
4120 Self { client: fidl::client::sync::Client::new(channel) }
4121 }
4122
4123 pub fn into_channel(self) -> fidl::Channel {
4124 self.client.into_channel()
4125 }
4126
4127 pub fn wait_for_event(
4130 &self,
4131 deadline: zx::MonotonicInstant,
4132 ) -> Result<SessionControlEvent, fidl::Error> {
4133 SessionControlEvent::decode(self.client.wait_for_event::<SessionControlMarker>(deadline)?)
4134 }
4135
4136 pub fn r#play(&self) -> Result<(), fidl::Error> {
4138 self.client.send::<fidl::encoding::EmptyPayload>(
4139 (),
4140 0x43c91c558f7b2946,
4141 fidl::encoding::DynamicFlags::empty(),
4142 )
4143 }
4144
4145 pub fn r#pause(&self) -> Result<(), fidl::Error> {
4147 self.client.send::<fidl::encoding::EmptyPayload>(
4148 (),
4149 0x4e2d75c91ff7d22d,
4150 fidl::encoding::DynamicFlags::empty(),
4151 )
4152 }
4153
4154 pub fn r#stop(&self) -> Result<(), fidl::Error> {
4156 self.client.send::<fidl::encoding::EmptyPayload>(
4157 (),
4158 0x53da6661beb2e817,
4159 fidl::encoding::DynamicFlags::empty(),
4160 )
4161 }
4162
4163 pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
4167 self.client.send::<SessionControlSeekRequest>(
4168 (position,),
4169 0x380280556aba53d4,
4170 fidl::encoding::DynamicFlags::empty(),
4171 )
4172 }
4173
4174 pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
4176 self.client.send::<fidl::encoding::EmptyPayload>(
4177 (),
4178 0x3674bb00f0f12079,
4179 fidl::encoding::DynamicFlags::empty(),
4180 )
4181 }
4182
4183 pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
4185 self.client.send::<fidl::encoding::EmptyPayload>(
4186 (),
4187 0x5edc786c1a6b087c,
4188 fidl::encoding::DynamicFlags::empty(),
4189 )
4190 }
4191
4192 pub fn r#next_item(&self) -> Result<(), fidl::Error> {
4194 self.client.send::<fidl::encoding::EmptyPayload>(
4195 (),
4196 0x13cab0e8bc316138,
4197 fidl::encoding::DynamicFlags::empty(),
4198 )
4199 }
4200
4201 pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
4203 self.client.send::<fidl::encoding::EmptyPayload>(
4204 (),
4205 0x7f7150e8bd6082cc,
4206 fidl::encoding::DynamicFlags::empty(),
4207 )
4208 }
4209
4210 pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
4213 self.client.send::<SessionControlSetPlaybackRateRequest>(
4214 (playback_rate,),
4215 0x3e382e2b70c5121d,
4216 fidl::encoding::DynamicFlags::empty(),
4217 )
4218 }
4219
4220 pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
4222 self.client.send::<SessionControlSetRepeatModeRequest>(
4223 (repeat_mode,),
4224 0x29381bedf7f29e5,
4225 fidl::encoding::DynamicFlags::empty(),
4226 )
4227 }
4228
4229 pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
4231 self.client.send::<SessionControlSetShuffleModeRequest>(
4232 (shuffle_on,),
4233 0x34d8d4c0f35e89e,
4234 fidl::encoding::DynamicFlags::empty(),
4235 )
4236 }
4237
4238 pub fn r#bind_volume_control(
4240 &self,
4241 mut volume_control_request: fidl::endpoints::ServerEnd<
4242 fidl_fuchsia_media_audio::VolumeControlMarker,
4243 >,
4244 ) -> Result<(), fidl::Error> {
4245 self.client.send::<SessionControlBindVolumeControlRequest>(
4246 (volume_control_request,),
4247 0x1e3c091a08e88710,
4248 fidl::encoding::DynamicFlags::empty(),
4249 )
4250 }
4251
4252 pub fn r#watch_status(
4256 &self,
4257 ___deadline: zx::MonotonicInstant,
4258 ) -> Result<SessionInfoDelta, fidl::Error> {
4259 let _response = self.client.send_query::<
4260 fidl::encoding::EmptyPayload,
4261 SessionControlWatchStatusResponse,
4262 SessionControlMarker,
4263 >(
4264 (),
4265 0x4ce5727251eb4b74,
4266 fidl::encoding::DynamicFlags::empty(),
4267 ___deadline,
4268 )?;
4269 Ok(_response.session_info_delta)
4270 }
4271}
4272
4273#[cfg(target_os = "fuchsia")]
4274impl From<SessionControlSynchronousProxy> for zx::NullableHandle {
4275 fn from(value: SessionControlSynchronousProxy) -> Self {
4276 value.into_channel().into()
4277 }
4278}
4279
4280#[cfg(target_os = "fuchsia")]
4281impl From<fidl::Channel> for SessionControlSynchronousProxy {
4282 fn from(value: fidl::Channel) -> Self {
4283 Self::new(value)
4284 }
4285}
4286
4287#[cfg(target_os = "fuchsia")]
4288impl fidl::endpoints::FromClient for SessionControlSynchronousProxy {
4289 type Protocol = SessionControlMarker;
4290
4291 fn from_client(value: fidl::endpoints::ClientEnd<SessionControlMarker>) -> Self {
4292 Self::new(value.into_channel())
4293 }
4294}
4295
4296#[derive(Debug, Clone)]
4297pub struct SessionControlProxy {
4298 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4299}
4300
4301impl fidl::endpoints::Proxy for SessionControlProxy {
4302 type Protocol = SessionControlMarker;
4303
4304 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4305 Self::new(inner)
4306 }
4307
4308 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4309 self.client.into_channel().map_err(|client| Self { client })
4310 }
4311
4312 fn as_channel(&self) -> &::fidl::AsyncChannel {
4313 self.client.as_channel()
4314 }
4315}
4316
4317impl SessionControlProxy {
4318 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4320 let protocol_name = <SessionControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4321 Self { client: fidl::client::Client::new(channel, protocol_name) }
4322 }
4323
4324 pub fn take_event_stream(&self) -> SessionControlEventStream {
4330 SessionControlEventStream { event_receiver: self.client.take_event_receiver() }
4331 }
4332
4333 pub fn r#play(&self) -> Result<(), fidl::Error> {
4335 SessionControlProxyInterface::r#play(self)
4336 }
4337
4338 pub fn r#pause(&self) -> Result<(), fidl::Error> {
4340 SessionControlProxyInterface::r#pause(self)
4341 }
4342
4343 pub fn r#stop(&self) -> Result<(), fidl::Error> {
4345 SessionControlProxyInterface::r#stop(self)
4346 }
4347
4348 pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
4352 SessionControlProxyInterface::r#seek(self, position)
4353 }
4354
4355 pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
4357 SessionControlProxyInterface::r#skip_forward(self)
4358 }
4359
4360 pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
4362 SessionControlProxyInterface::r#skip_reverse(self)
4363 }
4364
4365 pub fn r#next_item(&self) -> Result<(), fidl::Error> {
4367 SessionControlProxyInterface::r#next_item(self)
4368 }
4369
4370 pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
4372 SessionControlProxyInterface::r#prev_item(self)
4373 }
4374
4375 pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
4378 SessionControlProxyInterface::r#set_playback_rate(self, playback_rate)
4379 }
4380
4381 pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
4383 SessionControlProxyInterface::r#set_repeat_mode(self, repeat_mode)
4384 }
4385
4386 pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
4388 SessionControlProxyInterface::r#set_shuffle_mode(self, shuffle_on)
4389 }
4390
4391 pub fn r#bind_volume_control(
4393 &self,
4394 mut volume_control_request: fidl::endpoints::ServerEnd<
4395 fidl_fuchsia_media_audio::VolumeControlMarker,
4396 >,
4397 ) -> Result<(), fidl::Error> {
4398 SessionControlProxyInterface::r#bind_volume_control(self, volume_control_request)
4399 }
4400
4401 pub fn r#watch_status(
4405 &self,
4406 ) -> fidl::client::QueryResponseFut<
4407 SessionInfoDelta,
4408 fidl::encoding::DefaultFuchsiaResourceDialect,
4409 > {
4410 SessionControlProxyInterface::r#watch_status(self)
4411 }
4412}
4413
4414impl SessionControlProxyInterface for SessionControlProxy {
4415 fn r#play(&self) -> Result<(), fidl::Error> {
4416 self.client.send::<fidl::encoding::EmptyPayload>(
4417 (),
4418 0x43c91c558f7b2946,
4419 fidl::encoding::DynamicFlags::empty(),
4420 )
4421 }
4422
4423 fn r#pause(&self) -> Result<(), fidl::Error> {
4424 self.client.send::<fidl::encoding::EmptyPayload>(
4425 (),
4426 0x4e2d75c91ff7d22d,
4427 fidl::encoding::DynamicFlags::empty(),
4428 )
4429 }
4430
4431 fn r#stop(&self) -> Result<(), fidl::Error> {
4432 self.client.send::<fidl::encoding::EmptyPayload>(
4433 (),
4434 0x53da6661beb2e817,
4435 fidl::encoding::DynamicFlags::empty(),
4436 )
4437 }
4438
4439 fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
4440 self.client.send::<SessionControlSeekRequest>(
4441 (position,),
4442 0x380280556aba53d4,
4443 fidl::encoding::DynamicFlags::empty(),
4444 )
4445 }
4446
4447 fn r#skip_forward(&self) -> Result<(), fidl::Error> {
4448 self.client.send::<fidl::encoding::EmptyPayload>(
4449 (),
4450 0x3674bb00f0f12079,
4451 fidl::encoding::DynamicFlags::empty(),
4452 )
4453 }
4454
4455 fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
4456 self.client.send::<fidl::encoding::EmptyPayload>(
4457 (),
4458 0x5edc786c1a6b087c,
4459 fidl::encoding::DynamicFlags::empty(),
4460 )
4461 }
4462
4463 fn r#next_item(&self) -> Result<(), fidl::Error> {
4464 self.client.send::<fidl::encoding::EmptyPayload>(
4465 (),
4466 0x13cab0e8bc316138,
4467 fidl::encoding::DynamicFlags::empty(),
4468 )
4469 }
4470
4471 fn r#prev_item(&self) -> Result<(), fidl::Error> {
4472 self.client.send::<fidl::encoding::EmptyPayload>(
4473 (),
4474 0x7f7150e8bd6082cc,
4475 fidl::encoding::DynamicFlags::empty(),
4476 )
4477 }
4478
4479 fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
4480 self.client.send::<SessionControlSetPlaybackRateRequest>(
4481 (playback_rate,),
4482 0x3e382e2b70c5121d,
4483 fidl::encoding::DynamicFlags::empty(),
4484 )
4485 }
4486
4487 fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
4488 self.client.send::<SessionControlSetRepeatModeRequest>(
4489 (repeat_mode,),
4490 0x29381bedf7f29e5,
4491 fidl::encoding::DynamicFlags::empty(),
4492 )
4493 }
4494
4495 fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
4496 self.client.send::<SessionControlSetShuffleModeRequest>(
4497 (shuffle_on,),
4498 0x34d8d4c0f35e89e,
4499 fidl::encoding::DynamicFlags::empty(),
4500 )
4501 }
4502
4503 fn r#bind_volume_control(
4504 &self,
4505 mut volume_control_request: fidl::endpoints::ServerEnd<
4506 fidl_fuchsia_media_audio::VolumeControlMarker,
4507 >,
4508 ) -> Result<(), fidl::Error> {
4509 self.client.send::<SessionControlBindVolumeControlRequest>(
4510 (volume_control_request,),
4511 0x1e3c091a08e88710,
4512 fidl::encoding::DynamicFlags::empty(),
4513 )
4514 }
4515
4516 type WatchStatusResponseFut = fidl::client::QueryResponseFut<
4517 SessionInfoDelta,
4518 fidl::encoding::DefaultFuchsiaResourceDialect,
4519 >;
4520 fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
4521 fn _decode(
4522 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4523 ) -> Result<SessionInfoDelta, fidl::Error> {
4524 let _response = fidl::client::decode_transaction_body::<
4525 SessionControlWatchStatusResponse,
4526 fidl::encoding::DefaultFuchsiaResourceDialect,
4527 0x4ce5727251eb4b74,
4528 >(_buf?)?;
4529 Ok(_response.session_info_delta)
4530 }
4531 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionInfoDelta>(
4532 (),
4533 0x4ce5727251eb4b74,
4534 fidl::encoding::DynamicFlags::empty(),
4535 _decode,
4536 )
4537 }
4538}
4539
4540pub struct SessionControlEventStream {
4541 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4542}
4543
4544impl std::marker::Unpin for SessionControlEventStream {}
4545
4546impl futures::stream::FusedStream for SessionControlEventStream {
4547 fn is_terminated(&self) -> bool {
4548 self.event_receiver.is_terminated()
4549 }
4550}
4551
4552impl futures::Stream for SessionControlEventStream {
4553 type Item = Result<SessionControlEvent, fidl::Error>;
4554
4555 fn poll_next(
4556 mut self: std::pin::Pin<&mut Self>,
4557 cx: &mut std::task::Context<'_>,
4558 ) -> std::task::Poll<Option<Self::Item>> {
4559 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4560 &mut self.event_receiver,
4561 cx
4562 )?) {
4563 Some(buf) => std::task::Poll::Ready(Some(SessionControlEvent::decode(buf))),
4564 None => std::task::Poll::Ready(None),
4565 }
4566 }
4567}
4568
4569#[derive(Debug)]
4570pub enum SessionControlEvent {}
4571
4572impl SessionControlEvent {
4573 fn decode(
4575 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4576 ) -> Result<SessionControlEvent, fidl::Error> {
4577 let (bytes, _handles) = buf.split_mut();
4578 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4579 debug_assert_eq!(tx_header.tx_id, 0);
4580 match tx_header.ordinal {
4581 _ => Err(fidl::Error::UnknownOrdinal {
4582 ordinal: tx_header.ordinal,
4583 protocol_name:
4584 <SessionControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4585 }),
4586 }
4587 }
4588}
4589
4590pub struct SessionControlRequestStream {
4592 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4593 is_terminated: bool,
4594}
4595
4596impl std::marker::Unpin for SessionControlRequestStream {}
4597
4598impl futures::stream::FusedStream for SessionControlRequestStream {
4599 fn is_terminated(&self) -> bool {
4600 self.is_terminated
4601 }
4602}
4603
4604impl fidl::endpoints::RequestStream for SessionControlRequestStream {
4605 type Protocol = SessionControlMarker;
4606 type ControlHandle = SessionControlControlHandle;
4607
4608 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4609 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4610 }
4611
4612 fn control_handle(&self) -> Self::ControlHandle {
4613 SessionControlControlHandle { inner: self.inner.clone() }
4614 }
4615
4616 fn into_inner(
4617 self,
4618 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4619 {
4620 (self.inner, self.is_terminated)
4621 }
4622
4623 fn from_inner(
4624 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4625 is_terminated: bool,
4626 ) -> Self {
4627 Self { inner, is_terminated }
4628 }
4629}
4630
4631impl futures::Stream for SessionControlRequestStream {
4632 type Item = Result<SessionControlRequest, fidl::Error>;
4633
4634 fn poll_next(
4635 mut self: std::pin::Pin<&mut Self>,
4636 cx: &mut std::task::Context<'_>,
4637 ) -> std::task::Poll<Option<Self::Item>> {
4638 let this = &mut *self;
4639 if this.inner.check_shutdown(cx) {
4640 this.is_terminated = true;
4641 return std::task::Poll::Ready(None);
4642 }
4643 if this.is_terminated {
4644 panic!("polled SessionControlRequestStream after completion");
4645 }
4646 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4647 |bytes, handles| {
4648 match this.inner.channel().read_etc(cx, bytes, handles) {
4649 std::task::Poll::Ready(Ok(())) => {}
4650 std::task::Poll::Pending => return std::task::Poll::Pending,
4651 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4652 this.is_terminated = true;
4653 return std::task::Poll::Ready(None);
4654 }
4655 std::task::Poll::Ready(Err(e)) => {
4656 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4657 e.into(),
4658 ))));
4659 }
4660 }
4661
4662 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4664
4665 std::task::Poll::Ready(Some(match header.ordinal {
4666 0x43c91c558f7b2946 => {
4667 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4668 let mut req = fidl::new_empty!(
4669 fidl::encoding::EmptyPayload,
4670 fidl::encoding::DefaultFuchsiaResourceDialect
4671 );
4672 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4673 let control_handle =
4674 SessionControlControlHandle { inner: this.inner.clone() };
4675 Ok(SessionControlRequest::Play { control_handle })
4676 }
4677 0x4e2d75c91ff7d22d => {
4678 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4679 let mut req = fidl::new_empty!(
4680 fidl::encoding::EmptyPayload,
4681 fidl::encoding::DefaultFuchsiaResourceDialect
4682 );
4683 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4684 let control_handle =
4685 SessionControlControlHandle { inner: this.inner.clone() };
4686 Ok(SessionControlRequest::Pause { control_handle })
4687 }
4688 0x53da6661beb2e817 => {
4689 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4690 let mut req = fidl::new_empty!(
4691 fidl::encoding::EmptyPayload,
4692 fidl::encoding::DefaultFuchsiaResourceDialect
4693 );
4694 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4695 let control_handle =
4696 SessionControlControlHandle { inner: this.inner.clone() };
4697 Ok(SessionControlRequest::Stop { control_handle })
4698 }
4699 0x380280556aba53d4 => {
4700 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4701 let mut req = fidl::new_empty!(
4702 SessionControlSeekRequest,
4703 fidl::encoding::DefaultFuchsiaResourceDialect
4704 );
4705 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlSeekRequest>(&header, _body_bytes, handles, &mut req)?;
4706 let control_handle =
4707 SessionControlControlHandle { inner: this.inner.clone() };
4708 Ok(SessionControlRequest::Seek { position: req.position, control_handle })
4709 }
4710 0x3674bb00f0f12079 => {
4711 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4712 let mut req = fidl::new_empty!(
4713 fidl::encoding::EmptyPayload,
4714 fidl::encoding::DefaultFuchsiaResourceDialect
4715 );
4716 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4717 let control_handle =
4718 SessionControlControlHandle { inner: this.inner.clone() };
4719 Ok(SessionControlRequest::SkipForward { control_handle })
4720 }
4721 0x5edc786c1a6b087c => {
4722 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4723 let mut req = fidl::new_empty!(
4724 fidl::encoding::EmptyPayload,
4725 fidl::encoding::DefaultFuchsiaResourceDialect
4726 );
4727 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4728 let control_handle =
4729 SessionControlControlHandle { inner: this.inner.clone() };
4730 Ok(SessionControlRequest::SkipReverse { control_handle })
4731 }
4732 0x13cab0e8bc316138 => {
4733 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4734 let mut req = fidl::new_empty!(
4735 fidl::encoding::EmptyPayload,
4736 fidl::encoding::DefaultFuchsiaResourceDialect
4737 );
4738 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4739 let control_handle =
4740 SessionControlControlHandle { inner: this.inner.clone() };
4741 Ok(SessionControlRequest::NextItem { control_handle })
4742 }
4743 0x7f7150e8bd6082cc => {
4744 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4745 let mut req = fidl::new_empty!(
4746 fidl::encoding::EmptyPayload,
4747 fidl::encoding::DefaultFuchsiaResourceDialect
4748 );
4749 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4750 let control_handle =
4751 SessionControlControlHandle { inner: this.inner.clone() };
4752 Ok(SessionControlRequest::PrevItem { control_handle })
4753 }
4754 0x3e382e2b70c5121d => {
4755 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4756 let mut req = fidl::new_empty!(
4757 SessionControlSetPlaybackRateRequest,
4758 fidl::encoding::DefaultFuchsiaResourceDialect
4759 );
4760 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlSetPlaybackRateRequest>(&header, _body_bytes, handles, &mut req)?;
4761 let control_handle =
4762 SessionControlControlHandle { inner: this.inner.clone() };
4763 Ok(SessionControlRequest::SetPlaybackRate {
4764 playback_rate: req.playback_rate,
4765
4766 control_handle,
4767 })
4768 }
4769 0x29381bedf7f29e5 => {
4770 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4771 let mut req = fidl::new_empty!(
4772 SessionControlSetRepeatModeRequest,
4773 fidl::encoding::DefaultFuchsiaResourceDialect
4774 );
4775 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlSetRepeatModeRequest>(&header, _body_bytes, handles, &mut req)?;
4776 let control_handle =
4777 SessionControlControlHandle { inner: this.inner.clone() };
4778 Ok(SessionControlRequest::SetRepeatMode {
4779 repeat_mode: req.repeat_mode,
4780
4781 control_handle,
4782 })
4783 }
4784 0x34d8d4c0f35e89e => {
4785 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4786 let mut req = fidl::new_empty!(
4787 SessionControlSetShuffleModeRequest,
4788 fidl::encoding::DefaultFuchsiaResourceDialect
4789 );
4790 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlSetShuffleModeRequest>(&header, _body_bytes, handles, &mut req)?;
4791 let control_handle =
4792 SessionControlControlHandle { inner: this.inner.clone() };
4793 Ok(SessionControlRequest::SetShuffleMode {
4794 shuffle_on: req.shuffle_on,
4795
4796 control_handle,
4797 })
4798 }
4799 0x1e3c091a08e88710 => {
4800 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4801 let mut req = fidl::new_empty!(
4802 SessionControlBindVolumeControlRequest,
4803 fidl::encoding::DefaultFuchsiaResourceDialect
4804 );
4805 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlBindVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
4806 let control_handle =
4807 SessionControlControlHandle { inner: this.inner.clone() };
4808 Ok(SessionControlRequest::BindVolumeControl {
4809 volume_control_request: req.volume_control_request,
4810
4811 control_handle,
4812 })
4813 }
4814 0x4ce5727251eb4b74 => {
4815 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4816 let mut req = fidl::new_empty!(
4817 fidl::encoding::EmptyPayload,
4818 fidl::encoding::DefaultFuchsiaResourceDialect
4819 );
4820 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4821 let control_handle =
4822 SessionControlControlHandle { inner: this.inner.clone() };
4823 Ok(SessionControlRequest::WatchStatus {
4824 responder: SessionControlWatchStatusResponder {
4825 control_handle: std::mem::ManuallyDrop::new(control_handle),
4826 tx_id: header.tx_id,
4827 },
4828 })
4829 }
4830 _ => Err(fidl::Error::UnknownOrdinal {
4831 ordinal: header.ordinal,
4832 protocol_name:
4833 <SessionControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4834 }),
4835 }))
4836 },
4837 )
4838 }
4839}
4840
4841#[derive(Debug)]
4845pub enum SessionControlRequest {
4846 Play { control_handle: SessionControlControlHandle },
4848 Pause { control_handle: SessionControlControlHandle },
4850 Stop { control_handle: SessionControlControlHandle },
4852 Seek { position: i64, control_handle: SessionControlControlHandle },
4856 SkipForward { control_handle: SessionControlControlHandle },
4858 SkipReverse { control_handle: SessionControlControlHandle },
4860 NextItem { control_handle: SessionControlControlHandle },
4862 PrevItem { control_handle: SessionControlControlHandle },
4864 SetPlaybackRate { playback_rate: f32, control_handle: SessionControlControlHandle },
4867 SetRepeatMode { repeat_mode: RepeatMode, control_handle: SessionControlControlHandle },
4869 SetShuffleMode { shuffle_on: bool, control_handle: SessionControlControlHandle },
4871 BindVolumeControl {
4873 volume_control_request:
4874 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
4875 control_handle: SessionControlControlHandle,
4876 },
4877 WatchStatus { responder: SessionControlWatchStatusResponder },
4881}
4882
4883impl SessionControlRequest {
4884 #[allow(irrefutable_let_patterns)]
4885 pub fn into_play(self) -> Option<(SessionControlControlHandle)> {
4886 if let SessionControlRequest::Play { control_handle } = self {
4887 Some((control_handle))
4888 } else {
4889 None
4890 }
4891 }
4892
4893 #[allow(irrefutable_let_patterns)]
4894 pub fn into_pause(self) -> Option<(SessionControlControlHandle)> {
4895 if let SessionControlRequest::Pause { control_handle } = self {
4896 Some((control_handle))
4897 } else {
4898 None
4899 }
4900 }
4901
4902 #[allow(irrefutable_let_patterns)]
4903 pub fn into_stop(self) -> Option<(SessionControlControlHandle)> {
4904 if let SessionControlRequest::Stop { control_handle } = self {
4905 Some((control_handle))
4906 } else {
4907 None
4908 }
4909 }
4910
4911 #[allow(irrefutable_let_patterns)]
4912 pub fn into_seek(self) -> Option<(i64, SessionControlControlHandle)> {
4913 if let SessionControlRequest::Seek { position, control_handle } = self {
4914 Some((position, control_handle))
4915 } else {
4916 None
4917 }
4918 }
4919
4920 #[allow(irrefutable_let_patterns)]
4921 pub fn into_skip_forward(self) -> Option<(SessionControlControlHandle)> {
4922 if let SessionControlRequest::SkipForward { control_handle } = self {
4923 Some((control_handle))
4924 } else {
4925 None
4926 }
4927 }
4928
4929 #[allow(irrefutable_let_patterns)]
4930 pub fn into_skip_reverse(self) -> Option<(SessionControlControlHandle)> {
4931 if let SessionControlRequest::SkipReverse { control_handle } = self {
4932 Some((control_handle))
4933 } else {
4934 None
4935 }
4936 }
4937
4938 #[allow(irrefutable_let_patterns)]
4939 pub fn into_next_item(self) -> Option<(SessionControlControlHandle)> {
4940 if let SessionControlRequest::NextItem { control_handle } = self {
4941 Some((control_handle))
4942 } else {
4943 None
4944 }
4945 }
4946
4947 #[allow(irrefutable_let_patterns)]
4948 pub fn into_prev_item(self) -> Option<(SessionControlControlHandle)> {
4949 if let SessionControlRequest::PrevItem { control_handle } = self {
4950 Some((control_handle))
4951 } else {
4952 None
4953 }
4954 }
4955
4956 #[allow(irrefutable_let_patterns)]
4957 pub fn into_set_playback_rate(self) -> Option<(f32, SessionControlControlHandle)> {
4958 if let SessionControlRequest::SetPlaybackRate { playback_rate, control_handle } = self {
4959 Some((playback_rate, control_handle))
4960 } else {
4961 None
4962 }
4963 }
4964
4965 #[allow(irrefutable_let_patterns)]
4966 pub fn into_set_repeat_mode(self) -> Option<(RepeatMode, SessionControlControlHandle)> {
4967 if let SessionControlRequest::SetRepeatMode { repeat_mode, control_handle } = self {
4968 Some((repeat_mode, control_handle))
4969 } else {
4970 None
4971 }
4972 }
4973
4974 #[allow(irrefutable_let_patterns)]
4975 pub fn into_set_shuffle_mode(self) -> Option<(bool, SessionControlControlHandle)> {
4976 if let SessionControlRequest::SetShuffleMode { shuffle_on, control_handle } = self {
4977 Some((shuffle_on, control_handle))
4978 } else {
4979 None
4980 }
4981 }
4982
4983 #[allow(irrefutable_let_patterns)]
4984 pub fn into_bind_volume_control(
4985 self,
4986 ) -> Option<(
4987 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
4988 SessionControlControlHandle,
4989 )> {
4990 if let SessionControlRequest::BindVolumeControl { volume_control_request, control_handle } =
4991 self
4992 {
4993 Some((volume_control_request, control_handle))
4994 } else {
4995 None
4996 }
4997 }
4998
4999 #[allow(irrefutable_let_patterns)]
5000 pub fn into_watch_status(self) -> Option<(SessionControlWatchStatusResponder)> {
5001 if let SessionControlRequest::WatchStatus { responder } = self {
5002 Some((responder))
5003 } else {
5004 None
5005 }
5006 }
5007
5008 pub fn method_name(&self) -> &'static str {
5010 match *self {
5011 SessionControlRequest::Play { .. } => "play",
5012 SessionControlRequest::Pause { .. } => "pause",
5013 SessionControlRequest::Stop { .. } => "stop",
5014 SessionControlRequest::Seek { .. } => "seek",
5015 SessionControlRequest::SkipForward { .. } => "skip_forward",
5016 SessionControlRequest::SkipReverse { .. } => "skip_reverse",
5017 SessionControlRequest::NextItem { .. } => "next_item",
5018 SessionControlRequest::PrevItem { .. } => "prev_item",
5019 SessionControlRequest::SetPlaybackRate { .. } => "set_playback_rate",
5020 SessionControlRequest::SetRepeatMode { .. } => "set_repeat_mode",
5021 SessionControlRequest::SetShuffleMode { .. } => "set_shuffle_mode",
5022 SessionControlRequest::BindVolumeControl { .. } => "bind_volume_control",
5023 SessionControlRequest::WatchStatus { .. } => "watch_status",
5024 }
5025 }
5026}
5027
5028#[derive(Debug, Clone)]
5029pub struct SessionControlControlHandle {
5030 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5031}
5032
5033impl fidl::endpoints::ControlHandle for SessionControlControlHandle {
5034 fn shutdown(&self) {
5035 self.inner.shutdown()
5036 }
5037
5038 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5039 self.inner.shutdown_with_epitaph(status)
5040 }
5041
5042 fn is_closed(&self) -> bool {
5043 self.inner.channel().is_closed()
5044 }
5045 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5046 self.inner.channel().on_closed()
5047 }
5048
5049 #[cfg(target_os = "fuchsia")]
5050 fn signal_peer(
5051 &self,
5052 clear_mask: zx::Signals,
5053 set_mask: zx::Signals,
5054 ) -> Result<(), zx_status::Status> {
5055 use fidl::Peered;
5056 self.inner.channel().signal_peer(clear_mask, set_mask)
5057 }
5058}
5059
5060impl SessionControlControlHandle {}
5061
5062#[must_use = "FIDL methods require a response to be sent"]
5063#[derive(Debug)]
5064pub struct SessionControlWatchStatusResponder {
5065 control_handle: std::mem::ManuallyDrop<SessionControlControlHandle>,
5066 tx_id: u32,
5067}
5068
5069impl std::ops::Drop for SessionControlWatchStatusResponder {
5073 fn drop(&mut self) {
5074 self.control_handle.shutdown();
5075 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5077 }
5078}
5079
5080impl fidl::endpoints::Responder for SessionControlWatchStatusResponder {
5081 type ControlHandle = SessionControlControlHandle;
5082
5083 fn control_handle(&self) -> &SessionControlControlHandle {
5084 &self.control_handle
5085 }
5086
5087 fn drop_without_shutdown(mut self) {
5088 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5090 std::mem::forget(self);
5092 }
5093}
5094
5095impl SessionControlWatchStatusResponder {
5096 pub fn send(self, mut session_info_delta: &SessionInfoDelta) -> Result<(), fidl::Error> {
5100 let _result = self.send_raw(session_info_delta);
5101 if _result.is_err() {
5102 self.control_handle.shutdown();
5103 }
5104 self.drop_without_shutdown();
5105 _result
5106 }
5107
5108 pub fn send_no_shutdown_on_err(
5110 self,
5111 mut session_info_delta: &SessionInfoDelta,
5112 ) -> Result<(), fidl::Error> {
5113 let _result = self.send_raw(session_info_delta);
5114 self.drop_without_shutdown();
5115 _result
5116 }
5117
5118 fn send_raw(&self, mut session_info_delta: &SessionInfoDelta) -> Result<(), fidl::Error> {
5119 self.control_handle.inner.send::<SessionControlWatchStatusResponse>(
5120 (session_info_delta,),
5121 self.tx_id,
5122 0x4ce5727251eb4b74,
5123 fidl::encoding::DynamicFlags::empty(),
5124 )
5125 }
5126}
5127
5128#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5129pub struct SessionObserverMarker;
5130
5131impl fidl::endpoints::ProtocolMarker for SessionObserverMarker {
5132 type Proxy = SessionObserverProxy;
5133 type RequestStream = SessionObserverRequestStream;
5134 #[cfg(target_os = "fuchsia")]
5135 type SynchronousProxy = SessionObserverSynchronousProxy;
5136
5137 const DEBUG_NAME: &'static str = "(anonymous) SessionObserver";
5138}
5139
5140pub trait SessionObserverProxyInterface: Send + Sync {
5141 type WatchStatusResponseFut: std::future::Future<Output = Result<SessionInfoDelta, fidl::Error>>
5142 + Send;
5143 fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
5144}
5145#[derive(Debug)]
5146#[cfg(target_os = "fuchsia")]
5147pub struct SessionObserverSynchronousProxy {
5148 client: fidl::client::sync::Client,
5149}
5150
5151#[cfg(target_os = "fuchsia")]
5152impl fidl::endpoints::SynchronousProxy for SessionObserverSynchronousProxy {
5153 type Proxy = SessionObserverProxy;
5154 type Protocol = SessionObserverMarker;
5155
5156 fn from_channel(inner: fidl::Channel) -> Self {
5157 Self::new(inner)
5158 }
5159
5160 fn into_channel(self) -> fidl::Channel {
5161 self.client.into_channel()
5162 }
5163
5164 fn as_channel(&self) -> &fidl::Channel {
5165 self.client.as_channel()
5166 }
5167}
5168
5169#[cfg(target_os = "fuchsia")]
5170impl SessionObserverSynchronousProxy {
5171 pub fn new(channel: fidl::Channel) -> Self {
5172 Self { client: fidl::client::sync::Client::new(channel) }
5173 }
5174
5175 pub fn into_channel(self) -> fidl::Channel {
5176 self.client.into_channel()
5177 }
5178
5179 pub fn wait_for_event(
5182 &self,
5183 deadline: zx::MonotonicInstant,
5184 ) -> Result<SessionObserverEvent, fidl::Error> {
5185 SessionObserverEvent::decode(self.client.wait_for_event::<SessionObserverMarker>(deadline)?)
5186 }
5187
5188 pub fn r#watch_status(
5192 &self,
5193 ___deadline: zx::MonotonicInstant,
5194 ) -> Result<SessionInfoDelta, fidl::Error> {
5195 let _response = self.client.send_query::<
5196 fidl::encoding::EmptyPayload,
5197 SessionObserverWatchStatusResponse,
5198 SessionObserverMarker,
5199 >(
5200 (),
5201 0x24618b709ca18f4d,
5202 fidl::encoding::DynamicFlags::empty(),
5203 ___deadline,
5204 )?;
5205 Ok(_response.session_info_delta)
5206 }
5207}
5208
5209#[cfg(target_os = "fuchsia")]
5210impl From<SessionObserverSynchronousProxy> for zx::NullableHandle {
5211 fn from(value: SessionObserverSynchronousProxy) -> Self {
5212 value.into_channel().into()
5213 }
5214}
5215
5216#[cfg(target_os = "fuchsia")]
5217impl From<fidl::Channel> for SessionObserverSynchronousProxy {
5218 fn from(value: fidl::Channel) -> Self {
5219 Self::new(value)
5220 }
5221}
5222
5223#[cfg(target_os = "fuchsia")]
5224impl fidl::endpoints::FromClient for SessionObserverSynchronousProxy {
5225 type Protocol = SessionObserverMarker;
5226
5227 fn from_client(value: fidl::endpoints::ClientEnd<SessionObserverMarker>) -> Self {
5228 Self::new(value.into_channel())
5229 }
5230}
5231
5232#[derive(Debug, Clone)]
5233pub struct SessionObserverProxy {
5234 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5235}
5236
5237impl fidl::endpoints::Proxy for SessionObserverProxy {
5238 type Protocol = SessionObserverMarker;
5239
5240 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5241 Self::new(inner)
5242 }
5243
5244 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5245 self.client.into_channel().map_err(|client| Self { client })
5246 }
5247
5248 fn as_channel(&self) -> &::fidl::AsyncChannel {
5249 self.client.as_channel()
5250 }
5251}
5252
5253impl SessionObserverProxy {
5254 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5256 let protocol_name = <SessionObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5257 Self { client: fidl::client::Client::new(channel, protocol_name) }
5258 }
5259
5260 pub fn take_event_stream(&self) -> SessionObserverEventStream {
5266 SessionObserverEventStream { event_receiver: self.client.take_event_receiver() }
5267 }
5268
5269 pub fn r#watch_status(
5273 &self,
5274 ) -> fidl::client::QueryResponseFut<
5275 SessionInfoDelta,
5276 fidl::encoding::DefaultFuchsiaResourceDialect,
5277 > {
5278 SessionObserverProxyInterface::r#watch_status(self)
5279 }
5280}
5281
5282impl SessionObserverProxyInterface for SessionObserverProxy {
5283 type WatchStatusResponseFut = fidl::client::QueryResponseFut<
5284 SessionInfoDelta,
5285 fidl::encoding::DefaultFuchsiaResourceDialect,
5286 >;
5287 fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
5288 fn _decode(
5289 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5290 ) -> Result<SessionInfoDelta, fidl::Error> {
5291 let _response = fidl::client::decode_transaction_body::<
5292 SessionObserverWatchStatusResponse,
5293 fidl::encoding::DefaultFuchsiaResourceDialect,
5294 0x24618b709ca18f4d,
5295 >(_buf?)?;
5296 Ok(_response.session_info_delta)
5297 }
5298 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionInfoDelta>(
5299 (),
5300 0x24618b709ca18f4d,
5301 fidl::encoding::DynamicFlags::empty(),
5302 _decode,
5303 )
5304 }
5305}
5306
5307pub struct SessionObserverEventStream {
5308 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5309}
5310
5311impl std::marker::Unpin for SessionObserverEventStream {}
5312
5313impl futures::stream::FusedStream for SessionObserverEventStream {
5314 fn is_terminated(&self) -> bool {
5315 self.event_receiver.is_terminated()
5316 }
5317}
5318
5319impl futures::Stream for SessionObserverEventStream {
5320 type Item = Result<SessionObserverEvent, fidl::Error>;
5321
5322 fn poll_next(
5323 mut self: std::pin::Pin<&mut Self>,
5324 cx: &mut std::task::Context<'_>,
5325 ) -> std::task::Poll<Option<Self::Item>> {
5326 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5327 &mut self.event_receiver,
5328 cx
5329 )?) {
5330 Some(buf) => std::task::Poll::Ready(Some(SessionObserverEvent::decode(buf))),
5331 None => std::task::Poll::Ready(None),
5332 }
5333 }
5334}
5335
5336#[derive(Debug)]
5337pub enum SessionObserverEvent {}
5338
5339impl SessionObserverEvent {
5340 fn decode(
5342 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5343 ) -> Result<SessionObserverEvent, fidl::Error> {
5344 let (bytes, _handles) = buf.split_mut();
5345 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5346 debug_assert_eq!(tx_header.tx_id, 0);
5347 match tx_header.ordinal {
5348 _ => Err(fidl::Error::UnknownOrdinal {
5349 ordinal: tx_header.ordinal,
5350 protocol_name:
5351 <SessionObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5352 }),
5353 }
5354 }
5355}
5356
5357pub struct SessionObserverRequestStream {
5359 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5360 is_terminated: bool,
5361}
5362
5363impl std::marker::Unpin for SessionObserverRequestStream {}
5364
5365impl futures::stream::FusedStream for SessionObserverRequestStream {
5366 fn is_terminated(&self) -> bool {
5367 self.is_terminated
5368 }
5369}
5370
5371impl fidl::endpoints::RequestStream for SessionObserverRequestStream {
5372 type Protocol = SessionObserverMarker;
5373 type ControlHandle = SessionObserverControlHandle;
5374
5375 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5376 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5377 }
5378
5379 fn control_handle(&self) -> Self::ControlHandle {
5380 SessionObserverControlHandle { inner: self.inner.clone() }
5381 }
5382
5383 fn into_inner(
5384 self,
5385 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5386 {
5387 (self.inner, self.is_terminated)
5388 }
5389
5390 fn from_inner(
5391 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5392 is_terminated: bool,
5393 ) -> Self {
5394 Self { inner, is_terminated }
5395 }
5396}
5397
5398impl futures::Stream for SessionObserverRequestStream {
5399 type Item = Result<SessionObserverRequest, fidl::Error>;
5400
5401 fn poll_next(
5402 mut self: std::pin::Pin<&mut Self>,
5403 cx: &mut std::task::Context<'_>,
5404 ) -> std::task::Poll<Option<Self::Item>> {
5405 let this = &mut *self;
5406 if this.inner.check_shutdown(cx) {
5407 this.is_terminated = true;
5408 return std::task::Poll::Ready(None);
5409 }
5410 if this.is_terminated {
5411 panic!("polled SessionObserverRequestStream after completion");
5412 }
5413 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5414 |bytes, handles| {
5415 match this.inner.channel().read_etc(cx, bytes, handles) {
5416 std::task::Poll::Ready(Ok(())) => {}
5417 std::task::Poll::Pending => return std::task::Poll::Pending,
5418 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5419 this.is_terminated = true;
5420 return std::task::Poll::Ready(None);
5421 }
5422 std::task::Poll::Ready(Err(e)) => {
5423 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5424 e.into(),
5425 ))));
5426 }
5427 }
5428
5429 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5431
5432 std::task::Poll::Ready(Some(match header.ordinal {
5433 0x24618b709ca18f4d => {
5434 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5435 let mut req = fidl::new_empty!(
5436 fidl::encoding::EmptyPayload,
5437 fidl::encoding::DefaultFuchsiaResourceDialect
5438 );
5439 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5440 let control_handle =
5441 SessionObserverControlHandle { inner: this.inner.clone() };
5442 Ok(SessionObserverRequest::WatchStatus {
5443 responder: SessionObserverWatchStatusResponder {
5444 control_handle: std::mem::ManuallyDrop::new(control_handle),
5445 tx_id: header.tx_id,
5446 },
5447 })
5448 }
5449 _ => Err(fidl::Error::UnknownOrdinal {
5450 ordinal: header.ordinal,
5451 protocol_name:
5452 <SessionObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5453 }),
5454 }))
5455 },
5456 )
5457 }
5458}
5459
5460#[derive(Debug)]
5464pub enum SessionObserverRequest {
5465 WatchStatus { responder: SessionObserverWatchStatusResponder },
5469}
5470
5471impl SessionObserverRequest {
5472 #[allow(irrefutable_let_patterns)]
5473 pub fn into_watch_status(self) -> Option<(SessionObserverWatchStatusResponder)> {
5474 if let SessionObserverRequest::WatchStatus { responder } = self {
5475 Some((responder))
5476 } else {
5477 None
5478 }
5479 }
5480
5481 pub fn method_name(&self) -> &'static str {
5483 match *self {
5484 SessionObserverRequest::WatchStatus { .. } => "watch_status",
5485 }
5486 }
5487}
5488
5489#[derive(Debug, Clone)]
5490pub struct SessionObserverControlHandle {
5491 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5492}
5493
5494impl fidl::endpoints::ControlHandle for SessionObserverControlHandle {
5495 fn shutdown(&self) {
5496 self.inner.shutdown()
5497 }
5498
5499 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5500 self.inner.shutdown_with_epitaph(status)
5501 }
5502
5503 fn is_closed(&self) -> bool {
5504 self.inner.channel().is_closed()
5505 }
5506 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5507 self.inner.channel().on_closed()
5508 }
5509
5510 #[cfg(target_os = "fuchsia")]
5511 fn signal_peer(
5512 &self,
5513 clear_mask: zx::Signals,
5514 set_mask: zx::Signals,
5515 ) -> Result<(), zx_status::Status> {
5516 use fidl::Peered;
5517 self.inner.channel().signal_peer(clear_mask, set_mask)
5518 }
5519}
5520
5521impl SessionObserverControlHandle {}
5522
5523#[must_use = "FIDL methods require a response to be sent"]
5524#[derive(Debug)]
5525pub struct SessionObserverWatchStatusResponder {
5526 control_handle: std::mem::ManuallyDrop<SessionObserverControlHandle>,
5527 tx_id: u32,
5528}
5529
5530impl std::ops::Drop for SessionObserverWatchStatusResponder {
5534 fn drop(&mut self) {
5535 self.control_handle.shutdown();
5536 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5538 }
5539}
5540
5541impl fidl::endpoints::Responder for SessionObserverWatchStatusResponder {
5542 type ControlHandle = SessionObserverControlHandle;
5543
5544 fn control_handle(&self) -> &SessionObserverControlHandle {
5545 &self.control_handle
5546 }
5547
5548 fn drop_without_shutdown(mut self) {
5549 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5551 std::mem::forget(self);
5553 }
5554}
5555
5556impl SessionObserverWatchStatusResponder {
5557 pub fn send(self, mut session_info_delta: &SessionInfoDelta) -> Result<(), fidl::Error> {
5561 let _result = self.send_raw(session_info_delta);
5562 if _result.is_err() {
5563 self.control_handle.shutdown();
5564 }
5565 self.drop_without_shutdown();
5566 _result
5567 }
5568
5569 pub fn send_no_shutdown_on_err(
5571 self,
5572 mut session_info_delta: &SessionInfoDelta,
5573 ) -> Result<(), fidl::Error> {
5574 let _result = self.send_raw(session_info_delta);
5575 self.drop_without_shutdown();
5576 _result
5577 }
5578
5579 fn send_raw(&self, mut session_info_delta: &SessionInfoDelta) -> Result<(), fidl::Error> {
5580 self.control_handle.inner.send::<SessionObserverWatchStatusResponse>(
5581 (session_info_delta,),
5582 self.tx_id,
5583 0x24618b709ca18f4d,
5584 fidl::encoding::DynamicFlags::empty(),
5585 )
5586 }
5587}
5588
5589#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5590pub struct SessionsWatcherMarker;
5591
5592impl fidl::endpoints::ProtocolMarker for SessionsWatcherMarker {
5593 type Proxy = SessionsWatcherProxy;
5594 type RequestStream = SessionsWatcherRequestStream;
5595 #[cfg(target_os = "fuchsia")]
5596 type SynchronousProxy = SessionsWatcherSynchronousProxy;
5597
5598 const DEBUG_NAME: &'static str = "(anonymous) SessionsWatcher";
5599}
5600
5601pub trait SessionsWatcherProxyInterface: Send + Sync {
5602 type SessionUpdatedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5603 fn r#session_updated(
5604 &self,
5605 session_id: u64,
5606 session_info_delta: &SessionInfoDelta,
5607 ) -> Self::SessionUpdatedResponseFut;
5608 type SessionRemovedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5609 fn r#session_removed(&self, session_id: u64) -> Self::SessionRemovedResponseFut;
5610}
5611#[derive(Debug)]
5612#[cfg(target_os = "fuchsia")]
5613pub struct SessionsWatcherSynchronousProxy {
5614 client: fidl::client::sync::Client,
5615}
5616
5617#[cfg(target_os = "fuchsia")]
5618impl fidl::endpoints::SynchronousProxy for SessionsWatcherSynchronousProxy {
5619 type Proxy = SessionsWatcherProxy;
5620 type Protocol = SessionsWatcherMarker;
5621
5622 fn from_channel(inner: fidl::Channel) -> Self {
5623 Self::new(inner)
5624 }
5625
5626 fn into_channel(self) -> fidl::Channel {
5627 self.client.into_channel()
5628 }
5629
5630 fn as_channel(&self) -> &fidl::Channel {
5631 self.client.as_channel()
5632 }
5633}
5634
5635#[cfg(target_os = "fuchsia")]
5636impl SessionsWatcherSynchronousProxy {
5637 pub fn new(channel: fidl::Channel) -> Self {
5638 Self { client: fidl::client::sync::Client::new(channel) }
5639 }
5640
5641 pub fn into_channel(self) -> fidl::Channel {
5642 self.client.into_channel()
5643 }
5644
5645 pub fn wait_for_event(
5648 &self,
5649 deadline: zx::MonotonicInstant,
5650 ) -> Result<SessionsWatcherEvent, fidl::Error> {
5651 SessionsWatcherEvent::decode(self.client.wait_for_event::<SessionsWatcherMarker>(deadline)?)
5652 }
5653
5654 pub fn r#session_updated(
5661 &self,
5662 mut session_id: u64,
5663 mut session_info_delta: &SessionInfoDelta,
5664 ___deadline: zx::MonotonicInstant,
5665 ) -> Result<(), fidl::Error> {
5666 let _response = self.client.send_query::<
5667 SessionsWatcherSessionUpdatedRequest,
5668 fidl::encoding::EmptyPayload,
5669 SessionsWatcherMarker,
5670 >(
5671 (session_id, session_info_delta,),
5672 0x47d25ef93c58c2d9,
5673 fidl::encoding::DynamicFlags::empty(),
5674 ___deadline,
5675 )?;
5676 Ok(_response)
5677 }
5678
5679 pub fn r#session_removed(
5685 &self,
5686 mut session_id: u64,
5687 ___deadline: zx::MonotonicInstant,
5688 ) -> Result<(), fidl::Error> {
5689 let _response = self.client.send_query::<
5690 SessionsWatcherSessionRemovedRequest,
5691 fidl::encoding::EmptyPayload,
5692 SessionsWatcherMarker,
5693 >(
5694 (session_id,),
5695 0x407556ecd5a2400e,
5696 fidl::encoding::DynamicFlags::empty(),
5697 ___deadline,
5698 )?;
5699 Ok(_response)
5700 }
5701}
5702
5703#[cfg(target_os = "fuchsia")]
5704impl From<SessionsWatcherSynchronousProxy> for zx::NullableHandle {
5705 fn from(value: SessionsWatcherSynchronousProxy) -> Self {
5706 value.into_channel().into()
5707 }
5708}
5709
5710#[cfg(target_os = "fuchsia")]
5711impl From<fidl::Channel> for SessionsWatcherSynchronousProxy {
5712 fn from(value: fidl::Channel) -> Self {
5713 Self::new(value)
5714 }
5715}
5716
5717#[cfg(target_os = "fuchsia")]
5718impl fidl::endpoints::FromClient for SessionsWatcherSynchronousProxy {
5719 type Protocol = SessionsWatcherMarker;
5720
5721 fn from_client(value: fidl::endpoints::ClientEnd<SessionsWatcherMarker>) -> Self {
5722 Self::new(value.into_channel())
5723 }
5724}
5725
5726#[derive(Debug, Clone)]
5727pub struct SessionsWatcherProxy {
5728 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5729}
5730
5731impl fidl::endpoints::Proxy for SessionsWatcherProxy {
5732 type Protocol = SessionsWatcherMarker;
5733
5734 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5735 Self::new(inner)
5736 }
5737
5738 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5739 self.client.into_channel().map_err(|client| Self { client })
5740 }
5741
5742 fn as_channel(&self) -> &::fidl::AsyncChannel {
5743 self.client.as_channel()
5744 }
5745}
5746
5747impl SessionsWatcherProxy {
5748 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5750 let protocol_name = <SessionsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5751 Self { client: fidl::client::Client::new(channel, protocol_name) }
5752 }
5753
5754 pub fn take_event_stream(&self) -> SessionsWatcherEventStream {
5760 SessionsWatcherEventStream { event_receiver: self.client.take_event_receiver() }
5761 }
5762
5763 pub fn r#session_updated(
5770 &self,
5771 mut session_id: u64,
5772 mut session_info_delta: &SessionInfoDelta,
5773 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5774 SessionsWatcherProxyInterface::r#session_updated(self, session_id, session_info_delta)
5775 }
5776
5777 pub fn r#session_removed(
5783 &self,
5784 mut session_id: u64,
5785 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5786 SessionsWatcherProxyInterface::r#session_removed(self, session_id)
5787 }
5788}
5789
5790impl SessionsWatcherProxyInterface for SessionsWatcherProxy {
5791 type SessionUpdatedResponseFut =
5792 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5793 fn r#session_updated(
5794 &self,
5795 mut session_id: u64,
5796 mut session_info_delta: &SessionInfoDelta,
5797 ) -> Self::SessionUpdatedResponseFut {
5798 fn _decode(
5799 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5800 ) -> Result<(), fidl::Error> {
5801 let _response = fidl::client::decode_transaction_body::<
5802 fidl::encoding::EmptyPayload,
5803 fidl::encoding::DefaultFuchsiaResourceDialect,
5804 0x47d25ef93c58c2d9,
5805 >(_buf?)?;
5806 Ok(_response)
5807 }
5808 self.client.send_query_and_decode::<SessionsWatcherSessionUpdatedRequest, ()>(
5809 (session_id, session_info_delta),
5810 0x47d25ef93c58c2d9,
5811 fidl::encoding::DynamicFlags::empty(),
5812 _decode,
5813 )
5814 }
5815
5816 type SessionRemovedResponseFut =
5817 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5818 fn r#session_removed(&self, mut session_id: u64) -> Self::SessionRemovedResponseFut {
5819 fn _decode(
5820 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5821 ) -> Result<(), fidl::Error> {
5822 let _response = fidl::client::decode_transaction_body::<
5823 fidl::encoding::EmptyPayload,
5824 fidl::encoding::DefaultFuchsiaResourceDialect,
5825 0x407556ecd5a2400e,
5826 >(_buf?)?;
5827 Ok(_response)
5828 }
5829 self.client.send_query_and_decode::<SessionsWatcherSessionRemovedRequest, ()>(
5830 (session_id,),
5831 0x407556ecd5a2400e,
5832 fidl::encoding::DynamicFlags::empty(),
5833 _decode,
5834 )
5835 }
5836}
5837
5838pub struct SessionsWatcherEventStream {
5839 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5840}
5841
5842impl std::marker::Unpin for SessionsWatcherEventStream {}
5843
5844impl futures::stream::FusedStream for SessionsWatcherEventStream {
5845 fn is_terminated(&self) -> bool {
5846 self.event_receiver.is_terminated()
5847 }
5848}
5849
5850impl futures::Stream for SessionsWatcherEventStream {
5851 type Item = Result<SessionsWatcherEvent, fidl::Error>;
5852
5853 fn poll_next(
5854 mut self: std::pin::Pin<&mut Self>,
5855 cx: &mut std::task::Context<'_>,
5856 ) -> std::task::Poll<Option<Self::Item>> {
5857 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5858 &mut self.event_receiver,
5859 cx
5860 )?) {
5861 Some(buf) => std::task::Poll::Ready(Some(SessionsWatcherEvent::decode(buf))),
5862 None => std::task::Poll::Ready(None),
5863 }
5864 }
5865}
5866
5867#[derive(Debug)]
5868pub enum SessionsWatcherEvent {}
5869
5870impl SessionsWatcherEvent {
5871 fn decode(
5873 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5874 ) -> Result<SessionsWatcherEvent, fidl::Error> {
5875 let (bytes, _handles) = buf.split_mut();
5876 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5877 debug_assert_eq!(tx_header.tx_id, 0);
5878 match tx_header.ordinal {
5879 _ => Err(fidl::Error::UnknownOrdinal {
5880 ordinal: tx_header.ordinal,
5881 protocol_name:
5882 <SessionsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5883 }),
5884 }
5885 }
5886}
5887
5888pub struct SessionsWatcherRequestStream {
5890 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5891 is_terminated: bool,
5892}
5893
5894impl std::marker::Unpin for SessionsWatcherRequestStream {}
5895
5896impl futures::stream::FusedStream for SessionsWatcherRequestStream {
5897 fn is_terminated(&self) -> bool {
5898 self.is_terminated
5899 }
5900}
5901
5902impl fidl::endpoints::RequestStream for SessionsWatcherRequestStream {
5903 type Protocol = SessionsWatcherMarker;
5904 type ControlHandle = SessionsWatcherControlHandle;
5905
5906 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5907 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5908 }
5909
5910 fn control_handle(&self) -> Self::ControlHandle {
5911 SessionsWatcherControlHandle { inner: self.inner.clone() }
5912 }
5913
5914 fn into_inner(
5915 self,
5916 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5917 {
5918 (self.inner, self.is_terminated)
5919 }
5920
5921 fn from_inner(
5922 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5923 is_terminated: bool,
5924 ) -> Self {
5925 Self { inner, is_terminated }
5926 }
5927}
5928
5929impl futures::Stream for SessionsWatcherRequestStream {
5930 type Item = Result<SessionsWatcherRequest, fidl::Error>;
5931
5932 fn poll_next(
5933 mut self: std::pin::Pin<&mut Self>,
5934 cx: &mut std::task::Context<'_>,
5935 ) -> std::task::Poll<Option<Self::Item>> {
5936 let this = &mut *self;
5937 if this.inner.check_shutdown(cx) {
5938 this.is_terminated = true;
5939 return std::task::Poll::Ready(None);
5940 }
5941 if this.is_terminated {
5942 panic!("polled SessionsWatcherRequestStream after completion");
5943 }
5944 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5945 |bytes, handles| {
5946 match this.inner.channel().read_etc(cx, bytes, handles) {
5947 std::task::Poll::Ready(Ok(())) => {}
5948 std::task::Poll::Pending => return std::task::Poll::Pending,
5949 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5950 this.is_terminated = true;
5951 return std::task::Poll::Ready(None);
5952 }
5953 std::task::Poll::Ready(Err(e)) => {
5954 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5955 e.into(),
5956 ))));
5957 }
5958 }
5959
5960 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5962
5963 std::task::Poll::Ready(Some(match header.ordinal {
5964 0x47d25ef93c58c2d9 => {
5965 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5966 let mut req = fidl::new_empty!(
5967 SessionsWatcherSessionUpdatedRequest,
5968 fidl::encoding::DefaultFuchsiaResourceDialect
5969 );
5970 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionsWatcherSessionUpdatedRequest>(&header, _body_bytes, handles, &mut req)?;
5971 let control_handle =
5972 SessionsWatcherControlHandle { inner: this.inner.clone() };
5973 Ok(SessionsWatcherRequest::SessionUpdated {
5974 session_id: req.session_id,
5975 session_info_delta: req.session_info_delta,
5976
5977 responder: SessionsWatcherSessionUpdatedResponder {
5978 control_handle: std::mem::ManuallyDrop::new(control_handle),
5979 tx_id: header.tx_id,
5980 },
5981 })
5982 }
5983 0x407556ecd5a2400e => {
5984 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5985 let mut req = fidl::new_empty!(
5986 SessionsWatcherSessionRemovedRequest,
5987 fidl::encoding::DefaultFuchsiaResourceDialect
5988 );
5989 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionsWatcherSessionRemovedRequest>(&header, _body_bytes, handles, &mut req)?;
5990 let control_handle =
5991 SessionsWatcherControlHandle { inner: this.inner.clone() };
5992 Ok(SessionsWatcherRequest::SessionRemoved {
5993 session_id: req.session_id,
5994
5995 responder: SessionsWatcherSessionRemovedResponder {
5996 control_handle: std::mem::ManuallyDrop::new(control_handle),
5997 tx_id: header.tx_id,
5998 },
5999 })
6000 }
6001 _ => Err(fidl::Error::UnknownOrdinal {
6002 ordinal: header.ordinal,
6003 protocol_name:
6004 <SessionsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6005 }),
6006 }))
6007 },
6008 )
6009 }
6010}
6011
6012#[derive(Debug)]
6014pub enum SessionsWatcherRequest {
6015 SessionUpdated {
6022 session_id: u64,
6023 session_info_delta: SessionInfoDelta,
6024 responder: SessionsWatcherSessionUpdatedResponder,
6025 },
6026 SessionRemoved { session_id: u64, responder: SessionsWatcherSessionRemovedResponder },
6032}
6033
6034impl SessionsWatcherRequest {
6035 #[allow(irrefutable_let_patterns)]
6036 pub fn into_session_updated(
6037 self,
6038 ) -> Option<(u64, SessionInfoDelta, SessionsWatcherSessionUpdatedResponder)> {
6039 if let SessionsWatcherRequest::SessionUpdated {
6040 session_id,
6041 session_info_delta,
6042 responder,
6043 } = self
6044 {
6045 Some((session_id, session_info_delta, responder))
6046 } else {
6047 None
6048 }
6049 }
6050
6051 #[allow(irrefutable_let_patterns)]
6052 pub fn into_session_removed(self) -> Option<(u64, SessionsWatcherSessionRemovedResponder)> {
6053 if let SessionsWatcherRequest::SessionRemoved { session_id, responder } = self {
6054 Some((session_id, responder))
6055 } else {
6056 None
6057 }
6058 }
6059
6060 pub fn method_name(&self) -> &'static str {
6062 match *self {
6063 SessionsWatcherRequest::SessionUpdated { .. } => "session_updated",
6064 SessionsWatcherRequest::SessionRemoved { .. } => "session_removed",
6065 }
6066 }
6067}
6068
6069#[derive(Debug, Clone)]
6070pub struct SessionsWatcherControlHandle {
6071 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6072}
6073
6074impl fidl::endpoints::ControlHandle for SessionsWatcherControlHandle {
6075 fn shutdown(&self) {
6076 self.inner.shutdown()
6077 }
6078
6079 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6080 self.inner.shutdown_with_epitaph(status)
6081 }
6082
6083 fn is_closed(&self) -> bool {
6084 self.inner.channel().is_closed()
6085 }
6086 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6087 self.inner.channel().on_closed()
6088 }
6089
6090 #[cfg(target_os = "fuchsia")]
6091 fn signal_peer(
6092 &self,
6093 clear_mask: zx::Signals,
6094 set_mask: zx::Signals,
6095 ) -> Result<(), zx_status::Status> {
6096 use fidl::Peered;
6097 self.inner.channel().signal_peer(clear_mask, set_mask)
6098 }
6099}
6100
6101impl SessionsWatcherControlHandle {}
6102
6103#[must_use = "FIDL methods require a response to be sent"]
6104#[derive(Debug)]
6105pub struct SessionsWatcherSessionUpdatedResponder {
6106 control_handle: std::mem::ManuallyDrop<SessionsWatcherControlHandle>,
6107 tx_id: u32,
6108}
6109
6110impl std::ops::Drop for SessionsWatcherSessionUpdatedResponder {
6114 fn drop(&mut self) {
6115 self.control_handle.shutdown();
6116 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6118 }
6119}
6120
6121impl fidl::endpoints::Responder for SessionsWatcherSessionUpdatedResponder {
6122 type ControlHandle = SessionsWatcherControlHandle;
6123
6124 fn control_handle(&self) -> &SessionsWatcherControlHandle {
6125 &self.control_handle
6126 }
6127
6128 fn drop_without_shutdown(mut self) {
6129 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6131 std::mem::forget(self);
6133 }
6134}
6135
6136impl SessionsWatcherSessionUpdatedResponder {
6137 pub fn send(self) -> Result<(), fidl::Error> {
6141 let _result = self.send_raw();
6142 if _result.is_err() {
6143 self.control_handle.shutdown();
6144 }
6145 self.drop_without_shutdown();
6146 _result
6147 }
6148
6149 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6151 let _result = self.send_raw();
6152 self.drop_without_shutdown();
6153 _result
6154 }
6155
6156 fn send_raw(&self) -> Result<(), fidl::Error> {
6157 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6158 (),
6159 self.tx_id,
6160 0x47d25ef93c58c2d9,
6161 fidl::encoding::DynamicFlags::empty(),
6162 )
6163 }
6164}
6165
6166#[must_use = "FIDL methods require a response to be sent"]
6167#[derive(Debug)]
6168pub struct SessionsWatcherSessionRemovedResponder {
6169 control_handle: std::mem::ManuallyDrop<SessionsWatcherControlHandle>,
6170 tx_id: u32,
6171}
6172
6173impl std::ops::Drop for SessionsWatcherSessionRemovedResponder {
6177 fn drop(&mut self) {
6178 self.control_handle.shutdown();
6179 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6181 }
6182}
6183
6184impl fidl::endpoints::Responder for SessionsWatcherSessionRemovedResponder {
6185 type ControlHandle = SessionsWatcherControlHandle;
6186
6187 fn control_handle(&self) -> &SessionsWatcherControlHandle {
6188 &self.control_handle
6189 }
6190
6191 fn drop_without_shutdown(mut self) {
6192 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6194 std::mem::forget(self);
6196 }
6197}
6198
6199impl SessionsWatcherSessionRemovedResponder {
6200 pub fn send(self) -> Result<(), fidl::Error> {
6204 let _result = self.send_raw();
6205 if _result.is_err() {
6206 self.control_handle.shutdown();
6207 }
6208 self.drop_without_shutdown();
6209 _result
6210 }
6211
6212 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6214 let _result = self.send_raw();
6215 self.drop_without_shutdown();
6216 _result
6217 }
6218
6219 fn send_raw(&self) -> Result<(), fidl::Error> {
6220 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6221 (),
6222 self.tx_id,
6223 0x407556ecd5a2400e,
6224 fidl::encoding::DynamicFlags::empty(),
6225 )
6226 }
6227}
6228
6229mod internal {
6230 use super::*;
6231
6232 impl fidl::encoding::ResourceTypeMarker for ActiveSessionWatchActiveSessionResponse {
6233 type Borrowed<'a> = &'a mut Self;
6234 fn take_or_borrow<'a>(
6235 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6236 ) -> Self::Borrowed<'a> {
6237 value
6238 }
6239 }
6240
6241 unsafe impl fidl::encoding::TypeMarker for ActiveSessionWatchActiveSessionResponse {
6242 type Owned = Self;
6243
6244 #[inline(always)]
6245 fn inline_align(_context: fidl::encoding::Context) -> usize {
6246 4
6247 }
6248
6249 #[inline(always)]
6250 fn inline_size(_context: fidl::encoding::Context) -> usize {
6251 4
6252 }
6253 }
6254
6255 unsafe impl
6256 fidl::encoding::Encode<
6257 ActiveSessionWatchActiveSessionResponse,
6258 fidl::encoding::DefaultFuchsiaResourceDialect,
6259 > for &mut ActiveSessionWatchActiveSessionResponse
6260 {
6261 #[inline]
6262 unsafe fn encode(
6263 self,
6264 encoder: &mut fidl::encoding::Encoder<
6265 '_,
6266 fidl::encoding::DefaultFuchsiaResourceDialect,
6267 >,
6268 offset: usize,
6269 _depth: fidl::encoding::Depth,
6270 ) -> fidl::Result<()> {
6271 encoder.debug_check_bounds::<ActiveSessionWatchActiveSessionResponse>(offset);
6272 fidl::encoding::Encode::<
6274 ActiveSessionWatchActiveSessionResponse,
6275 fidl::encoding::DefaultFuchsiaResourceDialect,
6276 >::encode(
6277 (<fidl::encoding::Optional<
6278 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionControlMarker>>,
6279 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6280 &mut self.session
6281 ),),
6282 encoder,
6283 offset,
6284 _depth,
6285 )
6286 }
6287 }
6288 unsafe impl<
6289 T0: fidl::encoding::Encode<
6290 fidl::encoding::Optional<
6291 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionControlMarker>>,
6292 >,
6293 fidl::encoding::DefaultFuchsiaResourceDialect,
6294 >,
6295 >
6296 fidl::encoding::Encode<
6297 ActiveSessionWatchActiveSessionResponse,
6298 fidl::encoding::DefaultFuchsiaResourceDialect,
6299 > for (T0,)
6300 {
6301 #[inline]
6302 unsafe fn encode(
6303 self,
6304 encoder: &mut fidl::encoding::Encoder<
6305 '_,
6306 fidl::encoding::DefaultFuchsiaResourceDialect,
6307 >,
6308 offset: usize,
6309 depth: fidl::encoding::Depth,
6310 ) -> fidl::Result<()> {
6311 encoder.debug_check_bounds::<ActiveSessionWatchActiveSessionResponse>(offset);
6312 self.0.encode(encoder, offset + 0, depth)?;
6316 Ok(())
6317 }
6318 }
6319
6320 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6321 for ActiveSessionWatchActiveSessionResponse
6322 {
6323 #[inline(always)]
6324 fn new_empty() -> Self {
6325 Self {
6326 session: fidl::new_empty!(
6327 fidl::encoding::Optional<
6328 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionControlMarker>>,
6329 >,
6330 fidl::encoding::DefaultFuchsiaResourceDialect
6331 ),
6332 }
6333 }
6334
6335 #[inline]
6336 unsafe fn decode(
6337 &mut self,
6338 decoder: &mut fidl::encoding::Decoder<
6339 '_,
6340 fidl::encoding::DefaultFuchsiaResourceDialect,
6341 >,
6342 offset: usize,
6343 _depth: fidl::encoding::Depth,
6344 ) -> fidl::Result<()> {
6345 decoder.debug_check_bounds::<Self>(offset);
6346 fidl::decode!(
6348 fidl::encoding::Optional<
6349 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionControlMarker>>,
6350 >,
6351 fidl::encoding::DefaultFuchsiaResourceDialect,
6352 &mut self.session,
6353 decoder,
6354 offset + 0,
6355 _depth
6356 )?;
6357 Ok(())
6358 }
6359 }
6360
6361 impl fidl::encoding::ResourceTypeMarker for DiscoveryConnectToSessionRequest {
6362 type Borrowed<'a> = &'a mut Self;
6363 fn take_or_borrow<'a>(
6364 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6365 ) -> Self::Borrowed<'a> {
6366 value
6367 }
6368 }
6369
6370 unsafe impl fidl::encoding::TypeMarker for DiscoveryConnectToSessionRequest {
6371 type Owned = Self;
6372
6373 #[inline(always)]
6374 fn inline_align(_context: fidl::encoding::Context) -> usize {
6375 8
6376 }
6377
6378 #[inline(always)]
6379 fn inline_size(_context: fidl::encoding::Context) -> usize {
6380 16
6381 }
6382 }
6383
6384 unsafe impl
6385 fidl::encoding::Encode<
6386 DiscoveryConnectToSessionRequest,
6387 fidl::encoding::DefaultFuchsiaResourceDialect,
6388 > for &mut DiscoveryConnectToSessionRequest
6389 {
6390 #[inline]
6391 unsafe fn encode(
6392 self,
6393 encoder: &mut fidl::encoding::Encoder<
6394 '_,
6395 fidl::encoding::DefaultFuchsiaResourceDialect,
6396 >,
6397 offset: usize,
6398 _depth: fidl::encoding::Depth,
6399 ) -> fidl::Result<()> {
6400 encoder.debug_check_bounds::<DiscoveryConnectToSessionRequest>(offset);
6401 fidl::encoding::Encode::<DiscoveryConnectToSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6403 (
6404 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.session_id),
6405 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session_control_request),
6406 ),
6407 encoder, offset, _depth
6408 )
6409 }
6410 }
6411 unsafe impl<
6412 T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
6413 T1: fidl::encoding::Encode<
6414 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionControlMarker>>,
6415 fidl::encoding::DefaultFuchsiaResourceDialect,
6416 >,
6417 >
6418 fidl::encoding::Encode<
6419 DiscoveryConnectToSessionRequest,
6420 fidl::encoding::DefaultFuchsiaResourceDialect,
6421 > for (T0, T1)
6422 {
6423 #[inline]
6424 unsafe fn encode(
6425 self,
6426 encoder: &mut fidl::encoding::Encoder<
6427 '_,
6428 fidl::encoding::DefaultFuchsiaResourceDialect,
6429 >,
6430 offset: usize,
6431 depth: fidl::encoding::Depth,
6432 ) -> fidl::Result<()> {
6433 encoder.debug_check_bounds::<DiscoveryConnectToSessionRequest>(offset);
6434 unsafe {
6437 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
6438 (ptr as *mut u64).write_unaligned(0);
6439 }
6440 self.0.encode(encoder, offset + 0, depth)?;
6442 self.1.encode(encoder, offset + 8, depth)?;
6443 Ok(())
6444 }
6445 }
6446
6447 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6448 for DiscoveryConnectToSessionRequest
6449 {
6450 #[inline(always)]
6451 fn new_empty() -> Self {
6452 Self {
6453 session_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
6454 session_control_request: fidl::new_empty!(
6455 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionControlMarker>>,
6456 fidl::encoding::DefaultFuchsiaResourceDialect
6457 ),
6458 }
6459 }
6460
6461 #[inline]
6462 unsafe fn decode(
6463 &mut self,
6464 decoder: &mut fidl::encoding::Decoder<
6465 '_,
6466 fidl::encoding::DefaultFuchsiaResourceDialect,
6467 >,
6468 offset: usize,
6469 _depth: fidl::encoding::Depth,
6470 ) -> fidl::Result<()> {
6471 decoder.debug_check_bounds::<Self>(offset);
6472 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
6474 let padval = unsafe { (ptr as *const u64).read_unaligned() };
6475 let mask = 0xffffffff00000000u64;
6476 let maskedval = padval & mask;
6477 if maskedval != 0 {
6478 return Err(fidl::Error::NonZeroPadding {
6479 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
6480 });
6481 }
6482 fidl::decode!(
6483 u64,
6484 fidl::encoding::DefaultFuchsiaResourceDialect,
6485 &mut self.session_id,
6486 decoder,
6487 offset + 0,
6488 _depth
6489 )?;
6490 fidl::decode!(
6491 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionControlMarker>>,
6492 fidl::encoding::DefaultFuchsiaResourceDialect,
6493 &mut self.session_control_request,
6494 decoder,
6495 offset + 8,
6496 _depth
6497 )?;
6498 Ok(())
6499 }
6500 }
6501
6502 impl fidl::encoding::ResourceTypeMarker for DiscoveryWatchSessionsRequest {
6503 type Borrowed<'a> = &'a mut Self;
6504 fn take_or_borrow<'a>(
6505 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6506 ) -> Self::Borrowed<'a> {
6507 value
6508 }
6509 }
6510
6511 unsafe impl fidl::encoding::TypeMarker for DiscoveryWatchSessionsRequest {
6512 type Owned = Self;
6513
6514 #[inline(always)]
6515 fn inline_align(_context: fidl::encoding::Context) -> usize {
6516 8
6517 }
6518
6519 #[inline(always)]
6520 fn inline_size(_context: fidl::encoding::Context) -> usize {
6521 24
6522 }
6523 }
6524
6525 unsafe impl
6526 fidl::encoding::Encode<
6527 DiscoveryWatchSessionsRequest,
6528 fidl::encoding::DefaultFuchsiaResourceDialect,
6529 > for &mut DiscoveryWatchSessionsRequest
6530 {
6531 #[inline]
6532 unsafe fn encode(
6533 self,
6534 encoder: &mut fidl::encoding::Encoder<
6535 '_,
6536 fidl::encoding::DefaultFuchsiaResourceDialect,
6537 >,
6538 offset: usize,
6539 _depth: fidl::encoding::Depth,
6540 ) -> fidl::Result<()> {
6541 encoder.debug_check_bounds::<DiscoveryWatchSessionsRequest>(offset);
6542 fidl::encoding::Encode::<DiscoveryWatchSessionsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6544 (
6545 <WatchOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.watch_options),
6546 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session_watcher),
6547 ),
6548 encoder, offset, _depth
6549 )
6550 }
6551 }
6552 unsafe impl<
6553 T0: fidl::encoding::Encode<WatchOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
6554 T1: fidl::encoding::Encode<
6555 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
6556 fidl::encoding::DefaultFuchsiaResourceDialect,
6557 >,
6558 >
6559 fidl::encoding::Encode<
6560 DiscoveryWatchSessionsRequest,
6561 fidl::encoding::DefaultFuchsiaResourceDialect,
6562 > for (T0, T1)
6563 {
6564 #[inline]
6565 unsafe fn encode(
6566 self,
6567 encoder: &mut fidl::encoding::Encoder<
6568 '_,
6569 fidl::encoding::DefaultFuchsiaResourceDialect,
6570 >,
6571 offset: usize,
6572 depth: fidl::encoding::Depth,
6573 ) -> fidl::Result<()> {
6574 encoder.debug_check_bounds::<DiscoveryWatchSessionsRequest>(offset);
6575 unsafe {
6578 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
6579 (ptr as *mut u64).write_unaligned(0);
6580 }
6581 self.0.encode(encoder, offset + 0, depth)?;
6583 self.1.encode(encoder, offset + 16, depth)?;
6584 Ok(())
6585 }
6586 }
6587
6588 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6589 for DiscoveryWatchSessionsRequest
6590 {
6591 #[inline(always)]
6592 fn new_empty() -> Self {
6593 Self {
6594 watch_options: fidl::new_empty!(
6595 WatchOptions,
6596 fidl::encoding::DefaultFuchsiaResourceDialect
6597 ),
6598 session_watcher: fidl::new_empty!(
6599 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
6600 fidl::encoding::DefaultFuchsiaResourceDialect
6601 ),
6602 }
6603 }
6604
6605 #[inline]
6606 unsafe fn decode(
6607 &mut self,
6608 decoder: &mut fidl::encoding::Decoder<
6609 '_,
6610 fidl::encoding::DefaultFuchsiaResourceDialect,
6611 >,
6612 offset: usize,
6613 _depth: fidl::encoding::Depth,
6614 ) -> fidl::Result<()> {
6615 decoder.debug_check_bounds::<Self>(offset);
6616 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
6618 let padval = unsafe { (ptr as *const u64).read_unaligned() };
6619 let mask = 0xffffffff00000000u64;
6620 let maskedval = padval & mask;
6621 if maskedval != 0 {
6622 return Err(fidl::Error::NonZeroPadding {
6623 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
6624 });
6625 }
6626 fidl::decode!(
6627 WatchOptions,
6628 fidl::encoding::DefaultFuchsiaResourceDialect,
6629 &mut self.watch_options,
6630 decoder,
6631 offset + 0,
6632 _depth
6633 )?;
6634 fidl::decode!(
6635 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
6636 fidl::encoding::DefaultFuchsiaResourceDialect,
6637 &mut self.session_watcher,
6638 decoder,
6639 offset + 16,
6640 _depth
6641 )?;
6642 Ok(())
6643 }
6644 }
6645
6646 impl fidl::encoding::ResourceTypeMarker for ObserverDiscoveryConnectToSessionRequest {
6647 type Borrowed<'a> = &'a mut Self;
6648 fn take_or_borrow<'a>(
6649 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6650 ) -> Self::Borrowed<'a> {
6651 value
6652 }
6653 }
6654
6655 unsafe impl fidl::encoding::TypeMarker for ObserverDiscoveryConnectToSessionRequest {
6656 type Owned = Self;
6657
6658 #[inline(always)]
6659 fn inline_align(_context: fidl::encoding::Context) -> usize {
6660 8
6661 }
6662
6663 #[inline(always)]
6664 fn inline_size(_context: fidl::encoding::Context) -> usize {
6665 16
6666 }
6667 }
6668
6669 unsafe impl
6670 fidl::encoding::Encode<
6671 ObserverDiscoveryConnectToSessionRequest,
6672 fidl::encoding::DefaultFuchsiaResourceDialect,
6673 > for &mut ObserverDiscoveryConnectToSessionRequest
6674 {
6675 #[inline]
6676 unsafe fn encode(
6677 self,
6678 encoder: &mut fidl::encoding::Encoder<
6679 '_,
6680 fidl::encoding::DefaultFuchsiaResourceDialect,
6681 >,
6682 offset: usize,
6683 _depth: fidl::encoding::Depth,
6684 ) -> fidl::Result<()> {
6685 encoder.debug_check_bounds::<ObserverDiscoveryConnectToSessionRequest>(offset);
6686 fidl::encoding::Encode::<ObserverDiscoveryConnectToSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6688 (
6689 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.session_id),
6690 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionObserverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session_request),
6691 ),
6692 encoder, offset, _depth
6693 )
6694 }
6695 }
6696 unsafe impl<
6697 T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
6698 T1: fidl::encoding::Encode<
6699 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionObserverMarker>>,
6700 fidl::encoding::DefaultFuchsiaResourceDialect,
6701 >,
6702 >
6703 fidl::encoding::Encode<
6704 ObserverDiscoveryConnectToSessionRequest,
6705 fidl::encoding::DefaultFuchsiaResourceDialect,
6706 > for (T0, T1)
6707 {
6708 #[inline]
6709 unsafe fn encode(
6710 self,
6711 encoder: &mut fidl::encoding::Encoder<
6712 '_,
6713 fidl::encoding::DefaultFuchsiaResourceDialect,
6714 >,
6715 offset: usize,
6716 depth: fidl::encoding::Depth,
6717 ) -> fidl::Result<()> {
6718 encoder.debug_check_bounds::<ObserverDiscoveryConnectToSessionRequest>(offset);
6719 unsafe {
6722 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
6723 (ptr as *mut u64).write_unaligned(0);
6724 }
6725 self.0.encode(encoder, offset + 0, depth)?;
6727 self.1.encode(encoder, offset + 8, depth)?;
6728 Ok(())
6729 }
6730 }
6731
6732 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6733 for ObserverDiscoveryConnectToSessionRequest
6734 {
6735 #[inline(always)]
6736 fn new_empty() -> Self {
6737 Self {
6738 session_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
6739 session_request: fidl::new_empty!(
6740 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionObserverMarker>>,
6741 fidl::encoding::DefaultFuchsiaResourceDialect
6742 ),
6743 }
6744 }
6745
6746 #[inline]
6747 unsafe fn decode(
6748 &mut self,
6749 decoder: &mut fidl::encoding::Decoder<
6750 '_,
6751 fidl::encoding::DefaultFuchsiaResourceDialect,
6752 >,
6753 offset: usize,
6754 _depth: fidl::encoding::Depth,
6755 ) -> fidl::Result<()> {
6756 decoder.debug_check_bounds::<Self>(offset);
6757 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
6759 let padval = unsafe { (ptr as *const u64).read_unaligned() };
6760 let mask = 0xffffffff00000000u64;
6761 let maskedval = padval & mask;
6762 if maskedval != 0 {
6763 return Err(fidl::Error::NonZeroPadding {
6764 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
6765 });
6766 }
6767 fidl::decode!(
6768 u64,
6769 fidl::encoding::DefaultFuchsiaResourceDialect,
6770 &mut self.session_id,
6771 decoder,
6772 offset + 0,
6773 _depth
6774 )?;
6775 fidl::decode!(
6776 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionObserverMarker>>,
6777 fidl::encoding::DefaultFuchsiaResourceDialect,
6778 &mut self.session_request,
6779 decoder,
6780 offset + 8,
6781 _depth
6782 )?;
6783 Ok(())
6784 }
6785 }
6786
6787 impl fidl::encoding::ResourceTypeMarker for ObserverDiscoveryWatchSessionsRequest {
6788 type Borrowed<'a> = &'a mut Self;
6789 fn take_or_borrow<'a>(
6790 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6791 ) -> Self::Borrowed<'a> {
6792 value
6793 }
6794 }
6795
6796 unsafe impl fidl::encoding::TypeMarker for ObserverDiscoveryWatchSessionsRequest {
6797 type Owned = Self;
6798
6799 #[inline(always)]
6800 fn inline_align(_context: fidl::encoding::Context) -> usize {
6801 8
6802 }
6803
6804 #[inline(always)]
6805 fn inline_size(_context: fidl::encoding::Context) -> usize {
6806 24
6807 }
6808 }
6809
6810 unsafe impl
6811 fidl::encoding::Encode<
6812 ObserverDiscoveryWatchSessionsRequest,
6813 fidl::encoding::DefaultFuchsiaResourceDialect,
6814 > for &mut ObserverDiscoveryWatchSessionsRequest
6815 {
6816 #[inline]
6817 unsafe fn encode(
6818 self,
6819 encoder: &mut fidl::encoding::Encoder<
6820 '_,
6821 fidl::encoding::DefaultFuchsiaResourceDialect,
6822 >,
6823 offset: usize,
6824 _depth: fidl::encoding::Depth,
6825 ) -> fidl::Result<()> {
6826 encoder.debug_check_bounds::<ObserverDiscoveryWatchSessionsRequest>(offset);
6827 fidl::encoding::Encode::<ObserverDiscoveryWatchSessionsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6829 (
6830 <WatchOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.watch_options),
6831 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.sessions_watcher),
6832 ),
6833 encoder, offset, _depth
6834 )
6835 }
6836 }
6837 unsafe impl<
6838 T0: fidl::encoding::Encode<WatchOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
6839 T1: fidl::encoding::Encode<
6840 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
6841 fidl::encoding::DefaultFuchsiaResourceDialect,
6842 >,
6843 >
6844 fidl::encoding::Encode<
6845 ObserverDiscoveryWatchSessionsRequest,
6846 fidl::encoding::DefaultFuchsiaResourceDialect,
6847 > for (T0, T1)
6848 {
6849 #[inline]
6850 unsafe fn encode(
6851 self,
6852 encoder: &mut fidl::encoding::Encoder<
6853 '_,
6854 fidl::encoding::DefaultFuchsiaResourceDialect,
6855 >,
6856 offset: usize,
6857 depth: fidl::encoding::Depth,
6858 ) -> fidl::Result<()> {
6859 encoder.debug_check_bounds::<ObserverDiscoveryWatchSessionsRequest>(offset);
6860 unsafe {
6863 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
6864 (ptr as *mut u64).write_unaligned(0);
6865 }
6866 self.0.encode(encoder, offset + 0, depth)?;
6868 self.1.encode(encoder, offset + 16, depth)?;
6869 Ok(())
6870 }
6871 }
6872
6873 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6874 for ObserverDiscoveryWatchSessionsRequest
6875 {
6876 #[inline(always)]
6877 fn new_empty() -> Self {
6878 Self {
6879 watch_options: fidl::new_empty!(
6880 WatchOptions,
6881 fidl::encoding::DefaultFuchsiaResourceDialect
6882 ),
6883 sessions_watcher: fidl::new_empty!(
6884 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
6885 fidl::encoding::DefaultFuchsiaResourceDialect
6886 ),
6887 }
6888 }
6889
6890 #[inline]
6891 unsafe fn decode(
6892 &mut self,
6893 decoder: &mut fidl::encoding::Decoder<
6894 '_,
6895 fidl::encoding::DefaultFuchsiaResourceDialect,
6896 >,
6897 offset: usize,
6898 _depth: fidl::encoding::Depth,
6899 ) -> fidl::Result<()> {
6900 decoder.debug_check_bounds::<Self>(offset);
6901 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
6903 let padval = unsafe { (ptr as *const u64).read_unaligned() };
6904 let mask = 0xffffffff00000000u64;
6905 let maskedval = padval & mask;
6906 if maskedval != 0 {
6907 return Err(fidl::Error::NonZeroPadding {
6908 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
6909 });
6910 }
6911 fidl::decode!(
6912 WatchOptions,
6913 fidl::encoding::DefaultFuchsiaResourceDialect,
6914 &mut self.watch_options,
6915 decoder,
6916 offset + 0,
6917 _depth
6918 )?;
6919 fidl::decode!(
6920 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
6921 fidl::encoding::DefaultFuchsiaResourceDialect,
6922 &mut self.sessions_watcher,
6923 decoder,
6924 offset + 16,
6925 _depth
6926 )?;
6927 Ok(())
6928 }
6929 }
6930
6931 impl fidl::encoding::ResourceTypeMarker for PlayerControlBindVolumeControlRequest {
6932 type Borrowed<'a> = &'a mut Self;
6933 fn take_or_borrow<'a>(
6934 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6935 ) -> Self::Borrowed<'a> {
6936 value
6937 }
6938 }
6939
6940 unsafe impl fidl::encoding::TypeMarker for PlayerControlBindVolumeControlRequest {
6941 type Owned = Self;
6942
6943 #[inline(always)]
6944 fn inline_align(_context: fidl::encoding::Context) -> usize {
6945 4
6946 }
6947
6948 #[inline(always)]
6949 fn inline_size(_context: fidl::encoding::Context) -> usize {
6950 4
6951 }
6952 }
6953
6954 unsafe impl
6955 fidl::encoding::Encode<
6956 PlayerControlBindVolumeControlRequest,
6957 fidl::encoding::DefaultFuchsiaResourceDialect,
6958 > for &mut PlayerControlBindVolumeControlRequest
6959 {
6960 #[inline]
6961 unsafe fn encode(
6962 self,
6963 encoder: &mut fidl::encoding::Encoder<
6964 '_,
6965 fidl::encoding::DefaultFuchsiaResourceDialect,
6966 >,
6967 offset: usize,
6968 _depth: fidl::encoding::Depth,
6969 ) -> fidl::Result<()> {
6970 encoder.debug_check_bounds::<PlayerControlBindVolumeControlRequest>(offset);
6971 fidl::encoding::Encode::<
6973 PlayerControlBindVolumeControlRequest,
6974 fidl::encoding::DefaultFuchsiaResourceDialect,
6975 >::encode(
6976 (<fidl::encoding::Endpoint<
6977 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
6978 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6979 &mut self.volume_control_request,
6980 ),),
6981 encoder,
6982 offset,
6983 _depth,
6984 )
6985 }
6986 }
6987 unsafe impl<
6988 T0: fidl::encoding::Encode<
6989 fidl::encoding::Endpoint<
6990 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
6991 >,
6992 fidl::encoding::DefaultFuchsiaResourceDialect,
6993 >,
6994 >
6995 fidl::encoding::Encode<
6996 PlayerControlBindVolumeControlRequest,
6997 fidl::encoding::DefaultFuchsiaResourceDialect,
6998 > for (T0,)
6999 {
7000 #[inline]
7001 unsafe fn encode(
7002 self,
7003 encoder: &mut fidl::encoding::Encoder<
7004 '_,
7005 fidl::encoding::DefaultFuchsiaResourceDialect,
7006 >,
7007 offset: usize,
7008 depth: fidl::encoding::Depth,
7009 ) -> fidl::Result<()> {
7010 encoder.debug_check_bounds::<PlayerControlBindVolumeControlRequest>(offset);
7011 self.0.encode(encoder, offset + 0, depth)?;
7015 Ok(())
7016 }
7017 }
7018
7019 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7020 for PlayerControlBindVolumeControlRequest
7021 {
7022 #[inline(always)]
7023 fn new_empty() -> Self {
7024 Self {
7025 volume_control_request: fidl::new_empty!(
7026 fidl::encoding::Endpoint<
7027 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
7028 >,
7029 fidl::encoding::DefaultFuchsiaResourceDialect
7030 ),
7031 }
7032 }
7033
7034 #[inline]
7035 unsafe fn decode(
7036 &mut self,
7037 decoder: &mut fidl::encoding::Decoder<
7038 '_,
7039 fidl::encoding::DefaultFuchsiaResourceDialect,
7040 >,
7041 offset: usize,
7042 _depth: fidl::encoding::Depth,
7043 ) -> fidl::Result<()> {
7044 decoder.debug_check_bounds::<Self>(offset);
7045 fidl::decode!(
7047 fidl::encoding::Endpoint<
7048 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
7049 >,
7050 fidl::encoding::DefaultFuchsiaResourceDialect,
7051 &mut self.volume_control_request,
7052 decoder,
7053 offset + 0,
7054 _depth
7055 )?;
7056 Ok(())
7057 }
7058 }
7059
7060 impl fidl::encoding::ResourceTypeMarker for PublisherPublishRequest {
7061 type Borrowed<'a> = &'a mut Self;
7062 fn take_or_borrow<'a>(
7063 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7064 ) -> Self::Borrowed<'a> {
7065 value
7066 }
7067 }
7068
7069 unsafe impl fidl::encoding::TypeMarker for PublisherPublishRequest {
7070 type Owned = Self;
7071
7072 #[inline(always)]
7073 fn inline_align(_context: fidl::encoding::Context) -> usize {
7074 8
7075 }
7076
7077 #[inline(always)]
7078 fn inline_size(_context: fidl::encoding::Context) -> usize {
7079 24
7080 }
7081 }
7082
7083 unsafe impl
7084 fidl::encoding::Encode<
7085 PublisherPublishRequest,
7086 fidl::encoding::DefaultFuchsiaResourceDialect,
7087 > for &mut PublisherPublishRequest
7088 {
7089 #[inline]
7090 unsafe fn encode(
7091 self,
7092 encoder: &mut fidl::encoding::Encoder<
7093 '_,
7094 fidl::encoding::DefaultFuchsiaResourceDialect,
7095 >,
7096 offset: usize,
7097 _depth: fidl::encoding::Depth,
7098 ) -> fidl::Result<()> {
7099 encoder.debug_check_bounds::<PublisherPublishRequest>(offset);
7100 fidl::encoding::Encode::<PublisherPublishRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7102 (
7103 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PlayerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.player),
7104 <PlayerRegistration as fidl::encoding::ValueTypeMarker>::borrow(&self.registration),
7105 ),
7106 encoder, offset, _depth
7107 )
7108 }
7109 }
7110 unsafe impl<
7111 T0: fidl::encoding::Encode<
7112 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PlayerMarker>>,
7113 fidl::encoding::DefaultFuchsiaResourceDialect,
7114 >,
7115 T1: fidl::encoding::Encode<PlayerRegistration, fidl::encoding::DefaultFuchsiaResourceDialect>,
7116 >
7117 fidl::encoding::Encode<
7118 PublisherPublishRequest,
7119 fidl::encoding::DefaultFuchsiaResourceDialect,
7120 > for (T0, T1)
7121 {
7122 #[inline]
7123 unsafe fn encode(
7124 self,
7125 encoder: &mut fidl::encoding::Encoder<
7126 '_,
7127 fidl::encoding::DefaultFuchsiaResourceDialect,
7128 >,
7129 offset: usize,
7130 depth: fidl::encoding::Depth,
7131 ) -> fidl::Result<()> {
7132 encoder.debug_check_bounds::<PublisherPublishRequest>(offset);
7133 unsafe {
7136 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
7137 (ptr as *mut u64).write_unaligned(0);
7138 }
7139 self.0.encode(encoder, offset + 0, depth)?;
7141 self.1.encode(encoder, offset + 8, depth)?;
7142 Ok(())
7143 }
7144 }
7145
7146 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7147 for PublisherPublishRequest
7148 {
7149 #[inline(always)]
7150 fn new_empty() -> Self {
7151 Self {
7152 player: fidl::new_empty!(
7153 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PlayerMarker>>,
7154 fidl::encoding::DefaultFuchsiaResourceDialect
7155 ),
7156 registration: fidl::new_empty!(
7157 PlayerRegistration,
7158 fidl::encoding::DefaultFuchsiaResourceDialect
7159 ),
7160 }
7161 }
7162
7163 #[inline]
7164 unsafe fn decode(
7165 &mut self,
7166 decoder: &mut fidl::encoding::Decoder<
7167 '_,
7168 fidl::encoding::DefaultFuchsiaResourceDialect,
7169 >,
7170 offset: usize,
7171 _depth: fidl::encoding::Depth,
7172 ) -> fidl::Result<()> {
7173 decoder.debug_check_bounds::<Self>(offset);
7174 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
7176 let padval = unsafe { (ptr as *const u64).read_unaligned() };
7177 let mask = 0xffffffff00000000u64;
7178 let maskedval = padval & mask;
7179 if maskedval != 0 {
7180 return Err(fidl::Error::NonZeroPadding {
7181 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
7182 });
7183 }
7184 fidl::decode!(
7185 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PlayerMarker>>,
7186 fidl::encoding::DefaultFuchsiaResourceDialect,
7187 &mut self.player,
7188 decoder,
7189 offset + 0,
7190 _depth
7191 )?;
7192 fidl::decode!(
7193 PlayerRegistration,
7194 fidl::encoding::DefaultFuchsiaResourceDialect,
7195 &mut self.registration,
7196 decoder,
7197 offset + 8,
7198 _depth
7199 )?;
7200 Ok(())
7201 }
7202 }
7203
7204 impl fidl::encoding::ResourceTypeMarker for SessionControlBindVolumeControlRequest {
7205 type Borrowed<'a> = &'a mut Self;
7206 fn take_or_borrow<'a>(
7207 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7208 ) -> Self::Borrowed<'a> {
7209 value
7210 }
7211 }
7212
7213 unsafe impl fidl::encoding::TypeMarker for SessionControlBindVolumeControlRequest {
7214 type Owned = Self;
7215
7216 #[inline(always)]
7217 fn inline_align(_context: fidl::encoding::Context) -> usize {
7218 4
7219 }
7220
7221 #[inline(always)]
7222 fn inline_size(_context: fidl::encoding::Context) -> usize {
7223 4
7224 }
7225 }
7226
7227 unsafe impl
7228 fidl::encoding::Encode<
7229 SessionControlBindVolumeControlRequest,
7230 fidl::encoding::DefaultFuchsiaResourceDialect,
7231 > for &mut SessionControlBindVolumeControlRequest
7232 {
7233 #[inline]
7234 unsafe fn encode(
7235 self,
7236 encoder: &mut fidl::encoding::Encoder<
7237 '_,
7238 fidl::encoding::DefaultFuchsiaResourceDialect,
7239 >,
7240 offset: usize,
7241 _depth: fidl::encoding::Depth,
7242 ) -> fidl::Result<()> {
7243 encoder.debug_check_bounds::<SessionControlBindVolumeControlRequest>(offset);
7244 fidl::encoding::Encode::<
7246 SessionControlBindVolumeControlRequest,
7247 fidl::encoding::DefaultFuchsiaResourceDialect,
7248 >::encode(
7249 (<fidl::encoding::Endpoint<
7250 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
7251 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7252 &mut self.volume_control_request,
7253 ),),
7254 encoder,
7255 offset,
7256 _depth,
7257 )
7258 }
7259 }
7260 unsafe impl<
7261 T0: fidl::encoding::Encode<
7262 fidl::encoding::Endpoint<
7263 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
7264 >,
7265 fidl::encoding::DefaultFuchsiaResourceDialect,
7266 >,
7267 >
7268 fidl::encoding::Encode<
7269 SessionControlBindVolumeControlRequest,
7270 fidl::encoding::DefaultFuchsiaResourceDialect,
7271 > for (T0,)
7272 {
7273 #[inline]
7274 unsafe fn encode(
7275 self,
7276 encoder: &mut fidl::encoding::Encoder<
7277 '_,
7278 fidl::encoding::DefaultFuchsiaResourceDialect,
7279 >,
7280 offset: usize,
7281 depth: fidl::encoding::Depth,
7282 ) -> fidl::Result<()> {
7283 encoder.debug_check_bounds::<SessionControlBindVolumeControlRequest>(offset);
7284 self.0.encode(encoder, offset + 0, depth)?;
7288 Ok(())
7289 }
7290 }
7291
7292 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7293 for SessionControlBindVolumeControlRequest
7294 {
7295 #[inline(always)]
7296 fn new_empty() -> Self {
7297 Self {
7298 volume_control_request: fidl::new_empty!(
7299 fidl::encoding::Endpoint<
7300 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
7301 >,
7302 fidl::encoding::DefaultFuchsiaResourceDialect
7303 ),
7304 }
7305 }
7306
7307 #[inline]
7308 unsafe fn decode(
7309 &mut self,
7310 decoder: &mut fidl::encoding::Decoder<
7311 '_,
7312 fidl::encoding::DefaultFuchsiaResourceDialect,
7313 >,
7314 offset: usize,
7315 _depth: fidl::encoding::Depth,
7316 ) -> fidl::Result<()> {
7317 decoder.debug_check_bounds::<Self>(offset);
7318 fidl::decode!(
7320 fidl::encoding::Endpoint<
7321 fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
7322 >,
7323 fidl::encoding::DefaultFuchsiaResourceDialect,
7324 &mut self.volume_control_request,
7325 decoder,
7326 offset + 0,
7327 _depth
7328 )?;
7329 Ok(())
7330 }
7331 }
7332}