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_ui_activity_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ProviderWatchStateRequest {
16 pub listener: fidl::endpoints::ClientEnd<ListenerMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProviderWatchStateRequest {}
20
21#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
22pub struct ListenerMarker;
23
24impl fidl::endpoints::ProtocolMarker for ListenerMarker {
25 type Proxy = ListenerProxy;
26 type RequestStream = ListenerRequestStream;
27 #[cfg(target_os = "fuchsia")]
28 type SynchronousProxy = ListenerSynchronousProxy;
29
30 const DEBUG_NAME: &'static str = "(anonymous) Listener";
31}
32
33pub trait ListenerProxyInterface: Send + Sync {
34 type OnStateChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
35 fn r#on_state_changed(
36 &self,
37 state: State,
38 transition_time: i64,
39 ) -> Self::OnStateChangedResponseFut;
40}
41#[derive(Debug)]
42#[cfg(target_os = "fuchsia")]
43pub struct ListenerSynchronousProxy {
44 client: fidl::client::sync::Client,
45}
46
47#[cfg(target_os = "fuchsia")]
48impl fidl::endpoints::SynchronousProxy for ListenerSynchronousProxy {
49 type Proxy = ListenerProxy;
50 type Protocol = ListenerMarker;
51
52 fn from_channel(inner: fidl::Channel) -> Self {
53 Self::new(inner)
54 }
55
56 fn into_channel(self) -> fidl::Channel {
57 self.client.into_channel()
58 }
59
60 fn as_channel(&self) -> &fidl::Channel {
61 self.client.as_channel()
62 }
63}
64
65#[cfg(target_os = "fuchsia")]
66impl ListenerSynchronousProxy {
67 pub fn new(channel: fidl::Channel) -> Self {
68 let protocol_name = <ListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
69 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
70 }
71
72 pub fn into_channel(self) -> fidl::Channel {
73 self.client.into_channel()
74 }
75
76 pub fn wait_for_event(
79 &self,
80 deadline: zx::MonotonicInstant,
81 ) -> Result<ListenerEvent, fidl::Error> {
82 ListenerEvent::decode(self.client.wait_for_event(deadline)?)
83 }
84
85 pub fn r#on_state_changed(
89 &self,
90 mut state: State,
91 mut transition_time: i64,
92 ___deadline: zx::MonotonicInstant,
93 ) -> Result<(), fidl::Error> {
94 let _response =
95 self.client.send_query::<ListenerOnStateChangedRequest, fidl::encoding::EmptyPayload>(
96 (state, transition_time),
97 0xf74db3e6d5ba415,
98 fidl::encoding::DynamicFlags::empty(),
99 ___deadline,
100 )?;
101 Ok(_response)
102 }
103}
104
105#[cfg(target_os = "fuchsia")]
106impl From<ListenerSynchronousProxy> for zx::Handle {
107 fn from(value: ListenerSynchronousProxy) -> Self {
108 value.into_channel().into()
109 }
110}
111
112#[cfg(target_os = "fuchsia")]
113impl From<fidl::Channel> for ListenerSynchronousProxy {
114 fn from(value: fidl::Channel) -> Self {
115 Self::new(value)
116 }
117}
118
119#[derive(Debug, Clone)]
120pub struct ListenerProxy {
121 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
122}
123
124impl fidl::endpoints::Proxy for ListenerProxy {
125 type Protocol = ListenerMarker;
126
127 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
128 Self::new(inner)
129 }
130
131 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
132 self.client.into_channel().map_err(|client| Self { client })
133 }
134
135 fn as_channel(&self) -> &::fidl::AsyncChannel {
136 self.client.as_channel()
137 }
138}
139
140impl ListenerProxy {
141 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
143 let protocol_name = <ListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
144 Self { client: fidl::client::Client::new(channel, protocol_name) }
145 }
146
147 pub fn take_event_stream(&self) -> ListenerEventStream {
153 ListenerEventStream { event_receiver: self.client.take_event_receiver() }
154 }
155
156 pub fn r#on_state_changed(
160 &self,
161 mut state: State,
162 mut transition_time: i64,
163 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
164 ListenerProxyInterface::r#on_state_changed(self, state, transition_time)
165 }
166}
167
168impl ListenerProxyInterface for ListenerProxy {
169 type OnStateChangedResponseFut =
170 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
171 fn r#on_state_changed(
172 &self,
173 mut state: State,
174 mut transition_time: i64,
175 ) -> Self::OnStateChangedResponseFut {
176 fn _decode(
177 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
178 ) -> Result<(), fidl::Error> {
179 let _response = fidl::client::decode_transaction_body::<
180 fidl::encoding::EmptyPayload,
181 fidl::encoding::DefaultFuchsiaResourceDialect,
182 0xf74db3e6d5ba415,
183 >(_buf?)?;
184 Ok(_response)
185 }
186 self.client.send_query_and_decode::<ListenerOnStateChangedRequest, ()>(
187 (state, transition_time),
188 0xf74db3e6d5ba415,
189 fidl::encoding::DynamicFlags::empty(),
190 _decode,
191 )
192 }
193}
194
195pub struct ListenerEventStream {
196 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
197}
198
199impl std::marker::Unpin for ListenerEventStream {}
200
201impl futures::stream::FusedStream for ListenerEventStream {
202 fn is_terminated(&self) -> bool {
203 self.event_receiver.is_terminated()
204 }
205}
206
207impl futures::Stream for ListenerEventStream {
208 type Item = Result<ListenerEvent, fidl::Error>;
209
210 fn poll_next(
211 mut self: std::pin::Pin<&mut Self>,
212 cx: &mut std::task::Context<'_>,
213 ) -> std::task::Poll<Option<Self::Item>> {
214 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
215 &mut self.event_receiver,
216 cx
217 )?) {
218 Some(buf) => std::task::Poll::Ready(Some(ListenerEvent::decode(buf))),
219 None => std::task::Poll::Ready(None),
220 }
221 }
222}
223
224#[derive(Debug)]
225pub enum ListenerEvent {}
226
227impl ListenerEvent {
228 fn decode(
230 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
231 ) -> Result<ListenerEvent, fidl::Error> {
232 let (bytes, _handles) = buf.split_mut();
233 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
234 debug_assert_eq!(tx_header.tx_id, 0);
235 match tx_header.ordinal {
236 _ => Err(fidl::Error::UnknownOrdinal {
237 ordinal: tx_header.ordinal,
238 protocol_name: <ListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
239 }),
240 }
241 }
242}
243
244pub struct ListenerRequestStream {
246 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
247 is_terminated: bool,
248}
249
250impl std::marker::Unpin for ListenerRequestStream {}
251
252impl futures::stream::FusedStream for ListenerRequestStream {
253 fn is_terminated(&self) -> bool {
254 self.is_terminated
255 }
256}
257
258impl fidl::endpoints::RequestStream for ListenerRequestStream {
259 type Protocol = ListenerMarker;
260 type ControlHandle = ListenerControlHandle;
261
262 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
263 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
264 }
265
266 fn control_handle(&self) -> Self::ControlHandle {
267 ListenerControlHandle { inner: self.inner.clone() }
268 }
269
270 fn into_inner(
271 self,
272 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
273 {
274 (self.inner, self.is_terminated)
275 }
276
277 fn from_inner(
278 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
279 is_terminated: bool,
280 ) -> Self {
281 Self { inner, is_terminated }
282 }
283}
284
285impl futures::Stream for ListenerRequestStream {
286 type Item = Result<ListenerRequest, fidl::Error>;
287
288 fn poll_next(
289 mut self: std::pin::Pin<&mut Self>,
290 cx: &mut std::task::Context<'_>,
291 ) -> std::task::Poll<Option<Self::Item>> {
292 let this = &mut *self;
293 if this.inner.check_shutdown(cx) {
294 this.is_terminated = true;
295 return std::task::Poll::Ready(None);
296 }
297 if this.is_terminated {
298 panic!("polled ListenerRequestStream after completion");
299 }
300 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
301 |bytes, handles| {
302 match this.inner.channel().read_etc(cx, bytes, handles) {
303 std::task::Poll::Ready(Ok(())) => {}
304 std::task::Poll::Pending => return std::task::Poll::Pending,
305 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
306 this.is_terminated = true;
307 return std::task::Poll::Ready(None);
308 }
309 std::task::Poll::Ready(Err(e)) => {
310 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
311 e.into(),
312 ))))
313 }
314 }
315
316 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
318
319 std::task::Poll::Ready(Some(match header.ordinal {
320 0xf74db3e6d5ba415 => {
321 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
322 let mut req = fidl::new_empty!(
323 ListenerOnStateChangedRequest,
324 fidl::encoding::DefaultFuchsiaResourceDialect
325 );
326 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ListenerOnStateChangedRequest>(&header, _body_bytes, handles, &mut req)?;
327 let control_handle = ListenerControlHandle { inner: this.inner.clone() };
328 Ok(ListenerRequest::OnStateChanged {
329 state: req.state,
330 transition_time: req.transition_time,
331
332 responder: ListenerOnStateChangedResponder {
333 control_handle: std::mem::ManuallyDrop::new(control_handle),
334 tx_id: header.tx_id,
335 },
336 })
337 }
338 _ => Err(fidl::Error::UnknownOrdinal {
339 ordinal: header.ordinal,
340 protocol_name:
341 <ListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
342 }),
343 }))
344 },
345 )
346 }
347}
348
349#[derive(Debug)]
353pub enum ListenerRequest {
354 OnStateChanged {
358 state: State,
359 transition_time: i64,
360 responder: ListenerOnStateChangedResponder,
361 },
362}
363
364impl ListenerRequest {
365 #[allow(irrefutable_let_patterns)]
366 pub fn into_on_state_changed(self) -> Option<(State, i64, ListenerOnStateChangedResponder)> {
367 if let ListenerRequest::OnStateChanged { state, transition_time, responder } = self {
368 Some((state, transition_time, responder))
369 } else {
370 None
371 }
372 }
373
374 pub fn method_name(&self) -> &'static str {
376 match *self {
377 ListenerRequest::OnStateChanged { .. } => "on_state_changed",
378 }
379 }
380}
381
382#[derive(Debug, Clone)]
383pub struct ListenerControlHandle {
384 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
385}
386
387impl fidl::endpoints::ControlHandle for ListenerControlHandle {
388 fn shutdown(&self) {
389 self.inner.shutdown()
390 }
391 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
392 self.inner.shutdown_with_epitaph(status)
393 }
394
395 fn is_closed(&self) -> bool {
396 self.inner.channel().is_closed()
397 }
398 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
399 self.inner.channel().on_closed()
400 }
401
402 #[cfg(target_os = "fuchsia")]
403 fn signal_peer(
404 &self,
405 clear_mask: zx::Signals,
406 set_mask: zx::Signals,
407 ) -> Result<(), zx_status::Status> {
408 use fidl::Peered;
409 self.inner.channel().signal_peer(clear_mask, set_mask)
410 }
411}
412
413impl ListenerControlHandle {}
414
415#[must_use = "FIDL methods require a response to be sent"]
416#[derive(Debug)]
417pub struct ListenerOnStateChangedResponder {
418 control_handle: std::mem::ManuallyDrop<ListenerControlHandle>,
419 tx_id: u32,
420}
421
422impl std::ops::Drop for ListenerOnStateChangedResponder {
426 fn drop(&mut self) {
427 self.control_handle.shutdown();
428 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
430 }
431}
432
433impl fidl::endpoints::Responder for ListenerOnStateChangedResponder {
434 type ControlHandle = ListenerControlHandle;
435
436 fn control_handle(&self) -> &ListenerControlHandle {
437 &self.control_handle
438 }
439
440 fn drop_without_shutdown(mut self) {
441 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
443 std::mem::forget(self);
445 }
446}
447
448impl ListenerOnStateChangedResponder {
449 pub fn send(self) -> Result<(), fidl::Error> {
453 let _result = self.send_raw();
454 if _result.is_err() {
455 self.control_handle.shutdown();
456 }
457 self.drop_without_shutdown();
458 _result
459 }
460
461 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
463 let _result = self.send_raw();
464 self.drop_without_shutdown();
465 _result
466 }
467
468 fn send_raw(&self) -> Result<(), fidl::Error> {
469 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
470 (),
471 self.tx_id,
472 0xf74db3e6d5ba415,
473 fidl::encoding::DynamicFlags::empty(),
474 )
475 }
476}
477
478#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
479pub struct ProviderMarker;
480
481impl fidl::endpoints::ProtocolMarker for ProviderMarker {
482 type Proxy = ProviderProxy;
483 type RequestStream = ProviderRequestStream;
484 #[cfg(target_os = "fuchsia")]
485 type SynchronousProxy = ProviderSynchronousProxy;
486
487 const DEBUG_NAME: &'static str = "fuchsia.ui.activity.Provider";
488}
489impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
490
491pub trait ProviderProxyInterface: Send + Sync {
492 fn r#watch_state(
493 &self,
494 listener: fidl::endpoints::ClientEnd<ListenerMarker>,
495 ) -> Result<(), fidl::Error>;
496}
497#[derive(Debug)]
498#[cfg(target_os = "fuchsia")]
499pub struct ProviderSynchronousProxy {
500 client: fidl::client::sync::Client,
501}
502
503#[cfg(target_os = "fuchsia")]
504impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
505 type Proxy = ProviderProxy;
506 type Protocol = ProviderMarker;
507
508 fn from_channel(inner: fidl::Channel) -> Self {
509 Self::new(inner)
510 }
511
512 fn into_channel(self) -> fidl::Channel {
513 self.client.into_channel()
514 }
515
516 fn as_channel(&self) -> &fidl::Channel {
517 self.client.as_channel()
518 }
519}
520
521#[cfg(target_os = "fuchsia")]
522impl ProviderSynchronousProxy {
523 pub fn new(channel: fidl::Channel) -> Self {
524 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
525 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
526 }
527
528 pub fn into_channel(self) -> fidl::Channel {
529 self.client.into_channel()
530 }
531
532 pub fn wait_for_event(
535 &self,
536 deadline: zx::MonotonicInstant,
537 ) -> Result<ProviderEvent, fidl::Error> {
538 ProviderEvent::decode(self.client.wait_for_event(deadline)?)
539 }
540
541 pub fn r#watch_state(
546 &self,
547 mut listener: fidl::endpoints::ClientEnd<ListenerMarker>,
548 ) -> Result<(), fidl::Error> {
549 self.client.send::<ProviderWatchStateRequest>(
550 (listener,),
551 0x592e25a4cbe7f884,
552 fidl::encoding::DynamicFlags::empty(),
553 )
554 }
555}
556
557#[cfg(target_os = "fuchsia")]
558impl From<ProviderSynchronousProxy> for zx::Handle {
559 fn from(value: ProviderSynchronousProxy) -> Self {
560 value.into_channel().into()
561 }
562}
563
564#[cfg(target_os = "fuchsia")]
565impl From<fidl::Channel> for ProviderSynchronousProxy {
566 fn from(value: fidl::Channel) -> Self {
567 Self::new(value)
568 }
569}
570
571#[derive(Debug, Clone)]
572pub struct ProviderProxy {
573 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
574}
575
576impl fidl::endpoints::Proxy for ProviderProxy {
577 type Protocol = ProviderMarker;
578
579 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
580 Self::new(inner)
581 }
582
583 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
584 self.client.into_channel().map_err(|client| Self { client })
585 }
586
587 fn as_channel(&self) -> &::fidl::AsyncChannel {
588 self.client.as_channel()
589 }
590}
591
592impl ProviderProxy {
593 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
595 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
596 Self { client: fidl::client::Client::new(channel, protocol_name) }
597 }
598
599 pub fn take_event_stream(&self) -> ProviderEventStream {
605 ProviderEventStream { event_receiver: self.client.take_event_receiver() }
606 }
607
608 pub fn r#watch_state(
613 &self,
614 mut listener: fidl::endpoints::ClientEnd<ListenerMarker>,
615 ) -> Result<(), fidl::Error> {
616 ProviderProxyInterface::r#watch_state(self, listener)
617 }
618}
619
620impl ProviderProxyInterface for ProviderProxy {
621 fn r#watch_state(
622 &self,
623 mut listener: fidl::endpoints::ClientEnd<ListenerMarker>,
624 ) -> Result<(), fidl::Error> {
625 self.client.send::<ProviderWatchStateRequest>(
626 (listener,),
627 0x592e25a4cbe7f884,
628 fidl::encoding::DynamicFlags::empty(),
629 )
630 }
631}
632
633pub struct ProviderEventStream {
634 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
635}
636
637impl std::marker::Unpin for ProviderEventStream {}
638
639impl futures::stream::FusedStream for ProviderEventStream {
640 fn is_terminated(&self) -> bool {
641 self.event_receiver.is_terminated()
642 }
643}
644
645impl futures::Stream for ProviderEventStream {
646 type Item = Result<ProviderEvent, fidl::Error>;
647
648 fn poll_next(
649 mut self: std::pin::Pin<&mut Self>,
650 cx: &mut std::task::Context<'_>,
651 ) -> std::task::Poll<Option<Self::Item>> {
652 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
653 &mut self.event_receiver,
654 cx
655 )?) {
656 Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
657 None => std::task::Poll::Ready(None),
658 }
659 }
660}
661
662#[derive(Debug)]
663pub enum ProviderEvent {}
664
665impl ProviderEvent {
666 fn decode(
668 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
669 ) -> Result<ProviderEvent, fidl::Error> {
670 let (bytes, _handles) = buf.split_mut();
671 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
672 debug_assert_eq!(tx_header.tx_id, 0);
673 match tx_header.ordinal {
674 _ => Err(fidl::Error::UnknownOrdinal {
675 ordinal: tx_header.ordinal,
676 protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
677 }),
678 }
679 }
680}
681
682pub struct ProviderRequestStream {
684 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
685 is_terminated: bool,
686}
687
688impl std::marker::Unpin for ProviderRequestStream {}
689
690impl futures::stream::FusedStream for ProviderRequestStream {
691 fn is_terminated(&self) -> bool {
692 self.is_terminated
693 }
694}
695
696impl fidl::endpoints::RequestStream for ProviderRequestStream {
697 type Protocol = ProviderMarker;
698 type ControlHandle = ProviderControlHandle;
699
700 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
701 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
702 }
703
704 fn control_handle(&self) -> Self::ControlHandle {
705 ProviderControlHandle { inner: self.inner.clone() }
706 }
707
708 fn into_inner(
709 self,
710 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
711 {
712 (self.inner, self.is_terminated)
713 }
714
715 fn from_inner(
716 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
717 is_terminated: bool,
718 ) -> Self {
719 Self { inner, is_terminated }
720 }
721}
722
723impl futures::Stream for ProviderRequestStream {
724 type Item = Result<ProviderRequest, fidl::Error>;
725
726 fn poll_next(
727 mut self: std::pin::Pin<&mut Self>,
728 cx: &mut std::task::Context<'_>,
729 ) -> std::task::Poll<Option<Self::Item>> {
730 let this = &mut *self;
731 if this.inner.check_shutdown(cx) {
732 this.is_terminated = true;
733 return std::task::Poll::Ready(None);
734 }
735 if this.is_terminated {
736 panic!("polled ProviderRequestStream after completion");
737 }
738 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
739 |bytes, handles| {
740 match this.inner.channel().read_etc(cx, bytes, handles) {
741 std::task::Poll::Ready(Ok(())) => {}
742 std::task::Poll::Pending => return std::task::Poll::Pending,
743 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
744 this.is_terminated = true;
745 return std::task::Poll::Ready(None);
746 }
747 std::task::Poll::Ready(Err(e)) => {
748 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
749 e.into(),
750 ))))
751 }
752 }
753
754 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
756
757 std::task::Poll::Ready(Some(match header.ordinal {
758 0x592e25a4cbe7f884 => {
759 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
760 let mut req = fidl::new_empty!(
761 ProviderWatchStateRequest,
762 fidl::encoding::DefaultFuchsiaResourceDialect
763 );
764 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderWatchStateRequest>(&header, _body_bytes, handles, &mut req)?;
765 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
766 Ok(ProviderRequest::WatchState { listener: req.listener, control_handle })
767 }
768 _ => Err(fidl::Error::UnknownOrdinal {
769 ordinal: header.ordinal,
770 protocol_name:
771 <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
772 }),
773 }))
774 },
775 )
776 }
777}
778
779#[derive(Debug)]
782pub enum ProviderRequest {
783 WatchState {
788 listener: fidl::endpoints::ClientEnd<ListenerMarker>,
789 control_handle: ProviderControlHandle,
790 },
791}
792
793impl ProviderRequest {
794 #[allow(irrefutable_let_patterns)]
795 pub fn into_watch_state(
796 self,
797 ) -> Option<(fidl::endpoints::ClientEnd<ListenerMarker>, ProviderControlHandle)> {
798 if let ProviderRequest::WatchState { listener, control_handle } = self {
799 Some((listener, control_handle))
800 } else {
801 None
802 }
803 }
804
805 pub fn method_name(&self) -> &'static str {
807 match *self {
808 ProviderRequest::WatchState { .. } => "watch_state",
809 }
810 }
811}
812
813#[derive(Debug, Clone)]
814pub struct ProviderControlHandle {
815 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
816}
817
818impl fidl::endpoints::ControlHandle for ProviderControlHandle {
819 fn shutdown(&self) {
820 self.inner.shutdown()
821 }
822 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
823 self.inner.shutdown_with_epitaph(status)
824 }
825
826 fn is_closed(&self) -> bool {
827 self.inner.channel().is_closed()
828 }
829 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
830 self.inner.channel().on_closed()
831 }
832
833 #[cfg(target_os = "fuchsia")]
834 fn signal_peer(
835 &self,
836 clear_mask: zx::Signals,
837 set_mask: zx::Signals,
838 ) -> Result<(), zx_status::Status> {
839 use fidl::Peered;
840 self.inner.channel().signal_peer(clear_mask, set_mask)
841 }
842}
843
844impl ProviderControlHandle {}
845
846mod internal {
847 use super::*;
848
849 impl fidl::encoding::ResourceTypeMarker for ProviderWatchStateRequest {
850 type Borrowed<'a> = &'a mut Self;
851 fn take_or_borrow<'a>(
852 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
853 ) -> Self::Borrowed<'a> {
854 value
855 }
856 }
857
858 unsafe impl fidl::encoding::TypeMarker for ProviderWatchStateRequest {
859 type Owned = Self;
860
861 #[inline(always)]
862 fn inline_align(_context: fidl::encoding::Context) -> usize {
863 4
864 }
865
866 #[inline(always)]
867 fn inline_size(_context: fidl::encoding::Context) -> usize {
868 4
869 }
870 }
871
872 unsafe impl
873 fidl::encoding::Encode<
874 ProviderWatchStateRequest,
875 fidl::encoding::DefaultFuchsiaResourceDialect,
876 > for &mut ProviderWatchStateRequest
877 {
878 #[inline]
879 unsafe fn encode(
880 self,
881 encoder: &mut fidl::encoding::Encoder<
882 '_,
883 fidl::encoding::DefaultFuchsiaResourceDialect,
884 >,
885 offset: usize,
886 _depth: fidl::encoding::Depth,
887 ) -> fidl::Result<()> {
888 encoder.debug_check_bounds::<ProviderWatchStateRequest>(offset);
889 fidl::encoding::Encode::<ProviderWatchStateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
891 (
892 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listener),
893 ),
894 encoder, offset, _depth
895 )
896 }
897 }
898 unsafe impl<
899 T0: fidl::encoding::Encode<
900 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ListenerMarker>>,
901 fidl::encoding::DefaultFuchsiaResourceDialect,
902 >,
903 >
904 fidl::encoding::Encode<
905 ProviderWatchStateRequest,
906 fidl::encoding::DefaultFuchsiaResourceDialect,
907 > for (T0,)
908 {
909 #[inline]
910 unsafe fn encode(
911 self,
912 encoder: &mut fidl::encoding::Encoder<
913 '_,
914 fidl::encoding::DefaultFuchsiaResourceDialect,
915 >,
916 offset: usize,
917 depth: fidl::encoding::Depth,
918 ) -> fidl::Result<()> {
919 encoder.debug_check_bounds::<ProviderWatchStateRequest>(offset);
920 self.0.encode(encoder, offset + 0, depth)?;
924 Ok(())
925 }
926 }
927
928 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
929 for ProviderWatchStateRequest
930 {
931 #[inline(always)]
932 fn new_empty() -> Self {
933 Self {
934 listener: fidl::new_empty!(
935 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ListenerMarker>>,
936 fidl::encoding::DefaultFuchsiaResourceDialect
937 ),
938 }
939 }
940
941 #[inline]
942 unsafe fn decode(
943 &mut self,
944 decoder: &mut fidl::encoding::Decoder<
945 '_,
946 fidl::encoding::DefaultFuchsiaResourceDialect,
947 >,
948 offset: usize,
949 _depth: fidl::encoding::Depth,
950 ) -> fidl::Result<()> {
951 decoder.debug_check_bounds::<Self>(offset);
952 fidl::decode!(
954 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ListenerMarker>>,
955 fidl::encoding::DefaultFuchsiaResourceDialect,
956 &mut self.listener,
957 decoder,
958 offset + 0,
959 _depth
960 )?;
961 Ok(())
962 }
963 }
964}