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_hardware_network__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DeviceCloneRequest {
16 pub device: fidl::endpoints::ServerEnd<DeviceMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceCloneRequest {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct DeviceGetPortRequest {
23 pub id: PortId,
24 pub port: fidl::endpoints::ServerEnd<PortMarker>,
25}
26
27impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceGetPortRequest {}
28
29#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
30pub struct DeviceGetPortWatcherRequest {
31 pub watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
32}
33
34impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
35 for DeviceGetPortWatcherRequest
36{
37}
38
39#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct DeviceInstanceGetDeviceRequest {
41 pub device: fidl::endpoints::ServerEnd<DeviceMarker>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45 for DeviceInstanceGetDeviceRequest
46{
47}
48
49#[derive(Debug, PartialEq)]
50pub struct DeviceOpenSessionRequest {
51 pub session_name: String,
52 pub session_info: SessionInfo,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceOpenSessionRequest {}
56
57#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
58pub struct DeviceOpenSessionResponse {
59 pub session: fidl::endpoints::ClientEnd<SessionMarker>,
60 pub fifos: Fifos,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceOpenSessionResponse {}
64
65#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
67pub struct Fifos {
68 pub rx: fidl::Fifo,
73 pub tx: fidl::Fifo,
78}
79
80impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Fifos {}
81
82#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
83pub struct PortCloneRequest {
84 pub port: fidl::endpoints::ServerEnd<PortMarker>,
85}
86
87impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PortCloneRequest {}
88
89#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
90pub struct PortGetDeviceRequest {
91 pub device: fidl::endpoints::ServerEnd<DeviceMarker>,
92}
93
94impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PortGetDeviceRequest {}
95
96#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
97pub struct PortGetDiagnosticsRequest {
98 pub diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
99}
100
101impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PortGetDiagnosticsRequest {}
102
103#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
104pub struct PortGetMacRequest {
105 pub mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
106}
107
108impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PortGetMacRequest {}
109
110#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
111pub struct PortGetStatusWatcherRequest {
112 pub watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
113 pub buffer: u32,
114}
115
116impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
117 for PortGetStatusWatcherRequest
118{
119}
120
121#[derive(Debug, PartialEq)]
122pub struct SessionWatchDelegatedRxLeaseResponse {
123 pub lease: DelegatedRxLease,
124}
125
126impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
127 for SessionWatchDelegatedRxLeaseResponse
128{
129}
130
131#[derive(Debug, Default, PartialEq)]
133pub struct DelegatedRxLease {
134 pub hold_until_frame: Option<u64>,
150 pub handle: Option<DelegatedRxLeaseHandle>,
154 #[doc(hidden)]
155 pub __source_breaking: fidl::marker::SourceBreaking,
156}
157
158impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DelegatedRxLease {}
159
160#[derive(Debug, Default, PartialEq)]
162pub struct SessionInfo {
163 pub descriptors: Option<fidl::Vmo>,
168 pub data: Option<fidl::Vmo>,
173 pub descriptor_version: Option<u8>,
178 pub descriptor_length: Option<u8>,
184 pub descriptor_count: Option<u16>,
189 pub options: Option<SessionFlags>,
191 #[doc(hidden)]
192 pub __source_breaking: fidl::marker::SourceBreaking,
193}
194
195impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionInfo {}
196
197#[derive(Debug)]
198pub enum DelegatedRxLeaseHandle {
199 Channel(fidl::Channel),
203 #[doc(hidden)]
204 __SourceBreaking { unknown_ordinal: u64 },
205}
206
207#[macro_export]
209macro_rules! DelegatedRxLeaseHandleUnknown {
210 () => {
211 _
212 };
213}
214
215impl PartialEq for DelegatedRxLeaseHandle {
217 fn eq(&self, other: &Self) -> bool {
218 match (self, other) {
219 (Self::Channel(x), Self::Channel(y)) => *x == *y,
220 _ => false,
221 }
222 }
223}
224
225impl DelegatedRxLeaseHandle {
226 #[inline]
227 pub fn ordinal(&self) -> u64 {
228 match *self {
229 Self::Channel(_) => 1,
230 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
231 }
232 }
233
234 #[inline]
235 pub fn unknown_variant_for_testing() -> Self {
236 Self::__SourceBreaking { unknown_ordinal: 0 }
237 }
238
239 #[inline]
240 pub fn is_unknown(&self) -> bool {
241 match self {
242 Self::__SourceBreaking { .. } => true,
243 _ => false,
244 }
245 }
246}
247
248impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DelegatedRxLeaseHandle {}
249
250#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
251pub struct DeviceMarker;
252
253impl fidl::endpoints::ProtocolMarker for DeviceMarker {
254 type Proxy = DeviceProxy;
255 type RequestStream = DeviceRequestStream;
256 #[cfg(target_os = "fuchsia")]
257 type SynchronousProxy = DeviceSynchronousProxy;
258
259 const DEBUG_NAME: &'static str = "(anonymous) Device";
260}
261pub type DeviceOpenSessionResult = Result<(fidl::endpoints::ClientEnd<SessionMarker>, Fifos), i32>;
262
263pub trait DeviceProxyInterface: Send + Sync {
264 type GetInfoResponseFut: std::future::Future<Output = Result<DeviceInfo, fidl::Error>> + Send;
265 fn r#get_info(&self) -> Self::GetInfoResponseFut;
266 type OpenSessionResponseFut: std::future::Future<Output = Result<DeviceOpenSessionResult, fidl::Error>>
267 + Send;
268 fn r#open_session(
269 &self,
270 session_name: &str,
271 session_info: SessionInfo,
272 ) -> Self::OpenSessionResponseFut;
273 fn r#get_port(
274 &self,
275 id: &PortId,
276 port: fidl::endpoints::ServerEnd<PortMarker>,
277 ) -> Result<(), fidl::Error>;
278 fn r#get_port_watcher(
279 &self,
280 watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
281 ) -> Result<(), fidl::Error>;
282 fn r#clone(&self, device: fidl::endpoints::ServerEnd<DeviceMarker>) -> Result<(), fidl::Error>;
283}
284#[derive(Debug)]
285#[cfg(target_os = "fuchsia")]
286pub struct DeviceSynchronousProxy {
287 client: fidl::client::sync::Client,
288}
289
290#[cfg(target_os = "fuchsia")]
291impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
292 type Proxy = DeviceProxy;
293 type Protocol = DeviceMarker;
294
295 fn from_channel(inner: fidl::Channel) -> Self {
296 Self::new(inner)
297 }
298
299 fn into_channel(self) -> fidl::Channel {
300 self.client.into_channel()
301 }
302
303 fn as_channel(&self) -> &fidl::Channel {
304 self.client.as_channel()
305 }
306}
307
308#[cfg(target_os = "fuchsia")]
309impl DeviceSynchronousProxy {
310 pub fn new(channel: fidl::Channel) -> Self {
311 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
312 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
313 }
314
315 pub fn into_channel(self) -> fidl::Channel {
316 self.client.into_channel()
317 }
318
319 pub fn wait_for_event(
322 &self,
323 deadline: zx::MonotonicInstant,
324 ) -> Result<DeviceEvent, fidl::Error> {
325 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
326 }
327
328 pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<DeviceInfo, fidl::Error> {
332 let _response =
333 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetInfoResponse>(
334 (),
335 0x3c500ca9341e8f56,
336 fidl::encoding::DynamicFlags::empty(),
337 ___deadline,
338 )?;
339 Ok(_response.info)
340 }
341
342 pub fn r#open_session(
357 &self,
358 mut session_name: &str,
359 mut session_info: SessionInfo,
360 ___deadline: zx::MonotonicInstant,
361 ) -> Result<DeviceOpenSessionResult, fidl::Error> {
362 let _response = self.client.send_query::<
363 DeviceOpenSessionRequest,
364 fidl::encoding::ResultType<DeviceOpenSessionResponse, i32>,
365 >(
366 (session_name, &mut session_info,),
367 0x25940b82146dcf67,
368 fidl::encoding::DynamicFlags::empty(),
369 ___deadline,
370 )?;
371 Ok(_response.map(|x| (x.session, x.fifos)))
372 }
373
374 pub fn r#get_port(
382 &self,
383 mut id: &PortId,
384 mut port: fidl::endpoints::ServerEnd<PortMarker>,
385 ) -> Result<(), fidl::Error> {
386 self.client.send::<DeviceGetPortRequest>(
387 (id, port),
388 0x340a852c955ba2a6,
389 fidl::encoding::DynamicFlags::empty(),
390 )
391 }
392
393 pub fn r#get_port_watcher(
397 &self,
398 mut watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
399 ) -> Result<(), fidl::Error> {
400 self.client.send::<DeviceGetPortWatcherRequest>(
401 (watcher,),
402 0x104f43c937c39f0c,
403 fidl::encoding::DynamicFlags::empty(),
404 )
405 }
406
407 pub fn r#clone(
411 &self,
412 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
413 ) -> Result<(), fidl::Error> {
414 self.client.send::<DeviceCloneRequest>(
415 (device,),
416 0x5882ea09b3809af4,
417 fidl::encoding::DynamicFlags::empty(),
418 )
419 }
420}
421
422#[cfg(target_os = "fuchsia")]
423impl From<DeviceSynchronousProxy> for zx::Handle {
424 fn from(value: DeviceSynchronousProxy) -> Self {
425 value.into_channel().into()
426 }
427}
428
429#[cfg(target_os = "fuchsia")]
430impl From<fidl::Channel> for DeviceSynchronousProxy {
431 fn from(value: fidl::Channel) -> Self {
432 Self::new(value)
433 }
434}
435
436#[cfg(target_os = "fuchsia")]
437impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
438 type Protocol = DeviceMarker;
439
440 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
441 Self::new(value.into_channel())
442 }
443}
444
445#[derive(Debug, Clone)]
446pub struct DeviceProxy {
447 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
448}
449
450impl fidl::endpoints::Proxy for DeviceProxy {
451 type Protocol = DeviceMarker;
452
453 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
454 Self::new(inner)
455 }
456
457 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
458 self.client.into_channel().map_err(|client| Self { client })
459 }
460
461 fn as_channel(&self) -> &::fidl::AsyncChannel {
462 self.client.as_channel()
463 }
464}
465
466impl DeviceProxy {
467 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
469 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
470 Self { client: fidl::client::Client::new(channel, protocol_name) }
471 }
472
473 pub fn take_event_stream(&self) -> DeviceEventStream {
479 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
480 }
481
482 pub fn r#get_info(
486 &self,
487 ) -> fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
488 {
489 DeviceProxyInterface::r#get_info(self)
490 }
491
492 pub fn r#open_session(
507 &self,
508 mut session_name: &str,
509 mut session_info: SessionInfo,
510 ) -> fidl::client::QueryResponseFut<
511 DeviceOpenSessionResult,
512 fidl::encoding::DefaultFuchsiaResourceDialect,
513 > {
514 DeviceProxyInterface::r#open_session(self, session_name, session_info)
515 }
516
517 pub fn r#get_port(
525 &self,
526 mut id: &PortId,
527 mut port: fidl::endpoints::ServerEnd<PortMarker>,
528 ) -> Result<(), fidl::Error> {
529 DeviceProxyInterface::r#get_port(self, id, port)
530 }
531
532 pub fn r#get_port_watcher(
536 &self,
537 mut watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
538 ) -> Result<(), fidl::Error> {
539 DeviceProxyInterface::r#get_port_watcher(self, watcher)
540 }
541
542 pub fn r#clone(
546 &self,
547 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
548 ) -> Result<(), fidl::Error> {
549 DeviceProxyInterface::r#clone(self, device)
550 }
551}
552
553impl DeviceProxyInterface for DeviceProxy {
554 type GetInfoResponseFut =
555 fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
556 fn r#get_info(&self) -> Self::GetInfoResponseFut {
557 fn _decode(
558 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
559 ) -> Result<DeviceInfo, fidl::Error> {
560 let _response = fidl::client::decode_transaction_body::<
561 DeviceGetInfoResponse,
562 fidl::encoding::DefaultFuchsiaResourceDialect,
563 0x3c500ca9341e8f56,
564 >(_buf?)?;
565 Ok(_response.info)
566 }
567 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceInfo>(
568 (),
569 0x3c500ca9341e8f56,
570 fidl::encoding::DynamicFlags::empty(),
571 _decode,
572 )
573 }
574
575 type OpenSessionResponseFut = fidl::client::QueryResponseFut<
576 DeviceOpenSessionResult,
577 fidl::encoding::DefaultFuchsiaResourceDialect,
578 >;
579 fn r#open_session(
580 &self,
581 mut session_name: &str,
582 mut session_info: SessionInfo,
583 ) -> Self::OpenSessionResponseFut {
584 fn _decode(
585 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
586 ) -> Result<DeviceOpenSessionResult, fidl::Error> {
587 let _response = fidl::client::decode_transaction_body::<
588 fidl::encoding::ResultType<DeviceOpenSessionResponse, i32>,
589 fidl::encoding::DefaultFuchsiaResourceDialect,
590 0x25940b82146dcf67,
591 >(_buf?)?;
592 Ok(_response.map(|x| (x.session, x.fifos)))
593 }
594 self.client.send_query_and_decode::<DeviceOpenSessionRequest, DeviceOpenSessionResult>(
595 (session_name, &mut session_info),
596 0x25940b82146dcf67,
597 fidl::encoding::DynamicFlags::empty(),
598 _decode,
599 )
600 }
601
602 fn r#get_port(
603 &self,
604 mut id: &PortId,
605 mut port: fidl::endpoints::ServerEnd<PortMarker>,
606 ) -> Result<(), fidl::Error> {
607 self.client.send::<DeviceGetPortRequest>(
608 (id, port),
609 0x340a852c955ba2a6,
610 fidl::encoding::DynamicFlags::empty(),
611 )
612 }
613
614 fn r#get_port_watcher(
615 &self,
616 mut watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
617 ) -> Result<(), fidl::Error> {
618 self.client.send::<DeviceGetPortWatcherRequest>(
619 (watcher,),
620 0x104f43c937c39f0c,
621 fidl::encoding::DynamicFlags::empty(),
622 )
623 }
624
625 fn r#clone(
626 &self,
627 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
628 ) -> Result<(), fidl::Error> {
629 self.client.send::<DeviceCloneRequest>(
630 (device,),
631 0x5882ea09b3809af4,
632 fidl::encoding::DynamicFlags::empty(),
633 )
634 }
635}
636
637pub struct DeviceEventStream {
638 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
639}
640
641impl std::marker::Unpin for DeviceEventStream {}
642
643impl futures::stream::FusedStream for DeviceEventStream {
644 fn is_terminated(&self) -> bool {
645 self.event_receiver.is_terminated()
646 }
647}
648
649impl futures::Stream for DeviceEventStream {
650 type Item = Result<DeviceEvent, fidl::Error>;
651
652 fn poll_next(
653 mut self: std::pin::Pin<&mut Self>,
654 cx: &mut std::task::Context<'_>,
655 ) -> std::task::Poll<Option<Self::Item>> {
656 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
657 &mut self.event_receiver,
658 cx
659 )?) {
660 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
661 None => std::task::Poll::Ready(None),
662 }
663 }
664}
665
666#[derive(Debug)]
667pub enum DeviceEvent {}
668
669impl DeviceEvent {
670 fn decode(
672 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
673 ) -> Result<DeviceEvent, fidl::Error> {
674 let (bytes, _handles) = buf.split_mut();
675 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
676 debug_assert_eq!(tx_header.tx_id, 0);
677 match tx_header.ordinal {
678 _ => Err(fidl::Error::UnknownOrdinal {
679 ordinal: tx_header.ordinal,
680 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
681 }),
682 }
683 }
684}
685
686pub struct DeviceRequestStream {
688 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
689 is_terminated: bool,
690}
691
692impl std::marker::Unpin for DeviceRequestStream {}
693
694impl futures::stream::FusedStream for DeviceRequestStream {
695 fn is_terminated(&self) -> bool {
696 self.is_terminated
697 }
698}
699
700impl fidl::endpoints::RequestStream for DeviceRequestStream {
701 type Protocol = DeviceMarker;
702 type ControlHandle = DeviceControlHandle;
703
704 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
705 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
706 }
707
708 fn control_handle(&self) -> Self::ControlHandle {
709 DeviceControlHandle { inner: self.inner.clone() }
710 }
711
712 fn into_inner(
713 self,
714 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
715 {
716 (self.inner, self.is_terminated)
717 }
718
719 fn from_inner(
720 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
721 is_terminated: bool,
722 ) -> Self {
723 Self { inner, is_terminated }
724 }
725}
726
727impl futures::Stream for DeviceRequestStream {
728 type Item = Result<DeviceRequest, fidl::Error>;
729
730 fn poll_next(
731 mut self: std::pin::Pin<&mut Self>,
732 cx: &mut std::task::Context<'_>,
733 ) -> std::task::Poll<Option<Self::Item>> {
734 let this = &mut *self;
735 if this.inner.check_shutdown(cx) {
736 this.is_terminated = true;
737 return std::task::Poll::Ready(None);
738 }
739 if this.is_terminated {
740 panic!("polled DeviceRequestStream after completion");
741 }
742 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
743 |bytes, handles| {
744 match this.inner.channel().read_etc(cx, bytes, handles) {
745 std::task::Poll::Ready(Ok(())) => {}
746 std::task::Poll::Pending => return std::task::Poll::Pending,
747 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
748 this.is_terminated = true;
749 return std::task::Poll::Ready(None);
750 }
751 std::task::Poll::Ready(Err(e)) => {
752 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
753 e.into(),
754 ))))
755 }
756 }
757
758 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
760
761 std::task::Poll::Ready(Some(match header.ordinal {
762 0x3c500ca9341e8f56 => {
763 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
764 let mut req = fidl::new_empty!(
765 fidl::encoding::EmptyPayload,
766 fidl::encoding::DefaultFuchsiaResourceDialect
767 );
768 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
769 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
770 Ok(DeviceRequest::GetInfo {
771 responder: DeviceGetInfoResponder {
772 control_handle: std::mem::ManuallyDrop::new(control_handle),
773 tx_id: header.tx_id,
774 },
775 })
776 }
777 0x25940b82146dcf67 => {
778 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
779 let mut req = fidl::new_empty!(
780 DeviceOpenSessionRequest,
781 fidl::encoding::DefaultFuchsiaResourceDialect
782 );
783 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
784 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
785 Ok(DeviceRequest::OpenSession {
786 session_name: req.session_name,
787 session_info: req.session_info,
788
789 responder: DeviceOpenSessionResponder {
790 control_handle: std::mem::ManuallyDrop::new(control_handle),
791 tx_id: header.tx_id,
792 },
793 })
794 }
795 0x340a852c955ba2a6 => {
796 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
797 let mut req = fidl::new_empty!(
798 DeviceGetPortRequest,
799 fidl::encoding::DefaultFuchsiaResourceDialect
800 );
801 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetPortRequest>(&header, _body_bytes, handles, &mut req)?;
802 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
803 Ok(DeviceRequest::GetPort { id: req.id, port: req.port, control_handle })
804 }
805 0x104f43c937c39f0c => {
806 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
807 let mut req = fidl::new_empty!(
808 DeviceGetPortWatcherRequest,
809 fidl::encoding::DefaultFuchsiaResourceDialect
810 );
811 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetPortWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
812 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
813 Ok(DeviceRequest::GetPortWatcher { watcher: req.watcher, control_handle })
814 }
815 0x5882ea09b3809af4 => {
816 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
817 let mut req = fidl::new_empty!(
818 DeviceCloneRequest,
819 fidl::encoding::DefaultFuchsiaResourceDialect
820 );
821 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceCloneRequest>(&header, _body_bytes, handles, &mut req)?;
822 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
823 Ok(DeviceRequest::Clone { device: req.device, control_handle })
824 }
825 _ => Err(fidl::Error::UnknownOrdinal {
826 ordinal: header.ordinal,
827 protocol_name:
828 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
829 }),
830 }))
831 },
832 )
833 }
834}
835
836#[derive(Debug)]
838pub enum DeviceRequest {
839 GetInfo { responder: DeviceGetInfoResponder },
843 OpenSession {
858 session_name: String,
859 session_info: SessionInfo,
860 responder: DeviceOpenSessionResponder,
861 },
862 GetPort {
870 id: PortId,
871 port: fidl::endpoints::ServerEnd<PortMarker>,
872 control_handle: DeviceControlHandle,
873 },
874 GetPortWatcher {
878 watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
879 control_handle: DeviceControlHandle,
880 },
881 Clone { device: fidl::endpoints::ServerEnd<DeviceMarker>, control_handle: DeviceControlHandle },
885}
886
887impl DeviceRequest {
888 #[allow(irrefutable_let_patterns)]
889 pub fn into_get_info(self) -> Option<(DeviceGetInfoResponder)> {
890 if let DeviceRequest::GetInfo { responder } = self {
891 Some((responder))
892 } else {
893 None
894 }
895 }
896
897 #[allow(irrefutable_let_patterns)]
898 pub fn into_open_session(self) -> Option<(String, SessionInfo, DeviceOpenSessionResponder)> {
899 if let DeviceRequest::OpenSession { session_name, session_info, responder } = self {
900 Some((session_name, session_info, responder))
901 } else {
902 None
903 }
904 }
905
906 #[allow(irrefutable_let_patterns)]
907 pub fn into_get_port(
908 self,
909 ) -> Option<(PortId, fidl::endpoints::ServerEnd<PortMarker>, DeviceControlHandle)> {
910 if let DeviceRequest::GetPort { id, port, control_handle } = self {
911 Some((id, port, control_handle))
912 } else {
913 None
914 }
915 }
916
917 #[allow(irrefutable_let_patterns)]
918 pub fn into_get_port_watcher(
919 self,
920 ) -> Option<(fidl::endpoints::ServerEnd<PortWatcherMarker>, DeviceControlHandle)> {
921 if let DeviceRequest::GetPortWatcher { watcher, control_handle } = self {
922 Some((watcher, control_handle))
923 } else {
924 None
925 }
926 }
927
928 #[allow(irrefutable_let_patterns)]
929 pub fn into_clone(
930 self,
931 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, DeviceControlHandle)> {
932 if let DeviceRequest::Clone { device, control_handle } = self {
933 Some((device, control_handle))
934 } else {
935 None
936 }
937 }
938
939 pub fn method_name(&self) -> &'static str {
941 match *self {
942 DeviceRequest::GetInfo { .. } => "get_info",
943 DeviceRequest::OpenSession { .. } => "open_session",
944 DeviceRequest::GetPort { .. } => "get_port",
945 DeviceRequest::GetPortWatcher { .. } => "get_port_watcher",
946 DeviceRequest::Clone { .. } => "clone",
947 }
948 }
949}
950
951#[derive(Debug, Clone)]
952pub struct DeviceControlHandle {
953 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
954}
955
956impl fidl::endpoints::ControlHandle for DeviceControlHandle {
957 fn shutdown(&self) {
958 self.inner.shutdown()
959 }
960 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
961 self.inner.shutdown_with_epitaph(status)
962 }
963
964 fn is_closed(&self) -> bool {
965 self.inner.channel().is_closed()
966 }
967 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
968 self.inner.channel().on_closed()
969 }
970
971 #[cfg(target_os = "fuchsia")]
972 fn signal_peer(
973 &self,
974 clear_mask: zx::Signals,
975 set_mask: zx::Signals,
976 ) -> Result<(), zx_status::Status> {
977 use fidl::Peered;
978 self.inner.channel().signal_peer(clear_mask, set_mask)
979 }
980}
981
982impl DeviceControlHandle {}
983
984#[must_use = "FIDL methods require a response to be sent"]
985#[derive(Debug)]
986pub struct DeviceGetInfoResponder {
987 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
988 tx_id: u32,
989}
990
991impl std::ops::Drop for DeviceGetInfoResponder {
995 fn drop(&mut self) {
996 self.control_handle.shutdown();
997 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
999 }
1000}
1001
1002impl fidl::endpoints::Responder for DeviceGetInfoResponder {
1003 type ControlHandle = DeviceControlHandle;
1004
1005 fn control_handle(&self) -> &DeviceControlHandle {
1006 &self.control_handle
1007 }
1008
1009 fn drop_without_shutdown(mut self) {
1010 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1012 std::mem::forget(self);
1014 }
1015}
1016
1017impl DeviceGetInfoResponder {
1018 pub fn send(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
1022 let _result = self.send_raw(info);
1023 if _result.is_err() {
1024 self.control_handle.shutdown();
1025 }
1026 self.drop_without_shutdown();
1027 _result
1028 }
1029
1030 pub fn send_no_shutdown_on_err(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
1032 let _result = self.send_raw(info);
1033 self.drop_without_shutdown();
1034 _result
1035 }
1036
1037 fn send_raw(&self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
1038 self.control_handle.inner.send::<DeviceGetInfoResponse>(
1039 (info,),
1040 self.tx_id,
1041 0x3c500ca9341e8f56,
1042 fidl::encoding::DynamicFlags::empty(),
1043 )
1044 }
1045}
1046
1047#[must_use = "FIDL methods require a response to be sent"]
1048#[derive(Debug)]
1049pub struct DeviceOpenSessionResponder {
1050 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1051 tx_id: u32,
1052}
1053
1054impl std::ops::Drop for DeviceOpenSessionResponder {
1058 fn drop(&mut self) {
1059 self.control_handle.shutdown();
1060 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1062 }
1063}
1064
1065impl fidl::endpoints::Responder for DeviceOpenSessionResponder {
1066 type ControlHandle = DeviceControlHandle;
1067
1068 fn control_handle(&self) -> &DeviceControlHandle {
1069 &self.control_handle
1070 }
1071
1072 fn drop_without_shutdown(mut self) {
1073 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1075 std::mem::forget(self);
1077 }
1078}
1079
1080impl DeviceOpenSessionResponder {
1081 pub fn send(
1085 self,
1086 mut result: Result<(fidl::endpoints::ClientEnd<SessionMarker>, Fifos), i32>,
1087 ) -> Result<(), fidl::Error> {
1088 let _result = self.send_raw(result);
1089 if _result.is_err() {
1090 self.control_handle.shutdown();
1091 }
1092 self.drop_without_shutdown();
1093 _result
1094 }
1095
1096 pub fn send_no_shutdown_on_err(
1098 self,
1099 mut result: Result<(fidl::endpoints::ClientEnd<SessionMarker>, Fifos), i32>,
1100 ) -> Result<(), fidl::Error> {
1101 let _result = self.send_raw(result);
1102 self.drop_without_shutdown();
1103 _result
1104 }
1105
1106 fn send_raw(
1107 &self,
1108 mut result: Result<(fidl::endpoints::ClientEnd<SessionMarker>, Fifos), i32>,
1109 ) -> Result<(), fidl::Error> {
1110 self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceOpenSessionResponse, i32>>(
1111 result.as_mut().map_err(|e| *e).map(|(session, fifos)| (std::mem::replace(session, <<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::Handle as fidl::encoding::HandleFor<fidl::encoding::DefaultFuchsiaResourceDialect>>::invalid().into()), fifos,)),
1112 self.tx_id,
1113 0x25940b82146dcf67,
1114 fidl::encoding::DynamicFlags::empty()
1115 )
1116 }
1117}
1118
1119#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1120pub struct DeviceInstanceMarker;
1121
1122impl fidl::endpoints::ProtocolMarker for DeviceInstanceMarker {
1123 type Proxy = DeviceInstanceProxy;
1124 type RequestStream = DeviceInstanceRequestStream;
1125 #[cfg(target_os = "fuchsia")]
1126 type SynchronousProxy = DeviceInstanceSynchronousProxy;
1127
1128 const DEBUG_NAME: &'static str = "(anonymous) DeviceInstance";
1129}
1130
1131pub trait DeviceInstanceProxyInterface: Send + Sync {
1132 fn r#get_device(
1133 &self,
1134 device: fidl::endpoints::ServerEnd<DeviceMarker>,
1135 ) -> Result<(), fidl::Error>;
1136}
1137#[derive(Debug)]
1138#[cfg(target_os = "fuchsia")]
1139pub struct DeviceInstanceSynchronousProxy {
1140 client: fidl::client::sync::Client,
1141}
1142
1143#[cfg(target_os = "fuchsia")]
1144impl fidl::endpoints::SynchronousProxy for DeviceInstanceSynchronousProxy {
1145 type Proxy = DeviceInstanceProxy;
1146 type Protocol = DeviceInstanceMarker;
1147
1148 fn from_channel(inner: fidl::Channel) -> Self {
1149 Self::new(inner)
1150 }
1151
1152 fn into_channel(self) -> fidl::Channel {
1153 self.client.into_channel()
1154 }
1155
1156 fn as_channel(&self) -> &fidl::Channel {
1157 self.client.as_channel()
1158 }
1159}
1160
1161#[cfg(target_os = "fuchsia")]
1162impl DeviceInstanceSynchronousProxy {
1163 pub fn new(channel: fidl::Channel) -> Self {
1164 let protocol_name = <DeviceInstanceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1165 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1166 }
1167
1168 pub fn into_channel(self) -> fidl::Channel {
1169 self.client.into_channel()
1170 }
1171
1172 pub fn wait_for_event(
1175 &self,
1176 deadline: zx::MonotonicInstant,
1177 ) -> Result<DeviceInstanceEvent, fidl::Error> {
1178 DeviceInstanceEvent::decode(self.client.wait_for_event(deadline)?)
1179 }
1180
1181 pub fn r#get_device(
1185 &self,
1186 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
1187 ) -> Result<(), fidl::Error> {
1188 self.client.send::<DeviceInstanceGetDeviceRequest>(
1189 (device,),
1190 0x775270585575cef7,
1191 fidl::encoding::DynamicFlags::empty(),
1192 )
1193 }
1194}
1195
1196#[cfg(target_os = "fuchsia")]
1197impl From<DeviceInstanceSynchronousProxy> for zx::Handle {
1198 fn from(value: DeviceInstanceSynchronousProxy) -> Self {
1199 value.into_channel().into()
1200 }
1201}
1202
1203#[cfg(target_os = "fuchsia")]
1204impl From<fidl::Channel> for DeviceInstanceSynchronousProxy {
1205 fn from(value: fidl::Channel) -> Self {
1206 Self::new(value)
1207 }
1208}
1209
1210#[cfg(target_os = "fuchsia")]
1211impl fidl::endpoints::FromClient for DeviceInstanceSynchronousProxy {
1212 type Protocol = DeviceInstanceMarker;
1213
1214 fn from_client(value: fidl::endpoints::ClientEnd<DeviceInstanceMarker>) -> Self {
1215 Self::new(value.into_channel())
1216 }
1217}
1218
1219#[derive(Debug, Clone)]
1220pub struct DeviceInstanceProxy {
1221 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1222}
1223
1224impl fidl::endpoints::Proxy for DeviceInstanceProxy {
1225 type Protocol = DeviceInstanceMarker;
1226
1227 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1228 Self::new(inner)
1229 }
1230
1231 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1232 self.client.into_channel().map_err(|client| Self { client })
1233 }
1234
1235 fn as_channel(&self) -> &::fidl::AsyncChannel {
1236 self.client.as_channel()
1237 }
1238}
1239
1240impl DeviceInstanceProxy {
1241 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1243 let protocol_name = <DeviceInstanceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1244 Self { client: fidl::client::Client::new(channel, protocol_name) }
1245 }
1246
1247 pub fn take_event_stream(&self) -> DeviceInstanceEventStream {
1253 DeviceInstanceEventStream { event_receiver: self.client.take_event_receiver() }
1254 }
1255
1256 pub fn r#get_device(
1260 &self,
1261 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
1262 ) -> Result<(), fidl::Error> {
1263 DeviceInstanceProxyInterface::r#get_device(self, device)
1264 }
1265}
1266
1267impl DeviceInstanceProxyInterface for DeviceInstanceProxy {
1268 fn r#get_device(
1269 &self,
1270 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
1271 ) -> Result<(), fidl::Error> {
1272 self.client.send::<DeviceInstanceGetDeviceRequest>(
1273 (device,),
1274 0x775270585575cef7,
1275 fidl::encoding::DynamicFlags::empty(),
1276 )
1277 }
1278}
1279
1280pub struct DeviceInstanceEventStream {
1281 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1282}
1283
1284impl std::marker::Unpin for DeviceInstanceEventStream {}
1285
1286impl futures::stream::FusedStream for DeviceInstanceEventStream {
1287 fn is_terminated(&self) -> bool {
1288 self.event_receiver.is_terminated()
1289 }
1290}
1291
1292impl futures::Stream for DeviceInstanceEventStream {
1293 type Item = Result<DeviceInstanceEvent, fidl::Error>;
1294
1295 fn poll_next(
1296 mut self: std::pin::Pin<&mut Self>,
1297 cx: &mut std::task::Context<'_>,
1298 ) -> std::task::Poll<Option<Self::Item>> {
1299 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1300 &mut self.event_receiver,
1301 cx
1302 )?) {
1303 Some(buf) => std::task::Poll::Ready(Some(DeviceInstanceEvent::decode(buf))),
1304 None => std::task::Poll::Ready(None),
1305 }
1306 }
1307}
1308
1309#[derive(Debug)]
1310pub enum DeviceInstanceEvent {}
1311
1312impl DeviceInstanceEvent {
1313 fn decode(
1315 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1316 ) -> Result<DeviceInstanceEvent, fidl::Error> {
1317 let (bytes, _handles) = buf.split_mut();
1318 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1319 debug_assert_eq!(tx_header.tx_id, 0);
1320 match tx_header.ordinal {
1321 _ => Err(fidl::Error::UnknownOrdinal {
1322 ordinal: tx_header.ordinal,
1323 protocol_name:
1324 <DeviceInstanceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1325 }),
1326 }
1327 }
1328}
1329
1330pub struct DeviceInstanceRequestStream {
1332 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1333 is_terminated: bool,
1334}
1335
1336impl std::marker::Unpin for DeviceInstanceRequestStream {}
1337
1338impl futures::stream::FusedStream for DeviceInstanceRequestStream {
1339 fn is_terminated(&self) -> bool {
1340 self.is_terminated
1341 }
1342}
1343
1344impl fidl::endpoints::RequestStream for DeviceInstanceRequestStream {
1345 type Protocol = DeviceInstanceMarker;
1346 type ControlHandle = DeviceInstanceControlHandle;
1347
1348 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1349 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1350 }
1351
1352 fn control_handle(&self) -> Self::ControlHandle {
1353 DeviceInstanceControlHandle { inner: self.inner.clone() }
1354 }
1355
1356 fn into_inner(
1357 self,
1358 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1359 {
1360 (self.inner, self.is_terminated)
1361 }
1362
1363 fn from_inner(
1364 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1365 is_terminated: bool,
1366 ) -> Self {
1367 Self { inner, is_terminated }
1368 }
1369}
1370
1371impl futures::Stream for DeviceInstanceRequestStream {
1372 type Item = Result<DeviceInstanceRequest, fidl::Error>;
1373
1374 fn poll_next(
1375 mut self: std::pin::Pin<&mut Self>,
1376 cx: &mut std::task::Context<'_>,
1377 ) -> std::task::Poll<Option<Self::Item>> {
1378 let this = &mut *self;
1379 if this.inner.check_shutdown(cx) {
1380 this.is_terminated = true;
1381 return std::task::Poll::Ready(None);
1382 }
1383 if this.is_terminated {
1384 panic!("polled DeviceInstanceRequestStream after completion");
1385 }
1386 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1387 |bytes, handles| {
1388 match this.inner.channel().read_etc(cx, bytes, handles) {
1389 std::task::Poll::Ready(Ok(())) => {}
1390 std::task::Poll::Pending => return std::task::Poll::Pending,
1391 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1392 this.is_terminated = true;
1393 return std::task::Poll::Ready(None);
1394 }
1395 std::task::Poll::Ready(Err(e)) => {
1396 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1397 e.into(),
1398 ))))
1399 }
1400 }
1401
1402 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1404
1405 std::task::Poll::Ready(Some(match header.ordinal {
1406 0x775270585575cef7 => {
1407 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1408 let mut req = fidl::new_empty!(
1409 DeviceInstanceGetDeviceRequest,
1410 fidl::encoding::DefaultFuchsiaResourceDialect
1411 );
1412 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceInstanceGetDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
1413 let control_handle =
1414 DeviceInstanceControlHandle { inner: this.inner.clone() };
1415 Ok(DeviceInstanceRequest::GetDevice { device: req.device, control_handle })
1416 }
1417 _ => Err(fidl::Error::UnknownOrdinal {
1418 ordinal: header.ordinal,
1419 protocol_name:
1420 <DeviceInstanceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1421 }),
1422 }))
1423 },
1424 )
1425 }
1426}
1427
1428#[derive(Debug)]
1430pub enum DeviceInstanceRequest {
1431 GetDevice {
1435 device: fidl::endpoints::ServerEnd<DeviceMarker>,
1436 control_handle: DeviceInstanceControlHandle,
1437 },
1438}
1439
1440impl DeviceInstanceRequest {
1441 #[allow(irrefutable_let_patterns)]
1442 pub fn into_get_device(
1443 self,
1444 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, DeviceInstanceControlHandle)> {
1445 if let DeviceInstanceRequest::GetDevice { device, control_handle } = self {
1446 Some((device, control_handle))
1447 } else {
1448 None
1449 }
1450 }
1451
1452 pub fn method_name(&self) -> &'static str {
1454 match *self {
1455 DeviceInstanceRequest::GetDevice { .. } => "get_device",
1456 }
1457 }
1458}
1459
1460#[derive(Debug, Clone)]
1461pub struct DeviceInstanceControlHandle {
1462 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1463}
1464
1465impl fidl::endpoints::ControlHandle for DeviceInstanceControlHandle {
1466 fn shutdown(&self) {
1467 self.inner.shutdown()
1468 }
1469 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1470 self.inner.shutdown_with_epitaph(status)
1471 }
1472
1473 fn is_closed(&self) -> bool {
1474 self.inner.channel().is_closed()
1475 }
1476 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1477 self.inner.channel().on_closed()
1478 }
1479
1480 #[cfg(target_os = "fuchsia")]
1481 fn signal_peer(
1482 &self,
1483 clear_mask: zx::Signals,
1484 set_mask: zx::Signals,
1485 ) -> Result<(), zx_status::Status> {
1486 use fidl::Peered;
1487 self.inner.channel().signal_peer(clear_mask, set_mask)
1488 }
1489}
1490
1491impl DeviceInstanceControlHandle {}
1492
1493#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1494pub struct DiagnosticsMarker;
1495
1496impl fidl::endpoints::ProtocolMarker for DiagnosticsMarker {
1497 type Proxy = DiagnosticsProxy;
1498 type RequestStream = DiagnosticsRequestStream;
1499 #[cfg(target_os = "fuchsia")]
1500 type SynchronousProxy = DiagnosticsSynchronousProxy;
1501
1502 const DEBUG_NAME: &'static str = "(anonymous) Diagnostics";
1503}
1504
1505pub trait DiagnosticsProxyInterface: Send + Sync {
1506 type LogDebugInfoToSyslogResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1507 + Send;
1508 fn r#log_debug_info_to_syslog(&self) -> Self::LogDebugInfoToSyslogResponseFut;
1509}
1510#[derive(Debug)]
1511#[cfg(target_os = "fuchsia")]
1512pub struct DiagnosticsSynchronousProxy {
1513 client: fidl::client::sync::Client,
1514}
1515
1516#[cfg(target_os = "fuchsia")]
1517impl fidl::endpoints::SynchronousProxy for DiagnosticsSynchronousProxy {
1518 type Proxy = DiagnosticsProxy;
1519 type Protocol = DiagnosticsMarker;
1520
1521 fn from_channel(inner: fidl::Channel) -> Self {
1522 Self::new(inner)
1523 }
1524
1525 fn into_channel(self) -> fidl::Channel {
1526 self.client.into_channel()
1527 }
1528
1529 fn as_channel(&self) -> &fidl::Channel {
1530 self.client.as_channel()
1531 }
1532}
1533
1534#[cfg(target_os = "fuchsia")]
1535impl DiagnosticsSynchronousProxy {
1536 pub fn new(channel: fidl::Channel) -> Self {
1537 let protocol_name = <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1538 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1539 }
1540
1541 pub fn into_channel(self) -> fidl::Channel {
1542 self.client.into_channel()
1543 }
1544
1545 pub fn wait_for_event(
1548 &self,
1549 deadline: zx::MonotonicInstant,
1550 ) -> Result<DiagnosticsEvent, fidl::Error> {
1551 DiagnosticsEvent::decode(self.client.wait_for_event(deadline)?)
1552 }
1553
1554 pub fn r#log_debug_info_to_syslog(
1559 &self,
1560 ___deadline: zx::MonotonicInstant,
1561 ) -> Result<(), fidl::Error> {
1562 let _response =
1563 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
1564 (),
1565 0x4222897dfe1f4b4a,
1566 fidl::encoding::DynamicFlags::empty(),
1567 ___deadline,
1568 )?;
1569 Ok(_response)
1570 }
1571}
1572
1573#[cfg(target_os = "fuchsia")]
1574impl From<DiagnosticsSynchronousProxy> for zx::Handle {
1575 fn from(value: DiagnosticsSynchronousProxy) -> Self {
1576 value.into_channel().into()
1577 }
1578}
1579
1580#[cfg(target_os = "fuchsia")]
1581impl From<fidl::Channel> for DiagnosticsSynchronousProxy {
1582 fn from(value: fidl::Channel) -> Self {
1583 Self::new(value)
1584 }
1585}
1586
1587#[cfg(target_os = "fuchsia")]
1588impl fidl::endpoints::FromClient for DiagnosticsSynchronousProxy {
1589 type Protocol = DiagnosticsMarker;
1590
1591 fn from_client(value: fidl::endpoints::ClientEnd<DiagnosticsMarker>) -> Self {
1592 Self::new(value.into_channel())
1593 }
1594}
1595
1596#[derive(Debug, Clone)]
1597pub struct DiagnosticsProxy {
1598 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1599}
1600
1601impl fidl::endpoints::Proxy for DiagnosticsProxy {
1602 type Protocol = DiagnosticsMarker;
1603
1604 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1605 Self::new(inner)
1606 }
1607
1608 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1609 self.client.into_channel().map_err(|client| Self { client })
1610 }
1611
1612 fn as_channel(&self) -> &::fidl::AsyncChannel {
1613 self.client.as_channel()
1614 }
1615}
1616
1617impl DiagnosticsProxy {
1618 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1620 let protocol_name = <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1621 Self { client: fidl::client::Client::new(channel, protocol_name) }
1622 }
1623
1624 pub fn take_event_stream(&self) -> DiagnosticsEventStream {
1630 DiagnosticsEventStream { event_receiver: self.client.take_event_receiver() }
1631 }
1632
1633 pub fn r#log_debug_info_to_syslog(
1638 &self,
1639 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1640 DiagnosticsProxyInterface::r#log_debug_info_to_syslog(self)
1641 }
1642}
1643
1644impl DiagnosticsProxyInterface for DiagnosticsProxy {
1645 type LogDebugInfoToSyslogResponseFut =
1646 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1647 fn r#log_debug_info_to_syslog(&self) -> Self::LogDebugInfoToSyslogResponseFut {
1648 fn _decode(
1649 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1650 ) -> Result<(), fidl::Error> {
1651 let _response = fidl::client::decode_transaction_body::<
1652 fidl::encoding::EmptyPayload,
1653 fidl::encoding::DefaultFuchsiaResourceDialect,
1654 0x4222897dfe1f4b4a,
1655 >(_buf?)?;
1656 Ok(_response)
1657 }
1658 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1659 (),
1660 0x4222897dfe1f4b4a,
1661 fidl::encoding::DynamicFlags::empty(),
1662 _decode,
1663 )
1664 }
1665}
1666
1667pub struct DiagnosticsEventStream {
1668 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1669}
1670
1671impl std::marker::Unpin for DiagnosticsEventStream {}
1672
1673impl futures::stream::FusedStream for DiagnosticsEventStream {
1674 fn is_terminated(&self) -> bool {
1675 self.event_receiver.is_terminated()
1676 }
1677}
1678
1679impl futures::Stream for DiagnosticsEventStream {
1680 type Item = Result<DiagnosticsEvent, fidl::Error>;
1681
1682 fn poll_next(
1683 mut self: std::pin::Pin<&mut Self>,
1684 cx: &mut std::task::Context<'_>,
1685 ) -> std::task::Poll<Option<Self::Item>> {
1686 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1687 &mut self.event_receiver,
1688 cx
1689 )?) {
1690 Some(buf) => std::task::Poll::Ready(Some(DiagnosticsEvent::decode(buf))),
1691 None => std::task::Poll::Ready(None),
1692 }
1693 }
1694}
1695
1696#[derive(Debug)]
1697pub enum DiagnosticsEvent {}
1698
1699impl DiagnosticsEvent {
1700 fn decode(
1702 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1703 ) -> Result<DiagnosticsEvent, fidl::Error> {
1704 let (bytes, _handles) = buf.split_mut();
1705 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1706 debug_assert_eq!(tx_header.tx_id, 0);
1707 match tx_header.ordinal {
1708 _ => Err(fidl::Error::UnknownOrdinal {
1709 ordinal: tx_header.ordinal,
1710 protocol_name: <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1711 }),
1712 }
1713 }
1714}
1715
1716pub struct DiagnosticsRequestStream {
1718 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1719 is_terminated: bool,
1720}
1721
1722impl std::marker::Unpin for DiagnosticsRequestStream {}
1723
1724impl futures::stream::FusedStream for DiagnosticsRequestStream {
1725 fn is_terminated(&self) -> bool {
1726 self.is_terminated
1727 }
1728}
1729
1730impl fidl::endpoints::RequestStream for DiagnosticsRequestStream {
1731 type Protocol = DiagnosticsMarker;
1732 type ControlHandle = DiagnosticsControlHandle;
1733
1734 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1735 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1736 }
1737
1738 fn control_handle(&self) -> Self::ControlHandle {
1739 DiagnosticsControlHandle { inner: self.inner.clone() }
1740 }
1741
1742 fn into_inner(
1743 self,
1744 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1745 {
1746 (self.inner, self.is_terminated)
1747 }
1748
1749 fn from_inner(
1750 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1751 is_terminated: bool,
1752 ) -> Self {
1753 Self { inner, is_terminated }
1754 }
1755}
1756
1757impl futures::Stream for DiagnosticsRequestStream {
1758 type Item = Result<DiagnosticsRequest, fidl::Error>;
1759
1760 fn poll_next(
1761 mut self: std::pin::Pin<&mut Self>,
1762 cx: &mut std::task::Context<'_>,
1763 ) -> std::task::Poll<Option<Self::Item>> {
1764 let this = &mut *self;
1765 if this.inner.check_shutdown(cx) {
1766 this.is_terminated = true;
1767 return std::task::Poll::Ready(None);
1768 }
1769 if this.is_terminated {
1770 panic!("polled DiagnosticsRequestStream after completion");
1771 }
1772 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1773 |bytes, handles| {
1774 match this.inner.channel().read_etc(cx, bytes, handles) {
1775 std::task::Poll::Ready(Ok(())) => {}
1776 std::task::Poll::Pending => return std::task::Poll::Pending,
1777 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1778 this.is_terminated = true;
1779 return std::task::Poll::Ready(None);
1780 }
1781 std::task::Poll::Ready(Err(e)) => {
1782 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1783 e.into(),
1784 ))))
1785 }
1786 }
1787
1788 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1790
1791 std::task::Poll::Ready(Some(match header.ordinal {
1792 0x4222897dfe1f4b4a => {
1793 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1794 let mut req = fidl::new_empty!(
1795 fidl::encoding::EmptyPayload,
1796 fidl::encoding::DefaultFuchsiaResourceDialect
1797 );
1798 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1799 let control_handle = DiagnosticsControlHandle { inner: this.inner.clone() };
1800 Ok(DiagnosticsRequest::LogDebugInfoToSyslog {
1801 responder: DiagnosticsLogDebugInfoToSyslogResponder {
1802 control_handle: std::mem::ManuallyDrop::new(control_handle),
1803 tx_id: header.tx_id,
1804 },
1805 })
1806 }
1807 _ => Err(fidl::Error::UnknownOrdinal {
1808 ordinal: header.ordinal,
1809 protocol_name:
1810 <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1811 }),
1812 }))
1813 },
1814 )
1815 }
1816}
1817
1818#[derive(Debug)]
1821pub enum DiagnosticsRequest {
1822 LogDebugInfoToSyslog { responder: DiagnosticsLogDebugInfoToSyslogResponder },
1827}
1828
1829impl DiagnosticsRequest {
1830 #[allow(irrefutable_let_patterns)]
1831 pub fn into_log_debug_info_to_syslog(
1832 self,
1833 ) -> Option<(DiagnosticsLogDebugInfoToSyslogResponder)> {
1834 if let DiagnosticsRequest::LogDebugInfoToSyslog { responder } = self {
1835 Some((responder))
1836 } else {
1837 None
1838 }
1839 }
1840
1841 pub fn method_name(&self) -> &'static str {
1843 match *self {
1844 DiagnosticsRequest::LogDebugInfoToSyslog { .. } => "log_debug_info_to_syslog",
1845 }
1846 }
1847}
1848
1849#[derive(Debug, Clone)]
1850pub struct DiagnosticsControlHandle {
1851 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1852}
1853
1854impl fidl::endpoints::ControlHandle for DiagnosticsControlHandle {
1855 fn shutdown(&self) {
1856 self.inner.shutdown()
1857 }
1858 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1859 self.inner.shutdown_with_epitaph(status)
1860 }
1861
1862 fn is_closed(&self) -> bool {
1863 self.inner.channel().is_closed()
1864 }
1865 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1866 self.inner.channel().on_closed()
1867 }
1868
1869 #[cfg(target_os = "fuchsia")]
1870 fn signal_peer(
1871 &self,
1872 clear_mask: zx::Signals,
1873 set_mask: zx::Signals,
1874 ) -> Result<(), zx_status::Status> {
1875 use fidl::Peered;
1876 self.inner.channel().signal_peer(clear_mask, set_mask)
1877 }
1878}
1879
1880impl DiagnosticsControlHandle {}
1881
1882#[must_use = "FIDL methods require a response to be sent"]
1883#[derive(Debug)]
1884pub struct DiagnosticsLogDebugInfoToSyslogResponder {
1885 control_handle: std::mem::ManuallyDrop<DiagnosticsControlHandle>,
1886 tx_id: u32,
1887}
1888
1889impl std::ops::Drop for DiagnosticsLogDebugInfoToSyslogResponder {
1893 fn drop(&mut self) {
1894 self.control_handle.shutdown();
1895 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1897 }
1898}
1899
1900impl fidl::endpoints::Responder for DiagnosticsLogDebugInfoToSyslogResponder {
1901 type ControlHandle = DiagnosticsControlHandle;
1902
1903 fn control_handle(&self) -> &DiagnosticsControlHandle {
1904 &self.control_handle
1905 }
1906
1907 fn drop_without_shutdown(mut self) {
1908 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1910 std::mem::forget(self);
1912 }
1913}
1914
1915impl DiagnosticsLogDebugInfoToSyslogResponder {
1916 pub fn send(self) -> Result<(), fidl::Error> {
1920 let _result = self.send_raw();
1921 if _result.is_err() {
1922 self.control_handle.shutdown();
1923 }
1924 self.drop_without_shutdown();
1925 _result
1926 }
1927
1928 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1930 let _result = self.send_raw();
1931 self.drop_without_shutdown();
1932 _result
1933 }
1934
1935 fn send_raw(&self) -> Result<(), fidl::Error> {
1936 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1937 (),
1938 self.tx_id,
1939 0x4222897dfe1f4b4a,
1940 fidl::encoding::DynamicFlags::empty(),
1941 )
1942 }
1943}
1944
1945#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1946pub struct MacAddressingMarker;
1947
1948impl fidl::endpoints::ProtocolMarker for MacAddressingMarker {
1949 type Proxy = MacAddressingProxy;
1950 type RequestStream = MacAddressingRequestStream;
1951 #[cfg(target_os = "fuchsia")]
1952 type SynchronousProxy = MacAddressingSynchronousProxy;
1953
1954 const DEBUG_NAME: &'static str = "(anonymous) MacAddressing";
1955}
1956
1957pub trait MacAddressingProxyInterface: Send + Sync {
1958 type GetUnicastAddressResponseFut: std::future::Future<Output = Result<fidl_fuchsia_net::MacAddress, fidl::Error>>
1959 + Send;
1960 fn r#get_unicast_address(&self) -> Self::GetUnicastAddressResponseFut;
1961 type SetModeResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1962 fn r#set_mode(&self, mode: MacFilterMode) -> Self::SetModeResponseFut;
1963 type AddMulticastAddressResponseFut: std::future::Future<Output = Result<i32, fidl::Error>>
1964 + Send;
1965 fn r#add_multicast_address(
1966 &self,
1967 address: &fidl_fuchsia_net::MacAddress,
1968 ) -> Self::AddMulticastAddressResponseFut;
1969 type RemoveMulticastAddressResponseFut: std::future::Future<Output = Result<i32, fidl::Error>>
1970 + Send;
1971 fn r#remove_multicast_address(
1972 &self,
1973 address: &fidl_fuchsia_net::MacAddress,
1974 ) -> Self::RemoveMulticastAddressResponseFut;
1975}
1976#[derive(Debug)]
1977#[cfg(target_os = "fuchsia")]
1978pub struct MacAddressingSynchronousProxy {
1979 client: fidl::client::sync::Client,
1980}
1981
1982#[cfg(target_os = "fuchsia")]
1983impl fidl::endpoints::SynchronousProxy for MacAddressingSynchronousProxy {
1984 type Proxy = MacAddressingProxy;
1985 type Protocol = MacAddressingMarker;
1986
1987 fn from_channel(inner: fidl::Channel) -> Self {
1988 Self::new(inner)
1989 }
1990
1991 fn into_channel(self) -> fidl::Channel {
1992 self.client.into_channel()
1993 }
1994
1995 fn as_channel(&self) -> &fidl::Channel {
1996 self.client.as_channel()
1997 }
1998}
1999
2000#[cfg(target_os = "fuchsia")]
2001impl MacAddressingSynchronousProxy {
2002 pub fn new(channel: fidl::Channel) -> Self {
2003 let protocol_name = <MacAddressingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2004 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2005 }
2006
2007 pub fn into_channel(self) -> fidl::Channel {
2008 self.client.into_channel()
2009 }
2010
2011 pub fn wait_for_event(
2014 &self,
2015 deadline: zx::MonotonicInstant,
2016 ) -> Result<MacAddressingEvent, fidl::Error> {
2017 MacAddressingEvent::decode(self.client.wait_for_event(deadline)?)
2018 }
2019
2020 pub fn r#get_unicast_address(
2031 &self,
2032 ___deadline: zx::MonotonicInstant,
2033 ) -> Result<fidl_fuchsia_net::MacAddress, fidl::Error> {
2034 let _response = self
2035 .client
2036 .send_query::<fidl::encoding::EmptyPayload, MacAddressingGetUnicastAddressResponse>(
2037 (),
2038 0x2c60b82a4ecfaebe,
2039 fidl::encoding::DynamicFlags::empty(),
2040 ___deadline,
2041 )?;
2042 Ok(_response.address)
2043 }
2044
2045 pub fn r#set_mode(
2065 &self,
2066 mut mode: MacFilterMode,
2067 ___deadline: zx::MonotonicInstant,
2068 ) -> Result<i32, fidl::Error> {
2069 let _response =
2070 self.client.send_query::<MacAddressingSetModeRequest, MacAddressingSetModeResponse>(
2071 (mode,),
2072 0x6297b8dbf03c58c,
2073 fidl::encoding::DynamicFlags::empty(),
2074 ___deadline,
2075 )?;
2076 Ok(_response.status)
2077 }
2078
2079 pub fn r#add_multicast_address(
2089 &self,
2090 mut address: &fidl_fuchsia_net::MacAddress,
2091 ___deadline: zx::MonotonicInstant,
2092 ) -> Result<i32, fidl::Error> {
2093 let _response = self.client.send_query::<
2094 MacAddressingAddMulticastAddressRequest,
2095 MacAddressingAddMulticastAddressResponse,
2096 >(
2097 (address,),
2098 0xf5637ff11cf0c25,
2099 fidl::encoding::DynamicFlags::empty(),
2100 ___deadline,
2101 )?;
2102 Ok(_response.status)
2103 }
2104
2105 pub fn r#remove_multicast_address(
2111 &self,
2112 mut address: &fidl_fuchsia_net::MacAddress,
2113 ___deadline: zx::MonotonicInstant,
2114 ) -> Result<i32, fidl::Error> {
2115 let _response = self.client.send_query::<
2116 MacAddressingRemoveMulticastAddressRequest,
2117 MacAddressingRemoveMulticastAddressResponse,
2118 >(
2119 (address,),
2120 0x5dddf4e3ba4e2560,
2121 fidl::encoding::DynamicFlags::empty(),
2122 ___deadline,
2123 )?;
2124 Ok(_response.status)
2125 }
2126}
2127
2128#[cfg(target_os = "fuchsia")]
2129impl From<MacAddressingSynchronousProxy> for zx::Handle {
2130 fn from(value: MacAddressingSynchronousProxy) -> Self {
2131 value.into_channel().into()
2132 }
2133}
2134
2135#[cfg(target_os = "fuchsia")]
2136impl From<fidl::Channel> for MacAddressingSynchronousProxy {
2137 fn from(value: fidl::Channel) -> Self {
2138 Self::new(value)
2139 }
2140}
2141
2142#[cfg(target_os = "fuchsia")]
2143impl fidl::endpoints::FromClient for MacAddressingSynchronousProxy {
2144 type Protocol = MacAddressingMarker;
2145
2146 fn from_client(value: fidl::endpoints::ClientEnd<MacAddressingMarker>) -> Self {
2147 Self::new(value.into_channel())
2148 }
2149}
2150
2151#[derive(Debug, Clone)]
2152pub struct MacAddressingProxy {
2153 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2154}
2155
2156impl fidl::endpoints::Proxy for MacAddressingProxy {
2157 type Protocol = MacAddressingMarker;
2158
2159 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2160 Self::new(inner)
2161 }
2162
2163 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2164 self.client.into_channel().map_err(|client| Self { client })
2165 }
2166
2167 fn as_channel(&self) -> &::fidl::AsyncChannel {
2168 self.client.as_channel()
2169 }
2170}
2171
2172impl MacAddressingProxy {
2173 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2175 let protocol_name = <MacAddressingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2176 Self { client: fidl::client::Client::new(channel, protocol_name) }
2177 }
2178
2179 pub fn take_event_stream(&self) -> MacAddressingEventStream {
2185 MacAddressingEventStream { event_receiver: self.client.take_event_receiver() }
2186 }
2187
2188 pub fn r#get_unicast_address(
2199 &self,
2200 ) -> fidl::client::QueryResponseFut<
2201 fidl_fuchsia_net::MacAddress,
2202 fidl::encoding::DefaultFuchsiaResourceDialect,
2203 > {
2204 MacAddressingProxyInterface::r#get_unicast_address(self)
2205 }
2206
2207 pub fn r#set_mode(
2227 &self,
2228 mut mode: MacFilterMode,
2229 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2230 MacAddressingProxyInterface::r#set_mode(self, mode)
2231 }
2232
2233 pub fn r#add_multicast_address(
2243 &self,
2244 mut address: &fidl_fuchsia_net::MacAddress,
2245 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2246 MacAddressingProxyInterface::r#add_multicast_address(self, address)
2247 }
2248
2249 pub fn r#remove_multicast_address(
2255 &self,
2256 mut address: &fidl_fuchsia_net::MacAddress,
2257 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2258 MacAddressingProxyInterface::r#remove_multicast_address(self, address)
2259 }
2260}
2261
2262impl MacAddressingProxyInterface for MacAddressingProxy {
2263 type GetUnicastAddressResponseFut = fidl::client::QueryResponseFut<
2264 fidl_fuchsia_net::MacAddress,
2265 fidl::encoding::DefaultFuchsiaResourceDialect,
2266 >;
2267 fn r#get_unicast_address(&self) -> Self::GetUnicastAddressResponseFut {
2268 fn _decode(
2269 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2270 ) -> Result<fidl_fuchsia_net::MacAddress, fidl::Error> {
2271 let _response = fidl::client::decode_transaction_body::<
2272 MacAddressingGetUnicastAddressResponse,
2273 fidl::encoding::DefaultFuchsiaResourceDialect,
2274 0x2c60b82a4ecfaebe,
2275 >(_buf?)?;
2276 Ok(_response.address)
2277 }
2278 self.client
2279 .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_net::MacAddress>(
2280 (),
2281 0x2c60b82a4ecfaebe,
2282 fidl::encoding::DynamicFlags::empty(),
2283 _decode,
2284 )
2285 }
2286
2287 type SetModeResponseFut =
2288 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2289 fn r#set_mode(&self, mut mode: MacFilterMode) -> Self::SetModeResponseFut {
2290 fn _decode(
2291 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2292 ) -> Result<i32, fidl::Error> {
2293 let _response = fidl::client::decode_transaction_body::<
2294 MacAddressingSetModeResponse,
2295 fidl::encoding::DefaultFuchsiaResourceDialect,
2296 0x6297b8dbf03c58c,
2297 >(_buf?)?;
2298 Ok(_response.status)
2299 }
2300 self.client.send_query_and_decode::<MacAddressingSetModeRequest, i32>(
2301 (mode,),
2302 0x6297b8dbf03c58c,
2303 fidl::encoding::DynamicFlags::empty(),
2304 _decode,
2305 )
2306 }
2307
2308 type AddMulticastAddressResponseFut =
2309 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2310 fn r#add_multicast_address(
2311 &self,
2312 mut address: &fidl_fuchsia_net::MacAddress,
2313 ) -> Self::AddMulticastAddressResponseFut {
2314 fn _decode(
2315 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2316 ) -> Result<i32, fidl::Error> {
2317 let _response = fidl::client::decode_transaction_body::<
2318 MacAddressingAddMulticastAddressResponse,
2319 fidl::encoding::DefaultFuchsiaResourceDialect,
2320 0xf5637ff11cf0c25,
2321 >(_buf?)?;
2322 Ok(_response.status)
2323 }
2324 self.client.send_query_and_decode::<MacAddressingAddMulticastAddressRequest, i32>(
2325 (address,),
2326 0xf5637ff11cf0c25,
2327 fidl::encoding::DynamicFlags::empty(),
2328 _decode,
2329 )
2330 }
2331
2332 type RemoveMulticastAddressResponseFut =
2333 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2334 fn r#remove_multicast_address(
2335 &self,
2336 mut address: &fidl_fuchsia_net::MacAddress,
2337 ) -> Self::RemoveMulticastAddressResponseFut {
2338 fn _decode(
2339 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2340 ) -> Result<i32, fidl::Error> {
2341 let _response = fidl::client::decode_transaction_body::<
2342 MacAddressingRemoveMulticastAddressResponse,
2343 fidl::encoding::DefaultFuchsiaResourceDialect,
2344 0x5dddf4e3ba4e2560,
2345 >(_buf?)?;
2346 Ok(_response.status)
2347 }
2348 self.client.send_query_and_decode::<MacAddressingRemoveMulticastAddressRequest, i32>(
2349 (address,),
2350 0x5dddf4e3ba4e2560,
2351 fidl::encoding::DynamicFlags::empty(),
2352 _decode,
2353 )
2354 }
2355}
2356
2357pub struct MacAddressingEventStream {
2358 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2359}
2360
2361impl std::marker::Unpin for MacAddressingEventStream {}
2362
2363impl futures::stream::FusedStream for MacAddressingEventStream {
2364 fn is_terminated(&self) -> bool {
2365 self.event_receiver.is_terminated()
2366 }
2367}
2368
2369impl futures::Stream for MacAddressingEventStream {
2370 type Item = Result<MacAddressingEvent, fidl::Error>;
2371
2372 fn poll_next(
2373 mut self: std::pin::Pin<&mut Self>,
2374 cx: &mut std::task::Context<'_>,
2375 ) -> std::task::Poll<Option<Self::Item>> {
2376 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2377 &mut self.event_receiver,
2378 cx
2379 )?) {
2380 Some(buf) => std::task::Poll::Ready(Some(MacAddressingEvent::decode(buf))),
2381 None => std::task::Poll::Ready(None),
2382 }
2383 }
2384}
2385
2386#[derive(Debug)]
2387pub enum MacAddressingEvent {}
2388
2389impl MacAddressingEvent {
2390 fn decode(
2392 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2393 ) -> Result<MacAddressingEvent, fidl::Error> {
2394 let (bytes, _handles) = buf.split_mut();
2395 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2396 debug_assert_eq!(tx_header.tx_id, 0);
2397 match tx_header.ordinal {
2398 _ => Err(fidl::Error::UnknownOrdinal {
2399 ordinal: tx_header.ordinal,
2400 protocol_name: <MacAddressingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2401 }),
2402 }
2403 }
2404}
2405
2406pub struct MacAddressingRequestStream {
2408 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2409 is_terminated: bool,
2410}
2411
2412impl std::marker::Unpin for MacAddressingRequestStream {}
2413
2414impl futures::stream::FusedStream for MacAddressingRequestStream {
2415 fn is_terminated(&self) -> bool {
2416 self.is_terminated
2417 }
2418}
2419
2420impl fidl::endpoints::RequestStream for MacAddressingRequestStream {
2421 type Protocol = MacAddressingMarker;
2422 type ControlHandle = MacAddressingControlHandle;
2423
2424 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2425 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2426 }
2427
2428 fn control_handle(&self) -> Self::ControlHandle {
2429 MacAddressingControlHandle { inner: self.inner.clone() }
2430 }
2431
2432 fn into_inner(
2433 self,
2434 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2435 {
2436 (self.inner, self.is_terminated)
2437 }
2438
2439 fn from_inner(
2440 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2441 is_terminated: bool,
2442 ) -> Self {
2443 Self { inner, is_terminated }
2444 }
2445}
2446
2447impl futures::Stream for MacAddressingRequestStream {
2448 type Item = Result<MacAddressingRequest, fidl::Error>;
2449
2450 fn poll_next(
2451 mut self: std::pin::Pin<&mut Self>,
2452 cx: &mut std::task::Context<'_>,
2453 ) -> std::task::Poll<Option<Self::Item>> {
2454 let this = &mut *self;
2455 if this.inner.check_shutdown(cx) {
2456 this.is_terminated = true;
2457 return std::task::Poll::Ready(None);
2458 }
2459 if this.is_terminated {
2460 panic!("polled MacAddressingRequestStream after completion");
2461 }
2462 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2463 |bytes, handles| {
2464 match this.inner.channel().read_etc(cx, bytes, handles) {
2465 std::task::Poll::Ready(Ok(())) => {}
2466 std::task::Poll::Pending => return std::task::Poll::Pending,
2467 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2468 this.is_terminated = true;
2469 return std::task::Poll::Ready(None);
2470 }
2471 std::task::Poll::Ready(Err(e)) => {
2472 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2473 e.into(),
2474 ))))
2475 }
2476 }
2477
2478 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2480
2481 std::task::Poll::Ready(Some(match header.ordinal {
2482 0x2c60b82a4ecfaebe => {
2483 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2484 let mut req = fidl::new_empty!(
2485 fidl::encoding::EmptyPayload,
2486 fidl::encoding::DefaultFuchsiaResourceDialect
2487 );
2488 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2489 let control_handle =
2490 MacAddressingControlHandle { inner: this.inner.clone() };
2491 Ok(MacAddressingRequest::GetUnicastAddress {
2492 responder: MacAddressingGetUnicastAddressResponder {
2493 control_handle: std::mem::ManuallyDrop::new(control_handle),
2494 tx_id: header.tx_id,
2495 },
2496 })
2497 }
2498 0x6297b8dbf03c58c => {
2499 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2500 let mut req = fidl::new_empty!(
2501 MacAddressingSetModeRequest,
2502 fidl::encoding::DefaultFuchsiaResourceDialect
2503 );
2504 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MacAddressingSetModeRequest>(&header, _body_bytes, handles, &mut req)?;
2505 let control_handle =
2506 MacAddressingControlHandle { inner: this.inner.clone() };
2507 Ok(MacAddressingRequest::SetMode {
2508 mode: req.mode,
2509
2510 responder: MacAddressingSetModeResponder {
2511 control_handle: std::mem::ManuallyDrop::new(control_handle),
2512 tx_id: header.tx_id,
2513 },
2514 })
2515 }
2516 0xf5637ff11cf0c25 => {
2517 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2518 let mut req = fidl::new_empty!(
2519 MacAddressingAddMulticastAddressRequest,
2520 fidl::encoding::DefaultFuchsiaResourceDialect
2521 );
2522 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MacAddressingAddMulticastAddressRequest>(&header, _body_bytes, handles, &mut req)?;
2523 let control_handle =
2524 MacAddressingControlHandle { inner: this.inner.clone() };
2525 Ok(MacAddressingRequest::AddMulticastAddress {
2526 address: req.address,
2527
2528 responder: MacAddressingAddMulticastAddressResponder {
2529 control_handle: std::mem::ManuallyDrop::new(control_handle),
2530 tx_id: header.tx_id,
2531 },
2532 })
2533 }
2534 0x5dddf4e3ba4e2560 => {
2535 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2536 let mut req = fidl::new_empty!(
2537 MacAddressingRemoveMulticastAddressRequest,
2538 fidl::encoding::DefaultFuchsiaResourceDialect
2539 );
2540 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MacAddressingRemoveMulticastAddressRequest>(&header, _body_bytes, handles, &mut req)?;
2541 let control_handle =
2542 MacAddressingControlHandle { inner: this.inner.clone() };
2543 Ok(MacAddressingRequest::RemoveMulticastAddress {
2544 address: req.address,
2545
2546 responder: MacAddressingRemoveMulticastAddressResponder {
2547 control_handle: std::mem::ManuallyDrop::new(control_handle),
2548 tx_id: header.tx_id,
2549 },
2550 })
2551 }
2552 _ => Err(fidl::Error::UnknownOrdinal {
2553 ordinal: header.ordinal,
2554 protocol_name:
2555 <MacAddressingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2556 }),
2557 }))
2558 },
2559 )
2560 }
2561}
2562
2563#[derive(Debug)]
2564pub enum MacAddressingRequest {
2565 GetUnicastAddress { responder: MacAddressingGetUnicastAddressResponder },
2576 SetMode { mode: MacFilterMode, responder: MacAddressingSetModeResponder },
2596 AddMulticastAddress {
2606 address: fidl_fuchsia_net::MacAddress,
2607 responder: MacAddressingAddMulticastAddressResponder,
2608 },
2609 RemoveMulticastAddress {
2615 address: fidl_fuchsia_net::MacAddress,
2616 responder: MacAddressingRemoveMulticastAddressResponder,
2617 },
2618}
2619
2620impl MacAddressingRequest {
2621 #[allow(irrefutable_let_patterns)]
2622 pub fn into_get_unicast_address(self) -> Option<(MacAddressingGetUnicastAddressResponder)> {
2623 if let MacAddressingRequest::GetUnicastAddress { responder } = self {
2624 Some((responder))
2625 } else {
2626 None
2627 }
2628 }
2629
2630 #[allow(irrefutable_let_patterns)]
2631 pub fn into_set_mode(self) -> Option<(MacFilterMode, MacAddressingSetModeResponder)> {
2632 if let MacAddressingRequest::SetMode { mode, responder } = self {
2633 Some((mode, responder))
2634 } else {
2635 None
2636 }
2637 }
2638
2639 #[allow(irrefutable_let_patterns)]
2640 pub fn into_add_multicast_address(
2641 self,
2642 ) -> Option<(fidl_fuchsia_net::MacAddress, MacAddressingAddMulticastAddressResponder)> {
2643 if let MacAddressingRequest::AddMulticastAddress { address, responder } = self {
2644 Some((address, responder))
2645 } else {
2646 None
2647 }
2648 }
2649
2650 #[allow(irrefutable_let_patterns)]
2651 pub fn into_remove_multicast_address(
2652 self,
2653 ) -> Option<(fidl_fuchsia_net::MacAddress, MacAddressingRemoveMulticastAddressResponder)> {
2654 if let MacAddressingRequest::RemoveMulticastAddress { address, responder } = self {
2655 Some((address, responder))
2656 } else {
2657 None
2658 }
2659 }
2660
2661 pub fn method_name(&self) -> &'static str {
2663 match *self {
2664 MacAddressingRequest::GetUnicastAddress { .. } => "get_unicast_address",
2665 MacAddressingRequest::SetMode { .. } => "set_mode",
2666 MacAddressingRequest::AddMulticastAddress { .. } => "add_multicast_address",
2667 MacAddressingRequest::RemoveMulticastAddress { .. } => "remove_multicast_address",
2668 }
2669 }
2670}
2671
2672#[derive(Debug, Clone)]
2673pub struct MacAddressingControlHandle {
2674 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2675}
2676
2677impl fidl::endpoints::ControlHandle for MacAddressingControlHandle {
2678 fn shutdown(&self) {
2679 self.inner.shutdown()
2680 }
2681 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2682 self.inner.shutdown_with_epitaph(status)
2683 }
2684
2685 fn is_closed(&self) -> bool {
2686 self.inner.channel().is_closed()
2687 }
2688 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2689 self.inner.channel().on_closed()
2690 }
2691
2692 #[cfg(target_os = "fuchsia")]
2693 fn signal_peer(
2694 &self,
2695 clear_mask: zx::Signals,
2696 set_mask: zx::Signals,
2697 ) -> Result<(), zx_status::Status> {
2698 use fidl::Peered;
2699 self.inner.channel().signal_peer(clear_mask, set_mask)
2700 }
2701}
2702
2703impl MacAddressingControlHandle {}
2704
2705#[must_use = "FIDL methods require a response to be sent"]
2706#[derive(Debug)]
2707pub struct MacAddressingGetUnicastAddressResponder {
2708 control_handle: std::mem::ManuallyDrop<MacAddressingControlHandle>,
2709 tx_id: u32,
2710}
2711
2712impl std::ops::Drop for MacAddressingGetUnicastAddressResponder {
2716 fn drop(&mut self) {
2717 self.control_handle.shutdown();
2718 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2720 }
2721}
2722
2723impl fidl::endpoints::Responder for MacAddressingGetUnicastAddressResponder {
2724 type ControlHandle = MacAddressingControlHandle;
2725
2726 fn control_handle(&self) -> &MacAddressingControlHandle {
2727 &self.control_handle
2728 }
2729
2730 fn drop_without_shutdown(mut self) {
2731 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2733 std::mem::forget(self);
2735 }
2736}
2737
2738impl MacAddressingGetUnicastAddressResponder {
2739 pub fn send(self, mut address: &fidl_fuchsia_net::MacAddress) -> Result<(), fidl::Error> {
2743 let _result = self.send_raw(address);
2744 if _result.is_err() {
2745 self.control_handle.shutdown();
2746 }
2747 self.drop_without_shutdown();
2748 _result
2749 }
2750
2751 pub fn send_no_shutdown_on_err(
2753 self,
2754 mut address: &fidl_fuchsia_net::MacAddress,
2755 ) -> Result<(), fidl::Error> {
2756 let _result = self.send_raw(address);
2757 self.drop_without_shutdown();
2758 _result
2759 }
2760
2761 fn send_raw(&self, mut address: &fidl_fuchsia_net::MacAddress) -> Result<(), fidl::Error> {
2762 self.control_handle.inner.send::<MacAddressingGetUnicastAddressResponse>(
2763 (address,),
2764 self.tx_id,
2765 0x2c60b82a4ecfaebe,
2766 fidl::encoding::DynamicFlags::empty(),
2767 )
2768 }
2769}
2770
2771#[must_use = "FIDL methods require a response to be sent"]
2772#[derive(Debug)]
2773pub struct MacAddressingSetModeResponder {
2774 control_handle: std::mem::ManuallyDrop<MacAddressingControlHandle>,
2775 tx_id: u32,
2776}
2777
2778impl std::ops::Drop for MacAddressingSetModeResponder {
2782 fn drop(&mut self) {
2783 self.control_handle.shutdown();
2784 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2786 }
2787}
2788
2789impl fidl::endpoints::Responder for MacAddressingSetModeResponder {
2790 type ControlHandle = MacAddressingControlHandle;
2791
2792 fn control_handle(&self) -> &MacAddressingControlHandle {
2793 &self.control_handle
2794 }
2795
2796 fn drop_without_shutdown(mut self) {
2797 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2799 std::mem::forget(self);
2801 }
2802}
2803
2804impl MacAddressingSetModeResponder {
2805 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2809 let _result = self.send_raw(status);
2810 if _result.is_err() {
2811 self.control_handle.shutdown();
2812 }
2813 self.drop_without_shutdown();
2814 _result
2815 }
2816
2817 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2819 let _result = self.send_raw(status);
2820 self.drop_without_shutdown();
2821 _result
2822 }
2823
2824 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2825 self.control_handle.inner.send::<MacAddressingSetModeResponse>(
2826 (status,),
2827 self.tx_id,
2828 0x6297b8dbf03c58c,
2829 fidl::encoding::DynamicFlags::empty(),
2830 )
2831 }
2832}
2833
2834#[must_use = "FIDL methods require a response to be sent"]
2835#[derive(Debug)]
2836pub struct MacAddressingAddMulticastAddressResponder {
2837 control_handle: std::mem::ManuallyDrop<MacAddressingControlHandle>,
2838 tx_id: u32,
2839}
2840
2841impl std::ops::Drop for MacAddressingAddMulticastAddressResponder {
2845 fn drop(&mut self) {
2846 self.control_handle.shutdown();
2847 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2849 }
2850}
2851
2852impl fidl::endpoints::Responder for MacAddressingAddMulticastAddressResponder {
2853 type ControlHandle = MacAddressingControlHandle;
2854
2855 fn control_handle(&self) -> &MacAddressingControlHandle {
2856 &self.control_handle
2857 }
2858
2859 fn drop_without_shutdown(mut self) {
2860 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2862 std::mem::forget(self);
2864 }
2865}
2866
2867impl MacAddressingAddMulticastAddressResponder {
2868 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2872 let _result = self.send_raw(status);
2873 if _result.is_err() {
2874 self.control_handle.shutdown();
2875 }
2876 self.drop_without_shutdown();
2877 _result
2878 }
2879
2880 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2882 let _result = self.send_raw(status);
2883 self.drop_without_shutdown();
2884 _result
2885 }
2886
2887 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2888 self.control_handle.inner.send::<MacAddressingAddMulticastAddressResponse>(
2889 (status,),
2890 self.tx_id,
2891 0xf5637ff11cf0c25,
2892 fidl::encoding::DynamicFlags::empty(),
2893 )
2894 }
2895}
2896
2897#[must_use = "FIDL methods require a response to be sent"]
2898#[derive(Debug)]
2899pub struct MacAddressingRemoveMulticastAddressResponder {
2900 control_handle: std::mem::ManuallyDrop<MacAddressingControlHandle>,
2901 tx_id: u32,
2902}
2903
2904impl std::ops::Drop for MacAddressingRemoveMulticastAddressResponder {
2908 fn drop(&mut self) {
2909 self.control_handle.shutdown();
2910 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2912 }
2913}
2914
2915impl fidl::endpoints::Responder for MacAddressingRemoveMulticastAddressResponder {
2916 type ControlHandle = MacAddressingControlHandle;
2917
2918 fn control_handle(&self) -> &MacAddressingControlHandle {
2919 &self.control_handle
2920 }
2921
2922 fn drop_without_shutdown(mut self) {
2923 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2925 std::mem::forget(self);
2927 }
2928}
2929
2930impl MacAddressingRemoveMulticastAddressResponder {
2931 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2935 let _result = self.send_raw(status);
2936 if _result.is_err() {
2937 self.control_handle.shutdown();
2938 }
2939 self.drop_without_shutdown();
2940 _result
2941 }
2942
2943 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2945 let _result = self.send_raw(status);
2946 self.drop_without_shutdown();
2947 _result
2948 }
2949
2950 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2951 self.control_handle.inner.send::<MacAddressingRemoveMulticastAddressResponse>(
2952 (status,),
2953 self.tx_id,
2954 0x5dddf4e3ba4e2560,
2955 fidl::encoding::DynamicFlags::empty(),
2956 )
2957 }
2958}
2959
2960#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2961pub struct PortMarker;
2962
2963impl fidl::endpoints::ProtocolMarker for PortMarker {
2964 type Proxy = PortProxy;
2965 type RequestStream = PortRequestStream;
2966 #[cfg(target_os = "fuchsia")]
2967 type SynchronousProxy = PortSynchronousProxy;
2968
2969 const DEBUG_NAME: &'static str = "(anonymous) Port";
2970}
2971
2972pub trait PortProxyInterface: Send + Sync {
2973 type GetInfoResponseFut: std::future::Future<Output = Result<PortInfo, fidl::Error>> + Send;
2974 fn r#get_info(&self) -> Self::GetInfoResponseFut;
2975 type GetStatusResponseFut: std::future::Future<Output = Result<PortStatus, fidl::Error>> + Send;
2976 fn r#get_status(&self) -> Self::GetStatusResponseFut;
2977 fn r#get_status_watcher(
2978 &self,
2979 watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
2980 buffer: u32,
2981 ) -> Result<(), fidl::Error>;
2982 fn r#get_mac(
2983 &self,
2984 mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
2985 ) -> Result<(), fidl::Error>;
2986 fn r#get_device(
2987 &self,
2988 device: fidl::endpoints::ServerEnd<DeviceMarker>,
2989 ) -> Result<(), fidl::Error>;
2990 fn r#clone(&self, port: fidl::endpoints::ServerEnd<PortMarker>) -> Result<(), fidl::Error>;
2991 type GetCountersResponseFut: std::future::Future<Output = Result<PortGetCountersResponse, fidl::Error>>
2992 + Send;
2993 fn r#get_counters(&self) -> Self::GetCountersResponseFut;
2994 fn r#get_diagnostics(
2995 &self,
2996 diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
2997 ) -> Result<(), fidl::Error>;
2998}
2999#[derive(Debug)]
3000#[cfg(target_os = "fuchsia")]
3001pub struct PortSynchronousProxy {
3002 client: fidl::client::sync::Client,
3003}
3004
3005#[cfg(target_os = "fuchsia")]
3006impl fidl::endpoints::SynchronousProxy for PortSynchronousProxy {
3007 type Proxy = PortProxy;
3008 type Protocol = PortMarker;
3009
3010 fn from_channel(inner: fidl::Channel) -> Self {
3011 Self::new(inner)
3012 }
3013
3014 fn into_channel(self) -> fidl::Channel {
3015 self.client.into_channel()
3016 }
3017
3018 fn as_channel(&self) -> &fidl::Channel {
3019 self.client.as_channel()
3020 }
3021}
3022
3023#[cfg(target_os = "fuchsia")]
3024impl PortSynchronousProxy {
3025 pub fn new(channel: fidl::Channel) -> Self {
3026 let protocol_name = <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3027 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3028 }
3029
3030 pub fn into_channel(self) -> fidl::Channel {
3031 self.client.into_channel()
3032 }
3033
3034 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<PortEvent, fidl::Error> {
3037 PortEvent::decode(self.client.wait_for_event(deadline)?)
3038 }
3039
3040 pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<PortInfo, fidl::Error> {
3044 let _response =
3045 self.client.send_query::<fidl::encoding::EmptyPayload, PortGetInfoResponse>(
3046 (),
3047 0x276cf65feb554ebd,
3048 fidl::encoding::DynamicFlags::empty(),
3049 ___deadline,
3050 )?;
3051 Ok(_response.info)
3052 }
3053
3054 pub fn r#get_status(
3058 &self,
3059 ___deadline: zx::MonotonicInstant,
3060 ) -> Result<PortStatus, fidl::Error> {
3061 let _response =
3062 self.client.send_query::<fidl::encoding::EmptyPayload, PortGetStatusResponse>(
3063 (),
3064 0x4235650aacca60b2,
3065 fidl::encoding::DynamicFlags::empty(),
3066 ___deadline,
3067 )?;
3068 Ok(_response.status)
3069 }
3070
3071 pub fn r#get_status_watcher(
3083 &self,
3084 mut watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3085 mut buffer: u32,
3086 ) -> Result<(), fidl::Error> {
3087 self.client.send::<PortGetStatusWatcherRequest>(
3088 (watcher, buffer),
3089 0x65511ab81c1bd8d4,
3090 fidl::encoding::DynamicFlags::empty(),
3091 )
3092 }
3093
3094 pub fn r#get_mac(
3099 &self,
3100 mut mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3101 ) -> Result<(), fidl::Error> {
3102 self.client.send::<PortGetMacRequest>(
3103 (mac,),
3104 0x2c6ec2988aefc0f6,
3105 fidl::encoding::DynamicFlags::empty(),
3106 )
3107 }
3108
3109 pub fn r#get_device(
3113 &self,
3114 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
3115 ) -> Result<(), fidl::Error> {
3116 self.client.send::<PortGetDeviceRequest>(
3117 (device,),
3118 0x7de34747235d2d80,
3119 fidl::encoding::DynamicFlags::empty(),
3120 )
3121 }
3122
3123 pub fn r#clone(
3127 &self,
3128 mut port: fidl::endpoints::ServerEnd<PortMarker>,
3129 ) -> Result<(), fidl::Error> {
3130 self.client.send::<PortCloneRequest>(
3131 (port,),
3132 0x4e4764150b4942d3,
3133 fidl::encoding::DynamicFlags::empty(),
3134 )
3135 }
3136
3137 pub fn r#get_counters(
3139 &self,
3140 ___deadline: zx::MonotonicInstant,
3141 ) -> Result<PortGetCountersResponse, fidl::Error> {
3142 let _response =
3143 self.client.send_query::<fidl::encoding::EmptyPayload, PortGetCountersResponse>(
3144 (),
3145 0x6a213b03c4fcbbac,
3146 fidl::encoding::DynamicFlags::empty(),
3147 ___deadline,
3148 )?;
3149 Ok(_response)
3150 }
3151
3152 pub fn r#get_diagnostics(
3156 &self,
3157 mut diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3158 ) -> Result<(), fidl::Error> {
3159 self.client.send::<PortGetDiagnosticsRequest>(
3160 (diagnostics,),
3161 0x381faa4ed75e399c,
3162 fidl::encoding::DynamicFlags::empty(),
3163 )
3164 }
3165}
3166
3167#[cfg(target_os = "fuchsia")]
3168impl From<PortSynchronousProxy> for zx::Handle {
3169 fn from(value: PortSynchronousProxy) -> Self {
3170 value.into_channel().into()
3171 }
3172}
3173
3174#[cfg(target_os = "fuchsia")]
3175impl From<fidl::Channel> for PortSynchronousProxy {
3176 fn from(value: fidl::Channel) -> Self {
3177 Self::new(value)
3178 }
3179}
3180
3181#[cfg(target_os = "fuchsia")]
3182impl fidl::endpoints::FromClient for PortSynchronousProxy {
3183 type Protocol = PortMarker;
3184
3185 fn from_client(value: fidl::endpoints::ClientEnd<PortMarker>) -> Self {
3186 Self::new(value.into_channel())
3187 }
3188}
3189
3190#[derive(Debug, Clone)]
3191pub struct PortProxy {
3192 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3193}
3194
3195impl fidl::endpoints::Proxy for PortProxy {
3196 type Protocol = PortMarker;
3197
3198 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3199 Self::new(inner)
3200 }
3201
3202 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3203 self.client.into_channel().map_err(|client| Self { client })
3204 }
3205
3206 fn as_channel(&self) -> &::fidl::AsyncChannel {
3207 self.client.as_channel()
3208 }
3209}
3210
3211impl PortProxy {
3212 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3214 let protocol_name = <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3215 Self { client: fidl::client::Client::new(channel, protocol_name) }
3216 }
3217
3218 pub fn take_event_stream(&self) -> PortEventStream {
3224 PortEventStream { event_receiver: self.client.take_event_receiver() }
3225 }
3226
3227 pub fn r#get_info(
3231 &self,
3232 ) -> fidl::client::QueryResponseFut<PortInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
3233 {
3234 PortProxyInterface::r#get_info(self)
3235 }
3236
3237 pub fn r#get_status(
3241 &self,
3242 ) -> fidl::client::QueryResponseFut<PortStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
3243 {
3244 PortProxyInterface::r#get_status(self)
3245 }
3246
3247 pub fn r#get_status_watcher(
3259 &self,
3260 mut watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3261 mut buffer: u32,
3262 ) -> Result<(), fidl::Error> {
3263 PortProxyInterface::r#get_status_watcher(self, watcher, buffer)
3264 }
3265
3266 pub fn r#get_mac(
3271 &self,
3272 mut mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3273 ) -> Result<(), fidl::Error> {
3274 PortProxyInterface::r#get_mac(self, mac)
3275 }
3276
3277 pub fn r#get_device(
3281 &self,
3282 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
3283 ) -> Result<(), fidl::Error> {
3284 PortProxyInterface::r#get_device(self, device)
3285 }
3286
3287 pub fn r#clone(
3291 &self,
3292 mut port: fidl::endpoints::ServerEnd<PortMarker>,
3293 ) -> Result<(), fidl::Error> {
3294 PortProxyInterface::r#clone(self, port)
3295 }
3296
3297 pub fn r#get_counters(
3299 &self,
3300 ) -> fidl::client::QueryResponseFut<
3301 PortGetCountersResponse,
3302 fidl::encoding::DefaultFuchsiaResourceDialect,
3303 > {
3304 PortProxyInterface::r#get_counters(self)
3305 }
3306
3307 pub fn r#get_diagnostics(
3311 &self,
3312 mut diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3313 ) -> Result<(), fidl::Error> {
3314 PortProxyInterface::r#get_diagnostics(self, diagnostics)
3315 }
3316}
3317
3318impl PortProxyInterface for PortProxy {
3319 type GetInfoResponseFut =
3320 fidl::client::QueryResponseFut<PortInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
3321 fn r#get_info(&self) -> Self::GetInfoResponseFut {
3322 fn _decode(
3323 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3324 ) -> Result<PortInfo, fidl::Error> {
3325 let _response = fidl::client::decode_transaction_body::<
3326 PortGetInfoResponse,
3327 fidl::encoding::DefaultFuchsiaResourceDialect,
3328 0x276cf65feb554ebd,
3329 >(_buf?)?;
3330 Ok(_response.info)
3331 }
3332 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PortInfo>(
3333 (),
3334 0x276cf65feb554ebd,
3335 fidl::encoding::DynamicFlags::empty(),
3336 _decode,
3337 )
3338 }
3339
3340 type GetStatusResponseFut =
3341 fidl::client::QueryResponseFut<PortStatus, fidl::encoding::DefaultFuchsiaResourceDialect>;
3342 fn r#get_status(&self) -> Self::GetStatusResponseFut {
3343 fn _decode(
3344 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3345 ) -> Result<PortStatus, fidl::Error> {
3346 let _response = fidl::client::decode_transaction_body::<
3347 PortGetStatusResponse,
3348 fidl::encoding::DefaultFuchsiaResourceDialect,
3349 0x4235650aacca60b2,
3350 >(_buf?)?;
3351 Ok(_response.status)
3352 }
3353 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PortStatus>(
3354 (),
3355 0x4235650aacca60b2,
3356 fidl::encoding::DynamicFlags::empty(),
3357 _decode,
3358 )
3359 }
3360
3361 fn r#get_status_watcher(
3362 &self,
3363 mut watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3364 mut buffer: u32,
3365 ) -> Result<(), fidl::Error> {
3366 self.client.send::<PortGetStatusWatcherRequest>(
3367 (watcher, buffer),
3368 0x65511ab81c1bd8d4,
3369 fidl::encoding::DynamicFlags::empty(),
3370 )
3371 }
3372
3373 fn r#get_mac(
3374 &self,
3375 mut mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3376 ) -> Result<(), fidl::Error> {
3377 self.client.send::<PortGetMacRequest>(
3378 (mac,),
3379 0x2c6ec2988aefc0f6,
3380 fidl::encoding::DynamicFlags::empty(),
3381 )
3382 }
3383
3384 fn r#get_device(
3385 &self,
3386 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
3387 ) -> Result<(), fidl::Error> {
3388 self.client.send::<PortGetDeviceRequest>(
3389 (device,),
3390 0x7de34747235d2d80,
3391 fidl::encoding::DynamicFlags::empty(),
3392 )
3393 }
3394
3395 fn r#clone(&self, mut port: fidl::endpoints::ServerEnd<PortMarker>) -> Result<(), fidl::Error> {
3396 self.client.send::<PortCloneRequest>(
3397 (port,),
3398 0x4e4764150b4942d3,
3399 fidl::encoding::DynamicFlags::empty(),
3400 )
3401 }
3402
3403 type GetCountersResponseFut = fidl::client::QueryResponseFut<
3404 PortGetCountersResponse,
3405 fidl::encoding::DefaultFuchsiaResourceDialect,
3406 >;
3407 fn r#get_counters(&self) -> Self::GetCountersResponseFut {
3408 fn _decode(
3409 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3410 ) -> Result<PortGetCountersResponse, fidl::Error> {
3411 let _response = fidl::client::decode_transaction_body::<
3412 PortGetCountersResponse,
3413 fidl::encoding::DefaultFuchsiaResourceDialect,
3414 0x6a213b03c4fcbbac,
3415 >(_buf?)?;
3416 Ok(_response)
3417 }
3418 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PortGetCountersResponse>(
3419 (),
3420 0x6a213b03c4fcbbac,
3421 fidl::encoding::DynamicFlags::empty(),
3422 _decode,
3423 )
3424 }
3425
3426 fn r#get_diagnostics(
3427 &self,
3428 mut diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3429 ) -> Result<(), fidl::Error> {
3430 self.client.send::<PortGetDiagnosticsRequest>(
3431 (diagnostics,),
3432 0x381faa4ed75e399c,
3433 fidl::encoding::DynamicFlags::empty(),
3434 )
3435 }
3436}
3437
3438pub struct PortEventStream {
3439 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3440}
3441
3442impl std::marker::Unpin for PortEventStream {}
3443
3444impl futures::stream::FusedStream for PortEventStream {
3445 fn is_terminated(&self) -> bool {
3446 self.event_receiver.is_terminated()
3447 }
3448}
3449
3450impl futures::Stream for PortEventStream {
3451 type Item = Result<PortEvent, fidl::Error>;
3452
3453 fn poll_next(
3454 mut self: std::pin::Pin<&mut Self>,
3455 cx: &mut std::task::Context<'_>,
3456 ) -> std::task::Poll<Option<Self::Item>> {
3457 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3458 &mut self.event_receiver,
3459 cx
3460 )?) {
3461 Some(buf) => std::task::Poll::Ready(Some(PortEvent::decode(buf))),
3462 None => std::task::Poll::Ready(None),
3463 }
3464 }
3465}
3466
3467#[derive(Debug)]
3468pub enum PortEvent {}
3469
3470impl PortEvent {
3471 fn decode(
3473 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3474 ) -> Result<PortEvent, fidl::Error> {
3475 let (bytes, _handles) = buf.split_mut();
3476 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3477 debug_assert_eq!(tx_header.tx_id, 0);
3478 match tx_header.ordinal {
3479 _ => Err(fidl::Error::UnknownOrdinal {
3480 ordinal: tx_header.ordinal,
3481 protocol_name: <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3482 }),
3483 }
3484 }
3485}
3486
3487pub struct PortRequestStream {
3489 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3490 is_terminated: bool,
3491}
3492
3493impl std::marker::Unpin for PortRequestStream {}
3494
3495impl futures::stream::FusedStream for PortRequestStream {
3496 fn is_terminated(&self) -> bool {
3497 self.is_terminated
3498 }
3499}
3500
3501impl fidl::endpoints::RequestStream for PortRequestStream {
3502 type Protocol = PortMarker;
3503 type ControlHandle = PortControlHandle;
3504
3505 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3506 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3507 }
3508
3509 fn control_handle(&self) -> Self::ControlHandle {
3510 PortControlHandle { inner: self.inner.clone() }
3511 }
3512
3513 fn into_inner(
3514 self,
3515 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3516 {
3517 (self.inner, self.is_terminated)
3518 }
3519
3520 fn from_inner(
3521 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3522 is_terminated: bool,
3523 ) -> Self {
3524 Self { inner, is_terminated }
3525 }
3526}
3527
3528impl futures::Stream for PortRequestStream {
3529 type Item = Result<PortRequest, fidl::Error>;
3530
3531 fn poll_next(
3532 mut self: std::pin::Pin<&mut Self>,
3533 cx: &mut std::task::Context<'_>,
3534 ) -> std::task::Poll<Option<Self::Item>> {
3535 let this = &mut *self;
3536 if this.inner.check_shutdown(cx) {
3537 this.is_terminated = true;
3538 return std::task::Poll::Ready(None);
3539 }
3540 if this.is_terminated {
3541 panic!("polled PortRequestStream after completion");
3542 }
3543 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3544 |bytes, handles| {
3545 match this.inner.channel().read_etc(cx, bytes, handles) {
3546 std::task::Poll::Ready(Ok(())) => {}
3547 std::task::Poll::Pending => return std::task::Poll::Pending,
3548 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3549 this.is_terminated = true;
3550 return std::task::Poll::Ready(None);
3551 }
3552 std::task::Poll::Ready(Err(e)) => {
3553 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3554 e.into(),
3555 ))))
3556 }
3557 }
3558
3559 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3561
3562 std::task::Poll::Ready(Some(match header.ordinal {
3563 0x276cf65feb554ebd => {
3564 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3565 let mut req = fidl::new_empty!(
3566 fidl::encoding::EmptyPayload,
3567 fidl::encoding::DefaultFuchsiaResourceDialect
3568 );
3569 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3570 let control_handle = PortControlHandle { inner: this.inner.clone() };
3571 Ok(PortRequest::GetInfo {
3572 responder: PortGetInfoResponder {
3573 control_handle: std::mem::ManuallyDrop::new(control_handle),
3574 tx_id: header.tx_id,
3575 },
3576 })
3577 }
3578 0x4235650aacca60b2 => {
3579 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3580 let mut req = fidl::new_empty!(
3581 fidl::encoding::EmptyPayload,
3582 fidl::encoding::DefaultFuchsiaResourceDialect
3583 );
3584 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3585 let control_handle = PortControlHandle { inner: this.inner.clone() };
3586 Ok(PortRequest::GetStatus {
3587 responder: PortGetStatusResponder {
3588 control_handle: std::mem::ManuallyDrop::new(control_handle),
3589 tx_id: header.tx_id,
3590 },
3591 })
3592 }
3593 0x65511ab81c1bd8d4 => {
3594 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3595 let mut req = fidl::new_empty!(
3596 PortGetStatusWatcherRequest,
3597 fidl::encoding::DefaultFuchsiaResourceDialect
3598 );
3599 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetStatusWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
3600 let control_handle = PortControlHandle { inner: this.inner.clone() };
3601 Ok(PortRequest::GetStatusWatcher {
3602 watcher: req.watcher,
3603 buffer: req.buffer,
3604
3605 control_handle,
3606 })
3607 }
3608 0x2c6ec2988aefc0f6 => {
3609 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3610 let mut req = fidl::new_empty!(
3611 PortGetMacRequest,
3612 fidl::encoding::DefaultFuchsiaResourceDialect
3613 );
3614 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetMacRequest>(&header, _body_bytes, handles, &mut req)?;
3615 let control_handle = PortControlHandle { inner: this.inner.clone() };
3616 Ok(PortRequest::GetMac { mac: req.mac, control_handle })
3617 }
3618 0x7de34747235d2d80 => {
3619 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3620 let mut req = fidl::new_empty!(
3621 PortGetDeviceRequest,
3622 fidl::encoding::DefaultFuchsiaResourceDialect
3623 );
3624 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
3625 let control_handle = PortControlHandle { inner: this.inner.clone() };
3626 Ok(PortRequest::GetDevice { device: req.device, control_handle })
3627 }
3628 0x4e4764150b4942d3 => {
3629 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3630 let mut req = fidl::new_empty!(
3631 PortCloneRequest,
3632 fidl::encoding::DefaultFuchsiaResourceDialect
3633 );
3634 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortCloneRequest>(&header, _body_bytes, handles, &mut req)?;
3635 let control_handle = PortControlHandle { inner: this.inner.clone() };
3636 Ok(PortRequest::Clone { port: req.port, control_handle })
3637 }
3638 0x6a213b03c4fcbbac => {
3639 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3640 let mut req = fidl::new_empty!(
3641 fidl::encoding::EmptyPayload,
3642 fidl::encoding::DefaultFuchsiaResourceDialect
3643 );
3644 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3645 let control_handle = PortControlHandle { inner: this.inner.clone() };
3646 Ok(PortRequest::GetCounters {
3647 responder: PortGetCountersResponder {
3648 control_handle: std::mem::ManuallyDrop::new(control_handle),
3649 tx_id: header.tx_id,
3650 },
3651 })
3652 }
3653 0x381faa4ed75e399c => {
3654 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3655 let mut req = fidl::new_empty!(
3656 PortGetDiagnosticsRequest,
3657 fidl::encoding::DefaultFuchsiaResourceDialect
3658 );
3659 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetDiagnosticsRequest>(&header, _body_bytes, handles, &mut req)?;
3660 let control_handle = PortControlHandle { inner: this.inner.clone() };
3661 Ok(PortRequest::GetDiagnostics {
3662 diagnostics: req.diagnostics,
3663
3664 control_handle,
3665 })
3666 }
3667 _ => Err(fidl::Error::UnknownOrdinal {
3668 ordinal: header.ordinal,
3669 protocol_name: <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3670 }),
3671 }))
3672 },
3673 )
3674 }
3675}
3676
3677#[derive(Debug)]
3679pub enum PortRequest {
3680 GetInfo { responder: PortGetInfoResponder },
3684 GetStatus { responder: PortGetStatusResponder },
3688 GetStatusWatcher {
3700 watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3701 buffer: u32,
3702 control_handle: PortControlHandle,
3703 },
3704 GetMac {
3709 mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3710 control_handle: PortControlHandle,
3711 },
3712 GetDevice {
3716 device: fidl::endpoints::ServerEnd<DeviceMarker>,
3717 control_handle: PortControlHandle,
3718 },
3719 Clone { port: fidl::endpoints::ServerEnd<PortMarker>, control_handle: PortControlHandle },
3723 GetCounters { responder: PortGetCountersResponder },
3725 GetDiagnostics {
3729 diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3730 control_handle: PortControlHandle,
3731 },
3732}
3733
3734impl PortRequest {
3735 #[allow(irrefutable_let_patterns)]
3736 pub fn into_get_info(self) -> Option<(PortGetInfoResponder)> {
3737 if let PortRequest::GetInfo { responder } = self {
3738 Some((responder))
3739 } else {
3740 None
3741 }
3742 }
3743
3744 #[allow(irrefutable_let_patterns)]
3745 pub fn into_get_status(self) -> Option<(PortGetStatusResponder)> {
3746 if let PortRequest::GetStatus { responder } = self {
3747 Some((responder))
3748 } else {
3749 None
3750 }
3751 }
3752
3753 #[allow(irrefutable_let_patterns)]
3754 pub fn into_get_status_watcher(
3755 self,
3756 ) -> Option<(fidl::endpoints::ServerEnd<StatusWatcherMarker>, u32, PortControlHandle)> {
3757 if let PortRequest::GetStatusWatcher { watcher, buffer, control_handle } = self {
3758 Some((watcher, buffer, control_handle))
3759 } else {
3760 None
3761 }
3762 }
3763
3764 #[allow(irrefutable_let_patterns)]
3765 pub fn into_get_mac(
3766 self,
3767 ) -> Option<(fidl::endpoints::ServerEnd<MacAddressingMarker>, PortControlHandle)> {
3768 if let PortRequest::GetMac { mac, control_handle } = self {
3769 Some((mac, control_handle))
3770 } else {
3771 None
3772 }
3773 }
3774
3775 #[allow(irrefutable_let_patterns)]
3776 pub fn into_get_device(
3777 self,
3778 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, PortControlHandle)> {
3779 if let PortRequest::GetDevice { device, control_handle } = self {
3780 Some((device, control_handle))
3781 } else {
3782 None
3783 }
3784 }
3785
3786 #[allow(irrefutable_let_patterns)]
3787 pub fn into_clone(self) -> Option<(fidl::endpoints::ServerEnd<PortMarker>, PortControlHandle)> {
3788 if let PortRequest::Clone { port, control_handle } = self {
3789 Some((port, control_handle))
3790 } else {
3791 None
3792 }
3793 }
3794
3795 #[allow(irrefutable_let_patterns)]
3796 pub fn into_get_counters(self) -> Option<(PortGetCountersResponder)> {
3797 if let PortRequest::GetCounters { responder } = self {
3798 Some((responder))
3799 } else {
3800 None
3801 }
3802 }
3803
3804 #[allow(irrefutable_let_patterns)]
3805 pub fn into_get_diagnostics(
3806 self,
3807 ) -> Option<(fidl::endpoints::ServerEnd<DiagnosticsMarker>, PortControlHandle)> {
3808 if let PortRequest::GetDiagnostics { diagnostics, control_handle } = self {
3809 Some((diagnostics, control_handle))
3810 } else {
3811 None
3812 }
3813 }
3814
3815 pub fn method_name(&self) -> &'static str {
3817 match *self {
3818 PortRequest::GetInfo { .. } => "get_info",
3819 PortRequest::GetStatus { .. } => "get_status",
3820 PortRequest::GetStatusWatcher { .. } => "get_status_watcher",
3821 PortRequest::GetMac { .. } => "get_mac",
3822 PortRequest::GetDevice { .. } => "get_device",
3823 PortRequest::Clone { .. } => "clone",
3824 PortRequest::GetCounters { .. } => "get_counters",
3825 PortRequest::GetDiagnostics { .. } => "get_diagnostics",
3826 }
3827 }
3828}
3829
3830#[derive(Debug, Clone)]
3831pub struct PortControlHandle {
3832 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3833}
3834
3835impl fidl::endpoints::ControlHandle for PortControlHandle {
3836 fn shutdown(&self) {
3837 self.inner.shutdown()
3838 }
3839 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3840 self.inner.shutdown_with_epitaph(status)
3841 }
3842
3843 fn is_closed(&self) -> bool {
3844 self.inner.channel().is_closed()
3845 }
3846 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3847 self.inner.channel().on_closed()
3848 }
3849
3850 #[cfg(target_os = "fuchsia")]
3851 fn signal_peer(
3852 &self,
3853 clear_mask: zx::Signals,
3854 set_mask: zx::Signals,
3855 ) -> Result<(), zx_status::Status> {
3856 use fidl::Peered;
3857 self.inner.channel().signal_peer(clear_mask, set_mask)
3858 }
3859}
3860
3861impl PortControlHandle {}
3862
3863#[must_use = "FIDL methods require a response to be sent"]
3864#[derive(Debug)]
3865pub struct PortGetInfoResponder {
3866 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
3867 tx_id: u32,
3868}
3869
3870impl std::ops::Drop for PortGetInfoResponder {
3874 fn drop(&mut self) {
3875 self.control_handle.shutdown();
3876 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3878 }
3879}
3880
3881impl fidl::endpoints::Responder for PortGetInfoResponder {
3882 type ControlHandle = PortControlHandle;
3883
3884 fn control_handle(&self) -> &PortControlHandle {
3885 &self.control_handle
3886 }
3887
3888 fn drop_without_shutdown(mut self) {
3889 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3891 std::mem::forget(self);
3893 }
3894}
3895
3896impl PortGetInfoResponder {
3897 pub fn send(self, mut info: &PortInfo) -> Result<(), fidl::Error> {
3901 let _result = self.send_raw(info);
3902 if _result.is_err() {
3903 self.control_handle.shutdown();
3904 }
3905 self.drop_without_shutdown();
3906 _result
3907 }
3908
3909 pub fn send_no_shutdown_on_err(self, mut info: &PortInfo) -> Result<(), fidl::Error> {
3911 let _result = self.send_raw(info);
3912 self.drop_without_shutdown();
3913 _result
3914 }
3915
3916 fn send_raw(&self, mut info: &PortInfo) -> Result<(), fidl::Error> {
3917 self.control_handle.inner.send::<PortGetInfoResponse>(
3918 (info,),
3919 self.tx_id,
3920 0x276cf65feb554ebd,
3921 fidl::encoding::DynamicFlags::empty(),
3922 )
3923 }
3924}
3925
3926#[must_use = "FIDL methods require a response to be sent"]
3927#[derive(Debug)]
3928pub struct PortGetStatusResponder {
3929 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
3930 tx_id: u32,
3931}
3932
3933impl std::ops::Drop for PortGetStatusResponder {
3937 fn drop(&mut self) {
3938 self.control_handle.shutdown();
3939 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3941 }
3942}
3943
3944impl fidl::endpoints::Responder for PortGetStatusResponder {
3945 type ControlHandle = PortControlHandle;
3946
3947 fn control_handle(&self) -> &PortControlHandle {
3948 &self.control_handle
3949 }
3950
3951 fn drop_without_shutdown(mut self) {
3952 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3954 std::mem::forget(self);
3956 }
3957}
3958
3959impl PortGetStatusResponder {
3960 pub fn send(self, mut status: &PortStatus) -> Result<(), fidl::Error> {
3964 let _result = self.send_raw(status);
3965 if _result.is_err() {
3966 self.control_handle.shutdown();
3967 }
3968 self.drop_without_shutdown();
3969 _result
3970 }
3971
3972 pub fn send_no_shutdown_on_err(self, mut status: &PortStatus) -> Result<(), fidl::Error> {
3974 let _result = self.send_raw(status);
3975 self.drop_without_shutdown();
3976 _result
3977 }
3978
3979 fn send_raw(&self, mut status: &PortStatus) -> Result<(), fidl::Error> {
3980 self.control_handle.inner.send::<PortGetStatusResponse>(
3981 (status,),
3982 self.tx_id,
3983 0x4235650aacca60b2,
3984 fidl::encoding::DynamicFlags::empty(),
3985 )
3986 }
3987}
3988
3989#[must_use = "FIDL methods require a response to be sent"]
3990#[derive(Debug)]
3991pub struct PortGetCountersResponder {
3992 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
3993 tx_id: u32,
3994}
3995
3996impl std::ops::Drop for PortGetCountersResponder {
4000 fn drop(&mut self) {
4001 self.control_handle.shutdown();
4002 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4004 }
4005}
4006
4007impl fidl::endpoints::Responder for PortGetCountersResponder {
4008 type ControlHandle = PortControlHandle;
4009
4010 fn control_handle(&self) -> &PortControlHandle {
4011 &self.control_handle
4012 }
4013
4014 fn drop_without_shutdown(mut self) {
4015 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4017 std::mem::forget(self);
4019 }
4020}
4021
4022impl PortGetCountersResponder {
4023 pub fn send(self, mut payload: &PortGetCountersResponse) -> Result<(), fidl::Error> {
4027 let _result = self.send_raw(payload);
4028 if _result.is_err() {
4029 self.control_handle.shutdown();
4030 }
4031 self.drop_without_shutdown();
4032 _result
4033 }
4034
4035 pub fn send_no_shutdown_on_err(
4037 self,
4038 mut payload: &PortGetCountersResponse,
4039 ) -> Result<(), fidl::Error> {
4040 let _result = self.send_raw(payload);
4041 self.drop_without_shutdown();
4042 _result
4043 }
4044
4045 fn send_raw(&self, mut payload: &PortGetCountersResponse) -> Result<(), fidl::Error> {
4046 self.control_handle.inner.send::<PortGetCountersResponse>(
4047 payload,
4048 self.tx_id,
4049 0x6a213b03c4fcbbac,
4050 fidl::encoding::DynamicFlags::empty(),
4051 )
4052 }
4053}
4054
4055#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4056pub struct PortWatcherMarker;
4057
4058impl fidl::endpoints::ProtocolMarker for PortWatcherMarker {
4059 type Proxy = PortWatcherProxy;
4060 type RequestStream = PortWatcherRequestStream;
4061 #[cfg(target_os = "fuchsia")]
4062 type SynchronousProxy = PortWatcherSynchronousProxy;
4063
4064 const DEBUG_NAME: &'static str = "(anonymous) PortWatcher";
4065}
4066
4067pub trait PortWatcherProxyInterface: Send + Sync {
4068 type WatchResponseFut: std::future::Future<Output = Result<DevicePortEvent, fidl::Error>> + Send;
4069 fn r#watch(&self) -> Self::WatchResponseFut;
4070}
4071#[derive(Debug)]
4072#[cfg(target_os = "fuchsia")]
4073pub struct PortWatcherSynchronousProxy {
4074 client: fidl::client::sync::Client,
4075}
4076
4077#[cfg(target_os = "fuchsia")]
4078impl fidl::endpoints::SynchronousProxy for PortWatcherSynchronousProxy {
4079 type Proxy = PortWatcherProxy;
4080 type Protocol = PortWatcherMarker;
4081
4082 fn from_channel(inner: fidl::Channel) -> Self {
4083 Self::new(inner)
4084 }
4085
4086 fn into_channel(self) -> fidl::Channel {
4087 self.client.into_channel()
4088 }
4089
4090 fn as_channel(&self) -> &fidl::Channel {
4091 self.client.as_channel()
4092 }
4093}
4094
4095#[cfg(target_os = "fuchsia")]
4096impl PortWatcherSynchronousProxy {
4097 pub fn new(channel: fidl::Channel) -> Self {
4098 let protocol_name = <PortWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4099 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4100 }
4101
4102 pub fn into_channel(self) -> fidl::Channel {
4103 self.client.into_channel()
4104 }
4105
4106 pub fn wait_for_event(
4109 &self,
4110 deadline: zx::MonotonicInstant,
4111 ) -> Result<PortWatcherEvent, fidl::Error> {
4112 PortWatcherEvent::decode(self.client.wait_for_event(deadline)?)
4113 }
4114
4115 pub fn r#watch(
4130 &self,
4131 ___deadline: zx::MonotonicInstant,
4132 ) -> Result<DevicePortEvent, fidl::Error> {
4133 let _response =
4134 self.client.send_query::<fidl::encoding::EmptyPayload, PortWatcherWatchResponse>(
4135 (),
4136 0x3e87244b74fff55e,
4137 fidl::encoding::DynamicFlags::empty(),
4138 ___deadline,
4139 )?;
4140 Ok(_response.event)
4141 }
4142}
4143
4144#[cfg(target_os = "fuchsia")]
4145impl From<PortWatcherSynchronousProxy> for zx::Handle {
4146 fn from(value: PortWatcherSynchronousProxy) -> Self {
4147 value.into_channel().into()
4148 }
4149}
4150
4151#[cfg(target_os = "fuchsia")]
4152impl From<fidl::Channel> for PortWatcherSynchronousProxy {
4153 fn from(value: fidl::Channel) -> Self {
4154 Self::new(value)
4155 }
4156}
4157
4158#[cfg(target_os = "fuchsia")]
4159impl fidl::endpoints::FromClient for PortWatcherSynchronousProxy {
4160 type Protocol = PortWatcherMarker;
4161
4162 fn from_client(value: fidl::endpoints::ClientEnd<PortWatcherMarker>) -> Self {
4163 Self::new(value.into_channel())
4164 }
4165}
4166
4167#[derive(Debug, Clone)]
4168pub struct PortWatcherProxy {
4169 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4170}
4171
4172impl fidl::endpoints::Proxy for PortWatcherProxy {
4173 type Protocol = PortWatcherMarker;
4174
4175 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4176 Self::new(inner)
4177 }
4178
4179 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4180 self.client.into_channel().map_err(|client| Self { client })
4181 }
4182
4183 fn as_channel(&self) -> &::fidl::AsyncChannel {
4184 self.client.as_channel()
4185 }
4186}
4187
4188impl PortWatcherProxy {
4189 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4191 let protocol_name = <PortWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4192 Self { client: fidl::client::Client::new(channel, protocol_name) }
4193 }
4194
4195 pub fn take_event_stream(&self) -> PortWatcherEventStream {
4201 PortWatcherEventStream { event_receiver: self.client.take_event_receiver() }
4202 }
4203
4204 pub fn r#watch(
4219 &self,
4220 ) -> fidl::client::QueryResponseFut<
4221 DevicePortEvent,
4222 fidl::encoding::DefaultFuchsiaResourceDialect,
4223 > {
4224 PortWatcherProxyInterface::r#watch(self)
4225 }
4226}
4227
4228impl PortWatcherProxyInterface for PortWatcherProxy {
4229 type WatchResponseFut = fidl::client::QueryResponseFut<
4230 DevicePortEvent,
4231 fidl::encoding::DefaultFuchsiaResourceDialect,
4232 >;
4233 fn r#watch(&self) -> Self::WatchResponseFut {
4234 fn _decode(
4235 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4236 ) -> Result<DevicePortEvent, fidl::Error> {
4237 let _response = fidl::client::decode_transaction_body::<
4238 PortWatcherWatchResponse,
4239 fidl::encoding::DefaultFuchsiaResourceDialect,
4240 0x3e87244b74fff55e,
4241 >(_buf?)?;
4242 Ok(_response.event)
4243 }
4244 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DevicePortEvent>(
4245 (),
4246 0x3e87244b74fff55e,
4247 fidl::encoding::DynamicFlags::empty(),
4248 _decode,
4249 )
4250 }
4251}
4252
4253pub struct PortWatcherEventStream {
4254 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4255}
4256
4257impl std::marker::Unpin for PortWatcherEventStream {}
4258
4259impl futures::stream::FusedStream for PortWatcherEventStream {
4260 fn is_terminated(&self) -> bool {
4261 self.event_receiver.is_terminated()
4262 }
4263}
4264
4265impl futures::Stream for PortWatcherEventStream {
4266 type Item = Result<PortWatcherEvent, fidl::Error>;
4267
4268 fn poll_next(
4269 mut self: std::pin::Pin<&mut Self>,
4270 cx: &mut std::task::Context<'_>,
4271 ) -> std::task::Poll<Option<Self::Item>> {
4272 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4273 &mut self.event_receiver,
4274 cx
4275 )?) {
4276 Some(buf) => std::task::Poll::Ready(Some(PortWatcherEvent::decode(buf))),
4277 None => std::task::Poll::Ready(None),
4278 }
4279 }
4280}
4281
4282#[derive(Debug)]
4283pub enum PortWatcherEvent {}
4284
4285impl PortWatcherEvent {
4286 fn decode(
4288 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4289 ) -> Result<PortWatcherEvent, fidl::Error> {
4290 let (bytes, _handles) = buf.split_mut();
4291 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4292 debug_assert_eq!(tx_header.tx_id, 0);
4293 match tx_header.ordinal {
4294 _ => Err(fidl::Error::UnknownOrdinal {
4295 ordinal: tx_header.ordinal,
4296 protocol_name: <PortWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4297 }),
4298 }
4299 }
4300}
4301
4302pub struct PortWatcherRequestStream {
4304 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4305 is_terminated: bool,
4306}
4307
4308impl std::marker::Unpin for PortWatcherRequestStream {}
4309
4310impl futures::stream::FusedStream for PortWatcherRequestStream {
4311 fn is_terminated(&self) -> bool {
4312 self.is_terminated
4313 }
4314}
4315
4316impl fidl::endpoints::RequestStream for PortWatcherRequestStream {
4317 type Protocol = PortWatcherMarker;
4318 type ControlHandle = PortWatcherControlHandle;
4319
4320 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4321 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4322 }
4323
4324 fn control_handle(&self) -> Self::ControlHandle {
4325 PortWatcherControlHandle { inner: self.inner.clone() }
4326 }
4327
4328 fn into_inner(
4329 self,
4330 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4331 {
4332 (self.inner, self.is_terminated)
4333 }
4334
4335 fn from_inner(
4336 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4337 is_terminated: bool,
4338 ) -> Self {
4339 Self { inner, is_terminated }
4340 }
4341}
4342
4343impl futures::Stream for PortWatcherRequestStream {
4344 type Item = Result<PortWatcherRequest, fidl::Error>;
4345
4346 fn poll_next(
4347 mut self: std::pin::Pin<&mut Self>,
4348 cx: &mut std::task::Context<'_>,
4349 ) -> std::task::Poll<Option<Self::Item>> {
4350 let this = &mut *self;
4351 if this.inner.check_shutdown(cx) {
4352 this.is_terminated = true;
4353 return std::task::Poll::Ready(None);
4354 }
4355 if this.is_terminated {
4356 panic!("polled PortWatcherRequestStream after completion");
4357 }
4358 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4359 |bytes, handles| {
4360 match this.inner.channel().read_etc(cx, bytes, handles) {
4361 std::task::Poll::Ready(Ok(())) => {}
4362 std::task::Poll::Pending => return std::task::Poll::Pending,
4363 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4364 this.is_terminated = true;
4365 return std::task::Poll::Ready(None);
4366 }
4367 std::task::Poll::Ready(Err(e)) => {
4368 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4369 e.into(),
4370 ))))
4371 }
4372 }
4373
4374 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4376
4377 std::task::Poll::Ready(Some(match header.ordinal {
4378 0x3e87244b74fff55e => {
4379 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4380 let mut req = fidl::new_empty!(
4381 fidl::encoding::EmptyPayload,
4382 fidl::encoding::DefaultFuchsiaResourceDialect
4383 );
4384 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4385 let control_handle = PortWatcherControlHandle { inner: this.inner.clone() };
4386 Ok(PortWatcherRequest::Watch {
4387 responder: PortWatcherWatchResponder {
4388 control_handle: std::mem::ManuallyDrop::new(control_handle),
4389 tx_id: header.tx_id,
4390 },
4391 })
4392 }
4393 _ => Err(fidl::Error::UnknownOrdinal {
4394 ordinal: header.ordinal,
4395 protocol_name:
4396 <PortWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4397 }),
4398 }))
4399 },
4400 )
4401 }
4402}
4403
4404#[derive(Debug)]
4406pub enum PortWatcherRequest {
4407 Watch { responder: PortWatcherWatchResponder },
4422}
4423
4424impl PortWatcherRequest {
4425 #[allow(irrefutable_let_patterns)]
4426 pub fn into_watch(self) -> Option<(PortWatcherWatchResponder)> {
4427 if let PortWatcherRequest::Watch { responder } = self {
4428 Some((responder))
4429 } else {
4430 None
4431 }
4432 }
4433
4434 pub fn method_name(&self) -> &'static str {
4436 match *self {
4437 PortWatcherRequest::Watch { .. } => "watch",
4438 }
4439 }
4440}
4441
4442#[derive(Debug, Clone)]
4443pub struct PortWatcherControlHandle {
4444 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4445}
4446
4447impl fidl::endpoints::ControlHandle for PortWatcherControlHandle {
4448 fn shutdown(&self) {
4449 self.inner.shutdown()
4450 }
4451 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4452 self.inner.shutdown_with_epitaph(status)
4453 }
4454
4455 fn is_closed(&self) -> bool {
4456 self.inner.channel().is_closed()
4457 }
4458 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4459 self.inner.channel().on_closed()
4460 }
4461
4462 #[cfg(target_os = "fuchsia")]
4463 fn signal_peer(
4464 &self,
4465 clear_mask: zx::Signals,
4466 set_mask: zx::Signals,
4467 ) -> Result<(), zx_status::Status> {
4468 use fidl::Peered;
4469 self.inner.channel().signal_peer(clear_mask, set_mask)
4470 }
4471}
4472
4473impl PortWatcherControlHandle {}
4474
4475#[must_use = "FIDL methods require a response to be sent"]
4476#[derive(Debug)]
4477pub struct PortWatcherWatchResponder {
4478 control_handle: std::mem::ManuallyDrop<PortWatcherControlHandle>,
4479 tx_id: u32,
4480}
4481
4482impl std::ops::Drop for PortWatcherWatchResponder {
4486 fn drop(&mut self) {
4487 self.control_handle.shutdown();
4488 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4490 }
4491}
4492
4493impl fidl::endpoints::Responder for PortWatcherWatchResponder {
4494 type ControlHandle = PortWatcherControlHandle;
4495
4496 fn control_handle(&self) -> &PortWatcherControlHandle {
4497 &self.control_handle
4498 }
4499
4500 fn drop_without_shutdown(mut self) {
4501 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4503 std::mem::forget(self);
4505 }
4506}
4507
4508impl PortWatcherWatchResponder {
4509 pub fn send(self, mut event: &DevicePortEvent) -> Result<(), fidl::Error> {
4513 let _result = self.send_raw(event);
4514 if _result.is_err() {
4515 self.control_handle.shutdown();
4516 }
4517 self.drop_without_shutdown();
4518 _result
4519 }
4520
4521 pub fn send_no_shutdown_on_err(self, mut event: &DevicePortEvent) -> Result<(), fidl::Error> {
4523 let _result = self.send_raw(event);
4524 self.drop_without_shutdown();
4525 _result
4526 }
4527
4528 fn send_raw(&self, mut event: &DevicePortEvent) -> Result<(), fidl::Error> {
4529 self.control_handle.inner.send::<PortWatcherWatchResponse>(
4530 (event,),
4531 self.tx_id,
4532 0x3e87244b74fff55e,
4533 fidl::encoding::DynamicFlags::empty(),
4534 )
4535 }
4536}
4537
4538#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4539pub struct SessionMarker;
4540
4541impl fidl::endpoints::ProtocolMarker for SessionMarker {
4542 type Proxy = SessionProxy;
4543 type RequestStream = SessionRequestStream;
4544 #[cfg(target_os = "fuchsia")]
4545 type SynchronousProxy = SessionSynchronousProxy;
4546
4547 const DEBUG_NAME: &'static str = "(anonymous) Session";
4548}
4549pub type SessionAttachResult = Result<(), i32>;
4550pub type SessionDetachResult = Result<(), i32>;
4551
4552pub trait SessionProxyInterface: Send + Sync {
4553 type AttachResponseFut: std::future::Future<Output = Result<SessionAttachResult, fidl::Error>>
4554 + Send;
4555 fn r#attach(&self, port: &PortId, rx_frames: &[FrameType]) -> Self::AttachResponseFut;
4556 type DetachResponseFut: std::future::Future<Output = Result<SessionDetachResult, fidl::Error>>
4557 + Send;
4558 fn r#detach(&self, port: &PortId) -> Self::DetachResponseFut;
4559 fn r#close(&self) -> Result<(), fidl::Error>;
4560 type WatchDelegatedRxLeaseResponseFut: std::future::Future<Output = Result<DelegatedRxLease, fidl::Error>>
4561 + Send;
4562 fn r#watch_delegated_rx_lease(&self) -> Self::WatchDelegatedRxLeaseResponseFut;
4563}
4564#[derive(Debug)]
4565#[cfg(target_os = "fuchsia")]
4566pub struct SessionSynchronousProxy {
4567 client: fidl::client::sync::Client,
4568}
4569
4570#[cfg(target_os = "fuchsia")]
4571impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
4572 type Proxy = SessionProxy;
4573 type Protocol = SessionMarker;
4574
4575 fn from_channel(inner: fidl::Channel) -> Self {
4576 Self::new(inner)
4577 }
4578
4579 fn into_channel(self) -> fidl::Channel {
4580 self.client.into_channel()
4581 }
4582
4583 fn as_channel(&self) -> &fidl::Channel {
4584 self.client.as_channel()
4585 }
4586}
4587
4588#[cfg(target_os = "fuchsia")]
4589impl SessionSynchronousProxy {
4590 pub fn new(channel: fidl::Channel) -> Self {
4591 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4592 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4593 }
4594
4595 pub fn into_channel(self) -> fidl::Channel {
4596 self.client.into_channel()
4597 }
4598
4599 pub fn wait_for_event(
4602 &self,
4603 deadline: zx::MonotonicInstant,
4604 ) -> Result<SessionEvent, fidl::Error> {
4605 SessionEvent::decode(self.client.wait_for_event(deadline)?)
4606 }
4607
4608 pub fn r#attach(
4620 &self,
4621 mut port: &PortId,
4622 mut rx_frames: &[FrameType],
4623 ___deadline: zx::MonotonicInstant,
4624 ) -> Result<SessionAttachResult, fidl::Error> {
4625 let _response = self.client.send_query::<
4626 SessionAttachRequest,
4627 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4628 >(
4629 (port, rx_frames,),
4630 0x1e89c9013e201379,
4631 fidl::encoding::DynamicFlags::empty(),
4632 ___deadline,
4633 )?;
4634 Ok(_response.map(|x| x))
4635 }
4636
4637 pub fn r#detach(
4648 &self,
4649 mut port: &PortId,
4650 ___deadline: zx::MonotonicInstant,
4651 ) -> Result<SessionDetachResult, fidl::Error> {
4652 let _response = self.client.send_query::<
4653 SessionDetachRequest,
4654 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4655 >(
4656 (port,),
4657 0x68c40cf8fb549867,
4658 fidl::encoding::DynamicFlags::empty(),
4659 ___deadline,
4660 )?;
4661 Ok(_response.map(|x| x))
4662 }
4663
4664 pub fn r#close(&self) -> Result<(), fidl::Error> {
4672 self.client.send::<fidl::encoding::EmptyPayload>(
4673 (),
4674 0x393d5070394a92f6,
4675 fidl::encoding::DynamicFlags::empty(),
4676 )
4677 }
4678
4679 pub fn r#watch_delegated_rx_lease(
4694 &self,
4695 ___deadline: zx::MonotonicInstant,
4696 ) -> Result<DelegatedRxLease, fidl::Error> {
4697 let _response = self
4698 .client
4699 .send_query::<fidl::encoding::EmptyPayload, SessionWatchDelegatedRxLeaseResponse>(
4700 (),
4701 0x764d823ee64803b5,
4702 fidl::encoding::DynamicFlags::empty(),
4703 ___deadline,
4704 )?;
4705 Ok(_response.lease)
4706 }
4707}
4708
4709#[cfg(target_os = "fuchsia")]
4710impl From<SessionSynchronousProxy> for zx::Handle {
4711 fn from(value: SessionSynchronousProxy) -> Self {
4712 value.into_channel().into()
4713 }
4714}
4715
4716#[cfg(target_os = "fuchsia")]
4717impl From<fidl::Channel> for SessionSynchronousProxy {
4718 fn from(value: fidl::Channel) -> Self {
4719 Self::new(value)
4720 }
4721}
4722
4723#[cfg(target_os = "fuchsia")]
4724impl fidl::endpoints::FromClient for SessionSynchronousProxy {
4725 type Protocol = SessionMarker;
4726
4727 fn from_client(value: fidl::endpoints::ClientEnd<SessionMarker>) -> Self {
4728 Self::new(value.into_channel())
4729 }
4730}
4731
4732#[derive(Debug, Clone)]
4733pub struct SessionProxy {
4734 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4735}
4736
4737impl fidl::endpoints::Proxy for SessionProxy {
4738 type Protocol = SessionMarker;
4739
4740 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4741 Self::new(inner)
4742 }
4743
4744 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4745 self.client.into_channel().map_err(|client| Self { client })
4746 }
4747
4748 fn as_channel(&self) -> &::fidl::AsyncChannel {
4749 self.client.as_channel()
4750 }
4751}
4752
4753impl SessionProxy {
4754 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4756 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4757 Self { client: fidl::client::Client::new(channel, protocol_name) }
4758 }
4759
4760 pub fn take_event_stream(&self) -> SessionEventStream {
4766 SessionEventStream { event_receiver: self.client.take_event_receiver() }
4767 }
4768
4769 pub fn r#attach(
4781 &self,
4782 mut port: &PortId,
4783 mut rx_frames: &[FrameType],
4784 ) -> fidl::client::QueryResponseFut<
4785 SessionAttachResult,
4786 fidl::encoding::DefaultFuchsiaResourceDialect,
4787 > {
4788 SessionProxyInterface::r#attach(self, port, rx_frames)
4789 }
4790
4791 pub fn r#detach(
4802 &self,
4803 mut port: &PortId,
4804 ) -> fidl::client::QueryResponseFut<
4805 SessionDetachResult,
4806 fidl::encoding::DefaultFuchsiaResourceDialect,
4807 > {
4808 SessionProxyInterface::r#detach(self, port)
4809 }
4810
4811 pub fn r#close(&self) -> Result<(), fidl::Error> {
4819 SessionProxyInterface::r#close(self)
4820 }
4821
4822 pub fn r#watch_delegated_rx_lease(
4837 &self,
4838 ) -> fidl::client::QueryResponseFut<
4839 DelegatedRxLease,
4840 fidl::encoding::DefaultFuchsiaResourceDialect,
4841 > {
4842 SessionProxyInterface::r#watch_delegated_rx_lease(self)
4843 }
4844}
4845
4846impl SessionProxyInterface for SessionProxy {
4847 type AttachResponseFut = fidl::client::QueryResponseFut<
4848 SessionAttachResult,
4849 fidl::encoding::DefaultFuchsiaResourceDialect,
4850 >;
4851 fn r#attach(&self, mut port: &PortId, mut rx_frames: &[FrameType]) -> Self::AttachResponseFut {
4852 fn _decode(
4853 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4854 ) -> Result<SessionAttachResult, fidl::Error> {
4855 let _response = fidl::client::decode_transaction_body::<
4856 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4857 fidl::encoding::DefaultFuchsiaResourceDialect,
4858 0x1e89c9013e201379,
4859 >(_buf?)?;
4860 Ok(_response.map(|x| x))
4861 }
4862 self.client.send_query_and_decode::<SessionAttachRequest, SessionAttachResult>(
4863 (port, rx_frames),
4864 0x1e89c9013e201379,
4865 fidl::encoding::DynamicFlags::empty(),
4866 _decode,
4867 )
4868 }
4869
4870 type DetachResponseFut = fidl::client::QueryResponseFut<
4871 SessionDetachResult,
4872 fidl::encoding::DefaultFuchsiaResourceDialect,
4873 >;
4874 fn r#detach(&self, mut port: &PortId) -> Self::DetachResponseFut {
4875 fn _decode(
4876 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4877 ) -> Result<SessionDetachResult, fidl::Error> {
4878 let _response = fidl::client::decode_transaction_body::<
4879 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4880 fidl::encoding::DefaultFuchsiaResourceDialect,
4881 0x68c40cf8fb549867,
4882 >(_buf?)?;
4883 Ok(_response.map(|x| x))
4884 }
4885 self.client.send_query_and_decode::<SessionDetachRequest, SessionDetachResult>(
4886 (port,),
4887 0x68c40cf8fb549867,
4888 fidl::encoding::DynamicFlags::empty(),
4889 _decode,
4890 )
4891 }
4892
4893 fn r#close(&self) -> Result<(), fidl::Error> {
4894 self.client.send::<fidl::encoding::EmptyPayload>(
4895 (),
4896 0x393d5070394a92f6,
4897 fidl::encoding::DynamicFlags::empty(),
4898 )
4899 }
4900
4901 type WatchDelegatedRxLeaseResponseFut = fidl::client::QueryResponseFut<
4902 DelegatedRxLease,
4903 fidl::encoding::DefaultFuchsiaResourceDialect,
4904 >;
4905 fn r#watch_delegated_rx_lease(&self) -> Self::WatchDelegatedRxLeaseResponseFut {
4906 fn _decode(
4907 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4908 ) -> Result<DelegatedRxLease, fidl::Error> {
4909 let _response = fidl::client::decode_transaction_body::<
4910 SessionWatchDelegatedRxLeaseResponse,
4911 fidl::encoding::DefaultFuchsiaResourceDialect,
4912 0x764d823ee64803b5,
4913 >(_buf?)?;
4914 Ok(_response.lease)
4915 }
4916 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelegatedRxLease>(
4917 (),
4918 0x764d823ee64803b5,
4919 fidl::encoding::DynamicFlags::empty(),
4920 _decode,
4921 )
4922 }
4923}
4924
4925pub struct SessionEventStream {
4926 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4927}
4928
4929impl std::marker::Unpin for SessionEventStream {}
4930
4931impl futures::stream::FusedStream for SessionEventStream {
4932 fn is_terminated(&self) -> bool {
4933 self.event_receiver.is_terminated()
4934 }
4935}
4936
4937impl futures::Stream for SessionEventStream {
4938 type Item = Result<SessionEvent, fidl::Error>;
4939
4940 fn poll_next(
4941 mut self: std::pin::Pin<&mut Self>,
4942 cx: &mut std::task::Context<'_>,
4943 ) -> std::task::Poll<Option<Self::Item>> {
4944 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4945 &mut self.event_receiver,
4946 cx
4947 )?) {
4948 Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
4949 None => std::task::Poll::Ready(None),
4950 }
4951 }
4952}
4953
4954#[derive(Debug)]
4955pub enum SessionEvent {}
4956
4957impl SessionEvent {
4958 fn decode(
4960 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4961 ) -> Result<SessionEvent, fidl::Error> {
4962 let (bytes, _handles) = buf.split_mut();
4963 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4964 debug_assert_eq!(tx_header.tx_id, 0);
4965 match tx_header.ordinal {
4966 _ => Err(fidl::Error::UnknownOrdinal {
4967 ordinal: tx_header.ordinal,
4968 protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4969 }),
4970 }
4971 }
4972}
4973
4974pub struct SessionRequestStream {
4976 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4977 is_terminated: bool,
4978}
4979
4980impl std::marker::Unpin for SessionRequestStream {}
4981
4982impl futures::stream::FusedStream for SessionRequestStream {
4983 fn is_terminated(&self) -> bool {
4984 self.is_terminated
4985 }
4986}
4987
4988impl fidl::endpoints::RequestStream for SessionRequestStream {
4989 type Protocol = SessionMarker;
4990 type ControlHandle = SessionControlHandle;
4991
4992 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4993 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4994 }
4995
4996 fn control_handle(&self) -> Self::ControlHandle {
4997 SessionControlHandle { inner: self.inner.clone() }
4998 }
4999
5000 fn into_inner(
5001 self,
5002 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5003 {
5004 (self.inner, self.is_terminated)
5005 }
5006
5007 fn from_inner(
5008 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5009 is_terminated: bool,
5010 ) -> Self {
5011 Self { inner, is_terminated }
5012 }
5013}
5014
5015impl futures::Stream for SessionRequestStream {
5016 type Item = Result<SessionRequest, fidl::Error>;
5017
5018 fn poll_next(
5019 mut self: std::pin::Pin<&mut Self>,
5020 cx: &mut std::task::Context<'_>,
5021 ) -> std::task::Poll<Option<Self::Item>> {
5022 let this = &mut *self;
5023 if this.inner.check_shutdown(cx) {
5024 this.is_terminated = true;
5025 return std::task::Poll::Ready(None);
5026 }
5027 if this.is_terminated {
5028 panic!("polled SessionRequestStream after completion");
5029 }
5030 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5031 |bytes, handles| {
5032 match this.inner.channel().read_etc(cx, bytes, handles) {
5033 std::task::Poll::Ready(Ok(())) => {}
5034 std::task::Poll::Pending => return std::task::Poll::Pending,
5035 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5036 this.is_terminated = true;
5037 return std::task::Poll::Ready(None);
5038 }
5039 std::task::Poll::Ready(Err(e)) => {
5040 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5041 e.into(),
5042 ))))
5043 }
5044 }
5045
5046 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5048
5049 std::task::Poll::Ready(Some(match header.ordinal {
5050 0x1e89c9013e201379 => {
5051 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5052 let mut req = fidl::new_empty!(
5053 SessionAttachRequest,
5054 fidl::encoding::DefaultFuchsiaResourceDialect
5055 );
5056 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionAttachRequest>(&header, _body_bytes, handles, &mut req)?;
5057 let control_handle = SessionControlHandle { inner: this.inner.clone() };
5058 Ok(SessionRequest::Attach {
5059 port: req.port,
5060 rx_frames: req.rx_frames,
5061
5062 responder: SessionAttachResponder {
5063 control_handle: std::mem::ManuallyDrop::new(control_handle),
5064 tx_id: header.tx_id,
5065 },
5066 })
5067 }
5068 0x68c40cf8fb549867 => {
5069 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5070 let mut req = fidl::new_empty!(
5071 SessionDetachRequest,
5072 fidl::encoding::DefaultFuchsiaResourceDialect
5073 );
5074 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionDetachRequest>(&header, _body_bytes, handles, &mut req)?;
5075 let control_handle = SessionControlHandle { inner: this.inner.clone() };
5076 Ok(SessionRequest::Detach {
5077 port: req.port,
5078
5079 responder: SessionDetachResponder {
5080 control_handle: std::mem::ManuallyDrop::new(control_handle),
5081 tx_id: header.tx_id,
5082 },
5083 })
5084 }
5085 0x393d5070394a92f6 => {
5086 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5087 let mut req = fidl::new_empty!(
5088 fidl::encoding::EmptyPayload,
5089 fidl::encoding::DefaultFuchsiaResourceDialect
5090 );
5091 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5092 let control_handle = SessionControlHandle { inner: this.inner.clone() };
5093 Ok(SessionRequest::Close { control_handle })
5094 }
5095 0x764d823ee64803b5 => {
5096 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5097 let mut req = fidl::new_empty!(
5098 fidl::encoding::EmptyPayload,
5099 fidl::encoding::DefaultFuchsiaResourceDialect
5100 );
5101 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5102 let control_handle = SessionControlHandle { inner: this.inner.clone() };
5103 Ok(SessionRequest::WatchDelegatedRxLease {
5104 responder: SessionWatchDelegatedRxLeaseResponder {
5105 control_handle: std::mem::ManuallyDrop::new(control_handle),
5106 tx_id: header.tx_id,
5107 },
5108 })
5109 }
5110 _ => Err(fidl::Error::UnknownOrdinal {
5111 ordinal: header.ordinal,
5112 protocol_name:
5113 <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5114 }),
5115 }))
5116 },
5117 )
5118 }
5119}
5120
5121#[derive(Debug)]
5148pub enum SessionRequest {
5149 Attach { port: PortId, rx_frames: Vec<FrameType>, responder: SessionAttachResponder },
5161 Detach { port: PortId, responder: SessionDetachResponder },
5172 Close { control_handle: SessionControlHandle },
5180 WatchDelegatedRxLease { responder: SessionWatchDelegatedRxLeaseResponder },
5195}
5196
5197impl SessionRequest {
5198 #[allow(irrefutable_let_patterns)]
5199 pub fn into_attach(self) -> Option<(PortId, Vec<FrameType>, SessionAttachResponder)> {
5200 if let SessionRequest::Attach { port, rx_frames, responder } = self {
5201 Some((port, rx_frames, responder))
5202 } else {
5203 None
5204 }
5205 }
5206
5207 #[allow(irrefutable_let_patterns)]
5208 pub fn into_detach(self) -> Option<(PortId, SessionDetachResponder)> {
5209 if let SessionRequest::Detach { port, responder } = self {
5210 Some((port, responder))
5211 } else {
5212 None
5213 }
5214 }
5215
5216 #[allow(irrefutable_let_patterns)]
5217 pub fn into_close(self) -> Option<(SessionControlHandle)> {
5218 if let SessionRequest::Close { control_handle } = self {
5219 Some((control_handle))
5220 } else {
5221 None
5222 }
5223 }
5224
5225 #[allow(irrefutable_let_patterns)]
5226 pub fn into_watch_delegated_rx_lease(self) -> Option<(SessionWatchDelegatedRxLeaseResponder)> {
5227 if let SessionRequest::WatchDelegatedRxLease { responder } = self {
5228 Some((responder))
5229 } else {
5230 None
5231 }
5232 }
5233
5234 pub fn method_name(&self) -> &'static str {
5236 match *self {
5237 SessionRequest::Attach { .. } => "attach",
5238 SessionRequest::Detach { .. } => "detach",
5239 SessionRequest::Close { .. } => "close",
5240 SessionRequest::WatchDelegatedRxLease { .. } => "watch_delegated_rx_lease",
5241 }
5242 }
5243}
5244
5245#[derive(Debug, Clone)]
5246pub struct SessionControlHandle {
5247 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5248}
5249
5250impl fidl::endpoints::ControlHandle for SessionControlHandle {
5251 fn shutdown(&self) {
5252 self.inner.shutdown()
5253 }
5254 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5255 self.inner.shutdown_with_epitaph(status)
5256 }
5257
5258 fn is_closed(&self) -> bool {
5259 self.inner.channel().is_closed()
5260 }
5261 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5262 self.inner.channel().on_closed()
5263 }
5264
5265 #[cfg(target_os = "fuchsia")]
5266 fn signal_peer(
5267 &self,
5268 clear_mask: zx::Signals,
5269 set_mask: zx::Signals,
5270 ) -> Result<(), zx_status::Status> {
5271 use fidl::Peered;
5272 self.inner.channel().signal_peer(clear_mask, set_mask)
5273 }
5274}
5275
5276impl SessionControlHandle {}
5277
5278#[must_use = "FIDL methods require a response to be sent"]
5279#[derive(Debug)]
5280pub struct SessionAttachResponder {
5281 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5282 tx_id: u32,
5283}
5284
5285impl std::ops::Drop for SessionAttachResponder {
5289 fn drop(&mut self) {
5290 self.control_handle.shutdown();
5291 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5293 }
5294}
5295
5296impl fidl::endpoints::Responder for SessionAttachResponder {
5297 type ControlHandle = SessionControlHandle;
5298
5299 fn control_handle(&self) -> &SessionControlHandle {
5300 &self.control_handle
5301 }
5302
5303 fn drop_without_shutdown(mut self) {
5304 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5306 std::mem::forget(self);
5308 }
5309}
5310
5311impl SessionAttachResponder {
5312 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5316 let _result = self.send_raw(result);
5317 if _result.is_err() {
5318 self.control_handle.shutdown();
5319 }
5320 self.drop_without_shutdown();
5321 _result
5322 }
5323
5324 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5326 let _result = self.send_raw(result);
5327 self.drop_without_shutdown();
5328 _result
5329 }
5330
5331 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5332 self.control_handle
5333 .inner
5334 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5335 result,
5336 self.tx_id,
5337 0x1e89c9013e201379,
5338 fidl::encoding::DynamicFlags::empty(),
5339 )
5340 }
5341}
5342
5343#[must_use = "FIDL methods require a response to be sent"]
5344#[derive(Debug)]
5345pub struct SessionDetachResponder {
5346 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5347 tx_id: u32,
5348}
5349
5350impl std::ops::Drop for SessionDetachResponder {
5354 fn drop(&mut self) {
5355 self.control_handle.shutdown();
5356 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5358 }
5359}
5360
5361impl fidl::endpoints::Responder for SessionDetachResponder {
5362 type ControlHandle = SessionControlHandle;
5363
5364 fn control_handle(&self) -> &SessionControlHandle {
5365 &self.control_handle
5366 }
5367
5368 fn drop_without_shutdown(mut self) {
5369 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5371 std::mem::forget(self);
5373 }
5374}
5375
5376impl SessionDetachResponder {
5377 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5381 let _result = self.send_raw(result);
5382 if _result.is_err() {
5383 self.control_handle.shutdown();
5384 }
5385 self.drop_without_shutdown();
5386 _result
5387 }
5388
5389 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5391 let _result = self.send_raw(result);
5392 self.drop_without_shutdown();
5393 _result
5394 }
5395
5396 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5397 self.control_handle
5398 .inner
5399 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5400 result,
5401 self.tx_id,
5402 0x68c40cf8fb549867,
5403 fidl::encoding::DynamicFlags::empty(),
5404 )
5405 }
5406}
5407
5408#[must_use = "FIDL methods require a response to be sent"]
5409#[derive(Debug)]
5410pub struct SessionWatchDelegatedRxLeaseResponder {
5411 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5412 tx_id: u32,
5413}
5414
5415impl std::ops::Drop for SessionWatchDelegatedRxLeaseResponder {
5419 fn drop(&mut self) {
5420 self.control_handle.shutdown();
5421 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5423 }
5424}
5425
5426impl fidl::endpoints::Responder for SessionWatchDelegatedRxLeaseResponder {
5427 type ControlHandle = SessionControlHandle;
5428
5429 fn control_handle(&self) -> &SessionControlHandle {
5430 &self.control_handle
5431 }
5432
5433 fn drop_without_shutdown(mut self) {
5434 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5436 std::mem::forget(self);
5438 }
5439}
5440
5441impl SessionWatchDelegatedRxLeaseResponder {
5442 pub fn send(self, mut lease: DelegatedRxLease) -> Result<(), fidl::Error> {
5446 let _result = self.send_raw(lease);
5447 if _result.is_err() {
5448 self.control_handle.shutdown();
5449 }
5450 self.drop_without_shutdown();
5451 _result
5452 }
5453
5454 pub fn send_no_shutdown_on_err(self, mut lease: DelegatedRxLease) -> Result<(), fidl::Error> {
5456 let _result = self.send_raw(lease);
5457 self.drop_without_shutdown();
5458 _result
5459 }
5460
5461 fn send_raw(&self, mut lease: DelegatedRxLease) -> Result<(), fidl::Error> {
5462 self.control_handle.inner.send::<SessionWatchDelegatedRxLeaseResponse>(
5463 (&mut lease,),
5464 self.tx_id,
5465 0x764d823ee64803b5,
5466 fidl::encoding::DynamicFlags::empty(),
5467 )
5468 }
5469}
5470
5471#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5472pub struct StatusWatcherMarker;
5473
5474impl fidl::endpoints::ProtocolMarker for StatusWatcherMarker {
5475 type Proxy = StatusWatcherProxy;
5476 type RequestStream = StatusWatcherRequestStream;
5477 #[cfg(target_os = "fuchsia")]
5478 type SynchronousProxy = StatusWatcherSynchronousProxy;
5479
5480 const DEBUG_NAME: &'static str = "(anonymous) StatusWatcher";
5481}
5482
5483pub trait StatusWatcherProxyInterface: Send + Sync {
5484 type WatchStatusResponseFut: std::future::Future<Output = Result<PortStatus, fidl::Error>>
5485 + Send;
5486 fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
5487}
5488#[derive(Debug)]
5489#[cfg(target_os = "fuchsia")]
5490pub struct StatusWatcherSynchronousProxy {
5491 client: fidl::client::sync::Client,
5492}
5493
5494#[cfg(target_os = "fuchsia")]
5495impl fidl::endpoints::SynchronousProxy for StatusWatcherSynchronousProxy {
5496 type Proxy = StatusWatcherProxy;
5497 type Protocol = StatusWatcherMarker;
5498
5499 fn from_channel(inner: fidl::Channel) -> Self {
5500 Self::new(inner)
5501 }
5502
5503 fn into_channel(self) -> fidl::Channel {
5504 self.client.into_channel()
5505 }
5506
5507 fn as_channel(&self) -> &fidl::Channel {
5508 self.client.as_channel()
5509 }
5510}
5511
5512#[cfg(target_os = "fuchsia")]
5513impl StatusWatcherSynchronousProxy {
5514 pub fn new(channel: fidl::Channel) -> Self {
5515 let protocol_name = <StatusWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5516 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5517 }
5518
5519 pub fn into_channel(self) -> fidl::Channel {
5520 self.client.into_channel()
5521 }
5522
5523 pub fn wait_for_event(
5526 &self,
5527 deadline: zx::MonotonicInstant,
5528 ) -> Result<StatusWatcherEvent, fidl::Error> {
5529 StatusWatcherEvent::decode(self.client.wait_for_event(deadline)?)
5530 }
5531
5532 pub fn r#watch_status(
5544 &self,
5545 ___deadline: zx::MonotonicInstant,
5546 ) -> Result<PortStatus, fidl::Error> {
5547 let _response = self
5548 .client
5549 .send_query::<fidl::encoding::EmptyPayload, StatusWatcherWatchStatusResponse>(
5550 (),
5551 0x1369a8125c0862b9,
5552 fidl::encoding::DynamicFlags::empty(),
5553 ___deadline,
5554 )?;
5555 Ok(_response.port_status)
5556 }
5557}
5558
5559#[cfg(target_os = "fuchsia")]
5560impl From<StatusWatcherSynchronousProxy> for zx::Handle {
5561 fn from(value: StatusWatcherSynchronousProxy) -> Self {
5562 value.into_channel().into()
5563 }
5564}
5565
5566#[cfg(target_os = "fuchsia")]
5567impl From<fidl::Channel> for StatusWatcherSynchronousProxy {
5568 fn from(value: fidl::Channel) -> Self {
5569 Self::new(value)
5570 }
5571}
5572
5573#[cfg(target_os = "fuchsia")]
5574impl fidl::endpoints::FromClient for StatusWatcherSynchronousProxy {
5575 type Protocol = StatusWatcherMarker;
5576
5577 fn from_client(value: fidl::endpoints::ClientEnd<StatusWatcherMarker>) -> Self {
5578 Self::new(value.into_channel())
5579 }
5580}
5581
5582#[derive(Debug, Clone)]
5583pub struct StatusWatcherProxy {
5584 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5585}
5586
5587impl fidl::endpoints::Proxy for StatusWatcherProxy {
5588 type Protocol = StatusWatcherMarker;
5589
5590 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5591 Self::new(inner)
5592 }
5593
5594 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5595 self.client.into_channel().map_err(|client| Self { client })
5596 }
5597
5598 fn as_channel(&self) -> &::fidl::AsyncChannel {
5599 self.client.as_channel()
5600 }
5601}
5602
5603impl StatusWatcherProxy {
5604 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5606 let protocol_name = <StatusWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5607 Self { client: fidl::client::Client::new(channel, protocol_name) }
5608 }
5609
5610 pub fn take_event_stream(&self) -> StatusWatcherEventStream {
5616 StatusWatcherEventStream { event_receiver: self.client.take_event_receiver() }
5617 }
5618
5619 pub fn r#watch_status(
5631 &self,
5632 ) -> fidl::client::QueryResponseFut<PortStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
5633 {
5634 StatusWatcherProxyInterface::r#watch_status(self)
5635 }
5636}
5637
5638impl StatusWatcherProxyInterface for StatusWatcherProxy {
5639 type WatchStatusResponseFut =
5640 fidl::client::QueryResponseFut<PortStatus, fidl::encoding::DefaultFuchsiaResourceDialect>;
5641 fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
5642 fn _decode(
5643 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5644 ) -> Result<PortStatus, fidl::Error> {
5645 let _response = fidl::client::decode_transaction_body::<
5646 StatusWatcherWatchStatusResponse,
5647 fidl::encoding::DefaultFuchsiaResourceDialect,
5648 0x1369a8125c0862b9,
5649 >(_buf?)?;
5650 Ok(_response.port_status)
5651 }
5652 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PortStatus>(
5653 (),
5654 0x1369a8125c0862b9,
5655 fidl::encoding::DynamicFlags::empty(),
5656 _decode,
5657 )
5658 }
5659}
5660
5661pub struct StatusWatcherEventStream {
5662 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5663}
5664
5665impl std::marker::Unpin for StatusWatcherEventStream {}
5666
5667impl futures::stream::FusedStream for StatusWatcherEventStream {
5668 fn is_terminated(&self) -> bool {
5669 self.event_receiver.is_terminated()
5670 }
5671}
5672
5673impl futures::Stream for StatusWatcherEventStream {
5674 type Item = Result<StatusWatcherEvent, fidl::Error>;
5675
5676 fn poll_next(
5677 mut self: std::pin::Pin<&mut Self>,
5678 cx: &mut std::task::Context<'_>,
5679 ) -> std::task::Poll<Option<Self::Item>> {
5680 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5681 &mut self.event_receiver,
5682 cx
5683 )?) {
5684 Some(buf) => std::task::Poll::Ready(Some(StatusWatcherEvent::decode(buf))),
5685 None => std::task::Poll::Ready(None),
5686 }
5687 }
5688}
5689
5690#[derive(Debug)]
5691pub enum StatusWatcherEvent {}
5692
5693impl StatusWatcherEvent {
5694 fn decode(
5696 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5697 ) -> Result<StatusWatcherEvent, fidl::Error> {
5698 let (bytes, _handles) = buf.split_mut();
5699 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5700 debug_assert_eq!(tx_header.tx_id, 0);
5701 match tx_header.ordinal {
5702 _ => Err(fidl::Error::UnknownOrdinal {
5703 ordinal: tx_header.ordinal,
5704 protocol_name: <StatusWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5705 }),
5706 }
5707 }
5708}
5709
5710pub struct StatusWatcherRequestStream {
5712 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5713 is_terminated: bool,
5714}
5715
5716impl std::marker::Unpin for StatusWatcherRequestStream {}
5717
5718impl futures::stream::FusedStream for StatusWatcherRequestStream {
5719 fn is_terminated(&self) -> bool {
5720 self.is_terminated
5721 }
5722}
5723
5724impl fidl::endpoints::RequestStream for StatusWatcherRequestStream {
5725 type Protocol = StatusWatcherMarker;
5726 type ControlHandle = StatusWatcherControlHandle;
5727
5728 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5729 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5730 }
5731
5732 fn control_handle(&self) -> Self::ControlHandle {
5733 StatusWatcherControlHandle { inner: self.inner.clone() }
5734 }
5735
5736 fn into_inner(
5737 self,
5738 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5739 {
5740 (self.inner, self.is_terminated)
5741 }
5742
5743 fn from_inner(
5744 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5745 is_terminated: bool,
5746 ) -> Self {
5747 Self { inner, is_terminated }
5748 }
5749}
5750
5751impl futures::Stream for StatusWatcherRequestStream {
5752 type Item = Result<StatusWatcherRequest, fidl::Error>;
5753
5754 fn poll_next(
5755 mut self: std::pin::Pin<&mut Self>,
5756 cx: &mut std::task::Context<'_>,
5757 ) -> std::task::Poll<Option<Self::Item>> {
5758 let this = &mut *self;
5759 if this.inner.check_shutdown(cx) {
5760 this.is_terminated = true;
5761 return std::task::Poll::Ready(None);
5762 }
5763 if this.is_terminated {
5764 panic!("polled StatusWatcherRequestStream after completion");
5765 }
5766 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5767 |bytes, handles| {
5768 match this.inner.channel().read_etc(cx, bytes, handles) {
5769 std::task::Poll::Ready(Ok(())) => {}
5770 std::task::Poll::Pending => return std::task::Poll::Pending,
5771 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5772 this.is_terminated = true;
5773 return std::task::Poll::Ready(None);
5774 }
5775 std::task::Poll::Ready(Err(e)) => {
5776 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5777 e.into(),
5778 ))))
5779 }
5780 }
5781
5782 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5784
5785 std::task::Poll::Ready(Some(match header.ordinal {
5786 0x1369a8125c0862b9 => {
5787 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5788 let mut req = fidl::new_empty!(
5789 fidl::encoding::EmptyPayload,
5790 fidl::encoding::DefaultFuchsiaResourceDialect
5791 );
5792 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5793 let control_handle =
5794 StatusWatcherControlHandle { inner: this.inner.clone() };
5795 Ok(StatusWatcherRequest::WatchStatus {
5796 responder: StatusWatcherWatchStatusResponder {
5797 control_handle: std::mem::ManuallyDrop::new(control_handle),
5798 tx_id: header.tx_id,
5799 },
5800 })
5801 }
5802 _ => Err(fidl::Error::UnknownOrdinal {
5803 ordinal: header.ordinal,
5804 protocol_name:
5805 <StatusWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5806 }),
5807 }))
5808 },
5809 )
5810 }
5811}
5812
5813#[derive(Debug)]
5815pub enum StatusWatcherRequest {
5816 WatchStatus { responder: StatusWatcherWatchStatusResponder },
5828}
5829
5830impl StatusWatcherRequest {
5831 #[allow(irrefutable_let_patterns)]
5832 pub fn into_watch_status(self) -> Option<(StatusWatcherWatchStatusResponder)> {
5833 if let StatusWatcherRequest::WatchStatus { responder } = self {
5834 Some((responder))
5835 } else {
5836 None
5837 }
5838 }
5839
5840 pub fn method_name(&self) -> &'static str {
5842 match *self {
5843 StatusWatcherRequest::WatchStatus { .. } => "watch_status",
5844 }
5845 }
5846}
5847
5848#[derive(Debug, Clone)]
5849pub struct StatusWatcherControlHandle {
5850 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5851}
5852
5853impl fidl::endpoints::ControlHandle for StatusWatcherControlHandle {
5854 fn shutdown(&self) {
5855 self.inner.shutdown()
5856 }
5857 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5858 self.inner.shutdown_with_epitaph(status)
5859 }
5860
5861 fn is_closed(&self) -> bool {
5862 self.inner.channel().is_closed()
5863 }
5864 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5865 self.inner.channel().on_closed()
5866 }
5867
5868 #[cfg(target_os = "fuchsia")]
5869 fn signal_peer(
5870 &self,
5871 clear_mask: zx::Signals,
5872 set_mask: zx::Signals,
5873 ) -> Result<(), zx_status::Status> {
5874 use fidl::Peered;
5875 self.inner.channel().signal_peer(clear_mask, set_mask)
5876 }
5877}
5878
5879impl StatusWatcherControlHandle {}
5880
5881#[must_use = "FIDL methods require a response to be sent"]
5882#[derive(Debug)]
5883pub struct StatusWatcherWatchStatusResponder {
5884 control_handle: std::mem::ManuallyDrop<StatusWatcherControlHandle>,
5885 tx_id: u32,
5886}
5887
5888impl std::ops::Drop for StatusWatcherWatchStatusResponder {
5892 fn drop(&mut self) {
5893 self.control_handle.shutdown();
5894 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5896 }
5897}
5898
5899impl fidl::endpoints::Responder for StatusWatcherWatchStatusResponder {
5900 type ControlHandle = StatusWatcherControlHandle;
5901
5902 fn control_handle(&self) -> &StatusWatcherControlHandle {
5903 &self.control_handle
5904 }
5905
5906 fn drop_without_shutdown(mut self) {
5907 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5909 std::mem::forget(self);
5911 }
5912}
5913
5914impl StatusWatcherWatchStatusResponder {
5915 pub fn send(self, mut port_status: &PortStatus) -> Result<(), fidl::Error> {
5919 let _result = self.send_raw(port_status);
5920 if _result.is_err() {
5921 self.control_handle.shutdown();
5922 }
5923 self.drop_without_shutdown();
5924 _result
5925 }
5926
5927 pub fn send_no_shutdown_on_err(self, mut port_status: &PortStatus) -> Result<(), fidl::Error> {
5929 let _result = self.send_raw(port_status);
5930 self.drop_without_shutdown();
5931 _result
5932 }
5933
5934 fn send_raw(&self, mut port_status: &PortStatus) -> Result<(), fidl::Error> {
5935 self.control_handle.inner.send::<StatusWatcherWatchStatusResponse>(
5936 (port_status,),
5937 self.tx_id,
5938 0x1369a8125c0862b9,
5939 fidl::encoding::DynamicFlags::empty(),
5940 )
5941 }
5942}
5943
5944mod internal {
5945 use super::*;
5946
5947 impl fidl::encoding::ResourceTypeMarker for DeviceCloneRequest {
5948 type Borrowed<'a> = &'a mut Self;
5949 fn take_or_borrow<'a>(
5950 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5951 ) -> Self::Borrowed<'a> {
5952 value
5953 }
5954 }
5955
5956 unsafe impl fidl::encoding::TypeMarker for DeviceCloneRequest {
5957 type Owned = Self;
5958
5959 #[inline(always)]
5960 fn inline_align(_context: fidl::encoding::Context) -> usize {
5961 4
5962 }
5963
5964 #[inline(always)]
5965 fn inline_size(_context: fidl::encoding::Context) -> usize {
5966 4
5967 }
5968 }
5969
5970 unsafe impl
5971 fidl::encoding::Encode<DeviceCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5972 for &mut DeviceCloneRequest
5973 {
5974 #[inline]
5975 unsafe fn encode(
5976 self,
5977 encoder: &mut fidl::encoding::Encoder<
5978 '_,
5979 fidl::encoding::DefaultFuchsiaResourceDialect,
5980 >,
5981 offset: usize,
5982 _depth: fidl::encoding::Depth,
5983 ) -> fidl::Result<()> {
5984 encoder.debug_check_bounds::<DeviceCloneRequest>(offset);
5985 fidl::encoding::Encode::<DeviceCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5987 (
5988 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
5989 ),
5990 encoder, offset, _depth
5991 )
5992 }
5993 }
5994 unsafe impl<
5995 T0: fidl::encoding::Encode<
5996 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
5997 fidl::encoding::DefaultFuchsiaResourceDialect,
5998 >,
5999 >
6000 fidl::encoding::Encode<DeviceCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6001 for (T0,)
6002 {
6003 #[inline]
6004 unsafe fn encode(
6005 self,
6006 encoder: &mut fidl::encoding::Encoder<
6007 '_,
6008 fidl::encoding::DefaultFuchsiaResourceDialect,
6009 >,
6010 offset: usize,
6011 depth: fidl::encoding::Depth,
6012 ) -> fidl::Result<()> {
6013 encoder.debug_check_bounds::<DeviceCloneRequest>(offset);
6014 self.0.encode(encoder, offset + 0, depth)?;
6018 Ok(())
6019 }
6020 }
6021
6022 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6023 for DeviceCloneRequest
6024 {
6025 #[inline(always)]
6026 fn new_empty() -> Self {
6027 Self {
6028 device: fidl::new_empty!(
6029 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6030 fidl::encoding::DefaultFuchsiaResourceDialect
6031 ),
6032 }
6033 }
6034
6035 #[inline]
6036 unsafe fn decode(
6037 &mut self,
6038 decoder: &mut fidl::encoding::Decoder<
6039 '_,
6040 fidl::encoding::DefaultFuchsiaResourceDialect,
6041 >,
6042 offset: usize,
6043 _depth: fidl::encoding::Depth,
6044 ) -> fidl::Result<()> {
6045 decoder.debug_check_bounds::<Self>(offset);
6046 fidl::decode!(
6048 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6049 fidl::encoding::DefaultFuchsiaResourceDialect,
6050 &mut self.device,
6051 decoder,
6052 offset + 0,
6053 _depth
6054 )?;
6055 Ok(())
6056 }
6057 }
6058
6059 impl fidl::encoding::ResourceTypeMarker for DeviceGetPortRequest {
6060 type Borrowed<'a> = &'a mut Self;
6061 fn take_or_borrow<'a>(
6062 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6063 ) -> Self::Borrowed<'a> {
6064 value
6065 }
6066 }
6067
6068 unsafe impl fidl::encoding::TypeMarker for DeviceGetPortRequest {
6069 type Owned = Self;
6070
6071 #[inline(always)]
6072 fn inline_align(_context: fidl::encoding::Context) -> usize {
6073 4
6074 }
6075
6076 #[inline(always)]
6077 fn inline_size(_context: fidl::encoding::Context) -> usize {
6078 8
6079 }
6080 }
6081
6082 unsafe impl
6083 fidl::encoding::Encode<DeviceGetPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6084 for &mut DeviceGetPortRequest
6085 {
6086 #[inline]
6087 unsafe fn encode(
6088 self,
6089 encoder: &mut fidl::encoding::Encoder<
6090 '_,
6091 fidl::encoding::DefaultFuchsiaResourceDialect,
6092 >,
6093 offset: usize,
6094 _depth: fidl::encoding::Depth,
6095 ) -> fidl::Result<()> {
6096 encoder.debug_check_bounds::<DeviceGetPortRequest>(offset);
6097 fidl::encoding::Encode::<DeviceGetPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6099 (
6100 <PortId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
6101 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.port),
6102 ),
6103 encoder, offset, _depth
6104 )
6105 }
6106 }
6107 unsafe impl<
6108 T0: fidl::encoding::Encode<PortId, fidl::encoding::DefaultFuchsiaResourceDialect>,
6109 T1: fidl::encoding::Encode<
6110 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6111 fidl::encoding::DefaultFuchsiaResourceDialect,
6112 >,
6113 >
6114 fidl::encoding::Encode<DeviceGetPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6115 for (T0, T1)
6116 {
6117 #[inline]
6118 unsafe fn encode(
6119 self,
6120 encoder: &mut fidl::encoding::Encoder<
6121 '_,
6122 fidl::encoding::DefaultFuchsiaResourceDialect,
6123 >,
6124 offset: usize,
6125 depth: fidl::encoding::Depth,
6126 ) -> fidl::Result<()> {
6127 encoder.debug_check_bounds::<DeviceGetPortRequest>(offset);
6128 unsafe {
6131 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
6132 (ptr as *mut u32).write_unaligned(0);
6133 }
6134 self.0.encode(encoder, offset + 0, depth)?;
6136 self.1.encode(encoder, offset + 4, depth)?;
6137 Ok(())
6138 }
6139 }
6140
6141 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6142 for DeviceGetPortRequest
6143 {
6144 #[inline(always)]
6145 fn new_empty() -> Self {
6146 Self {
6147 id: fidl::new_empty!(PortId, fidl::encoding::DefaultFuchsiaResourceDialect),
6148 port: fidl::new_empty!(
6149 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6150 fidl::encoding::DefaultFuchsiaResourceDialect
6151 ),
6152 }
6153 }
6154
6155 #[inline]
6156 unsafe fn decode(
6157 &mut self,
6158 decoder: &mut fidl::encoding::Decoder<
6159 '_,
6160 fidl::encoding::DefaultFuchsiaResourceDialect,
6161 >,
6162 offset: usize,
6163 _depth: fidl::encoding::Depth,
6164 ) -> fidl::Result<()> {
6165 decoder.debug_check_bounds::<Self>(offset);
6166 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
6168 let padval = unsafe { (ptr as *const u32).read_unaligned() };
6169 let mask = 0xffff0000u32;
6170 let maskedval = padval & mask;
6171 if maskedval != 0 {
6172 return Err(fidl::Error::NonZeroPadding {
6173 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
6174 });
6175 }
6176 fidl::decode!(
6177 PortId,
6178 fidl::encoding::DefaultFuchsiaResourceDialect,
6179 &mut self.id,
6180 decoder,
6181 offset + 0,
6182 _depth
6183 )?;
6184 fidl::decode!(
6185 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6186 fidl::encoding::DefaultFuchsiaResourceDialect,
6187 &mut self.port,
6188 decoder,
6189 offset + 4,
6190 _depth
6191 )?;
6192 Ok(())
6193 }
6194 }
6195
6196 impl fidl::encoding::ResourceTypeMarker for DeviceGetPortWatcherRequest {
6197 type Borrowed<'a> = &'a mut Self;
6198 fn take_or_borrow<'a>(
6199 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6200 ) -> Self::Borrowed<'a> {
6201 value
6202 }
6203 }
6204
6205 unsafe impl fidl::encoding::TypeMarker for DeviceGetPortWatcherRequest {
6206 type Owned = Self;
6207
6208 #[inline(always)]
6209 fn inline_align(_context: fidl::encoding::Context) -> usize {
6210 4
6211 }
6212
6213 #[inline(always)]
6214 fn inline_size(_context: fidl::encoding::Context) -> usize {
6215 4
6216 }
6217 }
6218
6219 unsafe impl
6220 fidl::encoding::Encode<
6221 DeviceGetPortWatcherRequest,
6222 fidl::encoding::DefaultFuchsiaResourceDialect,
6223 > for &mut DeviceGetPortWatcherRequest
6224 {
6225 #[inline]
6226 unsafe fn encode(
6227 self,
6228 encoder: &mut fidl::encoding::Encoder<
6229 '_,
6230 fidl::encoding::DefaultFuchsiaResourceDialect,
6231 >,
6232 offset: usize,
6233 _depth: fidl::encoding::Depth,
6234 ) -> fidl::Result<()> {
6235 encoder.debug_check_bounds::<DeviceGetPortWatcherRequest>(offset);
6236 fidl::encoding::Encode::<DeviceGetPortWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6238 (
6239 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
6240 ),
6241 encoder, offset, _depth
6242 )
6243 }
6244 }
6245 unsafe impl<
6246 T0: fidl::encoding::Encode<
6247 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortWatcherMarker>>,
6248 fidl::encoding::DefaultFuchsiaResourceDialect,
6249 >,
6250 >
6251 fidl::encoding::Encode<
6252 DeviceGetPortWatcherRequest,
6253 fidl::encoding::DefaultFuchsiaResourceDialect,
6254 > for (T0,)
6255 {
6256 #[inline]
6257 unsafe fn encode(
6258 self,
6259 encoder: &mut fidl::encoding::Encoder<
6260 '_,
6261 fidl::encoding::DefaultFuchsiaResourceDialect,
6262 >,
6263 offset: usize,
6264 depth: fidl::encoding::Depth,
6265 ) -> fidl::Result<()> {
6266 encoder.debug_check_bounds::<DeviceGetPortWatcherRequest>(offset);
6267 self.0.encode(encoder, offset + 0, depth)?;
6271 Ok(())
6272 }
6273 }
6274
6275 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6276 for DeviceGetPortWatcherRequest
6277 {
6278 #[inline(always)]
6279 fn new_empty() -> Self {
6280 Self {
6281 watcher: fidl::new_empty!(
6282 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortWatcherMarker>>,
6283 fidl::encoding::DefaultFuchsiaResourceDialect
6284 ),
6285 }
6286 }
6287
6288 #[inline]
6289 unsafe fn decode(
6290 &mut self,
6291 decoder: &mut fidl::encoding::Decoder<
6292 '_,
6293 fidl::encoding::DefaultFuchsiaResourceDialect,
6294 >,
6295 offset: usize,
6296 _depth: fidl::encoding::Depth,
6297 ) -> fidl::Result<()> {
6298 decoder.debug_check_bounds::<Self>(offset);
6299 fidl::decode!(
6301 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortWatcherMarker>>,
6302 fidl::encoding::DefaultFuchsiaResourceDialect,
6303 &mut self.watcher,
6304 decoder,
6305 offset + 0,
6306 _depth
6307 )?;
6308 Ok(())
6309 }
6310 }
6311
6312 impl fidl::encoding::ResourceTypeMarker for DeviceInstanceGetDeviceRequest {
6313 type Borrowed<'a> = &'a mut Self;
6314 fn take_or_borrow<'a>(
6315 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6316 ) -> Self::Borrowed<'a> {
6317 value
6318 }
6319 }
6320
6321 unsafe impl fidl::encoding::TypeMarker for DeviceInstanceGetDeviceRequest {
6322 type Owned = Self;
6323
6324 #[inline(always)]
6325 fn inline_align(_context: fidl::encoding::Context) -> usize {
6326 4
6327 }
6328
6329 #[inline(always)]
6330 fn inline_size(_context: fidl::encoding::Context) -> usize {
6331 4
6332 }
6333 }
6334
6335 unsafe impl
6336 fidl::encoding::Encode<
6337 DeviceInstanceGetDeviceRequest,
6338 fidl::encoding::DefaultFuchsiaResourceDialect,
6339 > for &mut DeviceInstanceGetDeviceRequest
6340 {
6341 #[inline]
6342 unsafe fn encode(
6343 self,
6344 encoder: &mut fidl::encoding::Encoder<
6345 '_,
6346 fidl::encoding::DefaultFuchsiaResourceDialect,
6347 >,
6348 offset: usize,
6349 _depth: fidl::encoding::Depth,
6350 ) -> fidl::Result<()> {
6351 encoder.debug_check_bounds::<DeviceInstanceGetDeviceRequest>(offset);
6352 fidl::encoding::Encode::<DeviceInstanceGetDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6354 (
6355 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
6356 ),
6357 encoder, offset, _depth
6358 )
6359 }
6360 }
6361 unsafe impl<
6362 T0: fidl::encoding::Encode<
6363 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6364 fidl::encoding::DefaultFuchsiaResourceDialect,
6365 >,
6366 >
6367 fidl::encoding::Encode<
6368 DeviceInstanceGetDeviceRequest,
6369 fidl::encoding::DefaultFuchsiaResourceDialect,
6370 > for (T0,)
6371 {
6372 #[inline]
6373 unsafe fn encode(
6374 self,
6375 encoder: &mut fidl::encoding::Encoder<
6376 '_,
6377 fidl::encoding::DefaultFuchsiaResourceDialect,
6378 >,
6379 offset: usize,
6380 depth: fidl::encoding::Depth,
6381 ) -> fidl::Result<()> {
6382 encoder.debug_check_bounds::<DeviceInstanceGetDeviceRequest>(offset);
6383 self.0.encode(encoder, offset + 0, depth)?;
6387 Ok(())
6388 }
6389 }
6390
6391 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6392 for DeviceInstanceGetDeviceRequest
6393 {
6394 #[inline(always)]
6395 fn new_empty() -> Self {
6396 Self {
6397 device: fidl::new_empty!(
6398 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6399 fidl::encoding::DefaultFuchsiaResourceDialect
6400 ),
6401 }
6402 }
6403
6404 #[inline]
6405 unsafe fn decode(
6406 &mut self,
6407 decoder: &mut fidl::encoding::Decoder<
6408 '_,
6409 fidl::encoding::DefaultFuchsiaResourceDialect,
6410 >,
6411 offset: usize,
6412 _depth: fidl::encoding::Depth,
6413 ) -> fidl::Result<()> {
6414 decoder.debug_check_bounds::<Self>(offset);
6415 fidl::decode!(
6417 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6418 fidl::encoding::DefaultFuchsiaResourceDialect,
6419 &mut self.device,
6420 decoder,
6421 offset + 0,
6422 _depth
6423 )?;
6424 Ok(())
6425 }
6426 }
6427
6428 impl fidl::encoding::ResourceTypeMarker for DeviceOpenSessionRequest {
6429 type Borrowed<'a> = &'a mut Self;
6430 fn take_or_borrow<'a>(
6431 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6432 ) -> Self::Borrowed<'a> {
6433 value
6434 }
6435 }
6436
6437 unsafe impl fidl::encoding::TypeMarker for DeviceOpenSessionRequest {
6438 type Owned = Self;
6439
6440 #[inline(always)]
6441 fn inline_align(_context: fidl::encoding::Context) -> usize {
6442 8
6443 }
6444
6445 #[inline(always)]
6446 fn inline_size(_context: fidl::encoding::Context) -> usize {
6447 32
6448 }
6449 }
6450
6451 unsafe impl
6452 fidl::encoding::Encode<
6453 DeviceOpenSessionRequest,
6454 fidl::encoding::DefaultFuchsiaResourceDialect,
6455 > for &mut DeviceOpenSessionRequest
6456 {
6457 #[inline]
6458 unsafe fn encode(
6459 self,
6460 encoder: &mut fidl::encoding::Encoder<
6461 '_,
6462 fidl::encoding::DefaultFuchsiaResourceDialect,
6463 >,
6464 offset: usize,
6465 _depth: fidl::encoding::Depth,
6466 ) -> fidl::Result<()> {
6467 encoder.debug_check_bounds::<DeviceOpenSessionRequest>(offset);
6468 fidl::encoding::Encode::<
6470 DeviceOpenSessionRequest,
6471 fidl::encoding::DefaultFuchsiaResourceDialect,
6472 >::encode(
6473 (
6474 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
6475 &self.session_name,
6476 ),
6477 <SessionInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6478 &mut self.session_info,
6479 ),
6480 ),
6481 encoder,
6482 offset,
6483 _depth,
6484 )
6485 }
6486 }
6487 unsafe impl<
6488 T0: fidl::encoding::Encode<
6489 fidl::encoding::BoundedString<64>,
6490 fidl::encoding::DefaultFuchsiaResourceDialect,
6491 >,
6492 T1: fidl::encoding::Encode<SessionInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
6493 >
6494 fidl::encoding::Encode<
6495 DeviceOpenSessionRequest,
6496 fidl::encoding::DefaultFuchsiaResourceDialect,
6497 > for (T0, T1)
6498 {
6499 #[inline]
6500 unsafe fn encode(
6501 self,
6502 encoder: &mut fidl::encoding::Encoder<
6503 '_,
6504 fidl::encoding::DefaultFuchsiaResourceDialect,
6505 >,
6506 offset: usize,
6507 depth: fidl::encoding::Depth,
6508 ) -> fidl::Result<()> {
6509 encoder.debug_check_bounds::<DeviceOpenSessionRequest>(offset);
6510 self.0.encode(encoder, offset + 0, depth)?;
6514 self.1.encode(encoder, offset + 16, depth)?;
6515 Ok(())
6516 }
6517 }
6518
6519 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6520 for DeviceOpenSessionRequest
6521 {
6522 #[inline(always)]
6523 fn new_empty() -> Self {
6524 Self {
6525 session_name: fidl::new_empty!(
6526 fidl::encoding::BoundedString<64>,
6527 fidl::encoding::DefaultFuchsiaResourceDialect
6528 ),
6529 session_info: fidl::new_empty!(
6530 SessionInfo,
6531 fidl::encoding::DefaultFuchsiaResourceDialect
6532 ),
6533 }
6534 }
6535
6536 #[inline]
6537 unsafe fn decode(
6538 &mut self,
6539 decoder: &mut fidl::encoding::Decoder<
6540 '_,
6541 fidl::encoding::DefaultFuchsiaResourceDialect,
6542 >,
6543 offset: usize,
6544 _depth: fidl::encoding::Depth,
6545 ) -> fidl::Result<()> {
6546 decoder.debug_check_bounds::<Self>(offset);
6547 fidl::decode!(
6549 fidl::encoding::BoundedString<64>,
6550 fidl::encoding::DefaultFuchsiaResourceDialect,
6551 &mut self.session_name,
6552 decoder,
6553 offset + 0,
6554 _depth
6555 )?;
6556 fidl::decode!(
6557 SessionInfo,
6558 fidl::encoding::DefaultFuchsiaResourceDialect,
6559 &mut self.session_info,
6560 decoder,
6561 offset + 16,
6562 _depth
6563 )?;
6564 Ok(())
6565 }
6566 }
6567
6568 impl fidl::encoding::ResourceTypeMarker for DeviceOpenSessionResponse {
6569 type Borrowed<'a> = &'a mut Self;
6570 fn take_or_borrow<'a>(
6571 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6572 ) -> Self::Borrowed<'a> {
6573 value
6574 }
6575 }
6576
6577 unsafe impl fidl::encoding::TypeMarker for DeviceOpenSessionResponse {
6578 type Owned = Self;
6579
6580 #[inline(always)]
6581 fn inline_align(_context: fidl::encoding::Context) -> usize {
6582 4
6583 }
6584
6585 #[inline(always)]
6586 fn inline_size(_context: fidl::encoding::Context) -> usize {
6587 12
6588 }
6589 }
6590
6591 unsafe impl
6592 fidl::encoding::Encode<
6593 DeviceOpenSessionResponse,
6594 fidl::encoding::DefaultFuchsiaResourceDialect,
6595 > for &mut DeviceOpenSessionResponse
6596 {
6597 #[inline]
6598 unsafe fn encode(
6599 self,
6600 encoder: &mut fidl::encoding::Encoder<
6601 '_,
6602 fidl::encoding::DefaultFuchsiaResourceDialect,
6603 >,
6604 offset: usize,
6605 _depth: fidl::encoding::Depth,
6606 ) -> fidl::Result<()> {
6607 encoder.debug_check_bounds::<DeviceOpenSessionResponse>(offset);
6608 fidl::encoding::Encode::<DeviceOpenSessionResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6610 (
6611 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
6612 <Fifos as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.fifos),
6613 ),
6614 encoder, offset, _depth
6615 )
6616 }
6617 }
6618 unsafe impl<
6619 T0: fidl::encoding::Encode<
6620 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionMarker>>,
6621 fidl::encoding::DefaultFuchsiaResourceDialect,
6622 >,
6623 T1: fidl::encoding::Encode<Fifos, fidl::encoding::DefaultFuchsiaResourceDialect>,
6624 >
6625 fidl::encoding::Encode<
6626 DeviceOpenSessionResponse,
6627 fidl::encoding::DefaultFuchsiaResourceDialect,
6628 > for (T0, T1)
6629 {
6630 #[inline]
6631 unsafe fn encode(
6632 self,
6633 encoder: &mut fidl::encoding::Encoder<
6634 '_,
6635 fidl::encoding::DefaultFuchsiaResourceDialect,
6636 >,
6637 offset: usize,
6638 depth: fidl::encoding::Depth,
6639 ) -> fidl::Result<()> {
6640 encoder.debug_check_bounds::<DeviceOpenSessionResponse>(offset);
6641 self.0.encode(encoder, offset + 0, depth)?;
6645 self.1.encode(encoder, offset + 4, depth)?;
6646 Ok(())
6647 }
6648 }
6649
6650 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6651 for DeviceOpenSessionResponse
6652 {
6653 #[inline(always)]
6654 fn new_empty() -> Self {
6655 Self {
6656 session: fidl::new_empty!(
6657 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionMarker>>,
6658 fidl::encoding::DefaultFuchsiaResourceDialect
6659 ),
6660 fifos: fidl::new_empty!(Fifos, fidl::encoding::DefaultFuchsiaResourceDialect),
6661 }
6662 }
6663
6664 #[inline]
6665 unsafe fn decode(
6666 &mut self,
6667 decoder: &mut fidl::encoding::Decoder<
6668 '_,
6669 fidl::encoding::DefaultFuchsiaResourceDialect,
6670 >,
6671 offset: usize,
6672 _depth: fidl::encoding::Depth,
6673 ) -> fidl::Result<()> {
6674 decoder.debug_check_bounds::<Self>(offset);
6675 fidl::decode!(
6677 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionMarker>>,
6678 fidl::encoding::DefaultFuchsiaResourceDialect,
6679 &mut self.session,
6680 decoder,
6681 offset + 0,
6682 _depth
6683 )?;
6684 fidl::decode!(
6685 Fifos,
6686 fidl::encoding::DefaultFuchsiaResourceDialect,
6687 &mut self.fifos,
6688 decoder,
6689 offset + 4,
6690 _depth
6691 )?;
6692 Ok(())
6693 }
6694 }
6695
6696 impl fidl::encoding::ResourceTypeMarker for Fifos {
6697 type Borrowed<'a> = &'a mut Self;
6698 fn take_or_borrow<'a>(
6699 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6700 ) -> Self::Borrowed<'a> {
6701 value
6702 }
6703 }
6704
6705 unsafe impl fidl::encoding::TypeMarker for Fifos {
6706 type Owned = Self;
6707
6708 #[inline(always)]
6709 fn inline_align(_context: fidl::encoding::Context) -> usize {
6710 4
6711 }
6712
6713 #[inline(always)]
6714 fn inline_size(_context: fidl::encoding::Context) -> usize {
6715 8
6716 }
6717 }
6718
6719 unsafe impl fidl::encoding::Encode<Fifos, fidl::encoding::DefaultFuchsiaResourceDialect>
6720 for &mut Fifos
6721 {
6722 #[inline]
6723 unsafe fn encode(
6724 self,
6725 encoder: &mut fidl::encoding::Encoder<
6726 '_,
6727 fidl::encoding::DefaultFuchsiaResourceDialect,
6728 >,
6729 offset: usize,
6730 _depth: fidl::encoding::Depth,
6731 ) -> fidl::Result<()> {
6732 encoder.debug_check_bounds::<Fifos>(offset);
6733 fidl::encoding::Encode::<Fifos, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6735 (
6736 <fidl::encoding::HandleType<
6737 fidl::Fifo,
6738 { fidl::ObjectType::FIFO.into_raw() },
6739 2147483648,
6740 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6741 &mut self.rx
6742 ),
6743 <fidl::encoding::HandleType<
6744 fidl::Fifo,
6745 { fidl::ObjectType::FIFO.into_raw() },
6746 2147483648,
6747 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6748 &mut self.tx
6749 ),
6750 ),
6751 encoder,
6752 offset,
6753 _depth,
6754 )
6755 }
6756 }
6757 unsafe impl<
6758 T0: fidl::encoding::Encode<
6759 fidl::encoding::HandleType<
6760 fidl::Fifo,
6761 { fidl::ObjectType::FIFO.into_raw() },
6762 2147483648,
6763 >,
6764 fidl::encoding::DefaultFuchsiaResourceDialect,
6765 >,
6766 T1: fidl::encoding::Encode<
6767 fidl::encoding::HandleType<
6768 fidl::Fifo,
6769 { fidl::ObjectType::FIFO.into_raw() },
6770 2147483648,
6771 >,
6772 fidl::encoding::DefaultFuchsiaResourceDialect,
6773 >,
6774 > fidl::encoding::Encode<Fifos, fidl::encoding::DefaultFuchsiaResourceDialect>
6775 for (T0, T1)
6776 {
6777 #[inline]
6778 unsafe fn encode(
6779 self,
6780 encoder: &mut fidl::encoding::Encoder<
6781 '_,
6782 fidl::encoding::DefaultFuchsiaResourceDialect,
6783 >,
6784 offset: usize,
6785 depth: fidl::encoding::Depth,
6786 ) -> fidl::Result<()> {
6787 encoder.debug_check_bounds::<Fifos>(offset);
6788 self.0.encode(encoder, offset + 0, depth)?;
6792 self.1.encode(encoder, offset + 4, depth)?;
6793 Ok(())
6794 }
6795 }
6796
6797 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Fifos {
6798 #[inline(always)]
6799 fn new_empty() -> Self {
6800 Self {
6801 rx: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6802 tx: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6803 }
6804 }
6805
6806 #[inline]
6807 unsafe fn decode(
6808 &mut self,
6809 decoder: &mut fidl::encoding::Decoder<
6810 '_,
6811 fidl::encoding::DefaultFuchsiaResourceDialect,
6812 >,
6813 offset: usize,
6814 _depth: fidl::encoding::Depth,
6815 ) -> fidl::Result<()> {
6816 decoder.debug_check_bounds::<Self>(offset);
6817 fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.rx, decoder, offset + 0, _depth)?;
6819 fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.tx, decoder, offset + 4, _depth)?;
6820 Ok(())
6821 }
6822 }
6823
6824 impl fidl::encoding::ResourceTypeMarker for PortCloneRequest {
6825 type Borrowed<'a> = &'a mut Self;
6826 fn take_or_borrow<'a>(
6827 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6828 ) -> Self::Borrowed<'a> {
6829 value
6830 }
6831 }
6832
6833 unsafe impl fidl::encoding::TypeMarker for PortCloneRequest {
6834 type Owned = Self;
6835
6836 #[inline(always)]
6837 fn inline_align(_context: fidl::encoding::Context) -> usize {
6838 4
6839 }
6840
6841 #[inline(always)]
6842 fn inline_size(_context: fidl::encoding::Context) -> usize {
6843 4
6844 }
6845 }
6846
6847 unsafe impl
6848 fidl::encoding::Encode<PortCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6849 for &mut PortCloneRequest
6850 {
6851 #[inline]
6852 unsafe fn encode(
6853 self,
6854 encoder: &mut fidl::encoding::Encoder<
6855 '_,
6856 fidl::encoding::DefaultFuchsiaResourceDialect,
6857 >,
6858 offset: usize,
6859 _depth: fidl::encoding::Depth,
6860 ) -> fidl::Result<()> {
6861 encoder.debug_check_bounds::<PortCloneRequest>(offset);
6862 fidl::encoding::Encode::<PortCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6864 (
6865 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.port),
6866 ),
6867 encoder, offset, _depth
6868 )
6869 }
6870 }
6871 unsafe impl<
6872 T0: fidl::encoding::Encode<
6873 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6874 fidl::encoding::DefaultFuchsiaResourceDialect,
6875 >,
6876 >
6877 fidl::encoding::Encode<PortCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6878 for (T0,)
6879 {
6880 #[inline]
6881 unsafe fn encode(
6882 self,
6883 encoder: &mut fidl::encoding::Encoder<
6884 '_,
6885 fidl::encoding::DefaultFuchsiaResourceDialect,
6886 >,
6887 offset: usize,
6888 depth: fidl::encoding::Depth,
6889 ) -> fidl::Result<()> {
6890 encoder.debug_check_bounds::<PortCloneRequest>(offset);
6891 self.0.encode(encoder, offset + 0, depth)?;
6895 Ok(())
6896 }
6897 }
6898
6899 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6900 for PortCloneRequest
6901 {
6902 #[inline(always)]
6903 fn new_empty() -> Self {
6904 Self {
6905 port: fidl::new_empty!(
6906 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6907 fidl::encoding::DefaultFuchsiaResourceDialect
6908 ),
6909 }
6910 }
6911
6912 #[inline]
6913 unsafe fn decode(
6914 &mut self,
6915 decoder: &mut fidl::encoding::Decoder<
6916 '_,
6917 fidl::encoding::DefaultFuchsiaResourceDialect,
6918 >,
6919 offset: usize,
6920 _depth: fidl::encoding::Depth,
6921 ) -> fidl::Result<()> {
6922 decoder.debug_check_bounds::<Self>(offset);
6923 fidl::decode!(
6925 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6926 fidl::encoding::DefaultFuchsiaResourceDialect,
6927 &mut self.port,
6928 decoder,
6929 offset + 0,
6930 _depth
6931 )?;
6932 Ok(())
6933 }
6934 }
6935
6936 impl fidl::encoding::ResourceTypeMarker for PortGetDeviceRequest {
6937 type Borrowed<'a> = &'a mut Self;
6938 fn take_or_borrow<'a>(
6939 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6940 ) -> Self::Borrowed<'a> {
6941 value
6942 }
6943 }
6944
6945 unsafe impl fidl::encoding::TypeMarker for PortGetDeviceRequest {
6946 type Owned = Self;
6947
6948 #[inline(always)]
6949 fn inline_align(_context: fidl::encoding::Context) -> usize {
6950 4
6951 }
6952
6953 #[inline(always)]
6954 fn inline_size(_context: fidl::encoding::Context) -> usize {
6955 4
6956 }
6957 }
6958
6959 unsafe impl
6960 fidl::encoding::Encode<PortGetDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6961 for &mut PortGetDeviceRequest
6962 {
6963 #[inline]
6964 unsafe fn encode(
6965 self,
6966 encoder: &mut fidl::encoding::Encoder<
6967 '_,
6968 fidl::encoding::DefaultFuchsiaResourceDialect,
6969 >,
6970 offset: usize,
6971 _depth: fidl::encoding::Depth,
6972 ) -> fidl::Result<()> {
6973 encoder.debug_check_bounds::<PortGetDeviceRequest>(offset);
6974 fidl::encoding::Encode::<PortGetDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6976 (
6977 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
6978 ),
6979 encoder, offset, _depth
6980 )
6981 }
6982 }
6983 unsafe impl<
6984 T0: fidl::encoding::Encode<
6985 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6986 fidl::encoding::DefaultFuchsiaResourceDialect,
6987 >,
6988 >
6989 fidl::encoding::Encode<PortGetDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6990 for (T0,)
6991 {
6992 #[inline]
6993 unsafe fn encode(
6994 self,
6995 encoder: &mut fidl::encoding::Encoder<
6996 '_,
6997 fidl::encoding::DefaultFuchsiaResourceDialect,
6998 >,
6999 offset: usize,
7000 depth: fidl::encoding::Depth,
7001 ) -> fidl::Result<()> {
7002 encoder.debug_check_bounds::<PortGetDeviceRequest>(offset);
7003 self.0.encode(encoder, offset + 0, depth)?;
7007 Ok(())
7008 }
7009 }
7010
7011 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7012 for PortGetDeviceRequest
7013 {
7014 #[inline(always)]
7015 fn new_empty() -> Self {
7016 Self {
7017 device: fidl::new_empty!(
7018 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
7019 fidl::encoding::DefaultFuchsiaResourceDialect
7020 ),
7021 }
7022 }
7023
7024 #[inline]
7025 unsafe fn decode(
7026 &mut self,
7027 decoder: &mut fidl::encoding::Decoder<
7028 '_,
7029 fidl::encoding::DefaultFuchsiaResourceDialect,
7030 >,
7031 offset: usize,
7032 _depth: fidl::encoding::Depth,
7033 ) -> fidl::Result<()> {
7034 decoder.debug_check_bounds::<Self>(offset);
7035 fidl::decode!(
7037 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
7038 fidl::encoding::DefaultFuchsiaResourceDialect,
7039 &mut self.device,
7040 decoder,
7041 offset + 0,
7042 _depth
7043 )?;
7044 Ok(())
7045 }
7046 }
7047
7048 impl fidl::encoding::ResourceTypeMarker for PortGetDiagnosticsRequest {
7049 type Borrowed<'a> = &'a mut Self;
7050 fn take_or_borrow<'a>(
7051 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7052 ) -> Self::Borrowed<'a> {
7053 value
7054 }
7055 }
7056
7057 unsafe impl fidl::encoding::TypeMarker for PortGetDiagnosticsRequest {
7058 type Owned = Self;
7059
7060 #[inline(always)]
7061 fn inline_align(_context: fidl::encoding::Context) -> usize {
7062 4
7063 }
7064
7065 #[inline(always)]
7066 fn inline_size(_context: fidl::encoding::Context) -> usize {
7067 4
7068 }
7069 }
7070
7071 unsafe impl
7072 fidl::encoding::Encode<
7073 PortGetDiagnosticsRequest,
7074 fidl::encoding::DefaultFuchsiaResourceDialect,
7075 > for &mut PortGetDiagnosticsRequest
7076 {
7077 #[inline]
7078 unsafe fn encode(
7079 self,
7080 encoder: &mut fidl::encoding::Encoder<
7081 '_,
7082 fidl::encoding::DefaultFuchsiaResourceDialect,
7083 >,
7084 offset: usize,
7085 _depth: fidl::encoding::Depth,
7086 ) -> fidl::Result<()> {
7087 encoder.debug_check_bounds::<PortGetDiagnosticsRequest>(offset);
7088 fidl::encoding::Encode::<PortGetDiagnosticsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7090 (
7091 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiagnosticsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.diagnostics),
7092 ),
7093 encoder, offset, _depth
7094 )
7095 }
7096 }
7097 unsafe impl<
7098 T0: fidl::encoding::Encode<
7099 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiagnosticsMarker>>,
7100 fidl::encoding::DefaultFuchsiaResourceDialect,
7101 >,
7102 >
7103 fidl::encoding::Encode<
7104 PortGetDiagnosticsRequest,
7105 fidl::encoding::DefaultFuchsiaResourceDialect,
7106 > for (T0,)
7107 {
7108 #[inline]
7109 unsafe fn encode(
7110 self,
7111 encoder: &mut fidl::encoding::Encoder<
7112 '_,
7113 fidl::encoding::DefaultFuchsiaResourceDialect,
7114 >,
7115 offset: usize,
7116 depth: fidl::encoding::Depth,
7117 ) -> fidl::Result<()> {
7118 encoder.debug_check_bounds::<PortGetDiagnosticsRequest>(offset);
7119 self.0.encode(encoder, offset + 0, depth)?;
7123 Ok(())
7124 }
7125 }
7126
7127 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7128 for PortGetDiagnosticsRequest
7129 {
7130 #[inline(always)]
7131 fn new_empty() -> Self {
7132 Self {
7133 diagnostics: fidl::new_empty!(
7134 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiagnosticsMarker>>,
7135 fidl::encoding::DefaultFuchsiaResourceDialect
7136 ),
7137 }
7138 }
7139
7140 #[inline]
7141 unsafe fn decode(
7142 &mut self,
7143 decoder: &mut fidl::encoding::Decoder<
7144 '_,
7145 fidl::encoding::DefaultFuchsiaResourceDialect,
7146 >,
7147 offset: usize,
7148 _depth: fidl::encoding::Depth,
7149 ) -> fidl::Result<()> {
7150 decoder.debug_check_bounds::<Self>(offset);
7151 fidl::decode!(
7153 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiagnosticsMarker>>,
7154 fidl::encoding::DefaultFuchsiaResourceDialect,
7155 &mut self.diagnostics,
7156 decoder,
7157 offset + 0,
7158 _depth
7159 )?;
7160 Ok(())
7161 }
7162 }
7163
7164 impl fidl::encoding::ResourceTypeMarker for PortGetMacRequest {
7165 type Borrowed<'a> = &'a mut Self;
7166 fn take_or_borrow<'a>(
7167 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7168 ) -> Self::Borrowed<'a> {
7169 value
7170 }
7171 }
7172
7173 unsafe impl fidl::encoding::TypeMarker for PortGetMacRequest {
7174 type Owned = Self;
7175
7176 #[inline(always)]
7177 fn inline_align(_context: fidl::encoding::Context) -> usize {
7178 4
7179 }
7180
7181 #[inline(always)]
7182 fn inline_size(_context: fidl::encoding::Context) -> usize {
7183 4
7184 }
7185 }
7186
7187 unsafe impl
7188 fidl::encoding::Encode<PortGetMacRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7189 for &mut PortGetMacRequest
7190 {
7191 #[inline]
7192 unsafe fn encode(
7193 self,
7194 encoder: &mut fidl::encoding::Encoder<
7195 '_,
7196 fidl::encoding::DefaultFuchsiaResourceDialect,
7197 >,
7198 offset: usize,
7199 _depth: fidl::encoding::Depth,
7200 ) -> fidl::Result<()> {
7201 encoder.debug_check_bounds::<PortGetMacRequest>(offset);
7202 fidl::encoding::Encode::<PortGetMacRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7204 (
7205 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MacAddressingMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.mac),
7206 ),
7207 encoder, offset, _depth
7208 )
7209 }
7210 }
7211 unsafe impl<
7212 T0: fidl::encoding::Encode<
7213 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MacAddressingMarker>>,
7214 fidl::encoding::DefaultFuchsiaResourceDialect,
7215 >,
7216 >
7217 fidl::encoding::Encode<PortGetMacRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7218 for (T0,)
7219 {
7220 #[inline]
7221 unsafe fn encode(
7222 self,
7223 encoder: &mut fidl::encoding::Encoder<
7224 '_,
7225 fidl::encoding::DefaultFuchsiaResourceDialect,
7226 >,
7227 offset: usize,
7228 depth: fidl::encoding::Depth,
7229 ) -> fidl::Result<()> {
7230 encoder.debug_check_bounds::<PortGetMacRequest>(offset);
7231 self.0.encode(encoder, offset + 0, depth)?;
7235 Ok(())
7236 }
7237 }
7238
7239 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7240 for PortGetMacRequest
7241 {
7242 #[inline(always)]
7243 fn new_empty() -> Self {
7244 Self {
7245 mac: fidl::new_empty!(
7246 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MacAddressingMarker>>,
7247 fidl::encoding::DefaultFuchsiaResourceDialect
7248 ),
7249 }
7250 }
7251
7252 #[inline]
7253 unsafe fn decode(
7254 &mut self,
7255 decoder: &mut fidl::encoding::Decoder<
7256 '_,
7257 fidl::encoding::DefaultFuchsiaResourceDialect,
7258 >,
7259 offset: usize,
7260 _depth: fidl::encoding::Depth,
7261 ) -> fidl::Result<()> {
7262 decoder.debug_check_bounds::<Self>(offset);
7263 fidl::decode!(
7265 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MacAddressingMarker>>,
7266 fidl::encoding::DefaultFuchsiaResourceDialect,
7267 &mut self.mac,
7268 decoder,
7269 offset + 0,
7270 _depth
7271 )?;
7272 Ok(())
7273 }
7274 }
7275
7276 impl fidl::encoding::ResourceTypeMarker for PortGetStatusWatcherRequest {
7277 type Borrowed<'a> = &'a mut Self;
7278 fn take_or_borrow<'a>(
7279 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7280 ) -> Self::Borrowed<'a> {
7281 value
7282 }
7283 }
7284
7285 unsafe impl fidl::encoding::TypeMarker for PortGetStatusWatcherRequest {
7286 type Owned = Self;
7287
7288 #[inline(always)]
7289 fn inline_align(_context: fidl::encoding::Context) -> usize {
7290 4
7291 }
7292
7293 #[inline(always)]
7294 fn inline_size(_context: fidl::encoding::Context) -> usize {
7295 8
7296 }
7297 }
7298
7299 unsafe impl
7300 fidl::encoding::Encode<
7301 PortGetStatusWatcherRequest,
7302 fidl::encoding::DefaultFuchsiaResourceDialect,
7303 > for &mut PortGetStatusWatcherRequest
7304 {
7305 #[inline]
7306 unsafe fn encode(
7307 self,
7308 encoder: &mut fidl::encoding::Encoder<
7309 '_,
7310 fidl::encoding::DefaultFuchsiaResourceDialect,
7311 >,
7312 offset: usize,
7313 _depth: fidl::encoding::Depth,
7314 ) -> fidl::Result<()> {
7315 encoder.debug_check_bounds::<PortGetStatusWatcherRequest>(offset);
7316 fidl::encoding::Encode::<PortGetStatusWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7318 (
7319 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
7320 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer),
7321 ),
7322 encoder, offset, _depth
7323 )
7324 }
7325 }
7326 unsafe impl<
7327 T0: fidl::encoding::Encode<
7328 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusWatcherMarker>>,
7329 fidl::encoding::DefaultFuchsiaResourceDialect,
7330 >,
7331 T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
7332 >
7333 fidl::encoding::Encode<
7334 PortGetStatusWatcherRequest,
7335 fidl::encoding::DefaultFuchsiaResourceDialect,
7336 > for (T0, T1)
7337 {
7338 #[inline]
7339 unsafe fn encode(
7340 self,
7341 encoder: &mut fidl::encoding::Encoder<
7342 '_,
7343 fidl::encoding::DefaultFuchsiaResourceDialect,
7344 >,
7345 offset: usize,
7346 depth: fidl::encoding::Depth,
7347 ) -> fidl::Result<()> {
7348 encoder.debug_check_bounds::<PortGetStatusWatcherRequest>(offset);
7349 self.0.encode(encoder, offset + 0, depth)?;
7353 self.1.encode(encoder, offset + 4, depth)?;
7354 Ok(())
7355 }
7356 }
7357
7358 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7359 for PortGetStatusWatcherRequest
7360 {
7361 #[inline(always)]
7362 fn new_empty() -> Self {
7363 Self {
7364 watcher: fidl::new_empty!(
7365 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusWatcherMarker>>,
7366 fidl::encoding::DefaultFuchsiaResourceDialect
7367 ),
7368 buffer: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
7369 }
7370 }
7371
7372 #[inline]
7373 unsafe fn decode(
7374 &mut self,
7375 decoder: &mut fidl::encoding::Decoder<
7376 '_,
7377 fidl::encoding::DefaultFuchsiaResourceDialect,
7378 >,
7379 offset: usize,
7380 _depth: fidl::encoding::Depth,
7381 ) -> fidl::Result<()> {
7382 decoder.debug_check_bounds::<Self>(offset);
7383 fidl::decode!(
7385 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusWatcherMarker>>,
7386 fidl::encoding::DefaultFuchsiaResourceDialect,
7387 &mut self.watcher,
7388 decoder,
7389 offset + 0,
7390 _depth
7391 )?;
7392 fidl::decode!(
7393 u32,
7394 fidl::encoding::DefaultFuchsiaResourceDialect,
7395 &mut self.buffer,
7396 decoder,
7397 offset + 4,
7398 _depth
7399 )?;
7400 Ok(())
7401 }
7402 }
7403
7404 impl fidl::encoding::ResourceTypeMarker for SessionWatchDelegatedRxLeaseResponse {
7405 type Borrowed<'a> = &'a mut Self;
7406 fn take_or_borrow<'a>(
7407 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7408 ) -> Self::Borrowed<'a> {
7409 value
7410 }
7411 }
7412
7413 unsafe impl fidl::encoding::TypeMarker for SessionWatchDelegatedRxLeaseResponse {
7414 type Owned = Self;
7415
7416 #[inline(always)]
7417 fn inline_align(_context: fidl::encoding::Context) -> usize {
7418 8
7419 }
7420
7421 #[inline(always)]
7422 fn inline_size(_context: fidl::encoding::Context) -> usize {
7423 16
7424 }
7425 }
7426
7427 unsafe impl
7428 fidl::encoding::Encode<
7429 SessionWatchDelegatedRxLeaseResponse,
7430 fidl::encoding::DefaultFuchsiaResourceDialect,
7431 > for &mut SessionWatchDelegatedRxLeaseResponse
7432 {
7433 #[inline]
7434 unsafe fn encode(
7435 self,
7436 encoder: &mut fidl::encoding::Encoder<
7437 '_,
7438 fidl::encoding::DefaultFuchsiaResourceDialect,
7439 >,
7440 offset: usize,
7441 _depth: fidl::encoding::Depth,
7442 ) -> fidl::Result<()> {
7443 encoder.debug_check_bounds::<SessionWatchDelegatedRxLeaseResponse>(offset);
7444 fidl::encoding::Encode::<
7446 SessionWatchDelegatedRxLeaseResponse,
7447 fidl::encoding::DefaultFuchsiaResourceDialect,
7448 >::encode(
7449 (<DelegatedRxLease as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7450 &mut self.lease,
7451 ),),
7452 encoder,
7453 offset,
7454 _depth,
7455 )
7456 }
7457 }
7458 unsafe impl<
7459 T0: fidl::encoding::Encode<DelegatedRxLease, fidl::encoding::DefaultFuchsiaResourceDialect>,
7460 >
7461 fidl::encoding::Encode<
7462 SessionWatchDelegatedRxLeaseResponse,
7463 fidl::encoding::DefaultFuchsiaResourceDialect,
7464 > for (T0,)
7465 {
7466 #[inline]
7467 unsafe fn encode(
7468 self,
7469 encoder: &mut fidl::encoding::Encoder<
7470 '_,
7471 fidl::encoding::DefaultFuchsiaResourceDialect,
7472 >,
7473 offset: usize,
7474 depth: fidl::encoding::Depth,
7475 ) -> fidl::Result<()> {
7476 encoder.debug_check_bounds::<SessionWatchDelegatedRxLeaseResponse>(offset);
7477 self.0.encode(encoder, offset + 0, depth)?;
7481 Ok(())
7482 }
7483 }
7484
7485 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7486 for SessionWatchDelegatedRxLeaseResponse
7487 {
7488 #[inline(always)]
7489 fn new_empty() -> Self {
7490 Self {
7491 lease: fidl::new_empty!(
7492 DelegatedRxLease,
7493 fidl::encoding::DefaultFuchsiaResourceDialect
7494 ),
7495 }
7496 }
7497
7498 #[inline]
7499 unsafe fn decode(
7500 &mut self,
7501 decoder: &mut fidl::encoding::Decoder<
7502 '_,
7503 fidl::encoding::DefaultFuchsiaResourceDialect,
7504 >,
7505 offset: usize,
7506 _depth: fidl::encoding::Depth,
7507 ) -> fidl::Result<()> {
7508 decoder.debug_check_bounds::<Self>(offset);
7509 fidl::decode!(
7511 DelegatedRxLease,
7512 fidl::encoding::DefaultFuchsiaResourceDialect,
7513 &mut self.lease,
7514 decoder,
7515 offset + 0,
7516 _depth
7517 )?;
7518 Ok(())
7519 }
7520 }
7521
7522 impl DelegatedRxLease {
7523 #[inline(always)]
7524 fn max_ordinal_present(&self) -> u64 {
7525 if let Some(_) = self.handle {
7526 return 2;
7527 }
7528 if let Some(_) = self.hold_until_frame {
7529 return 1;
7530 }
7531 0
7532 }
7533 }
7534
7535 impl fidl::encoding::ResourceTypeMarker for DelegatedRxLease {
7536 type Borrowed<'a> = &'a mut Self;
7537 fn take_or_borrow<'a>(
7538 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7539 ) -> Self::Borrowed<'a> {
7540 value
7541 }
7542 }
7543
7544 unsafe impl fidl::encoding::TypeMarker for DelegatedRxLease {
7545 type Owned = Self;
7546
7547 #[inline(always)]
7548 fn inline_align(_context: fidl::encoding::Context) -> usize {
7549 8
7550 }
7551
7552 #[inline(always)]
7553 fn inline_size(_context: fidl::encoding::Context) -> usize {
7554 16
7555 }
7556 }
7557
7558 unsafe impl
7559 fidl::encoding::Encode<DelegatedRxLease, fidl::encoding::DefaultFuchsiaResourceDialect>
7560 for &mut DelegatedRxLease
7561 {
7562 unsafe fn encode(
7563 self,
7564 encoder: &mut fidl::encoding::Encoder<
7565 '_,
7566 fidl::encoding::DefaultFuchsiaResourceDialect,
7567 >,
7568 offset: usize,
7569 mut depth: fidl::encoding::Depth,
7570 ) -> fidl::Result<()> {
7571 encoder.debug_check_bounds::<DelegatedRxLease>(offset);
7572 let max_ordinal: u64 = self.max_ordinal_present();
7574 encoder.write_num(max_ordinal, offset);
7575 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7576 if max_ordinal == 0 {
7578 return Ok(());
7579 }
7580 depth.increment()?;
7581 let envelope_size = 8;
7582 let bytes_len = max_ordinal as usize * envelope_size;
7583 #[allow(unused_variables)]
7584 let offset = encoder.out_of_line_offset(bytes_len);
7585 let mut _prev_end_offset: usize = 0;
7586 if 1 > max_ordinal {
7587 return Ok(());
7588 }
7589
7590 let cur_offset: usize = (1 - 1) * envelope_size;
7593
7594 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7596
7597 fidl::encoding::encode_in_envelope_optional::<
7602 u64,
7603 fidl::encoding::DefaultFuchsiaResourceDialect,
7604 >(
7605 self.hold_until_frame
7606 .as_ref()
7607 .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
7608 encoder,
7609 offset + cur_offset,
7610 depth,
7611 )?;
7612
7613 _prev_end_offset = cur_offset + envelope_size;
7614 if 2 > max_ordinal {
7615 return Ok(());
7616 }
7617
7618 let cur_offset: usize = (2 - 1) * envelope_size;
7621
7622 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7624
7625 fidl::encoding::encode_in_envelope_optional::<
7630 DelegatedRxLeaseHandle,
7631 fidl::encoding::DefaultFuchsiaResourceDialect,
7632 >(
7633 self.handle.as_mut().map(
7634 <DelegatedRxLeaseHandle as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7635 ),
7636 encoder,
7637 offset + cur_offset,
7638 depth,
7639 )?;
7640
7641 _prev_end_offset = cur_offset + envelope_size;
7642
7643 Ok(())
7644 }
7645 }
7646
7647 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7648 for DelegatedRxLease
7649 {
7650 #[inline(always)]
7651 fn new_empty() -> Self {
7652 Self::default()
7653 }
7654
7655 unsafe fn decode(
7656 &mut self,
7657 decoder: &mut fidl::encoding::Decoder<
7658 '_,
7659 fidl::encoding::DefaultFuchsiaResourceDialect,
7660 >,
7661 offset: usize,
7662 mut depth: fidl::encoding::Depth,
7663 ) -> fidl::Result<()> {
7664 decoder.debug_check_bounds::<Self>(offset);
7665 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7666 None => return Err(fidl::Error::NotNullable),
7667 Some(len) => len,
7668 };
7669 if len == 0 {
7671 return Ok(());
7672 };
7673 depth.increment()?;
7674 let envelope_size = 8;
7675 let bytes_len = len * envelope_size;
7676 let offset = decoder.out_of_line_offset(bytes_len)?;
7677 let mut _next_ordinal_to_read = 0;
7679 let mut next_offset = offset;
7680 let end_offset = offset + bytes_len;
7681 _next_ordinal_to_read += 1;
7682 if next_offset >= end_offset {
7683 return Ok(());
7684 }
7685
7686 while _next_ordinal_to_read < 1 {
7688 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7689 _next_ordinal_to_read += 1;
7690 next_offset += envelope_size;
7691 }
7692
7693 let next_out_of_line = decoder.next_out_of_line();
7694 let handles_before = decoder.remaining_handles();
7695 if let Some((inlined, num_bytes, num_handles)) =
7696 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7697 {
7698 let member_inline_size =
7699 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7700 if inlined != (member_inline_size <= 4) {
7701 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7702 }
7703 let inner_offset;
7704 let mut inner_depth = depth.clone();
7705 if inlined {
7706 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7707 inner_offset = next_offset;
7708 } else {
7709 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7710 inner_depth.increment()?;
7711 }
7712 let val_ref = self.hold_until_frame.get_or_insert_with(|| {
7713 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
7714 });
7715 fidl::decode!(
7716 u64,
7717 fidl::encoding::DefaultFuchsiaResourceDialect,
7718 val_ref,
7719 decoder,
7720 inner_offset,
7721 inner_depth
7722 )?;
7723 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7724 {
7725 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7726 }
7727 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7728 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7729 }
7730 }
7731
7732 next_offset += envelope_size;
7733 _next_ordinal_to_read += 1;
7734 if next_offset >= end_offset {
7735 return Ok(());
7736 }
7737
7738 while _next_ordinal_to_read < 2 {
7740 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7741 _next_ordinal_to_read += 1;
7742 next_offset += envelope_size;
7743 }
7744
7745 let next_out_of_line = decoder.next_out_of_line();
7746 let handles_before = decoder.remaining_handles();
7747 if let Some((inlined, num_bytes, num_handles)) =
7748 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7749 {
7750 let member_inline_size =
7751 <DelegatedRxLeaseHandle as fidl::encoding::TypeMarker>::inline_size(
7752 decoder.context,
7753 );
7754 if inlined != (member_inline_size <= 4) {
7755 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7756 }
7757 let inner_offset;
7758 let mut inner_depth = depth.clone();
7759 if inlined {
7760 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7761 inner_offset = next_offset;
7762 } else {
7763 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7764 inner_depth.increment()?;
7765 }
7766 let val_ref = self.handle.get_or_insert_with(|| {
7767 fidl::new_empty!(
7768 DelegatedRxLeaseHandle,
7769 fidl::encoding::DefaultFuchsiaResourceDialect
7770 )
7771 });
7772 fidl::decode!(
7773 DelegatedRxLeaseHandle,
7774 fidl::encoding::DefaultFuchsiaResourceDialect,
7775 val_ref,
7776 decoder,
7777 inner_offset,
7778 inner_depth
7779 )?;
7780 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7781 {
7782 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7783 }
7784 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7785 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7786 }
7787 }
7788
7789 next_offset += envelope_size;
7790
7791 while next_offset < end_offset {
7793 _next_ordinal_to_read += 1;
7794 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7795 next_offset += envelope_size;
7796 }
7797
7798 Ok(())
7799 }
7800 }
7801
7802 impl SessionInfo {
7803 #[inline(always)]
7804 fn max_ordinal_present(&self) -> u64 {
7805 if let Some(_) = self.options {
7806 return 6;
7807 }
7808 if let Some(_) = self.descriptor_count {
7809 return 5;
7810 }
7811 if let Some(_) = self.descriptor_length {
7812 return 4;
7813 }
7814 if let Some(_) = self.descriptor_version {
7815 return 3;
7816 }
7817 if let Some(_) = self.data {
7818 return 2;
7819 }
7820 if let Some(_) = self.descriptors {
7821 return 1;
7822 }
7823 0
7824 }
7825 }
7826
7827 impl fidl::encoding::ResourceTypeMarker for SessionInfo {
7828 type Borrowed<'a> = &'a mut Self;
7829 fn take_or_borrow<'a>(
7830 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7831 ) -> Self::Borrowed<'a> {
7832 value
7833 }
7834 }
7835
7836 unsafe impl fidl::encoding::TypeMarker for SessionInfo {
7837 type Owned = Self;
7838
7839 #[inline(always)]
7840 fn inline_align(_context: fidl::encoding::Context) -> usize {
7841 8
7842 }
7843
7844 #[inline(always)]
7845 fn inline_size(_context: fidl::encoding::Context) -> usize {
7846 16
7847 }
7848 }
7849
7850 unsafe impl fidl::encoding::Encode<SessionInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
7851 for &mut SessionInfo
7852 {
7853 unsafe fn encode(
7854 self,
7855 encoder: &mut fidl::encoding::Encoder<
7856 '_,
7857 fidl::encoding::DefaultFuchsiaResourceDialect,
7858 >,
7859 offset: usize,
7860 mut depth: fidl::encoding::Depth,
7861 ) -> fidl::Result<()> {
7862 encoder.debug_check_bounds::<SessionInfo>(offset);
7863 let max_ordinal: u64 = self.max_ordinal_present();
7865 encoder.write_num(max_ordinal, offset);
7866 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7867 if max_ordinal == 0 {
7869 return Ok(());
7870 }
7871 depth.increment()?;
7872 let envelope_size = 8;
7873 let bytes_len = max_ordinal as usize * envelope_size;
7874 #[allow(unused_variables)]
7875 let offset = encoder.out_of_line_offset(bytes_len);
7876 let mut _prev_end_offset: usize = 0;
7877 if 1 > max_ordinal {
7878 return Ok(());
7879 }
7880
7881 let cur_offset: usize = (1 - 1) * envelope_size;
7884
7885 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7887
7888 fidl::encoding::encode_in_envelope_optional::<
7893 fidl::encoding::HandleType<
7894 fidl::Vmo,
7895 { fidl::ObjectType::VMO.into_raw() },
7896 2147483648,
7897 >,
7898 fidl::encoding::DefaultFuchsiaResourceDialect,
7899 >(
7900 self.descriptors.as_mut().map(
7901 <fidl::encoding::HandleType<
7902 fidl::Vmo,
7903 { fidl::ObjectType::VMO.into_raw() },
7904 2147483648,
7905 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7906 ),
7907 encoder,
7908 offset + cur_offset,
7909 depth,
7910 )?;
7911
7912 _prev_end_offset = cur_offset + envelope_size;
7913 if 2 > max_ordinal {
7914 return Ok(());
7915 }
7916
7917 let cur_offset: usize = (2 - 1) * envelope_size;
7920
7921 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7923
7924 fidl::encoding::encode_in_envelope_optional::<
7929 fidl::encoding::HandleType<
7930 fidl::Vmo,
7931 { fidl::ObjectType::VMO.into_raw() },
7932 2147483648,
7933 >,
7934 fidl::encoding::DefaultFuchsiaResourceDialect,
7935 >(
7936 self.data.as_mut().map(
7937 <fidl::encoding::HandleType<
7938 fidl::Vmo,
7939 { fidl::ObjectType::VMO.into_raw() },
7940 2147483648,
7941 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7942 ),
7943 encoder,
7944 offset + cur_offset,
7945 depth,
7946 )?;
7947
7948 _prev_end_offset = cur_offset + envelope_size;
7949 if 3 > max_ordinal {
7950 return Ok(());
7951 }
7952
7953 let cur_offset: usize = (3 - 1) * envelope_size;
7956
7957 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7959
7960 fidl::encoding::encode_in_envelope_optional::<
7965 u8,
7966 fidl::encoding::DefaultFuchsiaResourceDialect,
7967 >(
7968 self.descriptor_version
7969 .as_ref()
7970 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
7971 encoder,
7972 offset + cur_offset,
7973 depth,
7974 )?;
7975
7976 _prev_end_offset = cur_offset + envelope_size;
7977 if 4 > max_ordinal {
7978 return Ok(());
7979 }
7980
7981 let cur_offset: usize = (4 - 1) * envelope_size;
7984
7985 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7987
7988 fidl::encoding::encode_in_envelope_optional::<
7993 u8,
7994 fidl::encoding::DefaultFuchsiaResourceDialect,
7995 >(
7996 self.descriptor_length
7997 .as_ref()
7998 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
7999 encoder,
8000 offset + cur_offset,
8001 depth,
8002 )?;
8003
8004 _prev_end_offset = cur_offset + envelope_size;
8005 if 5 > max_ordinal {
8006 return Ok(());
8007 }
8008
8009 let cur_offset: usize = (5 - 1) * envelope_size;
8012
8013 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8015
8016 fidl::encoding::encode_in_envelope_optional::<
8021 u16,
8022 fidl::encoding::DefaultFuchsiaResourceDialect,
8023 >(
8024 self.descriptor_count
8025 .as_ref()
8026 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
8027 encoder,
8028 offset + cur_offset,
8029 depth,
8030 )?;
8031
8032 _prev_end_offset = cur_offset + envelope_size;
8033 if 6 > max_ordinal {
8034 return Ok(());
8035 }
8036
8037 let cur_offset: usize = (6 - 1) * envelope_size;
8040
8041 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8043
8044 fidl::encoding::encode_in_envelope_optional::<
8049 SessionFlags,
8050 fidl::encoding::DefaultFuchsiaResourceDialect,
8051 >(
8052 self.options
8053 .as_ref()
8054 .map(<SessionFlags as fidl::encoding::ValueTypeMarker>::borrow),
8055 encoder,
8056 offset + cur_offset,
8057 depth,
8058 )?;
8059
8060 _prev_end_offset = cur_offset + envelope_size;
8061
8062 Ok(())
8063 }
8064 }
8065
8066 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for SessionInfo {
8067 #[inline(always)]
8068 fn new_empty() -> Self {
8069 Self::default()
8070 }
8071
8072 unsafe fn decode(
8073 &mut self,
8074 decoder: &mut fidl::encoding::Decoder<
8075 '_,
8076 fidl::encoding::DefaultFuchsiaResourceDialect,
8077 >,
8078 offset: usize,
8079 mut depth: fidl::encoding::Depth,
8080 ) -> fidl::Result<()> {
8081 decoder.debug_check_bounds::<Self>(offset);
8082 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8083 None => return Err(fidl::Error::NotNullable),
8084 Some(len) => len,
8085 };
8086 if len == 0 {
8088 return Ok(());
8089 };
8090 depth.increment()?;
8091 let envelope_size = 8;
8092 let bytes_len = len * envelope_size;
8093 let offset = decoder.out_of_line_offset(bytes_len)?;
8094 let mut _next_ordinal_to_read = 0;
8096 let mut next_offset = offset;
8097 let end_offset = offset + bytes_len;
8098 _next_ordinal_to_read += 1;
8099 if next_offset >= end_offset {
8100 return Ok(());
8101 }
8102
8103 while _next_ordinal_to_read < 1 {
8105 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8106 _next_ordinal_to_read += 1;
8107 next_offset += envelope_size;
8108 }
8109
8110 let next_out_of_line = decoder.next_out_of_line();
8111 let handles_before = decoder.remaining_handles();
8112 if let Some((inlined, num_bytes, num_handles)) =
8113 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8114 {
8115 let member_inline_size = <fidl::encoding::HandleType<
8116 fidl::Vmo,
8117 { fidl::ObjectType::VMO.into_raw() },
8118 2147483648,
8119 > as fidl::encoding::TypeMarker>::inline_size(
8120 decoder.context
8121 );
8122 if inlined != (member_inline_size <= 4) {
8123 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8124 }
8125 let inner_offset;
8126 let mut inner_depth = depth.clone();
8127 if inlined {
8128 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8129 inner_offset = next_offset;
8130 } else {
8131 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8132 inner_depth.increment()?;
8133 }
8134 let val_ref =
8135 self.descriptors.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
8136 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8137 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8138 {
8139 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8140 }
8141 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8142 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8143 }
8144 }
8145
8146 next_offset += envelope_size;
8147 _next_ordinal_to_read += 1;
8148 if next_offset >= end_offset {
8149 return Ok(());
8150 }
8151
8152 while _next_ordinal_to_read < 2 {
8154 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8155 _next_ordinal_to_read += 1;
8156 next_offset += envelope_size;
8157 }
8158
8159 let next_out_of_line = decoder.next_out_of_line();
8160 let handles_before = decoder.remaining_handles();
8161 if let Some((inlined, num_bytes, num_handles)) =
8162 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8163 {
8164 let member_inline_size = <fidl::encoding::HandleType<
8165 fidl::Vmo,
8166 { fidl::ObjectType::VMO.into_raw() },
8167 2147483648,
8168 > as fidl::encoding::TypeMarker>::inline_size(
8169 decoder.context
8170 );
8171 if inlined != (member_inline_size <= 4) {
8172 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8173 }
8174 let inner_offset;
8175 let mut inner_depth = depth.clone();
8176 if inlined {
8177 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8178 inner_offset = next_offset;
8179 } else {
8180 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8181 inner_depth.increment()?;
8182 }
8183 let val_ref =
8184 self.data.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
8185 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8186 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8187 {
8188 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8189 }
8190 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8191 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8192 }
8193 }
8194
8195 next_offset += envelope_size;
8196 _next_ordinal_to_read += 1;
8197 if next_offset >= end_offset {
8198 return Ok(());
8199 }
8200
8201 while _next_ordinal_to_read < 3 {
8203 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8204 _next_ordinal_to_read += 1;
8205 next_offset += envelope_size;
8206 }
8207
8208 let next_out_of_line = decoder.next_out_of_line();
8209 let handles_before = decoder.remaining_handles();
8210 if let Some((inlined, num_bytes, num_handles)) =
8211 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8212 {
8213 let member_inline_size =
8214 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8215 if inlined != (member_inline_size <= 4) {
8216 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8217 }
8218 let inner_offset;
8219 let mut inner_depth = depth.clone();
8220 if inlined {
8221 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8222 inner_offset = next_offset;
8223 } else {
8224 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8225 inner_depth.increment()?;
8226 }
8227 let val_ref = self.descriptor_version.get_or_insert_with(|| {
8228 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
8229 });
8230 fidl::decode!(
8231 u8,
8232 fidl::encoding::DefaultFuchsiaResourceDialect,
8233 val_ref,
8234 decoder,
8235 inner_offset,
8236 inner_depth
8237 )?;
8238 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8239 {
8240 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8241 }
8242 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8243 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8244 }
8245 }
8246
8247 next_offset += envelope_size;
8248 _next_ordinal_to_read += 1;
8249 if next_offset >= end_offset {
8250 return Ok(());
8251 }
8252
8253 while _next_ordinal_to_read < 4 {
8255 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8256 _next_ordinal_to_read += 1;
8257 next_offset += envelope_size;
8258 }
8259
8260 let next_out_of_line = decoder.next_out_of_line();
8261 let handles_before = decoder.remaining_handles();
8262 if let Some((inlined, num_bytes, num_handles)) =
8263 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8264 {
8265 let member_inline_size =
8266 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8267 if inlined != (member_inline_size <= 4) {
8268 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8269 }
8270 let inner_offset;
8271 let mut inner_depth = depth.clone();
8272 if inlined {
8273 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8274 inner_offset = next_offset;
8275 } else {
8276 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8277 inner_depth.increment()?;
8278 }
8279 let val_ref = self.descriptor_length.get_or_insert_with(|| {
8280 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
8281 });
8282 fidl::decode!(
8283 u8,
8284 fidl::encoding::DefaultFuchsiaResourceDialect,
8285 val_ref,
8286 decoder,
8287 inner_offset,
8288 inner_depth
8289 )?;
8290 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8291 {
8292 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8293 }
8294 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8295 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8296 }
8297 }
8298
8299 next_offset += envelope_size;
8300 _next_ordinal_to_read += 1;
8301 if next_offset >= end_offset {
8302 return Ok(());
8303 }
8304
8305 while _next_ordinal_to_read < 5 {
8307 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8308 _next_ordinal_to_read += 1;
8309 next_offset += envelope_size;
8310 }
8311
8312 let next_out_of_line = decoder.next_out_of_line();
8313 let handles_before = decoder.remaining_handles();
8314 if let Some((inlined, num_bytes, num_handles)) =
8315 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8316 {
8317 let member_inline_size =
8318 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8319 if inlined != (member_inline_size <= 4) {
8320 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8321 }
8322 let inner_offset;
8323 let mut inner_depth = depth.clone();
8324 if inlined {
8325 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8326 inner_offset = next_offset;
8327 } else {
8328 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8329 inner_depth.increment()?;
8330 }
8331 let val_ref = self.descriptor_count.get_or_insert_with(|| {
8332 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
8333 });
8334 fidl::decode!(
8335 u16,
8336 fidl::encoding::DefaultFuchsiaResourceDialect,
8337 val_ref,
8338 decoder,
8339 inner_offset,
8340 inner_depth
8341 )?;
8342 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8343 {
8344 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8345 }
8346 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8347 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8348 }
8349 }
8350
8351 next_offset += envelope_size;
8352 _next_ordinal_to_read += 1;
8353 if next_offset >= end_offset {
8354 return Ok(());
8355 }
8356
8357 while _next_ordinal_to_read < 6 {
8359 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8360 _next_ordinal_to_read += 1;
8361 next_offset += envelope_size;
8362 }
8363
8364 let next_out_of_line = decoder.next_out_of_line();
8365 let handles_before = decoder.remaining_handles();
8366 if let Some((inlined, num_bytes, num_handles)) =
8367 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8368 {
8369 let member_inline_size =
8370 <SessionFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8371 if inlined != (member_inline_size <= 4) {
8372 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8373 }
8374 let inner_offset;
8375 let mut inner_depth = depth.clone();
8376 if inlined {
8377 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8378 inner_offset = next_offset;
8379 } else {
8380 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8381 inner_depth.increment()?;
8382 }
8383 let val_ref = self.options.get_or_insert_with(|| {
8384 fidl::new_empty!(SessionFlags, fidl::encoding::DefaultFuchsiaResourceDialect)
8385 });
8386 fidl::decode!(
8387 SessionFlags,
8388 fidl::encoding::DefaultFuchsiaResourceDialect,
8389 val_ref,
8390 decoder,
8391 inner_offset,
8392 inner_depth
8393 )?;
8394 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8395 {
8396 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8397 }
8398 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8399 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8400 }
8401 }
8402
8403 next_offset += envelope_size;
8404
8405 while next_offset < end_offset {
8407 _next_ordinal_to_read += 1;
8408 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8409 next_offset += envelope_size;
8410 }
8411
8412 Ok(())
8413 }
8414 }
8415
8416 impl fidl::encoding::ResourceTypeMarker for DelegatedRxLeaseHandle {
8417 type Borrowed<'a> = &'a mut Self;
8418 fn take_or_borrow<'a>(
8419 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8420 ) -> Self::Borrowed<'a> {
8421 value
8422 }
8423 }
8424
8425 unsafe impl fidl::encoding::TypeMarker for DelegatedRxLeaseHandle {
8426 type Owned = Self;
8427
8428 #[inline(always)]
8429 fn inline_align(_context: fidl::encoding::Context) -> usize {
8430 8
8431 }
8432
8433 #[inline(always)]
8434 fn inline_size(_context: fidl::encoding::Context) -> usize {
8435 16
8436 }
8437 }
8438
8439 unsafe impl
8440 fidl::encoding::Encode<
8441 DelegatedRxLeaseHandle,
8442 fidl::encoding::DefaultFuchsiaResourceDialect,
8443 > for &mut DelegatedRxLeaseHandle
8444 {
8445 #[inline]
8446 unsafe fn encode(
8447 self,
8448 encoder: &mut fidl::encoding::Encoder<
8449 '_,
8450 fidl::encoding::DefaultFuchsiaResourceDialect,
8451 >,
8452 offset: usize,
8453 _depth: fidl::encoding::Depth,
8454 ) -> fidl::Result<()> {
8455 encoder.debug_check_bounds::<DelegatedRxLeaseHandle>(offset);
8456 encoder.write_num::<u64>(self.ordinal(), offset);
8457 match self {
8458 DelegatedRxLeaseHandle::Channel(ref mut val) => {
8459 fidl::encoding::encode_in_envelope::<
8460 fidl::encoding::HandleType<
8461 fidl::Channel,
8462 { fidl::ObjectType::CHANNEL.into_raw() },
8463 2147483648,
8464 >,
8465 fidl::encoding::DefaultFuchsiaResourceDialect,
8466 >(
8467 <fidl::encoding::HandleType<
8468 fidl::Channel,
8469 { fidl::ObjectType::CHANNEL.into_raw() },
8470 2147483648,
8471 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8472 val
8473 ),
8474 encoder,
8475 offset + 8,
8476 _depth,
8477 )
8478 }
8479 DelegatedRxLeaseHandle::__SourceBreaking { .. } => {
8480 Err(fidl::Error::UnknownUnionTag)
8481 }
8482 }
8483 }
8484 }
8485
8486 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8487 for DelegatedRxLeaseHandle
8488 {
8489 #[inline(always)]
8490 fn new_empty() -> Self {
8491 Self::__SourceBreaking { unknown_ordinal: 0 }
8492 }
8493
8494 #[inline]
8495 unsafe fn decode(
8496 &mut self,
8497 decoder: &mut fidl::encoding::Decoder<
8498 '_,
8499 fidl::encoding::DefaultFuchsiaResourceDialect,
8500 >,
8501 offset: usize,
8502 mut depth: fidl::encoding::Depth,
8503 ) -> fidl::Result<()> {
8504 decoder.debug_check_bounds::<Self>(offset);
8505 #[allow(unused_variables)]
8506 let next_out_of_line = decoder.next_out_of_line();
8507 let handles_before = decoder.remaining_handles();
8508 let (ordinal, inlined, num_bytes, num_handles) =
8509 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
8510
8511 let member_inline_size = match ordinal {
8512 1 => <fidl::encoding::HandleType<
8513 fidl::Channel,
8514 { fidl::ObjectType::CHANNEL.into_raw() },
8515 2147483648,
8516 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8517 0 => return Err(fidl::Error::UnknownUnionTag),
8518 _ => num_bytes as usize,
8519 };
8520
8521 if inlined != (member_inline_size <= 4) {
8522 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8523 }
8524 let _inner_offset;
8525 if inlined {
8526 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
8527 _inner_offset = offset + 8;
8528 } else {
8529 depth.increment()?;
8530 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8531 }
8532 match ordinal {
8533 1 => {
8534 #[allow(irrefutable_let_patterns)]
8535 if let DelegatedRxLeaseHandle::Channel(_) = self {
8536 } else {
8538 *self = DelegatedRxLeaseHandle::Channel(
8540 fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8541 );
8542 }
8543 #[allow(irrefutable_let_patterns)]
8544 if let DelegatedRxLeaseHandle::Channel(ref mut val) = self {
8545 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
8546 } else {
8547 unreachable!()
8548 }
8549 }
8550 #[allow(deprecated)]
8551 ordinal => {
8552 for _ in 0..num_handles {
8553 decoder.drop_next_handle()?;
8554 }
8555 *self = DelegatedRxLeaseHandle::__SourceBreaking { unknown_ordinal: ordinal };
8556 }
8557 }
8558 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
8559 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8560 }
8561 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8562 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8563 }
8564 Ok(())
8565 }
8566 }
8567}