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_thermal__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ClientStateConnectorConnectRequest {
16 pub client_type: String,
17 pub watcher: fidl::endpoints::ServerEnd<ClientStateWatcherMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for ClientStateConnectorConnectRequest
22{
23}
24
25#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub struct ClientStateConnectorMarker;
27
28impl fidl::endpoints::ProtocolMarker for ClientStateConnectorMarker {
29 type Proxy = ClientStateConnectorProxy;
30 type RequestStream = ClientStateConnectorRequestStream;
31 #[cfg(target_os = "fuchsia")]
32 type SynchronousProxy = ClientStateConnectorSynchronousProxy;
33
34 const DEBUG_NAME: &'static str = "fuchsia.thermal.ClientStateConnector";
35}
36impl fidl::endpoints::DiscoverableProtocolMarker for ClientStateConnectorMarker {}
37
38pub trait ClientStateConnectorProxyInterface: Send + Sync {
39 fn r#connect(
40 &self,
41 client_type: &str,
42 watcher: fidl::endpoints::ServerEnd<ClientStateWatcherMarker>,
43 ) -> Result<(), fidl::Error>;
44}
45#[derive(Debug)]
46#[cfg(target_os = "fuchsia")]
47pub struct ClientStateConnectorSynchronousProxy {
48 client: fidl::client::sync::Client,
49}
50
51#[cfg(target_os = "fuchsia")]
52impl fidl::endpoints::SynchronousProxy for ClientStateConnectorSynchronousProxy {
53 type Proxy = ClientStateConnectorProxy;
54 type Protocol = ClientStateConnectorMarker;
55
56 fn from_channel(inner: fidl::Channel) -> Self {
57 Self::new(inner)
58 }
59
60 fn into_channel(self) -> fidl::Channel {
61 self.client.into_channel()
62 }
63
64 fn as_channel(&self) -> &fidl::Channel {
65 self.client.as_channel()
66 }
67}
68
69#[cfg(target_os = "fuchsia")]
70impl ClientStateConnectorSynchronousProxy {
71 pub fn new(channel: fidl::Channel) -> Self {
72 let protocol_name =
73 <ClientStateConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
74 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
75 }
76
77 pub fn into_channel(self) -> fidl::Channel {
78 self.client.into_channel()
79 }
80
81 pub fn wait_for_event(
84 &self,
85 deadline: zx::MonotonicInstant,
86 ) -> Result<ClientStateConnectorEvent, fidl::Error> {
87 ClientStateConnectorEvent::decode(self.client.wait_for_event(deadline)?)
88 }
89
90 pub fn r#connect(
108 &self,
109 mut client_type: &str,
110 mut watcher: fidl::endpoints::ServerEnd<ClientStateWatcherMarker>,
111 ) -> Result<(), fidl::Error> {
112 self.client.send::<ClientStateConnectorConnectRequest>(
113 (client_type, watcher),
114 0x65abd3ba57ddaa1d,
115 fidl::encoding::DynamicFlags::empty(),
116 )
117 }
118}
119
120#[cfg(target_os = "fuchsia")]
121impl From<ClientStateConnectorSynchronousProxy> for zx::Handle {
122 fn from(value: ClientStateConnectorSynchronousProxy) -> Self {
123 value.into_channel().into()
124 }
125}
126
127#[cfg(target_os = "fuchsia")]
128impl From<fidl::Channel> for ClientStateConnectorSynchronousProxy {
129 fn from(value: fidl::Channel) -> Self {
130 Self::new(value)
131 }
132}
133
134#[cfg(target_os = "fuchsia")]
135impl fidl::endpoints::FromClient for ClientStateConnectorSynchronousProxy {
136 type Protocol = ClientStateConnectorMarker;
137
138 fn from_client(value: fidl::endpoints::ClientEnd<ClientStateConnectorMarker>) -> Self {
139 Self::new(value.into_channel())
140 }
141}
142
143#[derive(Debug, Clone)]
144pub struct ClientStateConnectorProxy {
145 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
146}
147
148impl fidl::endpoints::Proxy for ClientStateConnectorProxy {
149 type Protocol = ClientStateConnectorMarker;
150
151 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
152 Self::new(inner)
153 }
154
155 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
156 self.client.into_channel().map_err(|client| Self { client })
157 }
158
159 fn as_channel(&self) -> &::fidl::AsyncChannel {
160 self.client.as_channel()
161 }
162}
163
164impl ClientStateConnectorProxy {
165 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
167 let protocol_name =
168 <ClientStateConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
169 Self { client: fidl::client::Client::new(channel, protocol_name) }
170 }
171
172 pub fn take_event_stream(&self) -> ClientStateConnectorEventStream {
178 ClientStateConnectorEventStream { event_receiver: self.client.take_event_receiver() }
179 }
180
181 pub fn r#connect(
199 &self,
200 mut client_type: &str,
201 mut watcher: fidl::endpoints::ServerEnd<ClientStateWatcherMarker>,
202 ) -> Result<(), fidl::Error> {
203 ClientStateConnectorProxyInterface::r#connect(self, client_type, watcher)
204 }
205}
206
207impl ClientStateConnectorProxyInterface for ClientStateConnectorProxy {
208 fn r#connect(
209 &self,
210 mut client_type: &str,
211 mut watcher: fidl::endpoints::ServerEnd<ClientStateWatcherMarker>,
212 ) -> Result<(), fidl::Error> {
213 self.client.send::<ClientStateConnectorConnectRequest>(
214 (client_type, watcher),
215 0x65abd3ba57ddaa1d,
216 fidl::encoding::DynamicFlags::empty(),
217 )
218 }
219}
220
221pub struct ClientStateConnectorEventStream {
222 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
223}
224
225impl std::marker::Unpin for ClientStateConnectorEventStream {}
226
227impl futures::stream::FusedStream for ClientStateConnectorEventStream {
228 fn is_terminated(&self) -> bool {
229 self.event_receiver.is_terminated()
230 }
231}
232
233impl futures::Stream for ClientStateConnectorEventStream {
234 type Item = Result<ClientStateConnectorEvent, fidl::Error>;
235
236 fn poll_next(
237 mut self: std::pin::Pin<&mut Self>,
238 cx: &mut std::task::Context<'_>,
239 ) -> std::task::Poll<Option<Self::Item>> {
240 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
241 &mut self.event_receiver,
242 cx
243 )?) {
244 Some(buf) => std::task::Poll::Ready(Some(ClientStateConnectorEvent::decode(buf))),
245 None => std::task::Poll::Ready(None),
246 }
247 }
248}
249
250#[derive(Debug)]
251pub enum ClientStateConnectorEvent {}
252
253impl ClientStateConnectorEvent {
254 fn decode(
256 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
257 ) -> Result<ClientStateConnectorEvent, fidl::Error> {
258 let (bytes, _handles) = buf.split_mut();
259 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
260 debug_assert_eq!(tx_header.tx_id, 0);
261 match tx_header.ordinal {
262 _ => Err(fidl::Error::UnknownOrdinal {
263 ordinal: tx_header.ordinal,
264 protocol_name:
265 <ClientStateConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
266 }),
267 }
268 }
269}
270
271pub struct ClientStateConnectorRequestStream {
273 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
274 is_terminated: bool,
275}
276
277impl std::marker::Unpin for ClientStateConnectorRequestStream {}
278
279impl futures::stream::FusedStream for ClientStateConnectorRequestStream {
280 fn is_terminated(&self) -> bool {
281 self.is_terminated
282 }
283}
284
285impl fidl::endpoints::RequestStream for ClientStateConnectorRequestStream {
286 type Protocol = ClientStateConnectorMarker;
287 type ControlHandle = ClientStateConnectorControlHandle;
288
289 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
290 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
291 }
292
293 fn control_handle(&self) -> Self::ControlHandle {
294 ClientStateConnectorControlHandle { inner: self.inner.clone() }
295 }
296
297 fn into_inner(
298 self,
299 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
300 {
301 (self.inner, self.is_terminated)
302 }
303
304 fn from_inner(
305 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
306 is_terminated: bool,
307 ) -> Self {
308 Self { inner, is_terminated }
309 }
310}
311
312impl futures::Stream for ClientStateConnectorRequestStream {
313 type Item = Result<ClientStateConnectorRequest, fidl::Error>;
314
315 fn poll_next(
316 mut self: std::pin::Pin<&mut Self>,
317 cx: &mut std::task::Context<'_>,
318 ) -> std::task::Poll<Option<Self::Item>> {
319 let this = &mut *self;
320 if this.inner.check_shutdown(cx) {
321 this.is_terminated = true;
322 return std::task::Poll::Ready(None);
323 }
324 if this.is_terminated {
325 panic!("polled ClientStateConnectorRequestStream after completion");
326 }
327 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
328 |bytes, handles| {
329 match this.inner.channel().read_etc(cx, bytes, handles) {
330 std::task::Poll::Ready(Ok(())) => {}
331 std::task::Poll::Pending => return std::task::Poll::Pending,
332 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
333 this.is_terminated = true;
334 return std::task::Poll::Ready(None);
335 }
336 std::task::Poll::Ready(Err(e)) => {
337 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
338 e.into(),
339 ))))
340 }
341 }
342
343 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
345
346 std::task::Poll::Ready(Some(match header.ordinal {
347 0x65abd3ba57ddaa1d => {
348 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
349 let mut req = fidl::new_empty!(ClientStateConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
350 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientStateConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
351 let control_handle = ClientStateConnectorControlHandle {
352 inner: this.inner.clone(),
353 };
354 Ok(ClientStateConnectorRequest::Connect {client_type: req.client_type,
355watcher: req.watcher,
356
357 control_handle,
358 })
359 }
360 _ => Err(fidl::Error::UnknownOrdinal {
361 ordinal: header.ordinal,
362 protocol_name: <ClientStateConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
363 }),
364 }))
365 },
366 )
367 }
368}
369
370#[derive(Debug)]
373pub enum ClientStateConnectorRequest {
374 Connect {
392 client_type: String,
393 watcher: fidl::endpoints::ServerEnd<ClientStateWatcherMarker>,
394 control_handle: ClientStateConnectorControlHandle,
395 },
396}
397
398impl ClientStateConnectorRequest {
399 #[allow(irrefutable_let_patterns)]
400 pub fn into_connect(
401 self,
402 ) -> Option<(
403 String,
404 fidl::endpoints::ServerEnd<ClientStateWatcherMarker>,
405 ClientStateConnectorControlHandle,
406 )> {
407 if let ClientStateConnectorRequest::Connect { client_type, watcher, control_handle } = self
408 {
409 Some((client_type, watcher, control_handle))
410 } else {
411 None
412 }
413 }
414
415 pub fn method_name(&self) -> &'static str {
417 match *self {
418 ClientStateConnectorRequest::Connect { .. } => "connect",
419 }
420 }
421}
422
423#[derive(Debug, Clone)]
424pub struct ClientStateConnectorControlHandle {
425 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
426}
427
428impl fidl::endpoints::ControlHandle for ClientStateConnectorControlHandle {
429 fn shutdown(&self) {
430 self.inner.shutdown()
431 }
432 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
433 self.inner.shutdown_with_epitaph(status)
434 }
435
436 fn is_closed(&self) -> bool {
437 self.inner.channel().is_closed()
438 }
439 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
440 self.inner.channel().on_closed()
441 }
442
443 #[cfg(target_os = "fuchsia")]
444 fn signal_peer(
445 &self,
446 clear_mask: zx::Signals,
447 set_mask: zx::Signals,
448 ) -> Result<(), zx_status::Status> {
449 use fidl::Peered;
450 self.inner.channel().signal_peer(clear_mask, set_mask)
451 }
452}
453
454impl ClientStateConnectorControlHandle {}
455
456#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
457pub struct ClientStateWatcherMarker;
458
459impl fidl::endpoints::ProtocolMarker for ClientStateWatcherMarker {
460 type Proxy = ClientStateWatcherProxy;
461 type RequestStream = ClientStateWatcherRequestStream;
462 #[cfg(target_os = "fuchsia")]
463 type SynchronousProxy = ClientStateWatcherSynchronousProxy;
464
465 const DEBUG_NAME: &'static str = "(anonymous) ClientStateWatcher";
466}
467
468pub trait ClientStateWatcherProxyInterface: Send + Sync {
469 type WatchResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
470 fn r#watch(&self) -> Self::WatchResponseFut;
471}
472#[derive(Debug)]
473#[cfg(target_os = "fuchsia")]
474pub struct ClientStateWatcherSynchronousProxy {
475 client: fidl::client::sync::Client,
476}
477
478#[cfg(target_os = "fuchsia")]
479impl fidl::endpoints::SynchronousProxy for ClientStateWatcherSynchronousProxy {
480 type Proxy = ClientStateWatcherProxy;
481 type Protocol = ClientStateWatcherMarker;
482
483 fn from_channel(inner: fidl::Channel) -> Self {
484 Self::new(inner)
485 }
486
487 fn into_channel(self) -> fidl::Channel {
488 self.client.into_channel()
489 }
490
491 fn as_channel(&self) -> &fidl::Channel {
492 self.client.as_channel()
493 }
494}
495
496#[cfg(target_os = "fuchsia")]
497impl ClientStateWatcherSynchronousProxy {
498 pub fn new(channel: fidl::Channel) -> Self {
499 let protocol_name =
500 <ClientStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
501 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
502 }
503
504 pub fn into_channel(self) -> fidl::Channel {
505 self.client.into_channel()
506 }
507
508 pub fn wait_for_event(
511 &self,
512 deadline: zx::MonotonicInstant,
513 ) -> Result<ClientStateWatcherEvent, fidl::Error> {
514 ClientStateWatcherEvent::decode(self.client.wait_for_event(deadline)?)
515 }
516
517 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<u64, fidl::Error> {
534 let _response = self
535 .client
536 .send_query::<fidl::encoding::EmptyPayload, ClientStateWatcherWatchResponse>(
537 (),
538 0x44831316a9942f7e,
539 fidl::encoding::DynamicFlags::empty(),
540 ___deadline,
541 )?;
542 Ok(_response.state)
543 }
544}
545
546#[cfg(target_os = "fuchsia")]
547impl From<ClientStateWatcherSynchronousProxy> for zx::Handle {
548 fn from(value: ClientStateWatcherSynchronousProxy) -> Self {
549 value.into_channel().into()
550 }
551}
552
553#[cfg(target_os = "fuchsia")]
554impl From<fidl::Channel> for ClientStateWatcherSynchronousProxy {
555 fn from(value: fidl::Channel) -> Self {
556 Self::new(value)
557 }
558}
559
560#[cfg(target_os = "fuchsia")]
561impl fidl::endpoints::FromClient for ClientStateWatcherSynchronousProxy {
562 type Protocol = ClientStateWatcherMarker;
563
564 fn from_client(value: fidl::endpoints::ClientEnd<ClientStateWatcherMarker>) -> Self {
565 Self::new(value.into_channel())
566 }
567}
568
569#[derive(Debug, Clone)]
570pub struct ClientStateWatcherProxy {
571 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
572}
573
574impl fidl::endpoints::Proxy for ClientStateWatcherProxy {
575 type Protocol = ClientStateWatcherMarker;
576
577 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
578 Self::new(inner)
579 }
580
581 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
582 self.client.into_channel().map_err(|client| Self { client })
583 }
584
585 fn as_channel(&self) -> &::fidl::AsyncChannel {
586 self.client.as_channel()
587 }
588}
589
590impl ClientStateWatcherProxy {
591 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
593 let protocol_name =
594 <ClientStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
595 Self { client: fidl::client::Client::new(channel, protocol_name) }
596 }
597
598 pub fn take_event_stream(&self) -> ClientStateWatcherEventStream {
604 ClientStateWatcherEventStream { event_receiver: self.client.take_event_receiver() }
605 }
606
607 pub fn r#watch(
624 &self,
625 ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
626 ClientStateWatcherProxyInterface::r#watch(self)
627 }
628}
629
630impl ClientStateWatcherProxyInterface for ClientStateWatcherProxy {
631 type WatchResponseFut =
632 fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
633 fn r#watch(&self) -> Self::WatchResponseFut {
634 fn _decode(
635 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
636 ) -> Result<u64, fidl::Error> {
637 let _response = fidl::client::decode_transaction_body::<
638 ClientStateWatcherWatchResponse,
639 fidl::encoding::DefaultFuchsiaResourceDialect,
640 0x44831316a9942f7e,
641 >(_buf?)?;
642 Ok(_response.state)
643 }
644 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
645 (),
646 0x44831316a9942f7e,
647 fidl::encoding::DynamicFlags::empty(),
648 _decode,
649 )
650 }
651}
652
653pub struct ClientStateWatcherEventStream {
654 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
655}
656
657impl std::marker::Unpin for ClientStateWatcherEventStream {}
658
659impl futures::stream::FusedStream for ClientStateWatcherEventStream {
660 fn is_terminated(&self) -> bool {
661 self.event_receiver.is_terminated()
662 }
663}
664
665impl futures::Stream for ClientStateWatcherEventStream {
666 type Item = Result<ClientStateWatcherEvent, fidl::Error>;
667
668 fn poll_next(
669 mut self: std::pin::Pin<&mut Self>,
670 cx: &mut std::task::Context<'_>,
671 ) -> std::task::Poll<Option<Self::Item>> {
672 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
673 &mut self.event_receiver,
674 cx
675 )?) {
676 Some(buf) => std::task::Poll::Ready(Some(ClientStateWatcherEvent::decode(buf))),
677 None => std::task::Poll::Ready(None),
678 }
679 }
680}
681
682#[derive(Debug)]
683pub enum ClientStateWatcherEvent {}
684
685impl ClientStateWatcherEvent {
686 fn decode(
688 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
689 ) -> Result<ClientStateWatcherEvent, fidl::Error> {
690 let (bytes, _handles) = buf.split_mut();
691 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
692 debug_assert_eq!(tx_header.tx_id, 0);
693 match tx_header.ordinal {
694 _ => Err(fidl::Error::UnknownOrdinal {
695 ordinal: tx_header.ordinal,
696 protocol_name:
697 <ClientStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
698 }),
699 }
700 }
701}
702
703pub struct ClientStateWatcherRequestStream {
705 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
706 is_terminated: bool,
707}
708
709impl std::marker::Unpin for ClientStateWatcherRequestStream {}
710
711impl futures::stream::FusedStream for ClientStateWatcherRequestStream {
712 fn is_terminated(&self) -> bool {
713 self.is_terminated
714 }
715}
716
717impl fidl::endpoints::RequestStream for ClientStateWatcherRequestStream {
718 type Protocol = ClientStateWatcherMarker;
719 type ControlHandle = ClientStateWatcherControlHandle;
720
721 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
722 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
723 }
724
725 fn control_handle(&self) -> Self::ControlHandle {
726 ClientStateWatcherControlHandle { inner: self.inner.clone() }
727 }
728
729 fn into_inner(
730 self,
731 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
732 {
733 (self.inner, self.is_terminated)
734 }
735
736 fn from_inner(
737 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
738 is_terminated: bool,
739 ) -> Self {
740 Self { inner, is_terminated }
741 }
742}
743
744impl futures::Stream for ClientStateWatcherRequestStream {
745 type Item = Result<ClientStateWatcherRequest, fidl::Error>;
746
747 fn poll_next(
748 mut self: std::pin::Pin<&mut Self>,
749 cx: &mut std::task::Context<'_>,
750 ) -> std::task::Poll<Option<Self::Item>> {
751 let this = &mut *self;
752 if this.inner.check_shutdown(cx) {
753 this.is_terminated = true;
754 return std::task::Poll::Ready(None);
755 }
756 if this.is_terminated {
757 panic!("polled ClientStateWatcherRequestStream after completion");
758 }
759 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
760 |bytes, handles| {
761 match this.inner.channel().read_etc(cx, bytes, handles) {
762 std::task::Poll::Ready(Ok(())) => {}
763 std::task::Poll::Pending => return std::task::Poll::Pending,
764 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
765 this.is_terminated = true;
766 return std::task::Poll::Ready(None);
767 }
768 std::task::Poll::Ready(Err(e)) => {
769 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
770 e.into(),
771 ))))
772 }
773 }
774
775 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
777
778 std::task::Poll::Ready(Some(match header.ordinal {
779 0x44831316a9942f7e => {
780 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
781 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
782 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
783 let control_handle = ClientStateWatcherControlHandle {
784 inner: this.inner.clone(),
785 };
786 Ok(ClientStateWatcherRequest::Watch {
787 responder: ClientStateWatcherWatchResponder {
788 control_handle: std::mem::ManuallyDrop::new(control_handle),
789 tx_id: header.tx_id,
790 },
791 })
792 }
793 _ => Err(fidl::Error::UnknownOrdinal {
794 ordinal: header.ordinal,
795 protocol_name: <ClientStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
796 }),
797 }))
798 },
799 )
800 }
801}
802
803#[derive(Debug)]
812pub enum ClientStateWatcherRequest {
813 Watch { responder: ClientStateWatcherWatchResponder },
830}
831
832impl ClientStateWatcherRequest {
833 #[allow(irrefutable_let_patterns)]
834 pub fn into_watch(self) -> Option<(ClientStateWatcherWatchResponder)> {
835 if let ClientStateWatcherRequest::Watch { responder } = self {
836 Some((responder))
837 } else {
838 None
839 }
840 }
841
842 pub fn method_name(&self) -> &'static str {
844 match *self {
845 ClientStateWatcherRequest::Watch { .. } => "watch",
846 }
847 }
848}
849
850#[derive(Debug, Clone)]
851pub struct ClientStateWatcherControlHandle {
852 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
853}
854
855impl fidl::endpoints::ControlHandle for ClientStateWatcherControlHandle {
856 fn shutdown(&self) {
857 self.inner.shutdown()
858 }
859 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
860 self.inner.shutdown_with_epitaph(status)
861 }
862
863 fn is_closed(&self) -> bool {
864 self.inner.channel().is_closed()
865 }
866 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
867 self.inner.channel().on_closed()
868 }
869
870 #[cfg(target_os = "fuchsia")]
871 fn signal_peer(
872 &self,
873 clear_mask: zx::Signals,
874 set_mask: zx::Signals,
875 ) -> Result<(), zx_status::Status> {
876 use fidl::Peered;
877 self.inner.channel().signal_peer(clear_mask, set_mask)
878 }
879}
880
881impl ClientStateWatcherControlHandle {}
882
883#[must_use = "FIDL methods require a response to be sent"]
884#[derive(Debug)]
885pub struct ClientStateWatcherWatchResponder {
886 control_handle: std::mem::ManuallyDrop<ClientStateWatcherControlHandle>,
887 tx_id: u32,
888}
889
890impl std::ops::Drop for ClientStateWatcherWatchResponder {
894 fn drop(&mut self) {
895 self.control_handle.shutdown();
896 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
898 }
899}
900
901impl fidl::endpoints::Responder for ClientStateWatcherWatchResponder {
902 type ControlHandle = ClientStateWatcherControlHandle;
903
904 fn control_handle(&self) -> &ClientStateWatcherControlHandle {
905 &self.control_handle
906 }
907
908 fn drop_without_shutdown(mut self) {
909 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
911 std::mem::forget(self);
913 }
914}
915
916impl ClientStateWatcherWatchResponder {
917 pub fn send(self, mut state: u64) -> Result<(), fidl::Error> {
921 let _result = self.send_raw(state);
922 if _result.is_err() {
923 self.control_handle.shutdown();
924 }
925 self.drop_without_shutdown();
926 _result
927 }
928
929 pub fn send_no_shutdown_on_err(self, mut state: u64) -> Result<(), fidl::Error> {
931 let _result = self.send_raw(state);
932 self.drop_without_shutdown();
933 _result
934 }
935
936 fn send_raw(&self, mut state: u64) -> Result<(), fidl::Error> {
937 self.control_handle.inner.send::<ClientStateWatcherWatchResponse>(
938 (state,),
939 self.tx_id,
940 0x44831316a9942f7e,
941 fidl::encoding::DynamicFlags::empty(),
942 )
943 }
944}
945
946mod internal {
947 use super::*;
948
949 impl fidl::encoding::ResourceTypeMarker for ClientStateConnectorConnectRequest {
950 type Borrowed<'a> = &'a mut Self;
951 fn take_or_borrow<'a>(
952 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
953 ) -> Self::Borrowed<'a> {
954 value
955 }
956 }
957
958 unsafe impl fidl::encoding::TypeMarker for ClientStateConnectorConnectRequest {
959 type Owned = Self;
960
961 #[inline(always)]
962 fn inline_align(_context: fidl::encoding::Context) -> usize {
963 8
964 }
965
966 #[inline(always)]
967 fn inline_size(_context: fidl::encoding::Context) -> usize {
968 24
969 }
970 }
971
972 unsafe impl
973 fidl::encoding::Encode<
974 ClientStateConnectorConnectRequest,
975 fidl::encoding::DefaultFuchsiaResourceDialect,
976 > for &mut ClientStateConnectorConnectRequest
977 {
978 #[inline]
979 unsafe fn encode(
980 self,
981 encoder: &mut fidl::encoding::Encoder<
982 '_,
983 fidl::encoding::DefaultFuchsiaResourceDialect,
984 >,
985 offset: usize,
986 _depth: fidl::encoding::Depth,
987 ) -> fidl::Result<()> {
988 encoder.debug_check_bounds::<ClientStateConnectorConnectRequest>(offset);
989 fidl::encoding::Encode::<ClientStateConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
991 (
992 <fidl::encoding::BoundedString<8> as fidl::encoding::ValueTypeMarker>::borrow(&self.client_type),
993 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientStateWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
994 ),
995 encoder, offset, _depth
996 )
997 }
998 }
999 unsafe impl<
1000 T0: fidl::encoding::Encode<
1001 fidl::encoding::BoundedString<8>,
1002 fidl::encoding::DefaultFuchsiaResourceDialect,
1003 >,
1004 T1: fidl::encoding::Encode<
1005 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientStateWatcherMarker>>,
1006 fidl::encoding::DefaultFuchsiaResourceDialect,
1007 >,
1008 >
1009 fidl::encoding::Encode<
1010 ClientStateConnectorConnectRequest,
1011 fidl::encoding::DefaultFuchsiaResourceDialect,
1012 > for (T0, T1)
1013 {
1014 #[inline]
1015 unsafe fn encode(
1016 self,
1017 encoder: &mut fidl::encoding::Encoder<
1018 '_,
1019 fidl::encoding::DefaultFuchsiaResourceDialect,
1020 >,
1021 offset: usize,
1022 depth: fidl::encoding::Depth,
1023 ) -> fidl::Result<()> {
1024 encoder.debug_check_bounds::<ClientStateConnectorConnectRequest>(offset);
1025 unsafe {
1028 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1029 (ptr as *mut u64).write_unaligned(0);
1030 }
1031 self.0.encode(encoder, offset + 0, depth)?;
1033 self.1.encode(encoder, offset + 16, depth)?;
1034 Ok(())
1035 }
1036 }
1037
1038 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1039 for ClientStateConnectorConnectRequest
1040 {
1041 #[inline(always)]
1042 fn new_empty() -> Self {
1043 Self {
1044 client_type: fidl::new_empty!(
1045 fidl::encoding::BoundedString<8>,
1046 fidl::encoding::DefaultFuchsiaResourceDialect
1047 ),
1048 watcher: fidl::new_empty!(
1049 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientStateWatcherMarker>>,
1050 fidl::encoding::DefaultFuchsiaResourceDialect
1051 ),
1052 }
1053 }
1054
1055 #[inline]
1056 unsafe fn decode(
1057 &mut self,
1058 decoder: &mut fidl::encoding::Decoder<
1059 '_,
1060 fidl::encoding::DefaultFuchsiaResourceDialect,
1061 >,
1062 offset: usize,
1063 _depth: fidl::encoding::Depth,
1064 ) -> fidl::Result<()> {
1065 decoder.debug_check_bounds::<Self>(offset);
1066 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1068 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1069 let mask = 0xffffffff00000000u64;
1070 let maskedval = padval & mask;
1071 if maskedval != 0 {
1072 return Err(fidl::Error::NonZeroPadding {
1073 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1074 });
1075 }
1076 fidl::decode!(
1077 fidl::encoding::BoundedString<8>,
1078 fidl::encoding::DefaultFuchsiaResourceDialect,
1079 &mut self.client_type,
1080 decoder,
1081 offset + 0,
1082 _depth
1083 )?;
1084 fidl::decode!(
1085 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientStateWatcherMarker>>,
1086 fidl::encoding::DefaultFuchsiaResourceDialect,
1087 &mut self.watcher,
1088 decoder,
1089 offset + 16,
1090 _depth
1091 )?;
1092 Ok(())
1093 }
1094 }
1095}