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 Self { client: fidl::client::sync::Client::new(channel) }
78 }
79
80 pub fn into_channel(self) -> fidl::Channel {
81 self.client.into_channel()
82 }
83
84 pub fn wait_for_event(
87 &self,
88 deadline: zx::MonotonicInstant,
89 ) -> Result<DeviceEvent, fidl::Error> {
90 DeviceEvent::decode(self.client.wait_for_event::<DeviceMarker>(deadline)?)
91 }
92
93 pub fn r#open(
110 &self,
111 ___deadline: zx::MonotonicInstant,
112 ) -> Result<DeviceOpenResult, fidl::Error> {
113 let _response = self.client.send_query::<
114 fidl::encoding::EmptyPayload,
115 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
116 DeviceMarker,
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 DeviceMarker,
153 >(
154 (),
155 0x621a0f31b867781a,
156 fidl::encoding::DynamicFlags::empty(),
157 ___deadline,
158 )?;
159 Ok(_response.map(|x| x))
160 }
161
162 pub fn r#get_max_frame_size(
170 &self,
171 ___deadline: zx::MonotonicInstant,
172 ) -> Result<u32, fidl::Error> {
173 let _response = self.client.send_query::<
174 fidl::encoding::EmptyPayload,
175 DeviceGetMaxFrameSizeResponse,
176 DeviceMarker,
177 >(
178 (),
179 0x1d2d652e8b06d463,
180 fidl::encoding::DynamicFlags::empty(),
181 ___deadline,
182 )?;
183 Ok(_response.size)
184 }
185
186 pub fn r#send_frame(&self, mut data: &[u8]) -> Result<(), fidl::Error> {
193 self.client.send::<DeviceSendFrameRequest>(
194 (data,),
195 0x634f2957b35c5944,
196 fidl::encoding::DynamicFlags::empty(),
197 )
198 }
199
200 pub fn r#ready_to_receive_frames(&self, mut number_of_frames: u32) -> Result<(), fidl::Error> {
227 self.client.send::<DeviceReadyToReceiveFramesRequest>(
228 (number_of_frames,),
229 0x3147df23fdd53b87,
230 fidl::encoding::DynamicFlags::empty(),
231 )
232 }
233}
234
235#[cfg(target_os = "fuchsia")]
236impl From<DeviceSynchronousProxy> for zx::NullableHandle {
237 fn from(value: DeviceSynchronousProxy) -> Self {
238 value.into_channel().into()
239 }
240}
241
242#[cfg(target_os = "fuchsia")]
243impl From<fidl::Channel> for DeviceSynchronousProxy {
244 fn from(value: fidl::Channel) -> Self {
245 Self::new(value)
246 }
247}
248
249#[cfg(target_os = "fuchsia")]
250impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
251 type Protocol = DeviceMarker;
252
253 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
254 Self::new(value.into_channel())
255 }
256}
257
258#[derive(Debug, Clone)]
259pub struct DeviceProxy {
260 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
261}
262
263impl fidl::endpoints::Proxy for DeviceProxy {
264 type Protocol = DeviceMarker;
265
266 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
267 Self::new(inner)
268 }
269
270 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
271 self.client.into_channel().map_err(|client| Self { client })
272 }
273
274 fn as_channel(&self) -> &::fidl::AsyncChannel {
275 self.client.as_channel()
276 }
277}
278
279impl DeviceProxy {
280 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
282 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
283 Self { client: fidl::client::Client::new(channel, protocol_name) }
284 }
285
286 pub fn take_event_stream(&self) -> DeviceEventStream {
292 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
293 }
294
295 pub fn r#open(
312 &self,
313 ) -> fidl::client::QueryResponseFut<
314 DeviceOpenResult,
315 fidl::encoding::DefaultFuchsiaResourceDialect,
316 > {
317 DeviceProxyInterface::r#open(self)
318 }
319
320 pub fn r#close(
340 &self,
341 ) -> fidl::client::QueryResponseFut<
342 DeviceCloseResult,
343 fidl::encoding::DefaultFuchsiaResourceDialect,
344 > {
345 DeviceProxyInterface::r#close(self)
346 }
347
348 pub fn r#get_max_frame_size(
356 &self,
357 ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
358 DeviceProxyInterface::r#get_max_frame_size(self)
359 }
360
361 pub fn r#send_frame(&self, mut data: &[u8]) -> Result<(), fidl::Error> {
368 DeviceProxyInterface::r#send_frame(self, data)
369 }
370
371 pub fn r#ready_to_receive_frames(&self, mut number_of_frames: u32) -> Result<(), fidl::Error> {
398 DeviceProxyInterface::r#ready_to_receive_frames(self, number_of_frames)
399 }
400}
401
402impl DeviceProxyInterface for DeviceProxy {
403 type OpenResponseFut = fidl::client::QueryResponseFut<
404 DeviceOpenResult,
405 fidl::encoding::DefaultFuchsiaResourceDialect,
406 >;
407 fn r#open(&self) -> Self::OpenResponseFut {
408 fn _decode(
409 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
410 ) -> Result<DeviceOpenResult, fidl::Error> {
411 let _response = fidl::client::decode_transaction_body::<
412 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
413 fidl::encoding::DefaultFuchsiaResourceDialect,
414 0x508cecb73a776ef7,
415 >(_buf?)?;
416 Ok(_response.map(|x| x))
417 }
418 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceOpenResult>(
419 (),
420 0x508cecb73a776ef7,
421 fidl::encoding::DynamicFlags::empty(),
422 _decode,
423 )
424 }
425
426 type CloseResponseFut = fidl::client::QueryResponseFut<
427 DeviceCloseResult,
428 fidl::encoding::DefaultFuchsiaResourceDialect,
429 >;
430 fn r#close(&self) -> Self::CloseResponseFut {
431 fn _decode(
432 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
433 ) -> Result<DeviceCloseResult, fidl::Error> {
434 let _response = fidl::client::decode_transaction_body::<
435 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
436 fidl::encoding::DefaultFuchsiaResourceDialect,
437 0x621a0f31b867781a,
438 >(_buf?)?;
439 Ok(_response.map(|x| x))
440 }
441 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceCloseResult>(
442 (),
443 0x621a0f31b867781a,
444 fidl::encoding::DynamicFlags::empty(),
445 _decode,
446 )
447 }
448
449 type GetMaxFrameSizeResponseFut =
450 fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
451 fn r#get_max_frame_size(&self) -> Self::GetMaxFrameSizeResponseFut {
452 fn _decode(
453 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
454 ) -> Result<u32, fidl::Error> {
455 let _response = fidl::client::decode_transaction_body::<
456 DeviceGetMaxFrameSizeResponse,
457 fidl::encoding::DefaultFuchsiaResourceDialect,
458 0x1d2d652e8b06d463,
459 >(_buf?)?;
460 Ok(_response.size)
461 }
462 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
463 (),
464 0x1d2d652e8b06d463,
465 fidl::encoding::DynamicFlags::empty(),
466 _decode,
467 )
468 }
469
470 fn r#send_frame(&self, mut data: &[u8]) -> Result<(), fidl::Error> {
471 self.client.send::<DeviceSendFrameRequest>(
472 (data,),
473 0x634f2957b35c5944,
474 fidl::encoding::DynamicFlags::empty(),
475 )
476 }
477
478 fn r#ready_to_receive_frames(&self, mut number_of_frames: u32) -> Result<(), fidl::Error> {
479 self.client.send::<DeviceReadyToReceiveFramesRequest>(
480 (number_of_frames,),
481 0x3147df23fdd53b87,
482 fidl::encoding::DynamicFlags::empty(),
483 )
484 }
485}
486
487pub struct DeviceEventStream {
488 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
489}
490
491impl std::marker::Unpin for DeviceEventStream {}
492
493impl futures::stream::FusedStream for DeviceEventStream {
494 fn is_terminated(&self) -> bool {
495 self.event_receiver.is_terminated()
496 }
497}
498
499impl futures::Stream for DeviceEventStream {
500 type Item = Result<DeviceEvent, fidl::Error>;
501
502 fn poll_next(
503 mut self: std::pin::Pin<&mut Self>,
504 cx: &mut std::task::Context<'_>,
505 ) -> std::task::Poll<Option<Self::Item>> {
506 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
507 &mut self.event_receiver,
508 cx
509 )?) {
510 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
511 None => std::task::Poll::Ready(None),
512 }
513 }
514}
515
516#[derive(Debug)]
517pub enum DeviceEvent {
518 OnReadyForSendFrames { number_of_frames: u32 },
519 OnReceiveFrame { data: Vec<u8> },
520 OnError { error: Error, did_close: bool },
521}
522
523impl DeviceEvent {
524 #[allow(irrefutable_let_patterns)]
525 pub fn into_on_ready_for_send_frames(self) -> Option<u32> {
526 if let DeviceEvent::OnReadyForSendFrames { number_of_frames } = self {
527 Some((number_of_frames))
528 } else {
529 None
530 }
531 }
532 #[allow(irrefutable_let_patterns)]
533 pub fn into_on_receive_frame(self) -> Option<Vec<u8>> {
534 if let DeviceEvent::OnReceiveFrame { data } = self { Some((data)) } else { None }
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 { Some((responder)) } else { None }
828 }
829
830 #[allow(irrefutable_let_patterns)]
831 pub fn into_close(self) -> Option<(DeviceCloseResponder)> {
832 if let DeviceRequest::Close { responder } = self { Some((responder)) } else { None }
833 }
834
835 #[allow(irrefutable_let_patterns)]
836 pub fn into_get_max_frame_size(self) -> Option<(DeviceGetMaxFrameSizeResponder)> {
837 if let DeviceRequest::GetMaxFrameSize { responder } = self {
838 Some((responder))
839 } else {
840 None
841 }
842 }
843
844 #[allow(irrefutable_let_patterns)]
845 pub fn into_send_frame(self) -> Option<(Vec<u8>, DeviceControlHandle)> {
846 if let DeviceRequest::SendFrame { data, control_handle } = self {
847 Some((data, control_handle))
848 } else {
849 None
850 }
851 }
852
853 #[allow(irrefutable_let_patterns)]
854 pub fn into_ready_to_receive_frames(self) -> Option<(u32, DeviceControlHandle)> {
855 if let DeviceRequest::ReadyToReceiveFrames { number_of_frames, control_handle } = self {
856 Some((number_of_frames, control_handle))
857 } else {
858 None
859 }
860 }
861
862 pub fn method_name(&self) -> &'static str {
864 match *self {
865 DeviceRequest::Open { .. } => "open",
866 DeviceRequest::Close { .. } => "close",
867 DeviceRequest::GetMaxFrameSize { .. } => "get_max_frame_size",
868 DeviceRequest::SendFrame { .. } => "send_frame",
869 DeviceRequest::ReadyToReceiveFrames { .. } => "ready_to_receive_frames",
870 }
871 }
872}
873
874#[derive(Debug, Clone)]
875pub struct DeviceControlHandle {
876 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
877}
878
879impl fidl::endpoints::ControlHandle for DeviceControlHandle {
880 fn shutdown(&self) {
881 self.inner.shutdown()
882 }
883
884 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
885 self.inner.shutdown_with_epitaph(status)
886 }
887
888 fn is_closed(&self) -> bool {
889 self.inner.channel().is_closed()
890 }
891 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
892 self.inner.channel().on_closed()
893 }
894
895 #[cfg(target_os = "fuchsia")]
896 fn signal_peer(
897 &self,
898 clear_mask: zx::Signals,
899 set_mask: zx::Signals,
900 ) -> Result<(), zx_status::Status> {
901 use fidl::Peered;
902 self.inner.channel().signal_peer(clear_mask, set_mask)
903 }
904}
905
906impl DeviceControlHandle {
907 pub fn send_on_ready_for_send_frames(
908 &self,
909 mut number_of_frames: u32,
910 ) -> Result<(), fidl::Error> {
911 self.inner.send::<DeviceOnReadyForSendFramesRequest>(
912 (number_of_frames,),
913 0,
914 0x2b1d5b28c5811b53,
915 fidl::encoding::DynamicFlags::empty(),
916 )
917 }
918
919 pub fn send_on_receive_frame(&self, mut data: &[u8]) -> Result<(), fidl::Error> {
920 self.inner.send::<DeviceOnReceiveFrameRequest>(
921 (data,),
922 0,
923 0x61937a45670aabb0,
924 fidl::encoding::DynamicFlags::empty(),
925 )
926 }
927
928 pub fn send_on_error(&self, mut error: Error, mut did_close: bool) -> Result<(), fidl::Error> {
929 self.inner.send::<DeviceOnErrorRequest>(
930 (error, did_close),
931 0,
932 0x4d20e65a9d2625e1,
933 fidl::encoding::DynamicFlags::empty(),
934 )
935 }
936}
937
938#[must_use = "FIDL methods require a response to be sent"]
939#[derive(Debug)]
940pub struct DeviceOpenResponder {
941 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
942 tx_id: u32,
943}
944
945impl std::ops::Drop for DeviceOpenResponder {
949 fn drop(&mut self) {
950 self.control_handle.shutdown();
951 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
953 }
954}
955
956impl fidl::endpoints::Responder for DeviceOpenResponder {
957 type ControlHandle = DeviceControlHandle;
958
959 fn control_handle(&self) -> &DeviceControlHandle {
960 &self.control_handle
961 }
962
963 fn drop_without_shutdown(mut self) {
964 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
966 std::mem::forget(self);
968 }
969}
970
971impl DeviceOpenResponder {
972 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
976 let _result = self.send_raw(result);
977 if _result.is_err() {
978 self.control_handle.shutdown();
979 }
980 self.drop_without_shutdown();
981 _result
982 }
983
984 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
986 let _result = self.send_raw(result);
987 self.drop_without_shutdown();
988 _result
989 }
990
991 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
992 self.control_handle
993 .inner
994 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
995 result,
996 self.tx_id,
997 0x508cecb73a776ef7,
998 fidl::encoding::DynamicFlags::empty(),
999 )
1000 }
1001}
1002
1003#[must_use = "FIDL methods require a response to be sent"]
1004#[derive(Debug)]
1005pub struct DeviceCloseResponder {
1006 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1007 tx_id: u32,
1008}
1009
1010impl std::ops::Drop for DeviceCloseResponder {
1014 fn drop(&mut self) {
1015 self.control_handle.shutdown();
1016 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1018 }
1019}
1020
1021impl fidl::endpoints::Responder for DeviceCloseResponder {
1022 type ControlHandle = DeviceControlHandle;
1023
1024 fn control_handle(&self) -> &DeviceControlHandle {
1025 &self.control_handle
1026 }
1027
1028 fn drop_without_shutdown(mut self) {
1029 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1031 std::mem::forget(self);
1033 }
1034}
1035
1036impl DeviceCloseResponder {
1037 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1041 let _result = self.send_raw(result);
1042 if _result.is_err() {
1043 self.control_handle.shutdown();
1044 }
1045 self.drop_without_shutdown();
1046 _result
1047 }
1048
1049 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1051 let _result = self.send_raw(result);
1052 self.drop_without_shutdown();
1053 _result
1054 }
1055
1056 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1057 self.control_handle
1058 .inner
1059 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1060 result,
1061 self.tx_id,
1062 0x621a0f31b867781a,
1063 fidl::encoding::DynamicFlags::empty(),
1064 )
1065 }
1066}
1067
1068#[must_use = "FIDL methods require a response to be sent"]
1069#[derive(Debug)]
1070pub struct DeviceGetMaxFrameSizeResponder {
1071 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1072 tx_id: u32,
1073}
1074
1075impl std::ops::Drop for DeviceGetMaxFrameSizeResponder {
1079 fn drop(&mut self) {
1080 self.control_handle.shutdown();
1081 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1083 }
1084}
1085
1086impl fidl::endpoints::Responder for DeviceGetMaxFrameSizeResponder {
1087 type ControlHandle = DeviceControlHandle;
1088
1089 fn control_handle(&self) -> &DeviceControlHandle {
1090 &self.control_handle
1091 }
1092
1093 fn drop_without_shutdown(mut self) {
1094 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1096 std::mem::forget(self);
1098 }
1099}
1100
1101impl DeviceGetMaxFrameSizeResponder {
1102 pub fn send(self, mut size: u32) -> Result<(), fidl::Error> {
1106 let _result = self.send_raw(size);
1107 if _result.is_err() {
1108 self.control_handle.shutdown();
1109 }
1110 self.drop_without_shutdown();
1111 _result
1112 }
1113
1114 pub fn send_no_shutdown_on_err(self, mut size: u32) -> Result<(), fidl::Error> {
1116 let _result = self.send_raw(size);
1117 self.drop_without_shutdown();
1118 _result
1119 }
1120
1121 fn send_raw(&self, mut size: u32) -> Result<(), fidl::Error> {
1122 self.control_handle.inner.send::<DeviceGetMaxFrameSizeResponse>(
1123 (size,),
1124 self.tx_id,
1125 0x1d2d652e8b06d463,
1126 fidl::encoding::DynamicFlags::empty(),
1127 )
1128 }
1129}
1130
1131#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1132pub struct DeviceSetupMarker;
1133
1134impl fidl::endpoints::ProtocolMarker for DeviceSetupMarker {
1135 type Proxy = DeviceSetupProxy;
1136 type RequestStream = DeviceSetupRequestStream;
1137 #[cfg(target_os = "fuchsia")]
1138 type SynchronousProxy = DeviceSetupSynchronousProxy;
1139
1140 const DEBUG_NAME: &'static str = "(anonymous) DeviceSetup";
1141}
1142pub type DeviceSetupSetChannelResult = Result<(), i32>;
1143
1144pub trait DeviceSetupProxyInterface: Send + Sync {
1145 type SetChannelResponseFut: std::future::Future<Output = Result<DeviceSetupSetChannelResult, fidl::Error>>
1146 + Send;
1147 fn r#set_channel(
1148 &self,
1149 req: fidl::endpoints::ServerEnd<DeviceMarker>,
1150 ) -> Self::SetChannelResponseFut;
1151}
1152#[derive(Debug)]
1153#[cfg(target_os = "fuchsia")]
1154pub struct DeviceSetupSynchronousProxy {
1155 client: fidl::client::sync::Client,
1156}
1157
1158#[cfg(target_os = "fuchsia")]
1159impl fidl::endpoints::SynchronousProxy for DeviceSetupSynchronousProxy {
1160 type Proxy = DeviceSetupProxy;
1161 type Protocol = DeviceSetupMarker;
1162
1163 fn from_channel(inner: fidl::Channel) -> Self {
1164 Self::new(inner)
1165 }
1166
1167 fn into_channel(self) -> fidl::Channel {
1168 self.client.into_channel()
1169 }
1170
1171 fn as_channel(&self) -> &fidl::Channel {
1172 self.client.as_channel()
1173 }
1174}
1175
1176#[cfg(target_os = "fuchsia")]
1177impl DeviceSetupSynchronousProxy {
1178 pub fn new(channel: fidl::Channel) -> Self {
1179 Self { client: fidl::client::sync::Client::new(channel) }
1180 }
1181
1182 pub fn into_channel(self) -> fidl::Channel {
1183 self.client.into_channel()
1184 }
1185
1186 pub fn wait_for_event(
1189 &self,
1190 deadline: zx::MonotonicInstant,
1191 ) -> Result<DeviceSetupEvent, fidl::Error> {
1192 DeviceSetupEvent::decode(self.client.wait_for_event::<DeviceSetupMarker>(deadline)?)
1193 }
1194
1195 pub fn r#set_channel(
1196 &self,
1197 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
1198 ___deadline: zx::MonotonicInstant,
1199 ) -> Result<DeviceSetupSetChannelResult, fidl::Error> {
1200 let _response = self.client.send_query::<
1201 DeviceSetupSetChannelRequest,
1202 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1203 DeviceSetupMarker,
1204 >(
1205 (req,),
1206 0x7f8e02c174ef02a5,
1207 fidl::encoding::DynamicFlags::empty(),
1208 ___deadline,
1209 )?;
1210 Ok(_response.map(|x| x))
1211 }
1212}
1213
1214#[cfg(target_os = "fuchsia")]
1215impl From<DeviceSetupSynchronousProxy> for zx::NullableHandle {
1216 fn from(value: DeviceSetupSynchronousProxy) -> Self {
1217 value.into_channel().into()
1218 }
1219}
1220
1221#[cfg(target_os = "fuchsia")]
1222impl From<fidl::Channel> for DeviceSetupSynchronousProxy {
1223 fn from(value: fidl::Channel) -> Self {
1224 Self::new(value)
1225 }
1226}
1227
1228#[cfg(target_os = "fuchsia")]
1229impl fidl::endpoints::FromClient for DeviceSetupSynchronousProxy {
1230 type Protocol = DeviceSetupMarker;
1231
1232 fn from_client(value: fidl::endpoints::ClientEnd<DeviceSetupMarker>) -> Self {
1233 Self::new(value.into_channel())
1234 }
1235}
1236
1237#[derive(Debug, Clone)]
1238pub struct DeviceSetupProxy {
1239 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1240}
1241
1242impl fidl::endpoints::Proxy for DeviceSetupProxy {
1243 type Protocol = DeviceSetupMarker;
1244
1245 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1246 Self::new(inner)
1247 }
1248
1249 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1250 self.client.into_channel().map_err(|client| Self { client })
1251 }
1252
1253 fn as_channel(&self) -> &::fidl::AsyncChannel {
1254 self.client.as_channel()
1255 }
1256}
1257
1258impl DeviceSetupProxy {
1259 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1261 let protocol_name = <DeviceSetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1262 Self { client: fidl::client::Client::new(channel, protocol_name) }
1263 }
1264
1265 pub fn take_event_stream(&self) -> DeviceSetupEventStream {
1271 DeviceSetupEventStream { event_receiver: self.client.take_event_receiver() }
1272 }
1273
1274 pub fn r#set_channel(
1275 &self,
1276 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
1277 ) -> fidl::client::QueryResponseFut<
1278 DeviceSetupSetChannelResult,
1279 fidl::encoding::DefaultFuchsiaResourceDialect,
1280 > {
1281 DeviceSetupProxyInterface::r#set_channel(self, req)
1282 }
1283}
1284
1285impl DeviceSetupProxyInterface for DeviceSetupProxy {
1286 type SetChannelResponseFut = fidl::client::QueryResponseFut<
1287 DeviceSetupSetChannelResult,
1288 fidl::encoding::DefaultFuchsiaResourceDialect,
1289 >;
1290 fn r#set_channel(
1291 &self,
1292 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
1293 ) -> Self::SetChannelResponseFut {
1294 fn _decode(
1295 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1296 ) -> Result<DeviceSetupSetChannelResult, fidl::Error> {
1297 let _response = fidl::client::decode_transaction_body::<
1298 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1299 fidl::encoding::DefaultFuchsiaResourceDialect,
1300 0x7f8e02c174ef02a5,
1301 >(_buf?)?;
1302 Ok(_response.map(|x| x))
1303 }
1304 self.client
1305 .send_query_and_decode::<DeviceSetupSetChannelRequest, DeviceSetupSetChannelResult>(
1306 (req,),
1307 0x7f8e02c174ef02a5,
1308 fidl::encoding::DynamicFlags::empty(),
1309 _decode,
1310 )
1311 }
1312}
1313
1314pub struct DeviceSetupEventStream {
1315 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1316}
1317
1318impl std::marker::Unpin for DeviceSetupEventStream {}
1319
1320impl futures::stream::FusedStream for DeviceSetupEventStream {
1321 fn is_terminated(&self) -> bool {
1322 self.event_receiver.is_terminated()
1323 }
1324}
1325
1326impl futures::Stream for DeviceSetupEventStream {
1327 type Item = Result<DeviceSetupEvent, fidl::Error>;
1328
1329 fn poll_next(
1330 mut self: std::pin::Pin<&mut Self>,
1331 cx: &mut std::task::Context<'_>,
1332 ) -> std::task::Poll<Option<Self::Item>> {
1333 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1334 &mut self.event_receiver,
1335 cx
1336 )?) {
1337 Some(buf) => std::task::Poll::Ready(Some(DeviceSetupEvent::decode(buf))),
1338 None => std::task::Poll::Ready(None),
1339 }
1340 }
1341}
1342
1343#[derive(Debug)]
1344pub enum DeviceSetupEvent {}
1345
1346impl DeviceSetupEvent {
1347 fn decode(
1349 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1350 ) -> Result<DeviceSetupEvent, fidl::Error> {
1351 let (bytes, _handles) = buf.split_mut();
1352 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1353 debug_assert_eq!(tx_header.tx_id, 0);
1354 match tx_header.ordinal {
1355 _ => Err(fidl::Error::UnknownOrdinal {
1356 ordinal: tx_header.ordinal,
1357 protocol_name: <DeviceSetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1358 }),
1359 }
1360 }
1361}
1362
1363pub struct DeviceSetupRequestStream {
1365 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1366 is_terminated: bool,
1367}
1368
1369impl std::marker::Unpin for DeviceSetupRequestStream {}
1370
1371impl futures::stream::FusedStream for DeviceSetupRequestStream {
1372 fn is_terminated(&self) -> bool {
1373 self.is_terminated
1374 }
1375}
1376
1377impl fidl::endpoints::RequestStream for DeviceSetupRequestStream {
1378 type Protocol = DeviceSetupMarker;
1379 type ControlHandle = DeviceSetupControlHandle;
1380
1381 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1382 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1383 }
1384
1385 fn control_handle(&self) -> Self::ControlHandle {
1386 DeviceSetupControlHandle { inner: self.inner.clone() }
1387 }
1388
1389 fn into_inner(
1390 self,
1391 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1392 {
1393 (self.inner, self.is_terminated)
1394 }
1395
1396 fn from_inner(
1397 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1398 is_terminated: bool,
1399 ) -> Self {
1400 Self { inner, is_terminated }
1401 }
1402}
1403
1404impl futures::Stream for DeviceSetupRequestStream {
1405 type Item = Result<DeviceSetupRequest, fidl::Error>;
1406
1407 fn poll_next(
1408 mut self: std::pin::Pin<&mut Self>,
1409 cx: &mut std::task::Context<'_>,
1410 ) -> std::task::Poll<Option<Self::Item>> {
1411 let this = &mut *self;
1412 if this.inner.check_shutdown(cx) {
1413 this.is_terminated = true;
1414 return std::task::Poll::Ready(None);
1415 }
1416 if this.is_terminated {
1417 panic!("polled DeviceSetupRequestStream after completion");
1418 }
1419 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1420 |bytes, handles| {
1421 match this.inner.channel().read_etc(cx, bytes, handles) {
1422 std::task::Poll::Ready(Ok(())) => {}
1423 std::task::Poll::Pending => return std::task::Poll::Pending,
1424 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1425 this.is_terminated = true;
1426 return std::task::Poll::Ready(None);
1427 }
1428 std::task::Poll::Ready(Err(e)) => {
1429 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1430 e.into(),
1431 ))));
1432 }
1433 }
1434
1435 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1437
1438 std::task::Poll::Ready(Some(match header.ordinal {
1439 0x7f8e02c174ef02a5 => {
1440 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1441 let mut req = fidl::new_empty!(
1442 DeviceSetupSetChannelRequest,
1443 fidl::encoding::DefaultFuchsiaResourceDialect
1444 );
1445 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetupSetChannelRequest>(&header, _body_bytes, handles, &mut req)?;
1446 let control_handle = DeviceSetupControlHandle { inner: this.inner.clone() };
1447 Ok(DeviceSetupRequest::SetChannel {
1448 req: req.req,
1449
1450 responder: DeviceSetupSetChannelResponder {
1451 control_handle: std::mem::ManuallyDrop::new(control_handle),
1452 tx_id: header.tx_id,
1453 },
1454 })
1455 }
1456 _ => Err(fidl::Error::UnknownOrdinal {
1457 ordinal: header.ordinal,
1458 protocol_name:
1459 <DeviceSetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1460 }),
1461 }))
1462 },
1463 )
1464 }
1465}
1466
1467#[derive(Debug)]
1468pub enum DeviceSetupRequest {
1469 SetChannel {
1470 req: fidl::endpoints::ServerEnd<DeviceMarker>,
1471 responder: DeviceSetupSetChannelResponder,
1472 },
1473}
1474
1475impl DeviceSetupRequest {
1476 #[allow(irrefutable_let_patterns)]
1477 pub fn into_set_channel(
1478 self,
1479 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, DeviceSetupSetChannelResponder)> {
1480 if let DeviceSetupRequest::SetChannel { req, responder } = self {
1481 Some((req, responder))
1482 } else {
1483 None
1484 }
1485 }
1486
1487 pub fn method_name(&self) -> &'static str {
1489 match *self {
1490 DeviceSetupRequest::SetChannel { .. } => "set_channel",
1491 }
1492 }
1493}
1494
1495#[derive(Debug, Clone)]
1496pub struct DeviceSetupControlHandle {
1497 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1498}
1499
1500impl fidl::endpoints::ControlHandle for DeviceSetupControlHandle {
1501 fn shutdown(&self) {
1502 self.inner.shutdown()
1503 }
1504
1505 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1506 self.inner.shutdown_with_epitaph(status)
1507 }
1508
1509 fn is_closed(&self) -> bool {
1510 self.inner.channel().is_closed()
1511 }
1512 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1513 self.inner.channel().on_closed()
1514 }
1515
1516 #[cfg(target_os = "fuchsia")]
1517 fn signal_peer(
1518 &self,
1519 clear_mask: zx::Signals,
1520 set_mask: zx::Signals,
1521 ) -> Result<(), zx_status::Status> {
1522 use fidl::Peered;
1523 self.inner.channel().signal_peer(clear_mask, set_mask)
1524 }
1525}
1526
1527impl DeviceSetupControlHandle {}
1528
1529#[must_use = "FIDL methods require a response to be sent"]
1530#[derive(Debug)]
1531pub struct DeviceSetupSetChannelResponder {
1532 control_handle: std::mem::ManuallyDrop<DeviceSetupControlHandle>,
1533 tx_id: u32,
1534}
1535
1536impl std::ops::Drop for DeviceSetupSetChannelResponder {
1540 fn drop(&mut self) {
1541 self.control_handle.shutdown();
1542 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1544 }
1545}
1546
1547impl fidl::endpoints::Responder for DeviceSetupSetChannelResponder {
1548 type ControlHandle = DeviceSetupControlHandle;
1549
1550 fn control_handle(&self) -> &DeviceSetupControlHandle {
1551 &self.control_handle
1552 }
1553
1554 fn drop_without_shutdown(mut self) {
1555 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1557 std::mem::forget(self);
1559 }
1560}
1561
1562impl DeviceSetupSetChannelResponder {
1563 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1567 let _result = self.send_raw(result);
1568 if _result.is_err() {
1569 self.control_handle.shutdown();
1570 }
1571 self.drop_without_shutdown();
1572 _result
1573 }
1574
1575 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1577 let _result = self.send_raw(result);
1578 self.drop_without_shutdown();
1579 _result
1580 }
1581
1582 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1583 self.control_handle
1584 .inner
1585 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1586 result,
1587 self.tx_id,
1588 0x7f8e02c174ef02a5,
1589 fidl::encoding::DynamicFlags::empty(),
1590 )
1591 }
1592}
1593
1594#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1595pub struct ServiceMarker;
1596
1597#[cfg(target_os = "fuchsia")]
1598impl fidl::endpoints::ServiceMarker for ServiceMarker {
1599 type Proxy = ServiceProxy;
1600 type Request = ServiceRequest;
1601 const SERVICE_NAME: &'static str = "fuchsia.lowpan.spinel.Service";
1602}
1603
1604#[cfg(target_os = "fuchsia")]
1607pub enum ServiceRequest {
1608 DeviceSetup(DeviceSetupRequestStream),
1609}
1610
1611#[cfg(target_os = "fuchsia")]
1612impl fidl::endpoints::ServiceRequest for ServiceRequest {
1613 type Service = ServiceMarker;
1614
1615 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1616 match name {
1617 "device_setup" => Self::DeviceSetup(
1618 <DeviceSetupRequestStream as fidl::endpoints::RequestStream>::from_channel(
1619 _channel,
1620 ),
1621 ),
1622 _ => panic!("no such member protocol name for service Service"),
1623 }
1624 }
1625
1626 fn member_names() -> &'static [&'static str] {
1627 &["device_setup"]
1628 }
1629}
1630#[cfg(target_os = "fuchsia")]
1631pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1632
1633#[cfg(target_os = "fuchsia")]
1634impl fidl::endpoints::ServiceProxy for ServiceProxy {
1635 type Service = ServiceMarker;
1636
1637 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1638 Self(opener)
1639 }
1640}
1641
1642#[cfg(target_os = "fuchsia")]
1643impl ServiceProxy {
1644 pub fn connect_to_device_setup(&self) -> Result<DeviceSetupProxy, fidl::Error> {
1645 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceSetupMarker>();
1646 self.connect_channel_to_device_setup(server_end)?;
1647 Ok(proxy)
1648 }
1649
1650 pub fn connect_to_device_setup_sync(&self) -> Result<DeviceSetupSynchronousProxy, fidl::Error> {
1653 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceSetupMarker>();
1654 self.connect_channel_to_device_setup(server_end)?;
1655 Ok(proxy)
1656 }
1657
1658 pub fn connect_channel_to_device_setup(
1661 &self,
1662 server_end: fidl::endpoints::ServerEnd<DeviceSetupMarker>,
1663 ) -> Result<(), fidl::Error> {
1664 self.0.open_member("device_setup", server_end.into_channel())
1665 }
1666
1667 pub fn instance_name(&self) -> &str {
1668 self.0.instance_name()
1669 }
1670}
1671
1672mod internal {
1673 use super::*;
1674
1675 impl fidl::encoding::ResourceTypeMarker for DeviceSetupSetChannelRequest {
1676 type Borrowed<'a> = &'a mut Self;
1677 fn take_or_borrow<'a>(
1678 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1679 ) -> Self::Borrowed<'a> {
1680 value
1681 }
1682 }
1683
1684 unsafe impl fidl::encoding::TypeMarker for DeviceSetupSetChannelRequest {
1685 type Owned = Self;
1686
1687 #[inline(always)]
1688 fn inline_align(_context: fidl::encoding::Context) -> usize {
1689 4
1690 }
1691
1692 #[inline(always)]
1693 fn inline_size(_context: fidl::encoding::Context) -> usize {
1694 4
1695 }
1696 }
1697
1698 unsafe impl
1699 fidl::encoding::Encode<
1700 DeviceSetupSetChannelRequest,
1701 fidl::encoding::DefaultFuchsiaResourceDialect,
1702 > for &mut DeviceSetupSetChannelRequest
1703 {
1704 #[inline]
1705 unsafe fn encode(
1706 self,
1707 encoder: &mut fidl::encoding::Encoder<
1708 '_,
1709 fidl::encoding::DefaultFuchsiaResourceDialect,
1710 >,
1711 offset: usize,
1712 _depth: fidl::encoding::Depth,
1713 ) -> fidl::Result<()> {
1714 encoder.debug_check_bounds::<DeviceSetupSetChannelRequest>(offset);
1715 fidl::encoding::Encode::<DeviceSetupSetChannelRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1717 (
1718 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.req),
1719 ),
1720 encoder, offset, _depth
1721 )
1722 }
1723 }
1724 unsafe impl<
1725 T0: fidl::encoding::Encode<
1726 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1727 fidl::encoding::DefaultFuchsiaResourceDialect,
1728 >,
1729 >
1730 fidl::encoding::Encode<
1731 DeviceSetupSetChannelRequest,
1732 fidl::encoding::DefaultFuchsiaResourceDialect,
1733 > for (T0,)
1734 {
1735 #[inline]
1736 unsafe fn encode(
1737 self,
1738 encoder: &mut fidl::encoding::Encoder<
1739 '_,
1740 fidl::encoding::DefaultFuchsiaResourceDialect,
1741 >,
1742 offset: usize,
1743 depth: fidl::encoding::Depth,
1744 ) -> fidl::Result<()> {
1745 encoder.debug_check_bounds::<DeviceSetupSetChannelRequest>(offset);
1746 self.0.encode(encoder, offset + 0, depth)?;
1750 Ok(())
1751 }
1752 }
1753
1754 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1755 for DeviceSetupSetChannelRequest
1756 {
1757 #[inline(always)]
1758 fn new_empty() -> Self {
1759 Self {
1760 req: fidl::new_empty!(
1761 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1762 fidl::encoding::DefaultFuchsiaResourceDialect
1763 ),
1764 }
1765 }
1766
1767 #[inline]
1768 unsafe fn decode(
1769 &mut self,
1770 decoder: &mut fidl::encoding::Decoder<
1771 '_,
1772 fidl::encoding::DefaultFuchsiaResourceDialect,
1773 >,
1774 offset: usize,
1775 _depth: fidl::encoding::Depth,
1776 ) -> fidl::Result<()> {
1777 decoder.debug_check_bounds::<Self>(offset);
1778 fidl::decode!(
1780 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1781 fidl::encoding::DefaultFuchsiaResourceDialect,
1782 &mut self.req,
1783 decoder,
1784 offset + 0,
1785 _depth
1786 )?;
1787 Ok(())
1788 }
1789 }
1790}