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::NullableHandle {
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 { Some((responder)) } else { None }
336 }
337
338 pub fn method_name(&self) -> &'static str {
340 match *self {
341 DeviceRequest::Ping { .. } => "ping",
342 }
343 }
344}
345
346#[derive(Debug, Clone)]
347pub struct DeviceControlHandle {
348 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
349}
350
351impl fidl::endpoints::ControlHandle for DeviceControlHandle {
352 fn shutdown(&self) {
353 self.inner.shutdown()
354 }
355
356 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
357 self.inner.shutdown_with_epitaph(status)
358 }
359
360 fn is_closed(&self) -> bool {
361 self.inner.channel().is_closed()
362 }
363 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
364 self.inner.channel().on_closed()
365 }
366
367 #[cfg(target_os = "fuchsia")]
368 fn signal_peer(
369 &self,
370 clear_mask: zx::Signals,
371 set_mask: zx::Signals,
372 ) -> Result<(), zx_status::Status> {
373 use fidl::Peered;
374 self.inner.channel().signal_peer(clear_mask, set_mask)
375 }
376}
377
378impl DeviceControlHandle {}
379
380#[must_use = "FIDL methods require a response to be sent"]
381#[derive(Debug)]
382pub struct DevicePingResponder {
383 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
384 tx_id: u32,
385}
386
387impl std::ops::Drop for DevicePingResponder {
391 fn drop(&mut self) {
392 self.control_handle.shutdown();
393 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
395 }
396}
397
398impl fidl::endpoints::Responder for DevicePingResponder {
399 type ControlHandle = DeviceControlHandle;
400
401 fn control_handle(&self) -> &DeviceControlHandle {
402 &self.control_handle
403 }
404
405 fn drop_without_shutdown(mut self) {
406 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
408 std::mem::forget(self);
410 }
411}
412
413impl DevicePingResponder {
414 pub fn send(self, mut pong: u32) -> Result<(), fidl::Error> {
418 let _result = self.send_raw(pong);
419 if _result.is_err() {
420 self.control_handle.shutdown();
421 }
422 self.drop_without_shutdown();
423 _result
424 }
425
426 pub fn send_no_shutdown_on_err(self, mut pong: u32) -> Result<(), fidl::Error> {
428 let _result = self.send_raw(pong);
429 self.drop_without_shutdown();
430 _result
431 }
432
433 fn send_raw(&self, mut pong: u32) -> Result<(), fidl::Error> {
434 self.control_handle.inner.send::<DevicePingResponse>(
435 (pong,),
436 self.tx_id,
437 0x53eb4e98ccf32729,
438 fidl::encoding::DynamicFlags::empty(),
439 )
440 }
441}
442
443#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
444pub struct WaiterMarker;
445
446impl fidl::endpoints::ProtocolMarker for WaiterMarker {
447 type Proxy = WaiterProxy;
448 type RequestStream = WaiterRequestStream;
449 #[cfg(target_os = "fuchsia")]
450 type SynchronousProxy = WaiterSynchronousProxy;
451
452 const DEBUG_NAME: &'static str = "fuchsia.basicdriver.ctftest.Waiter";
453}
454impl fidl::endpoints::DiscoverableProtocolMarker for WaiterMarker {}
455
456pub trait WaiterProxyInterface: Send + Sync {
457 fn r#ack(&self) -> Result<(), fidl::Error>;
458}
459#[derive(Debug)]
460#[cfg(target_os = "fuchsia")]
461pub struct WaiterSynchronousProxy {
462 client: fidl::client::sync::Client,
463}
464
465#[cfg(target_os = "fuchsia")]
466impl fidl::endpoints::SynchronousProxy for WaiterSynchronousProxy {
467 type Proxy = WaiterProxy;
468 type Protocol = WaiterMarker;
469
470 fn from_channel(inner: fidl::Channel) -> Self {
471 Self::new(inner)
472 }
473
474 fn into_channel(self) -> fidl::Channel {
475 self.client.into_channel()
476 }
477
478 fn as_channel(&self) -> &fidl::Channel {
479 self.client.as_channel()
480 }
481}
482
483#[cfg(target_os = "fuchsia")]
484impl WaiterSynchronousProxy {
485 pub fn new(channel: fidl::Channel) -> Self {
486 let protocol_name = <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
487 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
488 }
489
490 pub fn into_channel(self) -> fidl::Channel {
491 self.client.into_channel()
492 }
493
494 pub fn wait_for_event(
497 &self,
498 deadline: zx::MonotonicInstant,
499 ) -> Result<WaiterEvent, fidl::Error> {
500 WaiterEvent::decode(self.client.wait_for_event(deadline)?)
501 }
502
503 pub fn r#ack(&self) -> Result<(), fidl::Error> {
504 self.client.send::<fidl::encoding::EmptyPayload>(
505 (),
506 0x70e5c3f344540efa,
507 fidl::encoding::DynamicFlags::empty(),
508 )
509 }
510}
511
512#[cfg(target_os = "fuchsia")]
513impl From<WaiterSynchronousProxy> for zx::NullableHandle {
514 fn from(value: WaiterSynchronousProxy) -> Self {
515 value.into_channel().into()
516 }
517}
518
519#[cfg(target_os = "fuchsia")]
520impl From<fidl::Channel> for WaiterSynchronousProxy {
521 fn from(value: fidl::Channel) -> Self {
522 Self::new(value)
523 }
524}
525
526#[cfg(target_os = "fuchsia")]
527impl fidl::endpoints::FromClient for WaiterSynchronousProxy {
528 type Protocol = WaiterMarker;
529
530 fn from_client(value: fidl::endpoints::ClientEnd<WaiterMarker>) -> Self {
531 Self::new(value.into_channel())
532 }
533}
534
535#[derive(Debug, Clone)]
536pub struct WaiterProxy {
537 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
538}
539
540impl fidl::endpoints::Proxy for WaiterProxy {
541 type Protocol = WaiterMarker;
542
543 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
544 Self::new(inner)
545 }
546
547 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
548 self.client.into_channel().map_err(|client| Self { client })
549 }
550
551 fn as_channel(&self) -> &::fidl::AsyncChannel {
552 self.client.as_channel()
553 }
554}
555
556impl WaiterProxy {
557 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
559 let protocol_name = <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
560 Self { client: fidl::client::Client::new(channel, protocol_name) }
561 }
562
563 pub fn take_event_stream(&self) -> WaiterEventStream {
569 WaiterEventStream { event_receiver: self.client.take_event_receiver() }
570 }
571
572 pub fn r#ack(&self) -> Result<(), fidl::Error> {
573 WaiterProxyInterface::r#ack(self)
574 }
575}
576
577impl WaiterProxyInterface for WaiterProxy {
578 fn r#ack(&self) -> Result<(), fidl::Error> {
579 self.client.send::<fidl::encoding::EmptyPayload>(
580 (),
581 0x70e5c3f344540efa,
582 fidl::encoding::DynamicFlags::empty(),
583 )
584 }
585}
586
587pub struct WaiterEventStream {
588 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
589}
590
591impl std::marker::Unpin for WaiterEventStream {}
592
593impl futures::stream::FusedStream for WaiterEventStream {
594 fn is_terminated(&self) -> bool {
595 self.event_receiver.is_terminated()
596 }
597}
598
599impl futures::Stream for WaiterEventStream {
600 type Item = Result<WaiterEvent, fidl::Error>;
601
602 fn poll_next(
603 mut self: std::pin::Pin<&mut Self>,
604 cx: &mut std::task::Context<'_>,
605 ) -> std::task::Poll<Option<Self::Item>> {
606 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
607 &mut self.event_receiver,
608 cx
609 )?) {
610 Some(buf) => std::task::Poll::Ready(Some(WaiterEvent::decode(buf))),
611 None => std::task::Poll::Ready(None),
612 }
613 }
614}
615
616#[derive(Debug)]
617pub enum WaiterEvent {}
618
619impl WaiterEvent {
620 fn decode(
622 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
623 ) -> Result<WaiterEvent, fidl::Error> {
624 let (bytes, _handles) = buf.split_mut();
625 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
626 debug_assert_eq!(tx_header.tx_id, 0);
627 match tx_header.ordinal {
628 _ => Err(fidl::Error::UnknownOrdinal {
629 ordinal: tx_header.ordinal,
630 protocol_name: <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
631 }),
632 }
633 }
634}
635
636pub struct WaiterRequestStream {
638 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
639 is_terminated: bool,
640}
641
642impl std::marker::Unpin for WaiterRequestStream {}
643
644impl futures::stream::FusedStream for WaiterRequestStream {
645 fn is_terminated(&self) -> bool {
646 self.is_terminated
647 }
648}
649
650impl fidl::endpoints::RequestStream for WaiterRequestStream {
651 type Protocol = WaiterMarker;
652 type ControlHandle = WaiterControlHandle;
653
654 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
655 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
656 }
657
658 fn control_handle(&self) -> Self::ControlHandle {
659 WaiterControlHandle { inner: self.inner.clone() }
660 }
661
662 fn into_inner(
663 self,
664 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
665 {
666 (self.inner, self.is_terminated)
667 }
668
669 fn from_inner(
670 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
671 is_terminated: bool,
672 ) -> Self {
673 Self { inner, is_terminated }
674 }
675}
676
677impl futures::Stream for WaiterRequestStream {
678 type Item = Result<WaiterRequest, fidl::Error>;
679
680 fn poll_next(
681 mut self: std::pin::Pin<&mut Self>,
682 cx: &mut std::task::Context<'_>,
683 ) -> std::task::Poll<Option<Self::Item>> {
684 let this = &mut *self;
685 if this.inner.check_shutdown(cx) {
686 this.is_terminated = true;
687 return std::task::Poll::Ready(None);
688 }
689 if this.is_terminated {
690 panic!("polled WaiterRequestStream after completion");
691 }
692 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
693 |bytes, handles| {
694 match this.inner.channel().read_etc(cx, bytes, handles) {
695 std::task::Poll::Ready(Ok(())) => {}
696 std::task::Poll::Pending => return std::task::Poll::Pending,
697 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
698 this.is_terminated = true;
699 return std::task::Poll::Ready(None);
700 }
701 std::task::Poll::Ready(Err(e)) => {
702 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
703 e.into(),
704 ))));
705 }
706 }
707
708 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
710
711 std::task::Poll::Ready(Some(match header.ordinal {
712 0x70e5c3f344540efa => {
713 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
714 let mut req = fidl::new_empty!(
715 fidl::encoding::EmptyPayload,
716 fidl::encoding::DefaultFuchsiaResourceDialect
717 );
718 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
719 let control_handle = WaiterControlHandle { inner: this.inner.clone() };
720 Ok(WaiterRequest::Ack { control_handle })
721 }
722 _ => Err(fidl::Error::UnknownOrdinal {
723 ordinal: header.ordinal,
724 protocol_name:
725 <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
726 }),
727 }))
728 },
729 )
730 }
731}
732
733#[derive(Debug)]
734pub enum WaiterRequest {
735 Ack { control_handle: WaiterControlHandle },
736}
737
738impl WaiterRequest {
739 #[allow(irrefutable_let_patterns)]
740 pub fn into_ack(self) -> Option<(WaiterControlHandle)> {
741 if let WaiterRequest::Ack { control_handle } = self { Some((control_handle)) } else { None }
742 }
743
744 pub fn method_name(&self) -> &'static str {
746 match *self {
747 WaiterRequest::Ack { .. } => "ack",
748 }
749 }
750}
751
752#[derive(Debug, Clone)]
753pub struct WaiterControlHandle {
754 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
755}
756
757impl fidl::endpoints::ControlHandle for WaiterControlHandle {
758 fn shutdown(&self) {
759 self.inner.shutdown()
760 }
761
762 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
763 self.inner.shutdown_with_epitaph(status)
764 }
765
766 fn is_closed(&self) -> bool {
767 self.inner.channel().is_closed()
768 }
769 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
770 self.inner.channel().on_closed()
771 }
772
773 #[cfg(target_os = "fuchsia")]
774 fn signal_peer(
775 &self,
776 clear_mask: zx::Signals,
777 set_mask: zx::Signals,
778 ) -> Result<(), zx_status::Status> {
779 use fidl::Peered;
780 self.inner.channel().signal_peer(clear_mask, set_mask)
781 }
782}
783
784impl WaiterControlHandle {}
785
786#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
787pub struct ServiceMarker;
788
789#[cfg(target_os = "fuchsia")]
790impl fidl::endpoints::ServiceMarker for ServiceMarker {
791 type Proxy = ServiceProxy;
792 type Request = ServiceRequest;
793 const SERVICE_NAME: &'static str = "fuchsia.basicdriver.ctftest.Service";
794}
795
796#[cfg(target_os = "fuchsia")]
799pub enum ServiceRequest {
800 Device(DeviceRequestStream),
801}
802
803#[cfg(target_os = "fuchsia")]
804impl fidl::endpoints::ServiceRequest for ServiceRequest {
805 type Service = ServiceMarker;
806
807 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
808 match name {
809 "device" => Self::Device(
810 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
811 ),
812 _ => panic!("no such member protocol name for service Service"),
813 }
814 }
815
816 fn member_names() -> &'static [&'static str] {
817 &["device"]
818 }
819}
820#[cfg(target_os = "fuchsia")]
821pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
822
823#[cfg(target_os = "fuchsia")]
824impl fidl::endpoints::ServiceProxy for ServiceProxy {
825 type Service = ServiceMarker;
826
827 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
828 Self(opener)
829 }
830}
831
832#[cfg(target_os = "fuchsia")]
833impl ServiceProxy {
834 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
835 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
836 self.connect_channel_to_device(server_end)?;
837 Ok(proxy)
838 }
839
840 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
843 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
844 self.connect_channel_to_device(server_end)?;
845 Ok(proxy)
846 }
847
848 pub fn connect_channel_to_device(
851 &self,
852 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
853 ) -> Result<(), fidl::Error> {
854 self.0.open_member("device", server_end.into_channel())
855 }
856
857 pub fn instance_name(&self) -> &str {
858 self.0.instance_name()
859 }
860}
861
862mod internal {
863 use super::*;
864}