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_basicdriver_ctftest__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct DeviceMarker;
16
17impl fidl::endpoints::ProtocolMarker for DeviceMarker {
18 type Proxy = DeviceProxy;
19 type RequestStream = DeviceRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = DeviceSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "(anonymous) Device";
24}
25
26pub trait DeviceProxyInterface: Send + Sync {
27 type PingResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
28 fn r#ping(&self) -> Self::PingResponseFut;
29}
30#[derive(Debug)]
31#[cfg(target_os = "fuchsia")]
32pub struct DeviceSynchronousProxy {
33 client: fidl::client::sync::Client,
34}
35
36#[cfg(target_os = "fuchsia")]
37impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
38 type Proxy = DeviceProxy;
39 type Protocol = DeviceMarker;
40
41 fn from_channel(inner: fidl::Channel) -> Self {
42 Self::new(inner)
43 }
44
45 fn into_channel(self) -> fidl::Channel {
46 self.client.into_channel()
47 }
48
49 fn as_channel(&self) -> &fidl::Channel {
50 self.client.as_channel()
51 }
52}
53
54#[cfg(target_os = "fuchsia")]
55impl DeviceSynchronousProxy {
56 pub fn new(channel: fidl::Channel) -> Self {
57 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
58 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
59 }
60
61 pub fn into_channel(self) -> fidl::Channel {
62 self.client.into_channel()
63 }
64
65 pub fn wait_for_event(
68 &self,
69 deadline: zx::MonotonicInstant,
70 ) -> Result<DeviceEvent, fidl::Error> {
71 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
72 }
73
74 pub fn r#ping(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
75 let _response =
76 self.client.send_query::<fidl::encoding::EmptyPayload, DevicePingResponse>(
77 (),
78 0x53eb4e98ccf32729,
79 fidl::encoding::DynamicFlags::empty(),
80 ___deadline,
81 )?;
82 Ok(_response.pong)
83 }
84}
85
86#[cfg(target_os = "fuchsia")]
87impl From<DeviceSynchronousProxy> for zx::Handle {
88 fn from(value: DeviceSynchronousProxy) -> Self {
89 value.into_channel().into()
90 }
91}
92
93#[cfg(target_os = "fuchsia")]
94impl From<fidl::Channel> for DeviceSynchronousProxy {
95 fn from(value: fidl::Channel) -> Self {
96 Self::new(value)
97 }
98}
99
100#[cfg(target_os = "fuchsia")]
101impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
102 type Protocol = DeviceMarker;
103
104 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
105 Self::new(value.into_channel())
106 }
107}
108
109#[derive(Debug, Clone)]
110pub struct DeviceProxy {
111 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
112}
113
114impl fidl::endpoints::Proxy for DeviceProxy {
115 type Protocol = DeviceMarker;
116
117 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
118 Self::new(inner)
119 }
120
121 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
122 self.client.into_channel().map_err(|client| Self { client })
123 }
124
125 fn as_channel(&self) -> &::fidl::AsyncChannel {
126 self.client.as_channel()
127 }
128}
129
130impl DeviceProxy {
131 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
133 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
134 Self { client: fidl::client::Client::new(channel, protocol_name) }
135 }
136
137 pub fn take_event_stream(&self) -> DeviceEventStream {
143 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
144 }
145
146 pub fn r#ping(
147 &self,
148 ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
149 DeviceProxyInterface::r#ping(self)
150 }
151}
152
153impl DeviceProxyInterface for DeviceProxy {
154 type PingResponseFut =
155 fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
156 fn r#ping(&self) -> Self::PingResponseFut {
157 fn _decode(
158 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
159 ) -> Result<u32, fidl::Error> {
160 let _response = fidl::client::decode_transaction_body::<
161 DevicePingResponse,
162 fidl::encoding::DefaultFuchsiaResourceDialect,
163 0x53eb4e98ccf32729,
164 >(_buf?)?;
165 Ok(_response.pong)
166 }
167 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
168 (),
169 0x53eb4e98ccf32729,
170 fidl::encoding::DynamicFlags::empty(),
171 _decode,
172 )
173 }
174}
175
176pub struct DeviceEventStream {
177 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
178}
179
180impl std::marker::Unpin for DeviceEventStream {}
181
182impl futures::stream::FusedStream for DeviceEventStream {
183 fn is_terminated(&self) -> bool {
184 self.event_receiver.is_terminated()
185 }
186}
187
188impl futures::Stream for DeviceEventStream {
189 type Item = Result<DeviceEvent, fidl::Error>;
190
191 fn poll_next(
192 mut self: std::pin::Pin<&mut Self>,
193 cx: &mut std::task::Context<'_>,
194 ) -> std::task::Poll<Option<Self::Item>> {
195 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
196 &mut self.event_receiver,
197 cx
198 )?) {
199 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
200 None => std::task::Poll::Ready(None),
201 }
202 }
203}
204
205#[derive(Debug)]
206pub enum DeviceEvent {}
207
208impl DeviceEvent {
209 fn decode(
211 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
212 ) -> Result<DeviceEvent, fidl::Error> {
213 let (bytes, _handles) = buf.split_mut();
214 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
215 debug_assert_eq!(tx_header.tx_id, 0);
216 match tx_header.ordinal {
217 _ => Err(fidl::Error::UnknownOrdinal {
218 ordinal: tx_header.ordinal,
219 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
220 }),
221 }
222 }
223}
224
225pub struct DeviceRequestStream {
227 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
228 is_terminated: bool,
229}
230
231impl std::marker::Unpin for DeviceRequestStream {}
232
233impl futures::stream::FusedStream for DeviceRequestStream {
234 fn is_terminated(&self) -> bool {
235 self.is_terminated
236 }
237}
238
239impl fidl::endpoints::RequestStream for DeviceRequestStream {
240 type Protocol = DeviceMarker;
241 type ControlHandle = DeviceControlHandle;
242
243 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
244 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
245 }
246
247 fn control_handle(&self) -> Self::ControlHandle {
248 DeviceControlHandle { inner: self.inner.clone() }
249 }
250
251 fn into_inner(
252 self,
253 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
254 {
255 (self.inner, self.is_terminated)
256 }
257
258 fn from_inner(
259 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
260 is_terminated: bool,
261 ) -> Self {
262 Self { inner, is_terminated }
263 }
264}
265
266impl futures::Stream for DeviceRequestStream {
267 type Item = Result<DeviceRequest, fidl::Error>;
268
269 fn poll_next(
270 mut self: std::pin::Pin<&mut Self>,
271 cx: &mut std::task::Context<'_>,
272 ) -> std::task::Poll<Option<Self::Item>> {
273 let this = &mut *self;
274 if this.inner.check_shutdown(cx) {
275 this.is_terminated = true;
276 return std::task::Poll::Ready(None);
277 }
278 if this.is_terminated {
279 panic!("polled DeviceRequestStream after completion");
280 }
281 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
282 |bytes, handles| {
283 match this.inner.channel().read_etc(cx, bytes, handles) {
284 std::task::Poll::Ready(Ok(())) => {}
285 std::task::Poll::Pending => return std::task::Poll::Pending,
286 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
287 this.is_terminated = true;
288 return std::task::Poll::Ready(None);
289 }
290 std::task::Poll::Ready(Err(e)) => {
291 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
292 e.into(),
293 ))))
294 }
295 }
296
297 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
299
300 std::task::Poll::Ready(Some(match header.ordinal {
301 0x53eb4e98ccf32729 => {
302 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
303 let mut req = fidl::new_empty!(
304 fidl::encoding::EmptyPayload,
305 fidl::encoding::DefaultFuchsiaResourceDialect
306 );
307 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
308 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
309 Ok(DeviceRequest::Ping {
310 responder: DevicePingResponder {
311 control_handle: std::mem::ManuallyDrop::new(control_handle),
312 tx_id: header.tx_id,
313 },
314 })
315 }
316 _ => Err(fidl::Error::UnknownOrdinal {
317 ordinal: header.ordinal,
318 protocol_name:
319 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
320 }),
321 }))
322 },
323 )
324 }
325}
326
327#[derive(Debug)]
328pub enum DeviceRequest {
329 Ping { responder: DevicePingResponder },
330}
331
332impl DeviceRequest {
333 #[allow(irrefutable_let_patterns)]
334 pub fn into_ping(self) -> Option<(DevicePingResponder)> {
335 if let DeviceRequest::Ping { responder } = self {
336 Some((responder))
337 } else {
338 None
339 }
340 }
341
342 pub fn method_name(&self) -> &'static str {
344 match *self {
345 DeviceRequest::Ping { .. } => "ping",
346 }
347 }
348}
349
350#[derive(Debug, Clone)]
351pub struct DeviceControlHandle {
352 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
353}
354
355impl fidl::endpoints::ControlHandle for DeviceControlHandle {
356 fn shutdown(&self) {
357 self.inner.shutdown()
358 }
359 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
360 self.inner.shutdown_with_epitaph(status)
361 }
362
363 fn is_closed(&self) -> bool {
364 self.inner.channel().is_closed()
365 }
366 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
367 self.inner.channel().on_closed()
368 }
369
370 #[cfg(target_os = "fuchsia")]
371 fn signal_peer(
372 &self,
373 clear_mask: zx::Signals,
374 set_mask: zx::Signals,
375 ) -> Result<(), zx_status::Status> {
376 use fidl::Peered;
377 self.inner.channel().signal_peer(clear_mask, set_mask)
378 }
379}
380
381impl DeviceControlHandle {}
382
383#[must_use = "FIDL methods require a response to be sent"]
384#[derive(Debug)]
385pub struct DevicePingResponder {
386 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
387 tx_id: u32,
388}
389
390impl std::ops::Drop for DevicePingResponder {
394 fn drop(&mut self) {
395 self.control_handle.shutdown();
396 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
398 }
399}
400
401impl fidl::endpoints::Responder for DevicePingResponder {
402 type ControlHandle = DeviceControlHandle;
403
404 fn control_handle(&self) -> &DeviceControlHandle {
405 &self.control_handle
406 }
407
408 fn drop_without_shutdown(mut self) {
409 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
411 std::mem::forget(self);
413 }
414}
415
416impl DevicePingResponder {
417 pub fn send(self, mut pong: u32) -> Result<(), fidl::Error> {
421 let _result = self.send_raw(pong);
422 if _result.is_err() {
423 self.control_handle.shutdown();
424 }
425 self.drop_without_shutdown();
426 _result
427 }
428
429 pub fn send_no_shutdown_on_err(self, mut pong: u32) -> Result<(), fidl::Error> {
431 let _result = self.send_raw(pong);
432 self.drop_without_shutdown();
433 _result
434 }
435
436 fn send_raw(&self, mut pong: u32) -> Result<(), fidl::Error> {
437 self.control_handle.inner.send::<DevicePingResponse>(
438 (pong,),
439 self.tx_id,
440 0x53eb4e98ccf32729,
441 fidl::encoding::DynamicFlags::empty(),
442 )
443 }
444}
445
446#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
447pub struct WaiterMarker;
448
449impl fidl::endpoints::ProtocolMarker for WaiterMarker {
450 type Proxy = WaiterProxy;
451 type RequestStream = WaiterRequestStream;
452 #[cfg(target_os = "fuchsia")]
453 type SynchronousProxy = WaiterSynchronousProxy;
454
455 const DEBUG_NAME: &'static str = "fuchsia.basicdriver.ctftest.Waiter";
456}
457impl fidl::endpoints::DiscoverableProtocolMarker for WaiterMarker {}
458
459pub trait WaiterProxyInterface: Send + Sync {
460 fn r#ack(&self) -> Result<(), fidl::Error>;
461}
462#[derive(Debug)]
463#[cfg(target_os = "fuchsia")]
464pub struct WaiterSynchronousProxy {
465 client: fidl::client::sync::Client,
466}
467
468#[cfg(target_os = "fuchsia")]
469impl fidl::endpoints::SynchronousProxy for WaiterSynchronousProxy {
470 type Proxy = WaiterProxy;
471 type Protocol = WaiterMarker;
472
473 fn from_channel(inner: fidl::Channel) -> Self {
474 Self::new(inner)
475 }
476
477 fn into_channel(self) -> fidl::Channel {
478 self.client.into_channel()
479 }
480
481 fn as_channel(&self) -> &fidl::Channel {
482 self.client.as_channel()
483 }
484}
485
486#[cfg(target_os = "fuchsia")]
487impl WaiterSynchronousProxy {
488 pub fn new(channel: fidl::Channel) -> Self {
489 let protocol_name = <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
490 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
491 }
492
493 pub fn into_channel(self) -> fidl::Channel {
494 self.client.into_channel()
495 }
496
497 pub fn wait_for_event(
500 &self,
501 deadline: zx::MonotonicInstant,
502 ) -> Result<WaiterEvent, fidl::Error> {
503 WaiterEvent::decode(self.client.wait_for_event(deadline)?)
504 }
505
506 pub fn r#ack(&self) -> Result<(), fidl::Error> {
507 self.client.send::<fidl::encoding::EmptyPayload>(
508 (),
509 0x70e5c3f344540efa,
510 fidl::encoding::DynamicFlags::empty(),
511 )
512 }
513}
514
515#[cfg(target_os = "fuchsia")]
516impl From<WaiterSynchronousProxy> for zx::Handle {
517 fn from(value: WaiterSynchronousProxy) -> Self {
518 value.into_channel().into()
519 }
520}
521
522#[cfg(target_os = "fuchsia")]
523impl From<fidl::Channel> for WaiterSynchronousProxy {
524 fn from(value: fidl::Channel) -> Self {
525 Self::new(value)
526 }
527}
528
529#[cfg(target_os = "fuchsia")]
530impl fidl::endpoints::FromClient for WaiterSynchronousProxy {
531 type Protocol = WaiterMarker;
532
533 fn from_client(value: fidl::endpoints::ClientEnd<WaiterMarker>) -> Self {
534 Self::new(value.into_channel())
535 }
536}
537
538#[derive(Debug, Clone)]
539pub struct WaiterProxy {
540 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
541}
542
543impl fidl::endpoints::Proxy for WaiterProxy {
544 type Protocol = WaiterMarker;
545
546 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
547 Self::new(inner)
548 }
549
550 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
551 self.client.into_channel().map_err(|client| Self { client })
552 }
553
554 fn as_channel(&self) -> &::fidl::AsyncChannel {
555 self.client.as_channel()
556 }
557}
558
559impl WaiterProxy {
560 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
562 let protocol_name = <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
563 Self { client: fidl::client::Client::new(channel, protocol_name) }
564 }
565
566 pub fn take_event_stream(&self) -> WaiterEventStream {
572 WaiterEventStream { event_receiver: self.client.take_event_receiver() }
573 }
574
575 pub fn r#ack(&self) -> Result<(), fidl::Error> {
576 WaiterProxyInterface::r#ack(self)
577 }
578}
579
580impl WaiterProxyInterface for WaiterProxy {
581 fn r#ack(&self) -> Result<(), fidl::Error> {
582 self.client.send::<fidl::encoding::EmptyPayload>(
583 (),
584 0x70e5c3f344540efa,
585 fidl::encoding::DynamicFlags::empty(),
586 )
587 }
588}
589
590pub struct WaiterEventStream {
591 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
592}
593
594impl std::marker::Unpin for WaiterEventStream {}
595
596impl futures::stream::FusedStream for WaiterEventStream {
597 fn is_terminated(&self) -> bool {
598 self.event_receiver.is_terminated()
599 }
600}
601
602impl futures::Stream for WaiterEventStream {
603 type Item = Result<WaiterEvent, fidl::Error>;
604
605 fn poll_next(
606 mut self: std::pin::Pin<&mut Self>,
607 cx: &mut std::task::Context<'_>,
608 ) -> std::task::Poll<Option<Self::Item>> {
609 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
610 &mut self.event_receiver,
611 cx
612 )?) {
613 Some(buf) => std::task::Poll::Ready(Some(WaiterEvent::decode(buf))),
614 None => std::task::Poll::Ready(None),
615 }
616 }
617}
618
619#[derive(Debug)]
620pub enum WaiterEvent {}
621
622impl WaiterEvent {
623 fn decode(
625 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
626 ) -> Result<WaiterEvent, fidl::Error> {
627 let (bytes, _handles) = buf.split_mut();
628 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
629 debug_assert_eq!(tx_header.tx_id, 0);
630 match tx_header.ordinal {
631 _ => Err(fidl::Error::UnknownOrdinal {
632 ordinal: tx_header.ordinal,
633 protocol_name: <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
634 }),
635 }
636 }
637}
638
639pub struct WaiterRequestStream {
641 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
642 is_terminated: bool,
643}
644
645impl std::marker::Unpin for WaiterRequestStream {}
646
647impl futures::stream::FusedStream for WaiterRequestStream {
648 fn is_terminated(&self) -> bool {
649 self.is_terminated
650 }
651}
652
653impl fidl::endpoints::RequestStream for WaiterRequestStream {
654 type Protocol = WaiterMarker;
655 type ControlHandle = WaiterControlHandle;
656
657 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
658 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
659 }
660
661 fn control_handle(&self) -> Self::ControlHandle {
662 WaiterControlHandle { inner: self.inner.clone() }
663 }
664
665 fn into_inner(
666 self,
667 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
668 {
669 (self.inner, self.is_terminated)
670 }
671
672 fn from_inner(
673 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
674 is_terminated: bool,
675 ) -> Self {
676 Self { inner, is_terminated }
677 }
678}
679
680impl futures::Stream for WaiterRequestStream {
681 type Item = Result<WaiterRequest, fidl::Error>;
682
683 fn poll_next(
684 mut self: std::pin::Pin<&mut Self>,
685 cx: &mut std::task::Context<'_>,
686 ) -> std::task::Poll<Option<Self::Item>> {
687 let this = &mut *self;
688 if this.inner.check_shutdown(cx) {
689 this.is_terminated = true;
690 return std::task::Poll::Ready(None);
691 }
692 if this.is_terminated {
693 panic!("polled WaiterRequestStream after completion");
694 }
695 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
696 |bytes, handles| {
697 match this.inner.channel().read_etc(cx, bytes, handles) {
698 std::task::Poll::Ready(Ok(())) => {}
699 std::task::Poll::Pending => return std::task::Poll::Pending,
700 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
701 this.is_terminated = true;
702 return std::task::Poll::Ready(None);
703 }
704 std::task::Poll::Ready(Err(e)) => {
705 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
706 e.into(),
707 ))))
708 }
709 }
710
711 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
713
714 std::task::Poll::Ready(Some(match header.ordinal {
715 0x70e5c3f344540efa => {
716 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
717 let mut req = fidl::new_empty!(
718 fidl::encoding::EmptyPayload,
719 fidl::encoding::DefaultFuchsiaResourceDialect
720 );
721 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
722 let control_handle = WaiterControlHandle { inner: this.inner.clone() };
723 Ok(WaiterRequest::Ack { control_handle })
724 }
725 _ => Err(fidl::Error::UnknownOrdinal {
726 ordinal: header.ordinal,
727 protocol_name:
728 <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
729 }),
730 }))
731 },
732 )
733 }
734}
735
736#[derive(Debug)]
737pub enum WaiterRequest {
738 Ack { control_handle: WaiterControlHandle },
739}
740
741impl WaiterRequest {
742 #[allow(irrefutable_let_patterns)]
743 pub fn into_ack(self) -> Option<(WaiterControlHandle)> {
744 if let WaiterRequest::Ack { control_handle } = self {
745 Some((control_handle))
746 } else {
747 None
748 }
749 }
750
751 pub fn method_name(&self) -> &'static str {
753 match *self {
754 WaiterRequest::Ack { .. } => "ack",
755 }
756 }
757}
758
759#[derive(Debug, Clone)]
760pub struct WaiterControlHandle {
761 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
762}
763
764impl fidl::endpoints::ControlHandle for WaiterControlHandle {
765 fn shutdown(&self) {
766 self.inner.shutdown()
767 }
768 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
769 self.inner.shutdown_with_epitaph(status)
770 }
771
772 fn is_closed(&self) -> bool {
773 self.inner.channel().is_closed()
774 }
775 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
776 self.inner.channel().on_closed()
777 }
778
779 #[cfg(target_os = "fuchsia")]
780 fn signal_peer(
781 &self,
782 clear_mask: zx::Signals,
783 set_mask: zx::Signals,
784 ) -> Result<(), zx_status::Status> {
785 use fidl::Peered;
786 self.inner.channel().signal_peer(clear_mask, set_mask)
787 }
788}
789
790impl WaiterControlHandle {}
791
792#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
793pub struct ServiceMarker;
794
795#[cfg(target_os = "fuchsia")]
796impl fidl::endpoints::ServiceMarker for ServiceMarker {
797 type Proxy = ServiceProxy;
798 type Request = ServiceRequest;
799 const SERVICE_NAME: &'static str = "fuchsia.basicdriver.ctftest.Service";
800}
801
802#[cfg(target_os = "fuchsia")]
805pub enum ServiceRequest {
806 Device(DeviceRequestStream),
807}
808
809#[cfg(target_os = "fuchsia")]
810impl fidl::endpoints::ServiceRequest for ServiceRequest {
811 type Service = ServiceMarker;
812
813 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
814 match name {
815 "device" => Self::Device(
816 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
817 ),
818 _ => panic!("no such member protocol name for service Service"),
819 }
820 }
821
822 fn member_names() -> &'static [&'static str] {
823 &["device"]
824 }
825}
826#[cfg(target_os = "fuchsia")]
827pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
828
829#[cfg(target_os = "fuchsia")]
830impl fidl::endpoints::ServiceProxy for ServiceProxy {
831 type Service = ServiceMarker;
832
833 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
834 Self(opener)
835 }
836}
837
838#[cfg(target_os = "fuchsia")]
839impl ServiceProxy {
840 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
841 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
842 self.connect_channel_to_device(server_end)?;
843 Ok(proxy)
844 }
845
846 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
849 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
850 self.connect_channel_to_device(server_end)?;
851 Ok(proxy)
852 }
853
854 pub fn connect_channel_to_device(
857 &self,
858 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
859 ) -> Result<(), fidl::Error> {
860 self.0.open_member("device", server_end.into_channel())
861 }
862
863 pub fn instance_name(&self) -> &str {
864 self.0.instance_name()
865 }
866}
867
868mod internal {
869 use super::*;
870}