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