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_lowpan_spinel__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DeviceSetupSetChannelRequest {
16 pub req: fidl::endpoints::ServerEnd<DeviceMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for DeviceSetupSetChannelRequest
21{
22}
23
24#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub struct DeviceMarker;
26
27impl fidl::endpoints::ProtocolMarker for DeviceMarker {
28 type Proxy = DeviceProxy;
29 type RequestStream = DeviceRequestStream;
30 #[cfg(target_os = "fuchsia")]
31 type SynchronousProxy = DeviceSynchronousProxy;
32
33 const DEBUG_NAME: &'static str = "fuchsia.lowpan.spinel.Device";
34}
35impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
36pub type DeviceOpenResult = Result<(), Error>;
37pub type DeviceCloseResult = Result<(), Error>;
38
39pub trait DeviceProxyInterface: Send + Sync {
40 type OpenResponseFut: std::future::Future<Output = Result<DeviceOpenResult, fidl::Error>> + Send;
41 fn r#open(&self) -> Self::OpenResponseFut;
42 type CloseResponseFut: std::future::Future<Output = Result<DeviceCloseResult, fidl::Error>>
43 + Send;
44 fn r#close(&self) -> Self::CloseResponseFut;
45 type GetMaxFrameSizeResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
46 fn r#get_max_frame_size(&self) -> Self::GetMaxFrameSizeResponseFut;
47 fn r#send_frame(&self, data: &[u8]) -> Result<(), fidl::Error>;
48 fn r#ready_to_receive_frames(&self, number_of_frames: u32) -> Result<(), fidl::Error>;
49}
50#[derive(Debug)]
51#[cfg(target_os = "fuchsia")]
52pub struct DeviceSynchronousProxy {
53 client: fidl::client::sync::Client,
54}
55
56#[cfg(target_os = "fuchsia")]
57impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
58 type Proxy = DeviceProxy;
59 type Protocol = DeviceMarker;
60
61 fn from_channel(inner: fidl::Channel) -> Self {
62 Self::new(inner)
63 }
64
65 fn into_channel(self) -> fidl::Channel {
66 self.client.into_channel()
67 }
68
69 fn as_channel(&self) -> &fidl::Channel {
70 self.client.as_channel()
71 }
72}
73
74#[cfg(target_os = "fuchsia")]
75impl DeviceSynchronousProxy {
76 pub fn new(channel: fidl::Channel) -> Self {
77 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
78 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
79 }
80
81 pub fn into_channel(self) -> fidl::Channel {
82 self.client.into_channel()
83 }
84
85 pub fn wait_for_event(
88 &self,
89 deadline: zx::MonotonicInstant,
90 ) -> Result<DeviceEvent, fidl::Error> {
91 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
92 }
93
94 pub fn r#open(
111 &self,
112 ___deadline: zx::MonotonicInstant,
113 ) -> Result<DeviceOpenResult, fidl::Error> {
114 let _response = self.client.send_query::<
115 fidl::encoding::EmptyPayload,
116 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
117 >(
118 (),
119 0x508cecb73a776ef7,
120 fidl::encoding::DynamicFlags::empty(),
121 ___deadline,
122 )?;
123 Ok(_response.map(|x| x))
124 }
125
126 pub fn r#close(
146 &self,
147 ___deadline: zx::MonotonicInstant,
148 ) -> Result<DeviceCloseResult, fidl::Error> {
149 let _response = self.client.send_query::<
150 fidl::encoding::EmptyPayload,
151 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
152 >(
153 (),
154 0x621a0f31b867781a,
155 fidl::encoding::DynamicFlags::empty(),
156 ___deadline,
157 )?;
158 Ok(_response.map(|x| x))
159 }
160
161 pub fn r#get_max_frame_size(
169 &self,
170 ___deadline: zx::MonotonicInstant,
171 ) -> Result<u32, fidl::Error> {
172 let _response =
173 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetMaxFrameSizeResponse>(
174 (),
175 0x1d2d652e8b06d463,
176 fidl::encoding::DynamicFlags::empty(),
177 ___deadline,
178 )?;
179 Ok(_response.size)
180 }
181
182 pub fn r#send_frame(&self, mut data: &[u8]) -> Result<(), fidl::Error> {
189 self.client.send::<DeviceSendFrameRequest>(
190 (data,),
191 0x634f2957b35c5944,
192 fidl::encoding::DynamicFlags::empty(),
193 )
194 }
195
196 pub fn r#ready_to_receive_frames(&self, mut number_of_frames: u32) -> Result<(), fidl::Error> {
223 self.client.send::<DeviceReadyToReceiveFramesRequest>(
224 (number_of_frames,),
225 0x3147df23fdd53b87,
226 fidl::encoding::DynamicFlags::empty(),
227 )
228 }
229}
230
231#[cfg(target_os = "fuchsia")]
232impl From<DeviceSynchronousProxy> for zx::Handle {
233 fn from(value: DeviceSynchronousProxy) -> Self {
234 value.into_channel().into()
235 }
236}
237
238#[cfg(target_os = "fuchsia")]
239impl From<fidl::Channel> for DeviceSynchronousProxy {
240 fn from(value: fidl::Channel) -> Self {
241 Self::new(value)
242 }
243}
244
245#[cfg(target_os = "fuchsia")]
246impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
247 type Protocol = DeviceMarker;
248
249 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
250 Self::new(value.into_channel())
251 }
252}
253
254#[derive(Debug, Clone)]
255pub struct DeviceProxy {
256 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
257}
258
259impl fidl::endpoints::Proxy for DeviceProxy {
260 type Protocol = DeviceMarker;
261
262 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
263 Self::new(inner)
264 }
265
266 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
267 self.client.into_channel().map_err(|client| Self { client })
268 }
269
270 fn as_channel(&self) -> &::fidl::AsyncChannel {
271 self.client.as_channel()
272 }
273}
274
275impl DeviceProxy {
276 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
278 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
279 Self { client: fidl::client::Client::new(channel, protocol_name) }
280 }
281
282 pub fn take_event_stream(&self) -> DeviceEventStream {
288 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
289 }
290
291 pub fn r#open(
308 &self,
309 ) -> fidl::client::QueryResponseFut<
310 DeviceOpenResult,
311 fidl::encoding::DefaultFuchsiaResourceDialect,
312 > {
313 DeviceProxyInterface::r#open(self)
314 }
315
316 pub fn r#close(
336 &self,
337 ) -> fidl::client::QueryResponseFut<
338 DeviceCloseResult,
339 fidl::encoding::DefaultFuchsiaResourceDialect,
340 > {
341 DeviceProxyInterface::r#close(self)
342 }
343
344 pub fn r#get_max_frame_size(
352 &self,
353 ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
354 DeviceProxyInterface::r#get_max_frame_size(self)
355 }
356
357 pub fn r#send_frame(&self, mut data: &[u8]) -> Result<(), fidl::Error> {
364 DeviceProxyInterface::r#send_frame(self, data)
365 }
366
367 pub fn r#ready_to_receive_frames(&self, mut number_of_frames: u32) -> Result<(), fidl::Error> {
394 DeviceProxyInterface::r#ready_to_receive_frames(self, number_of_frames)
395 }
396}
397
398impl DeviceProxyInterface for DeviceProxy {
399 type OpenResponseFut = fidl::client::QueryResponseFut<
400 DeviceOpenResult,
401 fidl::encoding::DefaultFuchsiaResourceDialect,
402 >;
403 fn r#open(&self) -> Self::OpenResponseFut {
404 fn _decode(
405 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
406 ) -> Result<DeviceOpenResult, fidl::Error> {
407 let _response = fidl::client::decode_transaction_body::<
408 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
409 fidl::encoding::DefaultFuchsiaResourceDialect,
410 0x508cecb73a776ef7,
411 >(_buf?)?;
412 Ok(_response.map(|x| x))
413 }
414 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceOpenResult>(
415 (),
416 0x508cecb73a776ef7,
417 fidl::encoding::DynamicFlags::empty(),
418 _decode,
419 )
420 }
421
422 type CloseResponseFut = fidl::client::QueryResponseFut<
423 DeviceCloseResult,
424 fidl::encoding::DefaultFuchsiaResourceDialect,
425 >;
426 fn r#close(&self) -> Self::CloseResponseFut {
427 fn _decode(
428 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
429 ) -> Result<DeviceCloseResult, fidl::Error> {
430 let _response = fidl::client::decode_transaction_body::<
431 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
432 fidl::encoding::DefaultFuchsiaResourceDialect,
433 0x621a0f31b867781a,
434 >(_buf?)?;
435 Ok(_response.map(|x| x))
436 }
437 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceCloseResult>(
438 (),
439 0x621a0f31b867781a,
440 fidl::encoding::DynamicFlags::empty(),
441 _decode,
442 )
443 }
444
445 type GetMaxFrameSizeResponseFut =
446 fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
447 fn r#get_max_frame_size(&self) -> Self::GetMaxFrameSizeResponseFut {
448 fn _decode(
449 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
450 ) -> Result<u32, fidl::Error> {
451 let _response = fidl::client::decode_transaction_body::<
452 DeviceGetMaxFrameSizeResponse,
453 fidl::encoding::DefaultFuchsiaResourceDialect,
454 0x1d2d652e8b06d463,
455 >(_buf?)?;
456 Ok(_response.size)
457 }
458 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
459 (),
460 0x1d2d652e8b06d463,
461 fidl::encoding::DynamicFlags::empty(),
462 _decode,
463 )
464 }
465
466 fn r#send_frame(&self, mut data: &[u8]) -> Result<(), fidl::Error> {
467 self.client.send::<DeviceSendFrameRequest>(
468 (data,),
469 0x634f2957b35c5944,
470 fidl::encoding::DynamicFlags::empty(),
471 )
472 }
473
474 fn r#ready_to_receive_frames(&self, mut number_of_frames: u32) -> Result<(), fidl::Error> {
475 self.client.send::<DeviceReadyToReceiveFramesRequest>(
476 (number_of_frames,),
477 0x3147df23fdd53b87,
478 fidl::encoding::DynamicFlags::empty(),
479 )
480 }
481}
482
483pub struct DeviceEventStream {
484 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
485}
486
487impl std::marker::Unpin for DeviceEventStream {}
488
489impl futures::stream::FusedStream for DeviceEventStream {
490 fn is_terminated(&self) -> bool {
491 self.event_receiver.is_terminated()
492 }
493}
494
495impl futures::Stream for DeviceEventStream {
496 type Item = Result<DeviceEvent, fidl::Error>;
497
498 fn poll_next(
499 mut self: std::pin::Pin<&mut Self>,
500 cx: &mut std::task::Context<'_>,
501 ) -> std::task::Poll<Option<Self::Item>> {
502 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
503 &mut self.event_receiver,
504 cx
505 )?) {
506 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
507 None => std::task::Poll::Ready(None),
508 }
509 }
510}
511
512#[derive(Debug)]
513pub enum DeviceEvent {
514 OnReadyForSendFrames { number_of_frames: u32 },
515 OnReceiveFrame { data: Vec<u8> },
516 OnError { error: Error, did_close: bool },
517}
518
519impl DeviceEvent {
520 #[allow(irrefutable_let_patterns)]
521 pub fn into_on_ready_for_send_frames(self) -> Option<u32> {
522 if let DeviceEvent::OnReadyForSendFrames { number_of_frames } = self {
523 Some((number_of_frames))
524 } else {
525 None
526 }
527 }
528 #[allow(irrefutable_let_patterns)]
529 pub fn into_on_receive_frame(self) -> Option<Vec<u8>> {
530 if let DeviceEvent::OnReceiveFrame { data } = self {
531 Some((data))
532 } else {
533 None
534 }
535 }
536 #[allow(irrefutable_let_patterns)]
537 pub fn into_on_error(self) -> Option<(Error, bool)> {
538 if let DeviceEvent::OnError { error, did_close } = self {
539 Some((error, did_close))
540 } else {
541 None
542 }
543 }
544
545 fn decode(
547 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
548 ) -> Result<DeviceEvent, fidl::Error> {
549 let (bytes, _handles) = buf.split_mut();
550 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
551 debug_assert_eq!(tx_header.tx_id, 0);
552 match tx_header.ordinal {
553 0x2b1d5b28c5811b53 => {
554 let mut out = fidl::new_empty!(
555 DeviceOnReadyForSendFramesRequest,
556 fidl::encoding::DefaultFuchsiaResourceDialect
557 );
558 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceOnReadyForSendFramesRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
559 Ok((DeviceEvent::OnReadyForSendFrames { number_of_frames: out.number_of_frames }))
560 }
561 0x61937a45670aabb0 => {
562 let mut out = fidl::new_empty!(
563 DeviceOnReceiveFrameRequest,
564 fidl::encoding::DefaultFuchsiaResourceDialect
565 );
566 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceOnReceiveFrameRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
567 Ok((DeviceEvent::OnReceiveFrame { data: out.data }))
568 }
569 0x4d20e65a9d2625e1 => {
570 let mut out = fidl::new_empty!(
571 DeviceOnErrorRequest,
572 fidl::encoding::DefaultFuchsiaResourceDialect
573 );
574 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
575 Ok((DeviceEvent::OnError { error: out.error, did_close: out.did_close }))
576 }
577 _ => Err(fidl::Error::UnknownOrdinal {
578 ordinal: tx_header.ordinal,
579 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
580 }),
581 }
582 }
583}
584
585pub struct DeviceRequestStream {
587 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
588 is_terminated: bool,
589}
590
591impl std::marker::Unpin for DeviceRequestStream {}
592
593impl futures::stream::FusedStream for DeviceRequestStream {
594 fn is_terminated(&self) -> bool {
595 self.is_terminated
596 }
597}
598
599impl fidl::endpoints::RequestStream for DeviceRequestStream {
600 type Protocol = DeviceMarker;
601 type ControlHandle = DeviceControlHandle;
602
603 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
604 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
605 }
606
607 fn control_handle(&self) -> Self::ControlHandle {
608 DeviceControlHandle { inner: self.inner.clone() }
609 }
610
611 fn into_inner(
612 self,
613 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
614 {
615 (self.inner, self.is_terminated)
616 }
617
618 fn from_inner(
619 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
620 is_terminated: bool,
621 ) -> Self {
622 Self { inner, is_terminated }
623 }
624}
625
626impl futures::Stream for DeviceRequestStream {
627 type Item = Result<DeviceRequest, fidl::Error>;
628
629 fn poll_next(
630 mut self: std::pin::Pin<&mut Self>,
631 cx: &mut std::task::Context<'_>,
632 ) -> std::task::Poll<Option<Self::Item>> {
633 let this = &mut *self;
634 if this.inner.check_shutdown(cx) {
635 this.is_terminated = true;
636 return std::task::Poll::Ready(None);
637 }
638 if this.is_terminated {
639 panic!("polled DeviceRequestStream after completion");
640 }
641 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
642 |bytes, handles| {
643 match this.inner.channel().read_etc(cx, bytes, handles) {
644 std::task::Poll::Ready(Ok(())) => {}
645 std::task::Poll::Pending => return std::task::Poll::Pending,
646 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
647 this.is_terminated = true;
648 return std::task::Poll::Ready(None);
649 }
650 std::task::Poll::Ready(Err(e)) => {
651 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
652 e.into(),
653 ))))
654 }
655 }
656
657 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
659
660 std::task::Poll::Ready(Some(match header.ordinal {
661 0x508cecb73a776ef7 => {
662 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
663 let mut req = fidl::new_empty!(
664 fidl::encoding::EmptyPayload,
665 fidl::encoding::DefaultFuchsiaResourceDialect
666 );
667 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
668 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
669 Ok(DeviceRequest::Open {
670 responder: DeviceOpenResponder {
671 control_handle: std::mem::ManuallyDrop::new(control_handle),
672 tx_id: header.tx_id,
673 },
674 })
675 }
676 0x621a0f31b867781a => {
677 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
678 let mut req = fidl::new_empty!(
679 fidl::encoding::EmptyPayload,
680 fidl::encoding::DefaultFuchsiaResourceDialect
681 );
682 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
683 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
684 Ok(DeviceRequest::Close {
685 responder: DeviceCloseResponder {
686 control_handle: std::mem::ManuallyDrop::new(control_handle),
687 tx_id: header.tx_id,
688 },
689 })
690 }
691 0x1d2d652e8b06d463 => {
692 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
693 let mut req = fidl::new_empty!(
694 fidl::encoding::EmptyPayload,
695 fidl::encoding::DefaultFuchsiaResourceDialect
696 );
697 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
698 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
699 Ok(DeviceRequest::GetMaxFrameSize {
700 responder: DeviceGetMaxFrameSizeResponder {
701 control_handle: std::mem::ManuallyDrop::new(control_handle),
702 tx_id: header.tx_id,
703 },
704 })
705 }
706 0x634f2957b35c5944 => {
707 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
708 let mut req = fidl::new_empty!(
709 DeviceSendFrameRequest,
710 fidl::encoding::DefaultFuchsiaResourceDialect
711 );
712 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSendFrameRequest>(&header, _body_bytes, handles, &mut req)?;
713 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
714 Ok(DeviceRequest::SendFrame { data: req.data, control_handle })
715 }
716 0x3147df23fdd53b87 => {
717 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
718 let mut req = fidl::new_empty!(
719 DeviceReadyToReceiveFramesRequest,
720 fidl::encoding::DefaultFuchsiaResourceDialect
721 );
722 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadyToReceiveFramesRequest>(&header, _body_bytes, handles, &mut req)?;
723 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
724 Ok(DeviceRequest::ReadyToReceiveFrames {
725 number_of_frames: req.number_of_frames,
726
727 control_handle,
728 })
729 }
730 _ => Err(fidl::Error::UnknownOrdinal {
731 ordinal: header.ordinal,
732 protocol_name:
733 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
734 }),
735 }))
736 },
737 )
738 }
739}
740
741#[derive(Debug)]
742pub enum DeviceRequest {
743 Open { responder: DeviceOpenResponder },
760 Close { responder: DeviceCloseResponder },
780 GetMaxFrameSize { responder: DeviceGetMaxFrameSizeResponder },
788 SendFrame { data: Vec<u8>, control_handle: DeviceControlHandle },
795 ReadyToReceiveFrames { number_of_frames: u32, control_handle: DeviceControlHandle },
822}
823
824impl DeviceRequest {
825 #[allow(irrefutable_let_patterns)]
826 pub fn into_open(self) -> Option<(DeviceOpenResponder)> {
827 if let DeviceRequest::Open { responder } = self {
828 Some((responder))
829 } else {
830 None
831 }
832 }
833
834 #[allow(irrefutable_let_patterns)]
835 pub fn into_close(self) -> Option<(DeviceCloseResponder)> {
836 if let DeviceRequest::Close { responder } = self {
837 Some((responder))
838 } else {
839 None
840 }
841 }
842
843 #[allow(irrefutable_let_patterns)]
844 pub fn into_get_max_frame_size(self) -> Option<(DeviceGetMaxFrameSizeResponder)> {
845 if let DeviceRequest::GetMaxFrameSize { responder } = self {
846 Some((responder))
847 } else {
848 None
849 }
850 }
851
852 #[allow(irrefutable_let_patterns)]
853 pub fn into_send_frame(self) -> Option<(Vec<u8>, DeviceControlHandle)> {
854 if let DeviceRequest::SendFrame { data, control_handle } = self {
855 Some((data, control_handle))
856 } else {
857 None
858 }
859 }
860
861 #[allow(irrefutable_let_patterns)]
862 pub fn into_ready_to_receive_frames(self) -> Option<(u32, DeviceControlHandle)> {
863 if let DeviceRequest::ReadyToReceiveFrames { number_of_frames, control_handle } = self {
864 Some((number_of_frames, control_handle))
865 } else {
866 None
867 }
868 }
869
870 pub fn method_name(&self) -> &'static str {
872 match *self {
873 DeviceRequest::Open { .. } => "open",
874 DeviceRequest::Close { .. } => "close",
875 DeviceRequest::GetMaxFrameSize { .. } => "get_max_frame_size",
876 DeviceRequest::SendFrame { .. } => "send_frame",
877 DeviceRequest::ReadyToReceiveFrames { .. } => "ready_to_receive_frames",
878 }
879 }
880}
881
882#[derive(Debug, Clone)]
883pub struct DeviceControlHandle {
884 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
885}
886
887impl fidl::endpoints::ControlHandle for DeviceControlHandle {
888 fn shutdown(&self) {
889 self.inner.shutdown()
890 }
891 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
892 self.inner.shutdown_with_epitaph(status)
893 }
894
895 fn is_closed(&self) -> bool {
896 self.inner.channel().is_closed()
897 }
898 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
899 self.inner.channel().on_closed()
900 }
901
902 #[cfg(target_os = "fuchsia")]
903 fn signal_peer(
904 &self,
905 clear_mask: zx::Signals,
906 set_mask: zx::Signals,
907 ) -> Result<(), zx_status::Status> {
908 use fidl::Peered;
909 self.inner.channel().signal_peer(clear_mask, set_mask)
910 }
911}
912
913impl DeviceControlHandle {
914 pub fn send_on_ready_for_send_frames(
915 &self,
916 mut number_of_frames: u32,
917 ) -> Result<(), fidl::Error> {
918 self.inner.send::<DeviceOnReadyForSendFramesRequest>(
919 (number_of_frames,),
920 0,
921 0x2b1d5b28c5811b53,
922 fidl::encoding::DynamicFlags::empty(),
923 )
924 }
925
926 pub fn send_on_receive_frame(&self, mut data: &[u8]) -> Result<(), fidl::Error> {
927 self.inner.send::<DeviceOnReceiveFrameRequest>(
928 (data,),
929 0,
930 0x61937a45670aabb0,
931 fidl::encoding::DynamicFlags::empty(),
932 )
933 }
934
935 pub fn send_on_error(&self, mut error: Error, mut did_close: bool) -> Result<(), fidl::Error> {
936 self.inner.send::<DeviceOnErrorRequest>(
937 (error, did_close),
938 0,
939 0x4d20e65a9d2625e1,
940 fidl::encoding::DynamicFlags::empty(),
941 )
942 }
943}
944
945#[must_use = "FIDL methods require a response to be sent"]
946#[derive(Debug)]
947pub struct DeviceOpenResponder {
948 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
949 tx_id: u32,
950}
951
952impl std::ops::Drop for DeviceOpenResponder {
956 fn drop(&mut self) {
957 self.control_handle.shutdown();
958 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
960 }
961}
962
963impl fidl::endpoints::Responder for DeviceOpenResponder {
964 type ControlHandle = DeviceControlHandle;
965
966 fn control_handle(&self) -> &DeviceControlHandle {
967 &self.control_handle
968 }
969
970 fn drop_without_shutdown(mut self) {
971 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
973 std::mem::forget(self);
975 }
976}
977
978impl DeviceOpenResponder {
979 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
983 let _result = self.send_raw(result);
984 if _result.is_err() {
985 self.control_handle.shutdown();
986 }
987 self.drop_without_shutdown();
988 _result
989 }
990
991 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
993 let _result = self.send_raw(result);
994 self.drop_without_shutdown();
995 _result
996 }
997
998 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
999 self.control_handle
1000 .inner
1001 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1002 result,
1003 self.tx_id,
1004 0x508cecb73a776ef7,
1005 fidl::encoding::DynamicFlags::empty(),
1006 )
1007 }
1008}
1009
1010#[must_use = "FIDL methods require a response to be sent"]
1011#[derive(Debug)]
1012pub struct DeviceCloseResponder {
1013 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1014 tx_id: u32,
1015}
1016
1017impl std::ops::Drop for DeviceCloseResponder {
1021 fn drop(&mut self) {
1022 self.control_handle.shutdown();
1023 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1025 }
1026}
1027
1028impl fidl::endpoints::Responder for DeviceCloseResponder {
1029 type ControlHandle = DeviceControlHandle;
1030
1031 fn control_handle(&self) -> &DeviceControlHandle {
1032 &self.control_handle
1033 }
1034
1035 fn drop_without_shutdown(mut self) {
1036 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1038 std::mem::forget(self);
1040 }
1041}
1042
1043impl DeviceCloseResponder {
1044 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1048 let _result = self.send_raw(result);
1049 if _result.is_err() {
1050 self.control_handle.shutdown();
1051 }
1052 self.drop_without_shutdown();
1053 _result
1054 }
1055
1056 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1058 let _result = self.send_raw(result);
1059 self.drop_without_shutdown();
1060 _result
1061 }
1062
1063 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1064 self.control_handle
1065 .inner
1066 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1067 result,
1068 self.tx_id,
1069 0x621a0f31b867781a,
1070 fidl::encoding::DynamicFlags::empty(),
1071 )
1072 }
1073}
1074
1075#[must_use = "FIDL methods require a response to be sent"]
1076#[derive(Debug)]
1077pub struct DeviceGetMaxFrameSizeResponder {
1078 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1079 tx_id: u32,
1080}
1081
1082impl std::ops::Drop for DeviceGetMaxFrameSizeResponder {
1086 fn drop(&mut self) {
1087 self.control_handle.shutdown();
1088 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1090 }
1091}
1092
1093impl fidl::endpoints::Responder for DeviceGetMaxFrameSizeResponder {
1094 type ControlHandle = DeviceControlHandle;
1095
1096 fn control_handle(&self) -> &DeviceControlHandle {
1097 &self.control_handle
1098 }
1099
1100 fn drop_without_shutdown(mut self) {
1101 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1103 std::mem::forget(self);
1105 }
1106}
1107
1108impl DeviceGetMaxFrameSizeResponder {
1109 pub fn send(self, mut size: u32) -> Result<(), fidl::Error> {
1113 let _result = self.send_raw(size);
1114 if _result.is_err() {
1115 self.control_handle.shutdown();
1116 }
1117 self.drop_without_shutdown();
1118 _result
1119 }
1120
1121 pub fn send_no_shutdown_on_err(self, mut size: u32) -> Result<(), fidl::Error> {
1123 let _result = self.send_raw(size);
1124 self.drop_without_shutdown();
1125 _result
1126 }
1127
1128 fn send_raw(&self, mut size: u32) -> Result<(), fidl::Error> {
1129 self.control_handle.inner.send::<DeviceGetMaxFrameSizeResponse>(
1130 (size,),
1131 self.tx_id,
1132 0x1d2d652e8b06d463,
1133 fidl::encoding::DynamicFlags::empty(),
1134 )
1135 }
1136}
1137
1138#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1139pub struct DeviceSetupMarker;
1140
1141impl fidl::endpoints::ProtocolMarker for DeviceSetupMarker {
1142 type Proxy = DeviceSetupProxy;
1143 type RequestStream = DeviceSetupRequestStream;
1144 #[cfg(target_os = "fuchsia")]
1145 type SynchronousProxy = DeviceSetupSynchronousProxy;
1146
1147 const DEBUG_NAME: &'static str = "(anonymous) DeviceSetup";
1148}
1149pub type DeviceSetupSetChannelResult = Result<(), i32>;
1150
1151pub trait DeviceSetupProxyInterface: Send + Sync {
1152 type SetChannelResponseFut: std::future::Future<Output = Result<DeviceSetupSetChannelResult, fidl::Error>>
1153 + Send;
1154 fn r#set_channel(
1155 &self,
1156 req: fidl::endpoints::ServerEnd<DeviceMarker>,
1157 ) -> Self::SetChannelResponseFut;
1158}
1159#[derive(Debug)]
1160#[cfg(target_os = "fuchsia")]
1161pub struct DeviceSetupSynchronousProxy {
1162 client: fidl::client::sync::Client,
1163}
1164
1165#[cfg(target_os = "fuchsia")]
1166impl fidl::endpoints::SynchronousProxy for DeviceSetupSynchronousProxy {
1167 type Proxy = DeviceSetupProxy;
1168 type Protocol = DeviceSetupMarker;
1169
1170 fn from_channel(inner: fidl::Channel) -> Self {
1171 Self::new(inner)
1172 }
1173
1174 fn into_channel(self) -> fidl::Channel {
1175 self.client.into_channel()
1176 }
1177
1178 fn as_channel(&self) -> &fidl::Channel {
1179 self.client.as_channel()
1180 }
1181}
1182
1183#[cfg(target_os = "fuchsia")]
1184impl DeviceSetupSynchronousProxy {
1185 pub fn new(channel: fidl::Channel) -> Self {
1186 let protocol_name = <DeviceSetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1187 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1188 }
1189
1190 pub fn into_channel(self) -> fidl::Channel {
1191 self.client.into_channel()
1192 }
1193
1194 pub fn wait_for_event(
1197 &self,
1198 deadline: zx::MonotonicInstant,
1199 ) -> Result<DeviceSetupEvent, fidl::Error> {
1200 DeviceSetupEvent::decode(self.client.wait_for_event(deadline)?)
1201 }
1202
1203 pub fn r#set_channel(
1204 &self,
1205 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
1206 ___deadline: zx::MonotonicInstant,
1207 ) -> Result<DeviceSetupSetChannelResult, fidl::Error> {
1208 let _response = self.client.send_query::<
1209 DeviceSetupSetChannelRequest,
1210 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1211 >(
1212 (req,),
1213 0x7f8e02c174ef02a5,
1214 fidl::encoding::DynamicFlags::empty(),
1215 ___deadline,
1216 )?;
1217 Ok(_response.map(|x| x))
1218 }
1219}
1220
1221#[cfg(target_os = "fuchsia")]
1222impl From<DeviceSetupSynchronousProxy> for zx::Handle {
1223 fn from(value: DeviceSetupSynchronousProxy) -> Self {
1224 value.into_channel().into()
1225 }
1226}
1227
1228#[cfg(target_os = "fuchsia")]
1229impl From<fidl::Channel> for DeviceSetupSynchronousProxy {
1230 fn from(value: fidl::Channel) -> Self {
1231 Self::new(value)
1232 }
1233}
1234
1235#[cfg(target_os = "fuchsia")]
1236impl fidl::endpoints::FromClient for DeviceSetupSynchronousProxy {
1237 type Protocol = DeviceSetupMarker;
1238
1239 fn from_client(value: fidl::endpoints::ClientEnd<DeviceSetupMarker>) -> Self {
1240 Self::new(value.into_channel())
1241 }
1242}
1243
1244#[derive(Debug, Clone)]
1245pub struct DeviceSetupProxy {
1246 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1247}
1248
1249impl fidl::endpoints::Proxy for DeviceSetupProxy {
1250 type Protocol = DeviceSetupMarker;
1251
1252 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1253 Self::new(inner)
1254 }
1255
1256 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1257 self.client.into_channel().map_err(|client| Self { client })
1258 }
1259
1260 fn as_channel(&self) -> &::fidl::AsyncChannel {
1261 self.client.as_channel()
1262 }
1263}
1264
1265impl DeviceSetupProxy {
1266 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1268 let protocol_name = <DeviceSetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1269 Self { client: fidl::client::Client::new(channel, protocol_name) }
1270 }
1271
1272 pub fn take_event_stream(&self) -> DeviceSetupEventStream {
1278 DeviceSetupEventStream { event_receiver: self.client.take_event_receiver() }
1279 }
1280
1281 pub fn r#set_channel(
1282 &self,
1283 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
1284 ) -> fidl::client::QueryResponseFut<
1285 DeviceSetupSetChannelResult,
1286 fidl::encoding::DefaultFuchsiaResourceDialect,
1287 > {
1288 DeviceSetupProxyInterface::r#set_channel(self, req)
1289 }
1290}
1291
1292impl DeviceSetupProxyInterface for DeviceSetupProxy {
1293 type SetChannelResponseFut = fidl::client::QueryResponseFut<
1294 DeviceSetupSetChannelResult,
1295 fidl::encoding::DefaultFuchsiaResourceDialect,
1296 >;
1297 fn r#set_channel(
1298 &self,
1299 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
1300 ) -> Self::SetChannelResponseFut {
1301 fn _decode(
1302 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1303 ) -> Result<DeviceSetupSetChannelResult, fidl::Error> {
1304 let _response = fidl::client::decode_transaction_body::<
1305 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1306 fidl::encoding::DefaultFuchsiaResourceDialect,
1307 0x7f8e02c174ef02a5,
1308 >(_buf?)?;
1309 Ok(_response.map(|x| x))
1310 }
1311 self.client
1312 .send_query_and_decode::<DeviceSetupSetChannelRequest, DeviceSetupSetChannelResult>(
1313 (req,),
1314 0x7f8e02c174ef02a5,
1315 fidl::encoding::DynamicFlags::empty(),
1316 _decode,
1317 )
1318 }
1319}
1320
1321pub struct DeviceSetupEventStream {
1322 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1323}
1324
1325impl std::marker::Unpin for DeviceSetupEventStream {}
1326
1327impl futures::stream::FusedStream for DeviceSetupEventStream {
1328 fn is_terminated(&self) -> bool {
1329 self.event_receiver.is_terminated()
1330 }
1331}
1332
1333impl futures::Stream for DeviceSetupEventStream {
1334 type Item = Result<DeviceSetupEvent, fidl::Error>;
1335
1336 fn poll_next(
1337 mut self: std::pin::Pin<&mut Self>,
1338 cx: &mut std::task::Context<'_>,
1339 ) -> std::task::Poll<Option<Self::Item>> {
1340 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1341 &mut self.event_receiver,
1342 cx
1343 )?) {
1344 Some(buf) => std::task::Poll::Ready(Some(DeviceSetupEvent::decode(buf))),
1345 None => std::task::Poll::Ready(None),
1346 }
1347 }
1348}
1349
1350#[derive(Debug)]
1351pub enum DeviceSetupEvent {}
1352
1353impl DeviceSetupEvent {
1354 fn decode(
1356 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1357 ) -> Result<DeviceSetupEvent, fidl::Error> {
1358 let (bytes, _handles) = buf.split_mut();
1359 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1360 debug_assert_eq!(tx_header.tx_id, 0);
1361 match tx_header.ordinal {
1362 _ => Err(fidl::Error::UnknownOrdinal {
1363 ordinal: tx_header.ordinal,
1364 protocol_name: <DeviceSetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1365 }),
1366 }
1367 }
1368}
1369
1370pub struct DeviceSetupRequestStream {
1372 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1373 is_terminated: bool,
1374}
1375
1376impl std::marker::Unpin for DeviceSetupRequestStream {}
1377
1378impl futures::stream::FusedStream for DeviceSetupRequestStream {
1379 fn is_terminated(&self) -> bool {
1380 self.is_terminated
1381 }
1382}
1383
1384impl fidl::endpoints::RequestStream for DeviceSetupRequestStream {
1385 type Protocol = DeviceSetupMarker;
1386 type ControlHandle = DeviceSetupControlHandle;
1387
1388 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1389 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1390 }
1391
1392 fn control_handle(&self) -> Self::ControlHandle {
1393 DeviceSetupControlHandle { inner: self.inner.clone() }
1394 }
1395
1396 fn into_inner(
1397 self,
1398 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1399 {
1400 (self.inner, self.is_terminated)
1401 }
1402
1403 fn from_inner(
1404 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1405 is_terminated: bool,
1406 ) -> Self {
1407 Self { inner, is_terminated }
1408 }
1409}
1410
1411impl futures::Stream for DeviceSetupRequestStream {
1412 type Item = Result<DeviceSetupRequest, fidl::Error>;
1413
1414 fn poll_next(
1415 mut self: std::pin::Pin<&mut Self>,
1416 cx: &mut std::task::Context<'_>,
1417 ) -> std::task::Poll<Option<Self::Item>> {
1418 let this = &mut *self;
1419 if this.inner.check_shutdown(cx) {
1420 this.is_terminated = true;
1421 return std::task::Poll::Ready(None);
1422 }
1423 if this.is_terminated {
1424 panic!("polled DeviceSetupRequestStream after completion");
1425 }
1426 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1427 |bytes, handles| {
1428 match this.inner.channel().read_etc(cx, bytes, handles) {
1429 std::task::Poll::Ready(Ok(())) => {}
1430 std::task::Poll::Pending => return std::task::Poll::Pending,
1431 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1432 this.is_terminated = true;
1433 return std::task::Poll::Ready(None);
1434 }
1435 std::task::Poll::Ready(Err(e)) => {
1436 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1437 e.into(),
1438 ))))
1439 }
1440 }
1441
1442 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1444
1445 std::task::Poll::Ready(Some(match header.ordinal {
1446 0x7f8e02c174ef02a5 => {
1447 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1448 let mut req = fidl::new_empty!(
1449 DeviceSetupSetChannelRequest,
1450 fidl::encoding::DefaultFuchsiaResourceDialect
1451 );
1452 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetupSetChannelRequest>(&header, _body_bytes, handles, &mut req)?;
1453 let control_handle = DeviceSetupControlHandle { inner: this.inner.clone() };
1454 Ok(DeviceSetupRequest::SetChannel {
1455 req: req.req,
1456
1457 responder: DeviceSetupSetChannelResponder {
1458 control_handle: std::mem::ManuallyDrop::new(control_handle),
1459 tx_id: header.tx_id,
1460 },
1461 })
1462 }
1463 _ => Err(fidl::Error::UnknownOrdinal {
1464 ordinal: header.ordinal,
1465 protocol_name:
1466 <DeviceSetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1467 }),
1468 }))
1469 },
1470 )
1471 }
1472}
1473
1474#[derive(Debug)]
1475pub enum DeviceSetupRequest {
1476 SetChannel {
1477 req: fidl::endpoints::ServerEnd<DeviceMarker>,
1478 responder: DeviceSetupSetChannelResponder,
1479 },
1480}
1481
1482impl DeviceSetupRequest {
1483 #[allow(irrefutable_let_patterns)]
1484 pub fn into_set_channel(
1485 self,
1486 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, DeviceSetupSetChannelResponder)> {
1487 if let DeviceSetupRequest::SetChannel { req, responder } = self {
1488 Some((req, responder))
1489 } else {
1490 None
1491 }
1492 }
1493
1494 pub fn method_name(&self) -> &'static str {
1496 match *self {
1497 DeviceSetupRequest::SetChannel { .. } => "set_channel",
1498 }
1499 }
1500}
1501
1502#[derive(Debug, Clone)]
1503pub struct DeviceSetupControlHandle {
1504 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1505}
1506
1507impl fidl::endpoints::ControlHandle for DeviceSetupControlHandle {
1508 fn shutdown(&self) {
1509 self.inner.shutdown()
1510 }
1511 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1512 self.inner.shutdown_with_epitaph(status)
1513 }
1514
1515 fn is_closed(&self) -> bool {
1516 self.inner.channel().is_closed()
1517 }
1518 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1519 self.inner.channel().on_closed()
1520 }
1521
1522 #[cfg(target_os = "fuchsia")]
1523 fn signal_peer(
1524 &self,
1525 clear_mask: zx::Signals,
1526 set_mask: zx::Signals,
1527 ) -> Result<(), zx_status::Status> {
1528 use fidl::Peered;
1529 self.inner.channel().signal_peer(clear_mask, set_mask)
1530 }
1531}
1532
1533impl DeviceSetupControlHandle {}
1534
1535#[must_use = "FIDL methods require a response to be sent"]
1536#[derive(Debug)]
1537pub struct DeviceSetupSetChannelResponder {
1538 control_handle: std::mem::ManuallyDrop<DeviceSetupControlHandle>,
1539 tx_id: u32,
1540}
1541
1542impl std::ops::Drop for DeviceSetupSetChannelResponder {
1546 fn drop(&mut self) {
1547 self.control_handle.shutdown();
1548 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1550 }
1551}
1552
1553impl fidl::endpoints::Responder for DeviceSetupSetChannelResponder {
1554 type ControlHandle = DeviceSetupControlHandle;
1555
1556 fn control_handle(&self) -> &DeviceSetupControlHandle {
1557 &self.control_handle
1558 }
1559
1560 fn drop_without_shutdown(mut self) {
1561 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1563 std::mem::forget(self);
1565 }
1566}
1567
1568impl DeviceSetupSetChannelResponder {
1569 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1573 let _result = self.send_raw(result);
1574 if _result.is_err() {
1575 self.control_handle.shutdown();
1576 }
1577 self.drop_without_shutdown();
1578 _result
1579 }
1580
1581 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1583 let _result = self.send_raw(result);
1584 self.drop_without_shutdown();
1585 _result
1586 }
1587
1588 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1589 self.control_handle
1590 .inner
1591 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1592 result,
1593 self.tx_id,
1594 0x7f8e02c174ef02a5,
1595 fidl::encoding::DynamicFlags::empty(),
1596 )
1597 }
1598}
1599
1600#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1601pub struct ServiceMarker;
1602
1603#[cfg(target_os = "fuchsia")]
1604impl fidl::endpoints::ServiceMarker for ServiceMarker {
1605 type Proxy = ServiceProxy;
1606 type Request = ServiceRequest;
1607 const SERVICE_NAME: &'static str = "fuchsia.lowpan.spinel.Service";
1608}
1609
1610#[cfg(target_os = "fuchsia")]
1613pub enum ServiceRequest {
1614 DeviceSetup(DeviceSetupRequestStream),
1615}
1616
1617#[cfg(target_os = "fuchsia")]
1618impl fidl::endpoints::ServiceRequest for ServiceRequest {
1619 type Service = ServiceMarker;
1620
1621 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1622 match name {
1623 "device_setup" => Self::DeviceSetup(
1624 <DeviceSetupRequestStream as fidl::endpoints::RequestStream>::from_channel(
1625 _channel,
1626 ),
1627 ),
1628 _ => panic!("no such member protocol name for service Service"),
1629 }
1630 }
1631
1632 fn member_names() -> &'static [&'static str] {
1633 &["device_setup"]
1634 }
1635}
1636#[cfg(target_os = "fuchsia")]
1637pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1638
1639#[cfg(target_os = "fuchsia")]
1640impl fidl::endpoints::ServiceProxy for ServiceProxy {
1641 type Service = ServiceMarker;
1642
1643 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1644 Self(opener)
1645 }
1646}
1647
1648#[cfg(target_os = "fuchsia")]
1649impl ServiceProxy {
1650 pub fn connect_to_device_setup(&self) -> Result<DeviceSetupProxy, fidl::Error> {
1651 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceSetupMarker>();
1652 self.connect_channel_to_device_setup(server_end)?;
1653 Ok(proxy)
1654 }
1655
1656 pub fn connect_to_device_setup_sync(&self) -> Result<DeviceSetupSynchronousProxy, fidl::Error> {
1659 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceSetupMarker>();
1660 self.connect_channel_to_device_setup(server_end)?;
1661 Ok(proxy)
1662 }
1663
1664 pub fn connect_channel_to_device_setup(
1667 &self,
1668 server_end: fidl::endpoints::ServerEnd<DeviceSetupMarker>,
1669 ) -> Result<(), fidl::Error> {
1670 self.0.open_member("device_setup", server_end.into_channel())
1671 }
1672
1673 pub fn instance_name(&self) -> &str {
1674 self.0.instance_name()
1675 }
1676}
1677
1678mod internal {
1679 use super::*;
1680
1681 impl fidl::encoding::ResourceTypeMarker for DeviceSetupSetChannelRequest {
1682 type Borrowed<'a> = &'a mut Self;
1683 fn take_or_borrow<'a>(
1684 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1685 ) -> Self::Borrowed<'a> {
1686 value
1687 }
1688 }
1689
1690 unsafe impl fidl::encoding::TypeMarker for DeviceSetupSetChannelRequest {
1691 type Owned = Self;
1692
1693 #[inline(always)]
1694 fn inline_align(_context: fidl::encoding::Context) -> usize {
1695 4
1696 }
1697
1698 #[inline(always)]
1699 fn inline_size(_context: fidl::encoding::Context) -> usize {
1700 4
1701 }
1702 }
1703
1704 unsafe impl
1705 fidl::encoding::Encode<
1706 DeviceSetupSetChannelRequest,
1707 fidl::encoding::DefaultFuchsiaResourceDialect,
1708 > for &mut DeviceSetupSetChannelRequest
1709 {
1710 #[inline]
1711 unsafe fn encode(
1712 self,
1713 encoder: &mut fidl::encoding::Encoder<
1714 '_,
1715 fidl::encoding::DefaultFuchsiaResourceDialect,
1716 >,
1717 offset: usize,
1718 _depth: fidl::encoding::Depth,
1719 ) -> fidl::Result<()> {
1720 encoder.debug_check_bounds::<DeviceSetupSetChannelRequest>(offset);
1721 fidl::encoding::Encode::<DeviceSetupSetChannelRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1723 (
1724 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.req),
1725 ),
1726 encoder, offset, _depth
1727 )
1728 }
1729 }
1730 unsafe impl<
1731 T0: fidl::encoding::Encode<
1732 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1733 fidl::encoding::DefaultFuchsiaResourceDialect,
1734 >,
1735 >
1736 fidl::encoding::Encode<
1737 DeviceSetupSetChannelRequest,
1738 fidl::encoding::DefaultFuchsiaResourceDialect,
1739 > for (T0,)
1740 {
1741 #[inline]
1742 unsafe fn encode(
1743 self,
1744 encoder: &mut fidl::encoding::Encoder<
1745 '_,
1746 fidl::encoding::DefaultFuchsiaResourceDialect,
1747 >,
1748 offset: usize,
1749 depth: fidl::encoding::Depth,
1750 ) -> fidl::Result<()> {
1751 encoder.debug_check_bounds::<DeviceSetupSetChannelRequest>(offset);
1752 self.0.encode(encoder, offset + 0, depth)?;
1756 Ok(())
1757 }
1758 }
1759
1760 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1761 for DeviceSetupSetChannelRequest
1762 {
1763 #[inline(always)]
1764 fn new_empty() -> Self {
1765 Self {
1766 req: fidl::new_empty!(
1767 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1768 fidl::encoding::DefaultFuchsiaResourceDialect
1769 ),
1770 }
1771 }
1772
1773 #[inline]
1774 unsafe fn decode(
1775 &mut self,
1776 decoder: &mut fidl::encoding::Decoder<
1777 '_,
1778 fidl::encoding::DefaultFuchsiaResourceDialect,
1779 >,
1780 offset: usize,
1781 _depth: fidl::encoding::Depth,
1782 ) -> fidl::Result<()> {
1783 decoder.debug_check_bounds::<Self>(offset);
1784 fidl::decode!(
1786 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1787 fidl::encoding::DefaultFuchsiaResourceDialect,
1788 &mut self.req,
1789 decoder,
1790 offset + 0,
1791 _depth
1792 )?;
1793 Ok(())
1794 }
1795 }
1796}