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#[derive(Debug, Clone)]
135pub struct ClientStateConnectorProxy {
136 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
137}
138
139impl fidl::endpoints::Proxy for ClientStateConnectorProxy {
140 type Protocol = ClientStateConnectorMarker;
141
142 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
143 Self::new(inner)
144 }
145
146 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
147 self.client.into_channel().map_err(|client| Self { client })
148 }
149
150 fn as_channel(&self) -> &::fidl::AsyncChannel {
151 self.client.as_channel()
152 }
153}
154
155impl ClientStateConnectorProxy {
156 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
158 let protocol_name =
159 <ClientStateConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
160 Self { client: fidl::client::Client::new(channel, protocol_name) }
161 }
162
163 pub fn take_event_stream(&self) -> ClientStateConnectorEventStream {
169 ClientStateConnectorEventStream { event_receiver: self.client.take_event_receiver() }
170 }
171
172 pub fn r#connect(
190 &self,
191 mut client_type: &str,
192 mut watcher: fidl::endpoints::ServerEnd<ClientStateWatcherMarker>,
193 ) -> Result<(), fidl::Error> {
194 ClientStateConnectorProxyInterface::r#connect(self, client_type, watcher)
195 }
196}
197
198impl ClientStateConnectorProxyInterface for ClientStateConnectorProxy {
199 fn r#connect(
200 &self,
201 mut client_type: &str,
202 mut watcher: fidl::endpoints::ServerEnd<ClientStateWatcherMarker>,
203 ) -> Result<(), fidl::Error> {
204 self.client.send::<ClientStateConnectorConnectRequest>(
205 (client_type, watcher),
206 0x65abd3ba57ddaa1d,
207 fidl::encoding::DynamicFlags::empty(),
208 )
209 }
210}
211
212pub struct ClientStateConnectorEventStream {
213 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
214}
215
216impl std::marker::Unpin for ClientStateConnectorEventStream {}
217
218impl futures::stream::FusedStream for ClientStateConnectorEventStream {
219 fn is_terminated(&self) -> bool {
220 self.event_receiver.is_terminated()
221 }
222}
223
224impl futures::Stream for ClientStateConnectorEventStream {
225 type Item = Result<ClientStateConnectorEvent, fidl::Error>;
226
227 fn poll_next(
228 mut self: std::pin::Pin<&mut Self>,
229 cx: &mut std::task::Context<'_>,
230 ) -> std::task::Poll<Option<Self::Item>> {
231 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
232 &mut self.event_receiver,
233 cx
234 )?) {
235 Some(buf) => std::task::Poll::Ready(Some(ClientStateConnectorEvent::decode(buf))),
236 None => std::task::Poll::Ready(None),
237 }
238 }
239}
240
241#[derive(Debug)]
242pub enum ClientStateConnectorEvent {}
243
244impl ClientStateConnectorEvent {
245 fn decode(
247 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
248 ) -> Result<ClientStateConnectorEvent, fidl::Error> {
249 let (bytes, _handles) = buf.split_mut();
250 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
251 debug_assert_eq!(tx_header.tx_id, 0);
252 match tx_header.ordinal {
253 _ => Err(fidl::Error::UnknownOrdinal {
254 ordinal: tx_header.ordinal,
255 protocol_name:
256 <ClientStateConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
257 }),
258 }
259 }
260}
261
262pub struct ClientStateConnectorRequestStream {
264 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
265 is_terminated: bool,
266}
267
268impl std::marker::Unpin for ClientStateConnectorRequestStream {}
269
270impl futures::stream::FusedStream for ClientStateConnectorRequestStream {
271 fn is_terminated(&self) -> bool {
272 self.is_terminated
273 }
274}
275
276impl fidl::endpoints::RequestStream for ClientStateConnectorRequestStream {
277 type Protocol = ClientStateConnectorMarker;
278 type ControlHandle = ClientStateConnectorControlHandle;
279
280 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
281 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
282 }
283
284 fn control_handle(&self) -> Self::ControlHandle {
285 ClientStateConnectorControlHandle { inner: self.inner.clone() }
286 }
287
288 fn into_inner(
289 self,
290 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
291 {
292 (self.inner, self.is_terminated)
293 }
294
295 fn from_inner(
296 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
297 is_terminated: bool,
298 ) -> Self {
299 Self { inner, is_terminated }
300 }
301}
302
303impl futures::Stream for ClientStateConnectorRequestStream {
304 type Item = Result<ClientStateConnectorRequest, fidl::Error>;
305
306 fn poll_next(
307 mut self: std::pin::Pin<&mut Self>,
308 cx: &mut std::task::Context<'_>,
309 ) -> std::task::Poll<Option<Self::Item>> {
310 let this = &mut *self;
311 if this.inner.check_shutdown(cx) {
312 this.is_terminated = true;
313 return std::task::Poll::Ready(None);
314 }
315 if this.is_terminated {
316 panic!("polled ClientStateConnectorRequestStream after completion");
317 }
318 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
319 |bytes, handles| {
320 match this.inner.channel().read_etc(cx, bytes, handles) {
321 std::task::Poll::Ready(Ok(())) => {}
322 std::task::Poll::Pending => return std::task::Poll::Pending,
323 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
324 this.is_terminated = true;
325 return std::task::Poll::Ready(None);
326 }
327 std::task::Poll::Ready(Err(e)) => {
328 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
329 e.into(),
330 ))))
331 }
332 }
333
334 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
336
337 std::task::Poll::Ready(Some(match header.ordinal {
338 0x65abd3ba57ddaa1d => {
339 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
340 let mut req = fidl::new_empty!(ClientStateConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
341 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientStateConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
342 let control_handle = ClientStateConnectorControlHandle {
343 inner: this.inner.clone(),
344 };
345 Ok(ClientStateConnectorRequest::Connect {client_type: req.client_type,
346watcher: req.watcher,
347
348 control_handle,
349 })
350 }
351 _ => Err(fidl::Error::UnknownOrdinal {
352 ordinal: header.ordinal,
353 protocol_name: <ClientStateConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
354 }),
355 }))
356 },
357 )
358 }
359}
360
361#[derive(Debug)]
364pub enum ClientStateConnectorRequest {
365 Connect {
383 client_type: String,
384 watcher: fidl::endpoints::ServerEnd<ClientStateWatcherMarker>,
385 control_handle: ClientStateConnectorControlHandle,
386 },
387}
388
389impl ClientStateConnectorRequest {
390 #[allow(irrefutable_let_patterns)]
391 pub fn into_connect(
392 self,
393 ) -> Option<(
394 String,
395 fidl::endpoints::ServerEnd<ClientStateWatcherMarker>,
396 ClientStateConnectorControlHandle,
397 )> {
398 if let ClientStateConnectorRequest::Connect { client_type, watcher, control_handle } = self
399 {
400 Some((client_type, watcher, control_handle))
401 } else {
402 None
403 }
404 }
405
406 pub fn method_name(&self) -> &'static str {
408 match *self {
409 ClientStateConnectorRequest::Connect { .. } => "connect",
410 }
411 }
412}
413
414#[derive(Debug, Clone)]
415pub struct ClientStateConnectorControlHandle {
416 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
417}
418
419impl fidl::endpoints::ControlHandle for ClientStateConnectorControlHandle {
420 fn shutdown(&self) {
421 self.inner.shutdown()
422 }
423 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
424 self.inner.shutdown_with_epitaph(status)
425 }
426
427 fn is_closed(&self) -> bool {
428 self.inner.channel().is_closed()
429 }
430 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
431 self.inner.channel().on_closed()
432 }
433
434 #[cfg(target_os = "fuchsia")]
435 fn signal_peer(
436 &self,
437 clear_mask: zx::Signals,
438 set_mask: zx::Signals,
439 ) -> Result<(), zx_status::Status> {
440 use fidl::Peered;
441 self.inner.channel().signal_peer(clear_mask, set_mask)
442 }
443}
444
445impl ClientStateConnectorControlHandle {}
446
447#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
448pub struct ClientStateWatcherMarker;
449
450impl fidl::endpoints::ProtocolMarker for ClientStateWatcherMarker {
451 type Proxy = ClientStateWatcherProxy;
452 type RequestStream = ClientStateWatcherRequestStream;
453 #[cfg(target_os = "fuchsia")]
454 type SynchronousProxy = ClientStateWatcherSynchronousProxy;
455
456 const DEBUG_NAME: &'static str = "(anonymous) ClientStateWatcher";
457}
458
459pub trait ClientStateWatcherProxyInterface: Send + Sync {
460 type WatchResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
461 fn r#watch(&self) -> Self::WatchResponseFut;
462}
463#[derive(Debug)]
464#[cfg(target_os = "fuchsia")]
465pub struct ClientStateWatcherSynchronousProxy {
466 client: fidl::client::sync::Client,
467}
468
469#[cfg(target_os = "fuchsia")]
470impl fidl::endpoints::SynchronousProxy for ClientStateWatcherSynchronousProxy {
471 type Proxy = ClientStateWatcherProxy;
472 type Protocol = ClientStateWatcherMarker;
473
474 fn from_channel(inner: fidl::Channel) -> Self {
475 Self::new(inner)
476 }
477
478 fn into_channel(self) -> fidl::Channel {
479 self.client.into_channel()
480 }
481
482 fn as_channel(&self) -> &fidl::Channel {
483 self.client.as_channel()
484 }
485}
486
487#[cfg(target_os = "fuchsia")]
488impl ClientStateWatcherSynchronousProxy {
489 pub fn new(channel: fidl::Channel) -> Self {
490 let protocol_name =
491 <ClientStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
492 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
493 }
494
495 pub fn into_channel(self) -> fidl::Channel {
496 self.client.into_channel()
497 }
498
499 pub fn wait_for_event(
502 &self,
503 deadline: zx::MonotonicInstant,
504 ) -> Result<ClientStateWatcherEvent, fidl::Error> {
505 ClientStateWatcherEvent::decode(self.client.wait_for_event(deadline)?)
506 }
507
508 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<u64, fidl::Error> {
525 let _response = self
526 .client
527 .send_query::<fidl::encoding::EmptyPayload, ClientStateWatcherWatchResponse>(
528 (),
529 0x44831316a9942f7e,
530 fidl::encoding::DynamicFlags::empty(),
531 ___deadline,
532 )?;
533 Ok(_response.state)
534 }
535}
536
537#[cfg(target_os = "fuchsia")]
538impl From<ClientStateWatcherSynchronousProxy> for zx::Handle {
539 fn from(value: ClientStateWatcherSynchronousProxy) -> Self {
540 value.into_channel().into()
541 }
542}
543
544#[cfg(target_os = "fuchsia")]
545impl From<fidl::Channel> for ClientStateWatcherSynchronousProxy {
546 fn from(value: fidl::Channel) -> Self {
547 Self::new(value)
548 }
549}
550
551#[derive(Debug, Clone)]
552pub struct ClientStateWatcherProxy {
553 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
554}
555
556impl fidl::endpoints::Proxy for ClientStateWatcherProxy {
557 type Protocol = ClientStateWatcherMarker;
558
559 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
560 Self::new(inner)
561 }
562
563 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
564 self.client.into_channel().map_err(|client| Self { client })
565 }
566
567 fn as_channel(&self) -> &::fidl::AsyncChannel {
568 self.client.as_channel()
569 }
570}
571
572impl ClientStateWatcherProxy {
573 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
575 let protocol_name =
576 <ClientStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
577 Self { client: fidl::client::Client::new(channel, protocol_name) }
578 }
579
580 pub fn take_event_stream(&self) -> ClientStateWatcherEventStream {
586 ClientStateWatcherEventStream { event_receiver: self.client.take_event_receiver() }
587 }
588
589 pub fn r#watch(
606 &self,
607 ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
608 ClientStateWatcherProxyInterface::r#watch(self)
609 }
610}
611
612impl ClientStateWatcherProxyInterface for ClientStateWatcherProxy {
613 type WatchResponseFut =
614 fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
615 fn r#watch(&self) -> Self::WatchResponseFut {
616 fn _decode(
617 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
618 ) -> Result<u64, fidl::Error> {
619 let _response = fidl::client::decode_transaction_body::<
620 ClientStateWatcherWatchResponse,
621 fidl::encoding::DefaultFuchsiaResourceDialect,
622 0x44831316a9942f7e,
623 >(_buf?)?;
624 Ok(_response.state)
625 }
626 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
627 (),
628 0x44831316a9942f7e,
629 fidl::encoding::DynamicFlags::empty(),
630 _decode,
631 )
632 }
633}
634
635pub struct ClientStateWatcherEventStream {
636 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
637}
638
639impl std::marker::Unpin for ClientStateWatcherEventStream {}
640
641impl futures::stream::FusedStream for ClientStateWatcherEventStream {
642 fn is_terminated(&self) -> bool {
643 self.event_receiver.is_terminated()
644 }
645}
646
647impl futures::Stream for ClientStateWatcherEventStream {
648 type Item = Result<ClientStateWatcherEvent, fidl::Error>;
649
650 fn poll_next(
651 mut self: std::pin::Pin<&mut Self>,
652 cx: &mut std::task::Context<'_>,
653 ) -> std::task::Poll<Option<Self::Item>> {
654 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
655 &mut self.event_receiver,
656 cx
657 )?) {
658 Some(buf) => std::task::Poll::Ready(Some(ClientStateWatcherEvent::decode(buf))),
659 None => std::task::Poll::Ready(None),
660 }
661 }
662}
663
664#[derive(Debug)]
665pub enum ClientStateWatcherEvent {}
666
667impl ClientStateWatcherEvent {
668 fn decode(
670 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
671 ) -> Result<ClientStateWatcherEvent, fidl::Error> {
672 let (bytes, _handles) = buf.split_mut();
673 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
674 debug_assert_eq!(tx_header.tx_id, 0);
675 match tx_header.ordinal {
676 _ => Err(fidl::Error::UnknownOrdinal {
677 ordinal: tx_header.ordinal,
678 protocol_name:
679 <ClientStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
680 }),
681 }
682 }
683}
684
685pub struct ClientStateWatcherRequestStream {
687 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
688 is_terminated: bool,
689}
690
691impl std::marker::Unpin for ClientStateWatcherRequestStream {}
692
693impl futures::stream::FusedStream for ClientStateWatcherRequestStream {
694 fn is_terminated(&self) -> bool {
695 self.is_terminated
696 }
697}
698
699impl fidl::endpoints::RequestStream for ClientStateWatcherRequestStream {
700 type Protocol = ClientStateWatcherMarker;
701 type ControlHandle = ClientStateWatcherControlHandle;
702
703 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
704 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
705 }
706
707 fn control_handle(&self) -> Self::ControlHandle {
708 ClientStateWatcherControlHandle { inner: self.inner.clone() }
709 }
710
711 fn into_inner(
712 self,
713 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
714 {
715 (self.inner, self.is_terminated)
716 }
717
718 fn from_inner(
719 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
720 is_terminated: bool,
721 ) -> Self {
722 Self { inner, is_terminated }
723 }
724}
725
726impl futures::Stream for ClientStateWatcherRequestStream {
727 type Item = Result<ClientStateWatcherRequest, fidl::Error>;
728
729 fn poll_next(
730 mut self: std::pin::Pin<&mut Self>,
731 cx: &mut std::task::Context<'_>,
732 ) -> std::task::Poll<Option<Self::Item>> {
733 let this = &mut *self;
734 if this.inner.check_shutdown(cx) {
735 this.is_terminated = true;
736 return std::task::Poll::Ready(None);
737 }
738 if this.is_terminated {
739 panic!("polled ClientStateWatcherRequestStream after completion");
740 }
741 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
742 |bytes, handles| {
743 match this.inner.channel().read_etc(cx, bytes, handles) {
744 std::task::Poll::Ready(Ok(())) => {}
745 std::task::Poll::Pending => return std::task::Poll::Pending,
746 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
747 this.is_terminated = true;
748 return std::task::Poll::Ready(None);
749 }
750 std::task::Poll::Ready(Err(e)) => {
751 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
752 e.into(),
753 ))))
754 }
755 }
756
757 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
759
760 std::task::Poll::Ready(Some(match header.ordinal {
761 0x44831316a9942f7e => {
762 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
763 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
764 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
765 let control_handle = ClientStateWatcherControlHandle {
766 inner: this.inner.clone(),
767 };
768 Ok(ClientStateWatcherRequest::Watch {
769 responder: ClientStateWatcherWatchResponder {
770 control_handle: std::mem::ManuallyDrop::new(control_handle),
771 tx_id: header.tx_id,
772 },
773 })
774 }
775 _ => Err(fidl::Error::UnknownOrdinal {
776 ordinal: header.ordinal,
777 protocol_name: <ClientStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
778 }),
779 }))
780 },
781 )
782 }
783}
784
785#[derive(Debug)]
794pub enum ClientStateWatcherRequest {
795 Watch { responder: ClientStateWatcherWatchResponder },
812}
813
814impl ClientStateWatcherRequest {
815 #[allow(irrefutable_let_patterns)]
816 pub fn into_watch(self) -> Option<(ClientStateWatcherWatchResponder)> {
817 if let ClientStateWatcherRequest::Watch { responder } = self {
818 Some((responder))
819 } else {
820 None
821 }
822 }
823
824 pub fn method_name(&self) -> &'static str {
826 match *self {
827 ClientStateWatcherRequest::Watch { .. } => "watch",
828 }
829 }
830}
831
832#[derive(Debug, Clone)]
833pub struct ClientStateWatcherControlHandle {
834 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
835}
836
837impl fidl::endpoints::ControlHandle for ClientStateWatcherControlHandle {
838 fn shutdown(&self) {
839 self.inner.shutdown()
840 }
841 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
842 self.inner.shutdown_with_epitaph(status)
843 }
844
845 fn is_closed(&self) -> bool {
846 self.inner.channel().is_closed()
847 }
848 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
849 self.inner.channel().on_closed()
850 }
851
852 #[cfg(target_os = "fuchsia")]
853 fn signal_peer(
854 &self,
855 clear_mask: zx::Signals,
856 set_mask: zx::Signals,
857 ) -> Result<(), zx_status::Status> {
858 use fidl::Peered;
859 self.inner.channel().signal_peer(clear_mask, set_mask)
860 }
861}
862
863impl ClientStateWatcherControlHandle {}
864
865#[must_use = "FIDL methods require a response to be sent"]
866#[derive(Debug)]
867pub struct ClientStateWatcherWatchResponder {
868 control_handle: std::mem::ManuallyDrop<ClientStateWatcherControlHandle>,
869 tx_id: u32,
870}
871
872impl std::ops::Drop for ClientStateWatcherWatchResponder {
876 fn drop(&mut self) {
877 self.control_handle.shutdown();
878 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
880 }
881}
882
883impl fidl::endpoints::Responder for ClientStateWatcherWatchResponder {
884 type ControlHandle = ClientStateWatcherControlHandle;
885
886 fn control_handle(&self) -> &ClientStateWatcherControlHandle {
887 &self.control_handle
888 }
889
890 fn drop_without_shutdown(mut self) {
891 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
893 std::mem::forget(self);
895 }
896}
897
898impl ClientStateWatcherWatchResponder {
899 pub fn send(self, mut state: u64) -> Result<(), fidl::Error> {
903 let _result = self.send_raw(state);
904 if _result.is_err() {
905 self.control_handle.shutdown();
906 }
907 self.drop_without_shutdown();
908 _result
909 }
910
911 pub fn send_no_shutdown_on_err(self, mut state: u64) -> Result<(), fidl::Error> {
913 let _result = self.send_raw(state);
914 self.drop_without_shutdown();
915 _result
916 }
917
918 fn send_raw(&self, mut state: u64) -> Result<(), fidl::Error> {
919 self.control_handle.inner.send::<ClientStateWatcherWatchResponse>(
920 (state,),
921 self.tx_id,
922 0x44831316a9942f7e,
923 fidl::encoding::DynamicFlags::empty(),
924 )
925 }
926}
927
928mod internal {
929 use super::*;
930
931 impl fidl::encoding::ResourceTypeMarker for ClientStateConnectorConnectRequest {
932 type Borrowed<'a> = &'a mut Self;
933 fn take_or_borrow<'a>(
934 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
935 ) -> Self::Borrowed<'a> {
936 value
937 }
938 }
939
940 unsafe impl fidl::encoding::TypeMarker for ClientStateConnectorConnectRequest {
941 type Owned = Self;
942
943 #[inline(always)]
944 fn inline_align(_context: fidl::encoding::Context) -> usize {
945 8
946 }
947
948 #[inline(always)]
949 fn inline_size(_context: fidl::encoding::Context) -> usize {
950 24
951 }
952 }
953
954 unsafe impl
955 fidl::encoding::Encode<
956 ClientStateConnectorConnectRequest,
957 fidl::encoding::DefaultFuchsiaResourceDialect,
958 > for &mut ClientStateConnectorConnectRequest
959 {
960 #[inline]
961 unsafe fn encode(
962 self,
963 encoder: &mut fidl::encoding::Encoder<
964 '_,
965 fidl::encoding::DefaultFuchsiaResourceDialect,
966 >,
967 offset: usize,
968 _depth: fidl::encoding::Depth,
969 ) -> fidl::Result<()> {
970 encoder.debug_check_bounds::<ClientStateConnectorConnectRequest>(offset);
971 fidl::encoding::Encode::<ClientStateConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
973 (
974 <fidl::encoding::BoundedString<8> as fidl::encoding::ValueTypeMarker>::borrow(&self.client_type),
975 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientStateWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
976 ),
977 encoder, offset, _depth
978 )
979 }
980 }
981 unsafe impl<
982 T0: fidl::encoding::Encode<
983 fidl::encoding::BoundedString<8>,
984 fidl::encoding::DefaultFuchsiaResourceDialect,
985 >,
986 T1: fidl::encoding::Encode<
987 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientStateWatcherMarker>>,
988 fidl::encoding::DefaultFuchsiaResourceDialect,
989 >,
990 >
991 fidl::encoding::Encode<
992 ClientStateConnectorConnectRequest,
993 fidl::encoding::DefaultFuchsiaResourceDialect,
994 > for (T0, T1)
995 {
996 #[inline]
997 unsafe fn encode(
998 self,
999 encoder: &mut fidl::encoding::Encoder<
1000 '_,
1001 fidl::encoding::DefaultFuchsiaResourceDialect,
1002 >,
1003 offset: usize,
1004 depth: fidl::encoding::Depth,
1005 ) -> fidl::Result<()> {
1006 encoder.debug_check_bounds::<ClientStateConnectorConnectRequest>(offset);
1007 unsafe {
1010 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1011 (ptr as *mut u64).write_unaligned(0);
1012 }
1013 self.0.encode(encoder, offset + 0, depth)?;
1015 self.1.encode(encoder, offset + 16, depth)?;
1016 Ok(())
1017 }
1018 }
1019
1020 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1021 for ClientStateConnectorConnectRequest
1022 {
1023 #[inline(always)]
1024 fn new_empty() -> Self {
1025 Self {
1026 client_type: fidl::new_empty!(
1027 fidl::encoding::BoundedString<8>,
1028 fidl::encoding::DefaultFuchsiaResourceDialect
1029 ),
1030 watcher: fidl::new_empty!(
1031 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientStateWatcherMarker>>,
1032 fidl::encoding::DefaultFuchsiaResourceDialect
1033 ),
1034 }
1035 }
1036
1037 #[inline]
1038 unsafe fn decode(
1039 &mut self,
1040 decoder: &mut fidl::encoding::Decoder<
1041 '_,
1042 fidl::encoding::DefaultFuchsiaResourceDialect,
1043 >,
1044 offset: usize,
1045 _depth: fidl::encoding::Depth,
1046 ) -> fidl::Result<()> {
1047 decoder.debug_check_bounds::<Self>(offset);
1048 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1050 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1051 let mask = 0xffffffff00000000u64;
1052 let maskedval = padval & mask;
1053 if maskedval != 0 {
1054 return Err(fidl::Error::NonZeroPadding {
1055 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1056 });
1057 }
1058 fidl::decode!(
1059 fidl::encoding::BoundedString<8>,
1060 fidl::encoding::DefaultFuchsiaResourceDialect,
1061 &mut self.client_type,
1062 decoder,
1063 offset + 0,
1064 _depth
1065 )?;
1066 fidl::decode!(
1067 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientStateWatcherMarker>>,
1068 fidl::encoding::DefaultFuchsiaResourceDialect,
1069 &mut self.watcher,
1070 decoder,
1071 offset + 16,
1072 _depth
1073 )?;
1074 Ok(())
1075 }
1076 }
1077}