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_services_test_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct ControlPlaneMarker;
16
17impl fidl::endpoints::ProtocolMarker for ControlPlaneMarker {
18 type Proxy = ControlPlaneProxy;
19 type RequestStream = ControlPlaneRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = ControlPlaneSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "(anonymous) ControlPlane";
24}
25
26pub trait ControlPlaneProxyInterface: Send + Sync {
27 type ControlDoResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
28 fn r#control_do(&self) -> Self::ControlDoResponseFut;
29}
30#[derive(Debug)]
31#[cfg(target_os = "fuchsia")]
32pub struct ControlPlaneSynchronousProxy {
33 client: fidl::client::sync::Client,
34}
35
36#[cfg(target_os = "fuchsia")]
37impl fidl::endpoints::SynchronousProxy for ControlPlaneSynchronousProxy {
38 type Proxy = ControlPlaneProxy;
39 type Protocol = ControlPlaneMarker;
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 ControlPlaneSynchronousProxy {
56 pub fn new(channel: fidl::Channel) -> Self {
57 let protocol_name = <ControlPlaneMarker 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<ControlPlaneEvent, fidl::Error> {
71 ControlPlaneEvent::decode(self.client.wait_for_event(deadline)?)
72 }
73
74 pub fn r#control_do(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
75 let _response =
76 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
77 (),
78 0x668f0515ba2e1ebc,
79 fidl::encoding::DynamicFlags::empty(),
80 ___deadline,
81 )?;
82 Ok(_response)
83 }
84}
85
86#[derive(Debug, Clone)]
87pub struct ControlPlaneProxy {
88 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
89}
90
91impl fidl::endpoints::Proxy for ControlPlaneProxy {
92 type Protocol = ControlPlaneMarker;
93
94 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
95 Self::new(inner)
96 }
97
98 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
99 self.client.into_channel().map_err(|client| Self { client })
100 }
101
102 fn as_channel(&self) -> &::fidl::AsyncChannel {
103 self.client.as_channel()
104 }
105}
106
107impl ControlPlaneProxy {
108 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
110 let protocol_name = <ControlPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
111 Self { client: fidl::client::Client::new(channel, protocol_name) }
112 }
113
114 pub fn take_event_stream(&self) -> ControlPlaneEventStream {
120 ControlPlaneEventStream { event_receiver: self.client.take_event_receiver() }
121 }
122
123 pub fn r#control_do(
124 &self,
125 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
126 ControlPlaneProxyInterface::r#control_do(self)
127 }
128}
129
130impl ControlPlaneProxyInterface for ControlPlaneProxy {
131 type ControlDoResponseFut =
132 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
133 fn r#control_do(&self) -> Self::ControlDoResponseFut {
134 fn _decode(
135 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
136 ) -> Result<(), fidl::Error> {
137 let _response = fidl::client::decode_transaction_body::<
138 fidl::encoding::EmptyPayload,
139 fidl::encoding::DefaultFuchsiaResourceDialect,
140 0x668f0515ba2e1ebc,
141 >(_buf?)?;
142 Ok(_response)
143 }
144 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
145 (),
146 0x668f0515ba2e1ebc,
147 fidl::encoding::DynamicFlags::empty(),
148 _decode,
149 )
150 }
151}
152
153pub struct ControlPlaneEventStream {
154 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
155}
156
157impl std::marker::Unpin for ControlPlaneEventStream {}
158
159impl futures::stream::FusedStream for ControlPlaneEventStream {
160 fn is_terminated(&self) -> bool {
161 self.event_receiver.is_terminated()
162 }
163}
164
165impl futures::Stream for ControlPlaneEventStream {
166 type Item = Result<ControlPlaneEvent, fidl::Error>;
167
168 fn poll_next(
169 mut self: std::pin::Pin<&mut Self>,
170 cx: &mut std::task::Context<'_>,
171 ) -> std::task::Poll<Option<Self::Item>> {
172 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
173 &mut self.event_receiver,
174 cx
175 )?) {
176 Some(buf) => std::task::Poll::Ready(Some(ControlPlaneEvent::decode(buf))),
177 None => std::task::Poll::Ready(None),
178 }
179 }
180}
181
182#[derive(Debug)]
183pub enum ControlPlaneEvent {}
184
185impl ControlPlaneEvent {
186 fn decode(
188 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
189 ) -> Result<ControlPlaneEvent, fidl::Error> {
190 let (bytes, _handles) = buf.split_mut();
191 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
192 debug_assert_eq!(tx_header.tx_id, 0);
193 match tx_header.ordinal {
194 _ => Err(fidl::Error::UnknownOrdinal {
195 ordinal: tx_header.ordinal,
196 protocol_name: <ControlPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
197 }),
198 }
199 }
200}
201
202pub struct ControlPlaneRequestStream {
204 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
205 is_terminated: bool,
206}
207
208impl std::marker::Unpin for ControlPlaneRequestStream {}
209
210impl futures::stream::FusedStream for ControlPlaneRequestStream {
211 fn is_terminated(&self) -> bool {
212 self.is_terminated
213 }
214}
215
216impl fidl::endpoints::RequestStream for ControlPlaneRequestStream {
217 type Protocol = ControlPlaneMarker;
218 type ControlHandle = ControlPlaneControlHandle;
219
220 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
221 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
222 }
223
224 fn control_handle(&self) -> Self::ControlHandle {
225 ControlPlaneControlHandle { inner: self.inner.clone() }
226 }
227
228 fn into_inner(
229 self,
230 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
231 {
232 (self.inner, self.is_terminated)
233 }
234
235 fn from_inner(
236 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
237 is_terminated: bool,
238 ) -> Self {
239 Self { inner, is_terminated }
240 }
241}
242
243impl futures::Stream for ControlPlaneRequestStream {
244 type Item = Result<ControlPlaneRequest, fidl::Error>;
245
246 fn poll_next(
247 mut self: std::pin::Pin<&mut Self>,
248 cx: &mut std::task::Context<'_>,
249 ) -> std::task::Poll<Option<Self::Item>> {
250 let this = &mut *self;
251 if this.inner.check_shutdown(cx) {
252 this.is_terminated = true;
253 return std::task::Poll::Ready(None);
254 }
255 if this.is_terminated {
256 panic!("polled ControlPlaneRequestStream after completion");
257 }
258 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
259 |bytes, handles| {
260 match this.inner.channel().read_etc(cx, bytes, handles) {
261 std::task::Poll::Ready(Ok(())) => {}
262 std::task::Poll::Pending => return std::task::Poll::Pending,
263 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
264 this.is_terminated = true;
265 return std::task::Poll::Ready(None);
266 }
267 std::task::Poll::Ready(Err(e)) => {
268 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
269 e.into(),
270 ))))
271 }
272 }
273
274 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
276
277 std::task::Poll::Ready(Some(match header.ordinal {
278 0x668f0515ba2e1ebc => {
279 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
280 let mut req = fidl::new_empty!(
281 fidl::encoding::EmptyPayload,
282 fidl::encoding::DefaultFuchsiaResourceDialect
283 );
284 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
285 let control_handle =
286 ControlPlaneControlHandle { inner: this.inner.clone() };
287 Ok(ControlPlaneRequest::ControlDo {
288 responder: ControlPlaneControlDoResponder {
289 control_handle: std::mem::ManuallyDrop::new(control_handle),
290 tx_id: header.tx_id,
291 },
292 })
293 }
294 _ => Err(fidl::Error::UnknownOrdinal {
295 ordinal: header.ordinal,
296 protocol_name:
297 <ControlPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
298 }),
299 }))
300 },
301 )
302 }
303}
304
305#[derive(Debug)]
306pub enum ControlPlaneRequest {
307 ControlDo { responder: ControlPlaneControlDoResponder },
308}
309
310impl ControlPlaneRequest {
311 #[allow(irrefutable_let_patterns)]
312 pub fn into_control_do(self) -> Option<(ControlPlaneControlDoResponder)> {
313 if let ControlPlaneRequest::ControlDo { responder } = self {
314 Some((responder))
315 } else {
316 None
317 }
318 }
319
320 pub fn method_name(&self) -> &'static str {
322 match *self {
323 ControlPlaneRequest::ControlDo { .. } => "control_do",
324 }
325 }
326}
327
328#[derive(Debug, Clone)]
329pub struct ControlPlaneControlHandle {
330 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
331}
332
333impl fidl::endpoints::ControlHandle for ControlPlaneControlHandle {
334 fn shutdown(&self) {
335 self.inner.shutdown()
336 }
337 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
338 self.inner.shutdown_with_epitaph(status)
339 }
340
341 fn is_closed(&self) -> bool {
342 self.inner.channel().is_closed()
343 }
344 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
345 self.inner.channel().on_closed()
346 }
347
348 #[cfg(target_os = "fuchsia")]
349 fn signal_peer(
350 &self,
351 clear_mask: zx::Signals,
352 set_mask: zx::Signals,
353 ) -> Result<(), zx_status::Status> {
354 use fidl::Peered;
355 self.inner.channel().signal_peer(clear_mask, set_mask)
356 }
357}
358
359impl ControlPlaneControlHandle {}
360
361#[must_use = "FIDL methods require a response to be sent"]
362#[derive(Debug)]
363pub struct ControlPlaneControlDoResponder {
364 control_handle: std::mem::ManuallyDrop<ControlPlaneControlHandle>,
365 tx_id: u32,
366}
367
368impl std::ops::Drop for ControlPlaneControlDoResponder {
372 fn drop(&mut self) {
373 self.control_handle.shutdown();
374 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
376 }
377}
378
379impl fidl::endpoints::Responder for ControlPlaneControlDoResponder {
380 type ControlHandle = ControlPlaneControlHandle;
381
382 fn control_handle(&self) -> &ControlPlaneControlHandle {
383 &self.control_handle
384 }
385
386 fn drop_without_shutdown(mut self) {
387 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
389 std::mem::forget(self);
391 }
392}
393
394impl ControlPlaneControlDoResponder {
395 pub fn send(self) -> Result<(), fidl::Error> {
399 let _result = self.send_raw();
400 if _result.is_err() {
401 self.control_handle.shutdown();
402 }
403 self.drop_without_shutdown();
404 _result
405 }
406
407 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
409 let _result = self.send_raw();
410 self.drop_without_shutdown();
411 _result
412 }
413
414 fn send_raw(&self) -> Result<(), fidl::Error> {
415 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
416 (),
417 self.tx_id,
418 0x668f0515ba2e1ebc,
419 fidl::encoding::DynamicFlags::empty(),
420 )
421 }
422}
423
424#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
425pub struct DataPlaneMarker;
426
427impl fidl::endpoints::ProtocolMarker for DataPlaneMarker {
428 type Proxy = DataPlaneProxy;
429 type RequestStream = DataPlaneRequestStream;
430 #[cfg(target_os = "fuchsia")]
431 type SynchronousProxy = DataPlaneSynchronousProxy;
432
433 const DEBUG_NAME: &'static str = "(anonymous) DataPlane";
434}
435
436pub trait DataPlaneProxyInterface: Send + Sync {
437 type DataDoResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
438 fn r#data_do(&self) -> Self::DataDoResponseFut;
439}
440#[derive(Debug)]
441#[cfg(target_os = "fuchsia")]
442pub struct DataPlaneSynchronousProxy {
443 client: fidl::client::sync::Client,
444}
445
446#[cfg(target_os = "fuchsia")]
447impl fidl::endpoints::SynchronousProxy for DataPlaneSynchronousProxy {
448 type Proxy = DataPlaneProxy;
449 type Protocol = DataPlaneMarker;
450
451 fn from_channel(inner: fidl::Channel) -> Self {
452 Self::new(inner)
453 }
454
455 fn into_channel(self) -> fidl::Channel {
456 self.client.into_channel()
457 }
458
459 fn as_channel(&self) -> &fidl::Channel {
460 self.client.as_channel()
461 }
462}
463
464#[cfg(target_os = "fuchsia")]
465impl DataPlaneSynchronousProxy {
466 pub fn new(channel: fidl::Channel) -> Self {
467 let protocol_name = <DataPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
468 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
469 }
470
471 pub fn into_channel(self) -> fidl::Channel {
472 self.client.into_channel()
473 }
474
475 pub fn wait_for_event(
478 &self,
479 deadline: zx::MonotonicInstant,
480 ) -> Result<DataPlaneEvent, fidl::Error> {
481 DataPlaneEvent::decode(self.client.wait_for_event(deadline)?)
482 }
483
484 pub fn r#data_do(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
485 let _response =
486 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
487 (),
488 0x1c8c82496b32e147,
489 fidl::encoding::DynamicFlags::empty(),
490 ___deadline,
491 )?;
492 Ok(_response)
493 }
494}
495
496#[derive(Debug, Clone)]
497pub struct DataPlaneProxy {
498 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
499}
500
501impl fidl::endpoints::Proxy for DataPlaneProxy {
502 type Protocol = DataPlaneMarker;
503
504 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
505 Self::new(inner)
506 }
507
508 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
509 self.client.into_channel().map_err(|client| Self { client })
510 }
511
512 fn as_channel(&self) -> &::fidl::AsyncChannel {
513 self.client.as_channel()
514 }
515}
516
517impl DataPlaneProxy {
518 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
520 let protocol_name = <DataPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
521 Self { client: fidl::client::Client::new(channel, protocol_name) }
522 }
523
524 pub fn take_event_stream(&self) -> DataPlaneEventStream {
530 DataPlaneEventStream { event_receiver: self.client.take_event_receiver() }
531 }
532
533 pub fn r#data_do(
534 &self,
535 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
536 DataPlaneProxyInterface::r#data_do(self)
537 }
538}
539
540impl DataPlaneProxyInterface for DataPlaneProxy {
541 type DataDoResponseFut =
542 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
543 fn r#data_do(&self) -> Self::DataDoResponseFut {
544 fn _decode(
545 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
546 ) -> Result<(), fidl::Error> {
547 let _response = fidl::client::decode_transaction_body::<
548 fidl::encoding::EmptyPayload,
549 fidl::encoding::DefaultFuchsiaResourceDialect,
550 0x1c8c82496b32e147,
551 >(_buf?)?;
552 Ok(_response)
553 }
554 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
555 (),
556 0x1c8c82496b32e147,
557 fidl::encoding::DynamicFlags::empty(),
558 _decode,
559 )
560 }
561}
562
563pub struct DataPlaneEventStream {
564 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
565}
566
567impl std::marker::Unpin for DataPlaneEventStream {}
568
569impl futures::stream::FusedStream for DataPlaneEventStream {
570 fn is_terminated(&self) -> bool {
571 self.event_receiver.is_terminated()
572 }
573}
574
575impl futures::Stream for DataPlaneEventStream {
576 type Item = Result<DataPlaneEvent, fidl::Error>;
577
578 fn poll_next(
579 mut self: std::pin::Pin<&mut Self>,
580 cx: &mut std::task::Context<'_>,
581 ) -> std::task::Poll<Option<Self::Item>> {
582 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
583 &mut self.event_receiver,
584 cx
585 )?) {
586 Some(buf) => std::task::Poll::Ready(Some(DataPlaneEvent::decode(buf))),
587 None => std::task::Poll::Ready(None),
588 }
589 }
590}
591
592#[derive(Debug)]
593pub enum DataPlaneEvent {}
594
595impl DataPlaneEvent {
596 fn decode(
598 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
599 ) -> Result<DataPlaneEvent, fidl::Error> {
600 let (bytes, _handles) = buf.split_mut();
601 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
602 debug_assert_eq!(tx_header.tx_id, 0);
603 match tx_header.ordinal {
604 _ => Err(fidl::Error::UnknownOrdinal {
605 ordinal: tx_header.ordinal,
606 protocol_name: <DataPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
607 }),
608 }
609 }
610}
611
612pub struct DataPlaneRequestStream {
614 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
615 is_terminated: bool,
616}
617
618impl std::marker::Unpin for DataPlaneRequestStream {}
619
620impl futures::stream::FusedStream for DataPlaneRequestStream {
621 fn is_terminated(&self) -> bool {
622 self.is_terminated
623 }
624}
625
626impl fidl::endpoints::RequestStream for DataPlaneRequestStream {
627 type Protocol = DataPlaneMarker;
628 type ControlHandle = DataPlaneControlHandle;
629
630 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
631 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
632 }
633
634 fn control_handle(&self) -> Self::ControlHandle {
635 DataPlaneControlHandle { inner: self.inner.clone() }
636 }
637
638 fn into_inner(
639 self,
640 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
641 {
642 (self.inner, self.is_terminated)
643 }
644
645 fn from_inner(
646 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
647 is_terminated: bool,
648 ) -> Self {
649 Self { inner, is_terminated }
650 }
651}
652
653impl futures::Stream for DataPlaneRequestStream {
654 type Item = Result<DataPlaneRequest, fidl::Error>;
655
656 fn poll_next(
657 mut self: std::pin::Pin<&mut Self>,
658 cx: &mut std::task::Context<'_>,
659 ) -> std::task::Poll<Option<Self::Item>> {
660 let this = &mut *self;
661 if this.inner.check_shutdown(cx) {
662 this.is_terminated = true;
663 return std::task::Poll::Ready(None);
664 }
665 if this.is_terminated {
666 panic!("polled DataPlaneRequestStream after completion");
667 }
668 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
669 |bytes, handles| {
670 match this.inner.channel().read_etc(cx, bytes, handles) {
671 std::task::Poll::Ready(Ok(())) => {}
672 std::task::Poll::Pending => return std::task::Poll::Pending,
673 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
674 this.is_terminated = true;
675 return std::task::Poll::Ready(None);
676 }
677 std::task::Poll::Ready(Err(e)) => {
678 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
679 e.into(),
680 ))))
681 }
682 }
683
684 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
686
687 std::task::Poll::Ready(Some(match header.ordinal {
688 0x1c8c82496b32e147 => {
689 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
690 let mut req = fidl::new_empty!(
691 fidl::encoding::EmptyPayload,
692 fidl::encoding::DefaultFuchsiaResourceDialect
693 );
694 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
695 let control_handle = DataPlaneControlHandle { inner: this.inner.clone() };
696 Ok(DataPlaneRequest::DataDo {
697 responder: DataPlaneDataDoResponder {
698 control_handle: std::mem::ManuallyDrop::new(control_handle),
699 tx_id: header.tx_id,
700 },
701 })
702 }
703 _ => Err(fidl::Error::UnknownOrdinal {
704 ordinal: header.ordinal,
705 protocol_name:
706 <DataPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
707 }),
708 }))
709 },
710 )
711 }
712}
713
714#[derive(Debug)]
715pub enum DataPlaneRequest {
716 DataDo { responder: DataPlaneDataDoResponder },
717}
718
719impl DataPlaneRequest {
720 #[allow(irrefutable_let_patterns)]
721 pub fn into_data_do(self) -> Option<(DataPlaneDataDoResponder)> {
722 if let DataPlaneRequest::DataDo { responder } = self {
723 Some((responder))
724 } else {
725 None
726 }
727 }
728
729 pub fn method_name(&self) -> &'static str {
731 match *self {
732 DataPlaneRequest::DataDo { .. } => "data_do",
733 }
734 }
735}
736
737#[derive(Debug, Clone)]
738pub struct DataPlaneControlHandle {
739 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
740}
741
742impl fidl::endpoints::ControlHandle for DataPlaneControlHandle {
743 fn shutdown(&self) {
744 self.inner.shutdown()
745 }
746 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
747 self.inner.shutdown_with_epitaph(status)
748 }
749
750 fn is_closed(&self) -> bool {
751 self.inner.channel().is_closed()
752 }
753 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
754 self.inner.channel().on_closed()
755 }
756
757 #[cfg(target_os = "fuchsia")]
758 fn signal_peer(
759 &self,
760 clear_mask: zx::Signals,
761 set_mask: zx::Signals,
762 ) -> Result<(), zx_status::Status> {
763 use fidl::Peered;
764 self.inner.channel().signal_peer(clear_mask, set_mask)
765 }
766}
767
768impl DataPlaneControlHandle {}
769
770#[must_use = "FIDL methods require a response to be sent"]
771#[derive(Debug)]
772pub struct DataPlaneDataDoResponder {
773 control_handle: std::mem::ManuallyDrop<DataPlaneControlHandle>,
774 tx_id: u32,
775}
776
777impl std::ops::Drop for DataPlaneDataDoResponder {
781 fn drop(&mut self) {
782 self.control_handle.shutdown();
783 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
785 }
786}
787
788impl fidl::endpoints::Responder for DataPlaneDataDoResponder {
789 type ControlHandle = DataPlaneControlHandle;
790
791 fn control_handle(&self) -> &DataPlaneControlHandle {
792 &self.control_handle
793 }
794
795 fn drop_without_shutdown(mut self) {
796 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
798 std::mem::forget(self);
800 }
801}
802
803impl DataPlaneDataDoResponder {
804 pub fn send(self) -> Result<(), fidl::Error> {
808 let _result = self.send_raw();
809 if _result.is_err() {
810 self.control_handle.shutdown();
811 }
812 self.drop_without_shutdown();
813 _result
814 }
815
816 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
818 let _result = self.send_raw();
819 self.drop_without_shutdown();
820 _result
821 }
822
823 fn send_raw(&self) -> Result<(), fidl::Error> {
824 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
825 (),
826 self.tx_id,
827 0x1c8c82496b32e147,
828 fidl::encoding::DynamicFlags::empty(),
829 )
830 }
831}
832
833#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
834pub struct DeviceMarker;
835
836#[cfg(target_os = "fuchsia")]
837impl fidl::endpoints::ServiceMarker for DeviceMarker {
838 type Proxy = DeviceProxy;
839 type Request = DeviceRequest;
840 const SERVICE_NAME: &'static str = "fuchsia.services.test.Device";
841}
842
843#[cfg(target_os = "fuchsia")]
846pub enum DeviceRequest {
847 Control(ControlPlaneRequestStream),
848 Data(DataPlaneRequestStream),
849}
850
851#[cfg(target_os = "fuchsia")]
852impl fidl::endpoints::ServiceRequest for DeviceRequest {
853 type Service = DeviceMarker;
854
855 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
856 match name {
857 "control" => Self::Control(
858 <ControlPlaneRequestStream as fidl::endpoints::RequestStream>::from_channel(
859 _channel,
860 ),
861 ),
862 "data" => Self::Data(
863 <DataPlaneRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
864 ),
865 _ => panic!("no such member protocol name for service Device"),
866 }
867 }
868
869 fn member_names() -> &'static [&'static str] {
870 &["control", "data"]
871 }
872}
873#[cfg(target_os = "fuchsia")]
874pub struct DeviceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
875
876#[cfg(target_os = "fuchsia")]
877impl fidl::endpoints::ServiceProxy for DeviceProxy {
878 type Service = DeviceMarker;
879
880 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
881 Self(opener)
882 }
883}
884
885#[cfg(target_os = "fuchsia")]
886impl DeviceProxy {
887 pub fn connect_to_control(&self) -> Result<ControlPlaneProxy, fidl::Error> {
888 let (proxy, server_end) = fidl::endpoints::create_proxy::<ControlPlaneMarker>();
889 self.connect_channel_to_control(server_end)?;
890 Ok(proxy)
891 }
892
893 pub fn connect_to_control_sync(&self) -> Result<ControlPlaneSynchronousProxy, fidl::Error> {
896 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ControlPlaneMarker>();
897 self.connect_channel_to_control(server_end)?;
898 Ok(proxy)
899 }
900
901 pub fn connect_channel_to_control(
904 &self,
905 server_end: fidl::endpoints::ServerEnd<ControlPlaneMarker>,
906 ) -> Result<(), fidl::Error> {
907 self.0.open_member("control", server_end.into_channel())
908 }
909 pub fn connect_to_data(&self) -> Result<DataPlaneProxy, fidl::Error> {
910 let (proxy, server_end) = fidl::endpoints::create_proxy::<DataPlaneMarker>();
911 self.connect_channel_to_data(server_end)?;
912 Ok(proxy)
913 }
914
915 pub fn connect_to_data_sync(&self) -> Result<DataPlaneSynchronousProxy, fidl::Error> {
918 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DataPlaneMarker>();
919 self.connect_channel_to_data(server_end)?;
920 Ok(proxy)
921 }
922
923 pub fn connect_channel_to_data(
926 &self,
927 server_end: fidl::endpoints::ServerEnd<DataPlaneMarker>,
928 ) -> Result<(), fidl::Error> {
929 self.0.open_member("data", server_end.into_channel())
930 }
931
932 pub fn instance_name(&self) -> &str {
933 self.0.instance_name()
934 }
935}
936
937mod internal {
938 use super::*;
939}