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::NullableHandle {
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 { Some((data)) } else { None }
531 }
532 #[allow(irrefutable_let_patterns)]
533 pub fn into_on_error(self) -> Option<(Error, bool)> {
534 if let DeviceEvent::OnError { error, did_close } = self {
535 Some((error, did_close))
536 } else {
537 None
538 }
539 }
540
541 fn decode(
543 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
544 ) -> Result<DeviceEvent, fidl::Error> {
545 let (bytes, _handles) = buf.split_mut();
546 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
547 debug_assert_eq!(tx_header.tx_id, 0);
548 match tx_header.ordinal {
549 0x2b1d5b28c5811b53 => {
550 let mut out = fidl::new_empty!(
551 DeviceOnReadyForSendFramesRequest,
552 fidl::encoding::DefaultFuchsiaResourceDialect
553 );
554 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceOnReadyForSendFramesRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
555 Ok((DeviceEvent::OnReadyForSendFrames { number_of_frames: out.number_of_frames }))
556 }
557 0x61937a45670aabb0 => {
558 let mut out = fidl::new_empty!(
559 DeviceOnReceiveFrameRequest,
560 fidl::encoding::DefaultFuchsiaResourceDialect
561 );
562 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceOnReceiveFrameRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
563 Ok((DeviceEvent::OnReceiveFrame { data: out.data }))
564 }
565 0x4d20e65a9d2625e1 => {
566 let mut out = fidl::new_empty!(
567 DeviceOnErrorRequest,
568 fidl::encoding::DefaultFuchsiaResourceDialect
569 );
570 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
571 Ok((DeviceEvent::OnError { error: out.error, did_close: out.did_close }))
572 }
573 _ => Err(fidl::Error::UnknownOrdinal {
574 ordinal: tx_header.ordinal,
575 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
576 }),
577 }
578 }
579}
580
581pub struct DeviceRequestStream {
583 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
584 is_terminated: bool,
585}
586
587impl std::marker::Unpin for DeviceRequestStream {}
588
589impl futures::stream::FusedStream for DeviceRequestStream {
590 fn is_terminated(&self) -> bool {
591 self.is_terminated
592 }
593}
594
595impl fidl::endpoints::RequestStream for DeviceRequestStream {
596 type Protocol = DeviceMarker;
597 type ControlHandle = DeviceControlHandle;
598
599 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
600 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
601 }
602
603 fn control_handle(&self) -> Self::ControlHandle {
604 DeviceControlHandle { inner: self.inner.clone() }
605 }
606
607 fn into_inner(
608 self,
609 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
610 {
611 (self.inner, self.is_terminated)
612 }
613
614 fn from_inner(
615 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
616 is_terminated: bool,
617 ) -> Self {
618 Self { inner, is_terminated }
619 }
620}
621
622impl futures::Stream for DeviceRequestStream {
623 type Item = Result<DeviceRequest, fidl::Error>;
624
625 fn poll_next(
626 mut self: std::pin::Pin<&mut Self>,
627 cx: &mut std::task::Context<'_>,
628 ) -> std::task::Poll<Option<Self::Item>> {
629 let this = &mut *self;
630 if this.inner.check_shutdown(cx) {
631 this.is_terminated = true;
632 return std::task::Poll::Ready(None);
633 }
634 if this.is_terminated {
635 panic!("polled DeviceRequestStream after completion");
636 }
637 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
638 |bytes, handles| {
639 match this.inner.channel().read_etc(cx, bytes, handles) {
640 std::task::Poll::Ready(Ok(())) => {}
641 std::task::Poll::Pending => return std::task::Poll::Pending,
642 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
643 this.is_terminated = true;
644 return std::task::Poll::Ready(None);
645 }
646 std::task::Poll::Ready(Err(e)) => {
647 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
648 e.into(),
649 ))));
650 }
651 }
652
653 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
655
656 std::task::Poll::Ready(Some(match header.ordinal {
657 0x508cecb73a776ef7 => {
658 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
659 let mut req = fidl::new_empty!(
660 fidl::encoding::EmptyPayload,
661 fidl::encoding::DefaultFuchsiaResourceDialect
662 );
663 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
664 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
665 Ok(DeviceRequest::Open {
666 responder: DeviceOpenResponder {
667 control_handle: std::mem::ManuallyDrop::new(control_handle),
668 tx_id: header.tx_id,
669 },
670 })
671 }
672 0x621a0f31b867781a => {
673 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
674 let mut req = fidl::new_empty!(
675 fidl::encoding::EmptyPayload,
676 fidl::encoding::DefaultFuchsiaResourceDialect
677 );
678 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
679 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
680 Ok(DeviceRequest::Close {
681 responder: DeviceCloseResponder {
682 control_handle: std::mem::ManuallyDrop::new(control_handle),
683 tx_id: header.tx_id,
684 },
685 })
686 }
687 0x1d2d652e8b06d463 => {
688 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
689 let mut req = fidl::new_empty!(
690 fidl::encoding::EmptyPayload,
691 fidl::encoding::DefaultFuchsiaResourceDialect
692 );
693 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
694 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
695 Ok(DeviceRequest::GetMaxFrameSize {
696 responder: DeviceGetMaxFrameSizeResponder {
697 control_handle: std::mem::ManuallyDrop::new(control_handle),
698 tx_id: header.tx_id,
699 },
700 })
701 }
702 0x634f2957b35c5944 => {
703 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
704 let mut req = fidl::new_empty!(
705 DeviceSendFrameRequest,
706 fidl::encoding::DefaultFuchsiaResourceDialect
707 );
708 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSendFrameRequest>(&header, _body_bytes, handles, &mut req)?;
709 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
710 Ok(DeviceRequest::SendFrame { data: req.data, control_handle })
711 }
712 0x3147df23fdd53b87 => {
713 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
714 let mut req = fidl::new_empty!(
715 DeviceReadyToReceiveFramesRequest,
716 fidl::encoding::DefaultFuchsiaResourceDialect
717 );
718 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadyToReceiveFramesRequest>(&header, _body_bytes, handles, &mut req)?;
719 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
720 Ok(DeviceRequest::ReadyToReceiveFrames {
721 number_of_frames: req.number_of_frames,
722
723 control_handle,
724 })
725 }
726 _ => Err(fidl::Error::UnknownOrdinal {
727 ordinal: header.ordinal,
728 protocol_name:
729 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
730 }),
731 }))
732 },
733 )
734 }
735}
736
737#[derive(Debug)]
738pub enum DeviceRequest {
739 Open { responder: DeviceOpenResponder },
756 Close { responder: DeviceCloseResponder },
776 GetMaxFrameSize { responder: DeviceGetMaxFrameSizeResponder },
784 SendFrame { data: Vec<u8>, control_handle: DeviceControlHandle },
791 ReadyToReceiveFrames { number_of_frames: u32, control_handle: DeviceControlHandle },
818}
819
820impl DeviceRequest {
821 #[allow(irrefutable_let_patterns)]
822 pub fn into_open(self) -> Option<(DeviceOpenResponder)> {
823 if let DeviceRequest::Open { responder } = self { Some((responder)) } else { None }
824 }
825
826 #[allow(irrefutable_let_patterns)]
827 pub fn into_close(self) -> Option<(DeviceCloseResponder)> {
828 if let DeviceRequest::Close { responder } = self { Some((responder)) } else { None }
829 }
830
831 #[allow(irrefutable_let_patterns)]
832 pub fn into_get_max_frame_size(self) -> Option<(DeviceGetMaxFrameSizeResponder)> {
833 if let DeviceRequest::GetMaxFrameSize { responder } = self {
834 Some((responder))
835 } else {
836 None
837 }
838 }
839
840 #[allow(irrefutable_let_patterns)]
841 pub fn into_send_frame(self) -> Option<(Vec<u8>, DeviceControlHandle)> {
842 if let DeviceRequest::SendFrame { data, control_handle } = self {
843 Some((data, control_handle))
844 } else {
845 None
846 }
847 }
848
849 #[allow(irrefutable_let_patterns)]
850 pub fn into_ready_to_receive_frames(self) -> Option<(u32, DeviceControlHandle)> {
851 if let DeviceRequest::ReadyToReceiveFrames { number_of_frames, control_handle } = self {
852 Some((number_of_frames, control_handle))
853 } else {
854 None
855 }
856 }
857
858 pub fn method_name(&self) -> &'static str {
860 match *self {
861 DeviceRequest::Open { .. } => "open",
862 DeviceRequest::Close { .. } => "close",
863 DeviceRequest::GetMaxFrameSize { .. } => "get_max_frame_size",
864 DeviceRequest::SendFrame { .. } => "send_frame",
865 DeviceRequest::ReadyToReceiveFrames { .. } => "ready_to_receive_frames",
866 }
867 }
868}
869
870#[derive(Debug, Clone)]
871pub struct DeviceControlHandle {
872 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
873}
874
875impl fidl::endpoints::ControlHandle for DeviceControlHandle {
876 fn shutdown(&self) {
877 self.inner.shutdown()
878 }
879
880 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
881 self.inner.shutdown_with_epitaph(status)
882 }
883
884 fn is_closed(&self) -> bool {
885 self.inner.channel().is_closed()
886 }
887 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
888 self.inner.channel().on_closed()
889 }
890
891 #[cfg(target_os = "fuchsia")]
892 fn signal_peer(
893 &self,
894 clear_mask: zx::Signals,
895 set_mask: zx::Signals,
896 ) -> Result<(), zx_status::Status> {
897 use fidl::Peered;
898 self.inner.channel().signal_peer(clear_mask, set_mask)
899 }
900}
901
902impl DeviceControlHandle {
903 pub fn send_on_ready_for_send_frames(
904 &self,
905 mut number_of_frames: u32,
906 ) -> Result<(), fidl::Error> {
907 self.inner.send::<DeviceOnReadyForSendFramesRequest>(
908 (number_of_frames,),
909 0,
910 0x2b1d5b28c5811b53,
911 fidl::encoding::DynamicFlags::empty(),
912 )
913 }
914
915 pub fn send_on_receive_frame(&self, mut data: &[u8]) -> Result<(), fidl::Error> {
916 self.inner.send::<DeviceOnReceiveFrameRequest>(
917 (data,),
918 0,
919 0x61937a45670aabb0,
920 fidl::encoding::DynamicFlags::empty(),
921 )
922 }
923
924 pub fn send_on_error(&self, mut error: Error, mut did_close: bool) -> Result<(), fidl::Error> {
925 self.inner.send::<DeviceOnErrorRequest>(
926 (error, did_close),
927 0,
928 0x4d20e65a9d2625e1,
929 fidl::encoding::DynamicFlags::empty(),
930 )
931 }
932}
933
934#[must_use = "FIDL methods require a response to be sent"]
935#[derive(Debug)]
936pub struct DeviceOpenResponder {
937 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
938 tx_id: u32,
939}
940
941impl std::ops::Drop for DeviceOpenResponder {
945 fn drop(&mut self) {
946 self.control_handle.shutdown();
947 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
949 }
950}
951
952impl fidl::endpoints::Responder for DeviceOpenResponder {
953 type ControlHandle = DeviceControlHandle;
954
955 fn control_handle(&self) -> &DeviceControlHandle {
956 &self.control_handle
957 }
958
959 fn drop_without_shutdown(mut self) {
960 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
962 std::mem::forget(self);
964 }
965}
966
967impl DeviceOpenResponder {
968 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
972 let _result = self.send_raw(result);
973 if _result.is_err() {
974 self.control_handle.shutdown();
975 }
976 self.drop_without_shutdown();
977 _result
978 }
979
980 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
982 let _result = self.send_raw(result);
983 self.drop_without_shutdown();
984 _result
985 }
986
987 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
988 self.control_handle
989 .inner
990 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
991 result,
992 self.tx_id,
993 0x508cecb73a776ef7,
994 fidl::encoding::DynamicFlags::empty(),
995 )
996 }
997}
998
999#[must_use = "FIDL methods require a response to be sent"]
1000#[derive(Debug)]
1001pub struct DeviceCloseResponder {
1002 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1003 tx_id: u32,
1004}
1005
1006impl std::ops::Drop for DeviceCloseResponder {
1010 fn drop(&mut self) {
1011 self.control_handle.shutdown();
1012 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1014 }
1015}
1016
1017impl fidl::endpoints::Responder for DeviceCloseResponder {
1018 type ControlHandle = DeviceControlHandle;
1019
1020 fn control_handle(&self) -> &DeviceControlHandle {
1021 &self.control_handle
1022 }
1023
1024 fn drop_without_shutdown(mut self) {
1025 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1027 std::mem::forget(self);
1029 }
1030}
1031
1032impl DeviceCloseResponder {
1033 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1037 let _result = self.send_raw(result);
1038 if _result.is_err() {
1039 self.control_handle.shutdown();
1040 }
1041 self.drop_without_shutdown();
1042 _result
1043 }
1044
1045 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1047 let _result = self.send_raw(result);
1048 self.drop_without_shutdown();
1049 _result
1050 }
1051
1052 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1053 self.control_handle
1054 .inner
1055 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1056 result,
1057 self.tx_id,
1058 0x621a0f31b867781a,
1059 fidl::encoding::DynamicFlags::empty(),
1060 )
1061 }
1062}
1063
1064#[must_use = "FIDL methods require a response to be sent"]
1065#[derive(Debug)]
1066pub struct DeviceGetMaxFrameSizeResponder {
1067 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1068 tx_id: u32,
1069}
1070
1071impl std::ops::Drop for DeviceGetMaxFrameSizeResponder {
1075 fn drop(&mut self) {
1076 self.control_handle.shutdown();
1077 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1079 }
1080}
1081
1082impl fidl::endpoints::Responder for DeviceGetMaxFrameSizeResponder {
1083 type ControlHandle = DeviceControlHandle;
1084
1085 fn control_handle(&self) -> &DeviceControlHandle {
1086 &self.control_handle
1087 }
1088
1089 fn drop_without_shutdown(mut self) {
1090 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1092 std::mem::forget(self);
1094 }
1095}
1096
1097impl DeviceGetMaxFrameSizeResponder {
1098 pub fn send(self, mut size: u32) -> Result<(), fidl::Error> {
1102 let _result = self.send_raw(size);
1103 if _result.is_err() {
1104 self.control_handle.shutdown();
1105 }
1106 self.drop_without_shutdown();
1107 _result
1108 }
1109
1110 pub fn send_no_shutdown_on_err(self, mut size: u32) -> Result<(), fidl::Error> {
1112 let _result = self.send_raw(size);
1113 self.drop_without_shutdown();
1114 _result
1115 }
1116
1117 fn send_raw(&self, mut size: u32) -> Result<(), fidl::Error> {
1118 self.control_handle.inner.send::<DeviceGetMaxFrameSizeResponse>(
1119 (size,),
1120 self.tx_id,
1121 0x1d2d652e8b06d463,
1122 fidl::encoding::DynamicFlags::empty(),
1123 )
1124 }
1125}
1126
1127#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1128pub struct DeviceSetupMarker;
1129
1130impl fidl::endpoints::ProtocolMarker for DeviceSetupMarker {
1131 type Proxy = DeviceSetupProxy;
1132 type RequestStream = DeviceSetupRequestStream;
1133 #[cfg(target_os = "fuchsia")]
1134 type SynchronousProxy = DeviceSetupSynchronousProxy;
1135
1136 const DEBUG_NAME: &'static str = "(anonymous) DeviceSetup";
1137}
1138pub type DeviceSetupSetChannelResult = Result<(), i32>;
1139
1140pub trait DeviceSetupProxyInterface: Send + Sync {
1141 type SetChannelResponseFut: std::future::Future<Output = Result<DeviceSetupSetChannelResult, fidl::Error>>
1142 + Send;
1143 fn r#set_channel(
1144 &self,
1145 req: fidl::endpoints::ServerEnd<DeviceMarker>,
1146 ) -> Self::SetChannelResponseFut;
1147}
1148#[derive(Debug)]
1149#[cfg(target_os = "fuchsia")]
1150pub struct DeviceSetupSynchronousProxy {
1151 client: fidl::client::sync::Client,
1152}
1153
1154#[cfg(target_os = "fuchsia")]
1155impl fidl::endpoints::SynchronousProxy for DeviceSetupSynchronousProxy {
1156 type Proxy = DeviceSetupProxy;
1157 type Protocol = DeviceSetupMarker;
1158
1159 fn from_channel(inner: fidl::Channel) -> Self {
1160 Self::new(inner)
1161 }
1162
1163 fn into_channel(self) -> fidl::Channel {
1164 self.client.into_channel()
1165 }
1166
1167 fn as_channel(&self) -> &fidl::Channel {
1168 self.client.as_channel()
1169 }
1170}
1171
1172#[cfg(target_os = "fuchsia")]
1173impl DeviceSetupSynchronousProxy {
1174 pub fn new(channel: fidl::Channel) -> Self {
1175 let protocol_name = <DeviceSetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1176 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1177 }
1178
1179 pub fn into_channel(self) -> fidl::Channel {
1180 self.client.into_channel()
1181 }
1182
1183 pub fn wait_for_event(
1186 &self,
1187 deadline: zx::MonotonicInstant,
1188 ) -> Result<DeviceSetupEvent, fidl::Error> {
1189 DeviceSetupEvent::decode(self.client.wait_for_event(deadline)?)
1190 }
1191
1192 pub fn r#set_channel(
1193 &self,
1194 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
1195 ___deadline: zx::MonotonicInstant,
1196 ) -> Result<DeviceSetupSetChannelResult, fidl::Error> {
1197 let _response = self.client.send_query::<
1198 DeviceSetupSetChannelRequest,
1199 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1200 >(
1201 (req,),
1202 0x7f8e02c174ef02a5,
1203 fidl::encoding::DynamicFlags::empty(),
1204 ___deadline,
1205 )?;
1206 Ok(_response.map(|x| x))
1207 }
1208}
1209
1210#[cfg(target_os = "fuchsia")]
1211impl From<DeviceSetupSynchronousProxy> for zx::NullableHandle {
1212 fn from(value: DeviceSetupSynchronousProxy) -> Self {
1213 value.into_channel().into()
1214 }
1215}
1216
1217#[cfg(target_os = "fuchsia")]
1218impl From<fidl::Channel> for DeviceSetupSynchronousProxy {
1219 fn from(value: fidl::Channel) -> Self {
1220 Self::new(value)
1221 }
1222}
1223
1224#[cfg(target_os = "fuchsia")]
1225impl fidl::endpoints::FromClient for DeviceSetupSynchronousProxy {
1226 type Protocol = DeviceSetupMarker;
1227
1228 fn from_client(value: fidl::endpoints::ClientEnd<DeviceSetupMarker>) -> Self {
1229 Self::new(value.into_channel())
1230 }
1231}
1232
1233#[derive(Debug, Clone)]
1234pub struct DeviceSetupProxy {
1235 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1236}
1237
1238impl fidl::endpoints::Proxy for DeviceSetupProxy {
1239 type Protocol = DeviceSetupMarker;
1240
1241 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1242 Self::new(inner)
1243 }
1244
1245 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1246 self.client.into_channel().map_err(|client| Self { client })
1247 }
1248
1249 fn as_channel(&self) -> &::fidl::AsyncChannel {
1250 self.client.as_channel()
1251 }
1252}
1253
1254impl DeviceSetupProxy {
1255 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1257 let protocol_name = <DeviceSetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1258 Self { client: fidl::client::Client::new(channel, protocol_name) }
1259 }
1260
1261 pub fn take_event_stream(&self) -> DeviceSetupEventStream {
1267 DeviceSetupEventStream { event_receiver: self.client.take_event_receiver() }
1268 }
1269
1270 pub fn r#set_channel(
1271 &self,
1272 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
1273 ) -> fidl::client::QueryResponseFut<
1274 DeviceSetupSetChannelResult,
1275 fidl::encoding::DefaultFuchsiaResourceDialect,
1276 > {
1277 DeviceSetupProxyInterface::r#set_channel(self, req)
1278 }
1279}
1280
1281impl DeviceSetupProxyInterface for DeviceSetupProxy {
1282 type SetChannelResponseFut = fidl::client::QueryResponseFut<
1283 DeviceSetupSetChannelResult,
1284 fidl::encoding::DefaultFuchsiaResourceDialect,
1285 >;
1286 fn r#set_channel(
1287 &self,
1288 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
1289 ) -> Self::SetChannelResponseFut {
1290 fn _decode(
1291 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1292 ) -> Result<DeviceSetupSetChannelResult, fidl::Error> {
1293 let _response = fidl::client::decode_transaction_body::<
1294 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1295 fidl::encoding::DefaultFuchsiaResourceDialect,
1296 0x7f8e02c174ef02a5,
1297 >(_buf?)?;
1298 Ok(_response.map(|x| x))
1299 }
1300 self.client
1301 .send_query_and_decode::<DeviceSetupSetChannelRequest, DeviceSetupSetChannelResult>(
1302 (req,),
1303 0x7f8e02c174ef02a5,
1304 fidl::encoding::DynamicFlags::empty(),
1305 _decode,
1306 )
1307 }
1308}
1309
1310pub struct DeviceSetupEventStream {
1311 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1312}
1313
1314impl std::marker::Unpin for DeviceSetupEventStream {}
1315
1316impl futures::stream::FusedStream for DeviceSetupEventStream {
1317 fn is_terminated(&self) -> bool {
1318 self.event_receiver.is_terminated()
1319 }
1320}
1321
1322impl futures::Stream for DeviceSetupEventStream {
1323 type Item = Result<DeviceSetupEvent, fidl::Error>;
1324
1325 fn poll_next(
1326 mut self: std::pin::Pin<&mut Self>,
1327 cx: &mut std::task::Context<'_>,
1328 ) -> std::task::Poll<Option<Self::Item>> {
1329 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1330 &mut self.event_receiver,
1331 cx
1332 )?) {
1333 Some(buf) => std::task::Poll::Ready(Some(DeviceSetupEvent::decode(buf))),
1334 None => std::task::Poll::Ready(None),
1335 }
1336 }
1337}
1338
1339#[derive(Debug)]
1340pub enum DeviceSetupEvent {}
1341
1342impl DeviceSetupEvent {
1343 fn decode(
1345 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1346 ) -> Result<DeviceSetupEvent, fidl::Error> {
1347 let (bytes, _handles) = buf.split_mut();
1348 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1349 debug_assert_eq!(tx_header.tx_id, 0);
1350 match tx_header.ordinal {
1351 _ => Err(fidl::Error::UnknownOrdinal {
1352 ordinal: tx_header.ordinal,
1353 protocol_name: <DeviceSetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1354 }),
1355 }
1356 }
1357}
1358
1359pub struct DeviceSetupRequestStream {
1361 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1362 is_terminated: bool,
1363}
1364
1365impl std::marker::Unpin for DeviceSetupRequestStream {}
1366
1367impl futures::stream::FusedStream for DeviceSetupRequestStream {
1368 fn is_terminated(&self) -> bool {
1369 self.is_terminated
1370 }
1371}
1372
1373impl fidl::endpoints::RequestStream for DeviceSetupRequestStream {
1374 type Protocol = DeviceSetupMarker;
1375 type ControlHandle = DeviceSetupControlHandle;
1376
1377 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1378 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1379 }
1380
1381 fn control_handle(&self) -> Self::ControlHandle {
1382 DeviceSetupControlHandle { inner: self.inner.clone() }
1383 }
1384
1385 fn into_inner(
1386 self,
1387 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1388 {
1389 (self.inner, self.is_terminated)
1390 }
1391
1392 fn from_inner(
1393 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1394 is_terminated: bool,
1395 ) -> Self {
1396 Self { inner, is_terminated }
1397 }
1398}
1399
1400impl futures::Stream for DeviceSetupRequestStream {
1401 type Item = Result<DeviceSetupRequest, fidl::Error>;
1402
1403 fn poll_next(
1404 mut self: std::pin::Pin<&mut Self>,
1405 cx: &mut std::task::Context<'_>,
1406 ) -> std::task::Poll<Option<Self::Item>> {
1407 let this = &mut *self;
1408 if this.inner.check_shutdown(cx) {
1409 this.is_terminated = true;
1410 return std::task::Poll::Ready(None);
1411 }
1412 if this.is_terminated {
1413 panic!("polled DeviceSetupRequestStream after completion");
1414 }
1415 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1416 |bytes, handles| {
1417 match this.inner.channel().read_etc(cx, bytes, handles) {
1418 std::task::Poll::Ready(Ok(())) => {}
1419 std::task::Poll::Pending => return std::task::Poll::Pending,
1420 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1421 this.is_terminated = true;
1422 return std::task::Poll::Ready(None);
1423 }
1424 std::task::Poll::Ready(Err(e)) => {
1425 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1426 e.into(),
1427 ))));
1428 }
1429 }
1430
1431 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1433
1434 std::task::Poll::Ready(Some(match header.ordinal {
1435 0x7f8e02c174ef02a5 => {
1436 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1437 let mut req = fidl::new_empty!(
1438 DeviceSetupSetChannelRequest,
1439 fidl::encoding::DefaultFuchsiaResourceDialect
1440 );
1441 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetupSetChannelRequest>(&header, _body_bytes, handles, &mut req)?;
1442 let control_handle = DeviceSetupControlHandle { inner: this.inner.clone() };
1443 Ok(DeviceSetupRequest::SetChannel {
1444 req: req.req,
1445
1446 responder: DeviceSetupSetChannelResponder {
1447 control_handle: std::mem::ManuallyDrop::new(control_handle),
1448 tx_id: header.tx_id,
1449 },
1450 })
1451 }
1452 _ => Err(fidl::Error::UnknownOrdinal {
1453 ordinal: header.ordinal,
1454 protocol_name:
1455 <DeviceSetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1456 }),
1457 }))
1458 },
1459 )
1460 }
1461}
1462
1463#[derive(Debug)]
1464pub enum DeviceSetupRequest {
1465 SetChannel {
1466 req: fidl::endpoints::ServerEnd<DeviceMarker>,
1467 responder: DeviceSetupSetChannelResponder,
1468 },
1469}
1470
1471impl DeviceSetupRequest {
1472 #[allow(irrefutable_let_patterns)]
1473 pub fn into_set_channel(
1474 self,
1475 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, DeviceSetupSetChannelResponder)> {
1476 if let DeviceSetupRequest::SetChannel { req, responder } = self {
1477 Some((req, responder))
1478 } else {
1479 None
1480 }
1481 }
1482
1483 pub fn method_name(&self) -> &'static str {
1485 match *self {
1486 DeviceSetupRequest::SetChannel { .. } => "set_channel",
1487 }
1488 }
1489}
1490
1491#[derive(Debug, Clone)]
1492pub struct DeviceSetupControlHandle {
1493 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1494}
1495
1496impl fidl::endpoints::ControlHandle for DeviceSetupControlHandle {
1497 fn shutdown(&self) {
1498 self.inner.shutdown()
1499 }
1500
1501 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1502 self.inner.shutdown_with_epitaph(status)
1503 }
1504
1505 fn is_closed(&self) -> bool {
1506 self.inner.channel().is_closed()
1507 }
1508 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1509 self.inner.channel().on_closed()
1510 }
1511
1512 #[cfg(target_os = "fuchsia")]
1513 fn signal_peer(
1514 &self,
1515 clear_mask: zx::Signals,
1516 set_mask: zx::Signals,
1517 ) -> Result<(), zx_status::Status> {
1518 use fidl::Peered;
1519 self.inner.channel().signal_peer(clear_mask, set_mask)
1520 }
1521}
1522
1523impl DeviceSetupControlHandle {}
1524
1525#[must_use = "FIDL methods require a response to be sent"]
1526#[derive(Debug)]
1527pub struct DeviceSetupSetChannelResponder {
1528 control_handle: std::mem::ManuallyDrop<DeviceSetupControlHandle>,
1529 tx_id: u32,
1530}
1531
1532impl std::ops::Drop for DeviceSetupSetChannelResponder {
1536 fn drop(&mut self) {
1537 self.control_handle.shutdown();
1538 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1540 }
1541}
1542
1543impl fidl::endpoints::Responder for DeviceSetupSetChannelResponder {
1544 type ControlHandle = DeviceSetupControlHandle;
1545
1546 fn control_handle(&self) -> &DeviceSetupControlHandle {
1547 &self.control_handle
1548 }
1549
1550 fn drop_without_shutdown(mut self) {
1551 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1553 std::mem::forget(self);
1555 }
1556}
1557
1558impl DeviceSetupSetChannelResponder {
1559 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1563 let _result = self.send_raw(result);
1564 if _result.is_err() {
1565 self.control_handle.shutdown();
1566 }
1567 self.drop_without_shutdown();
1568 _result
1569 }
1570
1571 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1573 let _result = self.send_raw(result);
1574 self.drop_without_shutdown();
1575 _result
1576 }
1577
1578 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1579 self.control_handle
1580 .inner
1581 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1582 result,
1583 self.tx_id,
1584 0x7f8e02c174ef02a5,
1585 fidl::encoding::DynamicFlags::empty(),
1586 )
1587 }
1588}
1589
1590#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1591pub struct ServiceMarker;
1592
1593#[cfg(target_os = "fuchsia")]
1594impl fidl::endpoints::ServiceMarker for ServiceMarker {
1595 type Proxy = ServiceProxy;
1596 type Request = ServiceRequest;
1597 const SERVICE_NAME: &'static str = "fuchsia.lowpan.spinel.Service";
1598}
1599
1600#[cfg(target_os = "fuchsia")]
1603pub enum ServiceRequest {
1604 DeviceSetup(DeviceSetupRequestStream),
1605}
1606
1607#[cfg(target_os = "fuchsia")]
1608impl fidl::endpoints::ServiceRequest for ServiceRequest {
1609 type Service = ServiceMarker;
1610
1611 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1612 match name {
1613 "device_setup" => Self::DeviceSetup(
1614 <DeviceSetupRequestStream as fidl::endpoints::RequestStream>::from_channel(
1615 _channel,
1616 ),
1617 ),
1618 _ => panic!("no such member protocol name for service Service"),
1619 }
1620 }
1621
1622 fn member_names() -> &'static [&'static str] {
1623 &["device_setup"]
1624 }
1625}
1626#[cfg(target_os = "fuchsia")]
1627pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1628
1629#[cfg(target_os = "fuchsia")]
1630impl fidl::endpoints::ServiceProxy for ServiceProxy {
1631 type Service = ServiceMarker;
1632
1633 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1634 Self(opener)
1635 }
1636}
1637
1638#[cfg(target_os = "fuchsia")]
1639impl ServiceProxy {
1640 pub fn connect_to_device_setup(&self) -> Result<DeviceSetupProxy, fidl::Error> {
1641 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceSetupMarker>();
1642 self.connect_channel_to_device_setup(server_end)?;
1643 Ok(proxy)
1644 }
1645
1646 pub fn connect_to_device_setup_sync(&self) -> Result<DeviceSetupSynchronousProxy, fidl::Error> {
1649 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceSetupMarker>();
1650 self.connect_channel_to_device_setup(server_end)?;
1651 Ok(proxy)
1652 }
1653
1654 pub fn connect_channel_to_device_setup(
1657 &self,
1658 server_end: fidl::endpoints::ServerEnd<DeviceSetupMarker>,
1659 ) -> Result<(), fidl::Error> {
1660 self.0.open_member("device_setup", server_end.into_channel())
1661 }
1662
1663 pub fn instance_name(&self) -> &str {
1664 self.0.instance_name()
1665 }
1666}
1667
1668mod internal {
1669 use super::*;
1670
1671 impl fidl::encoding::ResourceTypeMarker for DeviceSetupSetChannelRequest {
1672 type Borrowed<'a> = &'a mut Self;
1673 fn take_or_borrow<'a>(
1674 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1675 ) -> Self::Borrowed<'a> {
1676 value
1677 }
1678 }
1679
1680 unsafe impl fidl::encoding::TypeMarker for DeviceSetupSetChannelRequest {
1681 type Owned = Self;
1682
1683 #[inline(always)]
1684 fn inline_align(_context: fidl::encoding::Context) -> usize {
1685 4
1686 }
1687
1688 #[inline(always)]
1689 fn inline_size(_context: fidl::encoding::Context) -> usize {
1690 4
1691 }
1692 }
1693
1694 unsafe impl
1695 fidl::encoding::Encode<
1696 DeviceSetupSetChannelRequest,
1697 fidl::encoding::DefaultFuchsiaResourceDialect,
1698 > for &mut DeviceSetupSetChannelRequest
1699 {
1700 #[inline]
1701 unsafe fn encode(
1702 self,
1703 encoder: &mut fidl::encoding::Encoder<
1704 '_,
1705 fidl::encoding::DefaultFuchsiaResourceDialect,
1706 >,
1707 offset: usize,
1708 _depth: fidl::encoding::Depth,
1709 ) -> fidl::Result<()> {
1710 encoder.debug_check_bounds::<DeviceSetupSetChannelRequest>(offset);
1711 fidl::encoding::Encode::<DeviceSetupSetChannelRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1713 (
1714 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.req),
1715 ),
1716 encoder, offset, _depth
1717 )
1718 }
1719 }
1720 unsafe impl<
1721 T0: fidl::encoding::Encode<
1722 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1723 fidl::encoding::DefaultFuchsiaResourceDialect,
1724 >,
1725 >
1726 fidl::encoding::Encode<
1727 DeviceSetupSetChannelRequest,
1728 fidl::encoding::DefaultFuchsiaResourceDialect,
1729 > for (T0,)
1730 {
1731 #[inline]
1732 unsafe fn encode(
1733 self,
1734 encoder: &mut fidl::encoding::Encoder<
1735 '_,
1736 fidl::encoding::DefaultFuchsiaResourceDialect,
1737 >,
1738 offset: usize,
1739 depth: fidl::encoding::Depth,
1740 ) -> fidl::Result<()> {
1741 encoder.debug_check_bounds::<DeviceSetupSetChannelRequest>(offset);
1742 self.0.encode(encoder, offset + 0, depth)?;
1746 Ok(())
1747 }
1748 }
1749
1750 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1751 for DeviceSetupSetChannelRequest
1752 {
1753 #[inline(always)]
1754 fn new_empty() -> Self {
1755 Self {
1756 req: fidl::new_empty!(
1757 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1758 fidl::encoding::DefaultFuchsiaResourceDialect
1759 ),
1760 }
1761 }
1762
1763 #[inline]
1764 unsafe fn decode(
1765 &mut self,
1766 decoder: &mut fidl::encoding::Decoder<
1767 '_,
1768 fidl::encoding::DefaultFuchsiaResourceDialect,
1769 >,
1770 offset: usize,
1771 _depth: fidl::encoding::Depth,
1772 ) -> fidl::Result<()> {
1773 decoder.debug_check_bounds::<Self>(offset);
1774 fidl::decode!(
1776 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1777 fidl::encoding::DefaultFuchsiaResourceDialect,
1778 &mut self.req,
1779 decoder,
1780 offset + 0,
1781 _depth
1782 )?;
1783 Ok(())
1784 }
1785 }
1786}