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 PortGetIdentityResponse {
105 pub event: fidl::Event,
106}
107
108impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PortGetIdentityResponse {}
109
110#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
111pub struct PortGetMacRequest {
112 pub mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
113}
114
115impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PortGetMacRequest {}
116
117#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
118pub struct PortGetStatusWatcherRequest {
119 pub watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
120 pub buffer: u32,
121}
122
123impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
124 for PortGetStatusWatcherRequest
125{
126}
127
128#[derive(Debug, PartialEq)]
129pub struct SessionWatchDelegatedRxLeaseResponse {
130 pub lease: DelegatedRxLease,
131}
132
133impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
134 for SessionWatchDelegatedRxLeaseResponse
135{
136}
137
138#[derive(Debug, Default, PartialEq)]
140pub struct DelegatedRxLease {
141 pub hold_until_frame: Option<u64>,
157 pub handle: Option<DelegatedRxLeaseHandle>,
161 #[doc(hidden)]
162 pub __source_breaking: fidl::marker::SourceBreaking,
163}
164
165impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DelegatedRxLease {}
166
167#[derive(Debug, Default, PartialEq)]
169pub struct SessionInfo {
170 pub descriptors: Option<fidl::Vmo>,
175 pub data: Option<fidl::Vmo>,
180 pub descriptor_version: Option<u8>,
185 pub descriptor_length: Option<u8>,
191 pub descriptor_count: Option<u16>,
196 pub options: Option<SessionFlags>,
198 #[doc(hidden)]
199 pub __source_breaking: fidl::marker::SourceBreaking,
200}
201
202impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionInfo {}
203
204#[derive(Debug)]
205pub enum DelegatedRxLeaseHandle {
206 Channel(fidl::Channel),
210 Eventpair(fidl::EventPair),
214 #[doc(hidden)]
215 __SourceBreaking { unknown_ordinal: u64 },
216}
217
218#[macro_export]
220macro_rules! DelegatedRxLeaseHandleUnknown {
221 () => {
222 _
223 };
224}
225
226impl PartialEq for DelegatedRxLeaseHandle {
228 fn eq(&self, other: &Self) -> bool {
229 match (self, other) {
230 (Self::Channel(x), Self::Channel(y)) => *x == *y,
231 (Self::Eventpair(x), Self::Eventpair(y)) => *x == *y,
232 _ => false,
233 }
234 }
235}
236
237impl DelegatedRxLeaseHandle {
238 #[inline]
239 pub fn ordinal(&self) -> u64 {
240 match *self {
241 Self::Channel(_) => 1,
242 Self::Eventpair(_) => 2,
243 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
244 }
245 }
246
247 #[inline]
248 pub fn unknown_variant_for_testing() -> Self {
249 Self::__SourceBreaking { unknown_ordinal: 0 }
250 }
251
252 #[inline]
253 pub fn is_unknown(&self) -> bool {
254 match self {
255 Self::__SourceBreaking { .. } => true,
256 _ => false,
257 }
258 }
259}
260
261impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DelegatedRxLeaseHandle {}
262
263#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
264pub struct DeviceMarker;
265
266impl fidl::endpoints::ProtocolMarker for DeviceMarker {
267 type Proxy = DeviceProxy;
268 type RequestStream = DeviceRequestStream;
269 #[cfg(target_os = "fuchsia")]
270 type SynchronousProxy = DeviceSynchronousProxy;
271
272 const DEBUG_NAME: &'static str = "(anonymous) Device";
273}
274pub type DeviceOpenSessionResult = Result<(fidl::endpoints::ClientEnd<SessionMarker>, Fifos), i32>;
275
276pub trait DeviceProxyInterface: Send + Sync {
277 type GetInfoResponseFut: std::future::Future<Output = Result<DeviceInfo, fidl::Error>> + Send;
278 fn r#get_info(&self) -> Self::GetInfoResponseFut;
279 type OpenSessionResponseFut: std::future::Future<Output = Result<DeviceOpenSessionResult, fidl::Error>>
280 + Send;
281 fn r#open_session(
282 &self,
283 session_name: &str,
284 session_info: SessionInfo,
285 ) -> Self::OpenSessionResponseFut;
286 fn r#get_port(
287 &self,
288 id: &PortId,
289 port: fidl::endpoints::ServerEnd<PortMarker>,
290 ) -> Result<(), fidl::Error>;
291 fn r#get_port_watcher(
292 &self,
293 watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
294 ) -> Result<(), fidl::Error>;
295 fn r#clone(&self, device: fidl::endpoints::ServerEnd<DeviceMarker>) -> Result<(), fidl::Error>;
296}
297#[derive(Debug)]
298#[cfg(target_os = "fuchsia")]
299pub struct DeviceSynchronousProxy {
300 client: fidl::client::sync::Client,
301}
302
303#[cfg(target_os = "fuchsia")]
304impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
305 type Proxy = DeviceProxy;
306 type Protocol = DeviceMarker;
307
308 fn from_channel(inner: fidl::Channel) -> Self {
309 Self::new(inner)
310 }
311
312 fn into_channel(self) -> fidl::Channel {
313 self.client.into_channel()
314 }
315
316 fn as_channel(&self) -> &fidl::Channel {
317 self.client.as_channel()
318 }
319}
320
321#[cfg(target_os = "fuchsia")]
322impl DeviceSynchronousProxy {
323 pub fn new(channel: fidl::Channel) -> Self {
324 Self { client: fidl::client::sync::Client::new(channel) }
325 }
326
327 pub fn into_channel(self) -> fidl::Channel {
328 self.client.into_channel()
329 }
330
331 pub fn wait_for_event(
334 &self,
335 deadline: zx::MonotonicInstant,
336 ) -> Result<DeviceEvent, fidl::Error> {
337 DeviceEvent::decode(self.client.wait_for_event::<DeviceMarker>(deadline)?)
338 }
339
340 pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<DeviceInfo, fidl::Error> {
344 let _response = self
345 .client
346 .send_query::<fidl::encoding::EmptyPayload, DeviceGetInfoResponse, DeviceMarker>(
347 (),
348 0x3c500ca9341e8f56,
349 fidl::encoding::DynamicFlags::empty(),
350 ___deadline,
351 )?;
352 Ok(_response.info)
353 }
354
355 pub fn r#open_session(
370 &self,
371 mut session_name: &str,
372 mut session_info: SessionInfo,
373 ___deadline: zx::MonotonicInstant,
374 ) -> Result<DeviceOpenSessionResult, fidl::Error> {
375 let _response = self.client.send_query::<
376 DeviceOpenSessionRequest,
377 fidl::encoding::ResultType<DeviceOpenSessionResponse, i32>,
378 DeviceMarker,
379 >(
380 (session_name, &mut session_info,),
381 0x25940b82146dcf67,
382 fidl::encoding::DynamicFlags::empty(),
383 ___deadline,
384 )?;
385 Ok(_response.map(|x| (x.session, x.fifos)))
386 }
387
388 pub fn r#get_port(
396 &self,
397 mut id: &PortId,
398 mut port: fidl::endpoints::ServerEnd<PortMarker>,
399 ) -> Result<(), fidl::Error> {
400 self.client.send::<DeviceGetPortRequest>(
401 (id, port),
402 0x340a852c955ba2a6,
403 fidl::encoding::DynamicFlags::empty(),
404 )
405 }
406
407 pub fn r#get_port_watcher(
411 &self,
412 mut watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
413 ) -> Result<(), fidl::Error> {
414 self.client.send::<DeviceGetPortWatcherRequest>(
415 (watcher,),
416 0x104f43c937c39f0c,
417 fidl::encoding::DynamicFlags::empty(),
418 )
419 }
420
421 pub fn r#clone(
425 &self,
426 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
427 ) -> Result<(), fidl::Error> {
428 self.client.send::<DeviceCloneRequest>(
429 (device,),
430 0x5882ea09b3809af4,
431 fidl::encoding::DynamicFlags::empty(),
432 )
433 }
434}
435
436#[cfg(target_os = "fuchsia")]
437impl From<DeviceSynchronousProxy> for zx::NullableHandle {
438 fn from(value: DeviceSynchronousProxy) -> Self {
439 value.into_channel().into()
440 }
441}
442
443#[cfg(target_os = "fuchsia")]
444impl From<fidl::Channel> for DeviceSynchronousProxy {
445 fn from(value: fidl::Channel) -> Self {
446 Self::new(value)
447 }
448}
449
450#[cfg(target_os = "fuchsia")]
451impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
452 type Protocol = DeviceMarker;
453
454 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
455 Self::new(value.into_channel())
456 }
457}
458
459#[derive(Debug, Clone)]
460pub struct DeviceProxy {
461 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
462}
463
464impl fidl::endpoints::Proxy for DeviceProxy {
465 type Protocol = DeviceMarker;
466
467 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
468 Self::new(inner)
469 }
470
471 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
472 self.client.into_channel().map_err(|client| Self { client })
473 }
474
475 fn as_channel(&self) -> &::fidl::AsyncChannel {
476 self.client.as_channel()
477 }
478}
479
480impl DeviceProxy {
481 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
483 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
484 Self { client: fidl::client::Client::new(channel, protocol_name) }
485 }
486
487 pub fn take_event_stream(&self) -> DeviceEventStream {
493 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
494 }
495
496 pub fn r#get_info(
500 &self,
501 ) -> fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
502 {
503 DeviceProxyInterface::r#get_info(self)
504 }
505
506 pub fn r#open_session(
521 &self,
522 mut session_name: &str,
523 mut session_info: SessionInfo,
524 ) -> fidl::client::QueryResponseFut<
525 DeviceOpenSessionResult,
526 fidl::encoding::DefaultFuchsiaResourceDialect,
527 > {
528 DeviceProxyInterface::r#open_session(self, session_name, session_info)
529 }
530
531 pub fn r#get_port(
539 &self,
540 mut id: &PortId,
541 mut port: fidl::endpoints::ServerEnd<PortMarker>,
542 ) -> Result<(), fidl::Error> {
543 DeviceProxyInterface::r#get_port(self, id, port)
544 }
545
546 pub fn r#get_port_watcher(
550 &self,
551 mut watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
552 ) -> Result<(), fidl::Error> {
553 DeviceProxyInterface::r#get_port_watcher(self, watcher)
554 }
555
556 pub fn r#clone(
560 &self,
561 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
562 ) -> Result<(), fidl::Error> {
563 DeviceProxyInterface::r#clone(self, device)
564 }
565}
566
567impl DeviceProxyInterface for DeviceProxy {
568 type GetInfoResponseFut =
569 fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
570 fn r#get_info(&self) -> Self::GetInfoResponseFut {
571 fn _decode(
572 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
573 ) -> Result<DeviceInfo, fidl::Error> {
574 let _response = fidl::client::decode_transaction_body::<
575 DeviceGetInfoResponse,
576 fidl::encoding::DefaultFuchsiaResourceDialect,
577 0x3c500ca9341e8f56,
578 >(_buf?)?;
579 Ok(_response.info)
580 }
581 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceInfo>(
582 (),
583 0x3c500ca9341e8f56,
584 fidl::encoding::DynamicFlags::empty(),
585 _decode,
586 )
587 }
588
589 type OpenSessionResponseFut = fidl::client::QueryResponseFut<
590 DeviceOpenSessionResult,
591 fidl::encoding::DefaultFuchsiaResourceDialect,
592 >;
593 fn r#open_session(
594 &self,
595 mut session_name: &str,
596 mut session_info: SessionInfo,
597 ) -> Self::OpenSessionResponseFut {
598 fn _decode(
599 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
600 ) -> Result<DeviceOpenSessionResult, fidl::Error> {
601 let _response = fidl::client::decode_transaction_body::<
602 fidl::encoding::ResultType<DeviceOpenSessionResponse, i32>,
603 fidl::encoding::DefaultFuchsiaResourceDialect,
604 0x25940b82146dcf67,
605 >(_buf?)?;
606 Ok(_response.map(|x| (x.session, x.fifos)))
607 }
608 self.client.send_query_and_decode::<DeviceOpenSessionRequest, DeviceOpenSessionResult>(
609 (session_name, &mut session_info),
610 0x25940b82146dcf67,
611 fidl::encoding::DynamicFlags::empty(),
612 _decode,
613 )
614 }
615
616 fn r#get_port(
617 &self,
618 mut id: &PortId,
619 mut port: fidl::endpoints::ServerEnd<PortMarker>,
620 ) -> Result<(), fidl::Error> {
621 self.client.send::<DeviceGetPortRequest>(
622 (id, port),
623 0x340a852c955ba2a6,
624 fidl::encoding::DynamicFlags::empty(),
625 )
626 }
627
628 fn r#get_port_watcher(
629 &self,
630 mut watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
631 ) -> Result<(), fidl::Error> {
632 self.client.send::<DeviceGetPortWatcherRequest>(
633 (watcher,),
634 0x104f43c937c39f0c,
635 fidl::encoding::DynamicFlags::empty(),
636 )
637 }
638
639 fn r#clone(
640 &self,
641 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
642 ) -> Result<(), fidl::Error> {
643 self.client.send::<DeviceCloneRequest>(
644 (device,),
645 0x5882ea09b3809af4,
646 fidl::encoding::DynamicFlags::empty(),
647 )
648 }
649}
650
651pub struct DeviceEventStream {
652 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
653}
654
655impl std::marker::Unpin for DeviceEventStream {}
656
657impl futures::stream::FusedStream for DeviceEventStream {
658 fn is_terminated(&self) -> bool {
659 self.event_receiver.is_terminated()
660 }
661}
662
663impl futures::Stream for DeviceEventStream {
664 type Item = Result<DeviceEvent, fidl::Error>;
665
666 fn poll_next(
667 mut self: std::pin::Pin<&mut Self>,
668 cx: &mut std::task::Context<'_>,
669 ) -> std::task::Poll<Option<Self::Item>> {
670 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
671 &mut self.event_receiver,
672 cx
673 )?) {
674 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
675 None => std::task::Poll::Ready(None),
676 }
677 }
678}
679
680#[derive(Debug)]
681pub enum DeviceEvent {}
682
683impl DeviceEvent {
684 fn decode(
686 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
687 ) -> Result<DeviceEvent, fidl::Error> {
688 let (bytes, _handles) = buf.split_mut();
689 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
690 debug_assert_eq!(tx_header.tx_id, 0);
691 match tx_header.ordinal {
692 _ => Err(fidl::Error::UnknownOrdinal {
693 ordinal: tx_header.ordinal,
694 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
695 }),
696 }
697 }
698}
699
700pub struct DeviceRequestStream {
702 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
703 is_terminated: bool,
704}
705
706impl std::marker::Unpin for DeviceRequestStream {}
707
708impl futures::stream::FusedStream for DeviceRequestStream {
709 fn is_terminated(&self) -> bool {
710 self.is_terminated
711 }
712}
713
714impl fidl::endpoints::RequestStream for DeviceRequestStream {
715 type Protocol = DeviceMarker;
716 type ControlHandle = DeviceControlHandle;
717
718 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
719 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
720 }
721
722 fn control_handle(&self) -> Self::ControlHandle {
723 DeviceControlHandle { inner: self.inner.clone() }
724 }
725
726 fn into_inner(
727 self,
728 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
729 {
730 (self.inner, self.is_terminated)
731 }
732
733 fn from_inner(
734 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
735 is_terminated: bool,
736 ) -> Self {
737 Self { inner, is_terminated }
738 }
739}
740
741impl futures::Stream for DeviceRequestStream {
742 type Item = Result<DeviceRequest, fidl::Error>;
743
744 fn poll_next(
745 mut self: std::pin::Pin<&mut Self>,
746 cx: &mut std::task::Context<'_>,
747 ) -> std::task::Poll<Option<Self::Item>> {
748 let this = &mut *self;
749 if this.inner.check_shutdown(cx) {
750 this.is_terminated = true;
751 return std::task::Poll::Ready(None);
752 }
753 if this.is_terminated {
754 panic!("polled DeviceRequestStream after completion");
755 }
756 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
757 |bytes, handles| {
758 match this.inner.channel().read_etc(cx, bytes, handles) {
759 std::task::Poll::Ready(Ok(())) => {}
760 std::task::Poll::Pending => return std::task::Poll::Pending,
761 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
762 this.is_terminated = true;
763 return std::task::Poll::Ready(None);
764 }
765 std::task::Poll::Ready(Err(e)) => {
766 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
767 e.into(),
768 ))));
769 }
770 }
771
772 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
774
775 std::task::Poll::Ready(Some(match header.ordinal {
776 0x3c500ca9341e8f56 => {
777 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
778 let mut req = fidl::new_empty!(
779 fidl::encoding::EmptyPayload,
780 fidl::encoding::DefaultFuchsiaResourceDialect
781 );
782 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
783 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
784 Ok(DeviceRequest::GetInfo {
785 responder: DeviceGetInfoResponder {
786 control_handle: std::mem::ManuallyDrop::new(control_handle),
787 tx_id: header.tx_id,
788 },
789 })
790 }
791 0x25940b82146dcf67 => {
792 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
793 let mut req = fidl::new_empty!(
794 DeviceOpenSessionRequest,
795 fidl::encoding::DefaultFuchsiaResourceDialect
796 );
797 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
798 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
799 Ok(DeviceRequest::OpenSession {
800 session_name: req.session_name,
801 session_info: req.session_info,
802
803 responder: DeviceOpenSessionResponder {
804 control_handle: std::mem::ManuallyDrop::new(control_handle),
805 tx_id: header.tx_id,
806 },
807 })
808 }
809 0x340a852c955ba2a6 => {
810 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
811 let mut req = fidl::new_empty!(
812 DeviceGetPortRequest,
813 fidl::encoding::DefaultFuchsiaResourceDialect
814 );
815 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetPortRequest>(&header, _body_bytes, handles, &mut req)?;
816 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
817 Ok(DeviceRequest::GetPort { id: req.id, port: req.port, control_handle })
818 }
819 0x104f43c937c39f0c => {
820 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
821 let mut req = fidl::new_empty!(
822 DeviceGetPortWatcherRequest,
823 fidl::encoding::DefaultFuchsiaResourceDialect
824 );
825 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetPortWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
826 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
827 Ok(DeviceRequest::GetPortWatcher { watcher: req.watcher, control_handle })
828 }
829 0x5882ea09b3809af4 => {
830 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
831 let mut req = fidl::new_empty!(
832 DeviceCloneRequest,
833 fidl::encoding::DefaultFuchsiaResourceDialect
834 );
835 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceCloneRequest>(&header, _body_bytes, handles, &mut req)?;
836 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
837 Ok(DeviceRequest::Clone { device: req.device, control_handle })
838 }
839 _ => Err(fidl::Error::UnknownOrdinal {
840 ordinal: header.ordinal,
841 protocol_name:
842 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
843 }),
844 }))
845 },
846 )
847 }
848}
849
850#[derive(Debug)]
852pub enum DeviceRequest {
853 GetInfo { responder: DeviceGetInfoResponder },
857 OpenSession {
872 session_name: String,
873 session_info: SessionInfo,
874 responder: DeviceOpenSessionResponder,
875 },
876 GetPort {
884 id: PortId,
885 port: fidl::endpoints::ServerEnd<PortMarker>,
886 control_handle: DeviceControlHandle,
887 },
888 GetPortWatcher {
892 watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
893 control_handle: DeviceControlHandle,
894 },
895 Clone { device: fidl::endpoints::ServerEnd<DeviceMarker>, control_handle: DeviceControlHandle },
899}
900
901impl DeviceRequest {
902 #[allow(irrefutable_let_patterns)]
903 pub fn into_get_info(self) -> Option<(DeviceGetInfoResponder)> {
904 if let DeviceRequest::GetInfo { responder } = self { Some((responder)) } else { None }
905 }
906
907 #[allow(irrefutable_let_patterns)]
908 pub fn into_open_session(self) -> Option<(String, SessionInfo, DeviceOpenSessionResponder)> {
909 if let DeviceRequest::OpenSession { session_name, session_info, responder } = self {
910 Some((session_name, session_info, responder))
911 } else {
912 None
913 }
914 }
915
916 #[allow(irrefutable_let_patterns)]
917 pub fn into_get_port(
918 self,
919 ) -> Option<(PortId, fidl::endpoints::ServerEnd<PortMarker>, DeviceControlHandle)> {
920 if let DeviceRequest::GetPort { id, port, control_handle } = self {
921 Some((id, port, control_handle))
922 } else {
923 None
924 }
925 }
926
927 #[allow(irrefutable_let_patterns)]
928 pub fn into_get_port_watcher(
929 self,
930 ) -> Option<(fidl::endpoints::ServerEnd<PortWatcherMarker>, DeviceControlHandle)> {
931 if let DeviceRequest::GetPortWatcher { watcher, control_handle } = self {
932 Some((watcher, control_handle))
933 } else {
934 None
935 }
936 }
937
938 #[allow(irrefutable_let_patterns)]
939 pub fn into_clone(
940 self,
941 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, DeviceControlHandle)> {
942 if let DeviceRequest::Clone { device, control_handle } = self {
943 Some((device, control_handle))
944 } else {
945 None
946 }
947 }
948
949 pub fn method_name(&self) -> &'static str {
951 match *self {
952 DeviceRequest::GetInfo { .. } => "get_info",
953 DeviceRequest::OpenSession { .. } => "open_session",
954 DeviceRequest::GetPort { .. } => "get_port",
955 DeviceRequest::GetPortWatcher { .. } => "get_port_watcher",
956 DeviceRequest::Clone { .. } => "clone",
957 }
958 }
959}
960
961#[derive(Debug, Clone)]
962pub struct DeviceControlHandle {
963 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
964}
965
966impl fidl::endpoints::ControlHandle for DeviceControlHandle {
967 fn shutdown(&self) {
968 self.inner.shutdown()
969 }
970
971 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
972 self.inner.shutdown_with_epitaph(status)
973 }
974
975 fn is_closed(&self) -> bool {
976 self.inner.channel().is_closed()
977 }
978 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
979 self.inner.channel().on_closed()
980 }
981
982 #[cfg(target_os = "fuchsia")]
983 fn signal_peer(
984 &self,
985 clear_mask: zx::Signals,
986 set_mask: zx::Signals,
987 ) -> Result<(), zx_status::Status> {
988 use fidl::Peered;
989 self.inner.channel().signal_peer(clear_mask, set_mask)
990 }
991}
992
993impl DeviceControlHandle {}
994
995#[must_use = "FIDL methods require a response to be sent"]
996#[derive(Debug)]
997pub struct DeviceGetInfoResponder {
998 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
999 tx_id: u32,
1000}
1001
1002impl std::ops::Drop for DeviceGetInfoResponder {
1006 fn drop(&mut self) {
1007 self.control_handle.shutdown();
1008 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1010 }
1011}
1012
1013impl fidl::endpoints::Responder for DeviceGetInfoResponder {
1014 type ControlHandle = DeviceControlHandle;
1015
1016 fn control_handle(&self) -> &DeviceControlHandle {
1017 &self.control_handle
1018 }
1019
1020 fn drop_without_shutdown(mut self) {
1021 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1023 std::mem::forget(self);
1025 }
1026}
1027
1028impl DeviceGetInfoResponder {
1029 pub fn send(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
1033 let _result = self.send_raw(info);
1034 if _result.is_err() {
1035 self.control_handle.shutdown();
1036 }
1037 self.drop_without_shutdown();
1038 _result
1039 }
1040
1041 pub fn send_no_shutdown_on_err(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
1043 let _result = self.send_raw(info);
1044 self.drop_without_shutdown();
1045 _result
1046 }
1047
1048 fn send_raw(&self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
1049 self.control_handle.inner.send::<DeviceGetInfoResponse>(
1050 (info,),
1051 self.tx_id,
1052 0x3c500ca9341e8f56,
1053 fidl::encoding::DynamicFlags::empty(),
1054 )
1055 }
1056}
1057
1058#[must_use = "FIDL methods require a response to be sent"]
1059#[derive(Debug)]
1060pub struct DeviceOpenSessionResponder {
1061 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1062 tx_id: u32,
1063}
1064
1065impl std::ops::Drop for DeviceOpenSessionResponder {
1069 fn drop(&mut self) {
1070 self.control_handle.shutdown();
1071 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1073 }
1074}
1075
1076impl fidl::endpoints::Responder for DeviceOpenSessionResponder {
1077 type ControlHandle = DeviceControlHandle;
1078
1079 fn control_handle(&self) -> &DeviceControlHandle {
1080 &self.control_handle
1081 }
1082
1083 fn drop_without_shutdown(mut self) {
1084 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1086 std::mem::forget(self);
1088 }
1089}
1090
1091impl DeviceOpenSessionResponder {
1092 pub fn send(
1096 self,
1097 mut result: Result<(fidl::endpoints::ClientEnd<SessionMarker>, Fifos), i32>,
1098 ) -> Result<(), fidl::Error> {
1099 let _result = self.send_raw(result);
1100 if _result.is_err() {
1101 self.control_handle.shutdown();
1102 }
1103 self.drop_without_shutdown();
1104 _result
1105 }
1106
1107 pub fn send_no_shutdown_on_err(
1109 self,
1110 mut result: Result<(fidl::endpoints::ClientEnd<SessionMarker>, Fifos), i32>,
1111 ) -> Result<(), fidl::Error> {
1112 let _result = self.send_raw(result);
1113 self.drop_without_shutdown();
1114 _result
1115 }
1116
1117 fn send_raw(
1118 &self,
1119 mut result: Result<(fidl::endpoints::ClientEnd<SessionMarker>, Fifos), i32>,
1120 ) -> Result<(), fidl::Error> {
1121 self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceOpenSessionResponse, i32>>(
1122 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,)),
1123 self.tx_id,
1124 0x25940b82146dcf67,
1125 fidl::encoding::DynamicFlags::empty()
1126 )
1127 }
1128}
1129
1130#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1131pub struct DeviceInstanceMarker;
1132
1133impl fidl::endpoints::ProtocolMarker for DeviceInstanceMarker {
1134 type Proxy = DeviceInstanceProxy;
1135 type RequestStream = DeviceInstanceRequestStream;
1136 #[cfg(target_os = "fuchsia")]
1137 type SynchronousProxy = DeviceInstanceSynchronousProxy;
1138
1139 const DEBUG_NAME: &'static str = "(anonymous) DeviceInstance";
1140}
1141
1142pub trait DeviceInstanceProxyInterface: Send + Sync {
1143 fn r#get_device(
1144 &self,
1145 device: fidl::endpoints::ServerEnd<DeviceMarker>,
1146 ) -> Result<(), fidl::Error>;
1147}
1148#[derive(Debug)]
1149#[cfg(target_os = "fuchsia")]
1150pub struct DeviceInstanceSynchronousProxy {
1151 client: fidl::client::sync::Client,
1152}
1153
1154#[cfg(target_os = "fuchsia")]
1155impl fidl::endpoints::SynchronousProxy for DeviceInstanceSynchronousProxy {
1156 type Proxy = DeviceInstanceProxy;
1157 type Protocol = DeviceInstanceMarker;
1158
1159 fn from_channel(inner: fidl::Channel) -> Self {
1160 Self::new(inner)
1161 }
1162
1163 fn into_channel(self) -> fidl::Channel {
1164 self.client.into_channel()
1165 }
1166
1167 fn as_channel(&self) -> &fidl::Channel {
1168 self.client.as_channel()
1169 }
1170}
1171
1172#[cfg(target_os = "fuchsia")]
1173impl DeviceInstanceSynchronousProxy {
1174 pub fn new(channel: fidl::Channel) -> Self {
1175 Self { client: fidl::client::sync::Client::new(channel) }
1176 }
1177
1178 pub fn into_channel(self) -> fidl::Channel {
1179 self.client.into_channel()
1180 }
1181
1182 pub fn wait_for_event(
1185 &self,
1186 deadline: zx::MonotonicInstant,
1187 ) -> Result<DeviceInstanceEvent, fidl::Error> {
1188 DeviceInstanceEvent::decode(self.client.wait_for_event::<DeviceInstanceMarker>(deadline)?)
1189 }
1190
1191 pub fn r#get_device(
1195 &self,
1196 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
1197 ) -> Result<(), fidl::Error> {
1198 self.client.send::<DeviceInstanceGetDeviceRequest>(
1199 (device,),
1200 0x775270585575cef7,
1201 fidl::encoding::DynamicFlags::empty(),
1202 )
1203 }
1204}
1205
1206#[cfg(target_os = "fuchsia")]
1207impl From<DeviceInstanceSynchronousProxy> for zx::NullableHandle {
1208 fn from(value: DeviceInstanceSynchronousProxy) -> Self {
1209 value.into_channel().into()
1210 }
1211}
1212
1213#[cfg(target_os = "fuchsia")]
1214impl From<fidl::Channel> for DeviceInstanceSynchronousProxy {
1215 fn from(value: fidl::Channel) -> Self {
1216 Self::new(value)
1217 }
1218}
1219
1220#[cfg(target_os = "fuchsia")]
1221impl fidl::endpoints::FromClient for DeviceInstanceSynchronousProxy {
1222 type Protocol = DeviceInstanceMarker;
1223
1224 fn from_client(value: fidl::endpoints::ClientEnd<DeviceInstanceMarker>) -> Self {
1225 Self::new(value.into_channel())
1226 }
1227}
1228
1229#[derive(Debug, Clone)]
1230pub struct DeviceInstanceProxy {
1231 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1232}
1233
1234impl fidl::endpoints::Proxy for DeviceInstanceProxy {
1235 type Protocol = DeviceInstanceMarker;
1236
1237 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1238 Self::new(inner)
1239 }
1240
1241 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1242 self.client.into_channel().map_err(|client| Self { client })
1243 }
1244
1245 fn as_channel(&self) -> &::fidl::AsyncChannel {
1246 self.client.as_channel()
1247 }
1248}
1249
1250impl DeviceInstanceProxy {
1251 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1253 let protocol_name = <DeviceInstanceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1254 Self { client: fidl::client::Client::new(channel, protocol_name) }
1255 }
1256
1257 pub fn take_event_stream(&self) -> DeviceInstanceEventStream {
1263 DeviceInstanceEventStream { event_receiver: self.client.take_event_receiver() }
1264 }
1265
1266 pub fn r#get_device(
1270 &self,
1271 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
1272 ) -> Result<(), fidl::Error> {
1273 DeviceInstanceProxyInterface::r#get_device(self, device)
1274 }
1275}
1276
1277impl DeviceInstanceProxyInterface for DeviceInstanceProxy {
1278 fn r#get_device(
1279 &self,
1280 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
1281 ) -> Result<(), fidl::Error> {
1282 self.client.send::<DeviceInstanceGetDeviceRequest>(
1283 (device,),
1284 0x775270585575cef7,
1285 fidl::encoding::DynamicFlags::empty(),
1286 )
1287 }
1288}
1289
1290pub struct DeviceInstanceEventStream {
1291 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1292}
1293
1294impl std::marker::Unpin for DeviceInstanceEventStream {}
1295
1296impl futures::stream::FusedStream for DeviceInstanceEventStream {
1297 fn is_terminated(&self) -> bool {
1298 self.event_receiver.is_terminated()
1299 }
1300}
1301
1302impl futures::Stream for DeviceInstanceEventStream {
1303 type Item = Result<DeviceInstanceEvent, fidl::Error>;
1304
1305 fn poll_next(
1306 mut self: std::pin::Pin<&mut Self>,
1307 cx: &mut std::task::Context<'_>,
1308 ) -> std::task::Poll<Option<Self::Item>> {
1309 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1310 &mut self.event_receiver,
1311 cx
1312 )?) {
1313 Some(buf) => std::task::Poll::Ready(Some(DeviceInstanceEvent::decode(buf))),
1314 None => std::task::Poll::Ready(None),
1315 }
1316 }
1317}
1318
1319#[derive(Debug)]
1320pub enum DeviceInstanceEvent {}
1321
1322impl DeviceInstanceEvent {
1323 fn decode(
1325 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1326 ) -> Result<DeviceInstanceEvent, fidl::Error> {
1327 let (bytes, _handles) = buf.split_mut();
1328 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1329 debug_assert_eq!(tx_header.tx_id, 0);
1330 match tx_header.ordinal {
1331 _ => Err(fidl::Error::UnknownOrdinal {
1332 ordinal: tx_header.ordinal,
1333 protocol_name:
1334 <DeviceInstanceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1335 }),
1336 }
1337 }
1338}
1339
1340pub struct DeviceInstanceRequestStream {
1342 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1343 is_terminated: bool,
1344}
1345
1346impl std::marker::Unpin for DeviceInstanceRequestStream {}
1347
1348impl futures::stream::FusedStream for DeviceInstanceRequestStream {
1349 fn is_terminated(&self) -> bool {
1350 self.is_terminated
1351 }
1352}
1353
1354impl fidl::endpoints::RequestStream for DeviceInstanceRequestStream {
1355 type Protocol = DeviceInstanceMarker;
1356 type ControlHandle = DeviceInstanceControlHandle;
1357
1358 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1359 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1360 }
1361
1362 fn control_handle(&self) -> Self::ControlHandle {
1363 DeviceInstanceControlHandle { inner: self.inner.clone() }
1364 }
1365
1366 fn into_inner(
1367 self,
1368 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1369 {
1370 (self.inner, self.is_terminated)
1371 }
1372
1373 fn from_inner(
1374 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1375 is_terminated: bool,
1376 ) -> Self {
1377 Self { inner, is_terminated }
1378 }
1379}
1380
1381impl futures::Stream for DeviceInstanceRequestStream {
1382 type Item = Result<DeviceInstanceRequest, fidl::Error>;
1383
1384 fn poll_next(
1385 mut self: std::pin::Pin<&mut Self>,
1386 cx: &mut std::task::Context<'_>,
1387 ) -> std::task::Poll<Option<Self::Item>> {
1388 let this = &mut *self;
1389 if this.inner.check_shutdown(cx) {
1390 this.is_terminated = true;
1391 return std::task::Poll::Ready(None);
1392 }
1393 if this.is_terminated {
1394 panic!("polled DeviceInstanceRequestStream after completion");
1395 }
1396 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1397 |bytes, handles| {
1398 match this.inner.channel().read_etc(cx, bytes, handles) {
1399 std::task::Poll::Ready(Ok(())) => {}
1400 std::task::Poll::Pending => return std::task::Poll::Pending,
1401 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1402 this.is_terminated = true;
1403 return std::task::Poll::Ready(None);
1404 }
1405 std::task::Poll::Ready(Err(e)) => {
1406 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1407 e.into(),
1408 ))));
1409 }
1410 }
1411
1412 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1414
1415 std::task::Poll::Ready(Some(match header.ordinal {
1416 0x775270585575cef7 => {
1417 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1418 let mut req = fidl::new_empty!(
1419 DeviceInstanceGetDeviceRequest,
1420 fidl::encoding::DefaultFuchsiaResourceDialect
1421 );
1422 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceInstanceGetDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
1423 let control_handle =
1424 DeviceInstanceControlHandle { inner: this.inner.clone() };
1425 Ok(DeviceInstanceRequest::GetDevice { device: req.device, control_handle })
1426 }
1427 _ => Err(fidl::Error::UnknownOrdinal {
1428 ordinal: header.ordinal,
1429 protocol_name:
1430 <DeviceInstanceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1431 }),
1432 }))
1433 },
1434 )
1435 }
1436}
1437
1438#[derive(Debug)]
1440pub enum DeviceInstanceRequest {
1441 GetDevice {
1445 device: fidl::endpoints::ServerEnd<DeviceMarker>,
1446 control_handle: DeviceInstanceControlHandle,
1447 },
1448}
1449
1450impl DeviceInstanceRequest {
1451 #[allow(irrefutable_let_patterns)]
1452 pub fn into_get_device(
1453 self,
1454 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, DeviceInstanceControlHandle)> {
1455 if let DeviceInstanceRequest::GetDevice { device, control_handle } = self {
1456 Some((device, control_handle))
1457 } else {
1458 None
1459 }
1460 }
1461
1462 pub fn method_name(&self) -> &'static str {
1464 match *self {
1465 DeviceInstanceRequest::GetDevice { .. } => "get_device",
1466 }
1467 }
1468}
1469
1470#[derive(Debug, Clone)]
1471pub struct DeviceInstanceControlHandle {
1472 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1473}
1474
1475impl fidl::endpoints::ControlHandle for DeviceInstanceControlHandle {
1476 fn shutdown(&self) {
1477 self.inner.shutdown()
1478 }
1479
1480 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1481 self.inner.shutdown_with_epitaph(status)
1482 }
1483
1484 fn is_closed(&self) -> bool {
1485 self.inner.channel().is_closed()
1486 }
1487 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1488 self.inner.channel().on_closed()
1489 }
1490
1491 #[cfg(target_os = "fuchsia")]
1492 fn signal_peer(
1493 &self,
1494 clear_mask: zx::Signals,
1495 set_mask: zx::Signals,
1496 ) -> Result<(), zx_status::Status> {
1497 use fidl::Peered;
1498 self.inner.channel().signal_peer(clear_mask, set_mask)
1499 }
1500}
1501
1502impl DeviceInstanceControlHandle {}
1503
1504#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1505pub struct DiagnosticsMarker;
1506
1507impl fidl::endpoints::ProtocolMarker for DiagnosticsMarker {
1508 type Proxy = DiagnosticsProxy;
1509 type RequestStream = DiagnosticsRequestStream;
1510 #[cfg(target_os = "fuchsia")]
1511 type SynchronousProxy = DiagnosticsSynchronousProxy;
1512
1513 const DEBUG_NAME: &'static str = "(anonymous) Diagnostics";
1514}
1515
1516pub trait DiagnosticsProxyInterface: Send + Sync {
1517 type LogDebugInfoToSyslogResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1518 + Send;
1519 fn r#log_debug_info_to_syslog(&self) -> Self::LogDebugInfoToSyslogResponseFut;
1520}
1521#[derive(Debug)]
1522#[cfg(target_os = "fuchsia")]
1523pub struct DiagnosticsSynchronousProxy {
1524 client: fidl::client::sync::Client,
1525}
1526
1527#[cfg(target_os = "fuchsia")]
1528impl fidl::endpoints::SynchronousProxy for DiagnosticsSynchronousProxy {
1529 type Proxy = DiagnosticsProxy;
1530 type Protocol = DiagnosticsMarker;
1531
1532 fn from_channel(inner: fidl::Channel) -> Self {
1533 Self::new(inner)
1534 }
1535
1536 fn into_channel(self) -> fidl::Channel {
1537 self.client.into_channel()
1538 }
1539
1540 fn as_channel(&self) -> &fidl::Channel {
1541 self.client.as_channel()
1542 }
1543}
1544
1545#[cfg(target_os = "fuchsia")]
1546impl DiagnosticsSynchronousProxy {
1547 pub fn new(channel: fidl::Channel) -> Self {
1548 Self { client: fidl::client::sync::Client::new(channel) }
1549 }
1550
1551 pub fn into_channel(self) -> fidl::Channel {
1552 self.client.into_channel()
1553 }
1554
1555 pub fn wait_for_event(
1558 &self,
1559 deadline: zx::MonotonicInstant,
1560 ) -> Result<DiagnosticsEvent, fidl::Error> {
1561 DiagnosticsEvent::decode(self.client.wait_for_event::<DiagnosticsMarker>(deadline)?)
1562 }
1563
1564 pub fn r#log_debug_info_to_syslog(
1569 &self,
1570 ___deadline: zx::MonotonicInstant,
1571 ) -> Result<(), fidl::Error> {
1572 let _response = self.client.send_query::<
1573 fidl::encoding::EmptyPayload,
1574 fidl::encoding::EmptyPayload,
1575 DiagnosticsMarker,
1576 >(
1577 (),
1578 0x4222897dfe1f4b4a,
1579 fidl::encoding::DynamicFlags::empty(),
1580 ___deadline,
1581 )?;
1582 Ok(_response)
1583 }
1584}
1585
1586#[cfg(target_os = "fuchsia")]
1587impl From<DiagnosticsSynchronousProxy> for zx::NullableHandle {
1588 fn from(value: DiagnosticsSynchronousProxy) -> Self {
1589 value.into_channel().into()
1590 }
1591}
1592
1593#[cfg(target_os = "fuchsia")]
1594impl From<fidl::Channel> for DiagnosticsSynchronousProxy {
1595 fn from(value: fidl::Channel) -> Self {
1596 Self::new(value)
1597 }
1598}
1599
1600#[cfg(target_os = "fuchsia")]
1601impl fidl::endpoints::FromClient for DiagnosticsSynchronousProxy {
1602 type Protocol = DiagnosticsMarker;
1603
1604 fn from_client(value: fidl::endpoints::ClientEnd<DiagnosticsMarker>) -> Self {
1605 Self::new(value.into_channel())
1606 }
1607}
1608
1609#[derive(Debug, Clone)]
1610pub struct DiagnosticsProxy {
1611 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1612}
1613
1614impl fidl::endpoints::Proxy for DiagnosticsProxy {
1615 type Protocol = DiagnosticsMarker;
1616
1617 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1618 Self::new(inner)
1619 }
1620
1621 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1622 self.client.into_channel().map_err(|client| Self { client })
1623 }
1624
1625 fn as_channel(&self) -> &::fidl::AsyncChannel {
1626 self.client.as_channel()
1627 }
1628}
1629
1630impl DiagnosticsProxy {
1631 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1633 let protocol_name = <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1634 Self { client: fidl::client::Client::new(channel, protocol_name) }
1635 }
1636
1637 pub fn take_event_stream(&self) -> DiagnosticsEventStream {
1643 DiagnosticsEventStream { event_receiver: self.client.take_event_receiver() }
1644 }
1645
1646 pub fn r#log_debug_info_to_syslog(
1651 &self,
1652 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1653 DiagnosticsProxyInterface::r#log_debug_info_to_syslog(self)
1654 }
1655}
1656
1657impl DiagnosticsProxyInterface for DiagnosticsProxy {
1658 type LogDebugInfoToSyslogResponseFut =
1659 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1660 fn r#log_debug_info_to_syslog(&self) -> Self::LogDebugInfoToSyslogResponseFut {
1661 fn _decode(
1662 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1663 ) -> Result<(), fidl::Error> {
1664 let _response = fidl::client::decode_transaction_body::<
1665 fidl::encoding::EmptyPayload,
1666 fidl::encoding::DefaultFuchsiaResourceDialect,
1667 0x4222897dfe1f4b4a,
1668 >(_buf?)?;
1669 Ok(_response)
1670 }
1671 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1672 (),
1673 0x4222897dfe1f4b4a,
1674 fidl::encoding::DynamicFlags::empty(),
1675 _decode,
1676 )
1677 }
1678}
1679
1680pub struct DiagnosticsEventStream {
1681 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1682}
1683
1684impl std::marker::Unpin for DiagnosticsEventStream {}
1685
1686impl futures::stream::FusedStream for DiagnosticsEventStream {
1687 fn is_terminated(&self) -> bool {
1688 self.event_receiver.is_terminated()
1689 }
1690}
1691
1692impl futures::Stream for DiagnosticsEventStream {
1693 type Item = Result<DiagnosticsEvent, fidl::Error>;
1694
1695 fn poll_next(
1696 mut self: std::pin::Pin<&mut Self>,
1697 cx: &mut std::task::Context<'_>,
1698 ) -> std::task::Poll<Option<Self::Item>> {
1699 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1700 &mut self.event_receiver,
1701 cx
1702 )?) {
1703 Some(buf) => std::task::Poll::Ready(Some(DiagnosticsEvent::decode(buf))),
1704 None => std::task::Poll::Ready(None),
1705 }
1706 }
1707}
1708
1709#[derive(Debug)]
1710pub enum DiagnosticsEvent {}
1711
1712impl DiagnosticsEvent {
1713 fn decode(
1715 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1716 ) -> Result<DiagnosticsEvent, fidl::Error> {
1717 let (bytes, _handles) = buf.split_mut();
1718 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1719 debug_assert_eq!(tx_header.tx_id, 0);
1720 match tx_header.ordinal {
1721 _ => Err(fidl::Error::UnknownOrdinal {
1722 ordinal: tx_header.ordinal,
1723 protocol_name: <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1724 }),
1725 }
1726 }
1727}
1728
1729pub struct DiagnosticsRequestStream {
1731 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1732 is_terminated: bool,
1733}
1734
1735impl std::marker::Unpin for DiagnosticsRequestStream {}
1736
1737impl futures::stream::FusedStream for DiagnosticsRequestStream {
1738 fn is_terminated(&self) -> bool {
1739 self.is_terminated
1740 }
1741}
1742
1743impl fidl::endpoints::RequestStream for DiagnosticsRequestStream {
1744 type Protocol = DiagnosticsMarker;
1745 type ControlHandle = DiagnosticsControlHandle;
1746
1747 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1748 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1749 }
1750
1751 fn control_handle(&self) -> Self::ControlHandle {
1752 DiagnosticsControlHandle { inner: self.inner.clone() }
1753 }
1754
1755 fn into_inner(
1756 self,
1757 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1758 {
1759 (self.inner, self.is_terminated)
1760 }
1761
1762 fn from_inner(
1763 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1764 is_terminated: bool,
1765 ) -> Self {
1766 Self { inner, is_terminated }
1767 }
1768}
1769
1770impl futures::Stream for DiagnosticsRequestStream {
1771 type Item = Result<DiagnosticsRequest, fidl::Error>;
1772
1773 fn poll_next(
1774 mut self: std::pin::Pin<&mut Self>,
1775 cx: &mut std::task::Context<'_>,
1776 ) -> std::task::Poll<Option<Self::Item>> {
1777 let this = &mut *self;
1778 if this.inner.check_shutdown(cx) {
1779 this.is_terminated = true;
1780 return std::task::Poll::Ready(None);
1781 }
1782 if this.is_terminated {
1783 panic!("polled DiagnosticsRequestStream after completion");
1784 }
1785 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1786 |bytes, handles| {
1787 match this.inner.channel().read_etc(cx, bytes, handles) {
1788 std::task::Poll::Ready(Ok(())) => {}
1789 std::task::Poll::Pending => return std::task::Poll::Pending,
1790 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1791 this.is_terminated = true;
1792 return std::task::Poll::Ready(None);
1793 }
1794 std::task::Poll::Ready(Err(e)) => {
1795 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1796 e.into(),
1797 ))));
1798 }
1799 }
1800
1801 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1803
1804 std::task::Poll::Ready(Some(match header.ordinal {
1805 0x4222897dfe1f4b4a => {
1806 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1807 let mut req = fidl::new_empty!(
1808 fidl::encoding::EmptyPayload,
1809 fidl::encoding::DefaultFuchsiaResourceDialect
1810 );
1811 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1812 let control_handle = DiagnosticsControlHandle { inner: this.inner.clone() };
1813 Ok(DiagnosticsRequest::LogDebugInfoToSyslog {
1814 responder: DiagnosticsLogDebugInfoToSyslogResponder {
1815 control_handle: std::mem::ManuallyDrop::new(control_handle),
1816 tx_id: header.tx_id,
1817 },
1818 })
1819 }
1820 _ => Err(fidl::Error::UnknownOrdinal {
1821 ordinal: header.ordinal,
1822 protocol_name:
1823 <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1824 }),
1825 }))
1826 },
1827 )
1828 }
1829}
1830
1831#[derive(Debug)]
1834pub enum DiagnosticsRequest {
1835 LogDebugInfoToSyslog { responder: DiagnosticsLogDebugInfoToSyslogResponder },
1840}
1841
1842impl DiagnosticsRequest {
1843 #[allow(irrefutable_let_patterns)]
1844 pub fn into_log_debug_info_to_syslog(
1845 self,
1846 ) -> Option<(DiagnosticsLogDebugInfoToSyslogResponder)> {
1847 if let DiagnosticsRequest::LogDebugInfoToSyslog { responder } = self {
1848 Some((responder))
1849 } else {
1850 None
1851 }
1852 }
1853
1854 pub fn method_name(&self) -> &'static str {
1856 match *self {
1857 DiagnosticsRequest::LogDebugInfoToSyslog { .. } => "log_debug_info_to_syslog",
1858 }
1859 }
1860}
1861
1862#[derive(Debug, Clone)]
1863pub struct DiagnosticsControlHandle {
1864 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1865}
1866
1867impl fidl::endpoints::ControlHandle for DiagnosticsControlHandle {
1868 fn shutdown(&self) {
1869 self.inner.shutdown()
1870 }
1871
1872 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1873 self.inner.shutdown_with_epitaph(status)
1874 }
1875
1876 fn is_closed(&self) -> bool {
1877 self.inner.channel().is_closed()
1878 }
1879 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1880 self.inner.channel().on_closed()
1881 }
1882
1883 #[cfg(target_os = "fuchsia")]
1884 fn signal_peer(
1885 &self,
1886 clear_mask: zx::Signals,
1887 set_mask: zx::Signals,
1888 ) -> Result<(), zx_status::Status> {
1889 use fidl::Peered;
1890 self.inner.channel().signal_peer(clear_mask, set_mask)
1891 }
1892}
1893
1894impl DiagnosticsControlHandle {}
1895
1896#[must_use = "FIDL methods require a response to be sent"]
1897#[derive(Debug)]
1898pub struct DiagnosticsLogDebugInfoToSyslogResponder {
1899 control_handle: std::mem::ManuallyDrop<DiagnosticsControlHandle>,
1900 tx_id: u32,
1901}
1902
1903impl std::ops::Drop for DiagnosticsLogDebugInfoToSyslogResponder {
1907 fn drop(&mut self) {
1908 self.control_handle.shutdown();
1909 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1911 }
1912}
1913
1914impl fidl::endpoints::Responder for DiagnosticsLogDebugInfoToSyslogResponder {
1915 type ControlHandle = DiagnosticsControlHandle;
1916
1917 fn control_handle(&self) -> &DiagnosticsControlHandle {
1918 &self.control_handle
1919 }
1920
1921 fn drop_without_shutdown(mut self) {
1922 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1924 std::mem::forget(self);
1926 }
1927}
1928
1929impl DiagnosticsLogDebugInfoToSyslogResponder {
1930 pub fn send(self) -> Result<(), fidl::Error> {
1934 let _result = self.send_raw();
1935 if _result.is_err() {
1936 self.control_handle.shutdown();
1937 }
1938 self.drop_without_shutdown();
1939 _result
1940 }
1941
1942 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1944 let _result = self.send_raw();
1945 self.drop_without_shutdown();
1946 _result
1947 }
1948
1949 fn send_raw(&self) -> Result<(), fidl::Error> {
1950 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1951 (),
1952 self.tx_id,
1953 0x4222897dfe1f4b4a,
1954 fidl::encoding::DynamicFlags::empty(),
1955 )
1956 }
1957}
1958
1959#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1960pub struct MacAddressingMarker;
1961
1962impl fidl::endpoints::ProtocolMarker for MacAddressingMarker {
1963 type Proxy = MacAddressingProxy;
1964 type RequestStream = MacAddressingRequestStream;
1965 #[cfg(target_os = "fuchsia")]
1966 type SynchronousProxy = MacAddressingSynchronousProxy;
1967
1968 const DEBUG_NAME: &'static str = "(anonymous) MacAddressing";
1969}
1970
1971pub trait MacAddressingProxyInterface: Send + Sync {
1972 type GetUnicastAddressResponseFut: std::future::Future<Output = Result<fidl_fuchsia_net::MacAddress, fidl::Error>>
1973 + Send;
1974 fn r#get_unicast_address(&self) -> Self::GetUnicastAddressResponseFut;
1975 type SetModeResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1976 fn r#set_mode(&self, mode: MacFilterMode) -> Self::SetModeResponseFut;
1977 type AddMulticastAddressResponseFut: std::future::Future<Output = Result<i32, fidl::Error>>
1978 + Send;
1979 fn r#add_multicast_address(
1980 &self,
1981 address: &fidl_fuchsia_net::MacAddress,
1982 ) -> Self::AddMulticastAddressResponseFut;
1983 type RemoveMulticastAddressResponseFut: std::future::Future<Output = Result<i32, fidl::Error>>
1984 + Send;
1985 fn r#remove_multicast_address(
1986 &self,
1987 address: &fidl_fuchsia_net::MacAddress,
1988 ) -> Self::RemoveMulticastAddressResponseFut;
1989}
1990#[derive(Debug)]
1991#[cfg(target_os = "fuchsia")]
1992pub struct MacAddressingSynchronousProxy {
1993 client: fidl::client::sync::Client,
1994}
1995
1996#[cfg(target_os = "fuchsia")]
1997impl fidl::endpoints::SynchronousProxy for MacAddressingSynchronousProxy {
1998 type Proxy = MacAddressingProxy;
1999 type Protocol = MacAddressingMarker;
2000
2001 fn from_channel(inner: fidl::Channel) -> Self {
2002 Self::new(inner)
2003 }
2004
2005 fn into_channel(self) -> fidl::Channel {
2006 self.client.into_channel()
2007 }
2008
2009 fn as_channel(&self) -> &fidl::Channel {
2010 self.client.as_channel()
2011 }
2012}
2013
2014#[cfg(target_os = "fuchsia")]
2015impl MacAddressingSynchronousProxy {
2016 pub fn new(channel: fidl::Channel) -> Self {
2017 Self { client: fidl::client::sync::Client::new(channel) }
2018 }
2019
2020 pub fn into_channel(self) -> fidl::Channel {
2021 self.client.into_channel()
2022 }
2023
2024 pub fn wait_for_event(
2027 &self,
2028 deadline: zx::MonotonicInstant,
2029 ) -> Result<MacAddressingEvent, fidl::Error> {
2030 MacAddressingEvent::decode(self.client.wait_for_event::<MacAddressingMarker>(deadline)?)
2031 }
2032
2033 pub fn r#get_unicast_address(
2044 &self,
2045 ___deadline: zx::MonotonicInstant,
2046 ) -> Result<fidl_fuchsia_net::MacAddress, fidl::Error> {
2047 let _response = self.client.send_query::<
2048 fidl::encoding::EmptyPayload,
2049 MacAddressingGetUnicastAddressResponse,
2050 MacAddressingMarker,
2051 >(
2052 (),
2053 0x2c60b82a4ecfaebe,
2054 fidl::encoding::DynamicFlags::empty(),
2055 ___deadline,
2056 )?;
2057 Ok(_response.address)
2058 }
2059
2060 pub fn r#set_mode(
2080 &self,
2081 mut mode: MacFilterMode,
2082 ___deadline: zx::MonotonicInstant,
2083 ) -> Result<i32, fidl::Error> {
2084 let _response = self.client.send_query::<
2085 MacAddressingSetModeRequest,
2086 MacAddressingSetModeResponse,
2087 MacAddressingMarker,
2088 >(
2089 (mode,),
2090 0x6297b8dbf03c58c,
2091 fidl::encoding::DynamicFlags::empty(),
2092 ___deadline,
2093 )?;
2094 Ok(_response.status)
2095 }
2096
2097 pub fn r#add_multicast_address(
2109 &self,
2110 mut address: &fidl_fuchsia_net::MacAddress,
2111 ___deadline: zx::MonotonicInstant,
2112 ) -> Result<i32, fidl::Error> {
2113 let _response = self.client.send_query::<
2114 MacAddressingAddMulticastAddressRequest,
2115 MacAddressingAddMulticastAddressResponse,
2116 MacAddressingMarker,
2117 >(
2118 (address,),
2119 0xf5637ff11cf0c25,
2120 fidl::encoding::DynamicFlags::empty(),
2121 ___deadline,
2122 )?;
2123 Ok(_response.status)
2124 }
2125
2126 pub fn r#remove_multicast_address(
2132 &self,
2133 mut address: &fidl_fuchsia_net::MacAddress,
2134 ___deadline: zx::MonotonicInstant,
2135 ) -> Result<i32, fidl::Error> {
2136 let _response = self.client.send_query::<
2137 MacAddressingRemoveMulticastAddressRequest,
2138 MacAddressingRemoveMulticastAddressResponse,
2139 MacAddressingMarker,
2140 >(
2141 (address,),
2142 0x5dddf4e3ba4e2560,
2143 fidl::encoding::DynamicFlags::empty(),
2144 ___deadline,
2145 )?;
2146 Ok(_response.status)
2147 }
2148}
2149
2150#[cfg(target_os = "fuchsia")]
2151impl From<MacAddressingSynchronousProxy> for zx::NullableHandle {
2152 fn from(value: MacAddressingSynchronousProxy) -> Self {
2153 value.into_channel().into()
2154 }
2155}
2156
2157#[cfg(target_os = "fuchsia")]
2158impl From<fidl::Channel> for MacAddressingSynchronousProxy {
2159 fn from(value: fidl::Channel) -> Self {
2160 Self::new(value)
2161 }
2162}
2163
2164#[cfg(target_os = "fuchsia")]
2165impl fidl::endpoints::FromClient for MacAddressingSynchronousProxy {
2166 type Protocol = MacAddressingMarker;
2167
2168 fn from_client(value: fidl::endpoints::ClientEnd<MacAddressingMarker>) -> Self {
2169 Self::new(value.into_channel())
2170 }
2171}
2172
2173#[derive(Debug, Clone)]
2174pub struct MacAddressingProxy {
2175 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2176}
2177
2178impl fidl::endpoints::Proxy for MacAddressingProxy {
2179 type Protocol = MacAddressingMarker;
2180
2181 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2182 Self::new(inner)
2183 }
2184
2185 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2186 self.client.into_channel().map_err(|client| Self { client })
2187 }
2188
2189 fn as_channel(&self) -> &::fidl::AsyncChannel {
2190 self.client.as_channel()
2191 }
2192}
2193
2194impl MacAddressingProxy {
2195 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2197 let protocol_name = <MacAddressingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2198 Self { client: fidl::client::Client::new(channel, protocol_name) }
2199 }
2200
2201 pub fn take_event_stream(&self) -> MacAddressingEventStream {
2207 MacAddressingEventStream { event_receiver: self.client.take_event_receiver() }
2208 }
2209
2210 pub fn r#get_unicast_address(
2221 &self,
2222 ) -> fidl::client::QueryResponseFut<
2223 fidl_fuchsia_net::MacAddress,
2224 fidl::encoding::DefaultFuchsiaResourceDialect,
2225 > {
2226 MacAddressingProxyInterface::r#get_unicast_address(self)
2227 }
2228
2229 pub fn r#set_mode(
2249 &self,
2250 mut mode: MacFilterMode,
2251 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2252 MacAddressingProxyInterface::r#set_mode(self, mode)
2253 }
2254
2255 pub fn r#add_multicast_address(
2267 &self,
2268 mut address: &fidl_fuchsia_net::MacAddress,
2269 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2270 MacAddressingProxyInterface::r#add_multicast_address(self, address)
2271 }
2272
2273 pub fn r#remove_multicast_address(
2279 &self,
2280 mut address: &fidl_fuchsia_net::MacAddress,
2281 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2282 MacAddressingProxyInterface::r#remove_multicast_address(self, address)
2283 }
2284}
2285
2286impl MacAddressingProxyInterface for MacAddressingProxy {
2287 type GetUnicastAddressResponseFut = fidl::client::QueryResponseFut<
2288 fidl_fuchsia_net::MacAddress,
2289 fidl::encoding::DefaultFuchsiaResourceDialect,
2290 >;
2291 fn r#get_unicast_address(&self) -> Self::GetUnicastAddressResponseFut {
2292 fn _decode(
2293 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2294 ) -> Result<fidl_fuchsia_net::MacAddress, fidl::Error> {
2295 let _response = fidl::client::decode_transaction_body::<
2296 MacAddressingGetUnicastAddressResponse,
2297 fidl::encoding::DefaultFuchsiaResourceDialect,
2298 0x2c60b82a4ecfaebe,
2299 >(_buf?)?;
2300 Ok(_response.address)
2301 }
2302 self.client
2303 .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_net::MacAddress>(
2304 (),
2305 0x2c60b82a4ecfaebe,
2306 fidl::encoding::DynamicFlags::empty(),
2307 _decode,
2308 )
2309 }
2310
2311 type SetModeResponseFut =
2312 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2313 fn r#set_mode(&self, mut mode: MacFilterMode) -> Self::SetModeResponseFut {
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 MacAddressingSetModeResponse,
2319 fidl::encoding::DefaultFuchsiaResourceDialect,
2320 0x6297b8dbf03c58c,
2321 >(_buf?)?;
2322 Ok(_response.status)
2323 }
2324 self.client.send_query_and_decode::<MacAddressingSetModeRequest, i32>(
2325 (mode,),
2326 0x6297b8dbf03c58c,
2327 fidl::encoding::DynamicFlags::empty(),
2328 _decode,
2329 )
2330 }
2331
2332 type AddMulticastAddressResponseFut =
2333 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2334 fn r#add_multicast_address(
2335 &self,
2336 mut address: &fidl_fuchsia_net::MacAddress,
2337 ) -> Self::AddMulticastAddressResponseFut {
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 MacAddressingAddMulticastAddressResponse,
2343 fidl::encoding::DefaultFuchsiaResourceDialect,
2344 0xf5637ff11cf0c25,
2345 >(_buf?)?;
2346 Ok(_response.status)
2347 }
2348 self.client.send_query_and_decode::<MacAddressingAddMulticastAddressRequest, i32>(
2349 (address,),
2350 0xf5637ff11cf0c25,
2351 fidl::encoding::DynamicFlags::empty(),
2352 _decode,
2353 )
2354 }
2355
2356 type RemoveMulticastAddressResponseFut =
2357 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2358 fn r#remove_multicast_address(
2359 &self,
2360 mut address: &fidl_fuchsia_net::MacAddress,
2361 ) -> Self::RemoveMulticastAddressResponseFut {
2362 fn _decode(
2363 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2364 ) -> Result<i32, fidl::Error> {
2365 let _response = fidl::client::decode_transaction_body::<
2366 MacAddressingRemoveMulticastAddressResponse,
2367 fidl::encoding::DefaultFuchsiaResourceDialect,
2368 0x5dddf4e3ba4e2560,
2369 >(_buf?)?;
2370 Ok(_response.status)
2371 }
2372 self.client.send_query_and_decode::<MacAddressingRemoveMulticastAddressRequest, i32>(
2373 (address,),
2374 0x5dddf4e3ba4e2560,
2375 fidl::encoding::DynamicFlags::empty(),
2376 _decode,
2377 )
2378 }
2379}
2380
2381pub struct MacAddressingEventStream {
2382 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2383}
2384
2385impl std::marker::Unpin for MacAddressingEventStream {}
2386
2387impl futures::stream::FusedStream for MacAddressingEventStream {
2388 fn is_terminated(&self) -> bool {
2389 self.event_receiver.is_terminated()
2390 }
2391}
2392
2393impl futures::Stream for MacAddressingEventStream {
2394 type Item = Result<MacAddressingEvent, fidl::Error>;
2395
2396 fn poll_next(
2397 mut self: std::pin::Pin<&mut Self>,
2398 cx: &mut std::task::Context<'_>,
2399 ) -> std::task::Poll<Option<Self::Item>> {
2400 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2401 &mut self.event_receiver,
2402 cx
2403 )?) {
2404 Some(buf) => std::task::Poll::Ready(Some(MacAddressingEvent::decode(buf))),
2405 None => std::task::Poll::Ready(None),
2406 }
2407 }
2408}
2409
2410#[derive(Debug)]
2411pub enum MacAddressingEvent {}
2412
2413impl MacAddressingEvent {
2414 fn decode(
2416 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2417 ) -> Result<MacAddressingEvent, fidl::Error> {
2418 let (bytes, _handles) = buf.split_mut();
2419 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2420 debug_assert_eq!(tx_header.tx_id, 0);
2421 match tx_header.ordinal {
2422 _ => Err(fidl::Error::UnknownOrdinal {
2423 ordinal: tx_header.ordinal,
2424 protocol_name: <MacAddressingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2425 }),
2426 }
2427 }
2428}
2429
2430pub struct MacAddressingRequestStream {
2432 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2433 is_terminated: bool,
2434}
2435
2436impl std::marker::Unpin for MacAddressingRequestStream {}
2437
2438impl futures::stream::FusedStream for MacAddressingRequestStream {
2439 fn is_terminated(&self) -> bool {
2440 self.is_terminated
2441 }
2442}
2443
2444impl fidl::endpoints::RequestStream for MacAddressingRequestStream {
2445 type Protocol = MacAddressingMarker;
2446 type ControlHandle = MacAddressingControlHandle;
2447
2448 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2449 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2450 }
2451
2452 fn control_handle(&self) -> Self::ControlHandle {
2453 MacAddressingControlHandle { inner: self.inner.clone() }
2454 }
2455
2456 fn into_inner(
2457 self,
2458 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2459 {
2460 (self.inner, self.is_terminated)
2461 }
2462
2463 fn from_inner(
2464 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2465 is_terminated: bool,
2466 ) -> Self {
2467 Self { inner, is_terminated }
2468 }
2469}
2470
2471impl futures::Stream for MacAddressingRequestStream {
2472 type Item = Result<MacAddressingRequest, fidl::Error>;
2473
2474 fn poll_next(
2475 mut self: std::pin::Pin<&mut Self>,
2476 cx: &mut std::task::Context<'_>,
2477 ) -> std::task::Poll<Option<Self::Item>> {
2478 let this = &mut *self;
2479 if this.inner.check_shutdown(cx) {
2480 this.is_terminated = true;
2481 return std::task::Poll::Ready(None);
2482 }
2483 if this.is_terminated {
2484 panic!("polled MacAddressingRequestStream after completion");
2485 }
2486 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2487 |bytes, handles| {
2488 match this.inner.channel().read_etc(cx, bytes, handles) {
2489 std::task::Poll::Ready(Ok(())) => {}
2490 std::task::Poll::Pending => return std::task::Poll::Pending,
2491 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2492 this.is_terminated = true;
2493 return std::task::Poll::Ready(None);
2494 }
2495 std::task::Poll::Ready(Err(e)) => {
2496 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2497 e.into(),
2498 ))));
2499 }
2500 }
2501
2502 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2504
2505 std::task::Poll::Ready(Some(match header.ordinal {
2506 0x2c60b82a4ecfaebe => {
2507 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2508 let mut req = fidl::new_empty!(
2509 fidl::encoding::EmptyPayload,
2510 fidl::encoding::DefaultFuchsiaResourceDialect
2511 );
2512 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2513 let control_handle =
2514 MacAddressingControlHandle { inner: this.inner.clone() };
2515 Ok(MacAddressingRequest::GetUnicastAddress {
2516 responder: MacAddressingGetUnicastAddressResponder {
2517 control_handle: std::mem::ManuallyDrop::new(control_handle),
2518 tx_id: header.tx_id,
2519 },
2520 })
2521 }
2522 0x6297b8dbf03c58c => {
2523 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2524 let mut req = fidl::new_empty!(
2525 MacAddressingSetModeRequest,
2526 fidl::encoding::DefaultFuchsiaResourceDialect
2527 );
2528 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MacAddressingSetModeRequest>(&header, _body_bytes, handles, &mut req)?;
2529 let control_handle =
2530 MacAddressingControlHandle { inner: this.inner.clone() };
2531 Ok(MacAddressingRequest::SetMode {
2532 mode: req.mode,
2533
2534 responder: MacAddressingSetModeResponder {
2535 control_handle: std::mem::ManuallyDrop::new(control_handle),
2536 tx_id: header.tx_id,
2537 },
2538 })
2539 }
2540 0xf5637ff11cf0c25 => {
2541 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2542 let mut req = fidl::new_empty!(
2543 MacAddressingAddMulticastAddressRequest,
2544 fidl::encoding::DefaultFuchsiaResourceDialect
2545 );
2546 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MacAddressingAddMulticastAddressRequest>(&header, _body_bytes, handles, &mut req)?;
2547 let control_handle =
2548 MacAddressingControlHandle { inner: this.inner.clone() };
2549 Ok(MacAddressingRequest::AddMulticastAddress {
2550 address: req.address,
2551
2552 responder: MacAddressingAddMulticastAddressResponder {
2553 control_handle: std::mem::ManuallyDrop::new(control_handle),
2554 tx_id: header.tx_id,
2555 },
2556 })
2557 }
2558 0x5dddf4e3ba4e2560 => {
2559 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2560 let mut req = fidl::new_empty!(
2561 MacAddressingRemoveMulticastAddressRequest,
2562 fidl::encoding::DefaultFuchsiaResourceDialect
2563 );
2564 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MacAddressingRemoveMulticastAddressRequest>(&header, _body_bytes, handles, &mut req)?;
2565 let control_handle =
2566 MacAddressingControlHandle { inner: this.inner.clone() };
2567 Ok(MacAddressingRequest::RemoveMulticastAddress {
2568 address: req.address,
2569
2570 responder: MacAddressingRemoveMulticastAddressResponder {
2571 control_handle: std::mem::ManuallyDrop::new(control_handle),
2572 tx_id: header.tx_id,
2573 },
2574 })
2575 }
2576 _ => Err(fidl::Error::UnknownOrdinal {
2577 ordinal: header.ordinal,
2578 protocol_name:
2579 <MacAddressingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2580 }),
2581 }))
2582 },
2583 )
2584 }
2585}
2586
2587#[derive(Debug)]
2588pub enum MacAddressingRequest {
2589 GetUnicastAddress { responder: MacAddressingGetUnicastAddressResponder },
2600 SetMode { mode: MacFilterMode, responder: MacAddressingSetModeResponder },
2620 AddMulticastAddress {
2632 address: fidl_fuchsia_net::MacAddress,
2633 responder: MacAddressingAddMulticastAddressResponder,
2634 },
2635 RemoveMulticastAddress {
2641 address: fidl_fuchsia_net::MacAddress,
2642 responder: MacAddressingRemoveMulticastAddressResponder,
2643 },
2644}
2645
2646impl MacAddressingRequest {
2647 #[allow(irrefutable_let_patterns)]
2648 pub fn into_get_unicast_address(self) -> Option<(MacAddressingGetUnicastAddressResponder)> {
2649 if let MacAddressingRequest::GetUnicastAddress { responder } = self {
2650 Some((responder))
2651 } else {
2652 None
2653 }
2654 }
2655
2656 #[allow(irrefutable_let_patterns)]
2657 pub fn into_set_mode(self) -> Option<(MacFilterMode, MacAddressingSetModeResponder)> {
2658 if let MacAddressingRequest::SetMode { mode, responder } = self {
2659 Some((mode, responder))
2660 } else {
2661 None
2662 }
2663 }
2664
2665 #[allow(irrefutable_let_patterns)]
2666 pub fn into_add_multicast_address(
2667 self,
2668 ) -> Option<(fidl_fuchsia_net::MacAddress, MacAddressingAddMulticastAddressResponder)> {
2669 if let MacAddressingRequest::AddMulticastAddress { address, responder } = self {
2670 Some((address, responder))
2671 } else {
2672 None
2673 }
2674 }
2675
2676 #[allow(irrefutable_let_patterns)]
2677 pub fn into_remove_multicast_address(
2678 self,
2679 ) -> Option<(fidl_fuchsia_net::MacAddress, MacAddressingRemoveMulticastAddressResponder)> {
2680 if let MacAddressingRequest::RemoveMulticastAddress { address, responder } = self {
2681 Some((address, responder))
2682 } else {
2683 None
2684 }
2685 }
2686
2687 pub fn method_name(&self) -> &'static str {
2689 match *self {
2690 MacAddressingRequest::GetUnicastAddress { .. } => "get_unicast_address",
2691 MacAddressingRequest::SetMode { .. } => "set_mode",
2692 MacAddressingRequest::AddMulticastAddress { .. } => "add_multicast_address",
2693 MacAddressingRequest::RemoveMulticastAddress { .. } => "remove_multicast_address",
2694 }
2695 }
2696}
2697
2698#[derive(Debug, Clone)]
2699pub struct MacAddressingControlHandle {
2700 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2701}
2702
2703impl fidl::endpoints::ControlHandle for MacAddressingControlHandle {
2704 fn shutdown(&self) {
2705 self.inner.shutdown()
2706 }
2707
2708 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2709 self.inner.shutdown_with_epitaph(status)
2710 }
2711
2712 fn is_closed(&self) -> bool {
2713 self.inner.channel().is_closed()
2714 }
2715 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2716 self.inner.channel().on_closed()
2717 }
2718
2719 #[cfg(target_os = "fuchsia")]
2720 fn signal_peer(
2721 &self,
2722 clear_mask: zx::Signals,
2723 set_mask: zx::Signals,
2724 ) -> Result<(), zx_status::Status> {
2725 use fidl::Peered;
2726 self.inner.channel().signal_peer(clear_mask, set_mask)
2727 }
2728}
2729
2730impl MacAddressingControlHandle {}
2731
2732#[must_use = "FIDL methods require a response to be sent"]
2733#[derive(Debug)]
2734pub struct MacAddressingGetUnicastAddressResponder {
2735 control_handle: std::mem::ManuallyDrop<MacAddressingControlHandle>,
2736 tx_id: u32,
2737}
2738
2739impl std::ops::Drop for MacAddressingGetUnicastAddressResponder {
2743 fn drop(&mut self) {
2744 self.control_handle.shutdown();
2745 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2747 }
2748}
2749
2750impl fidl::endpoints::Responder for MacAddressingGetUnicastAddressResponder {
2751 type ControlHandle = MacAddressingControlHandle;
2752
2753 fn control_handle(&self) -> &MacAddressingControlHandle {
2754 &self.control_handle
2755 }
2756
2757 fn drop_without_shutdown(mut self) {
2758 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2760 std::mem::forget(self);
2762 }
2763}
2764
2765impl MacAddressingGetUnicastAddressResponder {
2766 pub fn send(self, mut address: &fidl_fuchsia_net::MacAddress) -> Result<(), fidl::Error> {
2770 let _result = self.send_raw(address);
2771 if _result.is_err() {
2772 self.control_handle.shutdown();
2773 }
2774 self.drop_without_shutdown();
2775 _result
2776 }
2777
2778 pub fn send_no_shutdown_on_err(
2780 self,
2781 mut address: &fidl_fuchsia_net::MacAddress,
2782 ) -> Result<(), fidl::Error> {
2783 let _result = self.send_raw(address);
2784 self.drop_without_shutdown();
2785 _result
2786 }
2787
2788 fn send_raw(&self, mut address: &fidl_fuchsia_net::MacAddress) -> Result<(), fidl::Error> {
2789 self.control_handle.inner.send::<MacAddressingGetUnicastAddressResponse>(
2790 (address,),
2791 self.tx_id,
2792 0x2c60b82a4ecfaebe,
2793 fidl::encoding::DynamicFlags::empty(),
2794 )
2795 }
2796}
2797
2798#[must_use = "FIDL methods require a response to be sent"]
2799#[derive(Debug)]
2800pub struct MacAddressingSetModeResponder {
2801 control_handle: std::mem::ManuallyDrop<MacAddressingControlHandle>,
2802 tx_id: u32,
2803}
2804
2805impl std::ops::Drop for MacAddressingSetModeResponder {
2809 fn drop(&mut self) {
2810 self.control_handle.shutdown();
2811 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2813 }
2814}
2815
2816impl fidl::endpoints::Responder for MacAddressingSetModeResponder {
2817 type ControlHandle = MacAddressingControlHandle;
2818
2819 fn control_handle(&self) -> &MacAddressingControlHandle {
2820 &self.control_handle
2821 }
2822
2823 fn drop_without_shutdown(mut self) {
2824 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2826 std::mem::forget(self);
2828 }
2829}
2830
2831impl MacAddressingSetModeResponder {
2832 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2836 let _result = self.send_raw(status);
2837 if _result.is_err() {
2838 self.control_handle.shutdown();
2839 }
2840 self.drop_without_shutdown();
2841 _result
2842 }
2843
2844 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2846 let _result = self.send_raw(status);
2847 self.drop_without_shutdown();
2848 _result
2849 }
2850
2851 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2852 self.control_handle.inner.send::<MacAddressingSetModeResponse>(
2853 (status,),
2854 self.tx_id,
2855 0x6297b8dbf03c58c,
2856 fidl::encoding::DynamicFlags::empty(),
2857 )
2858 }
2859}
2860
2861#[must_use = "FIDL methods require a response to be sent"]
2862#[derive(Debug)]
2863pub struct MacAddressingAddMulticastAddressResponder {
2864 control_handle: std::mem::ManuallyDrop<MacAddressingControlHandle>,
2865 tx_id: u32,
2866}
2867
2868impl std::ops::Drop for MacAddressingAddMulticastAddressResponder {
2872 fn drop(&mut self) {
2873 self.control_handle.shutdown();
2874 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2876 }
2877}
2878
2879impl fidl::endpoints::Responder for MacAddressingAddMulticastAddressResponder {
2880 type ControlHandle = MacAddressingControlHandle;
2881
2882 fn control_handle(&self) -> &MacAddressingControlHandle {
2883 &self.control_handle
2884 }
2885
2886 fn drop_without_shutdown(mut self) {
2887 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2889 std::mem::forget(self);
2891 }
2892}
2893
2894impl MacAddressingAddMulticastAddressResponder {
2895 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2899 let _result = self.send_raw(status);
2900 if _result.is_err() {
2901 self.control_handle.shutdown();
2902 }
2903 self.drop_without_shutdown();
2904 _result
2905 }
2906
2907 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2909 let _result = self.send_raw(status);
2910 self.drop_without_shutdown();
2911 _result
2912 }
2913
2914 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2915 self.control_handle.inner.send::<MacAddressingAddMulticastAddressResponse>(
2916 (status,),
2917 self.tx_id,
2918 0xf5637ff11cf0c25,
2919 fidl::encoding::DynamicFlags::empty(),
2920 )
2921 }
2922}
2923
2924#[must_use = "FIDL methods require a response to be sent"]
2925#[derive(Debug)]
2926pub struct MacAddressingRemoveMulticastAddressResponder {
2927 control_handle: std::mem::ManuallyDrop<MacAddressingControlHandle>,
2928 tx_id: u32,
2929}
2930
2931impl std::ops::Drop for MacAddressingRemoveMulticastAddressResponder {
2935 fn drop(&mut self) {
2936 self.control_handle.shutdown();
2937 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2939 }
2940}
2941
2942impl fidl::endpoints::Responder for MacAddressingRemoveMulticastAddressResponder {
2943 type ControlHandle = MacAddressingControlHandle;
2944
2945 fn control_handle(&self) -> &MacAddressingControlHandle {
2946 &self.control_handle
2947 }
2948
2949 fn drop_without_shutdown(mut self) {
2950 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2952 std::mem::forget(self);
2954 }
2955}
2956
2957impl MacAddressingRemoveMulticastAddressResponder {
2958 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2962 let _result = self.send_raw(status);
2963 if _result.is_err() {
2964 self.control_handle.shutdown();
2965 }
2966 self.drop_without_shutdown();
2967 _result
2968 }
2969
2970 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2972 let _result = self.send_raw(status);
2973 self.drop_without_shutdown();
2974 _result
2975 }
2976
2977 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2978 self.control_handle.inner.send::<MacAddressingRemoveMulticastAddressResponse>(
2979 (status,),
2980 self.tx_id,
2981 0x5dddf4e3ba4e2560,
2982 fidl::encoding::DynamicFlags::empty(),
2983 )
2984 }
2985}
2986
2987#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2988pub struct PortMarker;
2989
2990impl fidl::endpoints::ProtocolMarker for PortMarker {
2991 type Proxy = PortProxy;
2992 type RequestStream = PortRequestStream;
2993 #[cfg(target_os = "fuchsia")]
2994 type SynchronousProxy = PortSynchronousProxy;
2995
2996 const DEBUG_NAME: &'static str = "(anonymous) Port";
2997}
2998
2999pub trait PortProxyInterface: Send + Sync {
3000 type GetInfoResponseFut: std::future::Future<Output = Result<PortInfo, fidl::Error>> + Send;
3001 fn r#get_info(&self) -> Self::GetInfoResponseFut;
3002 type GetStatusResponseFut: std::future::Future<Output = Result<PortStatus, fidl::Error>> + Send;
3003 fn r#get_status(&self) -> Self::GetStatusResponseFut;
3004 fn r#get_status_watcher(
3005 &self,
3006 watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3007 buffer: u32,
3008 ) -> Result<(), fidl::Error>;
3009 fn r#get_mac(
3010 &self,
3011 mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3012 ) -> Result<(), fidl::Error>;
3013 fn r#get_device(
3014 &self,
3015 device: fidl::endpoints::ServerEnd<DeviceMarker>,
3016 ) -> Result<(), fidl::Error>;
3017 fn r#clone(&self, port: fidl::endpoints::ServerEnd<PortMarker>) -> Result<(), fidl::Error>;
3018 type GetCountersResponseFut: std::future::Future<Output = Result<PortGetCountersResponse, fidl::Error>>
3019 + Send;
3020 fn r#get_counters(&self) -> Self::GetCountersResponseFut;
3021 fn r#get_diagnostics(
3022 &self,
3023 diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3024 ) -> Result<(), fidl::Error>;
3025 type GetIdentityResponseFut: std::future::Future<Output = Result<fidl::Event, fidl::Error>>
3026 + Send;
3027 fn r#get_identity(&self) -> Self::GetIdentityResponseFut;
3028}
3029#[derive(Debug)]
3030#[cfg(target_os = "fuchsia")]
3031pub struct PortSynchronousProxy {
3032 client: fidl::client::sync::Client,
3033}
3034
3035#[cfg(target_os = "fuchsia")]
3036impl fidl::endpoints::SynchronousProxy for PortSynchronousProxy {
3037 type Proxy = PortProxy;
3038 type Protocol = PortMarker;
3039
3040 fn from_channel(inner: fidl::Channel) -> Self {
3041 Self::new(inner)
3042 }
3043
3044 fn into_channel(self) -> fidl::Channel {
3045 self.client.into_channel()
3046 }
3047
3048 fn as_channel(&self) -> &fidl::Channel {
3049 self.client.as_channel()
3050 }
3051}
3052
3053#[cfg(target_os = "fuchsia")]
3054impl PortSynchronousProxy {
3055 pub fn new(channel: fidl::Channel) -> Self {
3056 Self { client: fidl::client::sync::Client::new(channel) }
3057 }
3058
3059 pub fn into_channel(self) -> fidl::Channel {
3060 self.client.into_channel()
3061 }
3062
3063 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<PortEvent, fidl::Error> {
3066 PortEvent::decode(self.client.wait_for_event::<PortMarker>(deadline)?)
3067 }
3068
3069 pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<PortInfo, fidl::Error> {
3073 let _response = self
3074 .client
3075 .send_query::<fidl::encoding::EmptyPayload, PortGetInfoResponse, PortMarker>(
3076 (),
3077 0x276cf65feb554ebd,
3078 fidl::encoding::DynamicFlags::empty(),
3079 ___deadline,
3080 )?;
3081 Ok(_response.info)
3082 }
3083
3084 pub fn r#get_status(
3088 &self,
3089 ___deadline: zx::MonotonicInstant,
3090 ) -> Result<PortStatus, fidl::Error> {
3091 let _response = self
3092 .client
3093 .send_query::<fidl::encoding::EmptyPayload, PortGetStatusResponse, PortMarker>(
3094 (),
3095 0x4235650aacca60b2,
3096 fidl::encoding::DynamicFlags::empty(),
3097 ___deadline,
3098 )?;
3099 Ok(_response.status)
3100 }
3101
3102 pub fn r#get_status_watcher(
3114 &self,
3115 mut watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3116 mut buffer: u32,
3117 ) -> Result<(), fidl::Error> {
3118 self.client.send::<PortGetStatusWatcherRequest>(
3119 (watcher, buffer),
3120 0x65511ab81c1bd8d4,
3121 fidl::encoding::DynamicFlags::empty(),
3122 )
3123 }
3124
3125 pub fn r#get_mac(
3130 &self,
3131 mut mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3132 ) -> Result<(), fidl::Error> {
3133 self.client.send::<PortGetMacRequest>(
3134 (mac,),
3135 0x2c6ec2988aefc0f6,
3136 fidl::encoding::DynamicFlags::empty(),
3137 )
3138 }
3139
3140 pub fn r#get_device(
3144 &self,
3145 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
3146 ) -> Result<(), fidl::Error> {
3147 self.client.send::<PortGetDeviceRequest>(
3148 (device,),
3149 0x7de34747235d2d80,
3150 fidl::encoding::DynamicFlags::empty(),
3151 )
3152 }
3153
3154 pub fn r#clone(
3158 &self,
3159 mut port: fidl::endpoints::ServerEnd<PortMarker>,
3160 ) -> Result<(), fidl::Error> {
3161 self.client.send::<PortCloneRequest>(
3162 (port,),
3163 0x4e4764150b4942d3,
3164 fidl::encoding::DynamicFlags::empty(),
3165 )
3166 }
3167
3168 pub fn r#get_counters(
3170 &self,
3171 ___deadline: zx::MonotonicInstant,
3172 ) -> Result<PortGetCountersResponse, fidl::Error> {
3173 let _response = self
3174 .client
3175 .send_query::<fidl::encoding::EmptyPayload, PortGetCountersResponse, PortMarker>(
3176 (),
3177 0x6a213b03c4fcbbac,
3178 fidl::encoding::DynamicFlags::empty(),
3179 ___deadline,
3180 )?;
3181 Ok(_response)
3182 }
3183
3184 pub fn r#get_diagnostics(
3188 &self,
3189 mut diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3190 ) -> Result<(), fidl::Error> {
3191 self.client.send::<PortGetDiagnosticsRequest>(
3192 (diagnostics,),
3193 0x381faa4ed75e399c,
3194 fidl::encoding::DynamicFlags::empty(),
3195 )
3196 }
3197
3198 pub fn r#get_identity(
3204 &self,
3205 ___deadline: zx::MonotonicInstant,
3206 ) -> Result<fidl::Event, fidl::Error> {
3207 let _response = self
3208 .client
3209 .send_query::<fidl::encoding::EmptyPayload, PortGetIdentityResponse, PortMarker>(
3210 (),
3211 0x75134ce0bc114e5a,
3212 fidl::encoding::DynamicFlags::empty(),
3213 ___deadline,
3214 )?;
3215 Ok(_response.event)
3216 }
3217}
3218
3219#[cfg(target_os = "fuchsia")]
3220impl From<PortSynchronousProxy> for zx::NullableHandle {
3221 fn from(value: PortSynchronousProxy) -> Self {
3222 value.into_channel().into()
3223 }
3224}
3225
3226#[cfg(target_os = "fuchsia")]
3227impl From<fidl::Channel> for PortSynchronousProxy {
3228 fn from(value: fidl::Channel) -> Self {
3229 Self::new(value)
3230 }
3231}
3232
3233#[cfg(target_os = "fuchsia")]
3234impl fidl::endpoints::FromClient for PortSynchronousProxy {
3235 type Protocol = PortMarker;
3236
3237 fn from_client(value: fidl::endpoints::ClientEnd<PortMarker>) -> Self {
3238 Self::new(value.into_channel())
3239 }
3240}
3241
3242#[derive(Debug, Clone)]
3243pub struct PortProxy {
3244 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3245}
3246
3247impl fidl::endpoints::Proxy for PortProxy {
3248 type Protocol = PortMarker;
3249
3250 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3251 Self::new(inner)
3252 }
3253
3254 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3255 self.client.into_channel().map_err(|client| Self { client })
3256 }
3257
3258 fn as_channel(&self) -> &::fidl::AsyncChannel {
3259 self.client.as_channel()
3260 }
3261}
3262
3263impl PortProxy {
3264 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3266 let protocol_name = <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3267 Self { client: fidl::client::Client::new(channel, protocol_name) }
3268 }
3269
3270 pub fn take_event_stream(&self) -> PortEventStream {
3276 PortEventStream { event_receiver: self.client.take_event_receiver() }
3277 }
3278
3279 pub fn r#get_info(
3283 &self,
3284 ) -> fidl::client::QueryResponseFut<PortInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
3285 {
3286 PortProxyInterface::r#get_info(self)
3287 }
3288
3289 pub fn r#get_status(
3293 &self,
3294 ) -> fidl::client::QueryResponseFut<PortStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
3295 {
3296 PortProxyInterface::r#get_status(self)
3297 }
3298
3299 pub fn r#get_status_watcher(
3311 &self,
3312 mut watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3313 mut buffer: u32,
3314 ) -> Result<(), fidl::Error> {
3315 PortProxyInterface::r#get_status_watcher(self, watcher, buffer)
3316 }
3317
3318 pub fn r#get_mac(
3323 &self,
3324 mut mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3325 ) -> Result<(), fidl::Error> {
3326 PortProxyInterface::r#get_mac(self, mac)
3327 }
3328
3329 pub fn r#get_device(
3333 &self,
3334 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
3335 ) -> Result<(), fidl::Error> {
3336 PortProxyInterface::r#get_device(self, device)
3337 }
3338
3339 pub fn r#clone(
3343 &self,
3344 mut port: fidl::endpoints::ServerEnd<PortMarker>,
3345 ) -> Result<(), fidl::Error> {
3346 PortProxyInterface::r#clone(self, port)
3347 }
3348
3349 pub fn r#get_counters(
3351 &self,
3352 ) -> fidl::client::QueryResponseFut<
3353 PortGetCountersResponse,
3354 fidl::encoding::DefaultFuchsiaResourceDialect,
3355 > {
3356 PortProxyInterface::r#get_counters(self)
3357 }
3358
3359 pub fn r#get_diagnostics(
3363 &self,
3364 mut diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3365 ) -> Result<(), fidl::Error> {
3366 PortProxyInterface::r#get_diagnostics(self, diagnostics)
3367 }
3368
3369 pub fn r#get_identity(
3375 &self,
3376 ) -> fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>
3377 {
3378 PortProxyInterface::r#get_identity(self)
3379 }
3380}
3381
3382impl PortProxyInterface for PortProxy {
3383 type GetInfoResponseFut =
3384 fidl::client::QueryResponseFut<PortInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
3385 fn r#get_info(&self) -> Self::GetInfoResponseFut {
3386 fn _decode(
3387 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3388 ) -> Result<PortInfo, fidl::Error> {
3389 let _response = fidl::client::decode_transaction_body::<
3390 PortGetInfoResponse,
3391 fidl::encoding::DefaultFuchsiaResourceDialect,
3392 0x276cf65feb554ebd,
3393 >(_buf?)?;
3394 Ok(_response.info)
3395 }
3396 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PortInfo>(
3397 (),
3398 0x276cf65feb554ebd,
3399 fidl::encoding::DynamicFlags::empty(),
3400 _decode,
3401 )
3402 }
3403
3404 type GetStatusResponseFut =
3405 fidl::client::QueryResponseFut<PortStatus, fidl::encoding::DefaultFuchsiaResourceDialect>;
3406 fn r#get_status(&self) -> Self::GetStatusResponseFut {
3407 fn _decode(
3408 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3409 ) -> Result<PortStatus, fidl::Error> {
3410 let _response = fidl::client::decode_transaction_body::<
3411 PortGetStatusResponse,
3412 fidl::encoding::DefaultFuchsiaResourceDialect,
3413 0x4235650aacca60b2,
3414 >(_buf?)?;
3415 Ok(_response.status)
3416 }
3417 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PortStatus>(
3418 (),
3419 0x4235650aacca60b2,
3420 fidl::encoding::DynamicFlags::empty(),
3421 _decode,
3422 )
3423 }
3424
3425 fn r#get_status_watcher(
3426 &self,
3427 mut watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3428 mut buffer: u32,
3429 ) -> Result<(), fidl::Error> {
3430 self.client.send::<PortGetStatusWatcherRequest>(
3431 (watcher, buffer),
3432 0x65511ab81c1bd8d4,
3433 fidl::encoding::DynamicFlags::empty(),
3434 )
3435 }
3436
3437 fn r#get_mac(
3438 &self,
3439 mut mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3440 ) -> Result<(), fidl::Error> {
3441 self.client.send::<PortGetMacRequest>(
3442 (mac,),
3443 0x2c6ec2988aefc0f6,
3444 fidl::encoding::DynamicFlags::empty(),
3445 )
3446 }
3447
3448 fn r#get_device(
3449 &self,
3450 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
3451 ) -> Result<(), fidl::Error> {
3452 self.client.send::<PortGetDeviceRequest>(
3453 (device,),
3454 0x7de34747235d2d80,
3455 fidl::encoding::DynamicFlags::empty(),
3456 )
3457 }
3458
3459 fn r#clone(&self, mut port: fidl::endpoints::ServerEnd<PortMarker>) -> Result<(), fidl::Error> {
3460 self.client.send::<PortCloneRequest>(
3461 (port,),
3462 0x4e4764150b4942d3,
3463 fidl::encoding::DynamicFlags::empty(),
3464 )
3465 }
3466
3467 type GetCountersResponseFut = fidl::client::QueryResponseFut<
3468 PortGetCountersResponse,
3469 fidl::encoding::DefaultFuchsiaResourceDialect,
3470 >;
3471 fn r#get_counters(&self) -> Self::GetCountersResponseFut {
3472 fn _decode(
3473 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3474 ) -> Result<PortGetCountersResponse, fidl::Error> {
3475 let _response = fidl::client::decode_transaction_body::<
3476 PortGetCountersResponse,
3477 fidl::encoding::DefaultFuchsiaResourceDialect,
3478 0x6a213b03c4fcbbac,
3479 >(_buf?)?;
3480 Ok(_response)
3481 }
3482 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PortGetCountersResponse>(
3483 (),
3484 0x6a213b03c4fcbbac,
3485 fidl::encoding::DynamicFlags::empty(),
3486 _decode,
3487 )
3488 }
3489
3490 fn r#get_diagnostics(
3491 &self,
3492 mut diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3493 ) -> Result<(), fidl::Error> {
3494 self.client.send::<PortGetDiagnosticsRequest>(
3495 (diagnostics,),
3496 0x381faa4ed75e399c,
3497 fidl::encoding::DynamicFlags::empty(),
3498 )
3499 }
3500
3501 type GetIdentityResponseFut =
3502 fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>;
3503 fn r#get_identity(&self) -> Self::GetIdentityResponseFut {
3504 fn _decode(
3505 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3506 ) -> Result<fidl::Event, fidl::Error> {
3507 let _response = fidl::client::decode_transaction_body::<
3508 PortGetIdentityResponse,
3509 fidl::encoding::DefaultFuchsiaResourceDialect,
3510 0x75134ce0bc114e5a,
3511 >(_buf?)?;
3512 Ok(_response.event)
3513 }
3514 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Event>(
3515 (),
3516 0x75134ce0bc114e5a,
3517 fidl::encoding::DynamicFlags::empty(),
3518 _decode,
3519 )
3520 }
3521}
3522
3523pub struct PortEventStream {
3524 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3525}
3526
3527impl std::marker::Unpin for PortEventStream {}
3528
3529impl futures::stream::FusedStream for PortEventStream {
3530 fn is_terminated(&self) -> bool {
3531 self.event_receiver.is_terminated()
3532 }
3533}
3534
3535impl futures::Stream for PortEventStream {
3536 type Item = Result<PortEvent, fidl::Error>;
3537
3538 fn poll_next(
3539 mut self: std::pin::Pin<&mut Self>,
3540 cx: &mut std::task::Context<'_>,
3541 ) -> std::task::Poll<Option<Self::Item>> {
3542 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3543 &mut self.event_receiver,
3544 cx
3545 )?) {
3546 Some(buf) => std::task::Poll::Ready(Some(PortEvent::decode(buf))),
3547 None => std::task::Poll::Ready(None),
3548 }
3549 }
3550}
3551
3552#[derive(Debug)]
3553pub enum PortEvent {}
3554
3555impl PortEvent {
3556 fn decode(
3558 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3559 ) -> Result<PortEvent, fidl::Error> {
3560 let (bytes, _handles) = buf.split_mut();
3561 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3562 debug_assert_eq!(tx_header.tx_id, 0);
3563 match tx_header.ordinal {
3564 _ => Err(fidl::Error::UnknownOrdinal {
3565 ordinal: tx_header.ordinal,
3566 protocol_name: <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3567 }),
3568 }
3569 }
3570}
3571
3572pub struct PortRequestStream {
3574 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3575 is_terminated: bool,
3576}
3577
3578impl std::marker::Unpin for PortRequestStream {}
3579
3580impl futures::stream::FusedStream for PortRequestStream {
3581 fn is_terminated(&self) -> bool {
3582 self.is_terminated
3583 }
3584}
3585
3586impl fidl::endpoints::RequestStream for PortRequestStream {
3587 type Protocol = PortMarker;
3588 type ControlHandle = PortControlHandle;
3589
3590 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3591 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3592 }
3593
3594 fn control_handle(&self) -> Self::ControlHandle {
3595 PortControlHandle { inner: self.inner.clone() }
3596 }
3597
3598 fn into_inner(
3599 self,
3600 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3601 {
3602 (self.inner, self.is_terminated)
3603 }
3604
3605 fn from_inner(
3606 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3607 is_terminated: bool,
3608 ) -> Self {
3609 Self { inner, is_terminated }
3610 }
3611}
3612
3613impl futures::Stream for PortRequestStream {
3614 type Item = Result<PortRequest, fidl::Error>;
3615
3616 fn poll_next(
3617 mut self: std::pin::Pin<&mut Self>,
3618 cx: &mut std::task::Context<'_>,
3619 ) -> std::task::Poll<Option<Self::Item>> {
3620 let this = &mut *self;
3621 if this.inner.check_shutdown(cx) {
3622 this.is_terminated = true;
3623 return std::task::Poll::Ready(None);
3624 }
3625 if this.is_terminated {
3626 panic!("polled PortRequestStream after completion");
3627 }
3628 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3629 |bytes, handles| {
3630 match this.inner.channel().read_etc(cx, bytes, handles) {
3631 std::task::Poll::Ready(Ok(())) => {}
3632 std::task::Poll::Pending => return std::task::Poll::Pending,
3633 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3634 this.is_terminated = true;
3635 return std::task::Poll::Ready(None);
3636 }
3637 std::task::Poll::Ready(Err(e)) => {
3638 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3639 e.into(),
3640 ))));
3641 }
3642 }
3643
3644 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3646
3647 std::task::Poll::Ready(Some(match header.ordinal {
3648 0x276cf65feb554ebd => {
3649 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3650 let mut req = fidl::new_empty!(
3651 fidl::encoding::EmptyPayload,
3652 fidl::encoding::DefaultFuchsiaResourceDialect
3653 );
3654 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3655 let control_handle = PortControlHandle { inner: this.inner.clone() };
3656 Ok(PortRequest::GetInfo {
3657 responder: PortGetInfoResponder {
3658 control_handle: std::mem::ManuallyDrop::new(control_handle),
3659 tx_id: header.tx_id,
3660 },
3661 })
3662 }
3663 0x4235650aacca60b2 => {
3664 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3665 let mut req = fidl::new_empty!(
3666 fidl::encoding::EmptyPayload,
3667 fidl::encoding::DefaultFuchsiaResourceDialect
3668 );
3669 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3670 let control_handle = PortControlHandle { inner: this.inner.clone() };
3671 Ok(PortRequest::GetStatus {
3672 responder: PortGetStatusResponder {
3673 control_handle: std::mem::ManuallyDrop::new(control_handle),
3674 tx_id: header.tx_id,
3675 },
3676 })
3677 }
3678 0x65511ab81c1bd8d4 => {
3679 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3680 let mut req = fidl::new_empty!(
3681 PortGetStatusWatcherRequest,
3682 fidl::encoding::DefaultFuchsiaResourceDialect
3683 );
3684 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetStatusWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
3685 let control_handle = PortControlHandle { inner: this.inner.clone() };
3686 Ok(PortRequest::GetStatusWatcher {
3687 watcher: req.watcher,
3688 buffer: req.buffer,
3689
3690 control_handle,
3691 })
3692 }
3693 0x2c6ec2988aefc0f6 => {
3694 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3695 let mut req = fidl::new_empty!(
3696 PortGetMacRequest,
3697 fidl::encoding::DefaultFuchsiaResourceDialect
3698 );
3699 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetMacRequest>(&header, _body_bytes, handles, &mut req)?;
3700 let control_handle = PortControlHandle { inner: this.inner.clone() };
3701 Ok(PortRequest::GetMac { mac: req.mac, control_handle })
3702 }
3703 0x7de34747235d2d80 => {
3704 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3705 let mut req = fidl::new_empty!(
3706 PortGetDeviceRequest,
3707 fidl::encoding::DefaultFuchsiaResourceDialect
3708 );
3709 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
3710 let control_handle = PortControlHandle { inner: this.inner.clone() };
3711 Ok(PortRequest::GetDevice { device: req.device, control_handle })
3712 }
3713 0x4e4764150b4942d3 => {
3714 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3715 let mut req = fidl::new_empty!(
3716 PortCloneRequest,
3717 fidl::encoding::DefaultFuchsiaResourceDialect
3718 );
3719 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortCloneRequest>(&header, _body_bytes, handles, &mut req)?;
3720 let control_handle = PortControlHandle { inner: this.inner.clone() };
3721 Ok(PortRequest::Clone { port: req.port, control_handle })
3722 }
3723 0x6a213b03c4fcbbac => {
3724 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3725 let mut req = fidl::new_empty!(
3726 fidl::encoding::EmptyPayload,
3727 fidl::encoding::DefaultFuchsiaResourceDialect
3728 );
3729 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3730 let control_handle = PortControlHandle { inner: this.inner.clone() };
3731 Ok(PortRequest::GetCounters {
3732 responder: PortGetCountersResponder {
3733 control_handle: std::mem::ManuallyDrop::new(control_handle),
3734 tx_id: header.tx_id,
3735 },
3736 })
3737 }
3738 0x381faa4ed75e399c => {
3739 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3740 let mut req = fidl::new_empty!(
3741 PortGetDiagnosticsRequest,
3742 fidl::encoding::DefaultFuchsiaResourceDialect
3743 );
3744 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetDiagnosticsRequest>(&header, _body_bytes, handles, &mut req)?;
3745 let control_handle = PortControlHandle { inner: this.inner.clone() };
3746 Ok(PortRequest::GetDiagnostics {
3747 diagnostics: req.diagnostics,
3748
3749 control_handle,
3750 })
3751 }
3752 0x75134ce0bc114e5a => {
3753 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3754 let mut req = fidl::new_empty!(
3755 fidl::encoding::EmptyPayload,
3756 fidl::encoding::DefaultFuchsiaResourceDialect
3757 );
3758 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3759 let control_handle = PortControlHandle { inner: this.inner.clone() };
3760 Ok(PortRequest::GetIdentity {
3761 responder: PortGetIdentityResponder {
3762 control_handle: std::mem::ManuallyDrop::new(control_handle),
3763 tx_id: header.tx_id,
3764 },
3765 })
3766 }
3767 _ => Err(fidl::Error::UnknownOrdinal {
3768 ordinal: header.ordinal,
3769 protocol_name: <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3770 }),
3771 }))
3772 },
3773 )
3774 }
3775}
3776
3777#[derive(Debug)]
3779pub enum PortRequest {
3780 GetInfo { responder: PortGetInfoResponder },
3784 GetStatus { responder: PortGetStatusResponder },
3788 GetStatusWatcher {
3800 watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3801 buffer: u32,
3802 control_handle: PortControlHandle,
3803 },
3804 GetMac {
3809 mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3810 control_handle: PortControlHandle,
3811 },
3812 GetDevice {
3816 device: fidl::endpoints::ServerEnd<DeviceMarker>,
3817 control_handle: PortControlHandle,
3818 },
3819 Clone { port: fidl::endpoints::ServerEnd<PortMarker>, control_handle: PortControlHandle },
3823 GetCounters { responder: PortGetCountersResponder },
3825 GetDiagnostics {
3829 diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3830 control_handle: PortControlHandle,
3831 },
3832 GetIdentity { responder: PortGetIdentityResponder },
3838}
3839
3840impl PortRequest {
3841 #[allow(irrefutable_let_patterns)]
3842 pub fn into_get_info(self) -> Option<(PortGetInfoResponder)> {
3843 if let PortRequest::GetInfo { responder } = self { Some((responder)) } else { None }
3844 }
3845
3846 #[allow(irrefutable_let_patterns)]
3847 pub fn into_get_status(self) -> Option<(PortGetStatusResponder)> {
3848 if let PortRequest::GetStatus { responder } = self { Some((responder)) } else { None }
3849 }
3850
3851 #[allow(irrefutable_let_patterns)]
3852 pub fn into_get_status_watcher(
3853 self,
3854 ) -> Option<(fidl::endpoints::ServerEnd<StatusWatcherMarker>, u32, PortControlHandle)> {
3855 if let PortRequest::GetStatusWatcher { watcher, buffer, control_handle } = self {
3856 Some((watcher, buffer, control_handle))
3857 } else {
3858 None
3859 }
3860 }
3861
3862 #[allow(irrefutable_let_patterns)]
3863 pub fn into_get_mac(
3864 self,
3865 ) -> Option<(fidl::endpoints::ServerEnd<MacAddressingMarker>, PortControlHandle)> {
3866 if let PortRequest::GetMac { mac, control_handle } = self {
3867 Some((mac, control_handle))
3868 } else {
3869 None
3870 }
3871 }
3872
3873 #[allow(irrefutable_let_patterns)]
3874 pub fn into_get_device(
3875 self,
3876 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, PortControlHandle)> {
3877 if let PortRequest::GetDevice { device, control_handle } = self {
3878 Some((device, control_handle))
3879 } else {
3880 None
3881 }
3882 }
3883
3884 #[allow(irrefutable_let_patterns)]
3885 pub fn into_clone(self) -> Option<(fidl::endpoints::ServerEnd<PortMarker>, PortControlHandle)> {
3886 if let PortRequest::Clone { port, control_handle } = self {
3887 Some((port, control_handle))
3888 } else {
3889 None
3890 }
3891 }
3892
3893 #[allow(irrefutable_let_patterns)]
3894 pub fn into_get_counters(self) -> Option<(PortGetCountersResponder)> {
3895 if let PortRequest::GetCounters { responder } = self { Some((responder)) } else { None }
3896 }
3897
3898 #[allow(irrefutable_let_patterns)]
3899 pub fn into_get_diagnostics(
3900 self,
3901 ) -> Option<(fidl::endpoints::ServerEnd<DiagnosticsMarker>, PortControlHandle)> {
3902 if let PortRequest::GetDiagnostics { diagnostics, control_handle } = self {
3903 Some((diagnostics, control_handle))
3904 } else {
3905 None
3906 }
3907 }
3908
3909 #[allow(irrefutable_let_patterns)]
3910 pub fn into_get_identity(self) -> Option<(PortGetIdentityResponder)> {
3911 if let PortRequest::GetIdentity { responder } = self { Some((responder)) } else { None }
3912 }
3913
3914 pub fn method_name(&self) -> &'static str {
3916 match *self {
3917 PortRequest::GetInfo { .. } => "get_info",
3918 PortRequest::GetStatus { .. } => "get_status",
3919 PortRequest::GetStatusWatcher { .. } => "get_status_watcher",
3920 PortRequest::GetMac { .. } => "get_mac",
3921 PortRequest::GetDevice { .. } => "get_device",
3922 PortRequest::Clone { .. } => "clone",
3923 PortRequest::GetCounters { .. } => "get_counters",
3924 PortRequest::GetDiagnostics { .. } => "get_diagnostics",
3925 PortRequest::GetIdentity { .. } => "get_identity",
3926 }
3927 }
3928}
3929
3930#[derive(Debug, Clone)]
3931pub struct PortControlHandle {
3932 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3933}
3934
3935impl fidl::endpoints::ControlHandle for PortControlHandle {
3936 fn shutdown(&self) {
3937 self.inner.shutdown()
3938 }
3939
3940 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3941 self.inner.shutdown_with_epitaph(status)
3942 }
3943
3944 fn is_closed(&self) -> bool {
3945 self.inner.channel().is_closed()
3946 }
3947 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3948 self.inner.channel().on_closed()
3949 }
3950
3951 #[cfg(target_os = "fuchsia")]
3952 fn signal_peer(
3953 &self,
3954 clear_mask: zx::Signals,
3955 set_mask: zx::Signals,
3956 ) -> Result<(), zx_status::Status> {
3957 use fidl::Peered;
3958 self.inner.channel().signal_peer(clear_mask, set_mask)
3959 }
3960}
3961
3962impl PortControlHandle {}
3963
3964#[must_use = "FIDL methods require a response to be sent"]
3965#[derive(Debug)]
3966pub struct PortGetInfoResponder {
3967 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
3968 tx_id: u32,
3969}
3970
3971impl std::ops::Drop for PortGetInfoResponder {
3975 fn drop(&mut self) {
3976 self.control_handle.shutdown();
3977 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3979 }
3980}
3981
3982impl fidl::endpoints::Responder for PortGetInfoResponder {
3983 type ControlHandle = PortControlHandle;
3984
3985 fn control_handle(&self) -> &PortControlHandle {
3986 &self.control_handle
3987 }
3988
3989 fn drop_without_shutdown(mut self) {
3990 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3992 std::mem::forget(self);
3994 }
3995}
3996
3997impl PortGetInfoResponder {
3998 pub fn send(self, mut info: &PortInfo) -> Result<(), fidl::Error> {
4002 let _result = self.send_raw(info);
4003 if _result.is_err() {
4004 self.control_handle.shutdown();
4005 }
4006 self.drop_without_shutdown();
4007 _result
4008 }
4009
4010 pub fn send_no_shutdown_on_err(self, mut info: &PortInfo) -> Result<(), fidl::Error> {
4012 let _result = self.send_raw(info);
4013 self.drop_without_shutdown();
4014 _result
4015 }
4016
4017 fn send_raw(&self, mut info: &PortInfo) -> Result<(), fidl::Error> {
4018 self.control_handle.inner.send::<PortGetInfoResponse>(
4019 (info,),
4020 self.tx_id,
4021 0x276cf65feb554ebd,
4022 fidl::encoding::DynamicFlags::empty(),
4023 )
4024 }
4025}
4026
4027#[must_use = "FIDL methods require a response to be sent"]
4028#[derive(Debug)]
4029pub struct PortGetStatusResponder {
4030 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
4031 tx_id: u32,
4032}
4033
4034impl std::ops::Drop for PortGetStatusResponder {
4038 fn drop(&mut self) {
4039 self.control_handle.shutdown();
4040 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4042 }
4043}
4044
4045impl fidl::endpoints::Responder for PortGetStatusResponder {
4046 type ControlHandle = PortControlHandle;
4047
4048 fn control_handle(&self) -> &PortControlHandle {
4049 &self.control_handle
4050 }
4051
4052 fn drop_without_shutdown(mut self) {
4053 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4055 std::mem::forget(self);
4057 }
4058}
4059
4060impl PortGetStatusResponder {
4061 pub fn send(self, mut status: &PortStatus) -> Result<(), fidl::Error> {
4065 let _result = self.send_raw(status);
4066 if _result.is_err() {
4067 self.control_handle.shutdown();
4068 }
4069 self.drop_without_shutdown();
4070 _result
4071 }
4072
4073 pub fn send_no_shutdown_on_err(self, mut status: &PortStatus) -> Result<(), fidl::Error> {
4075 let _result = self.send_raw(status);
4076 self.drop_without_shutdown();
4077 _result
4078 }
4079
4080 fn send_raw(&self, mut status: &PortStatus) -> Result<(), fidl::Error> {
4081 self.control_handle.inner.send::<PortGetStatusResponse>(
4082 (status,),
4083 self.tx_id,
4084 0x4235650aacca60b2,
4085 fidl::encoding::DynamicFlags::empty(),
4086 )
4087 }
4088}
4089
4090#[must_use = "FIDL methods require a response to be sent"]
4091#[derive(Debug)]
4092pub struct PortGetCountersResponder {
4093 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
4094 tx_id: u32,
4095}
4096
4097impl std::ops::Drop for PortGetCountersResponder {
4101 fn drop(&mut self) {
4102 self.control_handle.shutdown();
4103 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4105 }
4106}
4107
4108impl fidl::endpoints::Responder for PortGetCountersResponder {
4109 type ControlHandle = PortControlHandle;
4110
4111 fn control_handle(&self) -> &PortControlHandle {
4112 &self.control_handle
4113 }
4114
4115 fn drop_without_shutdown(mut self) {
4116 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4118 std::mem::forget(self);
4120 }
4121}
4122
4123impl PortGetCountersResponder {
4124 pub fn send(self, mut payload: &PortGetCountersResponse) -> Result<(), fidl::Error> {
4128 let _result = self.send_raw(payload);
4129 if _result.is_err() {
4130 self.control_handle.shutdown();
4131 }
4132 self.drop_without_shutdown();
4133 _result
4134 }
4135
4136 pub fn send_no_shutdown_on_err(
4138 self,
4139 mut payload: &PortGetCountersResponse,
4140 ) -> Result<(), fidl::Error> {
4141 let _result = self.send_raw(payload);
4142 self.drop_without_shutdown();
4143 _result
4144 }
4145
4146 fn send_raw(&self, mut payload: &PortGetCountersResponse) -> Result<(), fidl::Error> {
4147 self.control_handle.inner.send::<PortGetCountersResponse>(
4148 payload,
4149 self.tx_id,
4150 0x6a213b03c4fcbbac,
4151 fidl::encoding::DynamicFlags::empty(),
4152 )
4153 }
4154}
4155
4156#[must_use = "FIDL methods require a response to be sent"]
4157#[derive(Debug)]
4158pub struct PortGetIdentityResponder {
4159 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
4160 tx_id: u32,
4161}
4162
4163impl std::ops::Drop for PortGetIdentityResponder {
4167 fn drop(&mut self) {
4168 self.control_handle.shutdown();
4169 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4171 }
4172}
4173
4174impl fidl::endpoints::Responder for PortGetIdentityResponder {
4175 type ControlHandle = PortControlHandle;
4176
4177 fn control_handle(&self) -> &PortControlHandle {
4178 &self.control_handle
4179 }
4180
4181 fn drop_without_shutdown(mut self) {
4182 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4184 std::mem::forget(self);
4186 }
4187}
4188
4189impl PortGetIdentityResponder {
4190 pub fn send(self, mut event: fidl::Event) -> Result<(), fidl::Error> {
4194 let _result = self.send_raw(event);
4195 if _result.is_err() {
4196 self.control_handle.shutdown();
4197 }
4198 self.drop_without_shutdown();
4199 _result
4200 }
4201
4202 pub fn send_no_shutdown_on_err(self, mut event: fidl::Event) -> Result<(), fidl::Error> {
4204 let _result = self.send_raw(event);
4205 self.drop_without_shutdown();
4206 _result
4207 }
4208
4209 fn send_raw(&self, mut event: fidl::Event) -> Result<(), fidl::Error> {
4210 self.control_handle.inner.send::<PortGetIdentityResponse>(
4211 (event,),
4212 self.tx_id,
4213 0x75134ce0bc114e5a,
4214 fidl::encoding::DynamicFlags::empty(),
4215 )
4216 }
4217}
4218
4219#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4220pub struct PortWatcherMarker;
4221
4222impl fidl::endpoints::ProtocolMarker for PortWatcherMarker {
4223 type Proxy = PortWatcherProxy;
4224 type RequestStream = PortWatcherRequestStream;
4225 #[cfg(target_os = "fuchsia")]
4226 type SynchronousProxy = PortWatcherSynchronousProxy;
4227
4228 const DEBUG_NAME: &'static str = "(anonymous) PortWatcher";
4229}
4230
4231pub trait PortWatcherProxyInterface: Send + Sync {
4232 type WatchResponseFut: std::future::Future<Output = Result<DevicePortEvent, fidl::Error>> + Send;
4233 fn r#watch(&self) -> Self::WatchResponseFut;
4234}
4235#[derive(Debug)]
4236#[cfg(target_os = "fuchsia")]
4237pub struct PortWatcherSynchronousProxy {
4238 client: fidl::client::sync::Client,
4239}
4240
4241#[cfg(target_os = "fuchsia")]
4242impl fidl::endpoints::SynchronousProxy for PortWatcherSynchronousProxy {
4243 type Proxy = PortWatcherProxy;
4244 type Protocol = PortWatcherMarker;
4245
4246 fn from_channel(inner: fidl::Channel) -> Self {
4247 Self::new(inner)
4248 }
4249
4250 fn into_channel(self) -> fidl::Channel {
4251 self.client.into_channel()
4252 }
4253
4254 fn as_channel(&self) -> &fidl::Channel {
4255 self.client.as_channel()
4256 }
4257}
4258
4259#[cfg(target_os = "fuchsia")]
4260impl PortWatcherSynchronousProxy {
4261 pub fn new(channel: fidl::Channel) -> Self {
4262 Self { client: fidl::client::sync::Client::new(channel) }
4263 }
4264
4265 pub fn into_channel(self) -> fidl::Channel {
4266 self.client.into_channel()
4267 }
4268
4269 pub fn wait_for_event(
4272 &self,
4273 deadline: zx::MonotonicInstant,
4274 ) -> Result<PortWatcherEvent, fidl::Error> {
4275 PortWatcherEvent::decode(self.client.wait_for_event::<PortWatcherMarker>(deadline)?)
4276 }
4277
4278 pub fn r#watch(
4293 &self,
4294 ___deadline: zx::MonotonicInstant,
4295 ) -> Result<DevicePortEvent, fidl::Error> {
4296 let _response = self.client.send_query::<
4297 fidl::encoding::EmptyPayload,
4298 PortWatcherWatchResponse,
4299 PortWatcherMarker,
4300 >(
4301 (),
4302 0x3e87244b74fff55e,
4303 fidl::encoding::DynamicFlags::empty(),
4304 ___deadline,
4305 )?;
4306 Ok(_response.event)
4307 }
4308}
4309
4310#[cfg(target_os = "fuchsia")]
4311impl From<PortWatcherSynchronousProxy> for zx::NullableHandle {
4312 fn from(value: PortWatcherSynchronousProxy) -> Self {
4313 value.into_channel().into()
4314 }
4315}
4316
4317#[cfg(target_os = "fuchsia")]
4318impl From<fidl::Channel> for PortWatcherSynchronousProxy {
4319 fn from(value: fidl::Channel) -> Self {
4320 Self::new(value)
4321 }
4322}
4323
4324#[cfg(target_os = "fuchsia")]
4325impl fidl::endpoints::FromClient for PortWatcherSynchronousProxy {
4326 type Protocol = PortWatcherMarker;
4327
4328 fn from_client(value: fidl::endpoints::ClientEnd<PortWatcherMarker>) -> Self {
4329 Self::new(value.into_channel())
4330 }
4331}
4332
4333#[derive(Debug, Clone)]
4334pub struct PortWatcherProxy {
4335 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4336}
4337
4338impl fidl::endpoints::Proxy for PortWatcherProxy {
4339 type Protocol = PortWatcherMarker;
4340
4341 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4342 Self::new(inner)
4343 }
4344
4345 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4346 self.client.into_channel().map_err(|client| Self { client })
4347 }
4348
4349 fn as_channel(&self) -> &::fidl::AsyncChannel {
4350 self.client.as_channel()
4351 }
4352}
4353
4354impl PortWatcherProxy {
4355 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4357 let protocol_name = <PortWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4358 Self { client: fidl::client::Client::new(channel, protocol_name) }
4359 }
4360
4361 pub fn take_event_stream(&self) -> PortWatcherEventStream {
4367 PortWatcherEventStream { event_receiver: self.client.take_event_receiver() }
4368 }
4369
4370 pub fn r#watch(
4385 &self,
4386 ) -> fidl::client::QueryResponseFut<
4387 DevicePortEvent,
4388 fidl::encoding::DefaultFuchsiaResourceDialect,
4389 > {
4390 PortWatcherProxyInterface::r#watch(self)
4391 }
4392}
4393
4394impl PortWatcherProxyInterface for PortWatcherProxy {
4395 type WatchResponseFut = fidl::client::QueryResponseFut<
4396 DevicePortEvent,
4397 fidl::encoding::DefaultFuchsiaResourceDialect,
4398 >;
4399 fn r#watch(&self) -> Self::WatchResponseFut {
4400 fn _decode(
4401 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4402 ) -> Result<DevicePortEvent, fidl::Error> {
4403 let _response = fidl::client::decode_transaction_body::<
4404 PortWatcherWatchResponse,
4405 fidl::encoding::DefaultFuchsiaResourceDialect,
4406 0x3e87244b74fff55e,
4407 >(_buf?)?;
4408 Ok(_response.event)
4409 }
4410 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DevicePortEvent>(
4411 (),
4412 0x3e87244b74fff55e,
4413 fidl::encoding::DynamicFlags::empty(),
4414 _decode,
4415 )
4416 }
4417}
4418
4419pub struct PortWatcherEventStream {
4420 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4421}
4422
4423impl std::marker::Unpin for PortWatcherEventStream {}
4424
4425impl futures::stream::FusedStream for PortWatcherEventStream {
4426 fn is_terminated(&self) -> bool {
4427 self.event_receiver.is_terminated()
4428 }
4429}
4430
4431impl futures::Stream for PortWatcherEventStream {
4432 type Item = Result<PortWatcherEvent, fidl::Error>;
4433
4434 fn poll_next(
4435 mut self: std::pin::Pin<&mut Self>,
4436 cx: &mut std::task::Context<'_>,
4437 ) -> std::task::Poll<Option<Self::Item>> {
4438 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4439 &mut self.event_receiver,
4440 cx
4441 )?) {
4442 Some(buf) => std::task::Poll::Ready(Some(PortWatcherEvent::decode(buf))),
4443 None => std::task::Poll::Ready(None),
4444 }
4445 }
4446}
4447
4448#[derive(Debug)]
4449pub enum PortWatcherEvent {}
4450
4451impl PortWatcherEvent {
4452 fn decode(
4454 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4455 ) -> Result<PortWatcherEvent, fidl::Error> {
4456 let (bytes, _handles) = buf.split_mut();
4457 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4458 debug_assert_eq!(tx_header.tx_id, 0);
4459 match tx_header.ordinal {
4460 _ => Err(fidl::Error::UnknownOrdinal {
4461 ordinal: tx_header.ordinal,
4462 protocol_name: <PortWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4463 }),
4464 }
4465 }
4466}
4467
4468pub struct PortWatcherRequestStream {
4470 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4471 is_terminated: bool,
4472}
4473
4474impl std::marker::Unpin for PortWatcherRequestStream {}
4475
4476impl futures::stream::FusedStream for PortWatcherRequestStream {
4477 fn is_terminated(&self) -> bool {
4478 self.is_terminated
4479 }
4480}
4481
4482impl fidl::endpoints::RequestStream for PortWatcherRequestStream {
4483 type Protocol = PortWatcherMarker;
4484 type ControlHandle = PortWatcherControlHandle;
4485
4486 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4487 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4488 }
4489
4490 fn control_handle(&self) -> Self::ControlHandle {
4491 PortWatcherControlHandle { inner: self.inner.clone() }
4492 }
4493
4494 fn into_inner(
4495 self,
4496 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4497 {
4498 (self.inner, self.is_terminated)
4499 }
4500
4501 fn from_inner(
4502 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4503 is_terminated: bool,
4504 ) -> Self {
4505 Self { inner, is_terminated }
4506 }
4507}
4508
4509impl futures::Stream for PortWatcherRequestStream {
4510 type Item = Result<PortWatcherRequest, fidl::Error>;
4511
4512 fn poll_next(
4513 mut self: std::pin::Pin<&mut Self>,
4514 cx: &mut std::task::Context<'_>,
4515 ) -> std::task::Poll<Option<Self::Item>> {
4516 let this = &mut *self;
4517 if this.inner.check_shutdown(cx) {
4518 this.is_terminated = true;
4519 return std::task::Poll::Ready(None);
4520 }
4521 if this.is_terminated {
4522 panic!("polled PortWatcherRequestStream after completion");
4523 }
4524 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4525 |bytes, handles| {
4526 match this.inner.channel().read_etc(cx, bytes, handles) {
4527 std::task::Poll::Ready(Ok(())) => {}
4528 std::task::Poll::Pending => return std::task::Poll::Pending,
4529 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4530 this.is_terminated = true;
4531 return std::task::Poll::Ready(None);
4532 }
4533 std::task::Poll::Ready(Err(e)) => {
4534 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4535 e.into(),
4536 ))));
4537 }
4538 }
4539
4540 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4542
4543 std::task::Poll::Ready(Some(match header.ordinal {
4544 0x3e87244b74fff55e => {
4545 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4546 let mut req = fidl::new_empty!(
4547 fidl::encoding::EmptyPayload,
4548 fidl::encoding::DefaultFuchsiaResourceDialect
4549 );
4550 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4551 let control_handle = PortWatcherControlHandle { inner: this.inner.clone() };
4552 Ok(PortWatcherRequest::Watch {
4553 responder: PortWatcherWatchResponder {
4554 control_handle: std::mem::ManuallyDrop::new(control_handle),
4555 tx_id: header.tx_id,
4556 },
4557 })
4558 }
4559 _ => Err(fidl::Error::UnknownOrdinal {
4560 ordinal: header.ordinal,
4561 protocol_name:
4562 <PortWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4563 }),
4564 }))
4565 },
4566 )
4567 }
4568}
4569
4570#[derive(Debug)]
4572pub enum PortWatcherRequest {
4573 Watch { responder: PortWatcherWatchResponder },
4588}
4589
4590impl PortWatcherRequest {
4591 #[allow(irrefutable_let_patterns)]
4592 pub fn into_watch(self) -> Option<(PortWatcherWatchResponder)> {
4593 if let PortWatcherRequest::Watch { responder } = self { Some((responder)) } else { None }
4594 }
4595
4596 pub fn method_name(&self) -> &'static str {
4598 match *self {
4599 PortWatcherRequest::Watch { .. } => "watch",
4600 }
4601 }
4602}
4603
4604#[derive(Debug, Clone)]
4605pub struct PortWatcherControlHandle {
4606 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4607}
4608
4609impl fidl::endpoints::ControlHandle for PortWatcherControlHandle {
4610 fn shutdown(&self) {
4611 self.inner.shutdown()
4612 }
4613
4614 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4615 self.inner.shutdown_with_epitaph(status)
4616 }
4617
4618 fn is_closed(&self) -> bool {
4619 self.inner.channel().is_closed()
4620 }
4621 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4622 self.inner.channel().on_closed()
4623 }
4624
4625 #[cfg(target_os = "fuchsia")]
4626 fn signal_peer(
4627 &self,
4628 clear_mask: zx::Signals,
4629 set_mask: zx::Signals,
4630 ) -> Result<(), zx_status::Status> {
4631 use fidl::Peered;
4632 self.inner.channel().signal_peer(clear_mask, set_mask)
4633 }
4634}
4635
4636impl PortWatcherControlHandle {}
4637
4638#[must_use = "FIDL methods require a response to be sent"]
4639#[derive(Debug)]
4640pub struct PortWatcherWatchResponder {
4641 control_handle: std::mem::ManuallyDrop<PortWatcherControlHandle>,
4642 tx_id: u32,
4643}
4644
4645impl std::ops::Drop for PortWatcherWatchResponder {
4649 fn drop(&mut self) {
4650 self.control_handle.shutdown();
4651 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4653 }
4654}
4655
4656impl fidl::endpoints::Responder for PortWatcherWatchResponder {
4657 type ControlHandle = PortWatcherControlHandle;
4658
4659 fn control_handle(&self) -> &PortWatcherControlHandle {
4660 &self.control_handle
4661 }
4662
4663 fn drop_without_shutdown(mut self) {
4664 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4666 std::mem::forget(self);
4668 }
4669}
4670
4671impl PortWatcherWatchResponder {
4672 pub fn send(self, mut event: &DevicePortEvent) -> Result<(), fidl::Error> {
4676 let _result = self.send_raw(event);
4677 if _result.is_err() {
4678 self.control_handle.shutdown();
4679 }
4680 self.drop_without_shutdown();
4681 _result
4682 }
4683
4684 pub fn send_no_shutdown_on_err(self, mut event: &DevicePortEvent) -> Result<(), fidl::Error> {
4686 let _result = self.send_raw(event);
4687 self.drop_without_shutdown();
4688 _result
4689 }
4690
4691 fn send_raw(&self, mut event: &DevicePortEvent) -> Result<(), fidl::Error> {
4692 self.control_handle.inner.send::<PortWatcherWatchResponse>(
4693 (event,),
4694 self.tx_id,
4695 0x3e87244b74fff55e,
4696 fidl::encoding::DynamicFlags::empty(),
4697 )
4698 }
4699}
4700
4701#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4702pub struct SessionMarker;
4703
4704impl fidl::endpoints::ProtocolMarker for SessionMarker {
4705 type Proxy = SessionProxy;
4706 type RequestStream = SessionRequestStream;
4707 #[cfg(target_os = "fuchsia")]
4708 type SynchronousProxy = SessionSynchronousProxy;
4709
4710 const DEBUG_NAME: &'static str = "(anonymous) Session";
4711}
4712pub type SessionAttachResult = Result<(), i32>;
4713pub type SessionDetachResult = Result<(), i32>;
4714
4715pub trait SessionProxyInterface: Send + Sync {
4716 type AttachResponseFut: std::future::Future<Output = Result<SessionAttachResult, fidl::Error>>
4717 + Send;
4718 fn r#attach(&self, port: &PortId, rx_frames: &[FrameType]) -> Self::AttachResponseFut;
4719 type DetachResponseFut: std::future::Future<Output = Result<SessionDetachResult, fidl::Error>>
4720 + Send;
4721 fn r#detach(&self, port: &PortId) -> Self::DetachResponseFut;
4722 fn r#close(&self) -> Result<(), fidl::Error>;
4723 type WatchDelegatedRxLeaseResponseFut: std::future::Future<Output = Result<DelegatedRxLease, fidl::Error>>
4724 + Send;
4725 fn r#watch_delegated_rx_lease(&self) -> Self::WatchDelegatedRxLeaseResponseFut;
4726}
4727#[derive(Debug)]
4728#[cfg(target_os = "fuchsia")]
4729pub struct SessionSynchronousProxy {
4730 client: fidl::client::sync::Client,
4731}
4732
4733#[cfg(target_os = "fuchsia")]
4734impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
4735 type Proxy = SessionProxy;
4736 type Protocol = SessionMarker;
4737
4738 fn from_channel(inner: fidl::Channel) -> Self {
4739 Self::new(inner)
4740 }
4741
4742 fn into_channel(self) -> fidl::Channel {
4743 self.client.into_channel()
4744 }
4745
4746 fn as_channel(&self) -> &fidl::Channel {
4747 self.client.as_channel()
4748 }
4749}
4750
4751#[cfg(target_os = "fuchsia")]
4752impl SessionSynchronousProxy {
4753 pub fn new(channel: fidl::Channel) -> Self {
4754 Self { client: fidl::client::sync::Client::new(channel) }
4755 }
4756
4757 pub fn into_channel(self) -> fidl::Channel {
4758 self.client.into_channel()
4759 }
4760
4761 pub fn wait_for_event(
4764 &self,
4765 deadline: zx::MonotonicInstant,
4766 ) -> Result<SessionEvent, fidl::Error> {
4767 SessionEvent::decode(self.client.wait_for_event::<SessionMarker>(deadline)?)
4768 }
4769
4770 pub fn r#attach(
4782 &self,
4783 mut port: &PortId,
4784 mut rx_frames: &[FrameType],
4785 ___deadline: zx::MonotonicInstant,
4786 ) -> Result<SessionAttachResult, fidl::Error> {
4787 let _response = self.client.send_query::<
4788 SessionAttachRequest,
4789 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4790 SessionMarker,
4791 >(
4792 (port, rx_frames,),
4793 0x1e89c9013e201379,
4794 fidl::encoding::DynamicFlags::empty(),
4795 ___deadline,
4796 )?;
4797 Ok(_response.map(|x| x))
4798 }
4799
4800 pub fn r#detach(
4811 &self,
4812 mut port: &PortId,
4813 ___deadline: zx::MonotonicInstant,
4814 ) -> Result<SessionDetachResult, fidl::Error> {
4815 let _response = self.client.send_query::<
4816 SessionDetachRequest,
4817 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4818 SessionMarker,
4819 >(
4820 (port,),
4821 0x68c40cf8fb549867,
4822 fidl::encoding::DynamicFlags::empty(),
4823 ___deadline,
4824 )?;
4825 Ok(_response.map(|x| x))
4826 }
4827
4828 pub fn r#close(&self) -> Result<(), fidl::Error> {
4836 self.client.send::<fidl::encoding::EmptyPayload>(
4837 (),
4838 0x393d5070394a92f6,
4839 fidl::encoding::DynamicFlags::empty(),
4840 )
4841 }
4842
4843 pub fn r#watch_delegated_rx_lease(
4858 &self,
4859 ___deadline: zx::MonotonicInstant,
4860 ) -> Result<DelegatedRxLease, fidl::Error> {
4861 let _response = self.client.send_query::<
4862 fidl::encoding::EmptyPayload,
4863 SessionWatchDelegatedRxLeaseResponse,
4864 SessionMarker,
4865 >(
4866 (),
4867 0x764d823ee64803b5,
4868 fidl::encoding::DynamicFlags::empty(),
4869 ___deadline,
4870 )?;
4871 Ok(_response.lease)
4872 }
4873}
4874
4875#[cfg(target_os = "fuchsia")]
4876impl From<SessionSynchronousProxy> for zx::NullableHandle {
4877 fn from(value: SessionSynchronousProxy) -> Self {
4878 value.into_channel().into()
4879 }
4880}
4881
4882#[cfg(target_os = "fuchsia")]
4883impl From<fidl::Channel> for SessionSynchronousProxy {
4884 fn from(value: fidl::Channel) -> Self {
4885 Self::new(value)
4886 }
4887}
4888
4889#[cfg(target_os = "fuchsia")]
4890impl fidl::endpoints::FromClient for SessionSynchronousProxy {
4891 type Protocol = SessionMarker;
4892
4893 fn from_client(value: fidl::endpoints::ClientEnd<SessionMarker>) -> Self {
4894 Self::new(value.into_channel())
4895 }
4896}
4897
4898#[derive(Debug, Clone)]
4899pub struct SessionProxy {
4900 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4901}
4902
4903impl fidl::endpoints::Proxy for SessionProxy {
4904 type Protocol = SessionMarker;
4905
4906 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4907 Self::new(inner)
4908 }
4909
4910 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4911 self.client.into_channel().map_err(|client| Self { client })
4912 }
4913
4914 fn as_channel(&self) -> &::fidl::AsyncChannel {
4915 self.client.as_channel()
4916 }
4917}
4918
4919impl SessionProxy {
4920 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4922 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4923 Self { client: fidl::client::Client::new(channel, protocol_name) }
4924 }
4925
4926 pub fn take_event_stream(&self) -> SessionEventStream {
4932 SessionEventStream { event_receiver: self.client.take_event_receiver() }
4933 }
4934
4935 pub fn r#attach(
4947 &self,
4948 mut port: &PortId,
4949 mut rx_frames: &[FrameType],
4950 ) -> fidl::client::QueryResponseFut<
4951 SessionAttachResult,
4952 fidl::encoding::DefaultFuchsiaResourceDialect,
4953 > {
4954 SessionProxyInterface::r#attach(self, port, rx_frames)
4955 }
4956
4957 pub fn r#detach(
4968 &self,
4969 mut port: &PortId,
4970 ) -> fidl::client::QueryResponseFut<
4971 SessionDetachResult,
4972 fidl::encoding::DefaultFuchsiaResourceDialect,
4973 > {
4974 SessionProxyInterface::r#detach(self, port)
4975 }
4976
4977 pub fn r#close(&self) -> Result<(), fidl::Error> {
4985 SessionProxyInterface::r#close(self)
4986 }
4987
4988 pub fn r#watch_delegated_rx_lease(
5003 &self,
5004 ) -> fidl::client::QueryResponseFut<
5005 DelegatedRxLease,
5006 fidl::encoding::DefaultFuchsiaResourceDialect,
5007 > {
5008 SessionProxyInterface::r#watch_delegated_rx_lease(self)
5009 }
5010}
5011
5012impl SessionProxyInterface for SessionProxy {
5013 type AttachResponseFut = fidl::client::QueryResponseFut<
5014 SessionAttachResult,
5015 fidl::encoding::DefaultFuchsiaResourceDialect,
5016 >;
5017 fn r#attach(&self, mut port: &PortId, mut rx_frames: &[FrameType]) -> Self::AttachResponseFut {
5018 fn _decode(
5019 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5020 ) -> Result<SessionAttachResult, fidl::Error> {
5021 let _response = fidl::client::decode_transaction_body::<
5022 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5023 fidl::encoding::DefaultFuchsiaResourceDialect,
5024 0x1e89c9013e201379,
5025 >(_buf?)?;
5026 Ok(_response.map(|x| x))
5027 }
5028 self.client.send_query_and_decode::<SessionAttachRequest, SessionAttachResult>(
5029 (port, rx_frames),
5030 0x1e89c9013e201379,
5031 fidl::encoding::DynamicFlags::empty(),
5032 _decode,
5033 )
5034 }
5035
5036 type DetachResponseFut = fidl::client::QueryResponseFut<
5037 SessionDetachResult,
5038 fidl::encoding::DefaultFuchsiaResourceDialect,
5039 >;
5040 fn r#detach(&self, mut port: &PortId) -> Self::DetachResponseFut {
5041 fn _decode(
5042 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5043 ) -> Result<SessionDetachResult, fidl::Error> {
5044 let _response = fidl::client::decode_transaction_body::<
5045 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5046 fidl::encoding::DefaultFuchsiaResourceDialect,
5047 0x68c40cf8fb549867,
5048 >(_buf?)?;
5049 Ok(_response.map(|x| x))
5050 }
5051 self.client.send_query_and_decode::<SessionDetachRequest, SessionDetachResult>(
5052 (port,),
5053 0x68c40cf8fb549867,
5054 fidl::encoding::DynamicFlags::empty(),
5055 _decode,
5056 )
5057 }
5058
5059 fn r#close(&self) -> Result<(), fidl::Error> {
5060 self.client.send::<fidl::encoding::EmptyPayload>(
5061 (),
5062 0x393d5070394a92f6,
5063 fidl::encoding::DynamicFlags::empty(),
5064 )
5065 }
5066
5067 type WatchDelegatedRxLeaseResponseFut = fidl::client::QueryResponseFut<
5068 DelegatedRxLease,
5069 fidl::encoding::DefaultFuchsiaResourceDialect,
5070 >;
5071 fn r#watch_delegated_rx_lease(&self) -> Self::WatchDelegatedRxLeaseResponseFut {
5072 fn _decode(
5073 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5074 ) -> Result<DelegatedRxLease, fidl::Error> {
5075 let _response = fidl::client::decode_transaction_body::<
5076 SessionWatchDelegatedRxLeaseResponse,
5077 fidl::encoding::DefaultFuchsiaResourceDialect,
5078 0x764d823ee64803b5,
5079 >(_buf?)?;
5080 Ok(_response.lease)
5081 }
5082 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelegatedRxLease>(
5083 (),
5084 0x764d823ee64803b5,
5085 fidl::encoding::DynamicFlags::empty(),
5086 _decode,
5087 )
5088 }
5089}
5090
5091pub struct SessionEventStream {
5092 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5093}
5094
5095impl std::marker::Unpin for SessionEventStream {}
5096
5097impl futures::stream::FusedStream for SessionEventStream {
5098 fn is_terminated(&self) -> bool {
5099 self.event_receiver.is_terminated()
5100 }
5101}
5102
5103impl futures::Stream for SessionEventStream {
5104 type Item = Result<SessionEvent, fidl::Error>;
5105
5106 fn poll_next(
5107 mut self: std::pin::Pin<&mut Self>,
5108 cx: &mut std::task::Context<'_>,
5109 ) -> std::task::Poll<Option<Self::Item>> {
5110 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5111 &mut self.event_receiver,
5112 cx
5113 )?) {
5114 Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
5115 None => std::task::Poll::Ready(None),
5116 }
5117 }
5118}
5119
5120#[derive(Debug)]
5121pub enum SessionEvent {}
5122
5123impl SessionEvent {
5124 fn decode(
5126 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5127 ) -> Result<SessionEvent, fidl::Error> {
5128 let (bytes, _handles) = buf.split_mut();
5129 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5130 debug_assert_eq!(tx_header.tx_id, 0);
5131 match tx_header.ordinal {
5132 _ => Err(fidl::Error::UnknownOrdinal {
5133 ordinal: tx_header.ordinal,
5134 protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5135 }),
5136 }
5137 }
5138}
5139
5140pub struct SessionRequestStream {
5142 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5143 is_terminated: bool,
5144}
5145
5146impl std::marker::Unpin for SessionRequestStream {}
5147
5148impl futures::stream::FusedStream for SessionRequestStream {
5149 fn is_terminated(&self) -> bool {
5150 self.is_terminated
5151 }
5152}
5153
5154impl fidl::endpoints::RequestStream for SessionRequestStream {
5155 type Protocol = SessionMarker;
5156 type ControlHandle = SessionControlHandle;
5157
5158 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5159 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5160 }
5161
5162 fn control_handle(&self) -> Self::ControlHandle {
5163 SessionControlHandle { inner: self.inner.clone() }
5164 }
5165
5166 fn into_inner(
5167 self,
5168 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5169 {
5170 (self.inner, self.is_terminated)
5171 }
5172
5173 fn from_inner(
5174 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5175 is_terminated: bool,
5176 ) -> Self {
5177 Self { inner, is_terminated }
5178 }
5179}
5180
5181impl futures::Stream for SessionRequestStream {
5182 type Item = Result<SessionRequest, fidl::Error>;
5183
5184 fn poll_next(
5185 mut self: std::pin::Pin<&mut Self>,
5186 cx: &mut std::task::Context<'_>,
5187 ) -> std::task::Poll<Option<Self::Item>> {
5188 let this = &mut *self;
5189 if this.inner.check_shutdown(cx) {
5190 this.is_terminated = true;
5191 return std::task::Poll::Ready(None);
5192 }
5193 if this.is_terminated {
5194 panic!("polled SessionRequestStream after completion");
5195 }
5196 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5197 |bytes, handles| {
5198 match this.inner.channel().read_etc(cx, bytes, handles) {
5199 std::task::Poll::Ready(Ok(())) => {}
5200 std::task::Poll::Pending => return std::task::Poll::Pending,
5201 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5202 this.is_terminated = true;
5203 return std::task::Poll::Ready(None);
5204 }
5205 std::task::Poll::Ready(Err(e)) => {
5206 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5207 e.into(),
5208 ))));
5209 }
5210 }
5211
5212 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5214
5215 std::task::Poll::Ready(Some(match header.ordinal {
5216 0x1e89c9013e201379 => {
5217 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5218 let mut req = fidl::new_empty!(
5219 SessionAttachRequest,
5220 fidl::encoding::DefaultFuchsiaResourceDialect
5221 );
5222 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionAttachRequest>(&header, _body_bytes, handles, &mut req)?;
5223 let control_handle = SessionControlHandle { inner: this.inner.clone() };
5224 Ok(SessionRequest::Attach {
5225 port: req.port,
5226 rx_frames: req.rx_frames,
5227
5228 responder: SessionAttachResponder {
5229 control_handle: std::mem::ManuallyDrop::new(control_handle),
5230 tx_id: header.tx_id,
5231 },
5232 })
5233 }
5234 0x68c40cf8fb549867 => {
5235 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5236 let mut req = fidl::new_empty!(
5237 SessionDetachRequest,
5238 fidl::encoding::DefaultFuchsiaResourceDialect
5239 );
5240 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionDetachRequest>(&header, _body_bytes, handles, &mut req)?;
5241 let control_handle = SessionControlHandle { inner: this.inner.clone() };
5242 Ok(SessionRequest::Detach {
5243 port: req.port,
5244
5245 responder: SessionDetachResponder {
5246 control_handle: std::mem::ManuallyDrop::new(control_handle),
5247 tx_id: header.tx_id,
5248 },
5249 })
5250 }
5251 0x393d5070394a92f6 => {
5252 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5253 let mut req = fidl::new_empty!(
5254 fidl::encoding::EmptyPayload,
5255 fidl::encoding::DefaultFuchsiaResourceDialect
5256 );
5257 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5258 let control_handle = SessionControlHandle { inner: this.inner.clone() };
5259 Ok(SessionRequest::Close { control_handle })
5260 }
5261 0x764d823ee64803b5 => {
5262 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5263 let mut req = fidl::new_empty!(
5264 fidl::encoding::EmptyPayload,
5265 fidl::encoding::DefaultFuchsiaResourceDialect
5266 );
5267 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5268 let control_handle = SessionControlHandle { inner: this.inner.clone() };
5269 Ok(SessionRequest::WatchDelegatedRxLease {
5270 responder: SessionWatchDelegatedRxLeaseResponder {
5271 control_handle: std::mem::ManuallyDrop::new(control_handle),
5272 tx_id: header.tx_id,
5273 },
5274 })
5275 }
5276 _ => Err(fidl::Error::UnknownOrdinal {
5277 ordinal: header.ordinal,
5278 protocol_name:
5279 <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5280 }),
5281 }))
5282 },
5283 )
5284 }
5285}
5286
5287#[derive(Debug)]
5314pub enum SessionRequest {
5315 Attach { port: PortId, rx_frames: Vec<FrameType>, responder: SessionAttachResponder },
5327 Detach { port: PortId, responder: SessionDetachResponder },
5338 Close { control_handle: SessionControlHandle },
5346 WatchDelegatedRxLease { responder: SessionWatchDelegatedRxLeaseResponder },
5361}
5362
5363impl SessionRequest {
5364 #[allow(irrefutable_let_patterns)]
5365 pub fn into_attach(self) -> Option<(PortId, Vec<FrameType>, SessionAttachResponder)> {
5366 if let SessionRequest::Attach { port, rx_frames, responder } = self {
5367 Some((port, rx_frames, responder))
5368 } else {
5369 None
5370 }
5371 }
5372
5373 #[allow(irrefutable_let_patterns)]
5374 pub fn into_detach(self) -> Option<(PortId, SessionDetachResponder)> {
5375 if let SessionRequest::Detach { port, responder } = self {
5376 Some((port, responder))
5377 } else {
5378 None
5379 }
5380 }
5381
5382 #[allow(irrefutable_let_patterns)]
5383 pub fn into_close(self) -> Option<(SessionControlHandle)> {
5384 if let SessionRequest::Close { control_handle } = self {
5385 Some((control_handle))
5386 } else {
5387 None
5388 }
5389 }
5390
5391 #[allow(irrefutable_let_patterns)]
5392 pub fn into_watch_delegated_rx_lease(self) -> Option<(SessionWatchDelegatedRxLeaseResponder)> {
5393 if let SessionRequest::WatchDelegatedRxLease { responder } = self {
5394 Some((responder))
5395 } else {
5396 None
5397 }
5398 }
5399
5400 pub fn method_name(&self) -> &'static str {
5402 match *self {
5403 SessionRequest::Attach { .. } => "attach",
5404 SessionRequest::Detach { .. } => "detach",
5405 SessionRequest::Close { .. } => "close",
5406 SessionRequest::WatchDelegatedRxLease { .. } => "watch_delegated_rx_lease",
5407 }
5408 }
5409}
5410
5411#[derive(Debug, Clone)]
5412pub struct SessionControlHandle {
5413 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5414}
5415
5416impl fidl::endpoints::ControlHandle for SessionControlHandle {
5417 fn shutdown(&self) {
5418 self.inner.shutdown()
5419 }
5420
5421 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5422 self.inner.shutdown_with_epitaph(status)
5423 }
5424
5425 fn is_closed(&self) -> bool {
5426 self.inner.channel().is_closed()
5427 }
5428 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5429 self.inner.channel().on_closed()
5430 }
5431
5432 #[cfg(target_os = "fuchsia")]
5433 fn signal_peer(
5434 &self,
5435 clear_mask: zx::Signals,
5436 set_mask: zx::Signals,
5437 ) -> Result<(), zx_status::Status> {
5438 use fidl::Peered;
5439 self.inner.channel().signal_peer(clear_mask, set_mask)
5440 }
5441}
5442
5443impl SessionControlHandle {}
5444
5445#[must_use = "FIDL methods require a response to be sent"]
5446#[derive(Debug)]
5447pub struct SessionAttachResponder {
5448 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5449 tx_id: u32,
5450}
5451
5452impl std::ops::Drop for SessionAttachResponder {
5456 fn drop(&mut self) {
5457 self.control_handle.shutdown();
5458 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5460 }
5461}
5462
5463impl fidl::endpoints::Responder for SessionAttachResponder {
5464 type ControlHandle = SessionControlHandle;
5465
5466 fn control_handle(&self) -> &SessionControlHandle {
5467 &self.control_handle
5468 }
5469
5470 fn drop_without_shutdown(mut self) {
5471 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5473 std::mem::forget(self);
5475 }
5476}
5477
5478impl SessionAttachResponder {
5479 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5483 let _result = self.send_raw(result);
5484 if _result.is_err() {
5485 self.control_handle.shutdown();
5486 }
5487 self.drop_without_shutdown();
5488 _result
5489 }
5490
5491 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5493 let _result = self.send_raw(result);
5494 self.drop_without_shutdown();
5495 _result
5496 }
5497
5498 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5499 self.control_handle
5500 .inner
5501 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5502 result,
5503 self.tx_id,
5504 0x1e89c9013e201379,
5505 fidl::encoding::DynamicFlags::empty(),
5506 )
5507 }
5508}
5509
5510#[must_use = "FIDL methods require a response to be sent"]
5511#[derive(Debug)]
5512pub struct SessionDetachResponder {
5513 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5514 tx_id: u32,
5515}
5516
5517impl std::ops::Drop for SessionDetachResponder {
5521 fn drop(&mut self) {
5522 self.control_handle.shutdown();
5523 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5525 }
5526}
5527
5528impl fidl::endpoints::Responder for SessionDetachResponder {
5529 type ControlHandle = SessionControlHandle;
5530
5531 fn control_handle(&self) -> &SessionControlHandle {
5532 &self.control_handle
5533 }
5534
5535 fn drop_without_shutdown(mut self) {
5536 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5538 std::mem::forget(self);
5540 }
5541}
5542
5543impl SessionDetachResponder {
5544 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5548 let _result = self.send_raw(result);
5549 if _result.is_err() {
5550 self.control_handle.shutdown();
5551 }
5552 self.drop_without_shutdown();
5553 _result
5554 }
5555
5556 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5558 let _result = self.send_raw(result);
5559 self.drop_without_shutdown();
5560 _result
5561 }
5562
5563 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5564 self.control_handle
5565 .inner
5566 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5567 result,
5568 self.tx_id,
5569 0x68c40cf8fb549867,
5570 fidl::encoding::DynamicFlags::empty(),
5571 )
5572 }
5573}
5574
5575#[must_use = "FIDL methods require a response to be sent"]
5576#[derive(Debug)]
5577pub struct SessionWatchDelegatedRxLeaseResponder {
5578 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5579 tx_id: u32,
5580}
5581
5582impl std::ops::Drop for SessionWatchDelegatedRxLeaseResponder {
5586 fn drop(&mut self) {
5587 self.control_handle.shutdown();
5588 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5590 }
5591}
5592
5593impl fidl::endpoints::Responder for SessionWatchDelegatedRxLeaseResponder {
5594 type ControlHandle = SessionControlHandle;
5595
5596 fn control_handle(&self) -> &SessionControlHandle {
5597 &self.control_handle
5598 }
5599
5600 fn drop_without_shutdown(mut self) {
5601 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5603 std::mem::forget(self);
5605 }
5606}
5607
5608impl SessionWatchDelegatedRxLeaseResponder {
5609 pub fn send(self, mut lease: DelegatedRxLease) -> Result<(), fidl::Error> {
5613 let _result = self.send_raw(lease);
5614 if _result.is_err() {
5615 self.control_handle.shutdown();
5616 }
5617 self.drop_without_shutdown();
5618 _result
5619 }
5620
5621 pub fn send_no_shutdown_on_err(self, mut lease: DelegatedRxLease) -> Result<(), fidl::Error> {
5623 let _result = self.send_raw(lease);
5624 self.drop_without_shutdown();
5625 _result
5626 }
5627
5628 fn send_raw(&self, mut lease: DelegatedRxLease) -> Result<(), fidl::Error> {
5629 self.control_handle.inner.send::<SessionWatchDelegatedRxLeaseResponse>(
5630 (&mut lease,),
5631 self.tx_id,
5632 0x764d823ee64803b5,
5633 fidl::encoding::DynamicFlags::empty(),
5634 )
5635 }
5636}
5637
5638#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5639pub struct StatusWatcherMarker;
5640
5641impl fidl::endpoints::ProtocolMarker for StatusWatcherMarker {
5642 type Proxy = StatusWatcherProxy;
5643 type RequestStream = StatusWatcherRequestStream;
5644 #[cfg(target_os = "fuchsia")]
5645 type SynchronousProxy = StatusWatcherSynchronousProxy;
5646
5647 const DEBUG_NAME: &'static str = "(anonymous) StatusWatcher";
5648}
5649
5650pub trait StatusWatcherProxyInterface: Send + Sync {
5651 type WatchStatusResponseFut: std::future::Future<Output = Result<PortStatus, fidl::Error>>
5652 + Send;
5653 fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
5654}
5655#[derive(Debug)]
5656#[cfg(target_os = "fuchsia")]
5657pub struct StatusWatcherSynchronousProxy {
5658 client: fidl::client::sync::Client,
5659}
5660
5661#[cfg(target_os = "fuchsia")]
5662impl fidl::endpoints::SynchronousProxy for StatusWatcherSynchronousProxy {
5663 type Proxy = StatusWatcherProxy;
5664 type Protocol = StatusWatcherMarker;
5665
5666 fn from_channel(inner: fidl::Channel) -> Self {
5667 Self::new(inner)
5668 }
5669
5670 fn into_channel(self) -> fidl::Channel {
5671 self.client.into_channel()
5672 }
5673
5674 fn as_channel(&self) -> &fidl::Channel {
5675 self.client.as_channel()
5676 }
5677}
5678
5679#[cfg(target_os = "fuchsia")]
5680impl StatusWatcherSynchronousProxy {
5681 pub fn new(channel: fidl::Channel) -> Self {
5682 Self { client: fidl::client::sync::Client::new(channel) }
5683 }
5684
5685 pub fn into_channel(self) -> fidl::Channel {
5686 self.client.into_channel()
5687 }
5688
5689 pub fn wait_for_event(
5692 &self,
5693 deadline: zx::MonotonicInstant,
5694 ) -> Result<StatusWatcherEvent, fidl::Error> {
5695 StatusWatcherEvent::decode(self.client.wait_for_event::<StatusWatcherMarker>(deadline)?)
5696 }
5697
5698 pub fn r#watch_status(
5710 &self,
5711 ___deadline: zx::MonotonicInstant,
5712 ) -> Result<PortStatus, fidl::Error> {
5713 let _response = self.client.send_query::<
5714 fidl::encoding::EmptyPayload,
5715 StatusWatcherWatchStatusResponse,
5716 StatusWatcherMarker,
5717 >(
5718 (),
5719 0x1369a8125c0862b9,
5720 fidl::encoding::DynamicFlags::empty(),
5721 ___deadline,
5722 )?;
5723 Ok(_response.port_status)
5724 }
5725}
5726
5727#[cfg(target_os = "fuchsia")]
5728impl From<StatusWatcherSynchronousProxy> for zx::NullableHandle {
5729 fn from(value: StatusWatcherSynchronousProxy) -> Self {
5730 value.into_channel().into()
5731 }
5732}
5733
5734#[cfg(target_os = "fuchsia")]
5735impl From<fidl::Channel> for StatusWatcherSynchronousProxy {
5736 fn from(value: fidl::Channel) -> Self {
5737 Self::new(value)
5738 }
5739}
5740
5741#[cfg(target_os = "fuchsia")]
5742impl fidl::endpoints::FromClient for StatusWatcherSynchronousProxy {
5743 type Protocol = StatusWatcherMarker;
5744
5745 fn from_client(value: fidl::endpoints::ClientEnd<StatusWatcherMarker>) -> Self {
5746 Self::new(value.into_channel())
5747 }
5748}
5749
5750#[derive(Debug, Clone)]
5751pub struct StatusWatcherProxy {
5752 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5753}
5754
5755impl fidl::endpoints::Proxy for StatusWatcherProxy {
5756 type Protocol = StatusWatcherMarker;
5757
5758 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5759 Self::new(inner)
5760 }
5761
5762 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5763 self.client.into_channel().map_err(|client| Self { client })
5764 }
5765
5766 fn as_channel(&self) -> &::fidl::AsyncChannel {
5767 self.client.as_channel()
5768 }
5769}
5770
5771impl StatusWatcherProxy {
5772 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5774 let protocol_name = <StatusWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5775 Self { client: fidl::client::Client::new(channel, protocol_name) }
5776 }
5777
5778 pub fn take_event_stream(&self) -> StatusWatcherEventStream {
5784 StatusWatcherEventStream { event_receiver: self.client.take_event_receiver() }
5785 }
5786
5787 pub fn r#watch_status(
5799 &self,
5800 ) -> fidl::client::QueryResponseFut<PortStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
5801 {
5802 StatusWatcherProxyInterface::r#watch_status(self)
5803 }
5804}
5805
5806impl StatusWatcherProxyInterface for StatusWatcherProxy {
5807 type WatchStatusResponseFut =
5808 fidl::client::QueryResponseFut<PortStatus, fidl::encoding::DefaultFuchsiaResourceDialect>;
5809 fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
5810 fn _decode(
5811 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5812 ) -> Result<PortStatus, fidl::Error> {
5813 let _response = fidl::client::decode_transaction_body::<
5814 StatusWatcherWatchStatusResponse,
5815 fidl::encoding::DefaultFuchsiaResourceDialect,
5816 0x1369a8125c0862b9,
5817 >(_buf?)?;
5818 Ok(_response.port_status)
5819 }
5820 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PortStatus>(
5821 (),
5822 0x1369a8125c0862b9,
5823 fidl::encoding::DynamicFlags::empty(),
5824 _decode,
5825 )
5826 }
5827}
5828
5829pub struct StatusWatcherEventStream {
5830 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5831}
5832
5833impl std::marker::Unpin for StatusWatcherEventStream {}
5834
5835impl futures::stream::FusedStream for StatusWatcherEventStream {
5836 fn is_terminated(&self) -> bool {
5837 self.event_receiver.is_terminated()
5838 }
5839}
5840
5841impl futures::Stream for StatusWatcherEventStream {
5842 type Item = Result<StatusWatcherEvent, fidl::Error>;
5843
5844 fn poll_next(
5845 mut self: std::pin::Pin<&mut Self>,
5846 cx: &mut std::task::Context<'_>,
5847 ) -> std::task::Poll<Option<Self::Item>> {
5848 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5849 &mut self.event_receiver,
5850 cx
5851 )?) {
5852 Some(buf) => std::task::Poll::Ready(Some(StatusWatcherEvent::decode(buf))),
5853 None => std::task::Poll::Ready(None),
5854 }
5855 }
5856}
5857
5858#[derive(Debug)]
5859pub enum StatusWatcherEvent {}
5860
5861impl StatusWatcherEvent {
5862 fn decode(
5864 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5865 ) -> Result<StatusWatcherEvent, fidl::Error> {
5866 let (bytes, _handles) = buf.split_mut();
5867 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5868 debug_assert_eq!(tx_header.tx_id, 0);
5869 match tx_header.ordinal {
5870 _ => Err(fidl::Error::UnknownOrdinal {
5871 ordinal: tx_header.ordinal,
5872 protocol_name: <StatusWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5873 }),
5874 }
5875 }
5876}
5877
5878pub struct StatusWatcherRequestStream {
5880 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5881 is_terminated: bool,
5882}
5883
5884impl std::marker::Unpin for StatusWatcherRequestStream {}
5885
5886impl futures::stream::FusedStream for StatusWatcherRequestStream {
5887 fn is_terminated(&self) -> bool {
5888 self.is_terminated
5889 }
5890}
5891
5892impl fidl::endpoints::RequestStream for StatusWatcherRequestStream {
5893 type Protocol = StatusWatcherMarker;
5894 type ControlHandle = StatusWatcherControlHandle;
5895
5896 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5897 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5898 }
5899
5900 fn control_handle(&self) -> Self::ControlHandle {
5901 StatusWatcherControlHandle { inner: self.inner.clone() }
5902 }
5903
5904 fn into_inner(
5905 self,
5906 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5907 {
5908 (self.inner, self.is_terminated)
5909 }
5910
5911 fn from_inner(
5912 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5913 is_terminated: bool,
5914 ) -> Self {
5915 Self { inner, is_terminated }
5916 }
5917}
5918
5919impl futures::Stream for StatusWatcherRequestStream {
5920 type Item = Result<StatusWatcherRequest, fidl::Error>;
5921
5922 fn poll_next(
5923 mut self: std::pin::Pin<&mut Self>,
5924 cx: &mut std::task::Context<'_>,
5925 ) -> std::task::Poll<Option<Self::Item>> {
5926 let this = &mut *self;
5927 if this.inner.check_shutdown(cx) {
5928 this.is_terminated = true;
5929 return std::task::Poll::Ready(None);
5930 }
5931 if this.is_terminated {
5932 panic!("polled StatusWatcherRequestStream after completion");
5933 }
5934 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5935 |bytes, handles| {
5936 match this.inner.channel().read_etc(cx, bytes, handles) {
5937 std::task::Poll::Ready(Ok(())) => {}
5938 std::task::Poll::Pending => return std::task::Poll::Pending,
5939 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5940 this.is_terminated = true;
5941 return std::task::Poll::Ready(None);
5942 }
5943 std::task::Poll::Ready(Err(e)) => {
5944 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5945 e.into(),
5946 ))));
5947 }
5948 }
5949
5950 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5952
5953 std::task::Poll::Ready(Some(match header.ordinal {
5954 0x1369a8125c0862b9 => {
5955 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5956 let mut req = fidl::new_empty!(
5957 fidl::encoding::EmptyPayload,
5958 fidl::encoding::DefaultFuchsiaResourceDialect
5959 );
5960 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5961 let control_handle =
5962 StatusWatcherControlHandle { inner: this.inner.clone() };
5963 Ok(StatusWatcherRequest::WatchStatus {
5964 responder: StatusWatcherWatchStatusResponder {
5965 control_handle: std::mem::ManuallyDrop::new(control_handle),
5966 tx_id: header.tx_id,
5967 },
5968 })
5969 }
5970 _ => Err(fidl::Error::UnknownOrdinal {
5971 ordinal: header.ordinal,
5972 protocol_name:
5973 <StatusWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5974 }),
5975 }))
5976 },
5977 )
5978 }
5979}
5980
5981#[derive(Debug)]
5983pub enum StatusWatcherRequest {
5984 WatchStatus { responder: StatusWatcherWatchStatusResponder },
5996}
5997
5998impl StatusWatcherRequest {
5999 #[allow(irrefutable_let_patterns)]
6000 pub fn into_watch_status(self) -> Option<(StatusWatcherWatchStatusResponder)> {
6001 if let StatusWatcherRequest::WatchStatus { responder } = self {
6002 Some((responder))
6003 } else {
6004 None
6005 }
6006 }
6007
6008 pub fn method_name(&self) -> &'static str {
6010 match *self {
6011 StatusWatcherRequest::WatchStatus { .. } => "watch_status",
6012 }
6013 }
6014}
6015
6016#[derive(Debug, Clone)]
6017pub struct StatusWatcherControlHandle {
6018 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6019}
6020
6021impl fidl::endpoints::ControlHandle for StatusWatcherControlHandle {
6022 fn shutdown(&self) {
6023 self.inner.shutdown()
6024 }
6025
6026 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6027 self.inner.shutdown_with_epitaph(status)
6028 }
6029
6030 fn is_closed(&self) -> bool {
6031 self.inner.channel().is_closed()
6032 }
6033 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6034 self.inner.channel().on_closed()
6035 }
6036
6037 #[cfg(target_os = "fuchsia")]
6038 fn signal_peer(
6039 &self,
6040 clear_mask: zx::Signals,
6041 set_mask: zx::Signals,
6042 ) -> Result<(), zx_status::Status> {
6043 use fidl::Peered;
6044 self.inner.channel().signal_peer(clear_mask, set_mask)
6045 }
6046}
6047
6048impl StatusWatcherControlHandle {}
6049
6050#[must_use = "FIDL methods require a response to be sent"]
6051#[derive(Debug)]
6052pub struct StatusWatcherWatchStatusResponder {
6053 control_handle: std::mem::ManuallyDrop<StatusWatcherControlHandle>,
6054 tx_id: u32,
6055}
6056
6057impl std::ops::Drop for StatusWatcherWatchStatusResponder {
6061 fn drop(&mut self) {
6062 self.control_handle.shutdown();
6063 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6065 }
6066}
6067
6068impl fidl::endpoints::Responder for StatusWatcherWatchStatusResponder {
6069 type ControlHandle = StatusWatcherControlHandle;
6070
6071 fn control_handle(&self) -> &StatusWatcherControlHandle {
6072 &self.control_handle
6073 }
6074
6075 fn drop_without_shutdown(mut self) {
6076 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6078 std::mem::forget(self);
6080 }
6081}
6082
6083impl StatusWatcherWatchStatusResponder {
6084 pub fn send(self, mut port_status: &PortStatus) -> Result<(), fidl::Error> {
6088 let _result = self.send_raw(port_status);
6089 if _result.is_err() {
6090 self.control_handle.shutdown();
6091 }
6092 self.drop_without_shutdown();
6093 _result
6094 }
6095
6096 pub fn send_no_shutdown_on_err(self, mut port_status: &PortStatus) -> Result<(), fidl::Error> {
6098 let _result = self.send_raw(port_status);
6099 self.drop_without_shutdown();
6100 _result
6101 }
6102
6103 fn send_raw(&self, mut port_status: &PortStatus) -> Result<(), fidl::Error> {
6104 self.control_handle.inner.send::<StatusWatcherWatchStatusResponse>(
6105 (port_status,),
6106 self.tx_id,
6107 0x1369a8125c0862b9,
6108 fidl::encoding::DynamicFlags::empty(),
6109 )
6110 }
6111}
6112
6113mod internal {
6114 use super::*;
6115
6116 impl fidl::encoding::ResourceTypeMarker for DeviceCloneRequest {
6117 type Borrowed<'a> = &'a mut Self;
6118 fn take_or_borrow<'a>(
6119 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6120 ) -> Self::Borrowed<'a> {
6121 value
6122 }
6123 }
6124
6125 unsafe impl fidl::encoding::TypeMarker for DeviceCloneRequest {
6126 type Owned = Self;
6127
6128 #[inline(always)]
6129 fn inline_align(_context: fidl::encoding::Context) -> usize {
6130 4
6131 }
6132
6133 #[inline(always)]
6134 fn inline_size(_context: fidl::encoding::Context) -> usize {
6135 4
6136 }
6137 }
6138
6139 unsafe impl
6140 fidl::encoding::Encode<DeviceCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6141 for &mut DeviceCloneRequest
6142 {
6143 #[inline]
6144 unsafe fn encode(
6145 self,
6146 encoder: &mut fidl::encoding::Encoder<
6147 '_,
6148 fidl::encoding::DefaultFuchsiaResourceDialect,
6149 >,
6150 offset: usize,
6151 _depth: fidl::encoding::Depth,
6152 ) -> fidl::Result<()> {
6153 encoder.debug_check_bounds::<DeviceCloneRequest>(offset);
6154 fidl::encoding::Encode::<DeviceCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6156 (
6157 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
6158 ),
6159 encoder, offset, _depth
6160 )
6161 }
6162 }
6163 unsafe impl<
6164 T0: fidl::encoding::Encode<
6165 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6166 fidl::encoding::DefaultFuchsiaResourceDialect,
6167 >,
6168 > fidl::encoding::Encode<DeviceCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6169 for (T0,)
6170 {
6171 #[inline]
6172 unsafe fn encode(
6173 self,
6174 encoder: &mut fidl::encoding::Encoder<
6175 '_,
6176 fidl::encoding::DefaultFuchsiaResourceDialect,
6177 >,
6178 offset: usize,
6179 depth: fidl::encoding::Depth,
6180 ) -> fidl::Result<()> {
6181 encoder.debug_check_bounds::<DeviceCloneRequest>(offset);
6182 self.0.encode(encoder, offset + 0, depth)?;
6186 Ok(())
6187 }
6188 }
6189
6190 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6191 for DeviceCloneRequest
6192 {
6193 #[inline(always)]
6194 fn new_empty() -> Self {
6195 Self {
6196 device: fidl::new_empty!(
6197 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6198 fidl::encoding::DefaultFuchsiaResourceDialect
6199 ),
6200 }
6201 }
6202
6203 #[inline]
6204 unsafe fn decode(
6205 &mut self,
6206 decoder: &mut fidl::encoding::Decoder<
6207 '_,
6208 fidl::encoding::DefaultFuchsiaResourceDialect,
6209 >,
6210 offset: usize,
6211 _depth: fidl::encoding::Depth,
6212 ) -> fidl::Result<()> {
6213 decoder.debug_check_bounds::<Self>(offset);
6214 fidl::decode!(
6216 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6217 fidl::encoding::DefaultFuchsiaResourceDialect,
6218 &mut self.device,
6219 decoder,
6220 offset + 0,
6221 _depth
6222 )?;
6223 Ok(())
6224 }
6225 }
6226
6227 impl fidl::encoding::ResourceTypeMarker for DeviceGetPortRequest {
6228 type Borrowed<'a> = &'a mut Self;
6229 fn take_or_borrow<'a>(
6230 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6231 ) -> Self::Borrowed<'a> {
6232 value
6233 }
6234 }
6235
6236 unsafe impl fidl::encoding::TypeMarker for DeviceGetPortRequest {
6237 type Owned = Self;
6238
6239 #[inline(always)]
6240 fn inline_align(_context: fidl::encoding::Context) -> usize {
6241 4
6242 }
6243
6244 #[inline(always)]
6245 fn inline_size(_context: fidl::encoding::Context) -> usize {
6246 8
6247 }
6248 }
6249
6250 unsafe impl
6251 fidl::encoding::Encode<DeviceGetPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6252 for &mut DeviceGetPortRequest
6253 {
6254 #[inline]
6255 unsafe fn encode(
6256 self,
6257 encoder: &mut fidl::encoding::Encoder<
6258 '_,
6259 fidl::encoding::DefaultFuchsiaResourceDialect,
6260 >,
6261 offset: usize,
6262 _depth: fidl::encoding::Depth,
6263 ) -> fidl::Result<()> {
6264 encoder.debug_check_bounds::<DeviceGetPortRequest>(offset);
6265 fidl::encoding::Encode::<DeviceGetPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6267 (
6268 <PortId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
6269 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.port),
6270 ),
6271 encoder, offset, _depth
6272 )
6273 }
6274 }
6275 unsafe impl<
6276 T0: fidl::encoding::Encode<PortId, fidl::encoding::DefaultFuchsiaResourceDialect>,
6277 T1: fidl::encoding::Encode<
6278 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6279 fidl::encoding::DefaultFuchsiaResourceDialect,
6280 >,
6281 >
6282 fidl::encoding::Encode<DeviceGetPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6283 for (T0, T1)
6284 {
6285 #[inline]
6286 unsafe fn encode(
6287 self,
6288 encoder: &mut fidl::encoding::Encoder<
6289 '_,
6290 fidl::encoding::DefaultFuchsiaResourceDialect,
6291 >,
6292 offset: usize,
6293 depth: fidl::encoding::Depth,
6294 ) -> fidl::Result<()> {
6295 encoder.debug_check_bounds::<DeviceGetPortRequest>(offset);
6296 unsafe {
6299 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
6300 (ptr as *mut u32).write_unaligned(0);
6301 }
6302 self.0.encode(encoder, offset + 0, depth)?;
6304 self.1.encode(encoder, offset + 4, depth)?;
6305 Ok(())
6306 }
6307 }
6308
6309 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6310 for DeviceGetPortRequest
6311 {
6312 #[inline(always)]
6313 fn new_empty() -> Self {
6314 Self {
6315 id: fidl::new_empty!(PortId, fidl::encoding::DefaultFuchsiaResourceDialect),
6316 port: fidl::new_empty!(
6317 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6318 fidl::encoding::DefaultFuchsiaResourceDialect
6319 ),
6320 }
6321 }
6322
6323 #[inline]
6324 unsafe fn decode(
6325 &mut self,
6326 decoder: &mut fidl::encoding::Decoder<
6327 '_,
6328 fidl::encoding::DefaultFuchsiaResourceDialect,
6329 >,
6330 offset: usize,
6331 _depth: fidl::encoding::Depth,
6332 ) -> fidl::Result<()> {
6333 decoder.debug_check_bounds::<Self>(offset);
6334 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
6336 let padval = unsafe { (ptr as *const u32).read_unaligned() };
6337 let mask = 0xffff0000u32;
6338 let maskedval = padval & mask;
6339 if maskedval != 0 {
6340 return Err(fidl::Error::NonZeroPadding {
6341 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
6342 });
6343 }
6344 fidl::decode!(
6345 PortId,
6346 fidl::encoding::DefaultFuchsiaResourceDialect,
6347 &mut self.id,
6348 decoder,
6349 offset + 0,
6350 _depth
6351 )?;
6352 fidl::decode!(
6353 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6354 fidl::encoding::DefaultFuchsiaResourceDialect,
6355 &mut self.port,
6356 decoder,
6357 offset + 4,
6358 _depth
6359 )?;
6360 Ok(())
6361 }
6362 }
6363
6364 impl fidl::encoding::ResourceTypeMarker for DeviceGetPortWatcherRequest {
6365 type Borrowed<'a> = &'a mut Self;
6366 fn take_or_borrow<'a>(
6367 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6368 ) -> Self::Borrowed<'a> {
6369 value
6370 }
6371 }
6372
6373 unsafe impl fidl::encoding::TypeMarker for DeviceGetPortWatcherRequest {
6374 type Owned = Self;
6375
6376 #[inline(always)]
6377 fn inline_align(_context: fidl::encoding::Context) -> usize {
6378 4
6379 }
6380
6381 #[inline(always)]
6382 fn inline_size(_context: fidl::encoding::Context) -> usize {
6383 4
6384 }
6385 }
6386
6387 unsafe impl
6388 fidl::encoding::Encode<
6389 DeviceGetPortWatcherRequest,
6390 fidl::encoding::DefaultFuchsiaResourceDialect,
6391 > for &mut DeviceGetPortWatcherRequest
6392 {
6393 #[inline]
6394 unsafe fn encode(
6395 self,
6396 encoder: &mut fidl::encoding::Encoder<
6397 '_,
6398 fidl::encoding::DefaultFuchsiaResourceDialect,
6399 >,
6400 offset: usize,
6401 _depth: fidl::encoding::Depth,
6402 ) -> fidl::Result<()> {
6403 encoder.debug_check_bounds::<DeviceGetPortWatcherRequest>(offset);
6404 fidl::encoding::Encode::<DeviceGetPortWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6406 (
6407 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
6408 ),
6409 encoder, offset, _depth
6410 )
6411 }
6412 }
6413 unsafe impl<
6414 T0: fidl::encoding::Encode<
6415 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortWatcherMarker>>,
6416 fidl::encoding::DefaultFuchsiaResourceDialect,
6417 >,
6418 >
6419 fidl::encoding::Encode<
6420 DeviceGetPortWatcherRequest,
6421 fidl::encoding::DefaultFuchsiaResourceDialect,
6422 > for (T0,)
6423 {
6424 #[inline]
6425 unsafe fn encode(
6426 self,
6427 encoder: &mut fidl::encoding::Encoder<
6428 '_,
6429 fidl::encoding::DefaultFuchsiaResourceDialect,
6430 >,
6431 offset: usize,
6432 depth: fidl::encoding::Depth,
6433 ) -> fidl::Result<()> {
6434 encoder.debug_check_bounds::<DeviceGetPortWatcherRequest>(offset);
6435 self.0.encode(encoder, offset + 0, depth)?;
6439 Ok(())
6440 }
6441 }
6442
6443 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6444 for DeviceGetPortWatcherRequest
6445 {
6446 #[inline(always)]
6447 fn new_empty() -> Self {
6448 Self {
6449 watcher: fidl::new_empty!(
6450 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortWatcherMarker>>,
6451 fidl::encoding::DefaultFuchsiaResourceDialect
6452 ),
6453 }
6454 }
6455
6456 #[inline]
6457 unsafe fn decode(
6458 &mut self,
6459 decoder: &mut fidl::encoding::Decoder<
6460 '_,
6461 fidl::encoding::DefaultFuchsiaResourceDialect,
6462 >,
6463 offset: usize,
6464 _depth: fidl::encoding::Depth,
6465 ) -> fidl::Result<()> {
6466 decoder.debug_check_bounds::<Self>(offset);
6467 fidl::decode!(
6469 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortWatcherMarker>>,
6470 fidl::encoding::DefaultFuchsiaResourceDialect,
6471 &mut self.watcher,
6472 decoder,
6473 offset + 0,
6474 _depth
6475 )?;
6476 Ok(())
6477 }
6478 }
6479
6480 impl fidl::encoding::ResourceTypeMarker for DeviceInstanceGetDeviceRequest {
6481 type Borrowed<'a> = &'a mut Self;
6482 fn take_or_borrow<'a>(
6483 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6484 ) -> Self::Borrowed<'a> {
6485 value
6486 }
6487 }
6488
6489 unsafe impl fidl::encoding::TypeMarker for DeviceInstanceGetDeviceRequest {
6490 type Owned = Self;
6491
6492 #[inline(always)]
6493 fn inline_align(_context: fidl::encoding::Context) -> usize {
6494 4
6495 }
6496
6497 #[inline(always)]
6498 fn inline_size(_context: fidl::encoding::Context) -> usize {
6499 4
6500 }
6501 }
6502
6503 unsafe impl
6504 fidl::encoding::Encode<
6505 DeviceInstanceGetDeviceRequest,
6506 fidl::encoding::DefaultFuchsiaResourceDialect,
6507 > for &mut DeviceInstanceGetDeviceRequest
6508 {
6509 #[inline]
6510 unsafe fn encode(
6511 self,
6512 encoder: &mut fidl::encoding::Encoder<
6513 '_,
6514 fidl::encoding::DefaultFuchsiaResourceDialect,
6515 >,
6516 offset: usize,
6517 _depth: fidl::encoding::Depth,
6518 ) -> fidl::Result<()> {
6519 encoder.debug_check_bounds::<DeviceInstanceGetDeviceRequest>(offset);
6520 fidl::encoding::Encode::<DeviceInstanceGetDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6522 (
6523 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
6524 ),
6525 encoder, offset, _depth
6526 )
6527 }
6528 }
6529 unsafe impl<
6530 T0: fidl::encoding::Encode<
6531 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6532 fidl::encoding::DefaultFuchsiaResourceDialect,
6533 >,
6534 >
6535 fidl::encoding::Encode<
6536 DeviceInstanceGetDeviceRequest,
6537 fidl::encoding::DefaultFuchsiaResourceDialect,
6538 > for (T0,)
6539 {
6540 #[inline]
6541 unsafe fn encode(
6542 self,
6543 encoder: &mut fidl::encoding::Encoder<
6544 '_,
6545 fidl::encoding::DefaultFuchsiaResourceDialect,
6546 >,
6547 offset: usize,
6548 depth: fidl::encoding::Depth,
6549 ) -> fidl::Result<()> {
6550 encoder.debug_check_bounds::<DeviceInstanceGetDeviceRequest>(offset);
6551 self.0.encode(encoder, offset + 0, depth)?;
6555 Ok(())
6556 }
6557 }
6558
6559 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6560 for DeviceInstanceGetDeviceRequest
6561 {
6562 #[inline(always)]
6563 fn new_empty() -> Self {
6564 Self {
6565 device: fidl::new_empty!(
6566 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6567 fidl::encoding::DefaultFuchsiaResourceDialect
6568 ),
6569 }
6570 }
6571
6572 #[inline]
6573 unsafe fn decode(
6574 &mut self,
6575 decoder: &mut fidl::encoding::Decoder<
6576 '_,
6577 fidl::encoding::DefaultFuchsiaResourceDialect,
6578 >,
6579 offset: usize,
6580 _depth: fidl::encoding::Depth,
6581 ) -> fidl::Result<()> {
6582 decoder.debug_check_bounds::<Self>(offset);
6583 fidl::decode!(
6585 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6586 fidl::encoding::DefaultFuchsiaResourceDialect,
6587 &mut self.device,
6588 decoder,
6589 offset + 0,
6590 _depth
6591 )?;
6592 Ok(())
6593 }
6594 }
6595
6596 impl fidl::encoding::ResourceTypeMarker for DeviceOpenSessionRequest {
6597 type Borrowed<'a> = &'a mut Self;
6598 fn take_or_borrow<'a>(
6599 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6600 ) -> Self::Borrowed<'a> {
6601 value
6602 }
6603 }
6604
6605 unsafe impl fidl::encoding::TypeMarker for DeviceOpenSessionRequest {
6606 type Owned = Self;
6607
6608 #[inline(always)]
6609 fn inline_align(_context: fidl::encoding::Context) -> usize {
6610 8
6611 }
6612
6613 #[inline(always)]
6614 fn inline_size(_context: fidl::encoding::Context) -> usize {
6615 32
6616 }
6617 }
6618
6619 unsafe impl
6620 fidl::encoding::Encode<
6621 DeviceOpenSessionRequest,
6622 fidl::encoding::DefaultFuchsiaResourceDialect,
6623 > for &mut DeviceOpenSessionRequest
6624 {
6625 #[inline]
6626 unsafe fn encode(
6627 self,
6628 encoder: &mut fidl::encoding::Encoder<
6629 '_,
6630 fidl::encoding::DefaultFuchsiaResourceDialect,
6631 >,
6632 offset: usize,
6633 _depth: fidl::encoding::Depth,
6634 ) -> fidl::Result<()> {
6635 encoder.debug_check_bounds::<DeviceOpenSessionRequest>(offset);
6636 fidl::encoding::Encode::<
6638 DeviceOpenSessionRequest,
6639 fidl::encoding::DefaultFuchsiaResourceDialect,
6640 >::encode(
6641 (
6642 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
6643 &self.session_name,
6644 ),
6645 <SessionInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6646 &mut self.session_info,
6647 ),
6648 ),
6649 encoder,
6650 offset,
6651 _depth,
6652 )
6653 }
6654 }
6655 unsafe impl<
6656 T0: fidl::encoding::Encode<
6657 fidl::encoding::BoundedString<64>,
6658 fidl::encoding::DefaultFuchsiaResourceDialect,
6659 >,
6660 T1: fidl::encoding::Encode<SessionInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
6661 >
6662 fidl::encoding::Encode<
6663 DeviceOpenSessionRequest,
6664 fidl::encoding::DefaultFuchsiaResourceDialect,
6665 > for (T0, T1)
6666 {
6667 #[inline]
6668 unsafe fn encode(
6669 self,
6670 encoder: &mut fidl::encoding::Encoder<
6671 '_,
6672 fidl::encoding::DefaultFuchsiaResourceDialect,
6673 >,
6674 offset: usize,
6675 depth: fidl::encoding::Depth,
6676 ) -> fidl::Result<()> {
6677 encoder.debug_check_bounds::<DeviceOpenSessionRequest>(offset);
6678 self.0.encode(encoder, offset + 0, depth)?;
6682 self.1.encode(encoder, offset + 16, depth)?;
6683 Ok(())
6684 }
6685 }
6686
6687 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6688 for DeviceOpenSessionRequest
6689 {
6690 #[inline(always)]
6691 fn new_empty() -> Self {
6692 Self {
6693 session_name: fidl::new_empty!(
6694 fidl::encoding::BoundedString<64>,
6695 fidl::encoding::DefaultFuchsiaResourceDialect
6696 ),
6697 session_info: fidl::new_empty!(
6698 SessionInfo,
6699 fidl::encoding::DefaultFuchsiaResourceDialect
6700 ),
6701 }
6702 }
6703
6704 #[inline]
6705 unsafe fn decode(
6706 &mut self,
6707 decoder: &mut fidl::encoding::Decoder<
6708 '_,
6709 fidl::encoding::DefaultFuchsiaResourceDialect,
6710 >,
6711 offset: usize,
6712 _depth: fidl::encoding::Depth,
6713 ) -> fidl::Result<()> {
6714 decoder.debug_check_bounds::<Self>(offset);
6715 fidl::decode!(
6717 fidl::encoding::BoundedString<64>,
6718 fidl::encoding::DefaultFuchsiaResourceDialect,
6719 &mut self.session_name,
6720 decoder,
6721 offset + 0,
6722 _depth
6723 )?;
6724 fidl::decode!(
6725 SessionInfo,
6726 fidl::encoding::DefaultFuchsiaResourceDialect,
6727 &mut self.session_info,
6728 decoder,
6729 offset + 16,
6730 _depth
6731 )?;
6732 Ok(())
6733 }
6734 }
6735
6736 impl fidl::encoding::ResourceTypeMarker for DeviceOpenSessionResponse {
6737 type Borrowed<'a> = &'a mut Self;
6738 fn take_or_borrow<'a>(
6739 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6740 ) -> Self::Borrowed<'a> {
6741 value
6742 }
6743 }
6744
6745 unsafe impl fidl::encoding::TypeMarker for DeviceOpenSessionResponse {
6746 type Owned = Self;
6747
6748 #[inline(always)]
6749 fn inline_align(_context: fidl::encoding::Context) -> usize {
6750 4
6751 }
6752
6753 #[inline(always)]
6754 fn inline_size(_context: fidl::encoding::Context) -> usize {
6755 12
6756 }
6757 }
6758
6759 unsafe impl
6760 fidl::encoding::Encode<
6761 DeviceOpenSessionResponse,
6762 fidl::encoding::DefaultFuchsiaResourceDialect,
6763 > for &mut DeviceOpenSessionResponse
6764 {
6765 #[inline]
6766 unsafe fn encode(
6767 self,
6768 encoder: &mut fidl::encoding::Encoder<
6769 '_,
6770 fidl::encoding::DefaultFuchsiaResourceDialect,
6771 >,
6772 offset: usize,
6773 _depth: fidl::encoding::Depth,
6774 ) -> fidl::Result<()> {
6775 encoder.debug_check_bounds::<DeviceOpenSessionResponse>(offset);
6776 fidl::encoding::Encode::<DeviceOpenSessionResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6778 (
6779 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
6780 <Fifos as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.fifos),
6781 ),
6782 encoder, offset, _depth
6783 )
6784 }
6785 }
6786 unsafe impl<
6787 T0: fidl::encoding::Encode<
6788 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionMarker>>,
6789 fidl::encoding::DefaultFuchsiaResourceDialect,
6790 >,
6791 T1: fidl::encoding::Encode<Fifos, fidl::encoding::DefaultFuchsiaResourceDialect>,
6792 >
6793 fidl::encoding::Encode<
6794 DeviceOpenSessionResponse,
6795 fidl::encoding::DefaultFuchsiaResourceDialect,
6796 > for (T0, T1)
6797 {
6798 #[inline]
6799 unsafe fn encode(
6800 self,
6801 encoder: &mut fidl::encoding::Encoder<
6802 '_,
6803 fidl::encoding::DefaultFuchsiaResourceDialect,
6804 >,
6805 offset: usize,
6806 depth: fidl::encoding::Depth,
6807 ) -> fidl::Result<()> {
6808 encoder.debug_check_bounds::<DeviceOpenSessionResponse>(offset);
6809 self.0.encode(encoder, offset + 0, depth)?;
6813 self.1.encode(encoder, offset + 4, depth)?;
6814 Ok(())
6815 }
6816 }
6817
6818 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6819 for DeviceOpenSessionResponse
6820 {
6821 #[inline(always)]
6822 fn new_empty() -> Self {
6823 Self {
6824 session: fidl::new_empty!(
6825 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionMarker>>,
6826 fidl::encoding::DefaultFuchsiaResourceDialect
6827 ),
6828 fifos: fidl::new_empty!(Fifos, fidl::encoding::DefaultFuchsiaResourceDialect),
6829 }
6830 }
6831
6832 #[inline]
6833 unsafe fn decode(
6834 &mut self,
6835 decoder: &mut fidl::encoding::Decoder<
6836 '_,
6837 fidl::encoding::DefaultFuchsiaResourceDialect,
6838 >,
6839 offset: usize,
6840 _depth: fidl::encoding::Depth,
6841 ) -> fidl::Result<()> {
6842 decoder.debug_check_bounds::<Self>(offset);
6843 fidl::decode!(
6845 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionMarker>>,
6846 fidl::encoding::DefaultFuchsiaResourceDialect,
6847 &mut self.session,
6848 decoder,
6849 offset + 0,
6850 _depth
6851 )?;
6852 fidl::decode!(
6853 Fifos,
6854 fidl::encoding::DefaultFuchsiaResourceDialect,
6855 &mut self.fifos,
6856 decoder,
6857 offset + 4,
6858 _depth
6859 )?;
6860 Ok(())
6861 }
6862 }
6863
6864 impl fidl::encoding::ResourceTypeMarker for Fifos {
6865 type Borrowed<'a> = &'a mut Self;
6866 fn take_or_borrow<'a>(
6867 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6868 ) -> Self::Borrowed<'a> {
6869 value
6870 }
6871 }
6872
6873 unsafe impl fidl::encoding::TypeMarker for Fifos {
6874 type Owned = Self;
6875
6876 #[inline(always)]
6877 fn inline_align(_context: fidl::encoding::Context) -> usize {
6878 4
6879 }
6880
6881 #[inline(always)]
6882 fn inline_size(_context: fidl::encoding::Context) -> usize {
6883 8
6884 }
6885 }
6886
6887 unsafe impl fidl::encoding::Encode<Fifos, fidl::encoding::DefaultFuchsiaResourceDialect>
6888 for &mut Fifos
6889 {
6890 #[inline]
6891 unsafe fn encode(
6892 self,
6893 encoder: &mut fidl::encoding::Encoder<
6894 '_,
6895 fidl::encoding::DefaultFuchsiaResourceDialect,
6896 >,
6897 offset: usize,
6898 _depth: fidl::encoding::Depth,
6899 ) -> fidl::Result<()> {
6900 encoder.debug_check_bounds::<Fifos>(offset);
6901 fidl::encoding::Encode::<Fifos, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6903 (
6904 <fidl::encoding::HandleType<
6905 fidl::Fifo,
6906 { fidl::ObjectType::FIFO.into_raw() },
6907 2147483648,
6908 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6909 &mut self.rx
6910 ),
6911 <fidl::encoding::HandleType<
6912 fidl::Fifo,
6913 { fidl::ObjectType::FIFO.into_raw() },
6914 2147483648,
6915 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6916 &mut self.tx
6917 ),
6918 ),
6919 encoder,
6920 offset,
6921 _depth,
6922 )
6923 }
6924 }
6925 unsafe impl<
6926 T0: fidl::encoding::Encode<
6927 fidl::encoding::HandleType<
6928 fidl::Fifo,
6929 { fidl::ObjectType::FIFO.into_raw() },
6930 2147483648,
6931 >,
6932 fidl::encoding::DefaultFuchsiaResourceDialect,
6933 >,
6934 T1: fidl::encoding::Encode<
6935 fidl::encoding::HandleType<
6936 fidl::Fifo,
6937 { fidl::ObjectType::FIFO.into_raw() },
6938 2147483648,
6939 >,
6940 fidl::encoding::DefaultFuchsiaResourceDialect,
6941 >,
6942 > fidl::encoding::Encode<Fifos, fidl::encoding::DefaultFuchsiaResourceDialect> for (T0, T1)
6943 {
6944 #[inline]
6945 unsafe fn encode(
6946 self,
6947 encoder: &mut fidl::encoding::Encoder<
6948 '_,
6949 fidl::encoding::DefaultFuchsiaResourceDialect,
6950 >,
6951 offset: usize,
6952 depth: fidl::encoding::Depth,
6953 ) -> fidl::Result<()> {
6954 encoder.debug_check_bounds::<Fifos>(offset);
6955 self.0.encode(encoder, offset + 0, depth)?;
6959 self.1.encode(encoder, offset + 4, depth)?;
6960 Ok(())
6961 }
6962 }
6963
6964 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Fifos {
6965 #[inline(always)]
6966 fn new_empty() -> Self {
6967 Self {
6968 rx: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6969 tx: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6970 }
6971 }
6972
6973 #[inline]
6974 unsafe fn decode(
6975 &mut self,
6976 decoder: &mut fidl::encoding::Decoder<
6977 '_,
6978 fidl::encoding::DefaultFuchsiaResourceDialect,
6979 >,
6980 offset: usize,
6981 _depth: fidl::encoding::Depth,
6982 ) -> fidl::Result<()> {
6983 decoder.debug_check_bounds::<Self>(offset);
6984 fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.rx, decoder, offset + 0, _depth)?;
6986 fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.tx, decoder, offset + 4, _depth)?;
6987 Ok(())
6988 }
6989 }
6990
6991 impl fidl::encoding::ResourceTypeMarker for PortCloneRequest {
6992 type Borrowed<'a> = &'a mut Self;
6993 fn take_or_borrow<'a>(
6994 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6995 ) -> Self::Borrowed<'a> {
6996 value
6997 }
6998 }
6999
7000 unsafe impl fidl::encoding::TypeMarker for PortCloneRequest {
7001 type Owned = Self;
7002
7003 #[inline(always)]
7004 fn inline_align(_context: fidl::encoding::Context) -> usize {
7005 4
7006 }
7007
7008 #[inline(always)]
7009 fn inline_size(_context: fidl::encoding::Context) -> usize {
7010 4
7011 }
7012 }
7013
7014 unsafe impl
7015 fidl::encoding::Encode<PortCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7016 for &mut PortCloneRequest
7017 {
7018 #[inline]
7019 unsafe fn encode(
7020 self,
7021 encoder: &mut fidl::encoding::Encoder<
7022 '_,
7023 fidl::encoding::DefaultFuchsiaResourceDialect,
7024 >,
7025 offset: usize,
7026 _depth: fidl::encoding::Depth,
7027 ) -> fidl::Result<()> {
7028 encoder.debug_check_bounds::<PortCloneRequest>(offset);
7029 fidl::encoding::Encode::<PortCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7031 (
7032 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.port),
7033 ),
7034 encoder, offset, _depth
7035 )
7036 }
7037 }
7038 unsafe impl<
7039 T0: fidl::encoding::Encode<
7040 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
7041 fidl::encoding::DefaultFuchsiaResourceDialect,
7042 >,
7043 > fidl::encoding::Encode<PortCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7044 for (T0,)
7045 {
7046 #[inline]
7047 unsafe fn encode(
7048 self,
7049 encoder: &mut fidl::encoding::Encoder<
7050 '_,
7051 fidl::encoding::DefaultFuchsiaResourceDialect,
7052 >,
7053 offset: usize,
7054 depth: fidl::encoding::Depth,
7055 ) -> fidl::Result<()> {
7056 encoder.debug_check_bounds::<PortCloneRequest>(offset);
7057 self.0.encode(encoder, offset + 0, depth)?;
7061 Ok(())
7062 }
7063 }
7064
7065 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7066 for PortCloneRequest
7067 {
7068 #[inline(always)]
7069 fn new_empty() -> Self {
7070 Self {
7071 port: fidl::new_empty!(
7072 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
7073 fidl::encoding::DefaultFuchsiaResourceDialect
7074 ),
7075 }
7076 }
7077
7078 #[inline]
7079 unsafe fn decode(
7080 &mut self,
7081 decoder: &mut fidl::encoding::Decoder<
7082 '_,
7083 fidl::encoding::DefaultFuchsiaResourceDialect,
7084 >,
7085 offset: usize,
7086 _depth: fidl::encoding::Depth,
7087 ) -> fidl::Result<()> {
7088 decoder.debug_check_bounds::<Self>(offset);
7089 fidl::decode!(
7091 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
7092 fidl::encoding::DefaultFuchsiaResourceDialect,
7093 &mut self.port,
7094 decoder,
7095 offset + 0,
7096 _depth
7097 )?;
7098 Ok(())
7099 }
7100 }
7101
7102 impl fidl::encoding::ResourceTypeMarker for PortGetDeviceRequest {
7103 type Borrowed<'a> = &'a mut Self;
7104 fn take_or_borrow<'a>(
7105 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7106 ) -> Self::Borrowed<'a> {
7107 value
7108 }
7109 }
7110
7111 unsafe impl fidl::encoding::TypeMarker for PortGetDeviceRequest {
7112 type Owned = Self;
7113
7114 #[inline(always)]
7115 fn inline_align(_context: fidl::encoding::Context) -> usize {
7116 4
7117 }
7118
7119 #[inline(always)]
7120 fn inline_size(_context: fidl::encoding::Context) -> usize {
7121 4
7122 }
7123 }
7124
7125 unsafe impl
7126 fidl::encoding::Encode<PortGetDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7127 for &mut PortGetDeviceRequest
7128 {
7129 #[inline]
7130 unsafe fn encode(
7131 self,
7132 encoder: &mut fidl::encoding::Encoder<
7133 '_,
7134 fidl::encoding::DefaultFuchsiaResourceDialect,
7135 >,
7136 offset: usize,
7137 _depth: fidl::encoding::Depth,
7138 ) -> fidl::Result<()> {
7139 encoder.debug_check_bounds::<PortGetDeviceRequest>(offset);
7140 fidl::encoding::Encode::<PortGetDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7142 (
7143 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
7144 ),
7145 encoder, offset, _depth
7146 )
7147 }
7148 }
7149 unsafe impl<
7150 T0: fidl::encoding::Encode<
7151 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
7152 fidl::encoding::DefaultFuchsiaResourceDialect,
7153 >,
7154 >
7155 fidl::encoding::Encode<PortGetDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7156 for (T0,)
7157 {
7158 #[inline]
7159 unsafe fn encode(
7160 self,
7161 encoder: &mut fidl::encoding::Encoder<
7162 '_,
7163 fidl::encoding::DefaultFuchsiaResourceDialect,
7164 >,
7165 offset: usize,
7166 depth: fidl::encoding::Depth,
7167 ) -> fidl::Result<()> {
7168 encoder.debug_check_bounds::<PortGetDeviceRequest>(offset);
7169 self.0.encode(encoder, offset + 0, depth)?;
7173 Ok(())
7174 }
7175 }
7176
7177 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7178 for PortGetDeviceRequest
7179 {
7180 #[inline(always)]
7181 fn new_empty() -> Self {
7182 Self {
7183 device: fidl::new_empty!(
7184 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
7185 fidl::encoding::DefaultFuchsiaResourceDialect
7186 ),
7187 }
7188 }
7189
7190 #[inline]
7191 unsafe fn decode(
7192 &mut self,
7193 decoder: &mut fidl::encoding::Decoder<
7194 '_,
7195 fidl::encoding::DefaultFuchsiaResourceDialect,
7196 >,
7197 offset: usize,
7198 _depth: fidl::encoding::Depth,
7199 ) -> fidl::Result<()> {
7200 decoder.debug_check_bounds::<Self>(offset);
7201 fidl::decode!(
7203 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
7204 fidl::encoding::DefaultFuchsiaResourceDialect,
7205 &mut self.device,
7206 decoder,
7207 offset + 0,
7208 _depth
7209 )?;
7210 Ok(())
7211 }
7212 }
7213
7214 impl fidl::encoding::ResourceTypeMarker for PortGetDiagnosticsRequest {
7215 type Borrowed<'a> = &'a mut Self;
7216 fn take_or_borrow<'a>(
7217 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7218 ) -> Self::Borrowed<'a> {
7219 value
7220 }
7221 }
7222
7223 unsafe impl fidl::encoding::TypeMarker for PortGetDiagnosticsRequest {
7224 type Owned = Self;
7225
7226 #[inline(always)]
7227 fn inline_align(_context: fidl::encoding::Context) -> usize {
7228 4
7229 }
7230
7231 #[inline(always)]
7232 fn inline_size(_context: fidl::encoding::Context) -> usize {
7233 4
7234 }
7235 }
7236
7237 unsafe impl
7238 fidl::encoding::Encode<
7239 PortGetDiagnosticsRequest,
7240 fidl::encoding::DefaultFuchsiaResourceDialect,
7241 > for &mut PortGetDiagnosticsRequest
7242 {
7243 #[inline]
7244 unsafe fn encode(
7245 self,
7246 encoder: &mut fidl::encoding::Encoder<
7247 '_,
7248 fidl::encoding::DefaultFuchsiaResourceDialect,
7249 >,
7250 offset: usize,
7251 _depth: fidl::encoding::Depth,
7252 ) -> fidl::Result<()> {
7253 encoder.debug_check_bounds::<PortGetDiagnosticsRequest>(offset);
7254 fidl::encoding::Encode::<PortGetDiagnosticsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7256 (
7257 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiagnosticsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.diagnostics),
7258 ),
7259 encoder, offset, _depth
7260 )
7261 }
7262 }
7263 unsafe impl<
7264 T0: fidl::encoding::Encode<
7265 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiagnosticsMarker>>,
7266 fidl::encoding::DefaultFuchsiaResourceDialect,
7267 >,
7268 >
7269 fidl::encoding::Encode<
7270 PortGetDiagnosticsRequest,
7271 fidl::encoding::DefaultFuchsiaResourceDialect,
7272 > for (T0,)
7273 {
7274 #[inline]
7275 unsafe fn encode(
7276 self,
7277 encoder: &mut fidl::encoding::Encoder<
7278 '_,
7279 fidl::encoding::DefaultFuchsiaResourceDialect,
7280 >,
7281 offset: usize,
7282 depth: fidl::encoding::Depth,
7283 ) -> fidl::Result<()> {
7284 encoder.debug_check_bounds::<PortGetDiagnosticsRequest>(offset);
7285 self.0.encode(encoder, offset + 0, depth)?;
7289 Ok(())
7290 }
7291 }
7292
7293 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7294 for PortGetDiagnosticsRequest
7295 {
7296 #[inline(always)]
7297 fn new_empty() -> Self {
7298 Self {
7299 diagnostics: fidl::new_empty!(
7300 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiagnosticsMarker>>,
7301 fidl::encoding::DefaultFuchsiaResourceDialect
7302 ),
7303 }
7304 }
7305
7306 #[inline]
7307 unsafe fn decode(
7308 &mut self,
7309 decoder: &mut fidl::encoding::Decoder<
7310 '_,
7311 fidl::encoding::DefaultFuchsiaResourceDialect,
7312 >,
7313 offset: usize,
7314 _depth: fidl::encoding::Depth,
7315 ) -> fidl::Result<()> {
7316 decoder.debug_check_bounds::<Self>(offset);
7317 fidl::decode!(
7319 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiagnosticsMarker>>,
7320 fidl::encoding::DefaultFuchsiaResourceDialect,
7321 &mut self.diagnostics,
7322 decoder,
7323 offset + 0,
7324 _depth
7325 )?;
7326 Ok(())
7327 }
7328 }
7329
7330 impl fidl::encoding::ResourceTypeMarker for PortGetIdentityResponse {
7331 type Borrowed<'a> = &'a mut Self;
7332 fn take_or_borrow<'a>(
7333 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7334 ) -> Self::Borrowed<'a> {
7335 value
7336 }
7337 }
7338
7339 unsafe impl fidl::encoding::TypeMarker for PortGetIdentityResponse {
7340 type Owned = Self;
7341
7342 #[inline(always)]
7343 fn inline_align(_context: fidl::encoding::Context) -> usize {
7344 4
7345 }
7346
7347 #[inline(always)]
7348 fn inline_size(_context: fidl::encoding::Context) -> usize {
7349 4
7350 }
7351 }
7352
7353 unsafe impl
7354 fidl::encoding::Encode<
7355 PortGetIdentityResponse,
7356 fidl::encoding::DefaultFuchsiaResourceDialect,
7357 > for &mut PortGetIdentityResponse
7358 {
7359 #[inline]
7360 unsafe fn encode(
7361 self,
7362 encoder: &mut fidl::encoding::Encoder<
7363 '_,
7364 fidl::encoding::DefaultFuchsiaResourceDialect,
7365 >,
7366 offset: usize,
7367 _depth: fidl::encoding::Depth,
7368 ) -> fidl::Result<()> {
7369 encoder.debug_check_bounds::<PortGetIdentityResponse>(offset);
7370 fidl::encoding::Encode::<
7372 PortGetIdentityResponse,
7373 fidl::encoding::DefaultFuchsiaResourceDialect,
7374 >::encode(
7375 (<fidl::encoding::HandleType<
7376 fidl::Event,
7377 { fidl::ObjectType::EVENT.into_raw() },
7378 3,
7379 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7380 &mut self.event
7381 ),),
7382 encoder,
7383 offset,
7384 _depth,
7385 )
7386 }
7387 }
7388 unsafe impl<
7389 T0: fidl::encoding::Encode<
7390 fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>,
7391 fidl::encoding::DefaultFuchsiaResourceDialect,
7392 >,
7393 >
7394 fidl::encoding::Encode<
7395 PortGetIdentityResponse,
7396 fidl::encoding::DefaultFuchsiaResourceDialect,
7397 > for (T0,)
7398 {
7399 #[inline]
7400 unsafe fn encode(
7401 self,
7402 encoder: &mut fidl::encoding::Encoder<
7403 '_,
7404 fidl::encoding::DefaultFuchsiaResourceDialect,
7405 >,
7406 offset: usize,
7407 depth: fidl::encoding::Depth,
7408 ) -> fidl::Result<()> {
7409 encoder.debug_check_bounds::<PortGetIdentityResponse>(offset);
7410 self.0.encode(encoder, offset + 0, depth)?;
7414 Ok(())
7415 }
7416 }
7417
7418 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7419 for PortGetIdentityResponse
7420 {
7421 #[inline(always)]
7422 fn new_empty() -> Self {
7423 Self {
7424 event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect),
7425 }
7426 }
7427
7428 #[inline]
7429 unsafe fn decode(
7430 &mut self,
7431 decoder: &mut fidl::encoding::Decoder<
7432 '_,
7433 fidl::encoding::DefaultFuchsiaResourceDialect,
7434 >,
7435 offset: usize,
7436 _depth: fidl::encoding::Depth,
7437 ) -> fidl::Result<()> {
7438 decoder.debug_check_bounds::<Self>(offset);
7439 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 0, _depth)?;
7441 Ok(())
7442 }
7443 }
7444
7445 impl fidl::encoding::ResourceTypeMarker for PortGetMacRequest {
7446 type Borrowed<'a> = &'a mut Self;
7447 fn take_or_borrow<'a>(
7448 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7449 ) -> Self::Borrowed<'a> {
7450 value
7451 }
7452 }
7453
7454 unsafe impl fidl::encoding::TypeMarker for PortGetMacRequest {
7455 type Owned = Self;
7456
7457 #[inline(always)]
7458 fn inline_align(_context: fidl::encoding::Context) -> usize {
7459 4
7460 }
7461
7462 #[inline(always)]
7463 fn inline_size(_context: fidl::encoding::Context) -> usize {
7464 4
7465 }
7466 }
7467
7468 unsafe impl
7469 fidl::encoding::Encode<PortGetMacRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7470 for &mut PortGetMacRequest
7471 {
7472 #[inline]
7473 unsafe fn encode(
7474 self,
7475 encoder: &mut fidl::encoding::Encoder<
7476 '_,
7477 fidl::encoding::DefaultFuchsiaResourceDialect,
7478 >,
7479 offset: usize,
7480 _depth: fidl::encoding::Depth,
7481 ) -> fidl::Result<()> {
7482 encoder.debug_check_bounds::<PortGetMacRequest>(offset);
7483 fidl::encoding::Encode::<PortGetMacRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7485 (
7486 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MacAddressingMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.mac),
7487 ),
7488 encoder, offset, _depth
7489 )
7490 }
7491 }
7492 unsafe impl<
7493 T0: fidl::encoding::Encode<
7494 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MacAddressingMarker>>,
7495 fidl::encoding::DefaultFuchsiaResourceDialect,
7496 >,
7497 > fidl::encoding::Encode<PortGetMacRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7498 for (T0,)
7499 {
7500 #[inline]
7501 unsafe fn encode(
7502 self,
7503 encoder: &mut fidl::encoding::Encoder<
7504 '_,
7505 fidl::encoding::DefaultFuchsiaResourceDialect,
7506 >,
7507 offset: usize,
7508 depth: fidl::encoding::Depth,
7509 ) -> fidl::Result<()> {
7510 encoder.debug_check_bounds::<PortGetMacRequest>(offset);
7511 self.0.encode(encoder, offset + 0, depth)?;
7515 Ok(())
7516 }
7517 }
7518
7519 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7520 for PortGetMacRequest
7521 {
7522 #[inline(always)]
7523 fn new_empty() -> Self {
7524 Self {
7525 mac: fidl::new_empty!(
7526 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MacAddressingMarker>>,
7527 fidl::encoding::DefaultFuchsiaResourceDialect
7528 ),
7529 }
7530 }
7531
7532 #[inline]
7533 unsafe fn decode(
7534 &mut self,
7535 decoder: &mut fidl::encoding::Decoder<
7536 '_,
7537 fidl::encoding::DefaultFuchsiaResourceDialect,
7538 >,
7539 offset: usize,
7540 _depth: fidl::encoding::Depth,
7541 ) -> fidl::Result<()> {
7542 decoder.debug_check_bounds::<Self>(offset);
7543 fidl::decode!(
7545 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MacAddressingMarker>>,
7546 fidl::encoding::DefaultFuchsiaResourceDialect,
7547 &mut self.mac,
7548 decoder,
7549 offset + 0,
7550 _depth
7551 )?;
7552 Ok(())
7553 }
7554 }
7555
7556 impl fidl::encoding::ResourceTypeMarker for PortGetStatusWatcherRequest {
7557 type Borrowed<'a> = &'a mut Self;
7558 fn take_or_borrow<'a>(
7559 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7560 ) -> Self::Borrowed<'a> {
7561 value
7562 }
7563 }
7564
7565 unsafe impl fidl::encoding::TypeMarker for PortGetStatusWatcherRequest {
7566 type Owned = Self;
7567
7568 #[inline(always)]
7569 fn inline_align(_context: fidl::encoding::Context) -> usize {
7570 4
7571 }
7572
7573 #[inline(always)]
7574 fn inline_size(_context: fidl::encoding::Context) -> usize {
7575 8
7576 }
7577 }
7578
7579 unsafe impl
7580 fidl::encoding::Encode<
7581 PortGetStatusWatcherRequest,
7582 fidl::encoding::DefaultFuchsiaResourceDialect,
7583 > for &mut PortGetStatusWatcherRequest
7584 {
7585 #[inline]
7586 unsafe fn encode(
7587 self,
7588 encoder: &mut fidl::encoding::Encoder<
7589 '_,
7590 fidl::encoding::DefaultFuchsiaResourceDialect,
7591 >,
7592 offset: usize,
7593 _depth: fidl::encoding::Depth,
7594 ) -> fidl::Result<()> {
7595 encoder.debug_check_bounds::<PortGetStatusWatcherRequest>(offset);
7596 fidl::encoding::Encode::<PortGetStatusWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7598 (
7599 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
7600 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer),
7601 ),
7602 encoder, offset, _depth
7603 )
7604 }
7605 }
7606 unsafe impl<
7607 T0: fidl::encoding::Encode<
7608 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusWatcherMarker>>,
7609 fidl::encoding::DefaultFuchsiaResourceDialect,
7610 >,
7611 T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
7612 >
7613 fidl::encoding::Encode<
7614 PortGetStatusWatcherRequest,
7615 fidl::encoding::DefaultFuchsiaResourceDialect,
7616 > for (T0, T1)
7617 {
7618 #[inline]
7619 unsafe fn encode(
7620 self,
7621 encoder: &mut fidl::encoding::Encoder<
7622 '_,
7623 fidl::encoding::DefaultFuchsiaResourceDialect,
7624 >,
7625 offset: usize,
7626 depth: fidl::encoding::Depth,
7627 ) -> fidl::Result<()> {
7628 encoder.debug_check_bounds::<PortGetStatusWatcherRequest>(offset);
7629 self.0.encode(encoder, offset + 0, depth)?;
7633 self.1.encode(encoder, offset + 4, depth)?;
7634 Ok(())
7635 }
7636 }
7637
7638 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7639 for PortGetStatusWatcherRequest
7640 {
7641 #[inline(always)]
7642 fn new_empty() -> Self {
7643 Self {
7644 watcher: fidl::new_empty!(
7645 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusWatcherMarker>>,
7646 fidl::encoding::DefaultFuchsiaResourceDialect
7647 ),
7648 buffer: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
7649 }
7650 }
7651
7652 #[inline]
7653 unsafe fn decode(
7654 &mut self,
7655 decoder: &mut fidl::encoding::Decoder<
7656 '_,
7657 fidl::encoding::DefaultFuchsiaResourceDialect,
7658 >,
7659 offset: usize,
7660 _depth: fidl::encoding::Depth,
7661 ) -> fidl::Result<()> {
7662 decoder.debug_check_bounds::<Self>(offset);
7663 fidl::decode!(
7665 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusWatcherMarker>>,
7666 fidl::encoding::DefaultFuchsiaResourceDialect,
7667 &mut self.watcher,
7668 decoder,
7669 offset + 0,
7670 _depth
7671 )?;
7672 fidl::decode!(
7673 u32,
7674 fidl::encoding::DefaultFuchsiaResourceDialect,
7675 &mut self.buffer,
7676 decoder,
7677 offset + 4,
7678 _depth
7679 )?;
7680 Ok(())
7681 }
7682 }
7683
7684 impl fidl::encoding::ResourceTypeMarker for SessionWatchDelegatedRxLeaseResponse {
7685 type Borrowed<'a> = &'a mut Self;
7686 fn take_or_borrow<'a>(
7687 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7688 ) -> Self::Borrowed<'a> {
7689 value
7690 }
7691 }
7692
7693 unsafe impl fidl::encoding::TypeMarker for SessionWatchDelegatedRxLeaseResponse {
7694 type Owned = Self;
7695
7696 #[inline(always)]
7697 fn inline_align(_context: fidl::encoding::Context) -> usize {
7698 8
7699 }
7700
7701 #[inline(always)]
7702 fn inline_size(_context: fidl::encoding::Context) -> usize {
7703 16
7704 }
7705 }
7706
7707 unsafe impl
7708 fidl::encoding::Encode<
7709 SessionWatchDelegatedRxLeaseResponse,
7710 fidl::encoding::DefaultFuchsiaResourceDialect,
7711 > for &mut SessionWatchDelegatedRxLeaseResponse
7712 {
7713 #[inline]
7714 unsafe fn encode(
7715 self,
7716 encoder: &mut fidl::encoding::Encoder<
7717 '_,
7718 fidl::encoding::DefaultFuchsiaResourceDialect,
7719 >,
7720 offset: usize,
7721 _depth: fidl::encoding::Depth,
7722 ) -> fidl::Result<()> {
7723 encoder.debug_check_bounds::<SessionWatchDelegatedRxLeaseResponse>(offset);
7724 fidl::encoding::Encode::<
7726 SessionWatchDelegatedRxLeaseResponse,
7727 fidl::encoding::DefaultFuchsiaResourceDialect,
7728 >::encode(
7729 (<DelegatedRxLease as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7730 &mut self.lease,
7731 ),),
7732 encoder,
7733 offset,
7734 _depth,
7735 )
7736 }
7737 }
7738 unsafe impl<
7739 T0: fidl::encoding::Encode<DelegatedRxLease, fidl::encoding::DefaultFuchsiaResourceDialect>,
7740 >
7741 fidl::encoding::Encode<
7742 SessionWatchDelegatedRxLeaseResponse,
7743 fidl::encoding::DefaultFuchsiaResourceDialect,
7744 > for (T0,)
7745 {
7746 #[inline]
7747 unsafe fn encode(
7748 self,
7749 encoder: &mut fidl::encoding::Encoder<
7750 '_,
7751 fidl::encoding::DefaultFuchsiaResourceDialect,
7752 >,
7753 offset: usize,
7754 depth: fidl::encoding::Depth,
7755 ) -> fidl::Result<()> {
7756 encoder.debug_check_bounds::<SessionWatchDelegatedRxLeaseResponse>(offset);
7757 self.0.encode(encoder, offset + 0, depth)?;
7761 Ok(())
7762 }
7763 }
7764
7765 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7766 for SessionWatchDelegatedRxLeaseResponse
7767 {
7768 #[inline(always)]
7769 fn new_empty() -> Self {
7770 Self {
7771 lease: fidl::new_empty!(
7772 DelegatedRxLease,
7773 fidl::encoding::DefaultFuchsiaResourceDialect
7774 ),
7775 }
7776 }
7777
7778 #[inline]
7779 unsafe fn decode(
7780 &mut self,
7781 decoder: &mut fidl::encoding::Decoder<
7782 '_,
7783 fidl::encoding::DefaultFuchsiaResourceDialect,
7784 >,
7785 offset: usize,
7786 _depth: fidl::encoding::Depth,
7787 ) -> fidl::Result<()> {
7788 decoder.debug_check_bounds::<Self>(offset);
7789 fidl::decode!(
7791 DelegatedRxLease,
7792 fidl::encoding::DefaultFuchsiaResourceDialect,
7793 &mut self.lease,
7794 decoder,
7795 offset + 0,
7796 _depth
7797 )?;
7798 Ok(())
7799 }
7800 }
7801
7802 impl DelegatedRxLease {
7803 #[inline(always)]
7804 fn max_ordinal_present(&self) -> u64 {
7805 if let Some(_) = self.handle {
7806 return 2;
7807 }
7808 if let Some(_) = self.hold_until_frame {
7809 return 1;
7810 }
7811 0
7812 }
7813 }
7814
7815 impl fidl::encoding::ResourceTypeMarker for DelegatedRxLease {
7816 type Borrowed<'a> = &'a mut Self;
7817 fn take_or_borrow<'a>(
7818 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7819 ) -> Self::Borrowed<'a> {
7820 value
7821 }
7822 }
7823
7824 unsafe impl fidl::encoding::TypeMarker for DelegatedRxLease {
7825 type Owned = Self;
7826
7827 #[inline(always)]
7828 fn inline_align(_context: fidl::encoding::Context) -> usize {
7829 8
7830 }
7831
7832 #[inline(always)]
7833 fn inline_size(_context: fidl::encoding::Context) -> usize {
7834 16
7835 }
7836 }
7837
7838 unsafe impl
7839 fidl::encoding::Encode<DelegatedRxLease, fidl::encoding::DefaultFuchsiaResourceDialect>
7840 for &mut DelegatedRxLease
7841 {
7842 unsafe fn encode(
7843 self,
7844 encoder: &mut fidl::encoding::Encoder<
7845 '_,
7846 fidl::encoding::DefaultFuchsiaResourceDialect,
7847 >,
7848 offset: usize,
7849 mut depth: fidl::encoding::Depth,
7850 ) -> fidl::Result<()> {
7851 encoder.debug_check_bounds::<DelegatedRxLease>(offset);
7852 let max_ordinal: u64 = self.max_ordinal_present();
7854 encoder.write_num(max_ordinal, offset);
7855 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7856 if max_ordinal == 0 {
7858 return Ok(());
7859 }
7860 depth.increment()?;
7861 let envelope_size = 8;
7862 let bytes_len = max_ordinal as usize * envelope_size;
7863 #[allow(unused_variables)]
7864 let offset = encoder.out_of_line_offset(bytes_len);
7865 let mut _prev_end_offset: usize = 0;
7866 if 1 > max_ordinal {
7867 return Ok(());
7868 }
7869
7870 let cur_offset: usize = (1 - 1) * envelope_size;
7873
7874 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7876
7877 fidl::encoding::encode_in_envelope_optional::<
7882 u64,
7883 fidl::encoding::DefaultFuchsiaResourceDialect,
7884 >(
7885 self.hold_until_frame
7886 .as_ref()
7887 .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
7888 encoder,
7889 offset + cur_offset,
7890 depth,
7891 )?;
7892
7893 _prev_end_offset = cur_offset + envelope_size;
7894 if 2 > max_ordinal {
7895 return Ok(());
7896 }
7897
7898 let cur_offset: usize = (2 - 1) * envelope_size;
7901
7902 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7904
7905 fidl::encoding::encode_in_envelope_optional::<
7910 DelegatedRxLeaseHandle,
7911 fidl::encoding::DefaultFuchsiaResourceDialect,
7912 >(
7913 self.handle.as_mut().map(
7914 <DelegatedRxLeaseHandle as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7915 ),
7916 encoder,
7917 offset + cur_offset,
7918 depth,
7919 )?;
7920
7921 _prev_end_offset = cur_offset + envelope_size;
7922
7923 Ok(())
7924 }
7925 }
7926
7927 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7928 for DelegatedRxLease
7929 {
7930 #[inline(always)]
7931 fn new_empty() -> Self {
7932 Self::default()
7933 }
7934
7935 unsafe fn decode(
7936 &mut self,
7937 decoder: &mut fidl::encoding::Decoder<
7938 '_,
7939 fidl::encoding::DefaultFuchsiaResourceDialect,
7940 >,
7941 offset: usize,
7942 mut depth: fidl::encoding::Depth,
7943 ) -> fidl::Result<()> {
7944 decoder.debug_check_bounds::<Self>(offset);
7945 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7946 None => return Err(fidl::Error::NotNullable),
7947 Some(len) => len,
7948 };
7949 if len == 0 {
7951 return Ok(());
7952 };
7953 depth.increment()?;
7954 let envelope_size = 8;
7955 let bytes_len = len * envelope_size;
7956 let offset = decoder.out_of_line_offset(bytes_len)?;
7957 let mut _next_ordinal_to_read = 0;
7959 let mut next_offset = offset;
7960 let end_offset = offset + bytes_len;
7961 _next_ordinal_to_read += 1;
7962 if next_offset >= end_offset {
7963 return Ok(());
7964 }
7965
7966 while _next_ordinal_to_read < 1 {
7968 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7969 _next_ordinal_to_read += 1;
7970 next_offset += envelope_size;
7971 }
7972
7973 let next_out_of_line = decoder.next_out_of_line();
7974 let handles_before = decoder.remaining_handles();
7975 if let Some((inlined, num_bytes, num_handles)) =
7976 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7977 {
7978 let member_inline_size =
7979 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7980 if inlined != (member_inline_size <= 4) {
7981 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7982 }
7983 let inner_offset;
7984 let mut inner_depth = depth.clone();
7985 if inlined {
7986 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7987 inner_offset = next_offset;
7988 } else {
7989 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7990 inner_depth.increment()?;
7991 }
7992 let val_ref = self.hold_until_frame.get_or_insert_with(|| {
7993 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
7994 });
7995 fidl::decode!(
7996 u64,
7997 fidl::encoding::DefaultFuchsiaResourceDialect,
7998 val_ref,
7999 decoder,
8000 inner_offset,
8001 inner_depth
8002 )?;
8003 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8004 {
8005 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8006 }
8007 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8008 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8009 }
8010 }
8011
8012 next_offset += envelope_size;
8013 _next_ordinal_to_read += 1;
8014 if next_offset >= end_offset {
8015 return Ok(());
8016 }
8017
8018 while _next_ordinal_to_read < 2 {
8020 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8021 _next_ordinal_to_read += 1;
8022 next_offset += envelope_size;
8023 }
8024
8025 let next_out_of_line = decoder.next_out_of_line();
8026 let handles_before = decoder.remaining_handles();
8027 if let Some((inlined, num_bytes, num_handles)) =
8028 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8029 {
8030 let member_inline_size =
8031 <DelegatedRxLeaseHandle as fidl::encoding::TypeMarker>::inline_size(
8032 decoder.context,
8033 );
8034 if inlined != (member_inline_size <= 4) {
8035 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8036 }
8037 let inner_offset;
8038 let mut inner_depth = depth.clone();
8039 if inlined {
8040 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8041 inner_offset = next_offset;
8042 } else {
8043 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8044 inner_depth.increment()?;
8045 }
8046 let val_ref = self.handle.get_or_insert_with(|| {
8047 fidl::new_empty!(
8048 DelegatedRxLeaseHandle,
8049 fidl::encoding::DefaultFuchsiaResourceDialect
8050 )
8051 });
8052 fidl::decode!(
8053 DelegatedRxLeaseHandle,
8054 fidl::encoding::DefaultFuchsiaResourceDialect,
8055 val_ref,
8056 decoder,
8057 inner_offset,
8058 inner_depth
8059 )?;
8060 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8061 {
8062 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8063 }
8064 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8065 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8066 }
8067 }
8068
8069 next_offset += envelope_size;
8070
8071 while next_offset < end_offset {
8073 _next_ordinal_to_read += 1;
8074 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8075 next_offset += envelope_size;
8076 }
8077
8078 Ok(())
8079 }
8080 }
8081
8082 impl SessionInfo {
8083 #[inline(always)]
8084 fn max_ordinal_present(&self) -> u64 {
8085 if let Some(_) = self.options {
8086 return 6;
8087 }
8088 if let Some(_) = self.descriptor_count {
8089 return 5;
8090 }
8091 if let Some(_) = self.descriptor_length {
8092 return 4;
8093 }
8094 if let Some(_) = self.descriptor_version {
8095 return 3;
8096 }
8097 if let Some(_) = self.data {
8098 return 2;
8099 }
8100 if let Some(_) = self.descriptors {
8101 return 1;
8102 }
8103 0
8104 }
8105 }
8106
8107 impl fidl::encoding::ResourceTypeMarker for SessionInfo {
8108 type Borrowed<'a> = &'a mut Self;
8109 fn take_or_borrow<'a>(
8110 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8111 ) -> Self::Borrowed<'a> {
8112 value
8113 }
8114 }
8115
8116 unsafe impl fidl::encoding::TypeMarker for SessionInfo {
8117 type Owned = Self;
8118
8119 #[inline(always)]
8120 fn inline_align(_context: fidl::encoding::Context) -> usize {
8121 8
8122 }
8123
8124 #[inline(always)]
8125 fn inline_size(_context: fidl::encoding::Context) -> usize {
8126 16
8127 }
8128 }
8129
8130 unsafe impl fidl::encoding::Encode<SessionInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
8131 for &mut SessionInfo
8132 {
8133 unsafe fn encode(
8134 self,
8135 encoder: &mut fidl::encoding::Encoder<
8136 '_,
8137 fidl::encoding::DefaultFuchsiaResourceDialect,
8138 >,
8139 offset: usize,
8140 mut depth: fidl::encoding::Depth,
8141 ) -> fidl::Result<()> {
8142 encoder.debug_check_bounds::<SessionInfo>(offset);
8143 let max_ordinal: u64 = self.max_ordinal_present();
8145 encoder.write_num(max_ordinal, offset);
8146 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8147 if max_ordinal == 0 {
8149 return Ok(());
8150 }
8151 depth.increment()?;
8152 let envelope_size = 8;
8153 let bytes_len = max_ordinal as usize * envelope_size;
8154 #[allow(unused_variables)]
8155 let offset = encoder.out_of_line_offset(bytes_len);
8156 let mut _prev_end_offset: usize = 0;
8157 if 1 > max_ordinal {
8158 return Ok(());
8159 }
8160
8161 let cur_offset: usize = (1 - 1) * envelope_size;
8164
8165 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8167
8168 fidl::encoding::encode_in_envelope_optional::<
8173 fidl::encoding::HandleType<
8174 fidl::Vmo,
8175 { fidl::ObjectType::VMO.into_raw() },
8176 2147483648,
8177 >,
8178 fidl::encoding::DefaultFuchsiaResourceDialect,
8179 >(
8180 self.descriptors.as_mut().map(
8181 <fidl::encoding::HandleType<
8182 fidl::Vmo,
8183 { fidl::ObjectType::VMO.into_raw() },
8184 2147483648,
8185 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
8186 ),
8187 encoder,
8188 offset + cur_offset,
8189 depth,
8190 )?;
8191
8192 _prev_end_offset = cur_offset + envelope_size;
8193 if 2 > max_ordinal {
8194 return Ok(());
8195 }
8196
8197 let cur_offset: usize = (2 - 1) * envelope_size;
8200
8201 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8203
8204 fidl::encoding::encode_in_envelope_optional::<
8209 fidl::encoding::HandleType<
8210 fidl::Vmo,
8211 { fidl::ObjectType::VMO.into_raw() },
8212 2147483648,
8213 >,
8214 fidl::encoding::DefaultFuchsiaResourceDialect,
8215 >(
8216 self.data.as_mut().map(
8217 <fidl::encoding::HandleType<
8218 fidl::Vmo,
8219 { fidl::ObjectType::VMO.into_raw() },
8220 2147483648,
8221 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
8222 ),
8223 encoder,
8224 offset + cur_offset,
8225 depth,
8226 )?;
8227
8228 _prev_end_offset = cur_offset + envelope_size;
8229 if 3 > max_ordinal {
8230 return Ok(());
8231 }
8232
8233 let cur_offset: usize = (3 - 1) * envelope_size;
8236
8237 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8239
8240 fidl::encoding::encode_in_envelope_optional::<
8245 u8,
8246 fidl::encoding::DefaultFuchsiaResourceDialect,
8247 >(
8248 self.descriptor_version
8249 .as_ref()
8250 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
8251 encoder,
8252 offset + cur_offset,
8253 depth,
8254 )?;
8255
8256 _prev_end_offset = cur_offset + envelope_size;
8257 if 4 > max_ordinal {
8258 return Ok(());
8259 }
8260
8261 let cur_offset: usize = (4 - 1) * envelope_size;
8264
8265 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8267
8268 fidl::encoding::encode_in_envelope_optional::<
8273 u8,
8274 fidl::encoding::DefaultFuchsiaResourceDialect,
8275 >(
8276 self.descriptor_length
8277 .as_ref()
8278 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
8279 encoder,
8280 offset + cur_offset,
8281 depth,
8282 )?;
8283
8284 _prev_end_offset = cur_offset + envelope_size;
8285 if 5 > max_ordinal {
8286 return Ok(());
8287 }
8288
8289 let cur_offset: usize = (5 - 1) * envelope_size;
8292
8293 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8295
8296 fidl::encoding::encode_in_envelope_optional::<
8301 u16,
8302 fidl::encoding::DefaultFuchsiaResourceDialect,
8303 >(
8304 self.descriptor_count
8305 .as_ref()
8306 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
8307 encoder,
8308 offset + cur_offset,
8309 depth,
8310 )?;
8311
8312 _prev_end_offset = cur_offset + envelope_size;
8313 if 6 > max_ordinal {
8314 return Ok(());
8315 }
8316
8317 let cur_offset: usize = (6 - 1) * envelope_size;
8320
8321 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8323
8324 fidl::encoding::encode_in_envelope_optional::<
8329 SessionFlags,
8330 fidl::encoding::DefaultFuchsiaResourceDialect,
8331 >(
8332 self.options
8333 .as_ref()
8334 .map(<SessionFlags as fidl::encoding::ValueTypeMarker>::borrow),
8335 encoder,
8336 offset + cur_offset,
8337 depth,
8338 )?;
8339
8340 _prev_end_offset = cur_offset + envelope_size;
8341
8342 Ok(())
8343 }
8344 }
8345
8346 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for SessionInfo {
8347 #[inline(always)]
8348 fn new_empty() -> Self {
8349 Self::default()
8350 }
8351
8352 unsafe fn decode(
8353 &mut self,
8354 decoder: &mut fidl::encoding::Decoder<
8355 '_,
8356 fidl::encoding::DefaultFuchsiaResourceDialect,
8357 >,
8358 offset: usize,
8359 mut depth: fidl::encoding::Depth,
8360 ) -> fidl::Result<()> {
8361 decoder.debug_check_bounds::<Self>(offset);
8362 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8363 None => return Err(fidl::Error::NotNullable),
8364 Some(len) => len,
8365 };
8366 if len == 0 {
8368 return Ok(());
8369 };
8370 depth.increment()?;
8371 let envelope_size = 8;
8372 let bytes_len = len * envelope_size;
8373 let offset = decoder.out_of_line_offset(bytes_len)?;
8374 let mut _next_ordinal_to_read = 0;
8376 let mut next_offset = offset;
8377 let end_offset = offset + bytes_len;
8378 _next_ordinal_to_read += 1;
8379 if next_offset >= end_offset {
8380 return Ok(());
8381 }
8382
8383 while _next_ordinal_to_read < 1 {
8385 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8386 _next_ordinal_to_read += 1;
8387 next_offset += envelope_size;
8388 }
8389
8390 let next_out_of_line = decoder.next_out_of_line();
8391 let handles_before = decoder.remaining_handles();
8392 if let Some((inlined, num_bytes, num_handles)) =
8393 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8394 {
8395 let member_inline_size = <fidl::encoding::HandleType<
8396 fidl::Vmo,
8397 { fidl::ObjectType::VMO.into_raw() },
8398 2147483648,
8399 > as fidl::encoding::TypeMarker>::inline_size(
8400 decoder.context
8401 );
8402 if inlined != (member_inline_size <= 4) {
8403 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8404 }
8405 let inner_offset;
8406 let mut inner_depth = depth.clone();
8407 if inlined {
8408 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8409 inner_offset = next_offset;
8410 } else {
8411 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8412 inner_depth.increment()?;
8413 }
8414 let val_ref =
8415 self.descriptors.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
8416 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8417 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8418 {
8419 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8420 }
8421 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8422 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8423 }
8424 }
8425
8426 next_offset += envelope_size;
8427 _next_ordinal_to_read += 1;
8428 if next_offset >= end_offset {
8429 return Ok(());
8430 }
8431
8432 while _next_ordinal_to_read < 2 {
8434 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8435 _next_ordinal_to_read += 1;
8436 next_offset += envelope_size;
8437 }
8438
8439 let next_out_of_line = decoder.next_out_of_line();
8440 let handles_before = decoder.remaining_handles();
8441 if let Some((inlined, num_bytes, num_handles)) =
8442 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8443 {
8444 let member_inline_size = <fidl::encoding::HandleType<
8445 fidl::Vmo,
8446 { fidl::ObjectType::VMO.into_raw() },
8447 2147483648,
8448 > as fidl::encoding::TypeMarker>::inline_size(
8449 decoder.context
8450 );
8451 if inlined != (member_inline_size <= 4) {
8452 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8453 }
8454 let inner_offset;
8455 let mut inner_depth = depth.clone();
8456 if inlined {
8457 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8458 inner_offset = next_offset;
8459 } else {
8460 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8461 inner_depth.increment()?;
8462 }
8463 let val_ref =
8464 self.data.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
8465 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8466 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8467 {
8468 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8469 }
8470 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8471 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8472 }
8473 }
8474
8475 next_offset += envelope_size;
8476 _next_ordinal_to_read += 1;
8477 if next_offset >= end_offset {
8478 return Ok(());
8479 }
8480
8481 while _next_ordinal_to_read < 3 {
8483 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8484 _next_ordinal_to_read += 1;
8485 next_offset += envelope_size;
8486 }
8487
8488 let next_out_of_line = decoder.next_out_of_line();
8489 let handles_before = decoder.remaining_handles();
8490 if let Some((inlined, num_bytes, num_handles)) =
8491 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8492 {
8493 let member_inline_size =
8494 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8495 if inlined != (member_inline_size <= 4) {
8496 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8497 }
8498 let inner_offset;
8499 let mut inner_depth = depth.clone();
8500 if inlined {
8501 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8502 inner_offset = next_offset;
8503 } else {
8504 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8505 inner_depth.increment()?;
8506 }
8507 let val_ref = self.descriptor_version.get_or_insert_with(|| {
8508 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
8509 });
8510 fidl::decode!(
8511 u8,
8512 fidl::encoding::DefaultFuchsiaResourceDialect,
8513 val_ref,
8514 decoder,
8515 inner_offset,
8516 inner_depth
8517 )?;
8518 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8519 {
8520 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8521 }
8522 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8523 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8524 }
8525 }
8526
8527 next_offset += envelope_size;
8528 _next_ordinal_to_read += 1;
8529 if next_offset >= end_offset {
8530 return Ok(());
8531 }
8532
8533 while _next_ordinal_to_read < 4 {
8535 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8536 _next_ordinal_to_read += 1;
8537 next_offset += envelope_size;
8538 }
8539
8540 let next_out_of_line = decoder.next_out_of_line();
8541 let handles_before = decoder.remaining_handles();
8542 if let Some((inlined, num_bytes, num_handles)) =
8543 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8544 {
8545 let member_inline_size =
8546 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8547 if inlined != (member_inline_size <= 4) {
8548 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8549 }
8550 let inner_offset;
8551 let mut inner_depth = depth.clone();
8552 if inlined {
8553 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8554 inner_offset = next_offset;
8555 } else {
8556 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8557 inner_depth.increment()?;
8558 }
8559 let val_ref = self.descriptor_length.get_or_insert_with(|| {
8560 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
8561 });
8562 fidl::decode!(
8563 u8,
8564 fidl::encoding::DefaultFuchsiaResourceDialect,
8565 val_ref,
8566 decoder,
8567 inner_offset,
8568 inner_depth
8569 )?;
8570 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8571 {
8572 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8573 }
8574 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8575 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8576 }
8577 }
8578
8579 next_offset += envelope_size;
8580 _next_ordinal_to_read += 1;
8581 if next_offset >= end_offset {
8582 return Ok(());
8583 }
8584
8585 while _next_ordinal_to_read < 5 {
8587 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8588 _next_ordinal_to_read += 1;
8589 next_offset += envelope_size;
8590 }
8591
8592 let next_out_of_line = decoder.next_out_of_line();
8593 let handles_before = decoder.remaining_handles();
8594 if let Some((inlined, num_bytes, num_handles)) =
8595 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8596 {
8597 let member_inline_size =
8598 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8599 if inlined != (member_inline_size <= 4) {
8600 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8601 }
8602 let inner_offset;
8603 let mut inner_depth = depth.clone();
8604 if inlined {
8605 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8606 inner_offset = next_offset;
8607 } else {
8608 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8609 inner_depth.increment()?;
8610 }
8611 let val_ref = self.descriptor_count.get_or_insert_with(|| {
8612 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
8613 });
8614 fidl::decode!(
8615 u16,
8616 fidl::encoding::DefaultFuchsiaResourceDialect,
8617 val_ref,
8618 decoder,
8619 inner_offset,
8620 inner_depth
8621 )?;
8622 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8623 {
8624 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8625 }
8626 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8627 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8628 }
8629 }
8630
8631 next_offset += envelope_size;
8632 _next_ordinal_to_read += 1;
8633 if next_offset >= end_offset {
8634 return Ok(());
8635 }
8636
8637 while _next_ordinal_to_read < 6 {
8639 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8640 _next_ordinal_to_read += 1;
8641 next_offset += envelope_size;
8642 }
8643
8644 let next_out_of_line = decoder.next_out_of_line();
8645 let handles_before = decoder.remaining_handles();
8646 if let Some((inlined, num_bytes, num_handles)) =
8647 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8648 {
8649 let member_inline_size =
8650 <SessionFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8651 if inlined != (member_inline_size <= 4) {
8652 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8653 }
8654 let inner_offset;
8655 let mut inner_depth = depth.clone();
8656 if inlined {
8657 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8658 inner_offset = next_offset;
8659 } else {
8660 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8661 inner_depth.increment()?;
8662 }
8663 let val_ref = self.options.get_or_insert_with(|| {
8664 fidl::new_empty!(SessionFlags, fidl::encoding::DefaultFuchsiaResourceDialect)
8665 });
8666 fidl::decode!(
8667 SessionFlags,
8668 fidl::encoding::DefaultFuchsiaResourceDialect,
8669 val_ref,
8670 decoder,
8671 inner_offset,
8672 inner_depth
8673 )?;
8674 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8675 {
8676 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8677 }
8678 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8679 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8680 }
8681 }
8682
8683 next_offset += envelope_size;
8684
8685 while next_offset < end_offset {
8687 _next_ordinal_to_read += 1;
8688 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8689 next_offset += envelope_size;
8690 }
8691
8692 Ok(())
8693 }
8694 }
8695
8696 impl fidl::encoding::ResourceTypeMarker for DelegatedRxLeaseHandle {
8697 type Borrowed<'a> = &'a mut Self;
8698 fn take_or_borrow<'a>(
8699 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8700 ) -> Self::Borrowed<'a> {
8701 value
8702 }
8703 }
8704
8705 unsafe impl fidl::encoding::TypeMarker for DelegatedRxLeaseHandle {
8706 type Owned = Self;
8707
8708 #[inline(always)]
8709 fn inline_align(_context: fidl::encoding::Context) -> usize {
8710 8
8711 }
8712
8713 #[inline(always)]
8714 fn inline_size(_context: fidl::encoding::Context) -> usize {
8715 16
8716 }
8717 }
8718
8719 unsafe impl
8720 fidl::encoding::Encode<
8721 DelegatedRxLeaseHandle,
8722 fidl::encoding::DefaultFuchsiaResourceDialect,
8723 > for &mut DelegatedRxLeaseHandle
8724 {
8725 #[inline]
8726 unsafe fn encode(
8727 self,
8728 encoder: &mut fidl::encoding::Encoder<
8729 '_,
8730 fidl::encoding::DefaultFuchsiaResourceDialect,
8731 >,
8732 offset: usize,
8733 _depth: fidl::encoding::Depth,
8734 ) -> fidl::Result<()> {
8735 encoder.debug_check_bounds::<DelegatedRxLeaseHandle>(offset);
8736 encoder.write_num::<u64>(self.ordinal(), offset);
8737 match self {
8738 DelegatedRxLeaseHandle::Channel(ref mut val) => {
8739 fidl::encoding::encode_in_envelope::<
8740 fidl::encoding::HandleType<
8741 fidl::Channel,
8742 { fidl::ObjectType::CHANNEL.into_raw() },
8743 2147483648,
8744 >,
8745 fidl::encoding::DefaultFuchsiaResourceDialect,
8746 >(
8747 <fidl::encoding::HandleType<
8748 fidl::Channel,
8749 { fidl::ObjectType::CHANNEL.into_raw() },
8750 2147483648,
8751 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8752 val
8753 ),
8754 encoder,
8755 offset + 8,
8756 _depth,
8757 )
8758 }
8759 DelegatedRxLeaseHandle::Eventpair(ref mut val) => {
8760 fidl::encoding::encode_in_envelope::<
8761 fidl::encoding::HandleType<
8762 fidl::EventPair,
8763 { fidl::ObjectType::EVENTPAIR.into_raw() },
8764 16387,
8765 >,
8766 fidl::encoding::DefaultFuchsiaResourceDialect,
8767 >(
8768 <fidl::encoding::HandleType<
8769 fidl::EventPair,
8770 { fidl::ObjectType::EVENTPAIR.into_raw() },
8771 16387,
8772 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8773 val
8774 ),
8775 encoder,
8776 offset + 8,
8777 _depth,
8778 )
8779 }
8780 DelegatedRxLeaseHandle::__SourceBreaking { .. } => {
8781 Err(fidl::Error::UnknownUnionTag)
8782 }
8783 }
8784 }
8785 }
8786
8787 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8788 for DelegatedRxLeaseHandle
8789 {
8790 #[inline(always)]
8791 fn new_empty() -> Self {
8792 Self::__SourceBreaking { unknown_ordinal: 0 }
8793 }
8794
8795 #[inline]
8796 unsafe fn decode(
8797 &mut self,
8798 decoder: &mut fidl::encoding::Decoder<
8799 '_,
8800 fidl::encoding::DefaultFuchsiaResourceDialect,
8801 >,
8802 offset: usize,
8803 mut depth: fidl::encoding::Depth,
8804 ) -> fidl::Result<()> {
8805 decoder.debug_check_bounds::<Self>(offset);
8806 #[allow(unused_variables)]
8807 let next_out_of_line = decoder.next_out_of_line();
8808 let handles_before = decoder.remaining_handles();
8809 let (ordinal, inlined, num_bytes, num_handles) =
8810 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
8811
8812 let member_inline_size = match ordinal {
8813 1 => <fidl::encoding::HandleType<
8814 fidl::Channel,
8815 { fidl::ObjectType::CHANNEL.into_raw() },
8816 2147483648,
8817 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8818 2 => <fidl::encoding::HandleType<
8819 fidl::EventPair,
8820 { fidl::ObjectType::EVENTPAIR.into_raw() },
8821 16387,
8822 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8823 0 => return Err(fidl::Error::UnknownUnionTag),
8824 _ => num_bytes as usize,
8825 };
8826
8827 if inlined != (member_inline_size <= 4) {
8828 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8829 }
8830 let _inner_offset;
8831 if inlined {
8832 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
8833 _inner_offset = offset + 8;
8834 } else {
8835 depth.increment()?;
8836 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8837 }
8838 match ordinal {
8839 1 => {
8840 #[allow(irrefutable_let_patterns)]
8841 if let DelegatedRxLeaseHandle::Channel(_) = self {
8842 } else {
8844 *self = DelegatedRxLeaseHandle::Channel(
8846 fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8847 );
8848 }
8849 #[allow(irrefutable_let_patterns)]
8850 if let DelegatedRxLeaseHandle::Channel(ref mut val) = self {
8851 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
8852 } else {
8853 unreachable!()
8854 }
8855 }
8856 2 => {
8857 #[allow(irrefutable_let_patterns)]
8858 if let DelegatedRxLeaseHandle::Eventpair(_) = self {
8859 } else {
8861 *self = DelegatedRxLeaseHandle::Eventpair(
8863 fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
8864 );
8865 }
8866 #[allow(irrefutable_let_patterns)]
8867 if let DelegatedRxLeaseHandle::Eventpair(ref mut val) = self {
8868 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
8869 } else {
8870 unreachable!()
8871 }
8872 }
8873 #[allow(deprecated)]
8874 ordinal => {
8875 for _ in 0..num_handles {
8876 decoder.drop_next_handle()?;
8877 }
8878 *self = DelegatedRxLeaseHandle::__SourceBreaking { unknown_ordinal: ordinal };
8879 }
8880 }
8881 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
8882 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8883 }
8884 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8885 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8886 }
8887 Ok(())
8888 }
8889 }
8890}