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#[derive(Debug, Clone)]
437pub struct DeviceProxy {
438 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
439}
440
441impl fidl::endpoints::Proxy for DeviceProxy {
442 type Protocol = DeviceMarker;
443
444 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
445 Self::new(inner)
446 }
447
448 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
449 self.client.into_channel().map_err(|client| Self { client })
450 }
451
452 fn as_channel(&self) -> &::fidl::AsyncChannel {
453 self.client.as_channel()
454 }
455}
456
457impl DeviceProxy {
458 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
460 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
461 Self { client: fidl::client::Client::new(channel, protocol_name) }
462 }
463
464 pub fn take_event_stream(&self) -> DeviceEventStream {
470 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
471 }
472
473 pub fn r#get_info(
477 &self,
478 ) -> fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
479 {
480 DeviceProxyInterface::r#get_info(self)
481 }
482
483 pub fn r#open_session(
498 &self,
499 mut session_name: &str,
500 mut session_info: SessionInfo,
501 ) -> fidl::client::QueryResponseFut<
502 DeviceOpenSessionResult,
503 fidl::encoding::DefaultFuchsiaResourceDialect,
504 > {
505 DeviceProxyInterface::r#open_session(self, session_name, session_info)
506 }
507
508 pub fn r#get_port(
516 &self,
517 mut id: &PortId,
518 mut port: fidl::endpoints::ServerEnd<PortMarker>,
519 ) -> Result<(), fidl::Error> {
520 DeviceProxyInterface::r#get_port(self, id, port)
521 }
522
523 pub fn r#get_port_watcher(
527 &self,
528 mut watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
529 ) -> Result<(), fidl::Error> {
530 DeviceProxyInterface::r#get_port_watcher(self, watcher)
531 }
532
533 pub fn r#clone(
537 &self,
538 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
539 ) -> Result<(), fidl::Error> {
540 DeviceProxyInterface::r#clone(self, device)
541 }
542}
543
544impl DeviceProxyInterface for DeviceProxy {
545 type GetInfoResponseFut =
546 fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
547 fn r#get_info(&self) -> Self::GetInfoResponseFut {
548 fn _decode(
549 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
550 ) -> Result<DeviceInfo, fidl::Error> {
551 let _response = fidl::client::decode_transaction_body::<
552 DeviceGetInfoResponse,
553 fidl::encoding::DefaultFuchsiaResourceDialect,
554 0x3c500ca9341e8f56,
555 >(_buf?)?;
556 Ok(_response.info)
557 }
558 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceInfo>(
559 (),
560 0x3c500ca9341e8f56,
561 fidl::encoding::DynamicFlags::empty(),
562 _decode,
563 )
564 }
565
566 type OpenSessionResponseFut = fidl::client::QueryResponseFut<
567 DeviceOpenSessionResult,
568 fidl::encoding::DefaultFuchsiaResourceDialect,
569 >;
570 fn r#open_session(
571 &self,
572 mut session_name: &str,
573 mut session_info: SessionInfo,
574 ) -> Self::OpenSessionResponseFut {
575 fn _decode(
576 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
577 ) -> Result<DeviceOpenSessionResult, fidl::Error> {
578 let _response = fidl::client::decode_transaction_body::<
579 fidl::encoding::ResultType<DeviceOpenSessionResponse, i32>,
580 fidl::encoding::DefaultFuchsiaResourceDialect,
581 0x25940b82146dcf67,
582 >(_buf?)?;
583 Ok(_response.map(|x| (x.session, x.fifos)))
584 }
585 self.client.send_query_and_decode::<DeviceOpenSessionRequest, DeviceOpenSessionResult>(
586 (session_name, &mut session_info),
587 0x25940b82146dcf67,
588 fidl::encoding::DynamicFlags::empty(),
589 _decode,
590 )
591 }
592
593 fn r#get_port(
594 &self,
595 mut id: &PortId,
596 mut port: fidl::endpoints::ServerEnd<PortMarker>,
597 ) -> Result<(), fidl::Error> {
598 self.client.send::<DeviceGetPortRequest>(
599 (id, port),
600 0x340a852c955ba2a6,
601 fidl::encoding::DynamicFlags::empty(),
602 )
603 }
604
605 fn r#get_port_watcher(
606 &self,
607 mut watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
608 ) -> Result<(), fidl::Error> {
609 self.client.send::<DeviceGetPortWatcherRequest>(
610 (watcher,),
611 0x104f43c937c39f0c,
612 fidl::encoding::DynamicFlags::empty(),
613 )
614 }
615
616 fn r#clone(
617 &self,
618 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
619 ) -> Result<(), fidl::Error> {
620 self.client.send::<DeviceCloneRequest>(
621 (device,),
622 0x5882ea09b3809af4,
623 fidl::encoding::DynamicFlags::empty(),
624 )
625 }
626}
627
628pub struct DeviceEventStream {
629 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
630}
631
632impl std::marker::Unpin for DeviceEventStream {}
633
634impl futures::stream::FusedStream for DeviceEventStream {
635 fn is_terminated(&self) -> bool {
636 self.event_receiver.is_terminated()
637 }
638}
639
640impl futures::Stream for DeviceEventStream {
641 type Item = Result<DeviceEvent, fidl::Error>;
642
643 fn poll_next(
644 mut self: std::pin::Pin<&mut Self>,
645 cx: &mut std::task::Context<'_>,
646 ) -> std::task::Poll<Option<Self::Item>> {
647 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
648 &mut self.event_receiver,
649 cx
650 )?) {
651 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
652 None => std::task::Poll::Ready(None),
653 }
654 }
655}
656
657#[derive(Debug)]
658pub enum DeviceEvent {}
659
660impl DeviceEvent {
661 fn decode(
663 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
664 ) -> Result<DeviceEvent, fidl::Error> {
665 let (bytes, _handles) = buf.split_mut();
666 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
667 debug_assert_eq!(tx_header.tx_id, 0);
668 match tx_header.ordinal {
669 _ => Err(fidl::Error::UnknownOrdinal {
670 ordinal: tx_header.ordinal,
671 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
672 }),
673 }
674 }
675}
676
677pub struct DeviceRequestStream {
679 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
680 is_terminated: bool,
681}
682
683impl std::marker::Unpin for DeviceRequestStream {}
684
685impl futures::stream::FusedStream for DeviceRequestStream {
686 fn is_terminated(&self) -> bool {
687 self.is_terminated
688 }
689}
690
691impl fidl::endpoints::RequestStream for DeviceRequestStream {
692 type Protocol = DeviceMarker;
693 type ControlHandle = DeviceControlHandle;
694
695 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
696 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
697 }
698
699 fn control_handle(&self) -> Self::ControlHandle {
700 DeviceControlHandle { inner: self.inner.clone() }
701 }
702
703 fn into_inner(
704 self,
705 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
706 {
707 (self.inner, self.is_terminated)
708 }
709
710 fn from_inner(
711 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
712 is_terminated: bool,
713 ) -> Self {
714 Self { inner, is_terminated }
715 }
716}
717
718impl futures::Stream for DeviceRequestStream {
719 type Item = Result<DeviceRequest, fidl::Error>;
720
721 fn poll_next(
722 mut self: std::pin::Pin<&mut Self>,
723 cx: &mut std::task::Context<'_>,
724 ) -> std::task::Poll<Option<Self::Item>> {
725 let this = &mut *self;
726 if this.inner.check_shutdown(cx) {
727 this.is_terminated = true;
728 return std::task::Poll::Ready(None);
729 }
730 if this.is_terminated {
731 panic!("polled DeviceRequestStream after completion");
732 }
733 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
734 |bytes, handles| {
735 match this.inner.channel().read_etc(cx, bytes, handles) {
736 std::task::Poll::Ready(Ok(())) => {}
737 std::task::Poll::Pending => return std::task::Poll::Pending,
738 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
739 this.is_terminated = true;
740 return std::task::Poll::Ready(None);
741 }
742 std::task::Poll::Ready(Err(e)) => {
743 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
744 e.into(),
745 ))))
746 }
747 }
748
749 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
751
752 std::task::Poll::Ready(Some(match header.ordinal {
753 0x3c500ca9341e8f56 => {
754 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
755 let mut req = fidl::new_empty!(
756 fidl::encoding::EmptyPayload,
757 fidl::encoding::DefaultFuchsiaResourceDialect
758 );
759 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
760 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
761 Ok(DeviceRequest::GetInfo {
762 responder: DeviceGetInfoResponder {
763 control_handle: std::mem::ManuallyDrop::new(control_handle),
764 tx_id: header.tx_id,
765 },
766 })
767 }
768 0x25940b82146dcf67 => {
769 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
770 let mut req = fidl::new_empty!(
771 DeviceOpenSessionRequest,
772 fidl::encoding::DefaultFuchsiaResourceDialect
773 );
774 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
775 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
776 Ok(DeviceRequest::OpenSession {
777 session_name: req.session_name,
778 session_info: req.session_info,
779
780 responder: DeviceOpenSessionResponder {
781 control_handle: std::mem::ManuallyDrop::new(control_handle),
782 tx_id: header.tx_id,
783 },
784 })
785 }
786 0x340a852c955ba2a6 => {
787 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
788 let mut req = fidl::new_empty!(
789 DeviceGetPortRequest,
790 fidl::encoding::DefaultFuchsiaResourceDialect
791 );
792 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetPortRequest>(&header, _body_bytes, handles, &mut req)?;
793 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
794 Ok(DeviceRequest::GetPort { id: req.id, port: req.port, control_handle })
795 }
796 0x104f43c937c39f0c => {
797 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
798 let mut req = fidl::new_empty!(
799 DeviceGetPortWatcherRequest,
800 fidl::encoding::DefaultFuchsiaResourceDialect
801 );
802 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetPortWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
803 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
804 Ok(DeviceRequest::GetPortWatcher { watcher: req.watcher, control_handle })
805 }
806 0x5882ea09b3809af4 => {
807 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
808 let mut req = fidl::new_empty!(
809 DeviceCloneRequest,
810 fidl::encoding::DefaultFuchsiaResourceDialect
811 );
812 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceCloneRequest>(&header, _body_bytes, handles, &mut req)?;
813 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
814 Ok(DeviceRequest::Clone { device: req.device, control_handle })
815 }
816 _ => Err(fidl::Error::UnknownOrdinal {
817 ordinal: header.ordinal,
818 protocol_name:
819 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
820 }),
821 }))
822 },
823 )
824 }
825}
826
827#[derive(Debug)]
829pub enum DeviceRequest {
830 GetInfo { responder: DeviceGetInfoResponder },
834 OpenSession {
849 session_name: String,
850 session_info: SessionInfo,
851 responder: DeviceOpenSessionResponder,
852 },
853 GetPort {
861 id: PortId,
862 port: fidl::endpoints::ServerEnd<PortMarker>,
863 control_handle: DeviceControlHandle,
864 },
865 GetPortWatcher {
869 watcher: fidl::endpoints::ServerEnd<PortWatcherMarker>,
870 control_handle: DeviceControlHandle,
871 },
872 Clone { device: fidl::endpoints::ServerEnd<DeviceMarker>, control_handle: DeviceControlHandle },
876}
877
878impl DeviceRequest {
879 #[allow(irrefutable_let_patterns)]
880 pub fn into_get_info(self) -> Option<(DeviceGetInfoResponder)> {
881 if let DeviceRequest::GetInfo { responder } = self {
882 Some((responder))
883 } else {
884 None
885 }
886 }
887
888 #[allow(irrefutable_let_patterns)]
889 pub fn into_open_session(self) -> Option<(String, SessionInfo, DeviceOpenSessionResponder)> {
890 if let DeviceRequest::OpenSession { session_name, session_info, responder } = self {
891 Some((session_name, session_info, responder))
892 } else {
893 None
894 }
895 }
896
897 #[allow(irrefutable_let_patterns)]
898 pub fn into_get_port(
899 self,
900 ) -> Option<(PortId, fidl::endpoints::ServerEnd<PortMarker>, DeviceControlHandle)> {
901 if let DeviceRequest::GetPort { id, port, control_handle } = self {
902 Some((id, port, control_handle))
903 } else {
904 None
905 }
906 }
907
908 #[allow(irrefutable_let_patterns)]
909 pub fn into_get_port_watcher(
910 self,
911 ) -> Option<(fidl::endpoints::ServerEnd<PortWatcherMarker>, DeviceControlHandle)> {
912 if let DeviceRequest::GetPortWatcher { watcher, control_handle } = self {
913 Some((watcher, control_handle))
914 } else {
915 None
916 }
917 }
918
919 #[allow(irrefutable_let_patterns)]
920 pub fn into_clone(
921 self,
922 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, DeviceControlHandle)> {
923 if let DeviceRequest::Clone { device, control_handle } = self {
924 Some((device, control_handle))
925 } else {
926 None
927 }
928 }
929
930 pub fn method_name(&self) -> &'static str {
932 match *self {
933 DeviceRequest::GetInfo { .. } => "get_info",
934 DeviceRequest::OpenSession { .. } => "open_session",
935 DeviceRequest::GetPort { .. } => "get_port",
936 DeviceRequest::GetPortWatcher { .. } => "get_port_watcher",
937 DeviceRequest::Clone { .. } => "clone",
938 }
939 }
940}
941
942#[derive(Debug, Clone)]
943pub struct DeviceControlHandle {
944 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
945}
946
947impl fidl::endpoints::ControlHandle for DeviceControlHandle {
948 fn shutdown(&self) {
949 self.inner.shutdown()
950 }
951 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
952 self.inner.shutdown_with_epitaph(status)
953 }
954
955 fn is_closed(&self) -> bool {
956 self.inner.channel().is_closed()
957 }
958 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
959 self.inner.channel().on_closed()
960 }
961
962 #[cfg(target_os = "fuchsia")]
963 fn signal_peer(
964 &self,
965 clear_mask: zx::Signals,
966 set_mask: zx::Signals,
967 ) -> Result<(), zx_status::Status> {
968 use fidl::Peered;
969 self.inner.channel().signal_peer(clear_mask, set_mask)
970 }
971}
972
973impl DeviceControlHandle {}
974
975#[must_use = "FIDL methods require a response to be sent"]
976#[derive(Debug)]
977pub struct DeviceGetInfoResponder {
978 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
979 tx_id: u32,
980}
981
982impl std::ops::Drop for DeviceGetInfoResponder {
986 fn drop(&mut self) {
987 self.control_handle.shutdown();
988 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
990 }
991}
992
993impl fidl::endpoints::Responder for DeviceGetInfoResponder {
994 type ControlHandle = DeviceControlHandle;
995
996 fn control_handle(&self) -> &DeviceControlHandle {
997 &self.control_handle
998 }
999
1000 fn drop_without_shutdown(mut self) {
1001 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1003 std::mem::forget(self);
1005 }
1006}
1007
1008impl DeviceGetInfoResponder {
1009 pub fn send(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
1013 let _result = self.send_raw(info);
1014 if _result.is_err() {
1015 self.control_handle.shutdown();
1016 }
1017 self.drop_without_shutdown();
1018 _result
1019 }
1020
1021 pub fn send_no_shutdown_on_err(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
1023 let _result = self.send_raw(info);
1024 self.drop_without_shutdown();
1025 _result
1026 }
1027
1028 fn send_raw(&self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
1029 self.control_handle.inner.send::<DeviceGetInfoResponse>(
1030 (info,),
1031 self.tx_id,
1032 0x3c500ca9341e8f56,
1033 fidl::encoding::DynamicFlags::empty(),
1034 )
1035 }
1036}
1037
1038#[must_use = "FIDL methods require a response to be sent"]
1039#[derive(Debug)]
1040pub struct DeviceOpenSessionResponder {
1041 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1042 tx_id: u32,
1043}
1044
1045impl std::ops::Drop for DeviceOpenSessionResponder {
1049 fn drop(&mut self) {
1050 self.control_handle.shutdown();
1051 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1053 }
1054}
1055
1056impl fidl::endpoints::Responder for DeviceOpenSessionResponder {
1057 type ControlHandle = DeviceControlHandle;
1058
1059 fn control_handle(&self) -> &DeviceControlHandle {
1060 &self.control_handle
1061 }
1062
1063 fn drop_without_shutdown(mut self) {
1064 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1066 std::mem::forget(self);
1068 }
1069}
1070
1071impl DeviceOpenSessionResponder {
1072 pub fn send(
1076 self,
1077 mut result: Result<(fidl::endpoints::ClientEnd<SessionMarker>, Fifos), i32>,
1078 ) -> Result<(), fidl::Error> {
1079 let _result = self.send_raw(result);
1080 if _result.is_err() {
1081 self.control_handle.shutdown();
1082 }
1083 self.drop_without_shutdown();
1084 _result
1085 }
1086
1087 pub fn send_no_shutdown_on_err(
1089 self,
1090 mut result: Result<(fidl::endpoints::ClientEnd<SessionMarker>, Fifos), i32>,
1091 ) -> Result<(), fidl::Error> {
1092 let _result = self.send_raw(result);
1093 self.drop_without_shutdown();
1094 _result
1095 }
1096
1097 fn send_raw(
1098 &self,
1099 mut result: Result<(fidl::endpoints::ClientEnd<SessionMarker>, Fifos), i32>,
1100 ) -> Result<(), fidl::Error> {
1101 self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceOpenSessionResponse, i32>>(
1102 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,)),
1103 self.tx_id,
1104 0x25940b82146dcf67,
1105 fidl::encoding::DynamicFlags::empty()
1106 )
1107 }
1108}
1109
1110#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1111pub struct DeviceInstanceMarker;
1112
1113impl fidl::endpoints::ProtocolMarker for DeviceInstanceMarker {
1114 type Proxy = DeviceInstanceProxy;
1115 type RequestStream = DeviceInstanceRequestStream;
1116 #[cfg(target_os = "fuchsia")]
1117 type SynchronousProxy = DeviceInstanceSynchronousProxy;
1118
1119 const DEBUG_NAME: &'static str = "(anonymous) DeviceInstance";
1120}
1121
1122pub trait DeviceInstanceProxyInterface: Send + Sync {
1123 fn r#get_device(
1124 &self,
1125 device: fidl::endpoints::ServerEnd<DeviceMarker>,
1126 ) -> Result<(), fidl::Error>;
1127}
1128#[derive(Debug)]
1129#[cfg(target_os = "fuchsia")]
1130pub struct DeviceInstanceSynchronousProxy {
1131 client: fidl::client::sync::Client,
1132}
1133
1134#[cfg(target_os = "fuchsia")]
1135impl fidl::endpoints::SynchronousProxy for DeviceInstanceSynchronousProxy {
1136 type Proxy = DeviceInstanceProxy;
1137 type Protocol = DeviceInstanceMarker;
1138
1139 fn from_channel(inner: fidl::Channel) -> Self {
1140 Self::new(inner)
1141 }
1142
1143 fn into_channel(self) -> fidl::Channel {
1144 self.client.into_channel()
1145 }
1146
1147 fn as_channel(&self) -> &fidl::Channel {
1148 self.client.as_channel()
1149 }
1150}
1151
1152#[cfg(target_os = "fuchsia")]
1153impl DeviceInstanceSynchronousProxy {
1154 pub fn new(channel: fidl::Channel) -> Self {
1155 let protocol_name = <DeviceInstanceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1156 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1157 }
1158
1159 pub fn into_channel(self) -> fidl::Channel {
1160 self.client.into_channel()
1161 }
1162
1163 pub fn wait_for_event(
1166 &self,
1167 deadline: zx::MonotonicInstant,
1168 ) -> Result<DeviceInstanceEvent, fidl::Error> {
1169 DeviceInstanceEvent::decode(self.client.wait_for_event(deadline)?)
1170 }
1171
1172 pub fn r#get_device(
1176 &self,
1177 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
1178 ) -> Result<(), fidl::Error> {
1179 self.client.send::<DeviceInstanceGetDeviceRequest>(
1180 (device,),
1181 0x775270585575cef7,
1182 fidl::encoding::DynamicFlags::empty(),
1183 )
1184 }
1185}
1186
1187#[cfg(target_os = "fuchsia")]
1188impl From<DeviceInstanceSynchronousProxy> for zx::Handle {
1189 fn from(value: DeviceInstanceSynchronousProxy) -> Self {
1190 value.into_channel().into()
1191 }
1192}
1193
1194#[cfg(target_os = "fuchsia")]
1195impl From<fidl::Channel> for DeviceInstanceSynchronousProxy {
1196 fn from(value: fidl::Channel) -> Self {
1197 Self::new(value)
1198 }
1199}
1200
1201#[derive(Debug, Clone)]
1202pub struct DeviceInstanceProxy {
1203 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1204}
1205
1206impl fidl::endpoints::Proxy for DeviceInstanceProxy {
1207 type Protocol = DeviceInstanceMarker;
1208
1209 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1210 Self::new(inner)
1211 }
1212
1213 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1214 self.client.into_channel().map_err(|client| Self { client })
1215 }
1216
1217 fn as_channel(&self) -> &::fidl::AsyncChannel {
1218 self.client.as_channel()
1219 }
1220}
1221
1222impl DeviceInstanceProxy {
1223 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1225 let protocol_name = <DeviceInstanceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1226 Self { client: fidl::client::Client::new(channel, protocol_name) }
1227 }
1228
1229 pub fn take_event_stream(&self) -> DeviceInstanceEventStream {
1235 DeviceInstanceEventStream { event_receiver: self.client.take_event_receiver() }
1236 }
1237
1238 pub fn r#get_device(
1242 &self,
1243 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
1244 ) -> Result<(), fidl::Error> {
1245 DeviceInstanceProxyInterface::r#get_device(self, device)
1246 }
1247}
1248
1249impl DeviceInstanceProxyInterface for DeviceInstanceProxy {
1250 fn r#get_device(
1251 &self,
1252 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
1253 ) -> Result<(), fidl::Error> {
1254 self.client.send::<DeviceInstanceGetDeviceRequest>(
1255 (device,),
1256 0x775270585575cef7,
1257 fidl::encoding::DynamicFlags::empty(),
1258 )
1259 }
1260}
1261
1262pub struct DeviceInstanceEventStream {
1263 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1264}
1265
1266impl std::marker::Unpin for DeviceInstanceEventStream {}
1267
1268impl futures::stream::FusedStream for DeviceInstanceEventStream {
1269 fn is_terminated(&self) -> bool {
1270 self.event_receiver.is_terminated()
1271 }
1272}
1273
1274impl futures::Stream for DeviceInstanceEventStream {
1275 type Item = Result<DeviceInstanceEvent, fidl::Error>;
1276
1277 fn poll_next(
1278 mut self: std::pin::Pin<&mut Self>,
1279 cx: &mut std::task::Context<'_>,
1280 ) -> std::task::Poll<Option<Self::Item>> {
1281 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1282 &mut self.event_receiver,
1283 cx
1284 )?) {
1285 Some(buf) => std::task::Poll::Ready(Some(DeviceInstanceEvent::decode(buf))),
1286 None => std::task::Poll::Ready(None),
1287 }
1288 }
1289}
1290
1291#[derive(Debug)]
1292pub enum DeviceInstanceEvent {}
1293
1294impl DeviceInstanceEvent {
1295 fn decode(
1297 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1298 ) -> Result<DeviceInstanceEvent, fidl::Error> {
1299 let (bytes, _handles) = buf.split_mut();
1300 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1301 debug_assert_eq!(tx_header.tx_id, 0);
1302 match tx_header.ordinal {
1303 _ => Err(fidl::Error::UnknownOrdinal {
1304 ordinal: tx_header.ordinal,
1305 protocol_name:
1306 <DeviceInstanceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1307 }),
1308 }
1309 }
1310}
1311
1312pub struct DeviceInstanceRequestStream {
1314 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1315 is_terminated: bool,
1316}
1317
1318impl std::marker::Unpin for DeviceInstanceRequestStream {}
1319
1320impl futures::stream::FusedStream for DeviceInstanceRequestStream {
1321 fn is_terminated(&self) -> bool {
1322 self.is_terminated
1323 }
1324}
1325
1326impl fidl::endpoints::RequestStream for DeviceInstanceRequestStream {
1327 type Protocol = DeviceInstanceMarker;
1328 type ControlHandle = DeviceInstanceControlHandle;
1329
1330 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1331 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1332 }
1333
1334 fn control_handle(&self) -> Self::ControlHandle {
1335 DeviceInstanceControlHandle { inner: self.inner.clone() }
1336 }
1337
1338 fn into_inner(
1339 self,
1340 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1341 {
1342 (self.inner, self.is_terminated)
1343 }
1344
1345 fn from_inner(
1346 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1347 is_terminated: bool,
1348 ) -> Self {
1349 Self { inner, is_terminated }
1350 }
1351}
1352
1353impl futures::Stream for DeviceInstanceRequestStream {
1354 type Item = Result<DeviceInstanceRequest, fidl::Error>;
1355
1356 fn poll_next(
1357 mut self: std::pin::Pin<&mut Self>,
1358 cx: &mut std::task::Context<'_>,
1359 ) -> std::task::Poll<Option<Self::Item>> {
1360 let this = &mut *self;
1361 if this.inner.check_shutdown(cx) {
1362 this.is_terminated = true;
1363 return std::task::Poll::Ready(None);
1364 }
1365 if this.is_terminated {
1366 panic!("polled DeviceInstanceRequestStream after completion");
1367 }
1368 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1369 |bytes, handles| {
1370 match this.inner.channel().read_etc(cx, bytes, handles) {
1371 std::task::Poll::Ready(Ok(())) => {}
1372 std::task::Poll::Pending => return std::task::Poll::Pending,
1373 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1374 this.is_terminated = true;
1375 return std::task::Poll::Ready(None);
1376 }
1377 std::task::Poll::Ready(Err(e)) => {
1378 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1379 e.into(),
1380 ))))
1381 }
1382 }
1383
1384 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1386
1387 std::task::Poll::Ready(Some(match header.ordinal {
1388 0x775270585575cef7 => {
1389 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1390 let mut req = fidl::new_empty!(
1391 DeviceInstanceGetDeviceRequest,
1392 fidl::encoding::DefaultFuchsiaResourceDialect
1393 );
1394 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceInstanceGetDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
1395 let control_handle =
1396 DeviceInstanceControlHandle { inner: this.inner.clone() };
1397 Ok(DeviceInstanceRequest::GetDevice { device: req.device, control_handle })
1398 }
1399 _ => Err(fidl::Error::UnknownOrdinal {
1400 ordinal: header.ordinal,
1401 protocol_name:
1402 <DeviceInstanceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1403 }),
1404 }))
1405 },
1406 )
1407 }
1408}
1409
1410#[derive(Debug)]
1412pub enum DeviceInstanceRequest {
1413 GetDevice {
1417 device: fidl::endpoints::ServerEnd<DeviceMarker>,
1418 control_handle: DeviceInstanceControlHandle,
1419 },
1420}
1421
1422impl DeviceInstanceRequest {
1423 #[allow(irrefutable_let_patterns)]
1424 pub fn into_get_device(
1425 self,
1426 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, DeviceInstanceControlHandle)> {
1427 if let DeviceInstanceRequest::GetDevice { device, control_handle } = self {
1428 Some((device, control_handle))
1429 } else {
1430 None
1431 }
1432 }
1433
1434 pub fn method_name(&self) -> &'static str {
1436 match *self {
1437 DeviceInstanceRequest::GetDevice { .. } => "get_device",
1438 }
1439 }
1440}
1441
1442#[derive(Debug, Clone)]
1443pub struct DeviceInstanceControlHandle {
1444 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1445}
1446
1447impl fidl::endpoints::ControlHandle for DeviceInstanceControlHandle {
1448 fn shutdown(&self) {
1449 self.inner.shutdown()
1450 }
1451 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1452 self.inner.shutdown_with_epitaph(status)
1453 }
1454
1455 fn is_closed(&self) -> bool {
1456 self.inner.channel().is_closed()
1457 }
1458 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1459 self.inner.channel().on_closed()
1460 }
1461
1462 #[cfg(target_os = "fuchsia")]
1463 fn signal_peer(
1464 &self,
1465 clear_mask: zx::Signals,
1466 set_mask: zx::Signals,
1467 ) -> Result<(), zx_status::Status> {
1468 use fidl::Peered;
1469 self.inner.channel().signal_peer(clear_mask, set_mask)
1470 }
1471}
1472
1473impl DeviceInstanceControlHandle {}
1474
1475#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1476pub struct DiagnosticsMarker;
1477
1478impl fidl::endpoints::ProtocolMarker for DiagnosticsMarker {
1479 type Proxy = DiagnosticsProxy;
1480 type RequestStream = DiagnosticsRequestStream;
1481 #[cfg(target_os = "fuchsia")]
1482 type SynchronousProxy = DiagnosticsSynchronousProxy;
1483
1484 const DEBUG_NAME: &'static str = "(anonymous) Diagnostics";
1485}
1486
1487pub trait DiagnosticsProxyInterface: Send + Sync {
1488 type LogDebugInfoToSyslogResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1489 + Send;
1490 fn r#log_debug_info_to_syslog(&self) -> Self::LogDebugInfoToSyslogResponseFut;
1491}
1492#[derive(Debug)]
1493#[cfg(target_os = "fuchsia")]
1494pub struct DiagnosticsSynchronousProxy {
1495 client: fidl::client::sync::Client,
1496}
1497
1498#[cfg(target_os = "fuchsia")]
1499impl fidl::endpoints::SynchronousProxy for DiagnosticsSynchronousProxy {
1500 type Proxy = DiagnosticsProxy;
1501 type Protocol = DiagnosticsMarker;
1502
1503 fn from_channel(inner: fidl::Channel) -> Self {
1504 Self::new(inner)
1505 }
1506
1507 fn into_channel(self) -> fidl::Channel {
1508 self.client.into_channel()
1509 }
1510
1511 fn as_channel(&self) -> &fidl::Channel {
1512 self.client.as_channel()
1513 }
1514}
1515
1516#[cfg(target_os = "fuchsia")]
1517impl DiagnosticsSynchronousProxy {
1518 pub fn new(channel: fidl::Channel) -> Self {
1519 let protocol_name = <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1520 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1521 }
1522
1523 pub fn into_channel(self) -> fidl::Channel {
1524 self.client.into_channel()
1525 }
1526
1527 pub fn wait_for_event(
1530 &self,
1531 deadline: zx::MonotonicInstant,
1532 ) -> Result<DiagnosticsEvent, fidl::Error> {
1533 DiagnosticsEvent::decode(self.client.wait_for_event(deadline)?)
1534 }
1535
1536 pub fn r#log_debug_info_to_syslog(
1541 &self,
1542 ___deadline: zx::MonotonicInstant,
1543 ) -> Result<(), fidl::Error> {
1544 let _response =
1545 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
1546 (),
1547 0x4222897dfe1f4b4a,
1548 fidl::encoding::DynamicFlags::empty(),
1549 ___deadline,
1550 )?;
1551 Ok(_response)
1552 }
1553}
1554
1555#[cfg(target_os = "fuchsia")]
1556impl From<DiagnosticsSynchronousProxy> for zx::Handle {
1557 fn from(value: DiagnosticsSynchronousProxy) -> Self {
1558 value.into_channel().into()
1559 }
1560}
1561
1562#[cfg(target_os = "fuchsia")]
1563impl From<fidl::Channel> for DiagnosticsSynchronousProxy {
1564 fn from(value: fidl::Channel) -> Self {
1565 Self::new(value)
1566 }
1567}
1568
1569#[derive(Debug, Clone)]
1570pub struct DiagnosticsProxy {
1571 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1572}
1573
1574impl fidl::endpoints::Proxy for DiagnosticsProxy {
1575 type Protocol = DiagnosticsMarker;
1576
1577 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1578 Self::new(inner)
1579 }
1580
1581 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1582 self.client.into_channel().map_err(|client| Self { client })
1583 }
1584
1585 fn as_channel(&self) -> &::fidl::AsyncChannel {
1586 self.client.as_channel()
1587 }
1588}
1589
1590impl DiagnosticsProxy {
1591 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1593 let protocol_name = <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1594 Self { client: fidl::client::Client::new(channel, protocol_name) }
1595 }
1596
1597 pub fn take_event_stream(&self) -> DiagnosticsEventStream {
1603 DiagnosticsEventStream { event_receiver: self.client.take_event_receiver() }
1604 }
1605
1606 pub fn r#log_debug_info_to_syslog(
1611 &self,
1612 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1613 DiagnosticsProxyInterface::r#log_debug_info_to_syslog(self)
1614 }
1615}
1616
1617impl DiagnosticsProxyInterface for DiagnosticsProxy {
1618 type LogDebugInfoToSyslogResponseFut =
1619 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1620 fn r#log_debug_info_to_syslog(&self) -> Self::LogDebugInfoToSyslogResponseFut {
1621 fn _decode(
1622 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1623 ) -> Result<(), fidl::Error> {
1624 let _response = fidl::client::decode_transaction_body::<
1625 fidl::encoding::EmptyPayload,
1626 fidl::encoding::DefaultFuchsiaResourceDialect,
1627 0x4222897dfe1f4b4a,
1628 >(_buf?)?;
1629 Ok(_response)
1630 }
1631 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1632 (),
1633 0x4222897dfe1f4b4a,
1634 fidl::encoding::DynamicFlags::empty(),
1635 _decode,
1636 )
1637 }
1638}
1639
1640pub struct DiagnosticsEventStream {
1641 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1642}
1643
1644impl std::marker::Unpin for DiagnosticsEventStream {}
1645
1646impl futures::stream::FusedStream for DiagnosticsEventStream {
1647 fn is_terminated(&self) -> bool {
1648 self.event_receiver.is_terminated()
1649 }
1650}
1651
1652impl futures::Stream for DiagnosticsEventStream {
1653 type Item = Result<DiagnosticsEvent, fidl::Error>;
1654
1655 fn poll_next(
1656 mut self: std::pin::Pin<&mut Self>,
1657 cx: &mut std::task::Context<'_>,
1658 ) -> std::task::Poll<Option<Self::Item>> {
1659 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1660 &mut self.event_receiver,
1661 cx
1662 )?) {
1663 Some(buf) => std::task::Poll::Ready(Some(DiagnosticsEvent::decode(buf))),
1664 None => std::task::Poll::Ready(None),
1665 }
1666 }
1667}
1668
1669#[derive(Debug)]
1670pub enum DiagnosticsEvent {}
1671
1672impl DiagnosticsEvent {
1673 fn decode(
1675 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1676 ) -> Result<DiagnosticsEvent, fidl::Error> {
1677 let (bytes, _handles) = buf.split_mut();
1678 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1679 debug_assert_eq!(tx_header.tx_id, 0);
1680 match tx_header.ordinal {
1681 _ => Err(fidl::Error::UnknownOrdinal {
1682 ordinal: tx_header.ordinal,
1683 protocol_name: <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1684 }),
1685 }
1686 }
1687}
1688
1689pub struct DiagnosticsRequestStream {
1691 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1692 is_terminated: bool,
1693}
1694
1695impl std::marker::Unpin for DiagnosticsRequestStream {}
1696
1697impl futures::stream::FusedStream for DiagnosticsRequestStream {
1698 fn is_terminated(&self) -> bool {
1699 self.is_terminated
1700 }
1701}
1702
1703impl fidl::endpoints::RequestStream for DiagnosticsRequestStream {
1704 type Protocol = DiagnosticsMarker;
1705 type ControlHandle = DiagnosticsControlHandle;
1706
1707 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1708 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1709 }
1710
1711 fn control_handle(&self) -> Self::ControlHandle {
1712 DiagnosticsControlHandle { inner: self.inner.clone() }
1713 }
1714
1715 fn into_inner(
1716 self,
1717 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1718 {
1719 (self.inner, self.is_terminated)
1720 }
1721
1722 fn from_inner(
1723 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1724 is_terminated: bool,
1725 ) -> Self {
1726 Self { inner, is_terminated }
1727 }
1728}
1729
1730impl futures::Stream for DiagnosticsRequestStream {
1731 type Item = Result<DiagnosticsRequest, fidl::Error>;
1732
1733 fn poll_next(
1734 mut self: std::pin::Pin<&mut Self>,
1735 cx: &mut std::task::Context<'_>,
1736 ) -> std::task::Poll<Option<Self::Item>> {
1737 let this = &mut *self;
1738 if this.inner.check_shutdown(cx) {
1739 this.is_terminated = true;
1740 return std::task::Poll::Ready(None);
1741 }
1742 if this.is_terminated {
1743 panic!("polled DiagnosticsRequestStream after completion");
1744 }
1745 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1746 |bytes, handles| {
1747 match this.inner.channel().read_etc(cx, bytes, handles) {
1748 std::task::Poll::Ready(Ok(())) => {}
1749 std::task::Poll::Pending => return std::task::Poll::Pending,
1750 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1751 this.is_terminated = true;
1752 return std::task::Poll::Ready(None);
1753 }
1754 std::task::Poll::Ready(Err(e)) => {
1755 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1756 e.into(),
1757 ))))
1758 }
1759 }
1760
1761 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1763
1764 std::task::Poll::Ready(Some(match header.ordinal {
1765 0x4222897dfe1f4b4a => {
1766 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1767 let mut req = fidl::new_empty!(
1768 fidl::encoding::EmptyPayload,
1769 fidl::encoding::DefaultFuchsiaResourceDialect
1770 );
1771 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1772 let control_handle = DiagnosticsControlHandle { inner: this.inner.clone() };
1773 Ok(DiagnosticsRequest::LogDebugInfoToSyslog {
1774 responder: DiagnosticsLogDebugInfoToSyslogResponder {
1775 control_handle: std::mem::ManuallyDrop::new(control_handle),
1776 tx_id: header.tx_id,
1777 },
1778 })
1779 }
1780 _ => Err(fidl::Error::UnknownOrdinal {
1781 ordinal: header.ordinal,
1782 protocol_name:
1783 <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1784 }),
1785 }))
1786 },
1787 )
1788 }
1789}
1790
1791#[derive(Debug)]
1794pub enum DiagnosticsRequest {
1795 LogDebugInfoToSyslog { responder: DiagnosticsLogDebugInfoToSyslogResponder },
1800}
1801
1802impl DiagnosticsRequest {
1803 #[allow(irrefutable_let_patterns)]
1804 pub fn into_log_debug_info_to_syslog(
1805 self,
1806 ) -> Option<(DiagnosticsLogDebugInfoToSyslogResponder)> {
1807 if let DiagnosticsRequest::LogDebugInfoToSyslog { responder } = self {
1808 Some((responder))
1809 } else {
1810 None
1811 }
1812 }
1813
1814 pub fn method_name(&self) -> &'static str {
1816 match *self {
1817 DiagnosticsRequest::LogDebugInfoToSyslog { .. } => "log_debug_info_to_syslog",
1818 }
1819 }
1820}
1821
1822#[derive(Debug, Clone)]
1823pub struct DiagnosticsControlHandle {
1824 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1825}
1826
1827impl fidl::endpoints::ControlHandle for DiagnosticsControlHandle {
1828 fn shutdown(&self) {
1829 self.inner.shutdown()
1830 }
1831 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1832 self.inner.shutdown_with_epitaph(status)
1833 }
1834
1835 fn is_closed(&self) -> bool {
1836 self.inner.channel().is_closed()
1837 }
1838 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1839 self.inner.channel().on_closed()
1840 }
1841
1842 #[cfg(target_os = "fuchsia")]
1843 fn signal_peer(
1844 &self,
1845 clear_mask: zx::Signals,
1846 set_mask: zx::Signals,
1847 ) -> Result<(), zx_status::Status> {
1848 use fidl::Peered;
1849 self.inner.channel().signal_peer(clear_mask, set_mask)
1850 }
1851}
1852
1853impl DiagnosticsControlHandle {}
1854
1855#[must_use = "FIDL methods require a response to be sent"]
1856#[derive(Debug)]
1857pub struct DiagnosticsLogDebugInfoToSyslogResponder {
1858 control_handle: std::mem::ManuallyDrop<DiagnosticsControlHandle>,
1859 tx_id: u32,
1860}
1861
1862impl std::ops::Drop for DiagnosticsLogDebugInfoToSyslogResponder {
1866 fn drop(&mut self) {
1867 self.control_handle.shutdown();
1868 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1870 }
1871}
1872
1873impl fidl::endpoints::Responder for DiagnosticsLogDebugInfoToSyslogResponder {
1874 type ControlHandle = DiagnosticsControlHandle;
1875
1876 fn control_handle(&self) -> &DiagnosticsControlHandle {
1877 &self.control_handle
1878 }
1879
1880 fn drop_without_shutdown(mut self) {
1881 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1883 std::mem::forget(self);
1885 }
1886}
1887
1888impl DiagnosticsLogDebugInfoToSyslogResponder {
1889 pub fn send(self) -> Result<(), fidl::Error> {
1893 let _result = self.send_raw();
1894 if _result.is_err() {
1895 self.control_handle.shutdown();
1896 }
1897 self.drop_without_shutdown();
1898 _result
1899 }
1900
1901 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1903 let _result = self.send_raw();
1904 self.drop_without_shutdown();
1905 _result
1906 }
1907
1908 fn send_raw(&self) -> Result<(), fidl::Error> {
1909 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1910 (),
1911 self.tx_id,
1912 0x4222897dfe1f4b4a,
1913 fidl::encoding::DynamicFlags::empty(),
1914 )
1915 }
1916}
1917
1918#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1919pub struct MacAddressingMarker;
1920
1921impl fidl::endpoints::ProtocolMarker for MacAddressingMarker {
1922 type Proxy = MacAddressingProxy;
1923 type RequestStream = MacAddressingRequestStream;
1924 #[cfg(target_os = "fuchsia")]
1925 type SynchronousProxy = MacAddressingSynchronousProxy;
1926
1927 const DEBUG_NAME: &'static str = "(anonymous) MacAddressing";
1928}
1929
1930pub trait MacAddressingProxyInterface: Send + Sync {
1931 type GetUnicastAddressResponseFut: std::future::Future<Output = Result<fidl_fuchsia_net::MacAddress, fidl::Error>>
1932 + Send;
1933 fn r#get_unicast_address(&self) -> Self::GetUnicastAddressResponseFut;
1934 type SetModeResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1935 fn r#set_mode(&self, mode: MacFilterMode) -> Self::SetModeResponseFut;
1936 type AddMulticastAddressResponseFut: std::future::Future<Output = Result<i32, fidl::Error>>
1937 + Send;
1938 fn r#add_multicast_address(
1939 &self,
1940 address: &fidl_fuchsia_net::MacAddress,
1941 ) -> Self::AddMulticastAddressResponseFut;
1942 type RemoveMulticastAddressResponseFut: std::future::Future<Output = Result<i32, fidl::Error>>
1943 + Send;
1944 fn r#remove_multicast_address(
1945 &self,
1946 address: &fidl_fuchsia_net::MacAddress,
1947 ) -> Self::RemoveMulticastAddressResponseFut;
1948}
1949#[derive(Debug)]
1950#[cfg(target_os = "fuchsia")]
1951pub struct MacAddressingSynchronousProxy {
1952 client: fidl::client::sync::Client,
1953}
1954
1955#[cfg(target_os = "fuchsia")]
1956impl fidl::endpoints::SynchronousProxy for MacAddressingSynchronousProxy {
1957 type Proxy = MacAddressingProxy;
1958 type Protocol = MacAddressingMarker;
1959
1960 fn from_channel(inner: fidl::Channel) -> Self {
1961 Self::new(inner)
1962 }
1963
1964 fn into_channel(self) -> fidl::Channel {
1965 self.client.into_channel()
1966 }
1967
1968 fn as_channel(&self) -> &fidl::Channel {
1969 self.client.as_channel()
1970 }
1971}
1972
1973#[cfg(target_os = "fuchsia")]
1974impl MacAddressingSynchronousProxy {
1975 pub fn new(channel: fidl::Channel) -> Self {
1976 let protocol_name = <MacAddressingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1977 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1978 }
1979
1980 pub fn into_channel(self) -> fidl::Channel {
1981 self.client.into_channel()
1982 }
1983
1984 pub fn wait_for_event(
1987 &self,
1988 deadline: zx::MonotonicInstant,
1989 ) -> Result<MacAddressingEvent, fidl::Error> {
1990 MacAddressingEvent::decode(self.client.wait_for_event(deadline)?)
1991 }
1992
1993 pub fn r#get_unicast_address(
2004 &self,
2005 ___deadline: zx::MonotonicInstant,
2006 ) -> Result<fidl_fuchsia_net::MacAddress, fidl::Error> {
2007 let _response = self
2008 .client
2009 .send_query::<fidl::encoding::EmptyPayload, MacAddressingGetUnicastAddressResponse>(
2010 (),
2011 0x2c60b82a4ecfaebe,
2012 fidl::encoding::DynamicFlags::empty(),
2013 ___deadline,
2014 )?;
2015 Ok(_response.address)
2016 }
2017
2018 pub fn r#set_mode(
2038 &self,
2039 mut mode: MacFilterMode,
2040 ___deadline: zx::MonotonicInstant,
2041 ) -> Result<i32, fidl::Error> {
2042 let _response =
2043 self.client.send_query::<MacAddressingSetModeRequest, MacAddressingSetModeResponse>(
2044 (mode,),
2045 0x6297b8dbf03c58c,
2046 fidl::encoding::DynamicFlags::empty(),
2047 ___deadline,
2048 )?;
2049 Ok(_response.status)
2050 }
2051
2052 pub fn r#add_multicast_address(
2062 &self,
2063 mut address: &fidl_fuchsia_net::MacAddress,
2064 ___deadline: zx::MonotonicInstant,
2065 ) -> Result<i32, fidl::Error> {
2066 let _response = self.client.send_query::<
2067 MacAddressingAddMulticastAddressRequest,
2068 MacAddressingAddMulticastAddressResponse,
2069 >(
2070 (address,),
2071 0xf5637ff11cf0c25,
2072 fidl::encoding::DynamicFlags::empty(),
2073 ___deadline,
2074 )?;
2075 Ok(_response.status)
2076 }
2077
2078 pub fn r#remove_multicast_address(
2084 &self,
2085 mut address: &fidl_fuchsia_net::MacAddress,
2086 ___deadline: zx::MonotonicInstant,
2087 ) -> Result<i32, fidl::Error> {
2088 let _response = self.client.send_query::<
2089 MacAddressingRemoveMulticastAddressRequest,
2090 MacAddressingRemoveMulticastAddressResponse,
2091 >(
2092 (address,),
2093 0x5dddf4e3ba4e2560,
2094 fidl::encoding::DynamicFlags::empty(),
2095 ___deadline,
2096 )?;
2097 Ok(_response.status)
2098 }
2099}
2100
2101#[cfg(target_os = "fuchsia")]
2102impl From<MacAddressingSynchronousProxy> for zx::Handle {
2103 fn from(value: MacAddressingSynchronousProxy) -> Self {
2104 value.into_channel().into()
2105 }
2106}
2107
2108#[cfg(target_os = "fuchsia")]
2109impl From<fidl::Channel> for MacAddressingSynchronousProxy {
2110 fn from(value: fidl::Channel) -> Self {
2111 Self::new(value)
2112 }
2113}
2114
2115#[derive(Debug, Clone)]
2116pub struct MacAddressingProxy {
2117 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2118}
2119
2120impl fidl::endpoints::Proxy for MacAddressingProxy {
2121 type Protocol = MacAddressingMarker;
2122
2123 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2124 Self::new(inner)
2125 }
2126
2127 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2128 self.client.into_channel().map_err(|client| Self { client })
2129 }
2130
2131 fn as_channel(&self) -> &::fidl::AsyncChannel {
2132 self.client.as_channel()
2133 }
2134}
2135
2136impl MacAddressingProxy {
2137 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2139 let protocol_name = <MacAddressingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2140 Self { client: fidl::client::Client::new(channel, protocol_name) }
2141 }
2142
2143 pub fn take_event_stream(&self) -> MacAddressingEventStream {
2149 MacAddressingEventStream { event_receiver: self.client.take_event_receiver() }
2150 }
2151
2152 pub fn r#get_unicast_address(
2163 &self,
2164 ) -> fidl::client::QueryResponseFut<
2165 fidl_fuchsia_net::MacAddress,
2166 fidl::encoding::DefaultFuchsiaResourceDialect,
2167 > {
2168 MacAddressingProxyInterface::r#get_unicast_address(self)
2169 }
2170
2171 pub fn r#set_mode(
2191 &self,
2192 mut mode: MacFilterMode,
2193 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2194 MacAddressingProxyInterface::r#set_mode(self, mode)
2195 }
2196
2197 pub fn r#add_multicast_address(
2207 &self,
2208 mut address: &fidl_fuchsia_net::MacAddress,
2209 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2210 MacAddressingProxyInterface::r#add_multicast_address(self, address)
2211 }
2212
2213 pub fn r#remove_multicast_address(
2219 &self,
2220 mut address: &fidl_fuchsia_net::MacAddress,
2221 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2222 MacAddressingProxyInterface::r#remove_multicast_address(self, address)
2223 }
2224}
2225
2226impl MacAddressingProxyInterface for MacAddressingProxy {
2227 type GetUnicastAddressResponseFut = fidl::client::QueryResponseFut<
2228 fidl_fuchsia_net::MacAddress,
2229 fidl::encoding::DefaultFuchsiaResourceDialect,
2230 >;
2231 fn r#get_unicast_address(&self) -> Self::GetUnicastAddressResponseFut {
2232 fn _decode(
2233 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2234 ) -> Result<fidl_fuchsia_net::MacAddress, fidl::Error> {
2235 let _response = fidl::client::decode_transaction_body::<
2236 MacAddressingGetUnicastAddressResponse,
2237 fidl::encoding::DefaultFuchsiaResourceDialect,
2238 0x2c60b82a4ecfaebe,
2239 >(_buf?)?;
2240 Ok(_response.address)
2241 }
2242 self.client
2243 .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_net::MacAddress>(
2244 (),
2245 0x2c60b82a4ecfaebe,
2246 fidl::encoding::DynamicFlags::empty(),
2247 _decode,
2248 )
2249 }
2250
2251 type SetModeResponseFut =
2252 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2253 fn r#set_mode(&self, mut mode: MacFilterMode) -> Self::SetModeResponseFut {
2254 fn _decode(
2255 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2256 ) -> Result<i32, fidl::Error> {
2257 let _response = fidl::client::decode_transaction_body::<
2258 MacAddressingSetModeResponse,
2259 fidl::encoding::DefaultFuchsiaResourceDialect,
2260 0x6297b8dbf03c58c,
2261 >(_buf?)?;
2262 Ok(_response.status)
2263 }
2264 self.client.send_query_and_decode::<MacAddressingSetModeRequest, i32>(
2265 (mode,),
2266 0x6297b8dbf03c58c,
2267 fidl::encoding::DynamicFlags::empty(),
2268 _decode,
2269 )
2270 }
2271
2272 type AddMulticastAddressResponseFut =
2273 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2274 fn r#add_multicast_address(
2275 &self,
2276 mut address: &fidl_fuchsia_net::MacAddress,
2277 ) -> Self::AddMulticastAddressResponseFut {
2278 fn _decode(
2279 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2280 ) -> Result<i32, fidl::Error> {
2281 let _response = fidl::client::decode_transaction_body::<
2282 MacAddressingAddMulticastAddressResponse,
2283 fidl::encoding::DefaultFuchsiaResourceDialect,
2284 0xf5637ff11cf0c25,
2285 >(_buf?)?;
2286 Ok(_response.status)
2287 }
2288 self.client.send_query_and_decode::<MacAddressingAddMulticastAddressRequest, i32>(
2289 (address,),
2290 0xf5637ff11cf0c25,
2291 fidl::encoding::DynamicFlags::empty(),
2292 _decode,
2293 )
2294 }
2295
2296 type RemoveMulticastAddressResponseFut =
2297 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2298 fn r#remove_multicast_address(
2299 &self,
2300 mut address: &fidl_fuchsia_net::MacAddress,
2301 ) -> Self::RemoveMulticastAddressResponseFut {
2302 fn _decode(
2303 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2304 ) -> Result<i32, fidl::Error> {
2305 let _response = fidl::client::decode_transaction_body::<
2306 MacAddressingRemoveMulticastAddressResponse,
2307 fidl::encoding::DefaultFuchsiaResourceDialect,
2308 0x5dddf4e3ba4e2560,
2309 >(_buf?)?;
2310 Ok(_response.status)
2311 }
2312 self.client.send_query_and_decode::<MacAddressingRemoveMulticastAddressRequest, i32>(
2313 (address,),
2314 0x5dddf4e3ba4e2560,
2315 fidl::encoding::DynamicFlags::empty(),
2316 _decode,
2317 )
2318 }
2319}
2320
2321pub struct MacAddressingEventStream {
2322 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2323}
2324
2325impl std::marker::Unpin for MacAddressingEventStream {}
2326
2327impl futures::stream::FusedStream for MacAddressingEventStream {
2328 fn is_terminated(&self) -> bool {
2329 self.event_receiver.is_terminated()
2330 }
2331}
2332
2333impl futures::Stream for MacAddressingEventStream {
2334 type Item = Result<MacAddressingEvent, fidl::Error>;
2335
2336 fn poll_next(
2337 mut self: std::pin::Pin<&mut Self>,
2338 cx: &mut std::task::Context<'_>,
2339 ) -> std::task::Poll<Option<Self::Item>> {
2340 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2341 &mut self.event_receiver,
2342 cx
2343 )?) {
2344 Some(buf) => std::task::Poll::Ready(Some(MacAddressingEvent::decode(buf))),
2345 None => std::task::Poll::Ready(None),
2346 }
2347 }
2348}
2349
2350#[derive(Debug)]
2351pub enum MacAddressingEvent {}
2352
2353impl MacAddressingEvent {
2354 fn decode(
2356 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2357 ) -> Result<MacAddressingEvent, fidl::Error> {
2358 let (bytes, _handles) = buf.split_mut();
2359 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2360 debug_assert_eq!(tx_header.tx_id, 0);
2361 match tx_header.ordinal {
2362 _ => Err(fidl::Error::UnknownOrdinal {
2363 ordinal: tx_header.ordinal,
2364 protocol_name: <MacAddressingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2365 }),
2366 }
2367 }
2368}
2369
2370pub struct MacAddressingRequestStream {
2372 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2373 is_terminated: bool,
2374}
2375
2376impl std::marker::Unpin for MacAddressingRequestStream {}
2377
2378impl futures::stream::FusedStream for MacAddressingRequestStream {
2379 fn is_terminated(&self) -> bool {
2380 self.is_terminated
2381 }
2382}
2383
2384impl fidl::endpoints::RequestStream for MacAddressingRequestStream {
2385 type Protocol = MacAddressingMarker;
2386 type ControlHandle = MacAddressingControlHandle;
2387
2388 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2389 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2390 }
2391
2392 fn control_handle(&self) -> Self::ControlHandle {
2393 MacAddressingControlHandle { inner: self.inner.clone() }
2394 }
2395
2396 fn into_inner(
2397 self,
2398 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2399 {
2400 (self.inner, self.is_terminated)
2401 }
2402
2403 fn from_inner(
2404 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2405 is_terminated: bool,
2406 ) -> Self {
2407 Self { inner, is_terminated }
2408 }
2409}
2410
2411impl futures::Stream for MacAddressingRequestStream {
2412 type Item = Result<MacAddressingRequest, fidl::Error>;
2413
2414 fn poll_next(
2415 mut self: std::pin::Pin<&mut Self>,
2416 cx: &mut std::task::Context<'_>,
2417 ) -> std::task::Poll<Option<Self::Item>> {
2418 let this = &mut *self;
2419 if this.inner.check_shutdown(cx) {
2420 this.is_terminated = true;
2421 return std::task::Poll::Ready(None);
2422 }
2423 if this.is_terminated {
2424 panic!("polled MacAddressingRequestStream after completion");
2425 }
2426 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2427 |bytes, handles| {
2428 match this.inner.channel().read_etc(cx, bytes, handles) {
2429 std::task::Poll::Ready(Ok(())) => {}
2430 std::task::Poll::Pending => return std::task::Poll::Pending,
2431 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2432 this.is_terminated = true;
2433 return std::task::Poll::Ready(None);
2434 }
2435 std::task::Poll::Ready(Err(e)) => {
2436 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2437 e.into(),
2438 ))))
2439 }
2440 }
2441
2442 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2444
2445 std::task::Poll::Ready(Some(match header.ordinal {
2446 0x2c60b82a4ecfaebe => {
2447 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2448 let mut req = fidl::new_empty!(
2449 fidl::encoding::EmptyPayload,
2450 fidl::encoding::DefaultFuchsiaResourceDialect
2451 );
2452 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2453 let control_handle =
2454 MacAddressingControlHandle { inner: this.inner.clone() };
2455 Ok(MacAddressingRequest::GetUnicastAddress {
2456 responder: MacAddressingGetUnicastAddressResponder {
2457 control_handle: std::mem::ManuallyDrop::new(control_handle),
2458 tx_id: header.tx_id,
2459 },
2460 })
2461 }
2462 0x6297b8dbf03c58c => {
2463 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2464 let mut req = fidl::new_empty!(
2465 MacAddressingSetModeRequest,
2466 fidl::encoding::DefaultFuchsiaResourceDialect
2467 );
2468 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MacAddressingSetModeRequest>(&header, _body_bytes, handles, &mut req)?;
2469 let control_handle =
2470 MacAddressingControlHandle { inner: this.inner.clone() };
2471 Ok(MacAddressingRequest::SetMode {
2472 mode: req.mode,
2473
2474 responder: MacAddressingSetModeResponder {
2475 control_handle: std::mem::ManuallyDrop::new(control_handle),
2476 tx_id: header.tx_id,
2477 },
2478 })
2479 }
2480 0xf5637ff11cf0c25 => {
2481 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2482 let mut req = fidl::new_empty!(
2483 MacAddressingAddMulticastAddressRequest,
2484 fidl::encoding::DefaultFuchsiaResourceDialect
2485 );
2486 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MacAddressingAddMulticastAddressRequest>(&header, _body_bytes, handles, &mut req)?;
2487 let control_handle =
2488 MacAddressingControlHandle { inner: this.inner.clone() };
2489 Ok(MacAddressingRequest::AddMulticastAddress {
2490 address: req.address,
2491
2492 responder: MacAddressingAddMulticastAddressResponder {
2493 control_handle: std::mem::ManuallyDrop::new(control_handle),
2494 tx_id: header.tx_id,
2495 },
2496 })
2497 }
2498 0x5dddf4e3ba4e2560 => {
2499 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2500 let mut req = fidl::new_empty!(
2501 MacAddressingRemoveMulticastAddressRequest,
2502 fidl::encoding::DefaultFuchsiaResourceDialect
2503 );
2504 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MacAddressingRemoveMulticastAddressRequest>(&header, _body_bytes, handles, &mut req)?;
2505 let control_handle =
2506 MacAddressingControlHandle { inner: this.inner.clone() };
2507 Ok(MacAddressingRequest::RemoveMulticastAddress {
2508 address: req.address,
2509
2510 responder: MacAddressingRemoveMulticastAddressResponder {
2511 control_handle: std::mem::ManuallyDrop::new(control_handle),
2512 tx_id: header.tx_id,
2513 },
2514 })
2515 }
2516 _ => Err(fidl::Error::UnknownOrdinal {
2517 ordinal: header.ordinal,
2518 protocol_name:
2519 <MacAddressingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2520 }),
2521 }))
2522 },
2523 )
2524 }
2525}
2526
2527#[derive(Debug)]
2528pub enum MacAddressingRequest {
2529 GetUnicastAddress { responder: MacAddressingGetUnicastAddressResponder },
2540 SetMode { mode: MacFilterMode, responder: MacAddressingSetModeResponder },
2560 AddMulticastAddress {
2570 address: fidl_fuchsia_net::MacAddress,
2571 responder: MacAddressingAddMulticastAddressResponder,
2572 },
2573 RemoveMulticastAddress {
2579 address: fidl_fuchsia_net::MacAddress,
2580 responder: MacAddressingRemoveMulticastAddressResponder,
2581 },
2582}
2583
2584impl MacAddressingRequest {
2585 #[allow(irrefutable_let_patterns)]
2586 pub fn into_get_unicast_address(self) -> Option<(MacAddressingGetUnicastAddressResponder)> {
2587 if let MacAddressingRequest::GetUnicastAddress { responder } = self {
2588 Some((responder))
2589 } else {
2590 None
2591 }
2592 }
2593
2594 #[allow(irrefutable_let_patterns)]
2595 pub fn into_set_mode(self) -> Option<(MacFilterMode, MacAddressingSetModeResponder)> {
2596 if let MacAddressingRequest::SetMode { mode, responder } = self {
2597 Some((mode, responder))
2598 } else {
2599 None
2600 }
2601 }
2602
2603 #[allow(irrefutable_let_patterns)]
2604 pub fn into_add_multicast_address(
2605 self,
2606 ) -> Option<(fidl_fuchsia_net::MacAddress, MacAddressingAddMulticastAddressResponder)> {
2607 if let MacAddressingRequest::AddMulticastAddress { address, responder } = self {
2608 Some((address, responder))
2609 } else {
2610 None
2611 }
2612 }
2613
2614 #[allow(irrefutable_let_patterns)]
2615 pub fn into_remove_multicast_address(
2616 self,
2617 ) -> Option<(fidl_fuchsia_net::MacAddress, MacAddressingRemoveMulticastAddressResponder)> {
2618 if let MacAddressingRequest::RemoveMulticastAddress { address, responder } = self {
2619 Some((address, responder))
2620 } else {
2621 None
2622 }
2623 }
2624
2625 pub fn method_name(&self) -> &'static str {
2627 match *self {
2628 MacAddressingRequest::GetUnicastAddress { .. } => "get_unicast_address",
2629 MacAddressingRequest::SetMode { .. } => "set_mode",
2630 MacAddressingRequest::AddMulticastAddress { .. } => "add_multicast_address",
2631 MacAddressingRequest::RemoveMulticastAddress { .. } => "remove_multicast_address",
2632 }
2633 }
2634}
2635
2636#[derive(Debug, Clone)]
2637pub struct MacAddressingControlHandle {
2638 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2639}
2640
2641impl fidl::endpoints::ControlHandle for MacAddressingControlHandle {
2642 fn shutdown(&self) {
2643 self.inner.shutdown()
2644 }
2645 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2646 self.inner.shutdown_with_epitaph(status)
2647 }
2648
2649 fn is_closed(&self) -> bool {
2650 self.inner.channel().is_closed()
2651 }
2652 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2653 self.inner.channel().on_closed()
2654 }
2655
2656 #[cfg(target_os = "fuchsia")]
2657 fn signal_peer(
2658 &self,
2659 clear_mask: zx::Signals,
2660 set_mask: zx::Signals,
2661 ) -> Result<(), zx_status::Status> {
2662 use fidl::Peered;
2663 self.inner.channel().signal_peer(clear_mask, set_mask)
2664 }
2665}
2666
2667impl MacAddressingControlHandle {}
2668
2669#[must_use = "FIDL methods require a response to be sent"]
2670#[derive(Debug)]
2671pub struct MacAddressingGetUnicastAddressResponder {
2672 control_handle: std::mem::ManuallyDrop<MacAddressingControlHandle>,
2673 tx_id: u32,
2674}
2675
2676impl std::ops::Drop for MacAddressingGetUnicastAddressResponder {
2680 fn drop(&mut self) {
2681 self.control_handle.shutdown();
2682 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2684 }
2685}
2686
2687impl fidl::endpoints::Responder for MacAddressingGetUnicastAddressResponder {
2688 type ControlHandle = MacAddressingControlHandle;
2689
2690 fn control_handle(&self) -> &MacAddressingControlHandle {
2691 &self.control_handle
2692 }
2693
2694 fn drop_without_shutdown(mut self) {
2695 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2697 std::mem::forget(self);
2699 }
2700}
2701
2702impl MacAddressingGetUnicastAddressResponder {
2703 pub fn send(self, mut address: &fidl_fuchsia_net::MacAddress) -> Result<(), fidl::Error> {
2707 let _result = self.send_raw(address);
2708 if _result.is_err() {
2709 self.control_handle.shutdown();
2710 }
2711 self.drop_without_shutdown();
2712 _result
2713 }
2714
2715 pub fn send_no_shutdown_on_err(
2717 self,
2718 mut address: &fidl_fuchsia_net::MacAddress,
2719 ) -> Result<(), fidl::Error> {
2720 let _result = self.send_raw(address);
2721 self.drop_without_shutdown();
2722 _result
2723 }
2724
2725 fn send_raw(&self, mut address: &fidl_fuchsia_net::MacAddress) -> Result<(), fidl::Error> {
2726 self.control_handle.inner.send::<MacAddressingGetUnicastAddressResponse>(
2727 (address,),
2728 self.tx_id,
2729 0x2c60b82a4ecfaebe,
2730 fidl::encoding::DynamicFlags::empty(),
2731 )
2732 }
2733}
2734
2735#[must_use = "FIDL methods require a response to be sent"]
2736#[derive(Debug)]
2737pub struct MacAddressingSetModeResponder {
2738 control_handle: std::mem::ManuallyDrop<MacAddressingControlHandle>,
2739 tx_id: u32,
2740}
2741
2742impl std::ops::Drop for MacAddressingSetModeResponder {
2746 fn drop(&mut self) {
2747 self.control_handle.shutdown();
2748 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2750 }
2751}
2752
2753impl fidl::endpoints::Responder for MacAddressingSetModeResponder {
2754 type ControlHandle = MacAddressingControlHandle;
2755
2756 fn control_handle(&self) -> &MacAddressingControlHandle {
2757 &self.control_handle
2758 }
2759
2760 fn drop_without_shutdown(mut self) {
2761 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2763 std::mem::forget(self);
2765 }
2766}
2767
2768impl MacAddressingSetModeResponder {
2769 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2773 let _result = self.send_raw(status);
2774 if _result.is_err() {
2775 self.control_handle.shutdown();
2776 }
2777 self.drop_without_shutdown();
2778 _result
2779 }
2780
2781 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2783 let _result = self.send_raw(status);
2784 self.drop_without_shutdown();
2785 _result
2786 }
2787
2788 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2789 self.control_handle.inner.send::<MacAddressingSetModeResponse>(
2790 (status,),
2791 self.tx_id,
2792 0x6297b8dbf03c58c,
2793 fidl::encoding::DynamicFlags::empty(),
2794 )
2795 }
2796}
2797
2798#[must_use = "FIDL methods require a response to be sent"]
2799#[derive(Debug)]
2800pub struct MacAddressingAddMulticastAddressResponder {
2801 control_handle: std::mem::ManuallyDrop<MacAddressingControlHandle>,
2802 tx_id: u32,
2803}
2804
2805impl std::ops::Drop for MacAddressingAddMulticastAddressResponder {
2809 fn drop(&mut self) {
2810 self.control_handle.shutdown();
2811 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2813 }
2814}
2815
2816impl fidl::endpoints::Responder for MacAddressingAddMulticastAddressResponder {
2817 type ControlHandle = MacAddressingControlHandle;
2818
2819 fn control_handle(&self) -> &MacAddressingControlHandle {
2820 &self.control_handle
2821 }
2822
2823 fn drop_without_shutdown(mut self) {
2824 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2826 std::mem::forget(self);
2828 }
2829}
2830
2831impl MacAddressingAddMulticastAddressResponder {
2832 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2836 let _result = self.send_raw(status);
2837 if _result.is_err() {
2838 self.control_handle.shutdown();
2839 }
2840 self.drop_without_shutdown();
2841 _result
2842 }
2843
2844 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2846 let _result = self.send_raw(status);
2847 self.drop_without_shutdown();
2848 _result
2849 }
2850
2851 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2852 self.control_handle.inner.send::<MacAddressingAddMulticastAddressResponse>(
2853 (status,),
2854 self.tx_id,
2855 0xf5637ff11cf0c25,
2856 fidl::encoding::DynamicFlags::empty(),
2857 )
2858 }
2859}
2860
2861#[must_use = "FIDL methods require a response to be sent"]
2862#[derive(Debug)]
2863pub struct MacAddressingRemoveMulticastAddressResponder {
2864 control_handle: std::mem::ManuallyDrop<MacAddressingControlHandle>,
2865 tx_id: u32,
2866}
2867
2868impl std::ops::Drop for MacAddressingRemoveMulticastAddressResponder {
2872 fn drop(&mut self) {
2873 self.control_handle.shutdown();
2874 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2876 }
2877}
2878
2879impl fidl::endpoints::Responder for MacAddressingRemoveMulticastAddressResponder {
2880 type ControlHandle = MacAddressingControlHandle;
2881
2882 fn control_handle(&self) -> &MacAddressingControlHandle {
2883 &self.control_handle
2884 }
2885
2886 fn drop_without_shutdown(mut self) {
2887 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2889 std::mem::forget(self);
2891 }
2892}
2893
2894impl MacAddressingRemoveMulticastAddressResponder {
2895 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2899 let _result = self.send_raw(status);
2900 if _result.is_err() {
2901 self.control_handle.shutdown();
2902 }
2903 self.drop_without_shutdown();
2904 _result
2905 }
2906
2907 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2909 let _result = self.send_raw(status);
2910 self.drop_without_shutdown();
2911 _result
2912 }
2913
2914 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2915 self.control_handle.inner.send::<MacAddressingRemoveMulticastAddressResponse>(
2916 (status,),
2917 self.tx_id,
2918 0x5dddf4e3ba4e2560,
2919 fidl::encoding::DynamicFlags::empty(),
2920 )
2921 }
2922}
2923
2924#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2925pub struct PortMarker;
2926
2927impl fidl::endpoints::ProtocolMarker for PortMarker {
2928 type Proxy = PortProxy;
2929 type RequestStream = PortRequestStream;
2930 #[cfg(target_os = "fuchsia")]
2931 type SynchronousProxy = PortSynchronousProxy;
2932
2933 const DEBUG_NAME: &'static str = "(anonymous) Port";
2934}
2935
2936pub trait PortProxyInterface: Send + Sync {
2937 type GetInfoResponseFut: std::future::Future<Output = Result<PortInfo, fidl::Error>> + Send;
2938 fn r#get_info(&self) -> Self::GetInfoResponseFut;
2939 type GetStatusResponseFut: std::future::Future<Output = Result<PortStatus, fidl::Error>> + Send;
2940 fn r#get_status(&self) -> Self::GetStatusResponseFut;
2941 fn r#get_status_watcher(
2942 &self,
2943 watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
2944 buffer: u32,
2945 ) -> Result<(), fidl::Error>;
2946 fn r#get_mac(
2947 &self,
2948 mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
2949 ) -> Result<(), fidl::Error>;
2950 fn r#get_device(
2951 &self,
2952 device: fidl::endpoints::ServerEnd<DeviceMarker>,
2953 ) -> Result<(), fidl::Error>;
2954 fn r#clone(&self, port: fidl::endpoints::ServerEnd<PortMarker>) -> Result<(), fidl::Error>;
2955 type GetCountersResponseFut: std::future::Future<Output = Result<PortGetCountersResponse, fidl::Error>>
2956 + Send;
2957 fn r#get_counters(&self) -> Self::GetCountersResponseFut;
2958 fn r#get_diagnostics(
2959 &self,
2960 diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
2961 ) -> Result<(), fidl::Error>;
2962}
2963#[derive(Debug)]
2964#[cfg(target_os = "fuchsia")]
2965pub struct PortSynchronousProxy {
2966 client: fidl::client::sync::Client,
2967}
2968
2969#[cfg(target_os = "fuchsia")]
2970impl fidl::endpoints::SynchronousProxy for PortSynchronousProxy {
2971 type Proxy = PortProxy;
2972 type Protocol = PortMarker;
2973
2974 fn from_channel(inner: fidl::Channel) -> Self {
2975 Self::new(inner)
2976 }
2977
2978 fn into_channel(self) -> fidl::Channel {
2979 self.client.into_channel()
2980 }
2981
2982 fn as_channel(&self) -> &fidl::Channel {
2983 self.client.as_channel()
2984 }
2985}
2986
2987#[cfg(target_os = "fuchsia")]
2988impl PortSynchronousProxy {
2989 pub fn new(channel: fidl::Channel) -> Self {
2990 let protocol_name = <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2991 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2992 }
2993
2994 pub fn into_channel(self) -> fidl::Channel {
2995 self.client.into_channel()
2996 }
2997
2998 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<PortEvent, fidl::Error> {
3001 PortEvent::decode(self.client.wait_for_event(deadline)?)
3002 }
3003
3004 pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<PortInfo, fidl::Error> {
3008 let _response =
3009 self.client.send_query::<fidl::encoding::EmptyPayload, PortGetInfoResponse>(
3010 (),
3011 0x276cf65feb554ebd,
3012 fidl::encoding::DynamicFlags::empty(),
3013 ___deadline,
3014 )?;
3015 Ok(_response.info)
3016 }
3017
3018 pub fn r#get_status(
3022 &self,
3023 ___deadline: zx::MonotonicInstant,
3024 ) -> Result<PortStatus, fidl::Error> {
3025 let _response =
3026 self.client.send_query::<fidl::encoding::EmptyPayload, PortGetStatusResponse>(
3027 (),
3028 0x4235650aacca60b2,
3029 fidl::encoding::DynamicFlags::empty(),
3030 ___deadline,
3031 )?;
3032 Ok(_response.status)
3033 }
3034
3035 pub fn r#get_status_watcher(
3047 &self,
3048 mut watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3049 mut buffer: u32,
3050 ) -> Result<(), fidl::Error> {
3051 self.client.send::<PortGetStatusWatcherRequest>(
3052 (watcher, buffer),
3053 0x65511ab81c1bd8d4,
3054 fidl::encoding::DynamicFlags::empty(),
3055 )
3056 }
3057
3058 pub fn r#get_mac(
3063 &self,
3064 mut mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3065 ) -> Result<(), fidl::Error> {
3066 self.client.send::<PortGetMacRequest>(
3067 (mac,),
3068 0x2c6ec2988aefc0f6,
3069 fidl::encoding::DynamicFlags::empty(),
3070 )
3071 }
3072
3073 pub fn r#get_device(
3077 &self,
3078 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
3079 ) -> Result<(), fidl::Error> {
3080 self.client.send::<PortGetDeviceRequest>(
3081 (device,),
3082 0x7de34747235d2d80,
3083 fidl::encoding::DynamicFlags::empty(),
3084 )
3085 }
3086
3087 pub fn r#clone(
3091 &self,
3092 mut port: fidl::endpoints::ServerEnd<PortMarker>,
3093 ) -> Result<(), fidl::Error> {
3094 self.client.send::<PortCloneRequest>(
3095 (port,),
3096 0x4e4764150b4942d3,
3097 fidl::encoding::DynamicFlags::empty(),
3098 )
3099 }
3100
3101 pub fn r#get_counters(
3103 &self,
3104 ___deadline: zx::MonotonicInstant,
3105 ) -> Result<PortGetCountersResponse, fidl::Error> {
3106 let _response =
3107 self.client.send_query::<fidl::encoding::EmptyPayload, PortGetCountersResponse>(
3108 (),
3109 0x6a213b03c4fcbbac,
3110 fidl::encoding::DynamicFlags::empty(),
3111 ___deadline,
3112 )?;
3113 Ok(_response)
3114 }
3115
3116 pub fn r#get_diagnostics(
3120 &self,
3121 mut diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3122 ) -> Result<(), fidl::Error> {
3123 self.client.send::<PortGetDiagnosticsRequest>(
3124 (diagnostics,),
3125 0x381faa4ed75e399c,
3126 fidl::encoding::DynamicFlags::empty(),
3127 )
3128 }
3129}
3130
3131#[cfg(target_os = "fuchsia")]
3132impl From<PortSynchronousProxy> for zx::Handle {
3133 fn from(value: PortSynchronousProxy) -> Self {
3134 value.into_channel().into()
3135 }
3136}
3137
3138#[cfg(target_os = "fuchsia")]
3139impl From<fidl::Channel> for PortSynchronousProxy {
3140 fn from(value: fidl::Channel) -> Self {
3141 Self::new(value)
3142 }
3143}
3144
3145#[derive(Debug, Clone)]
3146pub struct PortProxy {
3147 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3148}
3149
3150impl fidl::endpoints::Proxy for PortProxy {
3151 type Protocol = PortMarker;
3152
3153 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3154 Self::new(inner)
3155 }
3156
3157 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3158 self.client.into_channel().map_err(|client| Self { client })
3159 }
3160
3161 fn as_channel(&self) -> &::fidl::AsyncChannel {
3162 self.client.as_channel()
3163 }
3164}
3165
3166impl PortProxy {
3167 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3169 let protocol_name = <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3170 Self { client: fidl::client::Client::new(channel, protocol_name) }
3171 }
3172
3173 pub fn take_event_stream(&self) -> PortEventStream {
3179 PortEventStream { event_receiver: self.client.take_event_receiver() }
3180 }
3181
3182 pub fn r#get_info(
3186 &self,
3187 ) -> fidl::client::QueryResponseFut<PortInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
3188 {
3189 PortProxyInterface::r#get_info(self)
3190 }
3191
3192 pub fn r#get_status(
3196 &self,
3197 ) -> fidl::client::QueryResponseFut<PortStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
3198 {
3199 PortProxyInterface::r#get_status(self)
3200 }
3201
3202 pub fn r#get_status_watcher(
3214 &self,
3215 mut watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3216 mut buffer: u32,
3217 ) -> Result<(), fidl::Error> {
3218 PortProxyInterface::r#get_status_watcher(self, watcher, buffer)
3219 }
3220
3221 pub fn r#get_mac(
3226 &self,
3227 mut mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3228 ) -> Result<(), fidl::Error> {
3229 PortProxyInterface::r#get_mac(self, mac)
3230 }
3231
3232 pub fn r#get_device(
3236 &self,
3237 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
3238 ) -> Result<(), fidl::Error> {
3239 PortProxyInterface::r#get_device(self, device)
3240 }
3241
3242 pub fn r#clone(
3246 &self,
3247 mut port: fidl::endpoints::ServerEnd<PortMarker>,
3248 ) -> Result<(), fidl::Error> {
3249 PortProxyInterface::r#clone(self, port)
3250 }
3251
3252 pub fn r#get_counters(
3254 &self,
3255 ) -> fidl::client::QueryResponseFut<
3256 PortGetCountersResponse,
3257 fidl::encoding::DefaultFuchsiaResourceDialect,
3258 > {
3259 PortProxyInterface::r#get_counters(self)
3260 }
3261
3262 pub fn r#get_diagnostics(
3266 &self,
3267 mut diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3268 ) -> Result<(), fidl::Error> {
3269 PortProxyInterface::r#get_diagnostics(self, diagnostics)
3270 }
3271}
3272
3273impl PortProxyInterface for PortProxy {
3274 type GetInfoResponseFut =
3275 fidl::client::QueryResponseFut<PortInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
3276 fn r#get_info(&self) -> Self::GetInfoResponseFut {
3277 fn _decode(
3278 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3279 ) -> Result<PortInfo, fidl::Error> {
3280 let _response = fidl::client::decode_transaction_body::<
3281 PortGetInfoResponse,
3282 fidl::encoding::DefaultFuchsiaResourceDialect,
3283 0x276cf65feb554ebd,
3284 >(_buf?)?;
3285 Ok(_response.info)
3286 }
3287 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PortInfo>(
3288 (),
3289 0x276cf65feb554ebd,
3290 fidl::encoding::DynamicFlags::empty(),
3291 _decode,
3292 )
3293 }
3294
3295 type GetStatusResponseFut =
3296 fidl::client::QueryResponseFut<PortStatus, fidl::encoding::DefaultFuchsiaResourceDialect>;
3297 fn r#get_status(&self) -> Self::GetStatusResponseFut {
3298 fn _decode(
3299 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3300 ) -> Result<PortStatus, fidl::Error> {
3301 let _response = fidl::client::decode_transaction_body::<
3302 PortGetStatusResponse,
3303 fidl::encoding::DefaultFuchsiaResourceDialect,
3304 0x4235650aacca60b2,
3305 >(_buf?)?;
3306 Ok(_response.status)
3307 }
3308 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PortStatus>(
3309 (),
3310 0x4235650aacca60b2,
3311 fidl::encoding::DynamicFlags::empty(),
3312 _decode,
3313 )
3314 }
3315
3316 fn r#get_status_watcher(
3317 &self,
3318 mut watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3319 mut buffer: u32,
3320 ) -> Result<(), fidl::Error> {
3321 self.client.send::<PortGetStatusWatcherRequest>(
3322 (watcher, buffer),
3323 0x65511ab81c1bd8d4,
3324 fidl::encoding::DynamicFlags::empty(),
3325 )
3326 }
3327
3328 fn r#get_mac(
3329 &self,
3330 mut mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3331 ) -> Result<(), fidl::Error> {
3332 self.client.send::<PortGetMacRequest>(
3333 (mac,),
3334 0x2c6ec2988aefc0f6,
3335 fidl::encoding::DynamicFlags::empty(),
3336 )
3337 }
3338
3339 fn r#get_device(
3340 &self,
3341 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
3342 ) -> Result<(), fidl::Error> {
3343 self.client.send::<PortGetDeviceRequest>(
3344 (device,),
3345 0x7de34747235d2d80,
3346 fidl::encoding::DynamicFlags::empty(),
3347 )
3348 }
3349
3350 fn r#clone(&self, mut port: fidl::endpoints::ServerEnd<PortMarker>) -> Result<(), fidl::Error> {
3351 self.client.send::<PortCloneRequest>(
3352 (port,),
3353 0x4e4764150b4942d3,
3354 fidl::encoding::DynamicFlags::empty(),
3355 )
3356 }
3357
3358 type GetCountersResponseFut = fidl::client::QueryResponseFut<
3359 PortGetCountersResponse,
3360 fidl::encoding::DefaultFuchsiaResourceDialect,
3361 >;
3362 fn r#get_counters(&self) -> Self::GetCountersResponseFut {
3363 fn _decode(
3364 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3365 ) -> Result<PortGetCountersResponse, fidl::Error> {
3366 let _response = fidl::client::decode_transaction_body::<
3367 PortGetCountersResponse,
3368 fidl::encoding::DefaultFuchsiaResourceDialect,
3369 0x6a213b03c4fcbbac,
3370 >(_buf?)?;
3371 Ok(_response)
3372 }
3373 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PortGetCountersResponse>(
3374 (),
3375 0x6a213b03c4fcbbac,
3376 fidl::encoding::DynamicFlags::empty(),
3377 _decode,
3378 )
3379 }
3380
3381 fn r#get_diagnostics(
3382 &self,
3383 mut diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3384 ) -> Result<(), fidl::Error> {
3385 self.client.send::<PortGetDiagnosticsRequest>(
3386 (diagnostics,),
3387 0x381faa4ed75e399c,
3388 fidl::encoding::DynamicFlags::empty(),
3389 )
3390 }
3391}
3392
3393pub struct PortEventStream {
3394 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3395}
3396
3397impl std::marker::Unpin for PortEventStream {}
3398
3399impl futures::stream::FusedStream for PortEventStream {
3400 fn is_terminated(&self) -> bool {
3401 self.event_receiver.is_terminated()
3402 }
3403}
3404
3405impl futures::Stream for PortEventStream {
3406 type Item = Result<PortEvent, fidl::Error>;
3407
3408 fn poll_next(
3409 mut self: std::pin::Pin<&mut Self>,
3410 cx: &mut std::task::Context<'_>,
3411 ) -> std::task::Poll<Option<Self::Item>> {
3412 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3413 &mut self.event_receiver,
3414 cx
3415 )?) {
3416 Some(buf) => std::task::Poll::Ready(Some(PortEvent::decode(buf))),
3417 None => std::task::Poll::Ready(None),
3418 }
3419 }
3420}
3421
3422#[derive(Debug)]
3423pub enum PortEvent {}
3424
3425impl PortEvent {
3426 fn decode(
3428 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3429 ) -> Result<PortEvent, fidl::Error> {
3430 let (bytes, _handles) = buf.split_mut();
3431 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3432 debug_assert_eq!(tx_header.tx_id, 0);
3433 match tx_header.ordinal {
3434 _ => Err(fidl::Error::UnknownOrdinal {
3435 ordinal: tx_header.ordinal,
3436 protocol_name: <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3437 }),
3438 }
3439 }
3440}
3441
3442pub struct PortRequestStream {
3444 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3445 is_terminated: bool,
3446}
3447
3448impl std::marker::Unpin for PortRequestStream {}
3449
3450impl futures::stream::FusedStream for PortRequestStream {
3451 fn is_terminated(&self) -> bool {
3452 self.is_terminated
3453 }
3454}
3455
3456impl fidl::endpoints::RequestStream for PortRequestStream {
3457 type Protocol = PortMarker;
3458 type ControlHandle = PortControlHandle;
3459
3460 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3461 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3462 }
3463
3464 fn control_handle(&self) -> Self::ControlHandle {
3465 PortControlHandle { inner: self.inner.clone() }
3466 }
3467
3468 fn into_inner(
3469 self,
3470 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3471 {
3472 (self.inner, self.is_terminated)
3473 }
3474
3475 fn from_inner(
3476 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3477 is_terminated: bool,
3478 ) -> Self {
3479 Self { inner, is_terminated }
3480 }
3481}
3482
3483impl futures::Stream for PortRequestStream {
3484 type Item = Result<PortRequest, fidl::Error>;
3485
3486 fn poll_next(
3487 mut self: std::pin::Pin<&mut Self>,
3488 cx: &mut std::task::Context<'_>,
3489 ) -> std::task::Poll<Option<Self::Item>> {
3490 let this = &mut *self;
3491 if this.inner.check_shutdown(cx) {
3492 this.is_terminated = true;
3493 return std::task::Poll::Ready(None);
3494 }
3495 if this.is_terminated {
3496 panic!("polled PortRequestStream after completion");
3497 }
3498 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3499 |bytes, handles| {
3500 match this.inner.channel().read_etc(cx, bytes, handles) {
3501 std::task::Poll::Ready(Ok(())) => {}
3502 std::task::Poll::Pending => return std::task::Poll::Pending,
3503 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3504 this.is_terminated = true;
3505 return std::task::Poll::Ready(None);
3506 }
3507 std::task::Poll::Ready(Err(e)) => {
3508 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3509 e.into(),
3510 ))))
3511 }
3512 }
3513
3514 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3516
3517 std::task::Poll::Ready(Some(match header.ordinal {
3518 0x276cf65feb554ebd => {
3519 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3520 let mut req = fidl::new_empty!(
3521 fidl::encoding::EmptyPayload,
3522 fidl::encoding::DefaultFuchsiaResourceDialect
3523 );
3524 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3525 let control_handle = PortControlHandle { inner: this.inner.clone() };
3526 Ok(PortRequest::GetInfo {
3527 responder: PortGetInfoResponder {
3528 control_handle: std::mem::ManuallyDrop::new(control_handle),
3529 tx_id: header.tx_id,
3530 },
3531 })
3532 }
3533 0x4235650aacca60b2 => {
3534 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3535 let mut req = fidl::new_empty!(
3536 fidl::encoding::EmptyPayload,
3537 fidl::encoding::DefaultFuchsiaResourceDialect
3538 );
3539 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3540 let control_handle = PortControlHandle { inner: this.inner.clone() };
3541 Ok(PortRequest::GetStatus {
3542 responder: PortGetStatusResponder {
3543 control_handle: std::mem::ManuallyDrop::new(control_handle),
3544 tx_id: header.tx_id,
3545 },
3546 })
3547 }
3548 0x65511ab81c1bd8d4 => {
3549 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3550 let mut req = fidl::new_empty!(
3551 PortGetStatusWatcherRequest,
3552 fidl::encoding::DefaultFuchsiaResourceDialect
3553 );
3554 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetStatusWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
3555 let control_handle = PortControlHandle { inner: this.inner.clone() };
3556 Ok(PortRequest::GetStatusWatcher {
3557 watcher: req.watcher,
3558 buffer: req.buffer,
3559
3560 control_handle,
3561 })
3562 }
3563 0x2c6ec2988aefc0f6 => {
3564 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3565 let mut req = fidl::new_empty!(
3566 PortGetMacRequest,
3567 fidl::encoding::DefaultFuchsiaResourceDialect
3568 );
3569 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetMacRequest>(&header, _body_bytes, handles, &mut req)?;
3570 let control_handle = PortControlHandle { inner: this.inner.clone() };
3571 Ok(PortRequest::GetMac { mac: req.mac, control_handle })
3572 }
3573 0x7de34747235d2d80 => {
3574 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3575 let mut req = fidl::new_empty!(
3576 PortGetDeviceRequest,
3577 fidl::encoding::DefaultFuchsiaResourceDialect
3578 );
3579 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
3580 let control_handle = PortControlHandle { inner: this.inner.clone() };
3581 Ok(PortRequest::GetDevice { device: req.device, control_handle })
3582 }
3583 0x4e4764150b4942d3 => {
3584 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3585 let mut req = fidl::new_empty!(
3586 PortCloneRequest,
3587 fidl::encoding::DefaultFuchsiaResourceDialect
3588 );
3589 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortCloneRequest>(&header, _body_bytes, handles, &mut req)?;
3590 let control_handle = PortControlHandle { inner: this.inner.clone() };
3591 Ok(PortRequest::Clone { port: req.port, control_handle })
3592 }
3593 0x6a213b03c4fcbbac => {
3594 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3595 let mut req = fidl::new_empty!(
3596 fidl::encoding::EmptyPayload,
3597 fidl::encoding::DefaultFuchsiaResourceDialect
3598 );
3599 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3600 let control_handle = PortControlHandle { inner: this.inner.clone() };
3601 Ok(PortRequest::GetCounters {
3602 responder: PortGetCountersResponder {
3603 control_handle: std::mem::ManuallyDrop::new(control_handle),
3604 tx_id: header.tx_id,
3605 },
3606 })
3607 }
3608 0x381faa4ed75e399c => {
3609 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3610 let mut req = fidl::new_empty!(
3611 PortGetDiagnosticsRequest,
3612 fidl::encoding::DefaultFuchsiaResourceDialect
3613 );
3614 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetDiagnosticsRequest>(&header, _body_bytes, handles, &mut req)?;
3615 let control_handle = PortControlHandle { inner: this.inner.clone() };
3616 Ok(PortRequest::GetDiagnostics {
3617 diagnostics: req.diagnostics,
3618
3619 control_handle,
3620 })
3621 }
3622 _ => Err(fidl::Error::UnknownOrdinal {
3623 ordinal: header.ordinal,
3624 protocol_name: <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3625 }),
3626 }))
3627 },
3628 )
3629 }
3630}
3631
3632#[derive(Debug)]
3634pub enum PortRequest {
3635 GetInfo { responder: PortGetInfoResponder },
3639 GetStatus { responder: PortGetStatusResponder },
3643 GetStatusWatcher {
3655 watcher: fidl::endpoints::ServerEnd<StatusWatcherMarker>,
3656 buffer: u32,
3657 control_handle: PortControlHandle,
3658 },
3659 GetMac {
3664 mac: fidl::endpoints::ServerEnd<MacAddressingMarker>,
3665 control_handle: PortControlHandle,
3666 },
3667 GetDevice {
3671 device: fidl::endpoints::ServerEnd<DeviceMarker>,
3672 control_handle: PortControlHandle,
3673 },
3674 Clone { port: fidl::endpoints::ServerEnd<PortMarker>, control_handle: PortControlHandle },
3678 GetCounters { responder: PortGetCountersResponder },
3680 GetDiagnostics {
3684 diagnostics: fidl::endpoints::ServerEnd<DiagnosticsMarker>,
3685 control_handle: PortControlHandle,
3686 },
3687}
3688
3689impl PortRequest {
3690 #[allow(irrefutable_let_patterns)]
3691 pub fn into_get_info(self) -> Option<(PortGetInfoResponder)> {
3692 if let PortRequest::GetInfo { responder } = self {
3693 Some((responder))
3694 } else {
3695 None
3696 }
3697 }
3698
3699 #[allow(irrefutable_let_patterns)]
3700 pub fn into_get_status(self) -> Option<(PortGetStatusResponder)> {
3701 if let PortRequest::GetStatus { responder } = self {
3702 Some((responder))
3703 } else {
3704 None
3705 }
3706 }
3707
3708 #[allow(irrefutable_let_patterns)]
3709 pub fn into_get_status_watcher(
3710 self,
3711 ) -> Option<(fidl::endpoints::ServerEnd<StatusWatcherMarker>, u32, PortControlHandle)> {
3712 if let PortRequest::GetStatusWatcher { watcher, buffer, control_handle } = self {
3713 Some((watcher, buffer, control_handle))
3714 } else {
3715 None
3716 }
3717 }
3718
3719 #[allow(irrefutable_let_patterns)]
3720 pub fn into_get_mac(
3721 self,
3722 ) -> Option<(fidl::endpoints::ServerEnd<MacAddressingMarker>, PortControlHandle)> {
3723 if let PortRequest::GetMac { mac, control_handle } = self {
3724 Some((mac, control_handle))
3725 } else {
3726 None
3727 }
3728 }
3729
3730 #[allow(irrefutable_let_patterns)]
3731 pub fn into_get_device(
3732 self,
3733 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, PortControlHandle)> {
3734 if let PortRequest::GetDevice { device, control_handle } = self {
3735 Some((device, control_handle))
3736 } else {
3737 None
3738 }
3739 }
3740
3741 #[allow(irrefutable_let_patterns)]
3742 pub fn into_clone(self) -> Option<(fidl::endpoints::ServerEnd<PortMarker>, PortControlHandle)> {
3743 if let PortRequest::Clone { port, control_handle } = self {
3744 Some((port, control_handle))
3745 } else {
3746 None
3747 }
3748 }
3749
3750 #[allow(irrefutable_let_patterns)]
3751 pub fn into_get_counters(self) -> Option<(PortGetCountersResponder)> {
3752 if let PortRequest::GetCounters { responder } = self {
3753 Some((responder))
3754 } else {
3755 None
3756 }
3757 }
3758
3759 #[allow(irrefutable_let_patterns)]
3760 pub fn into_get_diagnostics(
3761 self,
3762 ) -> Option<(fidl::endpoints::ServerEnd<DiagnosticsMarker>, PortControlHandle)> {
3763 if let PortRequest::GetDiagnostics { diagnostics, control_handle } = self {
3764 Some((diagnostics, control_handle))
3765 } else {
3766 None
3767 }
3768 }
3769
3770 pub fn method_name(&self) -> &'static str {
3772 match *self {
3773 PortRequest::GetInfo { .. } => "get_info",
3774 PortRequest::GetStatus { .. } => "get_status",
3775 PortRequest::GetStatusWatcher { .. } => "get_status_watcher",
3776 PortRequest::GetMac { .. } => "get_mac",
3777 PortRequest::GetDevice { .. } => "get_device",
3778 PortRequest::Clone { .. } => "clone",
3779 PortRequest::GetCounters { .. } => "get_counters",
3780 PortRequest::GetDiagnostics { .. } => "get_diagnostics",
3781 }
3782 }
3783}
3784
3785#[derive(Debug, Clone)]
3786pub struct PortControlHandle {
3787 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3788}
3789
3790impl fidl::endpoints::ControlHandle for PortControlHandle {
3791 fn shutdown(&self) {
3792 self.inner.shutdown()
3793 }
3794 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3795 self.inner.shutdown_with_epitaph(status)
3796 }
3797
3798 fn is_closed(&self) -> bool {
3799 self.inner.channel().is_closed()
3800 }
3801 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3802 self.inner.channel().on_closed()
3803 }
3804
3805 #[cfg(target_os = "fuchsia")]
3806 fn signal_peer(
3807 &self,
3808 clear_mask: zx::Signals,
3809 set_mask: zx::Signals,
3810 ) -> Result<(), zx_status::Status> {
3811 use fidl::Peered;
3812 self.inner.channel().signal_peer(clear_mask, set_mask)
3813 }
3814}
3815
3816impl PortControlHandle {}
3817
3818#[must_use = "FIDL methods require a response to be sent"]
3819#[derive(Debug)]
3820pub struct PortGetInfoResponder {
3821 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
3822 tx_id: u32,
3823}
3824
3825impl std::ops::Drop for PortGetInfoResponder {
3829 fn drop(&mut self) {
3830 self.control_handle.shutdown();
3831 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3833 }
3834}
3835
3836impl fidl::endpoints::Responder for PortGetInfoResponder {
3837 type ControlHandle = PortControlHandle;
3838
3839 fn control_handle(&self) -> &PortControlHandle {
3840 &self.control_handle
3841 }
3842
3843 fn drop_without_shutdown(mut self) {
3844 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3846 std::mem::forget(self);
3848 }
3849}
3850
3851impl PortGetInfoResponder {
3852 pub fn send(self, mut info: &PortInfo) -> Result<(), fidl::Error> {
3856 let _result = self.send_raw(info);
3857 if _result.is_err() {
3858 self.control_handle.shutdown();
3859 }
3860 self.drop_without_shutdown();
3861 _result
3862 }
3863
3864 pub fn send_no_shutdown_on_err(self, mut info: &PortInfo) -> Result<(), fidl::Error> {
3866 let _result = self.send_raw(info);
3867 self.drop_without_shutdown();
3868 _result
3869 }
3870
3871 fn send_raw(&self, mut info: &PortInfo) -> Result<(), fidl::Error> {
3872 self.control_handle.inner.send::<PortGetInfoResponse>(
3873 (info,),
3874 self.tx_id,
3875 0x276cf65feb554ebd,
3876 fidl::encoding::DynamicFlags::empty(),
3877 )
3878 }
3879}
3880
3881#[must_use = "FIDL methods require a response to be sent"]
3882#[derive(Debug)]
3883pub struct PortGetStatusResponder {
3884 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
3885 tx_id: u32,
3886}
3887
3888impl std::ops::Drop for PortGetStatusResponder {
3892 fn drop(&mut self) {
3893 self.control_handle.shutdown();
3894 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3896 }
3897}
3898
3899impl fidl::endpoints::Responder for PortGetStatusResponder {
3900 type ControlHandle = PortControlHandle;
3901
3902 fn control_handle(&self) -> &PortControlHandle {
3903 &self.control_handle
3904 }
3905
3906 fn drop_without_shutdown(mut self) {
3907 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3909 std::mem::forget(self);
3911 }
3912}
3913
3914impl PortGetStatusResponder {
3915 pub fn send(self, mut status: &PortStatus) -> Result<(), fidl::Error> {
3919 let _result = self.send_raw(status);
3920 if _result.is_err() {
3921 self.control_handle.shutdown();
3922 }
3923 self.drop_without_shutdown();
3924 _result
3925 }
3926
3927 pub fn send_no_shutdown_on_err(self, mut status: &PortStatus) -> Result<(), fidl::Error> {
3929 let _result = self.send_raw(status);
3930 self.drop_without_shutdown();
3931 _result
3932 }
3933
3934 fn send_raw(&self, mut status: &PortStatus) -> Result<(), fidl::Error> {
3935 self.control_handle.inner.send::<PortGetStatusResponse>(
3936 (status,),
3937 self.tx_id,
3938 0x4235650aacca60b2,
3939 fidl::encoding::DynamicFlags::empty(),
3940 )
3941 }
3942}
3943
3944#[must_use = "FIDL methods require a response to be sent"]
3945#[derive(Debug)]
3946pub struct PortGetCountersResponder {
3947 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
3948 tx_id: u32,
3949}
3950
3951impl std::ops::Drop for PortGetCountersResponder {
3955 fn drop(&mut self) {
3956 self.control_handle.shutdown();
3957 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3959 }
3960}
3961
3962impl fidl::endpoints::Responder for PortGetCountersResponder {
3963 type ControlHandle = PortControlHandle;
3964
3965 fn control_handle(&self) -> &PortControlHandle {
3966 &self.control_handle
3967 }
3968
3969 fn drop_without_shutdown(mut self) {
3970 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3972 std::mem::forget(self);
3974 }
3975}
3976
3977impl PortGetCountersResponder {
3978 pub fn send(self, mut payload: &PortGetCountersResponse) -> Result<(), fidl::Error> {
3982 let _result = self.send_raw(payload);
3983 if _result.is_err() {
3984 self.control_handle.shutdown();
3985 }
3986 self.drop_without_shutdown();
3987 _result
3988 }
3989
3990 pub fn send_no_shutdown_on_err(
3992 self,
3993 mut payload: &PortGetCountersResponse,
3994 ) -> Result<(), fidl::Error> {
3995 let _result = self.send_raw(payload);
3996 self.drop_without_shutdown();
3997 _result
3998 }
3999
4000 fn send_raw(&self, mut payload: &PortGetCountersResponse) -> Result<(), fidl::Error> {
4001 self.control_handle.inner.send::<PortGetCountersResponse>(
4002 payload,
4003 self.tx_id,
4004 0x6a213b03c4fcbbac,
4005 fidl::encoding::DynamicFlags::empty(),
4006 )
4007 }
4008}
4009
4010#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4011pub struct PortWatcherMarker;
4012
4013impl fidl::endpoints::ProtocolMarker for PortWatcherMarker {
4014 type Proxy = PortWatcherProxy;
4015 type RequestStream = PortWatcherRequestStream;
4016 #[cfg(target_os = "fuchsia")]
4017 type SynchronousProxy = PortWatcherSynchronousProxy;
4018
4019 const DEBUG_NAME: &'static str = "(anonymous) PortWatcher";
4020}
4021
4022pub trait PortWatcherProxyInterface: Send + Sync {
4023 type WatchResponseFut: std::future::Future<Output = Result<DevicePortEvent, fidl::Error>> + Send;
4024 fn r#watch(&self) -> Self::WatchResponseFut;
4025}
4026#[derive(Debug)]
4027#[cfg(target_os = "fuchsia")]
4028pub struct PortWatcherSynchronousProxy {
4029 client: fidl::client::sync::Client,
4030}
4031
4032#[cfg(target_os = "fuchsia")]
4033impl fidl::endpoints::SynchronousProxy for PortWatcherSynchronousProxy {
4034 type Proxy = PortWatcherProxy;
4035 type Protocol = PortWatcherMarker;
4036
4037 fn from_channel(inner: fidl::Channel) -> Self {
4038 Self::new(inner)
4039 }
4040
4041 fn into_channel(self) -> fidl::Channel {
4042 self.client.into_channel()
4043 }
4044
4045 fn as_channel(&self) -> &fidl::Channel {
4046 self.client.as_channel()
4047 }
4048}
4049
4050#[cfg(target_os = "fuchsia")]
4051impl PortWatcherSynchronousProxy {
4052 pub fn new(channel: fidl::Channel) -> Self {
4053 let protocol_name = <PortWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4054 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4055 }
4056
4057 pub fn into_channel(self) -> fidl::Channel {
4058 self.client.into_channel()
4059 }
4060
4061 pub fn wait_for_event(
4064 &self,
4065 deadline: zx::MonotonicInstant,
4066 ) -> Result<PortWatcherEvent, fidl::Error> {
4067 PortWatcherEvent::decode(self.client.wait_for_event(deadline)?)
4068 }
4069
4070 pub fn r#watch(
4085 &self,
4086 ___deadline: zx::MonotonicInstant,
4087 ) -> Result<DevicePortEvent, fidl::Error> {
4088 let _response =
4089 self.client.send_query::<fidl::encoding::EmptyPayload, PortWatcherWatchResponse>(
4090 (),
4091 0x3e87244b74fff55e,
4092 fidl::encoding::DynamicFlags::empty(),
4093 ___deadline,
4094 )?;
4095 Ok(_response.event)
4096 }
4097}
4098
4099#[cfg(target_os = "fuchsia")]
4100impl From<PortWatcherSynchronousProxy> for zx::Handle {
4101 fn from(value: PortWatcherSynchronousProxy) -> Self {
4102 value.into_channel().into()
4103 }
4104}
4105
4106#[cfg(target_os = "fuchsia")]
4107impl From<fidl::Channel> for PortWatcherSynchronousProxy {
4108 fn from(value: fidl::Channel) -> Self {
4109 Self::new(value)
4110 }
4111}
4112
4113#[derive(Debug, Clone)]
4114pub struct PortWatcherProxy {
4115 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4116}
4117
4118impl fidl::endpoints::Proxy for PortWatcherProxy {
4119 type Protocol = PortWatcherMarker;
4120
4121 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4122 Self::new(inner)
4123 }
4124
4125 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4126 self.client.into_channel().map_err(|client| Self { client })
4127 }
4128
4129 fn as_channel(&self) -> &::fidl::AsyncChannel {
4130 self.client.as_channel()
4131 }
4132}
4133
4134impl PortWatcherProxy {
4135 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4137 let protocol_name = <PortWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4138 Self { client: fidl::client::Client::new(channel, protocol_name) }
4139 }
4140
4141 pub fn take_event_stream(&self) -> PortWatcherEventStream {
4147 PortWatcherEventStream { event_receiver: self.client.take_event_receiver() }
4148 }
4149
4150 pub fn r#watch(
4165 &self,
4166 ) -> fidl::client::QueryResponseFut<
4167 DevicePortEvent,
4168 fidl::encoding::DefaultFuchsiaResourceDialect,
4169 > {
4170 PortWatcherProxyInterface::r#watch(self)
4171 }
4172}
4173
4174impl PortWatcherProxyInterface for PortWatcherProxy {
4175 type WatchResponseFut = fidl::client::QueryResponseFut<
4176 DevicePortEvent,
4177 fidl::encoding::DefaultFuchsiaResourceDialect,
4178 >;
4179 fn r#watch(&self) -> Self::WatchResponseFut {
4180 fn _decode(
4181 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4182 ) -> Result<DevicePortEvent, fidl::Error> {
4183 let _response = fidl::client::decode_transaction_body::<
4184 PortWatcherWatchResponse,
4185 fidl::encoding::DefaultFuchsiaResourceDialect,
4186 0x3e87244b74fff55e,
4187 >(_buf?)?;
4188 Ok(_response.event)
4189 }
4190 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DevicePortEvent>(
4191 (),
4192 0x3e87244b74fff55e,
4193 fidl::encoding::DynamicFlags::empty(),
4194 _decode,
4195 )
4196 }
4197}
4198
4199pub struct PortWatcherEventStream {
4200 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4201}
4202
4203impl std::marker::Unpin for PortWatcherEventStream {}
4204
4205impl futures::stream::FusedStream for PortWatcherEventStream {
4206 fn is_terminated(&self) -> bool {
4207 self.event_receiver.is_terminated()
4208 }
4209}
4210
4211impl futures::Stream for PortWatcherEventStream {
4212 type Item = Result<PortWatcherEvent, fidl::Error>;
4213
4214 fn poll_next(
4215 mut self: std::pin::Pin<&mut Self>,
4216 cx: &mut std::task::Context<'_>,
4217 ) -> std::task::Poll<Option<Self::Item>> {
4218 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4219 &mut self.event_receiver,
4220 cx
4221 )?) {
4222 Some(buf) => std::task::Poll::Ready(Some(PortWatcherEvent::decode(buf))),
4223 None => std::task::Poll::Ready(None),
4224 }
4225 }
4226}
4227
4228#[derive(Debug)]
4229pub enum PortWatcherEvent {}
4230
4231impl PortWatcherEvent {
4232 fn decode(
4234 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4235 ) -> Result<PortWatcherEvent, fidl::Error> {
4236 let (bytes, _handles) = buf.split_mut();
4237 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4238 debug_assert_eq!(tx_header.tx_id, 0);
4239 match tx_header.ordinal {
4240 _ => Err(fidl::Error::UnknownOrdinal {
4241 ordinal: tx_header.ordinal,
4242 protocol_name: <PortWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4243 }),
4244 }
4245 }
4246}
4247
4248pub struct PortWatcherRequestStream {
4250 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4251 is_terminated: bool,
4252}
4253
4254impl std::marker::Unpin for PortWatcherRequestStream {}
4255
4256impl futures::stream::FusedStream for PortWatcherRequestStream {
4257 fn is_terminated(&self) -> bool {
4258 self.is_terminated
4259 }
4260}
4261
4262impl fidl::endpoints::RequestStream for PortWatcherRequestStream {
4263 type Protocol = PortWatcherMarker;
4264 type ControlHandle = PortWatcherControlHandle;
4265
4266 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4267 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4268 }
4269
4270 fn control_handle(&self) -> Self::ControlHandle {
4271 PortWatcherControlHandle { inner: self.inner.clone() }
4272 }
4273
4274 fn into_inner(
4275 self,
4276 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4277 {
4278 (self.inner, self.is_terminated)
4279 }
4280
4281 fn from_inner(
4282 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4283 is_terminated: bool,
4284 ) -> Self {
4285 Self { inner, is_terminated }
4286 }
4287}
4288
4289impl futures::Stream for PortWatcherRequestStream {
4290 type Item = Result<PortWatcherRequest, fidl::Error>;
4291
4292 fn poll_next(
4293 mut self: std::pin::Pin<&mut Self>,
4294 cx: &mut std::task::Context<'_>,
4295 ) -> std::task::Poll<Option<Self::Item>> {
4296 let this = &mut *self;
4297 if this.inner.check_shutdown(cx) {
4298 this.is_terminated = true;
4299 return std::task::Poll::Ready(None);
4300 }
4301 if this.is_terminated {
4302 panic!("polled PortWatcherRequestStream after completion");
4303 }
4304 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4305 |bytes, handles| {
4306 match this.inner.channel().read_etc(cx, bytes, handles) {
4307 std::task::Poll::Ready(Ok(())) => {}
4308 std::task::Poll::Pending => return std::task::Poll::Pending,
4309 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4310 this.is_terminated = true;
4311 return std::task::Poll::Ready(None);
4312 }
4313 std::task::Poll::Ready(Err(e)) => {
4314 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4315 e.into(),
4316 ))))
4317 }
4318 }
4319
4320 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4322
4323 std::task::Poll::Ready(Some(match header.ordinal {
4324 0x3e87244b74fff55e => {
4325 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4326 let mut req = fidl::new_empty!(
4327 fidl::encoding::EmptyPayload,
4328 fidl::encoding::DefaultFuchsiaResourceDialect
4329 );
4330 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4331 let control_handle = PortWatcherControlHandle { inner: this.inner.clone() };
4332 Ok(PortWatcherRequest::Watch {
4333 responder: PortWatcherWatchResponder {
4334 control_handle: std::mem::ManuallyDrop::new(control_handle),
4335 tx_id: header.tx_id,
4336 },
4337 })
4338 }
4339 _ => Err(fidl::Error::UnknownOrdinal {
4340 ordinal: header.ordinal,
4341 protocol_name:
4342 <PortWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4343 }),
4344 }))
4345 },
4346 )
4347 }
4348}
4349
4350#[derive(Debug)]
4352pub enum PortWatcherRequest {
4353 Watch { responder: PortWatcherWatchResponder },
4368}
4369
4370impl PortWatcherRequest {
4371 #[allow(irrefutable_let_patterns)]
4372 pub fn into_watch(self) -> Option<(PortWatcherWatchResponder)> {
4373 if let PortWatcherRequest::Watch { responder } = self {
4374 Some((responder))
4375 } else {
4376 None
4377 }
4378 }
4379
4380 pub fn method_name(&self) -> &'static str {
4382 match *self {
4383 PortWatcherRequest::Watch { .. } => "watch",
4384 }
4385 }
4386}
4387
4388#[derive(Debug, Clone)]
4389pub struct PortWatcherControlHandle {
4390 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4391}
4392
4393impl fidl::endpoints::ControlHandle for PortWatcherControlHandle {
4394 fn shutdown(&self) {
4395 self.inner.shutdown()
4396 }
4397 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4398 self.inner.shutdown_with_epitaph(status)
4399 }
4400
4401 fn is_closed(&self) -> bool {
4402 self.inner.channel().is_closed()
4403 }
4404 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4405 self.inner.channel().on_closed()
4406 }
4407
4408 #[cfg(target_os = "fuchsia")]
4409 fn signal_peer(
4410 &self,
4411 clear_mask: zx::Signals,
4412 set_mask: zx::Signals,
4413 ) -> Result<(), zx_status::Status> {
4414 use fidl::Peered;
4415 self.inner.channel().signal_peer(clear_mask, set_mask)
4416 }
4417}
4418
4419impl PortWatcherControlHandle {}
4420
4421#[must_use = "FIDL methods require a response to be sent"]
4422#[derive(Debug)]
4423pub struct PortWatcherWatchResponder {
4424 control_handle: std::mem::ManuallyDrop<PortWatcherControlHandle>,
4425 tx_id: u32,
4426}
4427
4428impl std::ops::Drop for PortWatcherWatchResponder {
4432 fn drop(&mut self) {
4433 self.control_handle.shutdown();
4434 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4436 }
4437}
4438
4439impl fidl::endpoints::Responder for PortWatcherWatchResponder {
4440 type ControlHandle = PortWatcherControlHandle;
4441
4442 fn control_handle(&self) -> &PortWatcherControlHandle {
4443 &self.control_handle
4444 }
4445
4446 fn drop_without_shutdown(mut self) {
4447 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4449 std::mem::forget(self);
4451 }
4452}
4453
4454impl PortWatcherWatchResponder {
4455 pub fn send(self, mut event: &DevicePortEvent) -> Result<(), fidl::Error> {
4459 let _result = self.send_raw(event);
4460 if _result.is_err() {
4461 self.control_handle.shutdown();
4462 }
4463 self.drop_without_shutdown();
4464 _result
4465 }
4466
4467 pub fn send_no_shutdown_on_err(self, mut event: &DevicePortEvent) -> Result<(), fidl::Error> {
4469 let _result = self.send_raw(event);
4470 self.drop_without_shutdown();
4471 _result
4472 }
4473
4474 fn send_raw(&self, mut event: &DevicePortEvent) -> Result<(), fidl::Error> {
4475 self.control_handle.inner.send::<PortWatcherWatchResponse>(
4476 (event,),
4477 self.tx_id,
4478 0x3e87244b74fff55e,
4479 fidl::encoding::DynamicFlags::empty(),
4480 )
4481 }
4482}
4483
4484#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4485pub struct SessionMarker;
4486
4487impl fidl::endpoints::ProtocolMarker for SessionMarker {
4488 type Proxy = SessionProxy;
4489 type RequestStream = SessionRequestStream;
4490 #[cfg(target_os = "fuchsia")]
4491 type SynchronousProxy = SessionSynchronousProxy;
4492
4493 const DEBUG_NAME: &'static str = "(anonymous) Session";
4494}
4495pub type SessionAttachResult = Result<(), i32>;
4496pub type SessionDetachResult = Result<(), i32>;
4497
4498pub trait SessionProxyInterface: Send + Sync {
4499 type AttachResponseFut: std::future::Future<Output = Result<SessionAttachResult, fidl::Error>>
4500 + Send;
4501 fn r#attach(&self, port: &PortId, rx_frames: &[FrameType]) -> Self::AttachResponseFut;
4502 type DetachResponseFut: std::future::Future<Output = Result<SessionDetachResult, fidl::Error>>
4503 + Send;
4504 fn r#detach(&self, port: &PortId) -> Self::DetachResponseFut;
4505 fn r#close(&self) -> Result<(), fidl::Error>;
4506 type WatchDelegatedRxLeaseResponseFut: std::future::Future<Output = Result<DelegatedRxLease, fidl::Error>>
4507 + Send;
4508 fn r#watch_delegated_rx_lease(&self) -> Self::WatchDelegatedRxLeaseResponseFut;
4509}
4510#[derive(Debug)]
4511#[cfg(target_os = "fuchsia")]
4512pub struct SessionSynchronousProxy {
4513 client: fidl::client::sync::Client,
4514}
4515
4516#[cfg(target_os = "fuchsia")]
4517impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
4518 type Proxy = SessionProxy;
4519 type Protocol = SessionMarker;
4520
4521 fn from_channel(inner: fidl::Channel) -> Self {
4522 Self::new(inner)
4523 }
4524
4525 fn into_channel(self) -> fidl::Channel {
4526 self.client.into_channel()
4527 }
4528
4529 fn as_channel(&self) -> &fidl::Channel {
4530 self.client.as_channel()
4531 }
4532}
4533
4534#[cfg(target_os = "fuchsia")]
4535impl SessionSynchronousProxy {
4536 pub fn new(channel: fidl::Channel) -> Self {
4537 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4538 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4539 }
4540
4541 pub fn into_channel(self) -> fidl::Channel {
4542 self.client.into_channel()
4543 }
4544
4545 pub fn wait_for_event(
4548 &self,
4549 deadline: zx::MonotonicInstant,
4550 ) -> Result<SessionEvent, fidl::Error> {
4551 SessionEvent::decode(self.client.wait_for_event(deadline)?)
4552 }
4553
4554 pub fn r#attach(
4566 &self,
4567 mut port: &PortId,
4568 mut rx_frames: &[FrameType],
4569 ___deadline: zx::MonotonicInstant,
4570 ) -> Result<SessionAttachResult, fidl::Error> {
4571 let _response = self.client.send_query::<
4572 SessionAttachRequest,
4573 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4574 >(
4575 (port, rx_frames,),
4576 0x1e89c9013e201379,
4577 fidl::encoding::DynamicFlags::empty(),
4578 ___deadline,
4579 )?;
4580 Ok(_response.map(|x| x))
4581 }
4582
4583 pub fn r#detach(
4594 &self,
4595 mut port: &PortId,
4596 ___deadline: zx::MonotonicInstant,
4597 ) -> Result<SessionDetachResult, fidl::Error> {
4598 let _response = self.client.send_query::<
4599 SessionDetachRequest,
4600 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4601 >(
4602 (port,),
4603 0x68c40cf8fb549867,
4604 fidl::encoding::DynamicFlags::empty(),
4605 ___deadline,
4606 )?;
4607 Ok(_response.map(|x| x))
4608 }
4609
4610 pub fn r#close(&self) -> Result<(), fidl::Error> {
4618 self.client.send::<fidl::encoding::EmptyPayload>(
4619 (),
4620 0x393d5070394a92f6,
4621 fidl::encoding::DynamicFlags::empty(),
4622 )
4623 }
4624
4625 pub fn r#watch_delegated_rx_lease(
4640 &self,
4641 ___deadline: zx::MonotonicInstant,
4642 ) -> Result<DelegatedRxLease, fidl::Error> {
4643 let _response = self
4644 .client
4645 .send_query::<fidl::encoding::EmptyPayload, SessionWatchDelegatedRxLeaseResponse>(
4646 (),
4647 0x764d823ee64803b5,
4648 fidl::encoding::DynamicFlags::empty(),
4649 ___deadline,
4650 )?;
4651 Ok(_response.lease)
4652 }
4653}
4654
4655#[cfg(target_os = "fuchsia")]
4656impl From<SessionSynchronousProxy> for zx::Handle {
4657 fn from(value: SessionSynchronousProxy) -> Self {
4658 value.into_channel().into()
4659 }
4660}
4661
4662#[cfg(target_os = "fuchsia")]
4663impl From<fidl::Channel> for SessionSynchronousProxy {
4664 fn from(value: fidl::Channel) -> Self {
4665 Self::new(value)
4666 }
4667}
4668
4669#[derive(Debug, Clone)]
4670pub struct SessionProxy {
4671 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4672}
4673
4674impl fidl::endpoints::Proxy for SessionProxy {
4675 type Protocol = SessionMarker;
4676
4677 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4678 Self::new(inner)
4679 }
4680
4681 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4682 self.client.into_channel().map_err(|client| Self { client })
4683 }
4684
4685 fn as_channel(&self) -> &::fidl::AsyncChannel {
4686 self.client.as_channel()
4687 }
4688}
4689
4690impl SessionProxy {
4691 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4693 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4694 Self { client: fidl::client::Client::new(channel, protocol_name) }
4695 }
4696
4697 pub fn take_event_stream(&self) -> SessionEventStream {
4703 SessionEventStream { event_receiver: self.client.take_event_receiver() }
4704 }
4705
4706 pub fn r#attach(
4718 &self,
4719 mut port: &PortId,
4720 mut rx_frames: &[FrameType],
4721 ) -> fidl::client::QueryResponseFut<
4722 SessionAttachResult,
4723 fidl::encoding::DefaultFuchsiaResourceDialect,
4724 > {
4725 SessionProxyInterface::r#attach(self, port, rx_frames)
4726 }
4727
4728 pub fn r#detach(
4739 &self,
4740 mut port: &PortId,
4741 ) -> fidl::client::QueryResponseFut<
4742 SessionDetachResult,
4743 fidl::encoding::DefaultFuchsiaResourceDialect,
4744 > {
4745 SessionProxyInterface::r#detach(self, port)
4746 }
4747
4748 pub fn r#close(&self) -> Result<(), fidl::Error> {
4756 SessionProxyInterface::r#close(self)
4757 }
4758
4759 pub fn r#watch_delegated_rx_lease(
4774 &self,
4775 ) -> fidl::client::QueryResponseFut<
4776 DelegatedRxLease,
4777 fidl::encoding::DefaultFuchsiaResourceDialect,
4778 > {
4779 SessionProxyInterface::r#watch_delegated_rx_lease(self)
4780 }
4781}
4782
4783impl SessionProxyInterface for SessionProxy {
4784 type AttachResponseFut = fidl::client::QueryResponseFut<
4785 SessionAttachResult,
4786 fidl::encoding::DefaultFuchsiaResourceDialect,
4787 >;
4788 fn r#attach(&self, mut port: &PortId, mut rx_frames: &[FrameType]) -> Self::AttachResponseFut {
4789 fn _decode(
4790 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4791 ) -> Result<SessionAttachResult, fidl::Error> {
4792 let _response = fidl::client::decode_transaction_body::<
4793 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4794 fidl::encoding::DefaultFuchsiaResourceDialect,
4795 0x1e89c9013e201379,
4796 >(_buf?)?;
4797 Ok(_response.map(|x| x))
4798 }
4799 self.client.send_query_and_decode::<SessionAttachRequest, SessionAttachResult>(
4800 (port, rx_frames),
4801 0x1e89c9013e201379,
4802 fidl::encoding::DynamicFlags::empty(),
4803 _decode,
4804 )
4805 }
4806
4807 type DetachResponseFut = fidl::client::QueryResponseFut<
4808 SessionDetachResult,
4809 fidl::encoding::DefaultFuchsiaResourceDialect,
4810 >;
4811 fn r#detach(&self, mut port: &PortId) -> Self::DetachResponseFut {
4812 fn _decode(
4813 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4814 ) -> Result<SessionDetachResult, fidl::Error> {
4815 let _response = fidl::client::decode_transaction_body::<
4816 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4817 fidl::encoding::DefaultFuchsiaResourceDialect,
4818 0x68c40cf8fb549867,
4819 >(_buf?)?;
4820 Ok(_response.map(|x| x))
4821 }
4822 self.client.send_query_and_decode::<SessionDetachRequest, SessionDetachResult>(
4823 (port,),
4824 0x68c40cf8fb549867,
4825 fidl::encoding::DynamicFlags::empty(),
4826 _decode,
4827 )
4828 }
4829
4830 fn r#close(&self) -> Result<(), fidl::Error> {
4831 self.client.send::<fidl::encoding::EmptyPayload>(
4832 (),
4833 0x393d5070394a92f6,
4834 fidl::encoding::DynamicFlags::empty(),
4835 )
4836 }
4837
4838 type WatchDelegatedRxLeaseResponseFut = fidl::client::QueryResponseFut<
4839 DelegatedRxLease,
4840 fidl::encoding::DefaultFuchsiaResourceDialect,
4841 >;
4842 fn r#watch_delegated_rx_lease(&self) -> Self::WatchDelegatedRxLeaseResponseFut {
4843 fn _decode(
4844 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4845 ) -> Result<DelegatedRxLease, fidl::Error> {
4846 let _response = fidl::client::decode_transaction_body::<
4847 SessionWatchDelegatedRxLeaseResponse,
4848 fidl::encoding::DefaultFuchsiaResourceDialect,
4849 0x764d823ee64803b5,
4850 >(_buf?)?;
4851 Ok(_response.lease)
4852 }
4853 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelegatedRxLease>(
4854 (),
4855 0x764d823ee64803b5,
4856 fidl::encoding::DynamicFlags::empty(),
4857 _decode,
4858 )
4859 }
4860}
4861
4862pub struct SessionEventStream {
4863 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4864}
4865
4866impl std::marker::Unpin for SessionEventStream {}
4867
4868impl futures::stream::FusedStream for SessionEventStream {
4869 fn is_terminated(&self) -> bool {
4870 self.event_receiver.is_terminated()
4871 }
4872}
4873
4874impl futures::Stream for SessionEventStream {
4875 type Item = Result<SessionEvent, fidl::Error>;
4876
4877 fn poll_next(
4878 mut self: std::pin::Pin<&mut Self>,
4879 cx: &mut std::task::Context<'_>,
4880 ) -> std::task::Poll<Option<Self::Item>> {
4881 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4882 &mut self.event_receiver,
4883 cx
4884 )?) {
4885 Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
4886 None => std::task::Poll::Ready(None),
4887 }
4888 }
4889}
4890
4891#[derive(Debug)]
4892pub enum SessionEvent {}
4893
4894impl SessionEvent {
4895 fn decode(
4897 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4898 ) -> Result<SessionEvent, fidl::Error> {
4899 let (bytes, _handles) = buf.split_mut();
4900 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4901 debug_assert_eq!(tx_header.tx_id, 0);
4902 match tx_header.ordinal {
4903 _ => Err(fidl::Error::UnknownOrdinal {
4904 ordinal: tx_header.ordinal,
4905 protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4906 }),
4907 }
4908 }
4909}
4910
4911pub struct SessionRequestStream {
4913 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4914 is_terminated: bool,
4915}
4916
4917impl std::marker::Unpin for SessionRequestStream {}
4918
4919impl futures::stream::FusedStream for SessionRequestStream {
4920 fn is_terminated(&self) -> bool {
4921 self.is_terminated
4922 }
4923}
4924
4925impl fidl::endpoints::RequestStream for SessionRequestStream {
4926 type Protocol = SessionMarker;
4927 type ControlHandle = SessionControlHandle;
4928
4929 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4930 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4931 }
4932
4933 fn control_handle(&self) -> Self::ControlHandle {
4934 SessionControlHandle { inner: self.inner.clone() }
4935 }
4936
4937 fn into_inner(
4938 self,
4939 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4940 {
4941 (self.inner, self.is_terminated)
4942 }
4943
4944 fn from_inner(
4945 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4946 is_terminated: bool,
4947 ) -> Self {
4948 Self { inner, is_terminated }
4949 }
4950}
4951
4952impl futures::Stream for SessionRequestStream {
4953 type Item = Result<SessionRequest, fidl::Error>;
4954
4955 fn poll_next(
4956 mut self: std::pin::Pin<&mut Self>,
4957 cx: &mut std::task::Context<'_>,
4958 ) -> std::task::Poll<Option<Self::Item>> {
4959 let this = &mut *self;
4960 if this.inner.check_shutdown(cx) {
4961 this.is_terminated = true;
4962 return std::task::Poll::Ready(None);
4963 }
4964 if this.is_terminated {
4965 panic!("polled SessionRequestStream after completion");
4966 }
4967 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4968 |bytes, handles| {
4969 match this.inner.channel().read_etc(cx, bytes, handles) {
4970 std::task::Poll::Ready(Ok(())) => {}
4971 std::task::Poll::Pending => return std::task::Poll::Pending,
4972 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4973 this.is_terminated = true;
4974 return std::task::Poll::Ready(None);
4975 }
4976 std::task::Poll::Ready(Err(e)) => {
4977 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4978 e.into(),
4979 ))))
4980 }
4981 }
4982
4983 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4985
4986 std::task::Poll::Ready(Some(match header.ordinal {
4987 0x1e89c9013e201379 => {
4988 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4989 let mut req = fidl::new_empty!(
4990 SessionAttachRequest,
4991 fidl::encoding::DefaultFuchsiaResourceDialect
4992 );
4993 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionAttachRequest>(&header, _body_bytes, handles, &mut req)?;
4994 let control_handle = SessionControlHandle { inner: this.inner.clone() };
4995 Ok(SessionRequest::Attach {
4996 port: req.port,
4997 rx_frames: req.rx_frames,
4998
4999 responder: SessionAttachResponder {
5000 control_handle: std::mem::ManuallyDrop::new(control_handle),
5001 tx_id: header.tx_id,
5002 },
5003 })
5004 }
5005 0x68c40cf8fb549867 => {
5006 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5007 let mut req = fidl::new_empty!(
5008 SessionDetachRequest,
5009 fidl::encoding::DefaultFuchsiaResourceDialect
5010 );
5011 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionDetachRequest>(&header, _body_bytes, handles, &mut req)?;
5012 let control_handle = SessionControlHandle { inner: this.inner.clone() };
5013 Ok(SessionRequest::Detach {
5014 port: req.port,
5015
5016 responder: SessionDetachResponder {
5017 control_handle: std::mem::ManuallyDrop::new(control_handle),
5018 tx_id: header.tx_id,
5019 },
5020 })
5021 }
5022 0x393d5070394a92f6 => {
5023 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5024 let mut req = fidl::new_empty!(
5025 fidl::encoding::EmptyPayload,
5026 fidl::encoding::DefaultFuchsiaResourceDialect
5027 );
5028 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5029 let control_handle = SessionControlHandle { inner: this.inner.clone() };
5030 Ok(SessionRequest::Close { control_handle })
5031 }
5032 0x764d823ee64803b5 => {
5033 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5034 let mut req = fidl::new_empty!(
5035 fidl::encoding::EmptyPayload,
5036 fidl::encoding::DefaultFuchsiaResourceDialect
5037 );
5038 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5039 let control_handle = SessionControlHandle { inner: this.inner.clone() };
5040 Ok(SessionRequest::WatchDelegatedRxLease {
5041 responder: SessionWatchDelegatedRxLeaseResponder {
5042 control_handle: std::mem::ManuallyDrop::new(control_handle),
5043 tx_id: header.tx_id,
5044 },
5045 })
5046 }
5047 _ => Err(fidl::Error::UnknownOrdinal {
5048 ordinal: header.ordinal,
5049 protocol_name:
5050 <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5051 }),
5052 }))
5053 },
5054 )
5055 }
5056}
5057
5058#[derive(Debug)]
5085pub enum SessionRequest {
5086 Attach { port: PortId, rx_frames: Vec<FrameType>, responder: SessionAttachResponder },
5098 Detach { port: PortId, responder: SessionDetachResponder },
5109 Close { control_handle: SessionControlHandle },
5117 WatchDelegatedRxLease { responder: SessionWatchDelegatedRxLeaseResponder },
5132}
5133
5134impl SessionRequest {
5135 #[allow(irrefutable_let_patterns)]
5136 pub fn into_attach(self) -> Option<(PortId, Vec<FrameType>, SessionAttachResponder)> {
5137 if let SessionRequest::Attach { port, rx_frames, responder } = self {
5138 Some((port, rx_frames, responder))
5139 } else {
5140 None
5141 }
5142 }
5143
5144 #[allow(irrefutable_let_patterns)]
5145 pub fn into_detach(self) -> Option<(PortId, SessionDetachResponder)> {
5146 if let SessionRequest::Detach { port, responder } = self {
5147 Some((port, responder))
5148 } else {
5149 None
5150 }
5151 }
5152
5153 #[allow(irrefutable_let_patterns)]
5154 pub fn into_close(self) -> Option<(SessionControlHandle)> {
5155 if let SessionRequest::Close { control_handle } = self {
5156 Some((control_handle))
5157 } else {
5158 None
5159 }
5160 }
5161
5162 #[allow(irrefutable_let_patterns)]
5163 pub fn into_watch_delegated_rx_lease(self) -> Option<(SessionWatchDelegatedRxLeaseResponder)> {
5164 if let SessionRequest::WatchDelegatedRxLease { responder } = self {
5165 Some((responder))
5166 } else {
5167 None
5168 }
5169 }
5170
5171 pub fn method_name(&self) -> &'static str {
5173 match *self {
5174 SessionRequest::Attach { .. } => "attach",
5175 SessionRequest::Detach { .. } => "detach",
5176 SessionRequest::Close { .. } => "close",
5177 SessionRequest::WatchDelegatedRxLease { .. } => "watch_delegated_rx_lease",
5178 }
5179 }
5180}
5181
5182#[derive(Debug, Clone)]
5183pub struct SessionControlHandle {
5184 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5185}
5186
5187impl fidl::endpoints::ControlHandle for SessionControlHandle {
5188 fn shutdown(&self) {
5189 self.inner.shutdown()
5190 }
5191 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5192 self.inner.shutdown_with_epitaph(status)
5193 }
5194
5195 fn is_closed(&self) -> bool {
5196 self.inner.channel().is_closed()
5197 }
5198 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5199 self.inner.channel().on_closed()
5200 }
5201
5202 #[cfg(target_os = "fuchsia")]
5203 fn signal_peer(
5204 &self,
5205 clear_mask: zx::Signals,
5206 set_mask: zx::Signals,
5207 ) -> Result<(), zx_status::Status> {
5208 use fidl::Peered;
5209 self.inner.channel().signal_peer(clear_mask, set_mask)
5210 }
5211}
5212
5213impl SessionControlHandle {}
5214
5215#[must_use = "FIDL methods require a response to be sent"]
5216#[derive(Debug)]
5217pub struct SessionAttachResponder {
5218 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5219 tx_id: u32,
5220}
5221
5222impl std::ops::Drop for SessionAttachResponder {
5226 fn drop(&mut self) {
5227 self.control_handle.shutdown();
5228 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5230 }
5231}
5232
5233impl fidl::endpoints::Responder for SessionAttachResponder {
5234 type ControlHandle = SessionControlHandle;
5235
5236 fn control_handle(&self) -> &SessionControlHandle {
5237 &self.control_handle
5238 }
5239
5240 fn drop_without_shutdown(mut self) {
5241 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5243 std::mem::forget(self);
5245 }
5246}
5247
5248impl SessionAttachResponder {
5249 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5253 let _result = self.send_raw(result);
5254 if _result.is_err() {
5255 self.control_handle.shutdown();
5256 }
5257 self.drop_without_shutdown();
5258 _result
5259 }
5260
5261 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5263 let _result = self.send_raw(result);
5264 self.drop_without_shutdown();
5265 _result
5266 }
5267
5268 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5269 self.control_handle
5270 .inner
5271 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5272 result,
5273 self.tx_id,
5274 0x1e89c9013e201379,
5275 fidl::encoding::DynamicFlags::empty(),
5276 )
5277 }
5278}
5279
5280#[must_use = "FIDL methods require a response to be sent"]
5281#[derive(Debug)]
5282pub struct SessionDetachResponder {
5283 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5284 tx_id: u32,
5285}
5286
5287impl std::ops::Drop for SessionDetachResponder {
5291 fn drop(&mut self) {
5292 self.control_handle.shutdown();
5293 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5295 }
5296}
5297
5298impl fidl::endpoints::Responder for SessionDetachResponder {
5299 type ControlHandle = SessionControlHandle;
5300
5301 fn control_handle(&self) -> &SessionControlHandle {
5302 &self.control_handle
5303 }
5304
5305 fn drop_without_shutdown(mut self) {
5306 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5308 std::mem::forget(self);
5310 }
5311}
5312
5313impl SessionDetachResponder {
5314 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5318 let _result = self.send_raw(result);
5319 if _result.is_err() {
5320 self.control_handle.shutdown();
5321 }
5322 self.drop_without_shutdown();
5323 _result
5324 }
5325
5326 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5328 let _result = self.send_raw(result);
5329 self.drop_without_shutdown();
5330 _result
5331 }
5332
5333 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5334 self.control_handle
5335 .inner
5336 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5337 result,
5338 self.tx_id,
5339 0x68c40cf8fb549867,
5340 fidl::encoding::DynamicFlags::empty(),
5341 )
5342 }
5343}
5344
5345#[must_use = "FIDL methods require a response to be sent"]
5346#[derive(Debug)]
5347pub struct SessionWatchDelegatedRxLeaseResponder {
5348 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5349 tx_id: u32,
5350}
5351
5352impl std::ops::Drop for SessionWatchDelegatedRxLeaseResponder {
5356 fn drop(&mut self) {
5357 self.control_handle.shutdown();
5358 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5360 }
5361}
5362
5363impl fidl::endpoints::Responder for SessionWatchDelegatedRxLeaseResponder {
5364 type ControlHandle = SessionControlHandle;
5365
5366 fn control_handle(&self) -> &SessionControlHandle {
5367 &self.control_handle
5368 }
5369
5370 fn drop_without_shutdown(mut self) {
5371 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5373 std::mem::forget(self);
5375 }
5376}
5377
5378impl SessionWatchDelegatedRxLeaseResponder {
5379 pub fn send(self, mut lease: DelegatedRxLease) -> Result<(), fidl::Error> {
5383 let _result = self.send_raw(lease);
5384 if _result.is_err() {
5385 self.control_handle.shutdown();
5386 }
5387 self.drop_without_shutdown();
5388 _result
5389 }
5390
5391 pub fn send_no_shutdown_on_err(self, mut lease: DelegatedRxLease) -> Result<(), fidl::Error> {
5393 let _result = self.send_raw(lease);
5394 self.drop_without_shutdown();
5395 _result
5396 }
5397
5398 fn send_raw(&self, mut lease: DelegatedRxLease) -> Result<(), fidl::Error> {
5399 self.control_handle.inner.send::<SessionWatchDelegatedRxLeaseResponse>(
5400 (&mut lease,),
5401 self.tx_id,
5402 0x764d823ee64803b5,
5403 fidl::encoding::DynamicFlags::empty(),
5404 )
5405 }
5406}
5407
5408#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5409pub struct StatusWatcherMarker;
5410
5411impl fidl::endpoints::ProtocolMarker for StatusWatcherMarker {
5412 type Proxy = StatusWatcherProxy;
5413 type RequestStream = StatusWatcherRequestStream;
5414 #[cfg(target_os = "fuchsia")]
5415 type SynchronousProxy = StatusWatcherSynchronousProxy;
5416
5417 const DEBUG_NAME: &'static str = "(anonymous) StatusWatcher";
5418}
5419
5420pub trait StatusWatcherProxyInterface: Send + Sync {
5421 type WatchStatusResponseFut: std::future::Future<Output = Result<PortStatus, fidl::Error>>
5422 + Send;
5423 fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
5424}
5425#[derive(Debug)]
5426#[cfg(target_os = "fuchsia")]
5427pub struct StatusWatcherSynchronousProxy {
5428 client: fidl::client::sync::Client,
5429}
5430
5431#[cfg(target_os = "fuchsia")]
5432impl fidl::endpoints::SynchronousProxy for StatusWatcherSynchronousProxy {
5433 type Proxy = StatusWatcherProxy;
5434 type Protocol = StatusWatcherMarker;
5435
5436 fn from_channel(inner: fidl::Channel) -> Self {
5437 Self::new(inner)
5438 }
5439
5440 fn into_channel(self) -> fidl::Channel {
5441 self.client.into_channel()
5442 }
5443
5444 fn as_channel(&self) -> &fidl::Channel {
5445 self.client.as_channel()
5446 }
5447}
5448
5449#[cfg(target_os = "fuchsia")]
5450impl StatusWatcherSynchronousProxy {
5451 pub fn new(channel: fidl::Channel) -> Self {
5452 let protocol_name = <StatusWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5453 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5454 }
5455
5456 pub fn into_channel(self) -> fidl::Channel {
5457 self.client.into_channel()
5458 }
5459
5460 pub fn wait_for_event(
5463 &self,
5464 deadline: zx::MonotonicInstant,
5465 ) -> Result<StatusWatcherEvent, fidl::Error> {
5466 StatusWatcherEvent::decode(self.client.wait_for_event(deadline)?)
5467 }
5468
5469 pub fn r#watch_status(
5481 &self,
5482 ___deadline: zx::MonotonicInstant,
5483 ) -> Result<PortStatus, fidl::Error> {
5484 let _response = self
5485 .client
5486 .send_query::<fidl::encoding::EmptyPayload, StatusWatcherWatchStatusResponse>(
5487 (),
5488 0x1369a8125c0862b9,
5489 fidl::encoding::DynamicFlags::empty(),
5490 ___deadline,
5491 )?;
5492 Ok(_response.port_status)
5493 }
5494}
5495
5496#[cfg(target_os = "fuchsia")]
5497impl From<StatusWatcherSynchronousProxy> for zx::Handle {
5498 fn from(value: StatusWatcherSynchronousProxy) -> Self {
5499 value.into_channel().into()
5500 }
5501}
5502
5503#[cfg(target_os = "fuchsia")]
5504impl From<fidl::Channel> for StatusWatcherSynchronousProxy {
5505 fn from(value: fidl::Channel) -> Self {
5506 Self::new(value)
5507 }
5508}
5509
5510#[derive(Debug, Clone)]
5511pub struct StatusWatcherProxy {
5512 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5513}
5514
5515impl fidl::endpoints::Proxy for StatusWatcherProxy {
5516 type Protocol = StatusWatcherMarker;
5517
5518 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5519 Self::new(inner)
5520 }
5521
5522 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5523 self.client.into_channel().map_err(|client| Self { client })
5524 }
5525
5526 fn as_channel(&self) -> &::fidl::AsyncChannel {
5527 self.client.as_channel()
5528 }
5529}
5530
5531impl StatusWatcherProxy {
5532 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5534 let protocol_name = <StatusWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5535 Self { client: fidl::client::Client::new(channel, protocol_name) }
5536 }
5537
5538 pub fn take_event_stream(&self) -> StatusWatcherEventStream {
5544 StatusWatcherEventStream { event_receiver: self.client.take_event_receiver() }
5545 }
5546
5547 pub fn r#watch_status(
5559 &self,
5560 ) -> fidl::client::QueryResponseFut<PortStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
5561 {
5562 StatusWatcherProxyInterface::r#watch_status(self)
5563 }
5564}
5565
5566impl StatusWatcherProxyInterface for StatusWatcherProxy {
5567 type WatchStatusResponseFut =
5568 fidl::client::QueryResponseFut<PortStatus, fidl::encoding::DefaultFuchsiaResourceDialect>;
5569 fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
5570 fn _decode(
5571 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5572 ) -> Result<PortStatus, fidl::Error> {
5573 let _response = fidl::client::decode_transaction_body::<
5574 StatusWatcherWatchStatusResponse,
5575 fidl::encoding::DefaultFuchsiaResourceDialect,
5576 0x1369a8125c0862b9,
5577 >(_buf?)?;
5578 Ok(_response.port_status)
5579 }
5580 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PortStatus>(
5581 (),
5582 0x1369a8125c0862b9,
5583 fidl::encoding::DynamicFlags::empty(),
5584 _decode,
5585 )
5586 }
5587}
5588
5589pub struct StatusWatcherEventStream {
5590 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5591}
5592
5593impl std::marker::Unpin for StatusWatcherEventStream {}
5594
5595impl futures::stream::FusedStream for StatusWatcherEventStream {
5596 fn is_terminated(&self) -> bool {
5597 self.event_receiver.is_terminated()
5598 }
5599}
5600
5601impl futures::Stream for StatusWatcherEventStream {
5602 type Item = Result<StatusWatcherEvent, fidl::Error>;
5603
5604 fn poll_next(
5605 mut self: std::pin::Pin<&mut Self>,
5606 cx: &mut std::task::Context<'_>,
5607 ) -> std::task::Poll<Option<Self::Item>> {
5608 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5609 &mut self.event_receiver,
5610 cx
5611 )?) {
5612 Some(buf) => std::task::Poll::Ready(Some(StatusWatcherEvent::decode(buf))),
5613 None => std::task::Poll::Ready(None),
5614 }
5615 }
5616}
5617
5618#[derive(Debug)]
5619pub enum StatusWatcherEvent {}
5620
5621impl StatusWatcherEvent {
5622 fn decode(
5624 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5625 ) -> Result<StatusWatcherEvent, fidl::Error> {
5626 let (bytes, _handles) = buf.split_mut();
5627 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5628 debug_assert_eq!(tx_header.tx_id, 0);
5629 match tx_header.ordinal {
5630 _ => Err(fidl::Error::UnknownOrdinal {
5631 ordinal: tx_header.ordinal,
5632 protocol_name: <StatusWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5633 }),
5634 }
5635 }
5636}
5637
5638pub struct StatusWatcherRequestStream {
5640 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5641 is_terminated: bool,
5642}
5643
5644impl std::marker::Unpin for StatusWatcherRequestStream {}
5645
5646impl futures::stream::FusedStream for StatusWatcherRequestStream {
5647 fn is_terminated(&self) -> bool {
5648 self.is_terminated
5649 }
5650}
5651
5652impl fidl::endpoints::RequestStream for StatusWatcherRequestStream {
5653 type Protocol = StatusWatcherMarker;
5654 type ControlHandle = StatusWatcherControlHandle;
5655
5656 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5657 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5658 }
5659
5660 fn control_handle(&self) -> Self::ControlHandle {
5661 StatusWatcherControlHandle { inner: self.inner.clone() }
5662 }
5663
5664 fn into_inner(
5665 self,
5666 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5667 {
5668 (self.inner, self.is_terminated)
5669 }
5670
5671 fn from_inner(
5672 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5673 is_terminated: bool,
5674 ) -> Self {
5675 Self { inner, is_terminated }
5676 }
5677}
5678
5679impl futures::Stream for StatusWatcherRequestStream {
5680 type Item = Result<StatusWatcherRequest, fidl::Error>;
5681
5682 fn poll_next(
5683 mut self: std::pin::Pin<&mut Self>,
5684 cx: &mut std::task::Context<'_>,
5685 ) -> std::task::Poll<Option<Self::Item>> {
5686 let this = &mut *self;
5687 if this.inner.check_shutdown(cx) {
5688 this.is_terminated = true;
5689 return std::task::Poll::Ready(None);
5690 }
5691 if this.is_terminated {
5692 panic!("polled StatusWatcherRequestStream after completion");
5693 }
5694 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5695 |bytes, handles| {
5696 match this.inner.channel().read_etc(cx, bytes, handles) {
5697 std::task::Poll::Ready(Ok(())) => {}
5698 std::task::Poll::Pending => return std::task::Poll::Pending,
5699 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5700 this.is_terminated = true;
5701 return std::task::Poll::Ready(None);
5702 }
5703 std::task::Poll::Ready(Err(e)) => {
5704 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5705 e.into(),
5706 ))))
5707 }
5708 }
5709
5710 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5712
5713 std::task::Poll::Ready(Some(match header.ordinal {
5714 0x1369a8125c0862b9 => {
5715 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5716 let mut req = fidl::new_empty!(
5717 fidl::encoding::EmptyPayload,
5718 fidl::encoding::DefaultFuchsiaResourceDialect
5719 );
5720 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5721 let control_handle =
5722 StatusWatcherControlHandle { inner: this.inner.clone() };
5723 Ok(StatusWatcherRequest::WatchStatus {
5724 responder: StatusWatcherWatchStatusResponder {
5725 control_handle: std::mem::ManuallyDrop::new(control_handle),
5726 tx_id: header.tx_id,
5727 },
5728 })
5729 }
5730 _ => Err(fidl::Error::UnknownOrdinal {
5731 ordinal: header.ordinal,
5732 protocol_name:
5733 <StatusWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5734 }),
5735 }))
5736 },
5737 )
5738 }
5739}
5740
5741#[derive(Debug)]
5743pub enum StatusWatcherRequest {
5744 WatchStatus { responder: StatusWatcherWatchStatusResponder },
5756}
5757
5758impl StatusWatcherRequest {
5759 #[allow(irrefutable_let_patterns)]
5760 pub fn into_watch_status(self) -> Option<(StatusWatcherWatchStatusResponder)> {
5761 if let StatusWatcherRequest::WatchStatus { responder } = self {
5762 Some((responder))
5763 } else {
5764 None
5765 }
5766 }
5767
5768 pub fn method_name(&self) -> &'static str {
5770 match *self {
5771 StatusWatcherRequest::WatchStatus { .. } => "watch_status",
5772 }
5773 }
5774}
5775
5776#[derive(Debug, Clone)]
5777pub struct StatusWatcherControlHandle {
5778 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5779}
5780
5781impl fidl::endpoints::ControlHandle for StatusWatcherControlHandle {
5782 fn shutdown(&self) {
5783 self.inner.shutdown()
5784 }
5785 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5786 self.inner.shutdown_with_epitaph(status)
5787 }
5788
5789 fn is_closed(&self) -> bool {
5790 self.inner.channel().is_closed()
5791 }
5792 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5793 self.inner.channel().on_closed()
5794 }
5795
5796 #[cfg(target_os = "fuchsia")]
5797 fn signal_peer(
5798 &self,
5799 clear_mask: zx::Signals,
5800 set_mask: zx::Signals,
5801 ) -> Result<(), zx_status::Status> {
5802 use fidl::Peered;
5803 self.inner.channel().signal_peer(clear_mask, set_mask)
5804 }
5805}
5806
5807impl StatusWatcherControlHandle {}
5808
5809#[must_use = "FIDL methods require a response to be sent"]
5810#[derive(Debug)]
5811pub struct StatusWatcherWatchStatusResponder {
5812 control_handle: std::mem::ManuallyDrop<StatusWatcherControlHandle>,
5813 tx_id: u32,
5814}
5815
5816impl std::ops::Drop for StatusWatcherWatchStatusResponder {
5820 fn drop(&mut self) {
5821 self.control_handle.shutdown();
5822 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5824 }
5825}
5826
5827impl fidl::endpoints::Responder for StatusWatcherWatchStatusResponder {
5828 type ControlHandle = StatusWatcherControlHandle;
5829
5830 fn control_handle(&self) -> &StatusWatcherControlHandle {
5831 &self.control_handle
5832 }
5833
5834 fn drop_without_shutdown(mut self) {
5835 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5837 std::mem::forget(self);
5839 }
5840}
5841
5842impl StatusWatcherWatchStatusResponder {
5843 pub fn send(self, mut port_status: &PortStatus) -> Result<(), fidl::Error> {
5847 let _result = self.send_raw(port_status);
5848 if _result.is_err() {
5849 self.control_handle.shutdown();
5850 }
5851 self.drop_without_shutdown();
5852 _result
5853 }
5854
5855 pub fn send_no_shutdown_on_err(self, mut port_status: &PortStatus) -> Result<(), fidl::Error> {
5857 let _result = self.send_raw(port_status);
5858 self.drop_without_shutdown();
5859 _result
5860 }
5861
5862 fn send_raw(&self, mut port_status: &PortStatus) -> Result<(), fidl::Error> {
5863 self.control_handle.inner.send::<StatusWatcherWatchStatusResponse>(
5864 (port_status,),
5865 self.tx_id,
5866 0x1369a8125c0862b9,
5867 fidl::encoding::DynamicFlags::empty(),
5868 )
5869 }
5870}
5871
5872mod internal {
5873 use super::*;
5874
5875 impl fidl::encoding::ResourceTypeMarker for DeviceCloneRequest {
5876 type Borrowed<'a> = &'a mut Self;
5877 fn take_or_borrow<'a>(
5878 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5879 ) -> Self::Borrowed<'a> {
5880 value
5881 }
5882 }
5883
5884 unsafe impl fidl::encoding::TypeMarker for DeviceCloneRequest {
5885 type Owned = Self;
5886
5887 #[inline(always)]
5888 fn inline_align(_context: fidl::encoding::Context) -> usize {
5889 4
5890 }
5891
5892 #[inline(always)]
5893 fn inline_size(_context: fidl::encoding::Context) -> usize {
5894 4
5895 }
5896 }
5897
5898 unsafe impl
5899 fidl::encoding::Encode<DeviceCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5900 for &mut DeviceCloneRequest
5901 {
5902 #[inline]
5903 unsafe fn encode(
5904 self,
5905 encoder: &mut fidl::encoding::Encoder<
5906 '_,
5907 fidl::encoding::DefaultFuchsiaResourceDialect,
5908 >,
5909 offset: usize,
5910 _depth: fidl::encoding::Depth,
5911 ) -> fidl::Result<()> {
5912 encoder.debug_check_bounds::<DeviceCloneRequest>(offset);
5913 fidl::encoding::Encode::<DeviceCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5915 (
5916 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
5917 ),
5918 encoder, offset, _depth
5919 )
5920 }
5921 }
5922 unsafe impl<
5923 T0: fidl::encoding::Encode<
5924 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
5925 fidl::encoding::DefaultFuchsiaResourceDialect,
5926 >,
5927 >
5928 fidl::encoding::Encode<DeviceCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5929 for (T0,)
5930 {
5931 #[inline]
5932 unsafe fn encode(
5933 self,
5934 encoder: &mut fidl::encoding::Encoder<
5935 '_,
5936 fidl::encoding::DefaultFuchsiaResourceDialect,
5937 >,
5938 offset: usize,
5939 depth: fidl::encoding::Depth,
5940 ) -> fidl::Result<()> {
5941 encoder.debug_check_bounds::<DeviceCloneRequest>(offset);
5942 self.0.encode(encoder, offset + 0, depth)?;
5946 Ok(())
5947 }
5948 }
5949
5950 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5951 for DeviceCloneRequest
5952 {
5953 #[inline(always)]
5954 fn new_empty() -> Self {
5955 Self {
5956 device: fidl::new_empty!(
5957 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
5958 fidl::encoding::DefaultFuchsiaResourceDialect
5959 ),
5960 }
5961 }
5962
5963 #[inline]
5964 unsafe fn decode(
5965 &mut self,
5966 decoder: &mut fidl::encoding::Decoder<
5967 '_,
5968 fidl::encoding::DefaultFuchsiaResourceDialect,
5969 >,
5970 offset: usize,
5971 _depth: fidl::encoding::Depth,
5972 ) -> fidl::Result<()> {
5973 decoder.debug_check_bounds::<Self>(offset);
5974 fidl::decode!(
5976 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
5977 fidl::encoding::DefaultFuchsiaResourceDialect,
5978 &mut self.device,
5979 decoder,
5980 offset + 0,
5981 _depth
5982 )?;
5983 Ok(())
5984 }
5985 }
5986
5987 impl fidl::encoding::ResourceTypeMarker for DeviceGetPortRequest {
5988 type Borrowed<'a> = &'a mut Self;
5989 fn take_or_borrow<'a>(
5990 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5991 ) -> Self::Borrowed<'a> {
5992 value
5993 }
5994 }
5995
5996 unsafe impl fidl::encoding::TypeMarker for DeviceGetPortRequest {
5997 type Owned = Self;
5998
5999 #[inline(always)]
6000 fn inline_align(_context: fidl::encoding::Context) -> usize {
6001 4
6002 }
6003
6004 #[inline(always)]
6005 fn inline_size(_context: fidl::encoding::Context) -> usize {
6006 8
6007 }
6008 }
6009
6010 unsafe impl
6011 fidl::encoding::Encode<DeviceGetPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6012 for &mut DeviceGetPortRequest
6013 {
6014 #[inline]
6015 unsafe fn encode(
6016 self,
6017 encoder: &mut fidl::encoding::Encoder<
6018 '_,
6019 fidl::encoding::DefaultFuchsiaResourceDialect,
6020 >,
6021 offset: usize,
6022 _depth: fidl::encoding::Depth,
6023 ) -> fidl::Result<()> {
6024 encoder.debug_check_bounds::<DeviceGetPortRequest>(offset);
6025 fidl::encoding::Encode::<DeviceGetPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6027 (
6028 <PortId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
6029 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.port),
6030 ),
6031 encoder, offset, _depth
6032 )
6033 }
6034 }
6035 unsafe impl<
6036 T0: fidl::encoding::Encode<PortId, fidl::encoding::DefaultFuchsiaResourceDialect>,
6037 T1: fidl::encoding::Encode<
6038 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6039 fidl::encoding::DefaultFuchsiaResourceDialect,
6040 >,
6041 >
6042 fidl::encoding::Encode<DeviceGetPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6043 for (T0, T1)
6044 {
6045 #[inline]
6046 unsafe fn encode(
6047 self,
6048 encoder: &mut fidl::encoding::Encoder<
6049 '_,
6050 fidl::encoding::DefaultFuchsiaResourceDialect,
6051 >,
6052 offset: usize,
6053 depth: fidl::encoding::Depth,
6054 ) -> fidl::Result<()> {
6055 encoder.debug_check_bounds::<DeviceGetPortRequest>(offset);
6056 unsafe {
6059 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
6060 (ptr as *mut u32).write_unaligned(0);
6061 }
6062 self.0.encode(encoder, offset + 0, depth)?;
6064 self.1.encode(encoder, offset + 4, depth)?;
6065 Ok(())
6066 }
6067 }
6068
6069 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6070 for DeviceGetPortRequest
6071 {
6072 #[inline(always)]
6073 fn new_empty() -> Self {
6074 Self {
6075 id: fidl::new_empty!(PortId, fidl::encoding::DefaultFuchsiaResourceDialect),
6076 port: fidl::new_empty!(
6077 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6078 fidl::encoding::DefaultFuchsiaResourceDialect
6079 ),
6080 }
6081 }
6082
6083 #[inline]
6084 unsafe fn decode(
6085 &mut self,
6086 decoder: &mut fidl::encoding::Decoder<
6087 '_,
6088 fidl::encoding::DefaultFuchsiaResourceDialect,
6089 >,
6090 offset: usize,
6091 _depth: fidl::encoding::Depth,
6092 ) -> fidl::Result<()> {
6093 decoder.debug_check_bounds::<Self>(offset);
6094 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
6096 let padval = unsafe { (ptr as *const u32).read_unaligned() };
6097 let mask = 0xffff0000u32;
6098 let maskedval = padval & mask;
6099 if maskedval != 0 {
6100 return Err(fidl::Error::NonZeroPadding {
6101 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
6102 });
6103 }
6104 fidl::decode!(
6105 PortId,
6106 fidl::encoding::DefaultFuchsiaResourceDialect,
6107 &mut self.id,
6108 decoder,
6109 offset + 0,
6110 _depth
6111 )?;
6112 fidl::decode!(
6113 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6114 fidl::encoding::DefaultFuchsiaResourceDialect,
6115 &mut self.port,
6116 decoder,
6117 offset + 4,
6118 _depth
6119 )?;
6120 Ok(())
6121 }
6122 }
6123
6124 impl fidl::encoding::ResourceTypeMarker for DeviceGetPortWatcherRequest {
6125 type Borrowed<'a> = &'a mut Self;
6126 fn take_or_borrow<'a>(
6127 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6128 ) -> Self::Borrowed<'a> {
6129 value
6130 }
6131 }
6132
6133 unsafe impl fidl::encoding::TypeMarker for DeviceGetPortWatcherRequest {
6134 type Owned = Self;
6135
6136 #[inline(always)]
6137 fn inline_align(_context: fidl::encoding::Context) -> usize {
6138 4
6139 }
6140
6141 #[inline(always)]
6142 fn inline_size(_context: fidl::encoding::Context) -> usize {
6143 4
6144 }
6145 }
6146
6147 unsafe impl
6148 fidl::encoding::Encode<
6149 DeviceGetPortWatcherRequest,
6150 fidl::encoding::DefaultFuchsiaResourceDialect,
6151 > for &mut DeviceGetPortWatcherRequest
6152 {
6153 #[inline]
6154 unsafe fn encode(
6155 self,
6156 encoder: &mut fidl::encoding::Encoder<
6157 '_,
6158 fidl::encoding::DefaultFuchsiaResourceDialect,
6159 >,
6160 offset: usize,
6161 _depth: fidl::encoding::Depth,
6162 ) -> fidl::Result<()> {
6163 encoder.debug_check_bounds::<DeviceGetPortWatcherRequest>(offset);
6164 fidl::encoding::Encode::<DeviceGetPortWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6166 (
6167 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
6168 ),
6169 encoder, offset, _depth
6170 )
6171 }
6172 }
6173 unsafe impl<
6174 T0: fidl::encoding::Encode<
6175 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortWatcherMarker>>,
6176 fidl::encoding::DefaultFuchsiaResourceDialect,
6177 >,
6178 >
6179 fidl::encoding::Encode<
6180 DeviceGetPortWatcherRequest,
6181 fidl::encoding::DefaultFuchsiaResourceDialect,
6182 > for (T0,)
6183 {
6184 #[inline]
6185 unsafe fn encode(
6186 self,
6187 encoder: &mut fidl::encoding::Encoder<
6188 '_,
6189 fidl::encoding::DefaultFuchsiaResourceDialect,
6190 >,
6191 offset: usize,
6192 depth: fidl::encoding::Depth,
6193 ) -> fidl::Result<()> {
6194 encoder.debug_check_bounds::<DeviceGetPortWatcherRequest>(offset);
6195 self.0.encode(encoder, offset + 0, depth)?;
6199 Ok(())
6200 }
6201 }
6202
6203 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6204 for DeviceGetPortWatcherRequest
6205 {
6206 #[inline(always)]
6207 fn new_empty() -> Self {
6208 Self {
6209 watcher: fidl::new_empty!(
6210 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortWatcherMarker>>,
6211 fidl::encoding::DefaultFuchsiaResourceDialect
6212 ),
6213 }
6214 }
6215
6216 #[inline]
6217 unsafe fn decode(
6218 &mut self,
6219 decoder: &mut fidl::encoding::Decoder<
6220 '_,
6221 fidl::encoding::DefaultFuchsiaResourceDialect,
6222 >,
6223 offset: usize,
6224 _depth: fidl::encoding::Depth,
6225 ) -> fidl::Result<()> {
6226 decoder.debug_check_bounds::<Self>(offset);
6227 fidl::decode!(
6229 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortWatcherMarker>>,
6230 fidl::encoding::DefaultFuchsiaResourceDialect,
6231 &mut self.watcher,
6232 decoder,
6233 offset + 0,
6234 _depth
6235 )?;
6236 Ok(())
6237 }
6238 }
6239
6240 impl fidl::encoding::ResourceTypeMarker for DeviceInstanceGetDeviceRequest {
6241 type Borrowed<'a> = &'a mut Self;
6242 fn take_or_borrow<'a>(
6243 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6244 ) -> Self::Borrowed<'a> {
6245 value
6246 }
6247 }
6248
6249 unsafe impl fidl::encoding::TypeMarker for DeviceInstanceGetDeviceRequest {
6250 type Owned = Self;
6251
6252 #[inline(always)]
6253 fn inline_align(_context: fidl::encoding::Context) -> usize {
6254 4
6255 }
6256
6257 #[inline(always)]
6258 fn inline_size(_context: fidl::encoding::Context) -> usize {
6259 4
6260 }
6261 }
6262
6263 unsafe impl
6264 fidl::encoding::Encode<
6265 DeviceInstanceGetDeviceRequest,
6266 fidl::encoding::DefaultFuchsiaResourceDialect,
6267 > for &mut DeviceInstanceGetDeviceRequest
6268 {
6269 #[inline]
6270 unsafe fn encode(
6271 self,
6272 encoder: &mut fidl::encoding::Encoder<
6273 '_,
6274 fidl::encoding::DefaultFuchsiaResourceDialect,
6275 >,
6276 offset: usize,
6277 _depth: fidl::encoding::Depth,
6278 ) -> fidl::Result<()> {
6279 encoder.debug_check_bounds::<DeviceInstanceGetDeviceRequest>(offset);
6280 fidl::encoding::Encode::<DeviceInstanceGetDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6282 (
6283 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
6284 ),
6285 encoder, offset, _depth
6286 )
6287 }
6288 }
6289 unsafe impl<
6290 T0: fidl::encoding::Encode<
6291 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6292 fidl::encoding::DefaultFuchsiaResourceDialect,
6293 >,
6294 >
6295 fidl::encoding::Encode<
6296 DeviceInstanceGetDeviceRequest,
6297 fidl::encoding::DefaultFuchsiaResourceDialect,
6298 > for (T0,)
6299 {
6300 #[inline]
6301 unsafe fn encode(
6302 self,
6303 encoder: &mut fidl::encoding::Encoder<
6304 '_,
6305 fidl::encoding::DefaultFuchsiaResourceDialect,
6306 >,
6307 offset: usize,
6308 depth: fidl::encoding::Depth,
6309 ) -> fidl::Result<()> {
6310 encoder.debug_check_bounds::<DeviceInstanceGetDeviceRequest>(offset);
6311 self.0.encode(encoder, offset + 0, depth)?;
6315 Ok(())
6316 }
6317 }
6318
6319 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6320 for DeviceInstanceGetDeviceRequest
6321 {
6322 #[inline(always)]
6323 fn new_empty() -> Self {
6324 Self {
6325 device: fidl::new_empty!(
6326 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6327 fidl::encoding::DefaultFuchsiaResourceDialect
6328 ),
6329 }
6330 }
6331
6332 #[inline]
6333 unsafe fn decode(
6334 &mut self,
6335 decoder: &mut fidl::encoding::Decoder<
6336 '_,
6337 fidl::encoding::DefaultFuchsiaResourceDialect,
6338 >,
6339 offset: usize,
6340 _depth: fidl::encoding::Depth,
6341 ) -> fidl::Result<()> {
6342 decoder.debug_check_bounds::<Self>(offset);
6343 fidl::decode!(
6345 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6346 fidl::encoding::DefaultFuchsiaResourceDialect,
6347 &mut self.device,
6348 decoder,
6349 offset + 0,
6350 _depth
6351 )?;
6352 Ok(())
6353 }
6354 }
6355
6356 impl fidl::encoding::ResourceTypeMarker for DeviceOpenSessionRequest {
6357 type Borrowed<'a> = &'a mut Self;
6358 fn take_or_borrow<'a>(
6359 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6360 ) -> Self::Borrowed<'a> {
6361 value
6362 }
6363 }
6364
6365 unsafe impl fidl::encoding::TypeMarker for DeviceOpenSessionRequest {
6366 type Owned = Self;
6367
6368 #[inline(always)]
6369 fn inline_align(_context: fidl::encoding::Context) -> usize {
6370 8
6371 }
6372
6373 #[inline(always)]
6374 fn inline_size(_context: fidl::encoding::Context) -> usize {
6375 32
6376 }
6377 }
6378
6379 unsafe impl
6380 fidl::encoding::Encode<
6381 DeviceOpenSessionRequest,
6382 fidl::encoding::DefaultFuchsiaResourceDialect,
6383 > for &mut DeviceOpenSessionRequest
6384 {
6385 #[inline]
6386 unsafe fn encode(
6387 self,
6388 encoder: &mut fidl::encoding::Encoder<
6389 '_,
6390 fidl::encoding::DefaultFuchsiaResourceDialect,
6391 >,
6392 offset: usize,
6393 _depth: fidl::encoding::Depth,
6394 ) -> fidl::Result<()> {
6395 encoder.debug_check_bounds::<DeviceOpenSessionRequest>(offset);
6396 fidl::encoding::Encode::<
6398 DeviceOpenSessionRequest,
6399 fidl::encoding::DefaultFuchsiaResourceDialect,
6400 >::encode(
6401 (
6402 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
6403 &self.session_name,
6404 ),
6405 <SessionInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6406 &mut self.session_info,
6407 ),
6408 ),
6409 encoder,
6410 offset,
6411 _depth,
6412 )
6413 }
6414 }
6415 unsafe impl<
6416 T0: fidl::encoding::Encode<
6417 fidl::encoding::BoundedString<64>,
6418 fidl::encoding::DefaultFuchsiaResourceDialect,
6419 >,
6420 T1: fidl::encoding::Encode<SessionInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
6421 >
6422 fidl::encoding::Encode<
6423 DeviceOpenSessionRequest,
6424 fidl::encoding::DefaultFuchsiaResourceDialect,
6425 > for (T0, T1)
6426 {
6427 #[inline]
6428 unsafe fn encode(
6429 self,
6430 encoder: &mut fidl::encoding::Encoder<
6431 '_,
6432 fidl::encoding::DefaultFuchsiaResourceDialect,
6433 >,
6434 offset: usize,
6435 depth: fidl::encoding::Depth,
6436 ) -> fidl::Result<()> {
6437 encoder.debug_check_bounds::<DeviceOpenSessionRequest>(offset);
6438 self.0.encode(encoder, offset + 0, depth)?;
6442 self.1.encode(encoder, offset + 16, depth)?;
6443 Ok(())
6444 }
6445 }
6446
6447 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6448 for DeviceOpenSessionRequest
6449 {
6450 #[inline(always)]
6451 fn new_empty() -> Self {
6452 Self {
6453 session_name: fidl::new_empty!(
6454 fidl::encoding::BoundedString<64>,
6455 fidl::encoding::DefaultFuchsiaResourceDialect
6456 ),
6457 session_info: fidl::new_empty!(
6458 SessionInfo,
6459 fidl::encoding::DefaultFuchsiaResourceDialect
6460 ),
6461 }
6462 }
6463
6464 #[inline]
6465 unsafe fn decode(
6466 &mut self,
6467 decoder: &mut fidl::encoding::Decoder<
6468 '_,
6469 fidl::encoding::DefaultFuchsiaResourceDialect,
6470 >,
6471 offset: usize,
6472 _depth: fidl::encoding::Depth,
6473 ) -> fidl::Result<()> {
6474 decoder.debug_check_bounds::<Self>(offset);
6475 fidl::decode!(
6477 fidl::encoding::BoundedString<64>,
6478 fidl::encoding::DefaultFuchsiaResourceDialect,
6479 &mut self.session_name,
6480 decoder,
6481 offset + 0,
6482 _depth
6483 )?;
6484 fidl::decode!(
6485 SessionInfo,
6486 fidl::encoding::DefaultFuchsiaResourceDialect,
6487 &mut self.session_info,
6488 decoder,
6489 offset + 16,
6490 _depth
6491 )?;
6492 Ok(())
6493 }
6494 }
6495
6496 impl fidl::encoding::ResourceTypeMarker for DeviceOpenSessionResponse {
6497 type Borrowed<'a> = &'a mut Self;
6498 fn take_or_borrow<'a>(
6499 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6500 ) -> Self::Borrowed<'a> {
6501 value
6502 }
6503 }
6504
6505 unsafe impl fidl::encoding::TypeMarker for DeviceOpenSessionResponse {
6506 type Owned = Self;
6507
6508 #[inline(always)]
6509 fn inline_align(_context: fidl::encoding::Context) -> usize {
6510 4
6511 }
6512
6513 #[inline(always)]
6514 fn inline_size(_context: fidl::encoding::Context) -> usize {
6515 12
6516 }
6517 }
6518
6519 unsafe impl
6520 fidl::encoding::Encode<
6521 DeviceOpenSessionResponse,
6522 fidl::encoding::DefaultFuchsiaResourceDialect,
6523 > for &mut DeviceOpenSessionResponse
6524 {
6525 #[inline]
6526 unsafe fn encode(
6527 self,
6528 encoder: &mut fidl::encoding::Encoder<
6529 '_,
6530 fidl::encoding::DefaultFuchsiaResourceDialect,
6531 >,
6532 offset: usize,
6533 _depth: fidl::encoding::Depth,
6534 ) -> fidl::Result<()> {
6535 encoder.debug_check_bounds::<DeviceOpenSessionResponse>(offset);
6536 fidl::encoding::Encode::<DeviceOpenSessionResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6538 (
6539 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
6540 <Fifos as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.fifos),
6541 ),
6542 encoder, offset, _depth
6543 )
6544 }
6545 }
6546 unsafe impl<
6547 T0: fidl::encoding::Encode<
6548 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionMarker>>,
6549 fidl::encoding::DefaultFuchsiaResourceDialect,
6550 >,
6551 T1: fidl::encoding::Encode<Fifos, fidl::encoding::DefaultFuchsiaResourceDialect>,
6552 >
6553 fidl::encoding::Encode<
6554 DeviceOpenSessionResponse,
6555 fidl::encoding::DefaultFuchsiaResourceDialect,
6556 > for (T0, T1)
6557 {
6558 #[inline]
6559 unsafe fn encode(
6560 self,
6561 encoder: &mut fidl::encoding::Encoder<
6562 '_,
6563 fidl::encoding::DefaultFuchsiaResourceDialect,
6564 >,
6565 offset: usize,
6566 depth: fidl::encoding::Depth,
6567 ) -> fidl::Result<()> {
6568 encoder.debug_check_bounds::<DeviceOpenSessionResponse>(offset);
6569 self.0.encode(encoder, offset + 0, depth)?;
6573 self.1.encode(encoder, offset + 4, depth)?;
6574 Ok(())
6575 }
6576 }
6577
6578 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6579 for DeviceOpenSessionResponse
6580 {
6581 #[inline(always)]
6582 fn new_empty() -> Self {
6583 Self {
6584 session: fidl::new_empty!(
6585 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionMarker>>,
6586 fidl::encoding::DefaultFuchsiaResourceDialect
6587 ),
6588 fifos: fidl::new_empty!(Fifos, fidl::encoding::DefaultFuchsiaResourceDialect),
6589 }
6590 }
6591
6592 #[inline]
6593 unsafe fn decode(
6594 &mut self,
6595 decoder: &mut fidl::encoding::Decoder<
6596 '_,
6597 fidl::encoding::DefaultFuchsiaResourceDialect,
6598 >,
6599 offset: usize,
6600 _depth: fidl::encoding::Depth,
6601 ) -> fidl::Result<()> {
6602 decoder.debug_check_bounds::<Self>(offset);
6603 fidl::decode!(
6605 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionMarker>>,
6606 fidl::encoding::DefaultFuchsiaResourceDialect,
6607 &mut self.session,
6608 decoder,
6609 offset + 0,
6610 _depth
6611 )?;
6612 fidl::decode!(
6613 Fifos,
6614 fidl::encoding::DefaultFuchsiaResourceDialect,
6615 &mut self.fifos,
6616 decoder,
6617 offset + 4,
6618 _depth
6619 )?;
6620 Ok(())
6621 }
6622 }
6623
6624 impl fidl::encoding::ResourceTypeMarker for Fifos {
6625 type Borrowed<'a> = &'a mut Self;
6626 fn take_or_borrow<'a>(
6627 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6628 ) -> Self::Borrowed<'a> {
6629 value
6630 }
6631 }
6632
6633 unsafe impl fidl::encoding::TypeMarker for Fifos {
6634 type Owned = Self;
6635
6636 #[inline(always)]
6637 fn inline_align(_context: fidl::encoding::Context) -> usize {
6638 4
6639 }
6640
6641 #[inline(always)]
6642 fn inline_size(_context: fidl::encoding::Context) -> usize {
6643 8
6644 }
6645 }
6646
6647 unsafe impl fidl::encoding::Encode<Fifos, fidl::encoding::DefaultFuchsiaResourceDialect>
6648 for &mut Fifos
6649 {
6650 #[inline]
6651 unsafe fn encode(
6652 self,
6653 encoder: &mut fidl::encoding::Encoder<
6654 '_,
6655 fidl::encoding::DefaultFuchsiaResourceDialect,
6656 >,
6657 offset: usize,
6658 _depth: fidl::encoding::Depth,
6659 ) -> fidl::Result<()> {
6660 encoder.debug_check_bounds::<Fifos>(offset);
6661 fidl::encoding::Encode::<Fifos, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6663 (
6664 <fidl::encoding::HandleType<
6665 fidl::Fifo,
6666 { fidl::ObjectType::FIFO.into_raw() },
6667 2147483648,
6668 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6669 &mut self.rx
6670 ),
6671 <fidl::encoding::HandleType<
6672 fidl::Fifo,
6673 { fidl::ObjectType::FIFO.into_raw() },
6674 2147483648,
6675 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6676 &mut self.tx
6677 ),
6678 ),
6679 encoder,
6680 offset,
6681 _depth,
6682 )
6683 }
6684 }
6685 unsafe impl<
6686 T0: fidl::encoding::Encode<
6687 fidl::encoding::HandleType<
6688 fidl::Fifo,
6689 { fidl::ObjectType::FIFO.into_raw() },
6690 2147483648,
6691 >,
6692 fidl::encoding::DefaultFuchsiaResourceDialect,
6693 >,
6694 T1: fidl::encoding::Encode<
6695 fidl::encoding::HandleType<
6696 fidl::Fifo,
6697 { fidl::ObjectType::FIFO.into_raw() },
6698 2147483648,
6699 >,
6700 fidl::encoding::DefaultFuchsiaResourceDialect,
6701 >,
6702 > fidl::encoding::Encode<Fifos, fidl::encoding::DefaultFuchsiaResourceDialect>
6703 for (T0, T1)
6704 {
6705 #[inline]
6706 unsafe fn encode(
6707 self,
6708 encoder: &mut fidl::encoding::Encoder<
6709 '_,
6710 fidl::encoding::DefaultFuchsiaResourceDialect,
6711 >,
6712 offset: usize,
6713 depth: fidl::encoding::Depth,
6714 ) -> fidl::Result<()> {
6715 encoder.debug_check_bounds::<Fifos>(offset);
6716 self.0.encode(encoder, offset + 0, depth)?;
6720 self.1.encode(encoder, offset + 4, depth)?;
6721 Ok(())
6722 }
6723 }
6724
6725 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Fifos {
6726 #[inline(always)]
6727 fn new_empty() -> Self {
6728 Self {
6729 rx: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6730 tx: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6731 }
6732 }
6733
6734 #[inline]
6735 unsafe fn decode(
6736 &mut self,
6737 decoder: &mut fidl::encoding::Decoder<
6738 '_,
6739 fidl::encoding::DefaultFuchsiaResourceDialect,
6740 >,
6741 offset: usize,
6742 _depth: fidl::encoding::Depth,
6743 ) -> fidl::Result<()> {
6744 decoder.debug_check_bounds::<Self>(offset);
6745 fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.rx, decoder, offset + 0, _depth)?;
6747 fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.tx, decoder, offset + 4, _depth)?;
6748 Ok(())
6749 }
6750 }
6751
6752 impl fidl::encoding::ResourceTypeMarker for PortCloneRequest {
6753 type Borrowed<'a> = &'a mut Self;
6754 fn take_or_borrow<'a>(
6755 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6756 ) -> Self::Borrowed<'a> {
6757 value
6758 }
6759 }
6760
6761 unsafe impl fidl::encoding::TypeMarker for PortCloneRequest {
6762 type Owned = Self;
6763
6764 #[inline(always)]
6765 fn inline_align(_context: fidl::encoding::Context) -> usize {
6766 4
6767 }
6768
6769 #[inline(always)]
6770 fn inline_size(_context: fidl::encoding::Context) -> usize {
6771 4
6772 }
6773 }
6774
6775 unsafe impl
6776 fidl::encoding::Encode<PortCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6777 for &mut PortCloneRequest
6778 {
6779 #[inline]
6780 unsafe fn encode(
6781 self,
6782 encoder: &mut fidl::encoding::Encoder<
6783 '_,
6784 fidl::encoding::DefaultFuchsiaResourceDialect,
6785 >,
6786 offset: usize,
6787 _depth: fidl::encoding::Depth,
6788 ) -> fidl::Result<()> {
6789 encoder.debug_check_bounds::<PortCloneRequest>(offset);
6790 fidl::encoding::Encode::<PortCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6792 (
6793 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.port),
6794 ),
6795 encoder, offset, _depth
6796 )
6797 }
6798 }
6799 unsafe impl<
6800 T0: fidl::encoding::Encode<
6801 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6802 fidl::encoding::DefaultFuchsiaResourceDialect,
6803 >,
6804 >
6805 fidl::encoding::Encode<PortCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6806 for (T0,)
6807 {
6808 #[inline]
6809 unsafe fn encode(
6810 self,
6811 encoder: &mut fidl::encoding::Encoder<
6812 '_,
6813 fidl::encoding::DefaultFuchsiaResourceDialect,
6814 >,
6815 offset: usize,
6816 depth: fidl::encoding::Depth,
6817 ) -> fidl::Result<()> {
6818 encoder.debug_check_bounds::<PortCloneRequest>(offset);
6819 self.0.encode(encoder, offset + 0, depth)?;
6823 Ok(())
6824 }
6825 }
6826
6827 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6828 for PortCloneRequest
6829 {
6830 #[inline(always)]
6831 fn new_empty() -> Self {
6832 Self {
6833 port: fidl::new_empty!(
6834 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6835 fidl::encoding::DefaultFuchsiaResourceDialect
6836 ),
6837 }
6838 }
6839
6840 #[inline]
6841 unsafe fn decode(
6842 &mut self,
6843 decoder: &mut fidl::encoding::Decoder<
6844 '_,
6845 fidl::encoding::DefaultFuchsiaResourceDialect,
6846 >,
6847 offset: usize,
6848 _depth: fidl::encoding::Depth,
6849 ) -> fidl::Result<()> {
6850 decoder.debug_check_bounds::<Self>(offset);
6851 fidl::decode!(
6853 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
6854 fidl::encoding::DefaultFuchsiaResourceDialect,
6855 &mut self.port,
6856 decoder,
6857 offset + 0,
6858 _depth
6859 )?;
6860 Ok(())
6861 }
6862 }
6863
6864 impl fidl::encoding::ResourceTypeMarker for PortGetDeviceRequest {
6865 type Borrowed<'a> = &'a mut Self;
6866 fn take_or_borrow<'a>(
6867 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6868 ) -> Self::Borrowed<'a> {
6869 value
6870 }
6871 }
6872
6873 unsafe impl fidl::encoding::TypeMarker for PortGetDeviceRequest {
6874 type Owned = Self;
6875
6876 #[inline(always)]
6877 fn inline_align(_context: fidl::encoding::Context) -> usize {
6878 4
6879 }
6880
6881 #[inline(always)]
6882 fn inline_size(_context: fidl::encoding::Context) -> usize {
6883 4
6884 }
6885 }
6886
6887 unsafe impl
6888 fidl::encoding::Encode<PortGetDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6889 for &mut PortGetDeviceRequest
6890 {
6891 #[inline]
6892 unsafe fn encode(
6893 self,
6894 encoder: &mut fidl::encoding::Encoder<
6895 '_,
6896 fidl::encoding::DefaultFuchsiaResourceDialect,
6897 >,
6898 offset: usize,
6899 _depth: fidl::encoding::Depth,
6900 ) -> fidl::Result<()> {
6901 encoder.debug_check_bounds::<PortGetDeviceRequest>(offset);
6902 fidl::encoding::Encode::<PortGetDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6904 (
6905 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
6906 ),
6907 encoder, offset, _depth
6908 )
6909 }
6910 }
6911 unsafe impl<
6912 T0: fidl::encoding::Encode<
6913 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6914 fidl::encoding::DefaultFuchsiaResourceDialect,
6915 >,
6916 >
6917 fidl::encoding::Encode<PortGetDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6918 for (T0,)
6919 {
6920 #[inline]
6921 unsafe fn encode(
6922 self,
6923 encoder: &mut fidl::encoding::Encoder<
6924 '_,
6925 fidl::encoding::DefaultFuchsiaResourceDialect,
6926 >,
6927 offset: usize,
6928 depth: fidl::encoding::Depth,
6929 ) -> fidl::Result<()> {
6930 encoder.debug_check_bounds::<PortGetDeviceRequest>(offset);
6931 self.0.encode(encoder, offset + 0, depth)?;
6935 Ok(())
6936 }
6937 }
6938
6939 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6940 for PortGetDeviceRequest
6941 {
6942 #[inline(always)]
6943 fn new_empty() -> Self {
6944 Self {
6945 device: fidl::new_empty!(
6946 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6947 fidl::encoding::DefaultFuchsiaResourceDialect
6948 ),
6949 }
6950 }
6951
6952 #[inline]
6953 unsafe fn decode(
6954 &mut self,
6955 decoder: &mut fidl::encoding::Decoder<
6956 '_,
6957 fidl::encoding::DefaultFuchsiaResourceDialect,
6958 >,
6959 offset: usize,
6960 _depth: fidl::encoding::Depth,
6961 ) -> fidl::Result<()> {
6962 decoder.debug_check_bounds::<Self>(offset);
6963 fidl::decode!(
6965 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
6966 fidl::encoding::DefaultFuchsiaResourceDialect,
6967 &mut self.device,
6968 decoder,
6969 offset + 0,
6970 _depth
6971 )?;
6972 Ok(())
6973 }
6974 }
6975
6976 impl fidl::encoding::ResourceTypeMarker for PortGetDiagnosticsRequest {
6977 type Borrowed<'a> = &'a mut Self;
6978 fn take_or_borrow<'a>(
6979 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6980 ) -> Self::Borrowed<'a> {
6981 value
6982 }
6983 }
6984
6985 unsafe impl fidl::encoding::TypeMarker for PortGetDiagnosticsRequest {
6986 type Owned = Self;
6987
6988 #[inline(always)]
6989 fn inline_align(_context: fidl::encoding::Context) -> usize {
6990 4
6991 }
6992
6993 #[inline(always)]
6994 fn inline_size(_context: fidl::encoding::Context) -> usize {
6995 4
6996 }
6997 }
6998
6999 unsafe impl
7000 fidl::encoding::Encode<
7001 PortGetDiagnosticsRequest,
7002 fidl::encoding::DefaultFuchsiaResourceDialect,
7003 > for &mut PortGetDiagnosticsRequest
7004 {
7005 #[inline]
7006 unsafe fn encode(
7007 self,
7008 encoder: &mut fidl::encoding::Encoder<
7009 '_,
7010 fidl::encoding::DefaultFuchsiaResourceDialect,
7011 >,
7012 offset: usize,
7013 _depth: fidl::encoding::Depth,
7014 ) -> fidl::Result<()> {
7015 encoder.debug_check_bounds::<PortGetDiagnosticsRequest>(offset);
7016 fidl::encoding::Encode::<PortGetDiagnosticsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7018 (
7019 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiagnosticsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.diagnostics),
7020 ),
7021 encoder, offset, _depth
7022 )
7023 }
7024 }
7025 unsafe impl<
7026 T0: fidl::encoding::Encode<
7027 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiagnosticsMarker>>,
7028 fidl::encoding::DefaultFuchsiaResourceDialect,
7029 >,
7030 >
7031 fidl::encoding::Encode<
7032 PortGetDiagnosticsRequest,
7033 fidl::encoding::DefaultFuchsiaResourceDialect,
7034 > for (T0,)
7035 {
7036 #[inline]
7037 unsafe fn encode(
7038 self,
7039 encoder: &mut fidl::encoding::Encoder<
7040 '_,
7041 fidl::encoding::DefaultFuchsiaResourceDialect,
7042 >,
7043 offset: usize,
7044 depth: fidl::encoding::Depth,
7045 ) -> fidl::Result<()> {
7046 encoder.debug_check_bounds::<PortGetDiagnosticsRequest>(offset);
7047 self.0.encode(encoder, offset + 0, depth)?;
7051 Ok(())
7052 }
7053 }
7054
7055 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7056 for PortGetDiagnosticsRequest
7057 {
7058 #[inline(always)]
7059 fn new_empty() -> Self {
7060 Self {
7061 diagnostics: fidl::new_empty!(
7062 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiagnosticsMarker>>,
7063 fidl::encoding::DefaultFuchsiaResourceDialect
7064 ),
7065 }
7066 }
7067
7068 #[inline]
7069 unsafe fn decode(
7070 &mut self,
7071 decoder: &mut fidl::encoding::Decoder<
7072 '_,
7073 fidl::encoding::DefaultFuchsiaResourceDialect,
7074 >,
7075 offset: usize,
7076 _depth: fidl::encoding::Depth,
7077 ) -> fidl::Result<()> {
7078 decoder.debug_check_bounds::<Self>(offset);
7079 fidl::decode!(
7081 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiagnosticsMarker>>,
7082 fidl::encoding::DefaultFuchsiaResourceDialect,
7083 &mut self.diagnostics,
7084 decoder,
7085 offset + 0,
7086 _depth
7087 )?;
7088 Ok(())
7089 }
7090 }
7091
7092 impl fidl::encoding::ResourceTypeMarker for PortGetMacRequest {
7093 type Borrowed<'a> = &'a mut Self;
7094 fn take_or_borrow<'a>(
7095 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7096 ) -> Self::Borrowed<'a> {
7097 value
7098 }
7099 }
7100
7101 unsafe impl fidl::encoding::TypeMarker for PortGetMacRequest {
7102 type Owned = Self;
7103
7104 #[inline(always)]
7105 fn inline_align(_context: fidl::encoding::Context) -> usize {
7106 4
7107 }
7108
7109 #[inline(always)]
7110 fn inline_size(_context: fidl::encoding::Context) -> usize {
7111 4
7112 }
7113 }
7114
7115 unsafe impl
7116 fidl::encoding::Encode<PortGetMacRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7117 for &mut PortGetMacRequest
7118 {
7119 #[inline]
7120 unsafe fn encode(
7121 self,
7122 encoder: &mut fidl::encoding::Encoder<
7123 '_,
7124 fidl::encoding::DefaultFuchsiaResourceDialect,
7125 >,
7126 offset: usize,
7127 _depth: fidl::encoding::Depth,
7128 ) -> fidl::Result<()> {
7129 encoder.debug_check_bounds::<PortGetMacRequest>(offset);
7130 fidl::encoding::Encode::<PortGetMacRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7132 (
7133 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MacAddressingMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.mac),
7134 ),
7135 encoder, offset, _depth
7136 )
7137 }
7138 }
7139 unsafe impl<
7140 T0: fidl::encoding::Encode<
7141 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MacAddressingMarker>>,
7142 fidl::encoding::DefaultFuchsiaResourceDialect,
7143 >,
7144 >
7145 fidl::encoding::Encode<PortGetMacRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7146 for (T0,)
7147 {
7148 #[inline]
7149 unsafe fn encode(
7150 self,
7151 encoder: &mut fidl::encoding::Encoder<
7152 '_,
7153 fidl::encoding::DefaultFuchsiaResourceDialect,
7154 >,
7155 offset: usize,
7156 depth: fidl::encoding::Depth,
7157 ) -> fidl::Result<()> {
7158 encoder.debug_check_bounds::<PortGetMacRequest>(offset);
7159 self.0.encode(encoder, offset + 0, depth)?;
7163 Ok(())
7164 }
7165 }
7166
7167 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7168 for PortGetMacRequest
7169 {
7170 #[inline(always)]
7171 fn new_empty() -> Self {
7172 Self {
7173 mac: fidl::new_empty!(
7174 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MacAddressingMarker>>,
7175 fidl::encoding::DefaultFuchsiaResourceDialect
7176 ),
7177 }
7178 }
7179
7180 #[inline]
7181 unsafe fn decode(
7182 &mut self,
7183 decoder: &mut fidl::encoding::Decoder<
7184 '_,
7185 fidl::encoding::DefaultFuchsiaResourceDialect,
7186 >,
7187 offset: usize,
7188 _depth: fidl::encoding::Depth,
7189 ) -> fidl::Result<()> {
7190 decoder.debug_check_bounds::<Self>(offset);
7191 fidl::decode!(
7193 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MacAddressingMarker>>,
7194 fidl::encoding::DefaultFuchsiaResourceDialect,
7195 &mut self.mac,
7196 decoder,
7197 offset + 0,
7198 _depth
7199 )?;
7200 Ok(())
7201 }
7202 }
7203
7204 impl fidl::encoding::ResourceTypeMarker for PortGetStatusWatcherRequest {
7205 type Borrowed<'a> = &'a mut Self;
7206 fn take_or_borrow<'a>(
7207 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7208 ) -> Self::Borrowed<'a> {
7209 value
7210 }
7211 }
7212
7213 unsafe impl fidl::encoding::TypeMarker for PortGetStatusWatcherRequest {
7214 type Owned = Self;
7215
7216 #[inline(always)]
7217 fn inline_align(_context: fidl::encoding::Context) -> usize {
7218 4
7219 }
7220
7221 #[inline(always)]
7222 fn inline_size(_context: fidl::encoding::Context) -> usize {
7223 8
7224 }
7225 }
7226
7227 unsafe impl
7228 fidl::encoding::Encode<
7229 PortGetStatusWatcherRequest,
7230 fidl::encoding::DefaultFuchsiaResourceDialect,
7231 > for &mut PortGetStatusWatcherRequest
7232 {
7233 #[inline]
7234 unsafe fn encode(
7235 self,
7236 encoder: &mut fidl::encoding::Encoder<
7237 '_,
7238 fidl::encoding::DefaultFuchsiaResourceDialect,
7239 >,
7240 offset: usize,
7241 _depth: fidl::encoding::Depth,
7242 ) -> fidl::Result<()> {
7243 encoder.debug_check_bounds::<PortGetStatusWatcherRequest>(offset);
7244 fidl::encoding::Encode::<PortGetStatusWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7246 (
7247 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
7248 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer),
7249 ),
7250 encoder, offset, _depth
7251 )
7252 }
7253 }
7254 unsafe impl<
7255 T0: fidl::encoding::Encode<
7256 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusWatcherMarker>>,
7257 fidl::encoding::DefaultFuchsiaResourceDialect,
7258 >,
7259 T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
7260 >
7261 fidl::encoding::Encode<
7262 PortGetStatusWatcherRequest,
7263 fidl::encoding::DefaultFuchsiaResourceDialect,
7264 > for (T0, T1)
7265 {
7266 #[inline]
7267 unsafe fn encode(
7268 self,
7269 encoder: &mut fidl::encoding::Encoder<
7270 '_,
7271 fidl::encoding::DefaultFuchsiaResourceDialect,
7272 >,
7273 offset: usize,
7274 depth: fidl::encoding::Depth,
7275 ) -> fidl::Result<()> {
7276 encoder.debug_check_bounds::<PortGetStatusWatcherRequest>(offset);
7277 self.0.encode(encoder, offset + 0, depth)?;
7281 self.1.encode(encoder, offset + 4, depth)?;
7282 Ok(())
7283 }
7284 }
7285
7286 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7287 for PortGetStatusWatcherRequest
7288 {
7289 #[inline(always)]
7290 fn new_empty() -> Self {
7291 Self {
7292 watcher: fidl::new_empty!(
7293 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusWatcherMarker>>,
7294 fidl::encoding::DefaultFuchsiaResourceDialect
7295 ),
7296 buffer: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
7297 }
7298 }
7299
7300 #[inline]
7301 unsafe fn decode(
7302 &mut self,
7303 decoder: &mut fidl::encoding::Decoder<
7304 '_,
7305 fidl::encoding::DefaultFuchsiaResourceDialect,
7306 >,
7307 offset: usize,
7308 _depth: fidl::encoding::Depth,
7309 ) -> fidl::Result<()> {
7310 decoder.debug_check_bounds::<Self>(offset);
7311 fidl::decode!(
7313 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusWatcherMarker>>,
7314 fidl::encoding::DefaultFuchsiaResourceDialect,
7315 &mut self.watcher,
7316 decoder,
7317 offset + 0,
7318 _depth
7319 )?;
7320 fidl::decode!(
7321 u32,
7322 fidl::encoding::DefaultFuchsiaResourceDialect,
7323 &mut self.buffer,
7324 decoder,
7325 offset + 4,
7326 _depth
7327 )?;
7328 Ok(())
7329 }
7330 }
7331
7332 impl fidl::encoding::ResourceTypeMarker for SessionWatchDelegatedRxLeaseResponse {
7333 type Borrowed<'a> = &'a mut Self;
7334 fn take_or_borrow<'a>(
7335 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7336 ) -> Self::Borrowed<'a> {
7337 value
7338 }
7339 }
7340
7341 unsafe impl fidl::encoding::TypeMarker for SessionWatchDelegatedRxLeaseResponse {
7342 type Owned = Self;
7343
7344 #[inline(always)]
7345 fn inline_align(_context: fidl::encoding::Context) -> usize {
7346 8
7347 }
7348
7349 #[inline(always)]
7350 fn inline_size(_context: fidl::encoding::Context) -> usize {
7351 16
7352 }
7353 }
7354
7355 unsafe impl
7356 fidl::encoding::Encode<
7357 SessionWatchDelegatedRxLeaseResponse,
7358 fidl::encoding::DefaultFuchsiaResourceDialect,
7359 > for &mut SessionWatchDelegatedRxLeaseResponse
7360 {
7361 #[inline]
7362 unsafe fn encode(
7363 self,
7364 encoder: &mut fidl::encoding::Encoder<
7365 '_,
7366 fidl::encoding::DefaultFuchsiaResourceDialect,
7367 >,
7368 offset: usize,
7369 _depth: fidl::encoding::Depth,
7370 ) -> fidl::Result<()> {
7371 encoder.debug_check_bounds::<SessionWatchDelegatedRxLeaseResponse>(offset);
7372 fidl::encoding::Encode::<
7374 SessionWatchDelegatedRxLeaseResponse,
7375 fidl::encoding::DefaultFuchsiaResourceDialect,
7376 >::encode(
7377 (<DelegatedRxLease as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7378 &mut self.lease,
7379 ),),
7380 encoder,
7381 offset,
7382 _depth,
7383 )
7384 }
7385 }
7386 unsafe impl<
7387 T0: fidl::encoding::Encode<DelegatedRxLease, fidl::encoding::DefaultFuchsiaResourceDialect>,
7388 >
7389 fidl::encoding::Encode<
7390 SessionWatchDelegatedRxLeaseResponse,
7391 fidl::encoding::DefaultFuchsiaResourceDialect,
7392 > for (T0,)
7393 {
7394 #[inline]
7395 unsafe fn encode(
7396 self,
7397 encoder: &mut fidl::encoding::Encoder<
7398 '_,
7399 fidl::encoding::DefaultFuchsiaResourceDialect,
7400 >,
7401 offset: usize,
7402 depth: fidl::encoding::Depth,
7403 ) -> fidl::Result<()> {
7404 encoder.debug_check_bounds::<SessionWatchDelegatedRxLeaseResponse>(offset);
7405 self.0.encode(encoder, offset + 0, depth)?;
7409 Ok(())
7410 }
7411 }
7412
7413 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7414 for SessionWatchDelegatedRxLeaseResponse
7415 {
7416 #[inline(always)]
7417 fn new_empty() -> Self {
7418 Self {
7419 lease: fidl::new_empty!(
7420 DelegatedRxLease,
7421 fidl::encoding::DefaultFuchsiaResourceDialect
7422 ),
7423 }
7424 }
7425
7426 #[inline]
7427 unsafe fn decode(
7428 &mut self,
7429 decoder: &mut fidl::encoding::Decoder<
7430 '_,
7431 fidl::encoding::DefaultFuchsiaResourceDialect,
7432 >,
7433 offset: usize,
7434 _depth: fidl::encoding::Depth,
7435 ) -> fidl::Result<()> {
7436 decoder.debug_check_bounds::<Self>(offset);
7437 fidl::decode!(
7439 DelegatedRxLease,
7440 fidl::encoding::DefaultFuchsiaResourceDialect,
7441 &mut self.lease,
7442 decoder,
7443 offset + 0,
7444 _depth
7445 )?;
7446 Ok(())
7447 }
7448 }
7449
7450 impl DelegatedRxLease {
7451 #[inline(always)]
7452 fn max_ordinal_present(&self) -> u64 {
7453 if let Some(_) = self.handle {
7454 return 2;
7455 }
7456 if let Some(_) = self.hold_until_frame {
7457 return 1;
7458 }
7459 0
7460 }
7461 }
7462
7463 impl fidl::encoding::ResourceTypeMarker for DelegatedRxLease {
7464 type Borrowed<'a> = &'a mut Self;
7465 fn take_or_borrow<'a>(
7466 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7467 ) -> Self::Borrowed<'a> {
7468 value
7469 }
7470 }
7471
7472 unsafe impl fidl::encoding::TypeMarker for DelegatedRxLease {
7473 type Owned = Self;
7474
7475 #[inline(always)]
7476 fn inline_align(_context: fidl::encoding::Context) -> usize {
7477 8
7478 }
7479
7480 #[inline(always)]
7481 fn inline_size(_context: fidl::encoding::Context) -> usize {
7482 16
7483 }
7484 }
7485
7486 unsafe impl
7487 fidl::encoding::Encode<DelegatedRxLease, fidl::encoding::DefaultFuchsiaResourceDialect>
7488 for &mut DelegatedRxLease
7489 {
7490 unsafe fn encode(
7491 self,
7492 encoder: &mut fidl::encoding::Encoder<
7493 '_,
7494 fidl::encoding::DefaultFuchsiaResourceDialect,
7495 >,
7496 offset: usize,
7497 mut depth: fidl::encoding::Depth,
7498 ) -> fidl::Result<()> {
7499 encoder.debug_check_bounds::<DelegatedRxLease>(offset);
7500 let max_ordinal: u64 = self.max_ordinal_present();
7502 encoder.write_num(max_ordinal, offset);
7503 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7504 if max_ordinal == 0 {
7506 return Ok(());
7507 }
7508 depth.increment()?;
7509 let envelope_size = 8;
7510 let bytes_len = max_ordinal as usize * envelope_size;
7511 #[allow(unused_variables)]
7512 let offset = encoder.out_of_line_offset(bytes_len);
7513 let mut _prev_end_offset: usize = 0;
7514 if 1 > max_ordinal {
7515 return Ok(());
7516 }
7517
7518 let cur_offset: usize = (1 - 1) * envelope_size;
7521
7522 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7524
7525 fidl::encoding::encode_in_envelope_optional::<
7530 u64,
7531 fidl::encoding::DefaultFuchsiaResourceDialect,
7532 >(
7533 self.hold_until_frame
7534 .as_ref()
7535 .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
7536 encoder,
7537 offset + cur_offset,
7538 depth,
7539 )?;
7540
7541 _prev_end_offset = cur_offset + envelope_size;
7542 if 2 > max_ordinal {
7543 return Ok(());
7544 }
7545
7546 let cur_offset: usize = (2 - 1) * envelope_size;
7549
7550 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7552
7553 fidl::encoding::encode_in_envelope_optional::<
7558 DelegatedRxLeaseHandle,
7559 fidl::encoding::DefaultFuchsiaResourceDialect,
7560 >(
7561 self.handle.as_mut().map(
7562 <DelegatedRxLeaseHandle as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7563 ),
7564 encoder,
7565 offset + cur_offset,
7566 depth,
7567 )?;
7568
7569 _prev_end_offset = cur_offset + envelope_size;
7570
7571 Ok(())
7572 }
7573 }
7574
7575 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7576 for DelegatedRxLease
7577 {
7578 #[inline(always)]
7579 fn new_empty() -> Self {
7580 Self::default()
7581 }
7582
7583 unsafe fn decode(
7584 &mut self,
7585 decoder: &mut fidl::encoding::Decoder<
7586 '_,
7587 fidl::encoding::DefaultFuchsiaResourceDialect,
7588 >,
7589 offset: usize,
7590 mut depth: fidl::encoding::Depth,
7591 ) -> fidl::Result<()> {
7592 decoder.debug_check_bounds::<Self>(offset);
7593 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7594 None => return Err(fidl::Error::NotNullable),
7595 Some(len) => len,
7596 };
7597 if len == 0 {
7599 return Ok(());
7600 };
7601 depth.increment()?;
7602 let envelope_size = 8;
7603 let bytes_len = len * envelope_size;
7604 let offset = decoder.out_of_line_offset(bytes_len)?;
7605 let mut _next_ordinal_to_read = 0;
7607 let mut next_offset = offset;
7608 let end_offset = offset + bytes_len;
7609 _next_ordinal_to_read += 1;
7610 if next_offset >= end_offset {
7611 return Ok(());
7612 }
7613
7614 while _next_ordinal_to_read < 1 {
7616 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7617 _next_ordinal_to_read += 1;
7618 next_offset += envelope_size;
7619 }
7620
7621 let next_out_of_line = decoder.next_out_of_line();
7622 let handles_before = decoder.remaining_handles();
7623 if let Some((inlined, num_bytes, num_handles)) =
7624 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7625 {
7626 let member_inline_size =
7627 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7628 if inlined != (member_inline_size <= 4) {
7629 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7630 }
7631 let inner_offset;
7632 let mut inner_depth = depth.clone();
7633 if inlined {
7634 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7635 inner_offset = next_offset;
7636 } else {
7637 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7638 inner_depth.increment()?;
7639 }
7640 let val_ref = self.hold_until_frame.get_or_insert_with(|| {
7641 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
7642 });
7643 fidl::decode!(
7644 u64,
7645 fidl::encoding::DefaultFuchsiaResourceDialect,
7646 val_ref,
7647 decoder,
7648 inner_offset,
7649 inner_depth
7650 )?;
7651 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7652 {
7653 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7654 }
7655 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7656 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7657 }
7658 }
7659
7660 next_offset += envelope_size;
7661 _next_ordinal_to_read += 1;
7662 if next_offset >= end_offset {
7663 return Ok(());
7664 }
7665
7666 while _next_ordinal_to_read < 2 {
7668 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7669 _next_ordinal_to_read += 1;
7670 next_offset += envelope_size;
7671 }
7672
7673 let next_out_of_line = decoder.next_out_of_line();
7674 let handles_before = decoder.remaining_handles();
7675 if let Some((inlined, num_bytes, num_handles)) =
7676 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7677 {
7678 let member_inline_size =
7679 <DelegatedRxLeaseHandle as fidl::encoding::TypeMarker>::inline_size(
7680 decoder.context,
7681 );
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.handle.get_or_insert_with(|| {
7695 fidl::new_empty!(
7696 DelegatedRxLeaseHandle,
7697 fidl::encoding::DefaultFuchsiaResourceDialect
7698 )
7699 });
7700 fidl::decode!(
7701 DelegatedRxLeaseHandle,
7702 fidl::encoding::DefaultFuchsiaResourceDialect,
7703 val_ref,
7704 decoder,
7705 inner_offset,
7706 inner_depth
7707 )?;
7708 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7709 {
7710 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7711 }
7712 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7713 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7714 }
7715 }
7716
7717 next_offset += envelope_size;
7718
7719 while next_offset < end_offset {
7721 _next_ordinal_to_read += 1;
7722 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7723 next_offset += envelope_size;
7724 }
7725
7726 Ok(())
7727 }
7728 }
7729
7730 impl SessionInfo {
7731 #[inline(always)]
7732 fn max_ordinal_present(&self) -> u64 {
7733 if let Some(_) = self.options {
7734 return 6;
7735 }
7736 if let Some(_) = self.descriptor_count {
7737 return 5;
7738 }
7739 if let Some(_) = self.descriptor_length {
7740 return 4;
7741 }
7742 if let Some(_) = self.descriptor_version {
7743 return 3;
7744 }
7745 if let Some(_) = self.data {
7746 return 2;
7747 }
7748 if let Some(_) = self.descriptors {
7749 return 1;
7750 }
7751 0
7752 }
7753 }
7754
7755 impl fidl::encoding::ResourceTypeMarker for SessionInfo {
7756 type Borrowed<'a> = &'a mut Self;
7757 fn take_or_borrow<'a>(
7758 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7759 ) -> Self::Borrowed<'a> {
7760 value
7761 }
7762 }
7763
7764 unsafe impl fidl::encoding::TypeMarker for SessionInfo {
7765 type Owned = Self;
7766
7767 #[inline(always)]
7768 fn inline_align(_context: fidl::encoding::Context) -> usize {
7769 8
7770 }
7771
7772 #[inline(always)]
7773 fn inline_size(_context: fidl::encoding::Context) -> usize {
7774 16
7775 }
7776 }
7777
7778 unsafe impl fidl::encoding::Encode<SessionInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
7779 for &mut SessionInfo
7780 {
7781 unsafe fn encode(
7782 self,
7783 encoder: &mut fidl::encoding::Encoder<
7784 '_,
7785 fidl::encoding::DefaultFuchsiaResourceDialect,
7786 >,
7787 offset: usize,
7788 mut depth: fidl::encoding::Depth,
7789 ) -> fidl::Result<()> {
7790 encoder.debug_check_bounds::<SessionInfo>(offset);
7791 let max_ordinal: u64 = self.max_ordinal_present();
7793 encoder.write_num(max_ordinal, offset);
7794 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7795 if max_ordinal == 0 {
7797 return Ok(());
7798 }
7799 depth.increment()?;
7800 let envelope_size = 8;
7801 let bytes_len = max_ordinal as usize * envelope_size;
7802 #[allow(unused_variables)]
7803 let offset = encoder.out_of_line_offset(bytes_len);
7804 let mut _prev_end_offset: usize = 0;
7805 if 1 > max_ordinal {
7806 return Ok(());
7807 }
7808
7809 let cur_offset: usize = (1 - 1) * envelope_size;
7812
7813 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7815
7816 fidl::encoding::encode_in_envelope_optional::<
7821 fidl::encoding::HandleType<
7822 fidl::Vmo,
7823 { fidl::ObjectType::VMO.into_raw() },
7824 2147483648,
7825 >,
7826 fidl::encoding::DefaultFuchsiaResourceDialect,
7827 >(
7828 self.descriptors.as_mut().map(
7829 <fidl::encoding::HandleType<
7830 fidl::Vmo,
7831 { fidl::ObjectType::VMO.into_raw() },
7832 2147483648,
7833 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7834 ),
7835 encoder,
7836 offset + cur_offset,
7837 depth,
7838 )?;
7839
7840 _prev_end_offset = cur_offset + envelope_size;
7841 if 2 > max_ordinal {
7842 return Ok(());
7843 }
7844
7845 let cur_offset: usize = (2 - 1) * envelope_size;
7848
7849 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7851
7852 fidl::encoding::encode_in_envelope_optional::<
7857 fidl::encoding::HandleType<
7858 fidl::Vmo,
7859 { fidl::ObjectType::VMO.into_raw() },
7860 2147483648,
7861 >,
7862 fidl::encoding::DefaultFuchsiaResourceDialect,
7863 >(
7864 self.data.as_mut().map(
7865 <fidl::encoding::HandleType<
7866 fidl::Vmo,
7867 { fidl::ObjectType::VMO.into_raw() },
7868 2147483648,
7869 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7870 ),
7871 encoder,
7872 offset + cur_offset,
7873 depth,
7874 )?;
7875
7876 _prev_end_offset = cur_offset + envelope_size;
7877 if 3 > max_ordinal {
7878 return Ok(());
7879 }
7880
7881 let cur_offset: usize = (3 - 1) * envelope_size;
7884
7885 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7887
7888 fidl::encoding::encode_in_envelope_optional::<
7893 u8,
7894 fidl::encoding::DefaultFuchsiaResourceDialect,
7895 >(
7896 self.descriptor_version
7897 .as_ref()
7898 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
7899 encoder,
7900 offset + cur_offset,
7901 depth,
7902 )?;
7903
7904 _prev_end_offset = cur_offset + envelope_size;
7905 if 4 > max_ordinal {
7906 return Ok(());
7907 }
7908
7909 let cur_offset: usize = (4 - 1) * envelope_size;
7912
7913 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7915
7916 fidl::encoding::encode_in_envelope_optional::<
7921 u8,
7922 fidl::encoding::DefaultFuchsiaResourceDialect,
7923 >(
7924 self.descriptor_length
7925 .as_ref()
7926 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
7927 encoder,
7928 offset + cur_offset,
7929 depth,
7930 )?;
7931
7932 _prev_end_offset = cur_offset + envelope_size;
7933 if 5 > max_ordinal {
7934 return Ok(());
7935 }
7936
7937 let cur_offset: usize = (5 - 1) * envelope_size;
7940
7941 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7943
7944 fidl::encoding::encode_in_envelope_optional::<
7949 u16,
7950 fidl::encoding::DefaultFuchsiaResourceDialect,
7951 >(
7952 self.descriptor_count
7953 .as_ref()
7954 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
7955 encoder,
7956 offset + cur_offset,
7957 depth,
7958 )?;
7959
7960 _prev_end_offset = cur_offset + envelope_size;
7961 if 6 > max_ordinal {
7962 return Ok(());
7963 }
7964
7965 let cur_offset: usize = (6 - 1) * envelope_size;
7968
7969 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7971
7972 fidl::encoding::encode_in_envelope_optional::<
7977 SessionFlags,
7978 fidl::encoding::DefaultFuchsiaResourceDialect,
7979 >(
7980 self.options
7981 .as_ref()
7982 .map(<SessionFlags as fidl::encoding::ValueTypeMarker>::borrow),
7983 encoder,
7984 offset + cur_offset,
7985 depth,
7986 )?;
7987
7988 _prev_end_offset = cur_offset + envelope_size;
7989
7990 Ok(())
7991 }
7992 }
7993
7994 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for SessionInfo {
7995 #[inline(always)]
7996 fn new_empty() -> Self {
7997 Self::default()
7998 }
7999
8000 unsafe fn decode(
8001 &mut self,
8002 decoder: &mut fidl::encoding::Decoder<
8003 '_,
8004 fidl::encoding::DefaultFuchsiaResourceDialect,
8005 >,
8006 offset: usize,
8007 mut depth: fidl::encoding::Depth,
8008 ) -> fidl::Result<()> {
8009 decoder.debug_check_bounds::<Self>(offset);
8010 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8011 None => return Err(fidl::Error::NotNullable),
8012 Some(len) => len,
8013 };
8014 if len == 0 {
8016 return Ok(());
8017 };
8018 depth.increment()?;
8019 let envelope_size = 8;
8020 let bytes_len = len * envelope_size;
8021 let offset = decoder.out_of_line_offset(bytes_len)?;
8022 let mut _next_ordinal_to_read = 0;
8024 let mut next_offset = offset;
8025 let end_offset = offset + bytes_len;
8026 _next_ordinal_to_read += 1;
8027 if next_offset >= end_offset {
8028 return Ok(());
8029 }
8030
8031 while _next_ordinal_to_read < 1 {
8033 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8034 _next_ordinal_to_read += 1;
8035 next_offset += envelope_size;
8036 }
8037
8038 let next_out_of_line = decoder.next_out_of_line();
8039 let handles_before = decoder.remaining_handles();
8040 if let Some((inlined, num_bytes, num_handles)) =
8041 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8042 {
8043 let member_inline_size = <fidl::encoding::HandleType<
8044 fidl::Vmo,
8045 { fidl::ObjectType::VMO.into_raw() },
8046 2147483648,
8047 > as fidl::encoding::TypeMarker>::inline_size(
8048 decoder.context
8049 );
8050 if inlined != (member_inline_size <= 4) {
8051 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8052 }
8053 let inner_offset;
8054 let mut inner_depth = depth.clone();
8055 if inlined {
8056 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8057 inner_offset = next_offset;
8058 } else {
8059 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8060 inner_depth.increment()?;
8061 }
8062 let val_ref =
8063 self.descriptors.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
8064 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8065 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8066 {
8067 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8068 }
8069 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8070 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8071 }
8072 }
8073
8074 next_offset += envelope_size;
8075 _next_ordinal_to_read += 1;
8076 if next_offset >= end_offset {
8077 return Ok(());
8078 }
8079
8080 while _next_ordinal_to_read < 2 {
8082 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8083 _next_ordinal_to_read += 1;
8084 next_offset += envelope_size;
8085 }
8086
8087 let next_out_of_line = decoder.next_out_of_line();
8088 let handles_before = decoder.remaining_handles();
8089 if let Some((inlined, num_bytes, num_handles)) =
8090 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8091 {
8092 let member_inline_size = <fidl::encoding::HandleType<
8093 fidl::Vmo,
8094 { fidl::ObjectType::VMO.into_raw() },
8095 2147483648,
8096 > as fidl::encoding::TypeMarker>::inline_size(
8097 decoder.context
8098 );
8099 if inlined != (member_inline_size <= 4) {
8100 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8101 }
8102 let inner_offset;
8103 let mut inner_depth = depth.clone();
8104 if inlined {
8105 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8106 inner_offset = next_offset;
8107 } else {
8108 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8109 inner_depth.increment()?;
8110 }
8111 let val_ref =
8112 self.data.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
8113 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8114 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8115 {
8116 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8117 }
8118 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8119 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8120 }
8121 }
8122
8123 next_offset += envelope_size;
8124 _next_ordinal_to_read += 1;
8125 if next_offset >= end_offset {
8126 return Ok(());
8127 }
8128
8129 while _next_ordinal_to_read < 3 {
8131 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8132 _next_ordinal_to_read += 1;
8133 next_offset += envelope_size;
8134 }
8135
8136 let next_out_of_line = decoder.next_out_of_line();
8137 let handles_before = decoder.remaining_handles();
8138 if let Some((inlined, num_bytes, num_handles)) =
8139 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8140 {
8141 let member_inline_size =
8142 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8143 if inlined != (member_inline_size <= 4) {
8144 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8145 }
8146 let inner_offset;
8147 let mut inner_depth = depth.clone();
8148 if inlined {
8149 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8150 inner_offset = next_offset;
8151 } else {
8152 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8153 inner_depth.increment()?;
8154 }
8155 let val_ref = self.descriptor_version.get_or_insert_with(|| {
8156 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
8157 });
8158 fidl::decode!(
8159 u8,
8160 fidl::encoding::DefaultFuchsiaResourceDialect,
8161 val_ref,
8162 decoder,
8163 inner_offset,
8164 inner_depth
8165 )?;
8166 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8167 {
8168 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8169 }
8170 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8171 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8172 }
8173 }
8174
8175 next_offset += envelope_size;
8176 _next_ordinal_to_read += 1;
8177 if next_offset >= end_offset {
8178 return Ok(());
8179 }
8180
8181 while _next_ordinal_to_read < 4 {
8183 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8184 _next_ordinal_to_read += 1;
8185 next_offset += envelope_size;
8186 }
8187
8188 let next_out_of_line = decoder.next_out_of_line();
8189 let handles_before = decoder.remaining_handles();
8190 if let Some((inlined, num_bytes, num_handles)) =
8191 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8192 {
8193 let member_inline_size =
8194 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8195 if inlined != (member_inline_size <= 4) {
8196 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8197 }
8198 let inner_offset;
8199 let mut inner_depth = depth.clone();
8200 if inlined {
8201 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8202 inner_offset = next_offset;
8203 } else {
8204 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8205 inner_depth.increment()?;
8206 }
8207 let val_ref = self.descriptor_length.get_or_insert_with(|| {
8208 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
8209 });
8210 fidl::decode!(
8211 u8,
8212 fidl::encoding::DefaultFuchsiaResourceDialect,
8213 val_ref,
8214 decoder,
8215 inner_offset,
8216 inner_depth
8217 )?;
8218 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8219 {
8220 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8221 }
8222 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8223 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8224 }
8225 }
8226
8227 next_offset += envelope_size;
8228 _next_ordinal_to_read += 1;
8229 if next_offset >= end_offset {
8230 return Ok(());
8231 }
8232
8233 while _next_ordinal_to_read < 5 {
8235 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8236 _next_ordinal_to_read += 1;
8237 next_offset += envelope_size;
8238 }
8239
8240 let next_out_of_line = decoder.next_out_of_line();
8241 let handles_before = decoder.remaining_handles();
8242 if let Some((inlined, num_bytes, num_handles)) =
8243 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8244 {
8245 let member_inline_size =
8246 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8247 if inlined != (member_inline_size <= 4) {
8248 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8249 }
8250 let inner_offset;
8251 let mut inner_depth = depth.clone();
8252 if inlined {
8253 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8254 inner_offset = next_offset;
8255 } else {
8256 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8257 inner_depth.increment()?;
8258 }
8259 let val_ref = self.descriptor_count.get_or_insert_with(|| {
8260 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
8261 });
8262 fidl::decode!(
8263 u16,
8264 fidl::encoding::DefaultFuchsiaResourceDialect,
8265 val_ref,
8266 decoder,
8267 inner_offset,
8268 inner_depth
8269 )?;
8270 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8271 {
8272 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8273 }
8274 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8275 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8276 }
8277 }
8278
8279 next_offset += envelope_size;
8280 _next_ordinal_to_read += 1;
8281 if next_offset >= end_offset {
8282 return Ok(());
8283 }
8284
8285 while _next_ordinal_to_read < 6 {
8287 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8288 _next_ordinal_to_read += 1;
8289 next_offset += envelope_size;
8290 }
8291
8292 let next_out_of_line = decoder.next_out_of_line();
8293 let handles_before = decoder.remaining_handles();
8294 if let Some((inlined, num_bytes, num_handles)) =
8295 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8296 {
8297 let member_inline_size =
8298 <SessionFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8299 if inlined != (member_inline_size <= 4) {
8300 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8301 }
8302 let inner_offset;
8303 let mut inner_depth = depth.clone();
8304 if inlined {
8305 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8306 inner_offset = next_offset;
8307 } else {
8308 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8309 inner_depth.increment()?;
8310 }
8311 let val_ref = self.options.get_or_insert_with(|| {
8312 fidl::new_empty!(SessionFlags, fidl::encoding::DefaultFuchsiaResourceDialect)
8313 });
8314 fidl::decode!(
8315 SessionFlags,
8316 fidl::encoding::DefaultFuchsiaResourceDialect,
8317 val_ref,
8318 decoder,
8319 inner_offset,
8320 inner_depth
8321 )?;
8322 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8323 {
8324 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8325 }
8326 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8327 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8328 }
8329 }
8330
8331 next_offset += envelope_size;
8332
8333 while next_offset < end_offset {
8335 _next_ordinal_to_read += 1;
8336 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8337 next_offset += envelope_size;
8338 }
8339
8340 Ok(())
8341 }
8342 }
8343
8344 impl fidl::encoding::ResourceTypeMarker for DelegatedRxLeaseHandle {
8345 type Borrowed<'a> = &'a mut Self;
8346 fn take_or_borrow<'a>(
8347 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8348 ) -> Self::Borrowed<'a> {
8349 value
8350 }
8351 }
8352
8353 unsafe impl fidl::encoding::TypeMarker for DelegatedRxLeaseHandle {
8354 type Owned = Self;
8355
8356 #[inline(always)]
8357 fn inline_align(_context: fidl::encoding::Context) -> usize {
8358 8
8359 }
8360
8361 #[inline(always)]
8362 fn inline_size(_context: fidl::encoding::Context) -> usize {
8363 16
8364 }
8365 }
8366
8367 unsafe impl
8368 fidl::encoding::Encode<
8369 DelegatedRxLeaseHandle,
8370 fidl::encoding::DefaultFuchsiaResourceDialect,
8371 > for &mut DelegatedRxLeaseHandle
8372 {
8373 #[inline]
8374 unsafe fn encode(
8375 self,
8376 encoder: &mut fidl::encoding::Encoder<
8377 '_,
8378 fidl::encoding::DefaultFuchsiaResourceDialect,
8379 >,
8380 offset: usize,
8381 _depth: fidl::encoding::Depth,
8382 ) -> fidl::Result<()> {
8383 encoder.debug_check_bounds::<DelegatedRxLeaseHandle>(offset);
8384 encoder.write_num::<u64>(self.ordinal(), offset);
8385 match self {
8386 DelegatedRxLeaseHandle::Channel(ref mut val) => {
8387 fidl::encoding::encode_in_envelope::<
8388 fidl::encoding::HandleType<
8389 fidl::Channel,
8390 { fidl::ObjectType::CHANNEL.into_raw() },
8391 2147483648,
8392 >,
8393 fidl::encoding::DefaultFuchsiaResourceDialect,
8394 >(
8395 <fidl::encoding::HandleType<
8396 fidl::Channel,
8397 { fidl::ObjectType::CHANNEL.into_raw() },
8398 2147483648,
8399 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8400 val
8401 ),
8402 encoder,
8403 offset + 8,
8404 _depth,
8405 )
8406 }
8407 DelegatedRxLeaseHandle::__SourceBreaking { .. } => {
8408 Err(fidl::Error::UnknownUnionTag)
8409 }
8410 }
8411 }
8412 }
8413
8414 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8415 for DelegatedRxLeaseHandle
8416 {
8417 #[inline(always)]
8418 fn new_empty() -> Self {
8419 Self::__SourceBreaking { unknown_ordinal: 0 }
8420 }
8421
8422 #[inline]
8423 unsafe fn decode(
8424 &mut self,
8425 decoder: &mut fidl::encoding::Decoder<
8426 '_,
8427 fidl::encoding::DefaultFuchsiaResourceDialect,
8428 >,
8429 offset: usize,
8430 mut depth: fidl::encoding::Depth,
8431 ) -> fidl::Result<()> {
8432 decoder.debug_check_bounds::<Self>(offset);
8433 #[allow(unused_variables)]
8434 let next_out_of_line = decoder.next_out_of_line();
8435 let handles_before = decoder.remaining_handles();
8436 let (ordinal, inlined, num_bytes, num_handles) =
8437 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
8438
8439 let member_inline_size = match ordinal {
8440 1 => <fidl::encoding::HandleType<
8441 fidl::Channel,
8442 { fidl::ObjectType::CHANNEL.into_raw() },
8443 2147483648,
8444 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8445 0 => return Err(fidl::Error::UnknownUnionTag),
8446 _ => num_bytes as usize,
8447 };
8448
8449 if inlined != (member_inline_size <= 4) {
8450 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8451 }
8452 let _inner_offset;
8453 if inlined {
8454 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
8455 _inner_offset = offset + 8;
8456 } else {
8457 depth.increment()?;
8458 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8459 }
8460 match ordinal {
8461 1 => {
8462 #[allow(irrefutable_let_patterns)]
8463 if let DelegatedRxLeaseHandle::Channel(_) = self {
8464 } else {
8466 *self = DelegatedRxLeaseHandle::Channel(
8468 fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8469 );
8470 }
8471 #[allow(irrefutable_let_patterns)]
8472 if let DelegatedRxLeaseHandle::Channel(ref mut val) = self {
8473 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
8474 } else {
8475 unreachable!()
8476 }
8477 }
8478 #[allow(deprecated)]
8479 ordinal => {
8480 for _ in 0..num_handles {
8481 decoder.drop_next_handle()?;
8482 }
8483 *self = DelegatedRxLeaseHandle::__SourceBreaking { unknown_ordinal: ordinal };
8484 }
8485 }
8486 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
8487 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8488 }
8489 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8490 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8491 }
8492 Ok(())
8493 }
8494 }
8495}