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_diagnostics_test_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DetectControllerEnterTestModeRequest {
16 pub test_controller: fidl::endpoints::ServerEnd<TestCaseControllerMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for DetectControllerEnterTestModeRequest
21{
22}
23
24#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub struct DetectControllerMarker;
26
27impl fidl::endpoints::ProtocolMarker for DetectControllerMarker {
28 type Proxy = DetectControllerProxy;
29 type RequestStream = DetectControllerRequestStream;
30 #[cfg(target_os = "fuchsia")]
31 type SynchronousProxy = DetectControllerSynchronousProxy;
32
33 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.test.DetectController";
34}
35impl fidl::endpoints::DiscoverableProtocolMarker for DetectControllerMarker {}
36
37pub trait DetectControllerProxyInterface: Send + Sync {
38 type EnterTestModeResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
39 fn r#enter_test_mode(
40 &self,
41 test_controller: fidl::endpoints::ServerEnd<TestCaseControllerMarker>,
42 ) -> Self::EnterTestModeResponseFut;
43}
44#[derive(Debug)]
45#[cfg(target_os = "fuchsia")]
46pub struct DetectControllerSynchronousProxy {
47 client: fidl::client::sync::Client,
48}
49
50#[cfg(target_os = "fuchsia")]
51impl fidl::endpoints::SynchronousProxy for DetectControllerSynchronousProxy {
52 type Proxy = DetectControllerProxy;
53 type Protocol = DetectControllerMarker;
54
55 fn from_channel(inner: fidl::Channel) -> Self {
56 Self::new(inner)
57 }
58
59 fn into_channel(self) -> fidl::Channel {
60 self.client.into_channel()
61 }
62
63 fn as_channel(&self) -> &fidl::Channel {
64 self.client.as_channel()
65 }
66}
67
68#[cfg(target_os = "fuchsia")]
69impl DetectControllerSynchronousProxy {
70 pub fn new(channel: fidl::Channel) -> Self {
71 Self { client: fidl::client::sync::Client::new(channel) }
72 }
73
74 pub fn into_channel(self) -> fidl::Channel {
75 self.client.into_channel()
76 }
77
78 pub fn wait_for_event(
81 &self,
82 deadline: zx::MonotonicInstant,
83 ) -> Result<DetectControllerEvent, fidl::Error> {
84 DetectControllerEvent::decode(
85 self.client.wait_for_event::<DetectControllerMarker>(deadline)?,
86 )
87 }
88
89 pub fn r#enter_test_mode(
93 &self,
94 mut test_controller: fidl::endpoints::ServerEnd<TestCaseControllerMarker>,
95 ___deadline: zx::MonotonicInstant,
96 ) -> Result<(), fidl::Error> {
97 let _response = self.client.send_query::<
98 DetectControllerEnterTestModeRequest,
99 fidl::encoding::EmptyPayload,
100 DetectControllerMarker,
101 >(
102 (test_controller,),
103 0x6f4bb79cfba4f84,
104 fidl::encoding::DynamicFlags::empty(),
105 ___deadline,
106 )?;
107 Ok(_response)
108 }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl From<DetectControllerSynchronousProxy> for zx::NullableHandle {
113 fn from(value: DetectControllerSynchronousProxy) -> Self {
114 value.into_channel().into()
115 }
116}
117
118#[cfg(target_os = "fuchsia")]
119impl From<fidl::Channel> for DetectControllerSynchronousProxy {
120 fn from(value: fidl::Channel) -> Self {
121 Self::new(value)
122 }
123}
124
125#[cfg(target_os = "fuchsia")]
126impl fidl::endpoints::FromClient for DetectControllerSynchronousProxy {
127 type Protocol = DetectControllerMarker;
128
129 fn from_client(value: fidl::endpoints::ClientEnd<DetectControllerMarker>) -> Self {
130 Self::new(value.into_channel())
131 }
132}
133
134#[derive(Debug, Clone)]
135pub struct DetectControllerProxy {
136 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
137}
138
139impl fidl::endpoints::Proxy for DetectControllerProxy {
140 type Protocol = DetectControllerMarker;
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 DetectControllerProxy {
156 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
158 let protocol_name = <DetectControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
159 Self { client: fidl::client::Client::new(channel, protocol_name) }
160 }
161
162 pub fn take_event_stream(&self) -> DetectControllerEventStream {
168 DetectControllerEventStream { event_receiver: self.client.take_event_receiver() }
169 }
170
171 pub fn r#enter_test_mode(
175 &self,
176 mut test_controller: fidl::endpoints::ServerEnd<TestCaseControllerMarker>,
177 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
178 DetectControllerProxyInterface::r#enter_test_mode(self, test_controller)
179 }
180}
181
182impl DetectControllerProxyInterface for DetectControllerProxy {
183 type EnterTestModeResponseFut =
184 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
185 fn r#enter_test_mode(
186 &self,
187 mut test_controller: fidl::endpoints::ServerEnd<TestCaseControllerMarker>,
188 ) -> Self::EnterTestModeResponseFut {
189 fn _decode(
190 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
191 ) -> Result<(), fidl::Error> {
192 let _response = fidl::client::decode_transaction_body::<
193 fidl::encoding::EmptyPayload,
194 fidl::encoding::DefaultFuchsiaResourceDialect,
195 0x6f4bb79cfba4f84,
196 >(_buf?)?;
197 Ok(_response)
198 }
199 self.client.send_query_and_decode::<DetectControllerEnterTestModeRequest, ()>(
200 (test_controller,),
201 0x6f4bb79cfba4f84,
202 fidl::encoding::DynamicFlags::empty(),
203 _decode,
204 )
205 }
206}
207
208pub struct DetectControllerEventStream {
209 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
210}
211
212impl std::marker::Unpin for DetectControllerEventStream {}
213
214impl futures::stream::FusedStream for DetectControllerEventStream {
215 fn is_terminated(&self) -> bool {
216 self.event_receiver.is_terminated()
217 }
218}
219
220impl futures::Stream for DetectControllerEventStream {
221 type Item = Result<DetectControllerEvent, fidl::Error>;
222
223 fn poll_next(
224 mut self: std::pin::Pin<&mut Self>,
225 cx: &mut std::task::Context<'_>,
226 ) -> std::task::Poll<Option<Self::Item>> {
227 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
228 &mut self.event_receiver,
229 cx
230 )?) {
231 Some(buf) => std::task::Poll::Ready(Some(DetectControllerEvent::decode(buf))),
232 None => std::task::Poll::Ready(None),
233 }
234 }
235}
236
237#[derive(Debug)]
238pub enum DetectControllerEvent {}
239
240impl DetectControllerEvent {
241 fn decode(
243 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
244 ) -> Result<DetectControllerEvent, fidl::Error> {
245 let (bytes, _handles) = buf.split_mut();
246 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
247 debug_assert_eq!(tx_header.tx_id, 0);
248 match tx_header.ordinal {
249 _ => Err(fidl::Error::UnknownOrdinal {
250 ordinal: tx_header.ordinal,
251 protocol_name:
252 <DetectControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
253 }),
254 }
255 }
256}
257
258pub struct DetectControllerRequestStream {
260 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
261 is_terminated: bool,
262}
263
264impl std::marker::Unpin for DetectControllerRequestStream {}
265
266impl futures::stream::FusedStream for DetectControllerRequestStream {
267 fn is_terminated(&self) -> bool {
268 self.is_terminated
269 }
270}
271
272impl fidl::endpoints::RequestStream for DetectControllerRequestStream {
273 type Protocol = DetectControllerMarker;
274 type ControlHandle = DetectControllerControlHandle;
275
276 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
277 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
278 }
279
280 fn control_handle(&self) -> Self::ControlHandle {
281 DetectControllerControlHandle { inner: self.inner.clone() }
282 }
283
284 fn into_inner(
285 self,
286 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
287 {
288 (self.inner, self.is_terminated)
289 }
290
291 fn from_inner(
292 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
293 is_terminated: bool,
294 ) -> Self {
295 Self { inner, is_terminated }
296 }
297}
298
299impl futures::Stream for DetectControllerRequestStream {
300 type Item = Result<DetectControllerRequest, fidl::Error>;
301
302 fn poll_next(
303 mut self: std::pin::Pin<&mut Self>,
304 cx: &mut std::task::Context<'_>,
305 ) -> std::task::Poll<Option<Self::Item>> {
306 let this = &mut *self;
307 if this.inner.check_shutdown(cx) {
308 this.is_terminated = true;
309 return std::task::Poll::Ready(None);
310 }
311 if this.is_terminated {
312 panic!("polled DetectControllerRequestStream after completion");
313 }
314 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
315 |bytes, handles| {
316 match this.inner.channel().read_etc(cx, bytes, handles) {
317 std::task::Poll::Ready(Ok(())) => {}
318 std::task::Poll::Pending => return std::task::Poll::Pending,
319 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
320 this.is_terminated = true;
321 return std::task::Poll::Ready(None);
322 }
323 std::task::Poll::Ready(Err(e)) => {
324 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
325 e.into(),
326 ))));
327 }
328 }
329
330 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
332
333 std::task::Poll::Ready(Some(match header.ordinal {
334 0x6f4bb79cfba4f84 => {
335 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
336 let mut req = fidl::new_empty!(
337 DetectControllerEnterTestModeRequest,
338 fidl::encoding::DefaultFuchsiaResourceDialect
339 );
340 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DetectControllerEnterTestModeRequest>(&header, _body_bytes, handles, &mut req)?;
341 let control_handle =
342 DetectControllerControlHandle { inner: this.inner.clone() };
343 Ok(DetectControllerRequest::EnterTestMode {
344 test_controller: req.test_controller,
345
346 responder: DetectControllerEnterTestModeResponder {
347 control_handle: std::mem::ManuallyDrop::new(control_handle),
348 tx_id: header.tx_id,
349 },
350 })
351 }
352 _ => Err(fidl::Error::UnknownOrdinal {
353 ordinal: header.ordinal,
354 protocol_name:
355 <DetectControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
356 }),
357 }))
358 },
359 )
360 }
361}
362
363#[derive(Debug)]
366pub enum DetectControllerRequest {
367 EnterTestMode {
371 test_controller: fidl::endpoints::ServerEnd<TestCaseControllerMarker>,
372 responder: DetectControllerEnterTestModeResponder,
373 },
374}
375
376impl DetectControllerRequest {
377 #[allow(irrefutable_let_patterns)]
378 pub fn into_enter_test_mode(
379 self,
380 ) -> Option<(
381 fidl::endpoints::ServerEnd<TestCaseControllerMarker>,
382 DetectControllerEnterTestModeResponder,
383 )> {
384 if let DetectControllerRequest::EnterTestMode { test_controller, responder } = self {
385 Some((test_controller, responder))
386 } else {
387 None
388 }
389 }
390
391 pub fn method_name(&self) -> &'static str {
393 match *self {
394 DetectControllerRequest::EnterTestMode { .. } => "enter_test_mode",
395 }
396 }
397}
398
399#[derive(Debug, Clone)]
400pub struct DetectControllerControlHandle {
401 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
402}
403
404impl DetectControllerControlHandle {
405 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
406 self.inner.shutdown_with_epitaph(status.into())
407 }
408}
409
410impl fidl::endpoints::ControlHandle for DetectControllerControlHandle {
411 fn shutdown(&self) {
412 self.inner.shutdown()
413 }
414
415 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
416 self.inner.shutdown_with_epitaph(status)
417 }
418
419 fn is_closed(&self) -> bool {
420 self.inner.channel().is_closed()
421 }
422 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
423 self.inner.channel().on_closed()
424 }
425
426 #[cfg(target_os = "fuchsia")]
427 fn signal_peer(
428 &self,
429 clear_mask: zx::Signals,
430 set_mask: zx::Signals,
431 ) -> Result<(), zx_status::Status> {
432 use fidl::Peered;
433 self.inner.channel().signal_peer(clear_mask, set_mask)
434 }
435}
436
437impl DetectControllerControlHandle {}
438
439#[must_use = "FIDL methods require a response to be sent"]
440#[derive(Debug)]
441pub struct DetectControllerEnterTestModeResponder {
442 control_handle: std::mem::ManuallyDrop<DetectControllerControlHandle>,
443 tx_id: u32,
444}
445
446impl std::ops::Drop for DetectControllerEnterTestModeResponder {
450 fn drop(&mut self) {
451 self.control_handle.shutdown();
452 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
454 }
455}
456
457impl fidl::endpoints::Responder for DetectControllerEnterTestModeResponder {
458 type ControlHandle = DetectControllerControlHandle;
459
460 fn control_handle(&self) -> &DetectControllerControlHandle {
461 &self.control_handle
462 }
463
464 fn drop_without_shutdown(mut self) {
465 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
467 std::mem::forget(self);
469 }
470}
471
472impl DetectControllerEnterTestModeResponder {
473 pub fn send(self) -> Result<(), fidl::Error> {
477 let _result = self.send_raw();
478 if _result.is_err() {
479 self.control_handle.shutdown();
480 }
481 self.drop_without_shutdown();
482 _result
483 }
484
485 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
487 let _result = self.send_raw();
488 self.drop_without_shutdown();
489 _result
490 }
491
492 fn send_raw(&self) -> Result<(), fidl::Error> {
493 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
494 (),
495 self.tx_id,
496 0x6f4bb79cfba4f84,
497 fidl::encoding::DynamicFlags::empty(),
498 )
499 }
500}
501
502#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
503pub struct TestCaseControllerMarker;
504
505impl fidl::endpoints::ProtocolMarker for TestCaseControllerMarker {
506 type Proxy = TestCaseControllerProxy;
507 type RequestStream = TestCaseControllerRequestStream;
508 #[cfg(target_os = "fuchsia")]
509 type SynchronousProxy = TestCaseControllerSynchronousProxy;
510
511 const DEBUG_NAME: &'static str = "(anonymous) TestCaseController";
512}
513
514pub trait TestCaseControllerProxyInterface: Send + Sync {
515 type RunDefaultCycleResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
516 fn r#run_default_cycle(&self) -> Self::RunDefaultCycleResponseFut;
517}
518#[derive(Debug)]
519#[cfg(target_os = "fuchsia")]
520pub struct TestCaseControllerSynchronousProxy {
521 client: fidl::client::sync::Client,
522}
523
524#[cfg(target_os = "fuchsia")]
525impl fidl::endpoints::SynchronousProxy for TestCaseControllerSynchronousProxy {
526 type Proxy = TestCaseControllerProxy;
527 type Protocol = TestCaseControllerMarker;
528
529 fn from_channel(inner: fidl::Channel) -> Self {
530 Self::new(inner)
531 }
532
533 fn into_channel(self) -> fidl::Channel {
534 self.client.into_channel()
535 }
536
537 fn as_channel(&self) -> &fidl::Channel {
538 self.client.as_channel()
539 }
540}
541
542#[cfg(target_os = "fuchsia")]
543impl TestCaseControllerSynchronousProxy {
544 pub fn new(channel: fidl::Channel) -> Self {
545 Self { client: fidl::client::sync::Client::new(channel) }
546 }
547
548 pub fn into_channel(self) -> fidl::Channel {
549 self.client.into_channel()
550 }
551
552 pub fn wait_for_event(
555 &self,
556 deadline: zx::MonotonicInstant,
557 ) -> Result<TestCaseControllerEvent, fidl::Error> {
558 TestCaseControllerEvent::decode(
559 self.client.wait_for_event::<TestCaseControllerMarker>(deadline)?,
560 )
561 }
562
563 pub fn r#run_default_cycle(
566 &self,
567 ___deadline: zx::MonotonicInstant,
568 ) -> Result<(), fidl::Error> {
569 let _response = self.client.send_query::<
570 fidl::encoding::EmptyPayload,
571 fidl::encoding::EmptyPayload,
572 TestCaseControllerMarker,
573 >(
574 (),
575 0x6f41c0399849aea2,
576 fidl::encoding::DynamicFlags::empty(),
577 ___deadline,
578 )?;
579 Ok(_response)
580 }
581}
582
583#[cfg(target_os = "fuchsia")]
584impl From<TestCaseControllerSynchronousProxy> for zx::NullableHandle {
585 fn from(value: TestCaseControllerSynchronousProxy) -> Self {
586 value.into_channel().into()
587 }
588}
589
590#[cfg(target_os = "fuchsia")]
591impl From<fidl::Channel> for TestCaseControllerSynchronousProxy {
592 fn from(value: fidl::Channel) -> Self {
593 Self::new(value)
594 }
595}
596
597#[cfg(target_os = "fuchsia")]
598impl fidl::endpoints::FromClient for TestCaseControllerSynchronousProxy {
599 type Protocol = TestCaseControllerMarker;
600
601 fn from_client(value: fidl::endpoints::ClientEnd<TestCaseControllerMarker>) -> Self {
602 Self::new(value.into_channel())
603 }
604}
605
606#[derive(Debug, Clone)]
607pub struct TestCaseControllerProxy {
608 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
609}
610
611impl fidl::endpoints::Proxy for TestCaseControllerProxy {
612 type Protocol = TestCaseControllerMarker;
613
614 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
615 Self::new(inner)
616 }
617
618 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
619 self.client.into_channel().map_err(|client| Self { client })
620 }
621
622 fn as_channel(&self) -> &::fidl::AsyncChannel {
623 self.client.as_channel()
624 }
625}
626
627impl TestCaseControllerProxy {
628 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
630 let protocol_name =
631 <TestCaseControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
632 Self { client: fidl::client::Client::new(channel, protocol_name) }
633 }
634
635 pub fn take_event_stream(&self) -> TestCaseControllerEventStream {
641 TestCaseControllerEventStream { event_receiver: self.client.take_event_receiver() }
642 }
643
644 pub fn r#run_default_cycle(
647 &self,
648 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
649 TestCaseControllerProxyInterface::r#run_default_cycle(self)
650 }
651}
652
653impl TestCaseControllerProxyInterface for TestCaseControllerProxy {
654 type RunDefaultCycleResponseFut =
655 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
656 fn r#run_default_cycle(&self) -> Self::RunDefaultCycleResponseFut {
657 fn _decode(
658 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
659 ) -> Result<(), fidl::Error> {
660 let _response = fidl::client::decode_transaction_body::<
661 fidl::encoding::EmptyPayload,
662 fidl::encoding::DefaultFuchsiaResourceDialect,
663 0x6f41c0399849aea2,
664 >(_buf?)?;
665 Ok(_response)
666 }
667 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
668 (),
669 0x6f41c0399849aea2,
670 fidl::encoding::DynamicFlags::empty(),
671 _decode,
672 )
673 }
674}
675
676pub struct TestCaseControllerEventStream {
677 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
678}
679
680impl std::marker::Unpin for TestCaseControllerEventStream {}
681
682impl futures::stream::FusedStream for TestCaseControllerEventStream {
683 fn is_terminated(&self) -> bool {
684 self.event_receiver.is_terminated()
685 }
686}
687
688impl futures::Stream for TestCaseControllerEventStream {
689 type Item = Result<TestCaseControllerEvent, fidl::Error>;
690
691 fn poll_next(
692 mut self: std::pin::Pin<&mut Self>,
693 cx: &mut std::task::Context<'_>,
694 ) -> std::task::Poll<Option<Self::Item>> {
695 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
696 &mut self.event_receiver,
697 cx
698 )?) {
699 Some(buf) => std::task::Poll::Ready(Some(TestCaseControllerEvent::decode(buf))),
700 None => std::task::Poll::Ready(None),
701 }
702 }
703}
704
705#[derive(Debug)]
706pub enum TestCaseControllerEvent {}
707
708impl TestCaseControllerEvent {
709 fn decode(
711 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
712 ) -> Result<TestCaseControllerEvent, fidl::Error> {
713 let (bytes, _handles) = buf.split_mut();
714 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
715 debug_assert_eq!(tx_header.tx_id, 0);
716 match tx_header.ordinal {
717 _ => Err(fidl::Error::UnknownOrdinal {
718 ordinal: tx_header.ordinal,
719 protocol_name:
720 <TestCaseControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
721 }),
722 }
723 }
724}
725
726pub struct TestCaseControllerRequestStream {
728 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
729 is_terminated: bool,
730}
731
732impl std::marker::Unpin for TestCaseControllerRequestStream {}
733
734impl futures::stream::FusedStream for TestCaseControllerRequestStream {
735 fn is_terminated(&self) -> bool {
736 self.is_terminated
737 }
738}
739
740impl fidl::endpoints::RequestStream for TestCaseControllerRequestStream {
741 type Protocol = TestCaseControllerMarker;
742 type ControlHandle = TestCaseControllerControlHandle;
743
744 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
745 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
746 }
747
748 fn control_handle(&self) -> Self::ControlHandle {
749 TestCaseControllerControlHandle { inner: self.inner.clone() }
750 }
751
752 fn into_inner(
753 self,
754 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
755 {
756 (self.inner, self.is_terminated)
757 }
758
759 fn from_inner(
760 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
761 is_terminated: bool,
762 ) -> Self {
763 Self { inner, is_terminated }
764 }
765}
766
767impl futures::Stream for TestCaseControllerRequestStream {
768 type Item = Result<TestCaseControllerRequest, fidl::Error>;
769
770 fn poll_next(
771 mut self: std::pin::Pin<&mut Self>,
772 cx: &mut std::task::Context<'_>,
773 ) -> std::task::Poll<Option<Self::Item>> {
774 let this = &mut *self;
775 if this.inner.check_shutdown(cx) {
776 this.is_terminated = true;
777 return std::task::Poll::Ready(None);
778 }
779 if this.is_terminated {
780 panic!("polled TestCaseControllerRequestStream after completion");
781 }
782 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
783 |bytes, handles| {
784 match this.inner.channel().read_etc(cx, bytes, handles) {
785 std::task::Poll::Ready(Ok(())) => {}
786 std::task::Poll::Pending => return std::task::Poll::Pending,
787 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
788 this.is_terminated = true;
789 return std::task::Poll::Ready(None);
790 }
791 std::task::Poll::Ready(Err(e)) => {
792 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
793 e.into(),
794 ))));
795 }
796 }
797
798 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
800
801 std::task::Poll::Ready(Some(match header.ordinal {
802 0x6f41c0399849aea2 => {
803 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
804 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
805 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
806 let control_handle = TestCaseControllerControlHandle {
807 inner: this.inner.clone(),
808 };
809 Ok(TestCaseControllerRequest::RunDefaultCycle {
810 responder: TestCaseControllerRunDefaultCycleResponder {
811 control_handle: std::mem::ManuallyDrop::new(control_handle),
812 tx_id: header.tx_id,
813 },
814 })
815 }
816 _ => Err(fidl::Error::UnknownOrdinal {
817 ordinal: header.ordinal,
818 protocol_name: <TestCaseControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
819 }),
820 }))
821 },
822 )
823 }
824}
825
826#[derive(Debug)]
830pub enum TestCaseControllerRequest {
831 RunDefaultCycle { responder: TestCaseControllerRunDefaultCycleResponder },
834}
835
836impl TestCaseControllerRequest {
837 #[allow(irrefutable_let_patterns)]
838 pub fn into_run_default_cycle(self) -> Option<(TestCaseControllerRunDefaultCycleResponder)> {
839 if let TestCaseControllerRequest::RunDefaultCycle { responder } = self {
840 Some((responder))
841 } else {
842 None
843 }
844 }
845
846 pub fn method_name(&self) -> &'static str {
848 match *self {
849 TestCaseControllerRequest::RunDefaultCycle { .. } => "run_default_cycle",
850 }
851 }
852}
853
854#[derive(Debug, Clone)]
855pub struct TestCaseControllerControlHandle {
856 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
857}
858
859impl TestCaseControllerControlHandle {
860 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
861 self.inner.shutdown_with_epitaph(status.into())
862 }
863}
864
865impl fidl::endpoints::ControlHandle for TestCaseControllerControlHandle {
866 fn shutdown(&self) {
867 self.inner.shutdown()
868 }
869
870 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
871 self.inner.shutdown_with_epitaph(status)
872 }
873
874 fn is_closed(&self) -> bool {
875 self.inner.channel().is_closed()
876 }
877 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
878 self.inner.channel().on_closed()
879 }
880
881 #[cfg(target_os = "fuchsia")]
882 fn signal_peer(
883 &self,
884 clear_mask: zx::Signals,
885 set_mask: zx::Signals,
886 ) -> Result<(), zx_status::Status> {
887 use fidl::Peered;
888 self.inner.channel().signal_peer(clear_mask, set_mask)
889 }
890}
891
892impl TestCaseControllerControlHandle {}
893
894#[must_use = "FIDL methods require a response to be sent"]
895#[derive(Debug)]
896pub struct TestCaseControllerRunDefaultCycleResponder {
897 control_handle: std::mem::ManuallyDrop<TestCaseControllerControlHandle>,
898 tx_id: u32,
899}
900
901impl std::ops::Drop for TestCaseControllerRunDefaultCycleResponder {
905 fn drop(&mut self) {
906 self.control_handle.shutdown();
907 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
909 }
910}
911
912impl fidl::endpoints::Responder for TestCaseControllerRunDefaultCycleResponder {
913 type ControlHandle = TestCaseControllerControlHandle;
914
915 fn control_handle(&self) -> &TestCaseControllerControlHandle {
916 &self.control_handle
917 }
918
919 fn drop_without_shutdown(mut self) {
920 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
922 std::mem::forget(self);
924 }
925}
926
927impl TestCaseControllerRunDefaultCycleResponder {
928 pub fn send(self) -> Result<(), fidl::Error> {
932 let _result = self.send_raw();
933 if _result.is_err() {
934 self.control_handle.shutdown();
935 }
936 self.drop_without_shutdown();
937 _result
938 }
939
940 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
942 let _result = self.send_raw();
943 self.drop_without_shutdown();
944 _result
945 }
946
947 fn send_raw(&self) -> Result<(), fidl::Error> {
948 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
949 (),
950 self.tx_id,
951 0x6f41c0399849aea2,
952 fidl::encoding::DynamicFlags::empty(),
953 )
954 }
955}
956
957mod internal {
958 use super::*;
959
960 impl fidl::encoding::ResourceTypeMarker for DetectControllerEnterTestModeRequest {
961 type Borrowed<'a> = &'a mut Self;
962 fn take_or_borrow<'a>(
963 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
964 ) -> Self::Borrowed<'a> {
965 value
966 }
967 }
968
969 unsafe impl fidl::encoding::TypeMarker for DetectControllerEnterTestModeRequest {
970 type Owned = Self;
971
972 #[inline(always)]
973 fn inline_align(_context: fidl::encoding::Context) -> usize {
974 4
975 }
976
977 #[inline(always)]
978 fn inline_size(_context: fidl::encoding::Context) -> usize {
979 4
980 }
981 }
982
983 unsafe impl
984 fidl::encoding::Encode<
985 DetectControllerEnterTestModeRequest,
986 fidl::encoding::DefaultFuchsiaResourceDialect,
987 > for &mut DetectControllerEnterTestModeRequest
988 {
989 #[inline]
990 unsafe fn encode(
991 self,
992 encoder: &mut fidl::encoding::Encoder<
993 '_,
994 fidl::encoding::DefaultFuchsiaResourceDialect,
995 >,
996 offset: usize,
997 _depth: fidl::encoding::Depth,
998 ) -> fidl::Result<()> {
999 encoder.debug_check_bounds::<DetectControllerEnterTestModeRequest>(offset);
1000 fidl::encoding::Encode::<DetectControllerEnterTestModeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1002 (
1003 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TestCaseControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.test_controller),
1004 ),
1005 encoder, offset, _depth
1006 )
1007 }
1008 }
1009 unsafe impl<
1010 T0: fidl::encoding::Encode<
1011 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TestCaseControllerMarker>>,
1012 fidl::encoding::DefaultFuchsiaResourceDialect,
1013 >,
1014 >
1015 fidl::encoding::Encode<
1016 DetectControllerEnterTestModeRequest,
1017 fidl::encoding::DefaultFuchsiaResourceDialect,
1018 > for (T0,)
1019 {
1020 #[inline]
1021 unsafe fn encode(
1022 self,
1023 encoder: &mut fidl::encoding::Encoder<
1024 '_,
1025 fidl::encoding::DefaultFuchsiaResourceDialect,
1026 >,
1027 offset: usize,
1028 depth: fidl::encoding::Depth,
1029 ) -> fidl::Result<()> {
1030 encoder.debug_check_bounds::<DetectControllerEnterTestModeRequest>(offset);
1031 self.0.encode(encoder, offset + 0, depth)?;
1035 Ok(())
1036 }
1037 }
1038
1039 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1040 for DetectControllerEnterTestModeRequest
1041 {
1042 #[inline(always)]
1043 fn new_empty() -> Self {
1044 Self {
1045 test_controller: fidl::new_empty!(
1046 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TestCaseControllerMarker>>,
1047 fidl::encoding::DefaultFuchsiaResourceDialect
1048 ),
1049 }
1050 }
1051
1052 #[inline]
1053 unsafe fn decode(
1054 &mut self,
1055 decoder: &mut fidl::encoding::Decoder<
1056 '_,
1057 fidl::encoding::DefaultFuchsiaResourceDialect,
1058 >,
1059 offset: usize,
1060 _depth: fidl::encoding::Depth,
1061 ) -> fidl::Result<()> {
1062 decoder.debug_check_bounds::<Self>(offset);
1063 fidl::decode!(
1065 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TestCaseControllerMarker>>,
1066 fidl::encoding::DefaultFuchsiaResourceDialect,
1067 &mut self.test_controller,
1068 decoder,
1069 offset + 0,
1070 _depth
1071 )?;
1072 Ok(())
1073 }
1074 }
1075}