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