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_net_tun_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ControlCreateDeviceRequest {
16 pub config: DeviceConfig,
17 pub device: fidl::endpoints::ServerEnd<DeviceMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for ControlCreateDeviceRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct ControlCreatePairRequest {
27 pub config: DevicePairConfig,
28 pub device_pair: fidl::endpoints::ServerEnd<DevicePairMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControlCreatePairRequest {}
32
33#[derive(Debug, PartialEq)]
34pub struct DeviceAddPortRequest {
35 pub config: DevicePortConfig,
36 pub port: fidl::endpoints::ServerEnd<PortMarker>,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceAddPortRequest {}
40
41#[derive(Debug, PartialEq)]
42pub struct DeviceDelegateRxLeaseRequest {
43 pub lease: fidl_fuchsia_hardware_network::DelegatedRxLease,
44}
45
46impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
47 for DeviceDelegateRxLeaseRequest
48{
49}
50
51#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
52pub struct DeviceGetDeviceRequest {
53 pub device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
54}
55
56impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceGetDeviceRequest {}
57
58#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
59pub struct DeviceGetSignalsResponse {
60 pub signals: fidl::EventPair,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceGetSignalsResponse {}
64
65#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
66pub struct DevicePairGetLeftPortRequest {
67 pub id: u8,
68 pub port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
69}
70
71impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
72 for DevicePairGetLeftPortRequest
73{
74}
75
76#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
77pub struct DevicePairGetLeftRequest {
78 pub device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
79}
80
81impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DevicePairGetLeftRequest {}
82
83#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
84pub struct DevicePairGetRightPortRequest {
85 pub id: u8,
86 pub port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
87}
88
89impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
90 for DevicePairGetRightPortRequest
91{
92}
93
94#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
95pub struct DevicePairGetRightRequest {
96 pub device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
97}
98
99impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DevicePairGetRightRequest {}
100
101#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
102pub struct PortGetPortRequest {
103 pub port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
104}
105
106impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PortGetPortRequest {}
107
108#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
109pub struct ControlMarker;
110
111impl fidl::endpoints::ProtocolMarker for ControlMarker {
112 type Proxy = ControlProxy;
113 type RequestStream = ControlRequestStream;
114 #[cfg(target_os = "fuchsia")]
115 type SynchronousProxy = ControlSynchronousProxy;
116
117 const DEBUG_NAME: &'static str = "fuchsia.net.tun.Control";
118}
119impl fidl::endpoints::DiscoverableProtocolMarker for ControlMarker {}
120
121pub trait ControlProxyInterface: Send + Sync {
122 fn r#create_device(
123 &self,
124 config: &DeviceConfig,
125 device: fidl::endpoints::ServerEnd<DeviceMarker>,
126 ) -> Result<(), fidl::Error>;
127 fn r#create_pair(
128 &self,
129 config: &DevicePairConfig,
130 device_pair: fidl::endpoints::ServerEnd<DevicePairMarker>,
131 ) -> Result<(), fidl::Error>;
132}
133#[derive(Debug)]
134#[cfg(target_os = "fuchsia")]
135pub struct ControlSynchronousProxy {
136 client: fidl::client::sync::Client,
137}
138
139#[cfg(target_os = "fuchsia")]
140impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
141 type Proxy = ControlProxy;
142 type Protocol = ControlMarker;
143
144 fn from_channel(inner: fidl::Channel) -> Self {
145 Self::new(inner)
146 }
147
148 fn into_channel(self) -> fidl::Channel {
149 self.client.into_channel()
150 }
151
152 fn as_channel(&self) -> &fidl::Channel {
153 self.client.as_channel()
154 }
155}
156
157#[cfg(target_os = "fuchsia")]
158impl ControlSynchronousProxy {
159 pub fn new(channel: fidl::Channel) -> Self {
160 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
161 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
162 }
163
164 pub fn into_channel(self) -> fidl::Channel {
165 self.client.into_channel()
166 }
167
168 pub fn wait_for_event(
171 &self,
172 deadline: zx::MonotonicInstant,
173 ) -> Result<ControlEvent, fidl::Error> {
174 ControlEvent::decode(self.client.wait_for_event(deadline)?)
175 }
176
177 pub fn r#create_device(
183 &self,
184 mut config: &DeviceConfig,
185 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
186 ) -> Result<(), fidl::Error> {
187 self.client.send::<ControlCreateDeviceRequest>(
188 (config, device),
189 0x2aace38c0c1cd187,
190 fidl::encoding::DynamicFlags::empty(),
191 )
192 }
193
194 pub fn r#create_pair(
203 &self,
204 mut config: &DevicePairConfig,
205 mut device_pair: fidl::endpoints::ServerEnd<DevicePairMarker>,
206 ) -> Result<(), fidl::Error> {
207 self.client.send::<ControlCreatePairRequest>(
208 (config, device_pair),
209 0x2c8884060cc29d18,
210 fidl::encoding::DynamicFlags::empty(),
211 )
212 }
213}
214
215#[cfg(target_os = "fuchsia")]
216impl From<ControlSynchronousProxy> for zx::Handle {
217 fn from(value: ControlSynchronousProxy) -> Self {
218 value.into_channel().into()
219 }
220}
221
222#[cfg(target_os = "fuchsia")]
223impl From<fidl::Channel> for ControlSynchronousProxy {
224 fn from(value: fidl::Channel) -> Self {
225 Self::new(value)
226 }
227}
228
229#[derive(Debug, Clone)]
230pub struct ControlProxy {
231 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
232}
233
234impl fidl::endpoints::Proxy for ControlProxy {
235 type Protocol = ControlMarker;
236
237 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
238 Self::new(inner)
239 }
240
241 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
242 self.client.into_channel().map_err(|client| Self { client })
243 }
244
245 fn as_channel(&self) -> &::fidl::AsyncChannel {
246 self.client.as_channel()
247 }
248}
249
250impl ControlProxy {
251 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
253 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
254 Self { client: fidl::client::Client::new(channel, protocol_name) }
255 }
256
257 pub fn take_event_stream(&self) -> ControlEventStream {
263 ControlEventStream { event_receiver: self.client.take_event_receiver() }
264 }
265
266 pub fn r#create_device(
272 &self,
273 mut config: &DeviceConfig,
274 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
275 ) -> Result<(), fidl::Error> {
276 ControlProxyInterface::r#create_device(self, config, device)
277 }
278
279 pub fn r#create_pair(
288 &self,
289 mut config: &DevicePairConfig,
290 mut device_pair: fidl::endpoints::ServerEnd<DevicePairMarker>,
291 ) -> Result<(), fidl::Error> {
292 ControlProxyInterface::r#create_pair(self, config, device_pair)
293 }
294}
295
296impl ControlProxyInterface for ControlProxy {
297 fn r#create_device(
298 &self,
299 mut config: &DeviceConfig,
300 mut device: fidl::endpoints::ServerEnd<DeviceMarker>,
301 ) -> Result<(), fidl::Error> {
302 self.client.send::<ControlCreateDeviceRequest>(
303 (config, device),
304 0x2aace38c0c1cd187,
305 fidl::encoding::DynamicFlags::empty(),
306 )
307 }
308
309 fn r#create_pair(
310 &self,
311 mut config: &DevicePairConfig,
312 mut device_pair: fidl::endpoints::ServerEnd<DevicePairMarker>,
313 ) -> Result<(), fidl::Error> {
314 self.client.send::<ControlCreatePairRequest>(
315 (config, device_pair),
316 0x2c8884060cc29d18,
317 fidl::encoding::DynamicFlags::empty(),
318 )
319 }
320}
321
322pub struct ControlEventStream {
323 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
324}
325
326impl std::marker::Unpin for ControlEventStream {}
327
328impl futures::stream::FusedStream for ControlEventStream {
329 fn is_terminated(&self) -> bool {
330 self.event_receiver.is_terminated()
331 }
332}
333
334impl futures::Stream for ControlEventStream {
335 type Item = Result<ControlEvent, fidl::Error>;
336
337 fn poll_next(
338 mut self: std::pin::Pin<&mut Self>,
339 cx: &mut std::task::Context<'_>,
340 ) -> std::task::Poll<Option<Self::Item>> {
341 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
342 &mut self.event_receiver,
343 cx
344 )?) {
345 Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
346 None => std::task::Poll::Ready(None),
347 }
348 }
349}
350
351#[derive(Debug)]
352pub enum ControlEvent {}
353
354impl ControlEvent {
355 fn decode(
357 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
358 ) -> Result<ControlEvent, fidl::Error> {
359 let (bytes, _handles) = buf.split_mut();
360 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
361 debug_assert_eq!(tx_header.tx_id, 0);
362 match tx_header.ordinal {
363 _ => Err(fidl::Error::UnknownOrdinal {
364 ordinal: tx_header.ordinal,
365 protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
366 }),
367 }
368 }
369}
370
371pub struct ControlRequestStream {
373 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
374 is_terminated: bool,
375}
376
377impl std::marker::Unpin for ControlRequestStream {}
378
379impl futures::stream::FusedStream for ControlRequestStream {
380 fn is_terminated(&self) -> bool {
381 self.is_terminated
382 }
383}
384
385impl fidl::endpoints::RequestStream for ControlRequestStream {
386 type Protocol = ControlMarker;
387 type ControlHandle = ControlControlHandle;
388
389 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
390 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
391 }
392
393 fn control_handle(&self) -> Self::ControlHandle {
394 ControlControlHandle { inner: self.inner.clone() }
395 }
396
397 fn into_inner(
398 self,
399 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
400 {
401 (self.inner, self.is_terminated)
402 }
403
404 fn from_inner(
405 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
406 is_terminated: bool,
407 ) -> Self {
408 Self { inner, is_terminated }
409 }
410}
411
412impl futures::Stream for ControlRequestStream {
413 type Item = Result<ControlRequest, fidl::Error>;
414
415 fn poll_next(
416 mut self: std::pin::Pin<&mut Self>,
417 cx: &mut std::task::Context<'_>,
418 ) -> std::task::Poll<Option<Self::Item>> {
419 let this = &mut *self;
420 if this.inner.check_shutdown(cx) {
421 this.is_terminated = true;
422 return std::task::Poll::Ready(None);
423 }
424 if this.is_terminated {
425 panic!("polled ControlRequestStream after completion");
426 }
427 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
428 |bytes, handles| {
429 match this.inner.channel().read_etc(cx, bytes, handles) {
430 std::task::Poll::Ready(Ok(())) => {}
431 std::task::Poll::Pending => return std::task::Poll::Pending,
432 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
433 this.is_terminated = true;
434 return std::task::Poll::Ready(None);
435 }
436 std::task::Poll::Ready(Err(e)) => {
437 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
438 e.into(),
439 ))))
440 }
441 }
442
443 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
445
446 std::task::Poll::Ready(Some(match header.ordinal {
447 0x2aace38c0c1cd187 => {
448 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
449 let mut req = fidl::new_empty!(
450 ControlCreateDeviceRequest,
451 fidl::encoding::DefaultFuchsiaResourceDialect
452 );
453 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlCreateDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
454 let control_handle = ControlControlHandle { inner: this.inner.clone() };
455 Ok(ControlRequest::CreateDevice {
456 config: req.config,
457 device: req.device,
458
459 control_handle,
460 })
461 }
462 0x2c8884060cc29d18 => {
463 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
464 let mut req = fidl::new_empty!(
465 ControlCreatePairRequest,
466 fidl::encoding::DefaultFuchsiaResourceDialect
467 );
468 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlCreatePairRequest>(&header, _body_bytes, handles, &mut req)?;
469 let control_handle = ControlControlHandle { inner: this.inner.clone() };
470 Ok(ControlRequest::CreatePair {
471 config: req.config,
472 device_pair: req.device_pair,
473
474 control_handle,
475 })
476 }
477 _ => Err(fidl::Error::UnknownOrdinal {
478 ordinal: header.ordinal,
479 protocol_name:
480 <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
481 }),
482 }))
483 },
484 )
485 }
486}
487
488#[derive(Debug)]
493pub enum ControlRequest {
494 CreateDevice {
500 config: DeviceConfig,
501 device: fidl::endpoints::ServerEnd<DeviceMarker>,
502 control_handle: ControlControlHandle,
503 },
504 CreatePair {
513 config: DevicePairConfig,
514 device_pair: fidl::endpoints::ServerEnd<DevicePairMarker>,
515 control_handle: ControlControlHandle,
516 },
517}
518
519impl ControlRequest {
520 #[allow(irrefutable_let_patterns)]
521 pub fn into_create_device(
522 self,
523 ) -> Option<(DeviceConfig, fidl::endpoints::ServerEnd<DeviceMarker>, ControlControlHandle)>
524 {
525 if let ControlRequest::CreateDevice { config, device, control_handle } = self {
526 Some((config, device, control_handle))
527 } else {
528 None
529 }
530 }
531
532 #[allow(irrefutable_let_patterns)]
533 pub fn into_create_pair(
534 self,
535 ) -> Option<(
536 DevicePairConfig,
537 fidl::endpoints::ServerEnd<DevicePairMarker>,
538 ControlControlHandle,
539 )> {
540 if let ControlRequest::CreatePair { config, device_pair, control_handle } = self {
541 Some((config, device_pair, control_handle))
542 } else {
543 None
544 }
545 }
546
547 pub fn method_name(&self) -> &'static str {
549 match *self {
550 ControlRequest::CreateDevice { .. } => "create_device",
551 ControlRequest::CreatePair { .. } => "create_pair",
552 }
553 }
554}
555
556#[derive(Debug, Clone)]
557pub struct ControlControlHandle {
558 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
559}
560
561impl fidl::endpoints::ControlHandle for ControlControlHandle {
562 fn shutdown(&self) {
563 self.inner.shutdown()
564 }
565 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
566 self.inner.shutdown_with_epitaph(status)
567 }
568
569 fn is_closed(&self) -> bool {
570 self.inner.channel().is_closed()
571 }
572 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
573 self.inner.channel().on_closed()
574 }
575
576 #[cfg(target_os = "fuchsia")]
577 fn signal_peer(
578 &self,
579 clear_mask: zx::Signals,
580 set_mask: zx::Signals,
581 ) -> Result<(), zx_status::Status> {
582 use fidl::Peered;
583 self.inner.channel().signal_peer(clear_mask, set_mask)
584 }
585}
586
587impl ControlControlHandle {}
588
589#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
590pub struct DeviceMarker;
591
592impl fidl::endpoints::ProtocolMarker for DeviceMarker {
593 type Proxy = DeviceProxy;
594 type RequestStream = DeviceRequestStream;
595 #[cfg(target_os = "fuchsia")]
596 type SynchronousProxy = DeviceSynchronousProxy;
597
598 const DEBUG_NAME: &'static str = "(anonymous) Device";
599}
600pub type DeviceWriteFrameResult = Result<(), i32>;
601pub type DeviceReadFrameResult = Result<Frame, i32>;
602
603pub trait DeviceProxyInterface: Send + Sync {
604 type WriteFrameResponseFut: std::future::Future<Output = Result<DeviceWriteFrameResult, fidl::Error>>
605 + Send;
606 fn r#write_frame(&self, frame: &Frame) -> Self::WriteFrameResponseFut;
607 type ReadFrameResponseFut: std::future::Future<Output = Result<DeviceReadFrameResult, fidl::Error>>
608 + Send;
609 fn r#read_frame(&self) -> Self::ReadFrameResponseFut;
610 type GetSignalsResponseFut: std::future::Future<Output = Result<fidl::EventPair, fidl::Error>>
611 + Send;
612 fn r#get_signals(&self) -> Self::GetSignalsResponseFut;
613 fn r#add_port(
614 &self,
615 config: &DevicePortConfig,
616 port: fidl::endpoints::ServerEnd<PortMarker>,
617 ) -> Result<(), fidl::Error>;
618 fn r#get_device(
619 &self,
620 device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
621 ) -> Result<(), fidl::Error>;
622 fn r#delegate_rx_lease(
623 &self,
624 lease: fidl_fuchsia_hardware_network::DelegatedRxLease,
625 ) -> Result<(), fidl::Error>;
626}
627#[derive(Debug)]
628#[cfg(target_os = "fuchsia")]
629pub struct DeviceSynchronousProxy {
630 client: fidl::client::sync::Client,
631}
632
633#[cfg(target_os = "fuchsia")]
634impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
635 type Proxy = DeviceProxy;
636 type Protocol = DeviceMarker;
637
638 fn from_channel(inner: fidl::Channel) -> Self {
639 Self::new(inner)
640 }
641
642 fn into_channel(self) -> fidl::Channel {
643 self.client.into_channel()
644 }
645
646 fn as_channel(&self) -> &fidl::Channel {
647 self.client.as_channel()
648 }
649}
650
651#[cfg(target_os = "fuchsia")]
652impl DeviceSynchronousProxy {
653 pub fn new(channel: fidl::Channel) -> Self {
654 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
655 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
656 }
657
658 pub fn into_channel(self) -> fidl::Channel {
659 self.client.into_channel()
660 }
661
662 pub fn wait_for_event(
665 &self,
666 deadline: zx::MonotonicInstant,
667 ) -> Result<DeviceEvent, fidl::Error> {
668 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
669 }
670
671 pub fn r#write_frame(
689 &self,
690 mut frame: &Frame,
691 ___deadline: zx::MonotonicInstant,
692 ) -> Result<DeviceWriteFrameResult, fidl::Error> {
693 let _response = self.client.send_query::<
694 DeviceWriteFrameRequest,
695 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
696 >(
697 (frame,),
698 0x2d19e24e149bf6db,
699 fidl::encoding::DynamicFlags::empty(),
700 ___deadline,
701 )?;
702 Ok(_response.map(|x| x))
703 }
704
705 pub fn r#read_frame(
718 &self,
719 ___deadline: zx::MonotonicInstant,
720 ) -> Result<DeviceReadFrameResult, fidl::Error> {
721 let _response = self.client.send_query::<
722 fidl::encoding::EmptyPayload,
723 fidl::encoding::ResultType<DeviceReadFrameResponse, i32>,
724 >(
725 (),
726 0x6ebc56b8427e1571,
727 fidl::encoding::DynamicFlags::empty(),
728 ___deadline,
729 )?;
730 Ok(_response.map(|x| x.frame))
731 }
732
733 pub fn r#get_signals(
739 &self,
740 ___deadline: zx::MonotonicInstant,
741 ) -> Result<fidl::EventPair, fidl::Error> {
742 let _response =
743 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetSignalsResponse>(
744 (),
745 0x4d1ca50fc53606b9,
746 fidl::encoding::DynamicFlags::empty(),
747 ___deadline,
748 )?;
749 Ok(_response.signals)
750 }
751
752 pub fn r#add_port(
758 &self,
759 mut config: &DevicePortConfig,
760 mut port: fidl::endpoints::ServerEnd<PortMarker>,
761 ) -> Result<(), fidl::Error> {
762 self.client.send::<DeviceAddPortRequest>(
763 (config, port),
764 0x6b56b238f04ee3d4,
765 fidl::encoding::DynamicFlags::empty(),
766 )
767 }
768
769 pub fn r#get_device(
773 &self,
774 mut device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
775 ) -> Result<(), fidl::Error> {
776 self.client.send::<DeviceGetDeviceRequest>(
777 (device,),
778 0x2e8c81fdcdd99d26,
779 fidl::encoding::DynamicFlags::empty(),
780 )
781 }
782
783 pub fn r#delegate_rx_lease(
788 &self,
789 mut lease: fidl_fuchsia_hardware_network::DelegatedRxLease,
790 ) -> Result<(), fidl::Error> {
791 self.client.send::<DeviceDelegateRxLeaseRequest>(
792 (&mut lease,),
793 0x660137a0e680b4c0,
794 fidl::encoding::DynamicFlags::empty(),
795 )
796 }
797}
798
799#[cfg(target_os = "fuchsia")]
800impl From<DeviceSynchronousProxy> for zx::Handle {
801 fn from(value: DeviceSynchronousProxy) -> Self {
802 value.into_channel().into()
803 }
804}
805
806#[cfg(target_os = "fuchsia")]
807impl From<fidl::Channel> for DeviceSynchronousProxy {
808 fn from(value: fidl::Channel) -> Self {
809 Self::new(value)
810 }
811}
812
813#[derive(Debug, Clone)]
814pub struct DeviceProxy {
815 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
816}
817
818impl fidl::endpoints::Proxy for DeviceProxy {
819 type Protocol = DeviceMarker;
820
821 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
822 Self::new(inner)
823 }
824
825 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
826 self.client.into_channel().map_err(|client| Self { client })
827 }
828
829 fn as_channel(&self) -> &::fidl::AsyncChannel {
830 self.client.as_channel()
831 }
832}
833
834impl DeviceProxy {
835 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
837 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
838 Self { client: fidl::client::Client::new(channel, protocol_name) }
839 }
840
841 pub fn take_event_stream(&self) -> DeviceEventStream {
847 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
848 }
849
850 pub fn r#write_frame(
868 &self,
869 mut frame: &Frame,
870 ) -> fidl::client::QueryResponseFut<
871 DeviceWriteFrameResult,
872 fidl::encoding::DefaultFuchsiaResourceDialect,
873 > {
874 DeviceProxyInterface::r#write_frame(self, frame)
875 }
876
877 pub fn r#read_frame(
890 &self,
891 ) -> fidl::client::QueryResponseFut<
892 DeviceReadFrameResult,
893 fidl::encoding::DefaultFuchsiaResourceDialect,
894 > {
895 DeviceProxyInterface::r#read_frame(self)
896 }
897
898 pub fn r#get_signals(
904 &self,
905 ) -> fidl::client::QueryResponseFut<
906 fidl::EventPair,
907 fidl::encoding::DefaultFuchsiaResourceDialect,
908 > {
909 DeviceProxyInterface::r#get_signals(self)
910 }
911
912 pub fn r#add_port(
918 &self,
919 mut config: &DevicePortConfig,
920 mut port: fidl::endpoints::ServerEnd<PortMarker>,
921 ) -> Result<(), fidl::Error> {
922 DeviceProxyInterface::r#add_port(self, config, port)
923 }
924
925 pub fn r#get_device(
929 &self,
930 mut device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
931 ) -> Result<(), fidl::Error> {
932 DeviceProxyInterface::r#get_device(self, device)
933 }
934
935 pub fn r#delegate_rx_lease(
940 &self,
941 mut lease: fidl_fuchsia_hardware_network::DelegatedRxLease,
942 ) -> Result<(), fidl::Error> {
943 DeviceProxyInterface::r#delegate_rx_lease(self, lease)
944 }
945}
946
947impl DeviceProxyInterface for DeviceProxy {
948 type WriteFrameResponseFut = fidl::client::QueryResponseFut<
949 DeviceWriteFrameResult,
950 fidl::encoding::DefaultFuchsiaResourceDialect,
951 >;
952 fn r#write_frame(&self, mut frame: &Frame) -> Self::WriteFrameResponseFut {
953 fn _decode(
954 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
955 ) -> Result<DeviceWriteFrameResult, fidl::Error> {
956 let _response = fidl::client::decode_transaction_body::<
957 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
958 fidl::encoding::DefaultFuchsiaResourceDialect,
959 0x2d19e24e149bf6db,
960 >(_buf?)?;
961 Ok(_response.map(|x| x))
962 }
963 self.client.send_query_and_decode::<DeviceWriteFrameRequest, DeviceWriteFrameResult>(
964 (frame,),
965 0x2d19e24e149bf6db,
966 fidl::encoding::DynamicFlags::empty(),
967 _decode,
968 )
969 }
970
971 type ReadFrameResponseFut = fidl::client::QueryResponseFut<
972 DeviceReadFrameResult,
973 fidl::encoding::DefaultFuchsiaResourceDialect,
974 >;
975 fn r#read_frame(&self) -> Self::ReadFrameResponseFut {
976 fn _decode(
977 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
978 ) -> Result<DeviceReadFrameResult, fidl::Error> {
979 let _response = fidl::client::decode_transaction_body::<
980 fidl::encoding::ResultType<DeviceReadFrameResponse, i32>,
981 fidl::encoding::DefaultFuchsiaResourceDialect,
982 0x6ebc56b8427e1571,
983 >(_buf?)?;
984 Ok(_response.map(|x| x.frame))
985 }
986 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceReadFrameResult>(
987 (),
988 0x6ebc56b8427e1571,
989 fidl::encoding::DynamicFlags::empty(),
990 _decode,
991 )
992 }
993
994 type GetSignalsResponseFut = fidl::client::QueryResponseFut<
995 fidl::EventPair,
996 fidl::encoding::DefaultFuchsiaResourceDialect,
997 >;
998 fn r#get_signals(&self) -> Self::GetSignalsResponseFut {
999 fn _decode(
1000 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1001 ) -> Result<fidl::EventPair, fidl::Error> {
1002 let _response = fidl::client::decode_transaction_body::<
1003 DeviceGetSignalsResponse,
1004 fidl::encoding::DefaultFuchsiaResourceDialect,
1005 0x4d1ca50fc53606b9,
1006 >(_buf?)?;
1007 Ok(_response.signals)
1008 }
1009 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::EventPair>(
1010 (),
1011 0x4d1ca50fc53606b9,
1012 fidl::encoding::DynamicFlags::empty(),
1013 _decode,
1014 )
1015 }
1016
1017 fn r#add_port(
1018 &self,
1019 mut config: &DevicePortConfig,
1020 mut port: fidl::endpoints::ServerEnd<PortMarker>,
1021 ) -> Result<(), fidl::Error> {
1022 self.client.send::<DeviceAddPortRequest>(
1023 (config, port),
1024 0x6b56b238f04ee3d4,
1025 fidl::encoding::DynamicFlags::empty(),
1026 )
1027 }
1028
1029 fn r#get_device(
1030 &self,
1031 mut device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
1032 ) -> Result<(), fidl::Error> {
1033 self.client.send::<DeviceGetDeviceRequest>(
1034 (device,),
1035 0x2e8c81fdcdd99d26,
1036 fidl::encoding::DynamicFlags::empty(),
1037 )
1038 }
1039
1040 fn r#delegate_rx_lease(
1041 &self,
1042 mut lease: fidl_fuchsia_hardware_network::DelegatedRxLease,
1043 ) -> Result<(), fidl::Error> {
1044 self.client.send::<DeviceDelegateRxLeaseRequest>(
1045 (&mut lease,),
1046 0x660137a0e680b4c0,
1047 fidl::encoding::DynamicFlags::empty(),
1048 )
1049 }
1050}
1051
1052pub struct DeviceEventStream {
1053 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1054}
1055
1056impl std::marker::Unpin for DeviceEventStream {}
1057
1058impl futures::stream::FusedStream for DeviceEventStream {
1059 fn is_terminated(&self) -> bool {
1060 self.event_receiver.is_terminated()
1061 }
1062}
1063
1064impl futures::Stream for DeviceEventStream {
1065 type Item = Result<DeviceEvent, fidl::Error>;
1066
1067 fn poll_next(
1068 mut self: std::pin::Pin<&mut Self>,
1069 cx: &mut std::task::Context<'_>,
1070 ) -> std::task::Poll<Option<Self::Item>> {
1071 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1072 &mut self.event_receiver,
1073 cx
1074 )?) {
1075 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
1076 None => std::task::Poll::Ready(None),
1077 }
1078 }
1079}
1080
1081#[derive(Debug)]
1082pub enum DeviceEvent {}
1083
1084impl DeviceEvent {
1085 fn decode(
1087 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1088 ) -> Result<DeviceEvent, fidl::Error> {
1089 let (bytes, _handles) = buf.split_mut();
1090 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1091 debug_assert_eq!(tx_header.tx_id, 0);
1092 match tx_header.ordinal {
1093 _ => Err(fidl::Error::UnknownOrdinal {
1094 ordinal: tx_header.ordinal,
1095 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1096 }),
1097 }
1098 }
1099}
1100
1101pub struct DeviceRequestStream {
1103 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1104 is_terminated: bool,
1105}
1106
1107impl std::marker::Unpin for DeviceRequestStream {}
1108
1109impl futures::stream::FusedStream for DeviceRequestStream {
1110 fn is_terminated(&self) -> bool {
1111 self.is_terminated
1112 }
1113}
1114
1115impl fidl::endpoints::RequestStream for DeviceRequestStream {
1116 type Protocol = DeviceMarker;
1117 type ControlHandle = DeviceControlHandle;
1118
1119 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1120 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1121 }
1122
1123 fn control_handle(&self) -> Self::ControlHandle {
1124 DeviceControlHandle { inner: self.inner.clone() }
1125 }
1126
1127 fn into_inner(
1128 self,
1129 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1130 {
1131 (self.inner, self.is_terminated)
1132 }
1133
1134 fn from_inner(
1135 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1136 is_terminated: bool,
1137 ) -> Self {
1138 Self { inner, is_terminated }
1139 }
1140}
1141
1142impl futures::Stream for DeviceRequestStream {
1143 type Item = Result<DeviceRequest, fidl::Error>;
1144
1145 fn poll_next(
1146 mut self: std::pin::Pin<&mut Self>,
1147 cx: &mut std::task::Context<'_>,
1148 ) -> std::task::Poll<Option<Self::Item>> {
1149 let this = &mut *self;
1150 if this.inner.check_shutdown(cx) {
1151 this.is_terminated = true;
1152 return std::task::Poll::Ready(None);
1153 }
1154 if this.is_terminated {
1155 panic!("polled DeviceRequestStream after completion");
1156 }
1157 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1158 |bytes, handles| {
1159 match this.inner.channel().read_etc(cx, bytes, handles) {
1160 std::task::Poll::Ready(Ok(())) => {}
1161 std::task::Poll::Pending => return std::task::Poll::Pending,
1162 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1163 this.is_terminated = true;
1164 return std::task::Poll::Ready(None);
1165 }
1166 std::task::Poll::Ready(Err(e)) => {
1167 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1168 e.into(),
1169 ))))
1170 }
1171 }
1172
1173 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1175
1176 std::task::Poll::Ready(Some(match header.ordinal {
1177 0x2d19e24e149bf6db => {
1178 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1179 let mut req = fidl::new_empty!(
1180 DeviceWriteFrameRequest,
1181 fidl::encoding::DefaultFuchsiaResourceDialect
1182 );
1183 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteFrameRequest>(&header, _body_bytes, handles, &mut req)?;
1184 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1185 Ok(DeviceRequest::WriteFrame {
1186 frame: req.frame,
1187
1188 responder: DeviceWriteFrameResponder {
1189 control_handle: std::mem::ManuallyDrop::new(control_handle),
1190 tx_id: header.tx_id,
1191 },
1192 })
1193 }
1194 0x6ebc56b8427e1571 => {
1195 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1196 let mut req = fidl::new_empty!(
1197 fidl::encoding::EmptyPayload,
1198 fidl::encoding::DefaultFuchsiaResourceDialect
1199 );
1200 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1201 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1202 Ok(DeviceRequest::ReadFrame {
1203 responder: DeviceReadFrameResponder {
1204 control_handle: std::mem::ManuallyDrop::new(control_handle),
1205 tx_id: header.tx_id,
1206 },
1207 })
1208 }
1209 0x4d1ca50fc53606b9 => {
1210 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1211 let mut req = fidl::new_empty!(
1212 fidl::encoding::EmptyPayload,
1213 fidl::encoding::DefaultFuchsiaResourceDialect
1214 );
1215 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1216 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1217 Ok(DeviceRequest::GetSignals {
1218 responder: DeviceGetSignalsResponder {
1219 control_handle: std::mem::ManuallyDrop::new(control_handle),
1220 tx_id: header.tx_id,
1221 },
1222 })
1223 }
1224 0x6b56b238f04ee3d4 => {
1225 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1226 let mut req = fidl::new_empty!(
1227 DeviceAddPortRequest,
1228 fidl::encoding::DefaultFuchsiaResourceDialect
1229 );
1230 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceAddPortRequest>(&header, _body_bytes, handles, &mut req)?;
1231 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1232 Ok(DeviceRequest::AddPort {
1233 config: req.config,
1234 port: req.port,
1235
1236 control_handle,
1237 })
1238 }
1239 0x2e8c81fdcdd99d26 => {
1240 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1241 let mut req = fidl::new_empty!(
1242 DeviceGetDeviceRequest,
1243 fidl::encoding::DefaultFuchsiaResourceDialect
1244 );
1245 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
1246 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1247 Ok(DeviceRequest::GetDevice { device: req.device, control_handle })
1248 }
1249 0x660137a0e680b4c0 => {
1250 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1251 let mut req = fidl::new_empty!(
1252 DeviceDelegateRxLeaseRequest,
1253 fidl::encoding::DefaultFuchsiaResourceDialect
1254 );
1255 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceDelegateRxLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
1256 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1257 Ok(DeviceRequest::DelegateRxLease { lease: req.lease, control_handle })
1258 }
1259 _ => Err(fidl::Error::UnknownOrdinal {
1260 ordinal: header.ordinal,
1261 protocol_name:
1262 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1263 }),
1264 }))
1265 },
1266 )
1267 }
1268}
1269
1270#[derive(Debug)]
1280pub enum DeviceRequest {
1281 WriteFrame { frame: Frame, responder: DeviceWriteFrameResponder },
1299 ReadFrame { responder: DeviceReadFrameResponder },
1312 GetSignals { responder: DeviceGetSignalsResponder },
1318 AddPort {
1324 config: DevicePortConfig,
1325 port: fidl::endpoints::ServerEnd<PortMarker>,
1326 control_handle: DeviceControlHandle,
1327 },
1328 GetDevice {
1332 device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
1333 control_handle: DeviceControlHandle,
1334 },
1335 DelegateRxLease {
1340 lease: fidl_fuchsia_hardware_network::DelegatedRxLease,
1341 control_handle: DeviceControlHandle,
1342 },
1343}
1344
1345impl DeviceRequest {
1346 #[allow(irrefutable_let_patterns)]
1347 pub fn into_write_frame(self) -> Option<(Frame, DeviceWriteFrameResponder)> {
1348 if let DeviceRequest::WriteFrame { frame, responder } = self {
1349 Some((frame, responder))
1350 } else {
1351 None
1352 }
1353 }
1354
1355 #[allow(irrefutable_let_patterns)]
1356 pub fn into_read_frame(self) -> Option<(DeviceReadFrameResponder)> {
1357 if let DeviceRequest::ReadFrame { responder } = self {
1358 Some((responder))
1359 } else {
1360 None
1361 }
1362 }
1363
1364 #[allow(irrefutable_let_patterns)]
1365 pub fn into_get_signals(self) -> Option<(DeviceGetSignalsResponder)> {
1366 if let DeviceRequest::GetSignals { responder } = self {
1367 Some((responder))
1368 } else {
1369 None
1370 }
1371 }
1372
1373 #[allow(irrefutable_let_patterns)]
1374 pub fn into_add_port(
1375 self,
1376 ) -> Option<(DevicePortConfig, fidl::endpoints::ServerEnd<PortMarker>, DeviceControlHandle)>
1377 {
1378 if let DeviceRequest::AddPort { config, port, control_handle } = self {
1379 Some((config, port, control_handle))
1380 } else {
1381 None
1382 }
1383 }
1384
1385 #[allow(irrefutable_let_patterns)]
1386 pub fn into_get_device(
1387 self,
1388 ) -> Option<(
1389 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
1390 DeviceControlHandle,
1391 )> {
1392 if let DeviceRequest::GetDevice { device, control_handle } = self {
1393 Some((device, control_handle))
1394 } else {
1395 None
1396 }
1397 }
1398
1399 #[allow(irrefutable_let_patterns)]
1400 pub fn into_delegate_rx_lease(
1401 self,
1402 ) -> Option<(fidl_fuchsia_hardware_network::DelegatedRxLease, DeviceControlHandle)> {
1403 if let DeviceRequest::DelegateRxLease { lease, control_handle } = self {
1404 Some((lease, control_handle))
1405 } else {
1406 None
1407 }
1408 }
1409
1410 pub fn method_name(&self) -> &'static str {
1412 match *self {
1413 DeviceRequest::WriteFrame { .. } => "write_frame",
1414 DeviceRequest::ReadFrame { .. } => "read_frame",
1415 DeviceRequest::GetSignals { .. } => "get_signals",
1416 DeviceRequest::AddPort { .. } => "add_port",
1417 DeviceRequest::GetDevice { .. } => "get_device",
1418 DeviceRequest::DelegateRxLease { .. } => "delegate_rx_lease",
1419 }
1420 }
1421}
1422
1423#[derive(Debug, Clone)]
1424pub struct DeviceControlHandle {
1425 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1426}
1427
1428impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1429 fn shutdown(&self) {
1430 self.inner.shutdown()
1431 }
1432 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1433 self.inner.shutdown_with_epitaph(status)
1434 }
1435
1436 fn is_closed(&self) -> bool {
1437 self.inner.channel().is_closed()
1438 }
1439 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1440 self.inner.channel().on_closed()
1441 }
1442
1443 #[cfg(target_os = "fuchsia")]
1444 fn signal_peer(
1445 &self,
1446 clear_mask: zx::Signals,
1447 set_mask: zx::Signals,
1448 ) -> Result<(), zx_status::Status> {
1449 use fidl::Peered;
1450 self.inner.channel().signal_peer(clear_mask, set_mask)
1451 }
1452}
1453
1454impl DeviceControlHandle {}
1455
1456#[must_use = "FIDL methods require a response to be sent"]
1457#[derive(Debug)]
1458pub struct DeviceWriteFrameResponder {
1459 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1460 tx_id: u32,
1461}
1462
1463impl std::ops::Drop for DeviceWriteFrameResponder {
1467 fn drop(&mut self) {
1468 self.control_handle.shutdown();
1469 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1471 }
1472}
1473
1474impl fidl::endpoints::Responder for DeviceWriteFrameResponder {
1475 type ControlHandle = DeviceControlHandle;
1476
1477 fn control_handle(&self) -> &DeviceControlHandle {
1478 &self.control_handle
1479 }
1480
1481 fn drop_without_shutdown(mut self) {
1482 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1484 std::mem::forget(self);
1486 }
1487}
1488
1489impl DeviceWriteFrameResponder {
1490 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1494 let _result = self.send_raw(result);
1495 if _result.is_err() {
1496 self.control_handle.shutdown();
1497 }
1498 self.drop_without_shutdown();
1499 _result
1500 }
1501
1502 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1504 let _result = self.send_raw(result);
1505 self.drop_without_shutdown();
1506 _result
1507 }
1508
1509 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1510 self.control_handle
1511 .inner
1512 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1513 result,
1514 self.tx_id,
1515 0x2d19e24e149bf6db,
1516 fidl::encoding::DynamicFlags::empty(),
1517 )
1518 }
1519}
1520
1521#[must_use = "FIDL methods require a response to be sent"]
1522#[derive(Debug)]
1523pub struct DeviceReadFrameResponder {
1524 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1525 tx_id: u32,
1526}
1527
1528impl std::ops::Drop for DeviceReadFrameResponder {
1532 fn drop(&mut self) {
1533 self.control_handle.shutdown();
1534 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1536 }
1537}
1538
1539impl fidl::endpoints::Responder for DeviceReadFrameResponder {
1540 type ControlHandle = DeviceControlHandle;
1541
1542 fn control_handle(&self) -> &DeviceControlHandle {
1543 &self.control_handle
1544 }
1545
1546 fn drop_without_shutdown(mut self) {
1547 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1549 std::mem::forget(self);
1551 }
1552}
1553
1554impl DeviceReadFrameResponder {
1555 pub fn send(self, mut result: Result<&Frame, i32>) -> Result<(), fidl::Error> {
1559 let _result = self.send_raw(result);
1560 if _result.is_err() {
1561 self.control_handle.shutdown();
1562 }
1563 self.drop_without_shutdown();
1564 _result
1565 }
1566
1567 pub fn send_no_shutdown_on_err(
1569 self,
1570 mut result: Result<&Frame, i32>,
1571 ) -> Result<(), fidl::Error> {
1572 let _result = self.send_raw(result);
1573 self.drop_without_shutdown();
1574 _result
1575 }
1576
1577 fn send_raw(&self, mut result: Result<&Frame, i32>) -> Result<(), fidl::Error> {
1578 self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceReadFrameResponse, i32>>(
1579 result.map(|frame| (frame,)),
1580 self.tx_id,
1581 0x6ebc56b8427e1571,
1582 fidl::encoding::DynamicFlags::empty(),
1583 )
1584 }
1585}
1586
1587#[must_use = "FIDL methods require a response to be sent"]
1588#[derive(Debug)]
1589pub struct DeviceGetSignalsResponder {
1590 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1591 tx_id: u32,
1592}
1593
1594impl std::ops::Drop for DeviceGetSignalsResponder {
1598 fn drop(&mut self) {
1599 self.control_handle.shutdown();
1600 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1602 }
1603}
1604
1605impl fidl::endpoints::Responder for DeviceGetSignalsResponder {
1606 type ControlHandle = DeviceControlHandle;
1607
1608 fn control_handle(&self) -> &DeviceControlHandle {
1609 &self.control_handle
1610 }
1611
1612 fn drop_without_shutdown(mut self) {
1613 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1615 std::mem::forget(self);
1617 }
1618}
1619
1620impl DeviceGetSignalsResponder {
1621 pub fn send(self, mut signals: fidl::EventPair) -> Result<(), fidl::Error> {
1625 let _result = self.send_raw(signals);
1626 if _result.is_err() {
1627 self.control_handle.shutdown();
1628 }
1629 self.drop_without_shutdown();
1630 _result
1631 }
1632
1633 pub fn send_no_shutdown_on_err(self, mut signals: fidl::EventPair) -> Result<(), fidl::Error> {
1635 let _result = self.send_raw(signals);
1636 self.drop_without_shutdown();
1637 _result
1638 }
1639
1640 fn send_raw(&self, mut signals: fidl::EventPair) -> Result<(), fidl::Error> {
1641 self.control_handle.inner.send::<DeviceGetSignalsResponse>(
1642 (signals,),
1643 self.tx_id,
1644 0x4d1ca50fc53606b9,
1645 fidl::encoding::DynamicFlags::empty(),
1646 )
1647 }
1648}
1649
1650#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1651pub struct DevicePairMarker;
1652
1653impl fidl::endpoints::ProtocolMarker for DevicePairMarker {
1654 type Proxy = DevicePairProxy;
1655 type RequestStream = DevicePairRequestStream;
1656 #[cfg(target_os = "fuchsia")]
1657 type SynchronousProxy = DevicePairSynchronousProxy;
1658
1659 const DEBUG_NAME: &'static str = "(anonymous) DevicePair";
1660}
1661pub type DevicePairAddPortResult = Result<(), i32>;
1662pub type DevicePairRemovePortResult = Result<(), i32>;
1663
1664pub trait DevicePairProxyInterface: Send + Sync {
1665 type AddPortResponseFut: std::future::Future<Output = Result<DevicePairAddPortResult, fidl::Error>>
1666 + Send;
1667 fn r#add_port(&self, config: &DevicePairPortConfig) -> Self::AddPortResponseFut;
1668 type RemovePortResponseFut: std::future::Future<Output = Result<DevicePairRemovePortResult, fidl::Error>>
1669 + Send;
1670 fn r#remove_port(&self, id: u8) -> Self::RemovePortResponseFut;
1671 fn r#get_left(
1672 &self,
1673 device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
1674 ) -> Result<(), fidl::Error>;
1675 fn r#get_right(
1676 &self,
1677 device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
1678 ) -> Result<(), fidl::Error>;
1679 fn r#get_left_port(
1680 &self,
1681 id: u8,
1682 port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1683 ) -> Result<(), fidl::Error>;
1684 fn r#get_right_port(
1685 &self,
1686 id: u8,
1687 port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1688 ) -> Result<(), fidl::Error>;
1689}
1690#[derive(Debug)]
1691#[cfg(target_os = "fuchsia")]
1692pub struct DevicePairSynchronousProxy {
1693 client: fidl::client::sync::Client,
1694}
1695
1696#[cfg(target_os = "fuchsia")]
1697impl fidl::endpoints::SynchronousProxy for DevicePairSynchronousProxy {
1698 type Proxy = DevicePairProxy;
1699 type Protocol = DevicePairMarker;
1700
1701 fn from_channel(inner: fidl::Channel) -> Self {
1702 Self::new(inner)
1703 }
1704
1705 fn into_channel(self) -> fidl::Channel {
1706 self.client.into_channel()
1707 }
1708
1709 fn as_channel(&self) -> &fidl::Channel {
1710 self.client.as_channel()
1711 }
1712}
1713
1714#[cfg(target_os = "fuchsia")]
1715impl DevicePairSynchronousProxy {
1716 pub fn new(channel: fidl::Channel) -> Self {
1717 let protocol_name = <DevicePairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1718 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1719 }
1720
1721 pub fn into_channel(self) -> fidl::Channel {
1722 self.client.into_channel()
1723 }
1724
1725 pub fn wait_for_event(
1728 &self,
1729 deadline: zx::MonotonicInstant,
1730 ) -> Result<DevicePairEvent, fidl::Error> {
1731 DevicePairEvent::decode(self.client.wait_for_event(deadline)?)
1732 }
1733
1734 pub fn r#add_port(
1741 &self,
1742 mut config: &DevicePairPortConfig,
1743 ___deadline: zx::MonotonicInstant,
1744 ) -> Result<DevicePairAddPortResult, fidl::Error> {
1745 let _response = self.client.send_query::<
1746 DevicePairAddPortRequest,
1747 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1748 >(
1749 (config,),
1750 0x362f4856a075e1f8,
1751 fidl::encoding::DynamicFlags::empty(),
1752 ___deadline,
1753 )?;
1754 Ok(_response.map(|x| x))
1755 }
1756
1757 pub fn r#remove_port(
1763 &self,
1764 mut id: u8,
1765 ___deadline: zx::MonotonicInstant,
1766 ) -> Result<DevicePairRemovePortResult, fidl::Error> {
1767 let _response = self.client.send_query::<
1768 DevicePairRemovePortRequest,
1769 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1770 >(
1771 (id,),
1772 0x33bb45cc1d3fbe1e,
1773 fidl::encoding::DynamicFlags::empty(),
1774 ___deadline,
1775 )?;
1776 Ok(_response.map(|x| x))
1777 }
1778
1779 pub fn r#get_left(
1783 &self,
1784 mut device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
1785 ) -> Result<(), fidl::Error> {
1786 self.client.send::<DevicePairGetLeftRequest>(
1787 (device,),
1788 0x1357a771a6ccb303,
1789 fidl::encoding::DynamicFlags::empty(),
1790 )
1791 }
1792
1793 pub fn r#get_right(
1797 &self,
1798 mut device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
1799 ) -> Result<(), fidl::Error> {
1800 self.client.send::<DevicePairGetRightRequest>(
1801 (device,),
1802 0x45ebce063223b60f,
1803 fidl::encoding::DynamicFlags::empty(),
1804 )
1805 }
1806
1807 pub fn r#get_left_port(
1812 &self,
1813 mut id: u8,
1814 mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1815 ) -> Result<(), fidl::Error> {
1816 self.client.send::<DevicePairGetLeftPortRequest>(
1817 (id, port),
1818 0x6e3038d75096ab77,
1819 fidl::encoding::DynamicFlags::empty(),
1820 )
1821 }
1822
1823 pub fn r#get_right_port(
1828 &self,
1829 mut id: u8,
1830 mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1831 ) -> Result<(), fidl::Error> {
1832 self.client.send::<DevicePairGetRightPortRequest>(
1833 (id, port),
1834 0x7fc4716601eb987c,
1835 fidl::encoding::DynamicFlags::empty(),
1836 )
1837 }
1838}
1839
1840#[cfg(target_os = "fuchsia")]
1841impl From<DevicePairSynchronousProxy> for zx::Handle {
1842 fn from(value: DevicePairSynchronousProxy) -> Self {
1843 value.into_channel().into()
1844 }
1845}
1846
1847#[cfg(target_os = "fuchsia")]
1848impl From<fidl::Channel> for DevicePairSynchronousProxy {
1849 fn from(value: fidl::Channel) -> Self {
1850 Self::new(value)
1851 }
1852}
1853
1854#[derive(Debug, Clone)]
1855pub struct DevicePairProxy {
1856 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1857}
1858
1859impl fidl::endpoints::Proxy for DevicePairProxy {
1860 type Protocol = DevicePairMarker;
1861
1862 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1863 Self::new(inner)
1864 }
1865
1866 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1867 self.client.into_channel().map_err(|client| Self { client })
1868 }
1869
1870 fn as_channel(&self) -> &::fidl::AsyncChannel {
1871 self.client.as_channel()
1872 }
1873}
1874
1875impl DevicePairProxy {
1876 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1878 let protocol_name = <DevicePairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1879 Self { client: fidl::client::Client::new(channel, protocol_name) }
1880 }
1881
1882 pub fn take_event_stream(&self) -> DevicePairEventStream {
1888 DevicePairEventStream { event_receiver: self.client.take_event_receiver() }
1889 }
1890
1891 pub fn r#add_port(
1898 &self,
1899 mut config: &DevicePairPortConfig,
1900 ) -> fidl::client::QueryResponseFut<
1901 DevicePairAddPortResult,
1902 fidl::encoding::DefaultFuchsiaResourceDialect,
1903 > {
1904 DevicePairProxyInterface::r#add_port(self, config)
1905 }
1906
1907 pub fn r#remove_port(
1913 &self,
1914 mut id: u8,
1915 ) -> fidl::client::QueryResponseFut<
1916 DevicePairRemovePortResult,
1917 fidl::encoding::DefaultFuchsiaResourceDialect,
1918 > {
1919 DevicePairProxyInterface::r#remove_port(self, id)
1920 }
1921
1922 pub fn r#get_left(
1926 &self,
1927 mut device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
1928 ) -> Result<(), fidl::Error> {
1929 DevicePairProxyInterface::r#get_left(self, device)
1930 }
1931
1932 pub fn r#get_right(
1936 &self,
1937 mut device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
1938 ) -> Result<(), fidl::Error> {
1939 DevicePairProxyInterface::r#get_right(self, device)
1940 }
1941
1942 pub fn r#get_left_port(
1947 &self,
1948 mut id: u8,
1949 mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1950 ) -> Result<(), fidl::Error> {
1951 DevicePairProxyInterface::r#get_left_port(self, id, port)
1952 }
1953
1954 pub fn r#get_right_port(
1959 &self,
1960 mut id: u8,
1961 mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1962 ) -> Result<(), fidl::Error> {
1963 DevicePairProxyInterface::r#get_right_port(self, id, port)
1964 }
1965}
1966
1967impl DevicePairProxyInterface for DevicePairProxy {
1968 type AddPortResponseFut = fidl::client::QueryResponseFut<
1969 DevicePairAddPortResult,
1970 fidl::encoding::DefaultFuchsiaResourceDialect,
1971 >;
1972 fn r#add_port(&self, mut config: &DevicePairPortConfig) -> Self::AddPortResponseFut {
1973 fn _decode(
1974 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1975 ) -> Result<DevicePairAddPortResult, fidl::Error> {
1976 let _response = fidl::client::decode_transaction_body::<
1977 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1978 fidl::encoding::DefaultFuchsiaResourceDialect,
1979 0x362f4856a075e1f8,
1980 >(_buf?)?;
1981 Ok(_response.map(|x| x))
1982 }
1983 self.client.send_query_and_decode::<DevicePairAddPortRequest, DevicePairAddPortResult>(
1984 (config,),
1985 0x362f4856a075e1f8,
1986 fidl::encoding::DynamicFlags::empty(),
1987 _decode,
1988 )
1989 }
1990
1991 type RemovePortResponseFut = fidl::client::QueryResponseFut<
1992 DevicePairRemovePortResult,
1993 fidl::encoding::DefaultFuchsiaResourceDialect,
1994 >;
1995 fn r#remove_port(&self, mut id: u8) -> Self::RemovePortResponseFut {
1996 fn _decode(
1997 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1998 ) -> Result<DevicePairRemovePortResult, fidl::Error> {
1999 let _response = fidl::client::decode_transaction_body::<
2000 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2001 fidl::encoding::DefaultFuchsiaResourceDialect,
2002 0x33bb45cc1d3fbe1e,
2003 >(_buf?)?;
2004 Ok(_response.map(|x| x))
2005 }
2006 self.client
2007 .send_query_and_decode::<DevicePairRemovePortRequest, DevicePairRemovePortResult>(
2008 (id,),
2009 0x33bb45cc1d3fbe1e,
2010 fidl::encoding::DynamicFlags::empty(),
2011 _decode,
2012 )
2013 }
2014
2015 fn r#get_left(
2016 &self,
2017 mut device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
2018 ) -> Result<(), fidl::Error> {
2019 self.client.send::<DevicePairGetLeftRequest>(
2020 (device,),
2021 0x1357a771a6ccb303,
2022 fidl::encoding::DynamicFlags::empty(),
2023 )
2024 }
2025
2026 fn r#get_right(
2027 &self,
2028 mut device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
2029 ) -> Result<(), fidl::Error> {
2030 self.client.send::<DevicePairGetRightRequest>(
2031 (device,),
2032 0x45ebce063223b60f,
2033 fidl::encoding::DynamicFlags::empty(),
2034 )
2035 }
2036
2037 fn r#get_left_port(
2038 &self,
2039 mut id: u8,
2040 mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
2041 ) -> Result<(), fidl::Error> {
2042 self.client.send::<DevicePairGetLeftPortRequest>(
2043 (id, port),
2044 0x6e3038d75096ab77,
2045 fidl::encoding::DynamicFlags::empty(),
2046 )
2047 }
2048
2049 fn r#get_right_port(
2050 &self,
2051 mut id: u8,
2052 mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
2053 ) -> Result<(), fidl::Error> {
2054 self.client.send::<DevicePairGetRightPortRequest>(
2055 (id, port),
2056 0x7fc4716601eb987c,
2057 fidl::encoding::DynamicFlags::empty(),
2058 )
2059 }
2060}
2061
2062pub struct DevicePairEventStream {
2063 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2064}
2065
2066impl std::marker::Unpin for DevicePairEventStream {}
2067
2068impl futures::stream::FusedStream for DevicePairEventStream {
2069 fn is_terminated(&self) -> bool {
2070 self.event_receiver.is_terminated()
2071 }
2072}
2073
2074impl futures::Stream for DevicePairEventStream {
2075 type Item = Result<DevicePairEvent, fidl::Error>;
2076
2077 fn poll_next(
2078 mut self: std::pin::Pin<&mut Self>,
2079 cx: &mut std::task::Context<'_>,
2080 ) -> std::task::Poll<Option<Self::Item>> {
2081 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2082 &mut self.event_receiver,
2083 cx
2084 )?) {
2085 Some(buf) => std::task::Poll::Ready(Some(DevicePairEvent::decode(buf))),
2086 None => std::task::Poll::Ready(None),
2087 }
2088 }
2089}
2090
2091#[derive(Debug)]
2092pub enum DevicePairEvent {}
2093
2094impl DevicePairEvent {
2095 fn decode(
2097 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2098 ) -> Result<DevicePairEvent, fidl::Error> {
2099 let (bytes, _handles) = buf.split_mut();
2100 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2101 debug_assert_eq!(tx_header.tx_id, 0);
2102 match tx_header.ordinal {
2103 _ => Err(fidl::Error::UnknownOrdinal {
2104 ordinal: tx_header.ordinal,
2105 protocol_name: <DevicePairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2106 }),
2107 }
2108 }
2109}
2110
2111pub struct DevicePairRequestStream {
2113 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2114 is_terminated: bool,
2115}
2116
2117impl std::marker::Unpin for DevicePairRequestStream {}
2118
2119impl futures::stream::FusedStream for DevicePairRequestStream {
2120 fn is_terminated(&self) -> bool {
2121 self.is_terminated
2122 }
2123}
2124
2125impl fidl::endpoints::RequestStream for DevicePairRequestStream {
2126 type Protocol = DevicePairMarker;
2127 type ControlHandle = DevicePairControlHandle;
2128
2129 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2130 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2131 }
2132
2133 fn control_handle(&self) -> Self::ControlHandle {
2134 DevicePairControlHandle { inner: self.inner.clone() }
2135 }
2136
2137 fn into_inner(
2138 self,
2139 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2140 {
2141 (self.inner, self.is_terminated)
2142 }
2143
2144 fn from_inner(
2145 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2146 is_terminated: bool,
2147 ) -> Self {
2148 Self { inner, is_terminated }
2149 }
2150}
2151
2152impl futures::Stream for DevicePairRequestStream {
2153 type Item = Result<DevicePairRequest, fidl::Error>;
2154
2155 fn poll_next(
2156 mut self: std::pin::Pin<&mut Self>,
2157 cx: &mut std::task::Context<'_>,
2158 ) -> std::task::Poll<Option<Self::Item>> {
2159 let this = &mut *self;
2160 if this.inner.check_shutdown(cx) {
2161 this.is_terminated = true;
2162 return std::task::Poll::Ready(None);
2163 }
2164 if this.is_terminated {
2165 panic!("polled DevicePairRequestStream after completion");
2166 }
2167 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2168 |bytes, handles| {
2169 match this.inner.channel().read_etc(cx, bytes, handles) {
2170 std::task::Poll::Ready(Ok(())) => {}
2171 std::task::Poll::Pending => return std::task::Poll::Pending,
2172 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2173 this.is_terminated = true;
2174 return std::task::Poll::Ready(None);
2175 }
2176 std::task::Poll::Ready(Err(e)) => {
2177 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2178 e.into(),
2179 ))))
2180 }
2181 }
2182
2183 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2185
2186 std::task::Poll::Ready(Some(match header.ordinal {
2187 0x362f4856a075e1f8 => {
2188 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2189 let mut req = fidl::new_empty!(
2190 DevicePairAddPortRequest,
2191 fidl::encoding::DefaultFuchsiaResourceDialect
2192 );
2193 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevicePairAddPortRequest>(&header, _body_bytes, handles, &mut req)?;
2194 let control_handle = DevicePairControlHandle { inner: this.inner.clone() };
2195 Ok(DevicePairRequest::AddPort {
2196 config: req.config,
2197
2198 responder: DevicePairAddPortResponder {
2199 control_handle: std::mem::ManuallyDrop::new(control_handle),
2200 tx_id: header.tx_id,
2201 },
2202 })
2203 }
2204 0x33bb45cc1d3fbe1e => {
2205 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2206 let mut req = fidl::new_empty!(
2207 DevicePairRemovePortRequest,
2208 fidl::encoding::DefaultFuchsiaResourceDialect
2209 );
2210 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevicePairRemovePortRequest>(&header, _body_bytes, handles, &mut req)?;
2211 let control_handle = DevicePairControlHandle { inner: this.inner.clone() };
2212 Ok(DevicePairRequest::RemovePort {
2213 id: req.id,
2214
2215 responder: DevicePairRemovePortResponder {
2216 control_handle: std::mem::ManuallyDrop::new(control_handle),
2217 tx_id: header.tx_id,
2218 },
2219 })
2220 }
2221 0x1357a771a6ccb303 => {
2222 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2223 let mut req = fidl::new_empty!(
2224 DevicePairGetLeftRequest,
2225 fidl::encoding::DefaultFuchsiaResourceDialect
2226 );
2227 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevicePairGetLeftRequest>(&header, _body_bytes, handles, &mut req)?;
2228 let control_handle = DevicePairControlHandle { inner: this.inner.clone() };
2229 Ok(DevicePairRequest::GetLeft { device: req.device, control_handle })
2230 }
2231 0x45ebce063223b60f => {
2232 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2233 let mut req = fidl::new_empty!(
2234 DevicePairGetRightRequest,
2235 fidl::encoding::DefaultFuchsiaResourceDialect
2236 );
2237 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevicePairGetRightRequest>(&header, _body_bytes, handles, &mut req)?;
2238 let control_handle = DevicePairControlHandle { inner: this.inner.clone() };
2239 Ok(DevicePairRequest::GetRight { device: req.device, control_handle })
2240 }
2241 0x6e3038d75096ab77 => {
2242 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2243 let mut req = fidl::new_empty!(
2244 DevicePairGetLeftPortRequest,
2245 fidl::encoding::DefaultFuchsiaResourceDialect
2246 );
2247 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevicePairGetLeftPortRequest>(&header, _body_bytes, handles, &mut req)?;
2248 let control_handle = DevicePairControlHandle { inner: this.inner.clone() };
2249 Ok(DevicePairRequest::GetLeftPort {
2250 id: req.id,
2251 port: req.port,
2252
2253 control_handle,
2254 })
2255 }
2256 0x7fc4716601eb987c => {
2257 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2258 let mut req = fidl::new_empty!(
2259 DevicePairGetRightPortRequest,
2260 fidl::encoding::DefaultFuchsiaResourceDialect
2261 );
2262 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevicePairGetRightPortRequest>(&header, _body_bytes, handles, &mut req)?;
2263 let control_handle = DevicePairControlHandle { inner: this.inner.clone() };
2264 Ok(DevicePairRequest::GetRightPort {
2265 id: req.id,
2266 port: req.port,
2267
2268 control_handle,
2269 })
2270 }
2271 _ => Err(fidl::Error::UnknownOrdinal {
2272 ordinal: header.ordinal,
2273 protocol_name:
2274 <DevicePairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2275 }),
2276 }))
2277 },
2278 )
2279 }
2280}
2281
2282#[derive(Debug)]
2303pub enum DevicePairRequest {
2304 AddPort { config: DevicePairPortConfig, responder: DevicePairAddPortResponder },
2311 RemovePort { id: u8, responder: DevicePairRemovePortResponder },
2317 GetLeft {
2321 device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
2322 control_handle: DevicePairControlHandle,
2323 },
2324 GetRight {
2328 device: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
2329 control_handle: DevicePairControlHandle,
2330 },
2331 GetLeftPort {
2336 id: u8,
2337 port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
2338 control_handle: DevicePairControlHandle,
2339 },
2340 GetRightPort {
2345 id: u8,
2346 port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
2347 control_handle: DevicePairControlHandle,
2348 },
2349}
2350
2351impl DevicePairRequest {
2352 #[allow(irrefutable_let_patterns)]
2353 pub fn into_add_port(self) -> Option<(DevicePairPortConfig, DevicePairAddPortResponder)> {
2354 if let DevicePairRequest::AddPort { config, responder } = self {
2355 Some((config, responder))
2356 } else {
2357 None
2358 }
2359 }
2360
2361 #[allow(irrefutable_let_patterns)]
2362 pub fn into_remove_port(self) -> Option<(u8, DevicePairRemovePortResponder)> {
2363 if let DevicePairRequest::RemovePort { id, responder } = self {
2364 Some((id, responder))
2365 } else {
2366 None
2367 }
2368 }
2369
2370 #[allow(irrefutable_let_patterns)]
2371 pub fn into_get_left(
2372 self,
2373 ) -> Option<(
2374 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
2375 DevicePairControlHandle,
2376 )> {
2377 if let DevicePairRequest::GetLeft { device, control_handle } = self {
2378 Some((device, control_handle))
2379 } else {
2380 None
2381 }
2382 }
2383
2384 #[allow(irrefutable_let_patterns)]
2385 pub fn into_get_right(
2386 self,
2387 ) -> Option<(
2388 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
2389 DevicePairControlHandle,
2390 )> {
2391 if let DevicePairRequest::GetRight { device, control_handle } = self {
2392 Some((device, control_handle))
2393 } else {
2394 None
2395 }
2396 }
2397
2398 #[allow(irrefutable_let_patterns)]
2399 pub fn into_get_left_port(
2400 self,
2401 ) -> Option<(
2402 u8,
2403 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
2404 DevicePairControlHandle,
2405 )> {
2406 if let DevicePairRequest::GetLeftPort { id, port, control_handle } = self {
2407 Some((id, port, control_handle))
2408 } else {
2409 None
2410 }
2411 }
2412
2413 #[allow(irrefutable_let_patterns)]
2414 pub fn into_get_right_port(
2415 self,
2416 ) -> Option<(
2417 u8,
2418 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
2419 DevicePairControlHandle,
2420 )> {
2421 if let DevicePairRequest::GetRightPort { id, port, control_handle } = self {
2422 Some((id, port, control_handle))
2423 } else {
2424 None
2425 }
2426 }
2427
2428 pub fn method_name(&self) -> &'static str {
2430 match *self {
2431 DevicePairRequest::AddPort { .. } => "add_port",
2432 DevicePairRequest::RemovePort { .. } => "remove_port",
2433 DevicePairRequest::GetLeft { .. } => "get_left",
2434 DevicePairRequest::GetRight { .. } => "get_right",
2435 DevicePairRequest::GetLeftPort { .. } => "get_left_port",
2436 DevicePairRequest::GetRightPort { .. } => "get_right_port",
2437 }
2438 }
2439}
2440
2441#[derive(Debug, Clone)]
2442pub struct DevicePairControlHandle {
2443 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2444}
2445
2446impl fidl::endpoints::ControlHandle for DevicePairControlHandle {
2447 fn shutdown(&self) {
2448 self.inner.shutdown()
2449 }
2450 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2451 self.inner.shutdown_with_epitaph(status)
2452 }
2453
2454 fn is_closed(&self) -> bool {
2455 self.inner.channel().is_closed()
2456 }
2457 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2458 self.inner.channel().on_closed()
2459 }
2460
2461 #[cfg(target_os = "fuchsia")]
2462 fn signal_peer(
2463 &self,
2464 clear_mask: zx::Signals,
2465 set_mask: zx::Signals,
2466 ) -> Result<(), zx_status::Status> {
2467 use fidl::Peered;
2468 self.inner.channel().signal_peer(clear_mask, set_mask)
2469 }
2470}
2471
2472impl DevicePairControlHandle {}
2473
2474#[must_use = "FIDL methods require a response to be sent"]
2475#[derive(Debug)]
2476pub struct DevicePairAddPortResponder {
2477 control_handle: std::mem::ManuallyDrop<DevicePairControlHandle>,
2478 tx_id: u32,
2479}
2480
2481impl std::ops::Drop for DevicePairAddPortResponder {
2485 fn drop(&mut self) {
2486 self.control_handle.shutdown();
2487 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2489 }
2490}
2491
2492impl fidl::endpoints::Responder for DevicePairAddPortResponder {
2493 type ControlHandle = DevicePairControlHandle;
2494
2495 fn control_handle(&self) -> &DevicePairControlHandle {
2496 &self.control_handle
2497 }
2498
2499 fn drop_without_shutdown(mut self) {
2500 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2502 std::mem::forget(self);
2504 }
2505}
2506
2507impl DevicePairAddPortResponder {
2508 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2512 let _result = self.send_raw(result);
2513 if _result.is_err() {
2514 self.control_handle.shutdown();
2515 }
2516 self.drop_without_shutdown();
2517 _result
2518 }
2519
2520 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2522 let _result = self.send_raw(result);
2523 self.drop_without_shutdown();
2524 _result
2525 }
2526
2527 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2528 self.control_handle
2529 .inner
2530 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2531 result,
2532 self.tx_id,
2533 0x362f4856a075e1f8,
2534 fidl::encoding::DynamicFlags::empty(),
2535 )
2536 }
2537}
2538
2539#[must_use = "FIDL methods require a response to be sent"]
2540#[derive(Debug)]
2541pub struct DevicePairRemovePortResponder {
2542 control_handle: std::mem::ManuallyDrop<DevicePairControlHandle>,
2543 tx_id: u32,
2544}
2545
2546impl std::ops::Drop for DevicePairRemovePortResponder {
2550 fn drop(&mut self) {
2551 self.control_handle.shutdown();
2552 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2554 }
2555}
2556
2557impl fidl::endpoints::Responder for DevicePairRemovePortResponder {
2558 type ControlHandle = DevicePairControlHandle;
2559
2560 fn control_handle(&self) -> &DevicePairControlHandle {
2561 &self.control_handle
2562 }
2563
2564 fn drop_without_shutdown(mut self) {
2565 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2567 std::mem::forget(self);
2569 }
2570}
2571
2572impl DevicePairRemovePortResponder {
2573 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2577 let _result = self.send_raw(result);
2578 if _result.is_err() {
2579 self.control_handle.shutdown();
2580 }
2581 self.drop_without_shutdown();
2582 _result
2583 }
2584
2585 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2587 let _result = self.send_raw(result);
2588 self.drop_without_shutdown();
2589 _result
2590 }
2591
2592 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2593 self.control_handle
2594 .inner
2595 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2596 result,
2597 self.tx_id,
2598 0x33bb45cc1d3fbe1e,
2599 fidl::encoding::DynamicFlags::empty(),
2600 )
2601 }
2602}
2603
2604#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2605pub struct PortMarker;
2606
2607impl fidl::endpoints::ProtocolMarker for PortMarker {
2608 type Proxy = PortProxy;
2609 type RequestStream = PortRequestStream;
2610 #[cfg(target_os = "fuchsia")]
2611 type SynchronousProxy = PortSynchronousProxy;
2612
2613 const DEBUG_NAME: &'static str = "(anonymous) Port";
2614}
2615
2616pub trait PortProxyInterface: Send + Sync {
2617 type GetStateResponseFut: std::future::Future<Output = Result<InternalState, fidl::Error>>
2618 + Send;
2619 fn r#get_state(&self) -> Self::GetStateResponseFut;
2620 type WatchStateResponseFut: std::future::Future<Output = Result<InternalState, fidl::Error>>
2621 + Send;
2622 fn r#watch_state(&self) -> Self::WatchStateResponseFut;
2623 type SetOnlineResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2624 fn r#set_online(&self, online: bool) -> Self::SetOnlineResponseFut;
2625 fn r#get_port(
2626 &self,
2627 port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
2628 ) -> Result<(), fidl::Error>;
2629 fn r#remove(&self) -> Result<(), fidl::Error>;
2630}
2631#[derive(Debug)]
2632#[cfg(target_os = "fuchsia")]
2633pub struct PortSynchronousProxy {
2634 client: fidl::client::sync::Client,
2635}
2636
2637#[cfg(target_os = "fuchsia")]
2638impl fidl::endpoints::SynchronousProxy for PortSynchronousProxy {
2639 type Proxy = PortProxy;
2640 type Protocol = PortMarker;
2641
2642 fn from_channel(inner: fidl::Channel) -> Self {
2643 Self::new(inner)
2644 }
2645
2646 fn into_channel(self) -> fidl::Channel {
2647 self.client.into_channel()
2648 }
2649
2650 fn as_channel(&self) -> &fidl::Channel {
2651 self.client.as_channel()
2652 }
2653}
2654
2655#[cfg(target_os = "fuchsia")]
2656impl PortSynchronousProxy {
2657 pub fn new(channel: fidl::Channel) -> Self {
2658 let protocol_name = <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2659 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2660 }
2661
2662 pub fn into_channel(self) -> fidl::Channel {
2663 self.client.into_channel()
2664 }
2665
2666 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<PortEvent, fidl::Error> {
2669 PortEvent::decode(self.client.wait_for_event(deadline)?)
2670 }
2671
2672 pub fn r#get_state(
2676 &self,
2677 ___deadline: zx::MonotonicInstant,
2678 ) -> Result<InternalState, fidl::Error> {
2679 let _response =
2680 self.client.send_query::<fidl::encoding::EmptyPayload, PortGetStateResponse>(
2681 (),
2682 0x5022630816212ed,
2683 fidl::encoding::DynamicFlags::empty(),
2684 ___deadline,
2685 )?;
2686 Ok(_response.state)
2687 }
2688
2689 pub fn r#watch_state(
2701 &self,
2702 ___deadline: zx::MonotonicInstant,
2703 ) -> Result<InternalState, fidl::Error> {
2704 let _response =
2705 self.client.send_query::<fidl::encoding::EmptyPayload, PortWatchStateResponse>(
2706 (),
2707 0x74d3c94c96e2b605,
2708 fidl::encoding::DynamicFlags::empty(),
2709 ___deadline,
2710 )?;
2711 Ok(_response.state)
2712 }
2713
2714 pub fn r#set_online(
2723 &self,
2724 mut online: bool,
2725 ___deadline: zx::MonotonicInstant,
2726 ) -> Result<(), fidl::Error> {
2727 let _response =
2728 self.client.send_query::<PortSetOnlineRequest, fidl::encoding::EmptyPayload>(
2729 (online,),
2730 0x734f83793ce86e6c,
2731 fidl::encoding::DynamicFlags::empty(),
2732 ___deadline,
2733 )?;
2734 Ok(_response)
2735 }
2736
2737 pub fn r#get_port(
2741 &self,
2742 mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
2743 ) -> Result<(), fidl::Error> {
2744 self.client.send::<PortGetPortRequest>(
2745 (port,),
2746 0x1998638c1d97eed2,
2747 fidl::encoding::DynamicFlags::empty(),
2748 )
2749 }
2750
2751 pub fn r#remove(&self) -> Result<(), fidl::Error> {
2758 self.client.send::<fidl::encoding::EmptyPayload>(
2759 (),
2760 0x4f45201ed5719261,
2761 fidl::encoding::DynamicFlags::empty(),
2762 )
2763 }
2764}
2765
2766#[cfg(target_os = "fuchsia")]
2767impl From<PortSynchronousProxy> for zx::Handle {
2768 fn from(value: PortSynchronousProxy) -> Self {
2769 value.into_channel().into()
2770 }
2771}
2772
2773#[cfg(target_os = "fuchsia")]
2774impl From<fidl::Channel> for PortSynchronousProxy {
2775 fn from(value: fidl::Channel) -> Self {
2776 Self::new(value)
2777 }
2778}
2779
2780#[derive(Debug, Clone)]
2781pub struct PortProxy {
2782 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2783}
2784
2785impl fidl::endpoints::Proxy for PortProxy {
2786 type Protocol = PortMarker;
2787
2788 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2789 Self::new(inner)
2790 }
2791
2792 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2793 self.client.into_channel().map_err(|client| Self { client })
2794 }
2795
2796 fn as_channel(&self) -> &::fidl::AsyncChannel {
2797 self.client.as_channel()
2798 }
2799}
2800
2801impl PortProxy {
2802 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2804 let protocol_name = <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2805 Self { client: fidl::client::Client::new(channel, protocol_name) }
2806 }
2807
2808 pub fn take_event_stream(&self) -> PortEventStream {
2814 PortEventStream { event_receiver: self.client.take_event_receiver() }
2815 }
2816
2817 pub fn r#get_state(
2821 &self,
2822 ) -> fidl::client::QueryResponseFut<InternalState, fidl::encoding::DefaultFuchsiaResourceDialect>
2823 {
2824 PortProxyInterface::r#get_state(self)
2825 }
2826
2827 pub fn r#watch_state(
2839 &self,
2840 ) -> fidl::client::QueryResponseFut<InternalState, fidl::encoding::DefaultFuchsiaResourceDialect>
2841 {
2842 PortProxyInterface::r#watch_state(self)
2843 }
2844
2845 pub fn r#set_online(
2854 &self,
2855 mut online: bool,
2856 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2857 PortProxyInterface::r#set_online(self, online)
2858 }
2859
2860 pub fn r#get_port(
2864 &self,
2865 mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
2866 ) -> Result<(), fidl::Error> {
2867 PortProxyInterface::r#get_port(self, port)
2868 }
2869
2870 pub fn r#remove(&self) -> Result<(), fidl::Error> {
2877 PortProxyInterface::r#remove(self)
2878 }
2879}
2880
2881impl PortProxyInterface for PortProxy {
2882 type GetStateResponseFut = fidl::client::QueryResponseFut<
2883 InternalState,
2884 fidl::encoding::DefaultFuchsiaResourceDialect,
2885 >;
2886 fn r#get_state(&self) -> Self::GetStateResponseFut {
2887 fn _decode(
2888 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2889 ) -> Result<InternalState, fidl::Error> {
2890 let _response = fidl::client::decode_transaction_body::<
2891 PortGetStateResponse,
2892 fidl::encoding::DefaultFuchsiaResourceDialect,
2893 0x5022630816212ed,
2894 >(_buf?)?;
2895 Ok(_response.state)
2896 }
2897 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, InternalState>(
2898 (),
2899 0x5022630816212ed,
2900 fidl::encoding::DynamicFlags::empty(),
2901 _decode,
2902 )
2903 }
2904
2905 type WatchStateResponseFut = fidl::client::QueryResponseFut<
2906 InternalState,
2907 fidl::encoding::DefaultFuchsiaResourceDialect,
2908 >;
2909 fn r#watch_state(&self) -> Self::WatchStateResponseFut {
2910 fn _decode(
2911 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2912 ) -> Result<InternalState, fidl::Error> {
2913 let _response = fidl::client::decode_transaction_body::<
2914 PortWatchStateResponse,
2915 fidl::encoding::DefaultFuchsiaResourceDialect,
2916 0x74d3c94c96e2b605,
2917 >(_buf?)?;
2918 Ok(_response.state)
2919 }
2920 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, InternalState>(
2921 (),
2922 0x74d3c94c96e2b605,
2923 fidl::encoding::DynamicFlags::empty(),
2924 _decode,
2925 )
2926 }
2927
2928 type SetOnlineResponseFut =
2929 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2930 fn r#set_online(&self, mut online: bool) -> Self::SetOnlineResponseFut {
2931 fn _decode(
2932 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2933 ) -> Result<(), fidl::Error> {
2934 let _response = fidl::client::decode_transaction_body::<
2935 fidl::encoding::EmptyPayload,
2936 fidl::encoding::DefaultFuchsiaResourceDialect,
2937 0x734f83793ce86e6c,
2938 >(_buf?)?;
2939 Ok(_response)
2940 }
2941 self.client.send_query_and_decode::<PortSetOnlineRequest, ()>(
2942 (online,),
2943 0x734f83793ce86e6c,
2944 fidl::encoding::DynamicFlags::empty(),
2945 _decode,
2946 )
2947 }
2948
2949 fn r#get_port(
2950 &self,
2951 mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
2952 ) -> Result<(), fidl::Error> {
2953 self.client.send::<PortGetPortRequest>(
2954 (port,),
2955 0x1998638c1d97eed2,
2956 fidl::encoding::DynamicFlags::empty(),
2957 )
2958 }
2959
2960 fn r#remove(&self) -> Result<(), fidl::Error> {
2961 self.client.send::<fidl::encoding::EmptyPayload>(
2962 (),
2963 0x4f45201ed5719261,
2964 fidl::encoding::DynamicFlags::empty(),
2965 )
2966 }
2967}
2968
2969pub struct PortEventStream {
2970 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2971}
2972
2973impl std::marker::Unpin for PortEventStream {}
2974
2975impl futures::stream::FusedStream for PortEventStream {
2976 fn is_terminated(&self) -> bool {
2977 self.event_receiver.is_terminated()
2978 }
2979}
2980
2981impl futures::Stream for PortEventStream {
2982 type Item = Result<PortEvent, fidl::Error>;
2983
2984 fn poll_next(
2985 mut self: std::pin::Pin<&mut Self>,
2986 cx: &mut std::task::Context<'_>,
2987 ) -> std::task::Poll<Option<Self::Item>> {
2988 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2989 &mut self.event_receiver,
2990 cx
2991 )?) {
2992 Some(buf) => std::task::Poll::Ready(Some(PortEvent::decode(buf))),
2993 None => std::task::Poll::Ready(None),
2994 }
2995 }
2996}
2997
2998#[derive(Debug)]
2999pub enum PortEvent {}
3000
3001impl PortEvent {
3002 fn decode(
3004 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3005 ) -> Result<PortEvent, fidl::Error> {
3006 let (bytes, _handles) = buf.split_mut();
3007 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3008 debug_assert_eq!(tx_header.tx_id, 0);
3009 match tx_header.ordinal {
3010 _ => Err(fidl::Error::UnknownOrdinal {
3011 ordinal: tx_header.ordinal,
3012 protocol_name: <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3013 }),
3014 }
3015 }
3016}
3017
3018pub struct PortRequestStream {
3020 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3021 is_terminated: bool,
3022}
3023
3024impl std::marker::Unpin for PortRequestStream {}
3025
3026impl futures::stream::FusedStream for PortRequestStream {
3027 fn is_terminated(&self) -> bool {
3028 self.is_terminated
3029 }
3030}
3031
3032impl fidl::endpoints::RequestStream for PortRequestStream {
3033 type Protocol = PortMarker;
3034 type ControlHandle = PortControlHandle;
3035
3036 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3037 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3038 }
3039
3040 fn control_handle(&self) -> Self::ControlHandle {
3041 PortControlHandle { inner: self.inner.clone() }
3042 }
3043
3044 fn into_inner(
3045 self,
3046 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3047 {
3048 (self.inner, self.is_terminated)
3049 }
3050
3051 fn from_inner(
3052 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3053 is_terminated: bool,
3054 ) -> Self {
3055 Self { inner, is_terminated }
3056 }
3057}
3058
3059impl futures::Stream for PortRequestStream {
3060 type Item = Result<PortRequest, fidl::Error>;
3061
3062 fn poll_next(
3063 mut self: std::pin::Pin<&mut Self>,
3064 cx: &mut std::task::Context<'_>,
3065 ) -> std::task::Poll<Option<Self::Item>> {
3066 let this = &mut *self;
3067 if this.inner.check_shutdown(cx) {
3068 this.is_terminated = true;
3069 return std::task::Poll::Ready(None);
3070 }
3071 if this.is_terminated {
3072 panic!("polled PortRequestStream after completion");
3073 }
3074 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3075 |bytes, handles| {
3076 match this.inner.channel().read_etc(cx, bytes, handles) {
3077 std::task::Poll::Ready(Ok(())) => {}
3078 std::task::Poll::Pending => return std::task::Poll::Pending,
3079 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3080 this.is_terminated = true;
3081 return std::task::Poll::Ready(None);
3082 }
3083 std::task::Poll::Ready(Err(e)) => {
3084 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3085 e.into(),
3086 ))))
3087 }
3088 }
3089
3090 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3092
3093 std::task::Poll::Ready(Some(match header.ordinal {
3094 0x5022630816212ed => {
3095 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3096 let mut req = fidl::new_empty!(
3097 fidl::encoding::EmptyPayload,
3098 fidl::encoding::DefaultFuchsiaResourceDialect
3099 );
3100 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3101 let control_handle = PortControlHandle { inner: this.inner.clone() };
3102 Ok(PortRequest::GetState {
3103 responder: PortGetStateResponder {
3104 control_handle: std::mem::ManuallyDrop::new(control_handle),
3105 tx_id: header.tx_id,
3106 },
3107 })
3108 }
3109 0x74d3c94c96e2b605 => {
3110 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3111 let mut req = fidl::new_empty!(
3112 fidl::encoding::EmptyPayload,
3113 fidl::encoding::DefaultFuchsiaResourceDialect
3114 );
3115 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3116 let control_handle = PortControlHandle { inner: this.inner.clone() };
3117 Ok(PortRequest::WatchState {
3118 responder: PortWatchStateResponder {
3119 control_handle: std::mem::ManuallyDrop::new(control_handle),
3120 tx_id: header.tx_id,
3121 },
3122 })
3123 }
3124 0x734f83793ce86e6c => {
3125 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3126 let mut req = fidl::new_empty!(
3127 PortSetOnlineRequest,
3128 fidl::encoding::DefaultFuchsiaResourceDialect
3129 );
3130 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortSetOnlineRequest>(&header, _body_bytes, handles, &mut req)?;
3131 let control_handle = PortControlHandle { inner: this.inner.clone() };
3132 Ok(PortRequest::SetOnline {
3133 online: req.online,
3134
3135 responder: PortSetOnlineResponder {
3136 control_handle: std::mem::ManuallyDrop::new(control_handle),
3137 tx_id: header.tx_id,
3138 },
3139 })
3140 }
3141 0x1998638c1d97eed2 => {
3142 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3143 let mut req = fidl::new_empty!(
3144 PortGetPortRequest,
3145 fidl::encoding::DefaultFuchsiaResourceDialect
3146 );
3147 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PortGetPortRequest>(&header, _body_bytes, handles, &mut req)?;
3148 let control_handle = PortControlHandle { inner: this.inner.clone() };
3149 Ok(PortRequest::GetPort { port: req.port, control_handle })
3150 }
3151 0x4f45201ed5719261 => {
3152 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3153 let mut req = fidl::new_empty!(
3154 fidl::encoding::EmptyPayload,
3155 fidl::encoding::DefaultFuchsiaResourceDialect
3156 );
3157 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3158 let control_handle = PortControlHandle { inner: this.inner.clone() };
3159 Ok(PortRequest::Remove { control_handle })
3160 }
3161 _ => Err(fidl::Error::UnknownOrdinal {
3162 ordinal: header.ordinal,
3163 protocol_name: <PortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3164 }),
3165 }))
3166 },
3167 )
3168 }
3169}
3170
3171#[derive(Debug)]
3181pub enum PortRequest {
3182 GetState { responder: PortGetStateResponder },
3186 WatchState { responder: PortWatchStateResponder },
3198 SetOnline { online: bool, responder: PortSetOnlineResponder },
3207 GetPort {
3211 port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
3212 control_handle: PortControlHandle,
3213 },
3214 Remove { control_handle: PortControlHandle },
3221}
3222
3223impl PortRequest {
3224 #[allow(irrefutable_let_patterns)]
3225 pub fn into_get_state(self) -> Option<(PortGetStateResponder)> {
3226 if let PortRequest::GetState { responder } = self {
3227 Some((responder))
3228 } else {
3229 None
3230 }
3231 }
3232
3233 #[allow(irrefutable_let_patterns)]
3234 pub fn into_watch_state(self) -> Option<(PortWatchStateResponder)> {
3235 if let PortRequest::WatchState { responder } = self {
3236 Some((responder))
3237 } else {
3238 None
3239 }
3240 }
3241
3242 #[allow(irrefutable_let_patterns)]
3243 pub fn into_set_online(self) -> Option<(bool, PortSetOnlineResponder)> {
3244 if let PortRequest::SetOnline { online, responder } = self {
3245 Some((online, responder))
3246 } else {
3247 None
3248 }
3249 }
3250
3251 #[allow(irrefutable_let_patterns)]
3252 pub fn into_get_port(
3253 self,
3254 ) -> Option<(
3255 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
3256 PortControlHandle,
3257 )> {
3258 if let PortRequest::GetPort { port, control_handle } = self {
3259 Some((port, control_handle))
3260 } else {
3261 None
3262 }
3263 }
3264
3265 #[allow(irrefutable_let_patterns)]
3266 pub fn into_remove(self) -> Option<(PortControlHandle)> {
3267 if let PortRequest::Remove { control_handle } = self {
3268 Some((control_handle))
3269 } else {
3270 None
3271 }
3272 }
3273
3274 pub fn method_name(&self) -> &'static str {
3276 match *self {
3277 PortRequest::GetState { .. } => "get_state",
3278 PortRequest::WatchState { .. } => "watch_state",
3279 PortRequest::SetOnline { .. } => "set_online",
3280 PortRequest::GetPort { .. } => "get_port",
3281 PortRequest::Remove { .. } => "remove",
3282 }
3283 }
3284}
3285
3286#[derive(Debug, Clone)]
3287pub struct PortControlHandle {
3288 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3289}
3290
3291impl fidl::endpoints::ControlHandle for PortControlHandle {
3292 fn shutdown(&self) {
3293 self.inner.shutdown()
3294 }
3295 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3296 self.inner.shutdown_with_epitaph(status)
3297 }
3298
3299 fn is_closed(&self) -> bool {
3300 self.inner.channel().is_closed()
3301 }
3302 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3303 self.inner.channel().on_closed()
3304 }
3305
3306 #[cfg(target_os = "fuchsia")]
3307 fn signal_peer(
3308 &self,
3309 clear_mask: zx::Signals,
3310 set_mask: zx::Signals,
3311 ) -> Result<(), zx_status::Status> {
3312 use fidl::Peered;
3313 self.inner.channel().signal_peer(clear_mask, set_mask)
3314 }
3315}
3316
3317impl PortControlHandle {}
3318
3319#[must_use = "FIDL methods require a response to be sent"]
3320#[derive(Debug)]
3321pub struct PortGetStateResponder {
3322 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
3323 tx_id: u32,
3324}
3325
3326impl std::ops::Drop for PortGetStateResponder {
3330 fn drop(&mut self) {
3331 self.control_handle.shutdown();
3332 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3334 }
3335}
3336
3337impl fidl::endpoints::Responder for PortGetStateResponder {
3338 type ControlHandle = PortControlHandle;
3339
3340 fn control_handle(&self) -> &PortControlHandle {
3341 &self.control_handle
3342 }
3343
3344 fn drop_without_shutdown(mut self) {
3345 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3347 std::mem::forget(self);
3349 }
3350}
3351
3352impl PortGetStateResponder {
3353 pub fn send(self, mut state: &InternalState) -> Result<(), fidl::Error> {
3357 let _result = self.send_raw(state);
3358 if _result.is_err() {
3359 self.control_handle.shutdown();
3360 }
3361 self.drop_without_shutdown();
3362 _result
3363 }
3364
3365 pub fn send_no_shutdown_on_err(self, mut state: &InternalState) -> Result<(), fidl::Error> {
3367 let _result = self.send_raw(state);
3368 self.drop_without_shutdown();
3369 _result
3370 }
3371
3372 fn send_raw(&self, mut state: &InternalState) -> Result<(), fidl::Error> {
3373 self.control_handle.inner.send::<PortGetStateResponse>(
3374 (state,),
3375 self.tx_id,
3376 0x5022630816212ed,
3377 fidl::encoding::DynamicFlags::empty(),
3378 )
3379 }
3380}
3381
3382#[must_use = "FIDL methods require a response to be sent"]
3383#[derive(Debug)]
3384pub struct PortWatchStateResponder {
3385 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
3386 tx_id: u32,
3387}
3388
3389impl std::ops::Drop for PortWatchStateResponder {
3393 fn drop(&mut self) {
3394 self.control_handle.shutdown();
3395 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3397 }
3398}
3399
3400impl fidl::endpoints::Responder for PortWatchStateResponder {
3401 type ControlHandle = PortControlHandle;
3402
3403 fn control_handle(&self) -> &PortControlHandle {
3404 &self.control_handle
3405 }
3406
3407 fn drop_without_shutdown(mut self) {
3408 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3410 std::mem::forget(self);
3412 }
3413}
3414
3415impl PortWatchStateResponder {
3416 pub fn send(self, mut state: &InternalState) -> Result<(), fidl::Error> {
3420 let _result = self.send_raw(state);
3421 if _result.is_err() {
3422 self.control_handle.shutdown();
3423 }
3424 self.drop_without_shutdown();
3425 _result
3426 }
3427
3428 pub fn send_no_shutdown_on_err(self, mut state: &InternalState) -> Result<(), fidl::Error> {
3430 let _result = self.send_raw(state);
3431 self.drop_without_shutdown();
3432 _result
3433 }
3434
3435 fn send_raw(&self, mut state: &InternalState) -> Result<(), fidl::Error> {
3436 self.control_handle.inner.send::<PortWatchStateResponse>(
3437 (state,),
3438 self.tx_id,
3439 0x74d3c94c96e2b605,
3440 fidl::encoding::DynamicFlags::empty(),
3441 )
3442 }
3443}
3444
3445#[must_use = "FIDL methods require a response to be sent"]
3446#[derive(Debug)]
3447pub struct PortSetOnlineResponder {
3448 control_handle: std::mem::ManuallyDrop<PortControlHandle>,
3449 tx_id: u32,
3450}
3451
3452impl std::ops::Drop for PortSetOnlineResponder {
3456 fn drop(&mut self) {
3457 self.control_handle.shutdown();
3458 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3460 }
3461}
3462
3463impl fidl::endpoints::Responder for PortSetOnlineResponder {
3464 type ControlHandle = PortControlHandle;
3465
3466 fn control_handle(&self) -> &PortControlHandle {
3467 &self.control_handle
3468 }
3469
3470 fn drop_without_shutdown(mut self) {
3471 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3473 std::mem::forget(self);
3475 }
3476}
3477
3478impl PortSetOnlineResponder {
3479 pub fn send(self) -> Result<(), fidl::Error> {
3483 let _result = self.send_raw();
3484 if _result.is_err() {
3485 self.control_handle.shutdown();
3486 }
3487 self.drop_without_shutdown();
3488 _result
3489 }
3490
3491 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3493 let _result = self.send_raw();
3494 self.drop_without_shutdown();
3495 _result
3496 }
3497
3498 fn send_raw(&self) -> Result<(), fidl::Error> {
3499 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3500 (),
3501 self.tx_id,
3502 0x734f83793ce86e6c,
3503 fidl::encoding::DynamicFlags::empty(),
3504 )
3505 }
3506}
3507
3508mod internal {
3509 use super::*;
3510
3511 impl fidl::encoding::ResourceTypeMarker for ControlCreateDeviceRequest {
3512 type Borrowed<'a> = &'a mut Self;
3513 fn take_or_borrow<'a>(
3514 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3515 ) -> Self::Borrowed<'a> {
3516 value
3517 }
3518 }
3519
3520 unsafe impl fidl::encoding::TypeMarker for ControlCreateDeviceRequest {
3521 type Owned = Self;
3522
3523 #[inline(always)]
3524 fn inline_align(_context: fidl::encoding::Context) -> usize {
3525 8
3526 }
3527
3528 #[inline(always)]
3529 fn inline_size(_context: fidl::encoding::Context) -> usize {
3530 24
3531 }
3532 }
3533
3534 unsafe impl
3535 fidl::encoding::Encode<
3536 ControlCreateDeviceRequest,
3537 fidl::encoding::DefaultFuchsiaResourceDialect,
3538 > for &mut ControlCreateDeviceRequest
3539 {
3540 #[inline]
3541 unsafe fn encode(
3542 self,
3543 encoder: &mut fidl::encoding::Encoder<
3544 '_,
3545 fidl::encoding::DefaultFuchsiaResourceDialect,
3546 >,
3547 offset: usize,
3548 _depth: fidl::encoding::Depth,
3549 ) -> fidl::Result<()> {
3550 encoder.debug_check_bounds::<ControlCreateDeviceRequest>(offset);
3551 fidl::encoding::Encode::<ControlCreateDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3553 (
3554 <DeviceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
3555 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
3556 ),
3557 encoder, offset, _depth
3558 )
3559 }
3560 }
3561 unsafe impl<
3562 T0: fidl::encoding::Encode<DeviceConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
3563 T1: fidl::encoding::Encode<
3564 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
3565 fidl::encoding::DefaultFuchsiaResourceDialect,
3566 >,
3567 >
3568 fidl::encoding::Encode<
3569 ControlCreateDeviceRequest,
3570 fidl::encoding::DefaultFuchsiaResourceDialect,
3571 > for (T0, T1)
3572 {
3573 #[inline]
3574 unsafe fn encode(
3575 self,
3576 encoder: &mut fidl::encoding::Encoder<
3577 '_,
3578 fidl::encoding::DefaultFuchsiaResourceDialect,
3579 >,
3580 offset: usize,
3581 depth: fidl::encoding::Depth,
3582 ) -> fidl::Result<()> {
3583 encoder.debug_check_bounds::<ControlCreateDeviceRequest>(offset);
3584 unsafe {
3587 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3588 (ptr as *mut u64).write_unaligned(0);
3589 }
3590 self.0.encode(encoder, offset + 0, depth)?;
3592 self.1.encode(encoder, offset + 16, depth)?;
3593 Ok(())
3594 }
3595 }
3596
3597 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3598 for ControlCreateDeviceRequest
3599 {
3600 #[inline(always)]
3601 fn new_empty() -> Self {
3602 Self {
3603 config: fidl::new_empty!(
3604 DeviceConfig,
3605 fidl::encoding::DefaultFuchsiaResourceDialect
3606 ),
3607 device: fidl::new_empty!(
3608 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
3609 fidl::encoding::DefaultFuchsiaResourceDialect
3610 ),
3611 }
3612 }
3613
3614 #[inline]
3615 unsafe fn decode(
3616 &mut self,
3617 decoder: &mut fidl::encoding::Decoder<
3618 '_,
3619 fidl::encoding::DefaultFuchsiaResourceDialect,
3620 >,
3621 offset: usize,
3622 _depth: fidl::encoding::Depth,
3623 ) -> fidl::Result<()> {
3624 decoder.debug_check_bounds::<Self>(offset);
3625 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3627 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3628 let mask = 0xffffffff00000000u64;
3629 let maskedval = padval & mask;
3630 if maskedval != 0 {
3631 return Err(fidl::Error::NonZeroPadding {
3632 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3633 });
3634 }
3635 fidl::decode!(
3636 DeviceConfig,
3637 fidl::encoding::DefaultFuchsiaResourceDialect,
3638 &mut self.config,
3639 decoder,
3640 offset + 0,
3641 _depth
3642 )?;
3643 fidl::decode!(
3644 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
3645 fidl::encoding::DefaultFuchsiaResourceDialect,
3646 &mut self.device,
3647 decoder,
3648 offset + 16,
3649 _depth
3650 )?;
3651 Ok(())
3652 }
3653 }
3654
3655 impl fidl::encoding::ResourceTypeMarker for ControlCreatePairRequest {
3656 type Borrowed<'a> = &'a mut Self;
3657 fn take_or_borrow<'a>(
3658 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3659 ) -> Self::Borrowed<'a> {
3660 value
3661 }
3662 }
3663
3664 unsafe impl fidl::encoding::TypeMarker for ControlCreatePairRequest {
3665 type Owned = Self;
3666
3667 #[inline(always)]
3668 fn inline_align(_context: fidl::encoding::Context) -> usize {
3669 8
3670 }
3671
3672 #[inline(always)]
3673 fn inline_size(_context: fidl::encoding::Context) -> usize {
3674 24
3675 }
3676 }
3677
3678 unsafe impl
3679 fidl::encoding::Encode<
3680 ControlCreatePairRequest,
3681 fidl::encoding::DefaultFuchsiaResourceDialect,
3682 > for &mut ControlCreatePairRequest
3683 {
3684 #[inline]
3685 unsafe fn encode(
3686 self,
3687 encoder: &mut fidl::encoding::Encoder<
3688 '_,
3689 fidl::encoding::DefaultFuchsiaResourceDialect,
3690 >,
3691 offset: usize,
3692 _depth: fidl::encoding::Depth,
3693 ) -> fidl::Result<()> {
3694 encoder.debug_check_bounds::<ControlCreatePairRequest>(offset);
3695 fidl::encoding::Encode::<ControlCreatePairRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3697 (
3698 <DevicePairConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
3699 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DevicePairMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device_pair),
3700 ),
3701 encoder, offset, _depth
3702 )
3703 }
3704 }
3705 unsafe impl<
3706 T0: fidl::encoding::Encode<DevicePairConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
3707 T1: fidl::encoding::Encode<
3708 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DevicePairMarker>>,
3709 fidl::encoding::DefaultFuchsiaResourceDialect,
3710 >,
3711 >
3712 fidl::encoding::Encode<
3713 ControlCreatePairRequest,
3714 fidl::encoding::DefaultFuchsiaResourceDialect,
3715 > for (T0, T1)
3716 {
3717 #[inline]
3718 unsafe fn encode(
3719 self,
3720 encoder: &mut fidl::encoding::Encoder<
3721 '_,
3722 fidl::encoding::DefaultFuchsiaResourceDialect,
3723 >,
3724 offset: usize,
3725 depth: fidl::encoding::Depth,
3726 ) -> fidl::Result<()> {
3727 encoder.debug_check_bounds::<ControlCreatePairRequest>(offset);
3728 unsafe {
3731 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3732 (ptr as *mut u64).write_unaligned(0);
3733 }
3734 self.0.encode(encoder, offset + 0, depth)?;
3736 self.1.encode(encoder, offset + 16, depth)?;
3737 Ok(())
3738 }
3739 }
3740
3741 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3742 for ControlCreatePairRequest
3743 {
3744 #[inline(always)]
3745 fn new_empty() -> Self {
3746 Self {
3747 config: fidl::new_empty!(
3748 DevicePairConfig,
3749 fidl::encoding::DefaultFuchsiaResourceDialect
3750 ),
3751 device_pair: fidl::new_empty!(
3752 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DevicePairMarker>>,
3753 fidl::encoding::DefaultFuchsiaResourceDialect
3754 ),
3755 }
3756 }
3757
3758 #[inline]
3759 unsafe fn decode(
3760 &mut self,
3761 decoder: &mut fidl::encoding::Decoder<
3762 '_,
3763 fidl::encoding::DefaultFuchsiaResourceDialect,
3764 >,
3765 offset: usize,
3766 _depth: fidl::encoding::Depth,
3767 ) -> fidl::Result<()> {
3768 decoder.debug_check_bounds::<Self>(offset);
3769 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3771 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3772 let mask = 0xffffffff00000000u64;
3773 let maskedval = padval & mask;
3774 if maskedval != 0 {
3775 return Err(fidl::Error::NonZeroPadding {
3776 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3777 });
3778 }
3779 fidl::decode!(
3780 DevicePairConfig,
3781 fidl::encoding::DefaultFuchsiaResourceDialect,
3782 &mut self.config,
3783 decoder,
3784 offset + 0,
3785 _depth
3786 )?;
3787 fidl::decode!(
3788 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DevicePairMarker>>,
3789 fidl::encoding::DefaultFuchsiaResourceDialect,
3790 &mut self.device_pair,
3791 decoder,
3792 offset + 16,
3793 _depth
3794 )?;
3795 Ok(())
3796 }
3797 }
3798
3799 impl fidl::encoding::ResourceTypeMarker for DeviceAddPortRequest {
3800 type Borrowed<'a> = &'a mut Self;
3801 fn take_or_borrow<'a>(
3802 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3803 ) -> Self::Borrowed<'a> {
3804 value
3805 }
3806 }
3807
3808 unsafe impl fidl::encoding::TypeMarker for DeviceAddPortRequest {
3809 type Owned = Self;
3810
3811 #[inline(always)]
3812 fn inline_align(_context: fidl::encoding::Context) -> usize {
3813 8
3814 }
3815
3816 #[inline(always)]
3817 fn inline_size(_context: fidl::encoding::Context) -> usize {
3818 24
3819 }
3820 }
3821
3822 unsafe impl
3823 fidl::encoding::Encode<DeviceAddPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3824 for &mut DeviceAddPortRequest
3825 {
3826 #[inline]
3827 unsafe fn encode(
3828 self,
3829 encoder: &mut fidl::encoding::Encoder<
3830 '_,
3831 fidl::encoding::DefaultFuchsiaResourceDialect,
3832 >,
3833 offset: usize,
3834 _depth: fidl::encoding::Depth,
3835 ) -> fidl::Result<()> {
3836 encoder.debug_check_bounds::<DeviceAddPortRequest>(offset);
3837 fidl::encoding::Encode::<DeviceAddPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3839 (
3840 <DevicePortConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
3841 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.port),
3842 ),
3843 encoder, offset, _depth
3844 )
3845 }
3846 }
3847 unsafe impl<
3848 T0: fidl::encoding::Encode<DevicePortConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
3849 T1: fidl::encoding::Encode<
3850 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
3851 fidl::encoding::DefaultFuchsiaResourceDialect,
3852 >,
3853 >
3854 fidl::encoding::Encode<DeviceAddPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3855 for (T0, T1)
3856 {
3857 #[inline]
3858 unsafe fn encode(
3859 self,
3860 encoder: &mut fidl::encoding::Encoder<
3861 '_,
3862 fidl::encoding::DefaultFuchsiaResourceDialect,
3863 >,
3864 offset: usize,
3865 depth: fidl::encoding::Depth,
3866 ) -> fidl::Result<()> {
3867 encoder.debug_check_bounds::<DeviceAddPortRequest>(offset);
3868 unsafe {
3871 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3872 (ptr as *mut u64).write_unaligned(0);
3873 }
3874 self.0.encode(encoder, offset + 0, depth)?;
3876 self.1.encode(encoder, offset + 16, depth)?;
3877 Ok(())
3878 }
3879 }
3880
3881 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3882 for DeviceAddPortRequest
3883 {
3884 #[inline(always)]
3885 fn new_empty() -> Self {
3886 Self {
3887 config: fidl::new_empty!(
3888 DevicePortConfig,
3889 fidl::encoding::DefaultFuchsiaResourceDialect
3890 ),
3891 port: fidl::new_empty!(
3892 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
3893 fidl::encoding::DefaultFuchsiaResourceDialect
3894 ),
3895 }
3896 }
3897
3898 #[inline]
3899 unsafe fn decode(
3900 &mut self,
3901 decoder: &mut fidl::encoding::Decoder<
3902 '_,
3903 fidl::encoding::DefaultFuchsiaResourceDialect,
3904 >,
3905 offset: usize,
3906 _depth: fidl::encoding::Depth,
3907 ) -> fidl::Result<()> {
3908 decoder.debug_check_bounds::<Self>(offset);
3909 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3911 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3912 let mask = 0xffffffff00000000u64;
3913 let maskedval = padval & mask;
3914 if maskedval != 0 {
3915 return Err(fidl::Error::NonZeroPadding {
3916 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3917 });
3918 }
3919 fidl::decode!(
3920 DevicePortConfig,
3921 fidl::encoding::DefaultFuchsiaResourceDialect,
3922 &mut self.config,
3923 decoder,
3924 offset + 0,
3925 _depth
3926 )?;
3927 fidl::decode!(
3928 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PortMarker>>,
3929 fidl::encoding::DefaultFuchsiaResourceDialect,
3930 &mut self.port,
3931 decoder,
3932 offset + 16,
3933 _depth
3934 )?;
3935 Ok(())
3936 }
3937 }
3938
3939 impl fidl::encoding::ResourceTypeMarker for DeviceDelegateRxLeaseRequest {
3940 type Borrowed<'a> = &'a mut Self;
3941 fn take_or_borrow<'a>(
3942 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3943 ) -> Self::Borrowed<'a> {
3944 value
3945 }
3946 }
3947
3948 unsafe impl fidl::encoding::TypeMarker for DeviceDelegateRxLeaseRequest {
3949 type Owned = Self;
3950
3951 #[inline(always)]
3952 fn inline_align(_context: fidl::encoding::Context) -> usize {
3953 8
3954 }
3955
3956 #[inline(always)]
3957 fn inline_size(_context: fidl::encoding::Context) -> usize {
3958 16
3959 }
3960 }
3961
3962 unsafe impl
3963 fidl::encoding::Encode<
3964 DeviceDelegateRxLeaseRequest,
3965 fidl::encoding::DefaultFuchsiaResourceDialect,
3966 > for &mut DeviceDelegateRxLeaseRequest
3967 {
3968 #[inline]
3969 unsafe fn encode(
3970 self,
3971 encoder: &mut fidl::encoding::Encoder<
3972 '_,
3973 fidl::encoding::DefaultFuchsiaResourceDialect,
3974 >,
3975 offset: usize,
3976 _depth: fidl::encoding::Depth,
3977 ) -> fidl::Result<()> {
3978 encoder.debug_check_bounds::<DeviceDelegateRxLeaseRequest>(offset);
3979 fidl::encoding::Encode::<DeviceDelegateRxLeaseRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3981 (
3982 <fidl_fuchsia_hardware_network::DelegatedRxLease as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.lease),
3983 ),
3984 encoder, offset, _depth
3985 )
3986 }
3987 }
3988 unsafe impl<
3989 T0: fidl::encoding::Encode<
3990 fidl_fuchsia_hardware_network::DelegatedRxLease,
3991 fidl::encoding::DefaultFuchsiaResourceDialect,
3992 >,
3993 >
3994 fidl::encoding::Encode<
3995 DeviceDelegateRxLeaseRequest,
3996 fidl::encoding::DefaultFuchsiaResourceDialect,
3997 > for (T0,)
3998 {
3999 #[inline]
4000 unsafe fn encode(
4001 self,
4002 encoder: &mut fidl::encoding::Encoder<
4003 '_,
4004 fidl::encoding::DefaultFuchsiaResourceDialect,
4005 >,
4006 offset: usize,
4007 depth: fidl::encoding::Depth,
4008 ) -> fidl::Result<()> {
4009 encoder.debug_check_bounds::<DeviceDelegateRxLeaseRequest>(offset);
4010 self.0.encode(encoder, offset + 0, depth)?;
4014 Ok(())
4015 }
4016 }
4017
4018 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4019 for DeviceDelegateRxLeaseRequest
4020 {
4021 #[inline(always)]
4022 fn new_empty() -> Self {
4023 Self {
4024 lease: fidl::new_empty!(
4025 fidl_fuchsia_hardware_network::DelegatedRxLease,
4026 fidl::encoding::DefaultFuchsiaResourceDialect
4027 ),
4028 }
4029 }
4030
4031 #[inline]
4032 unsafe fn decode(
4033 &mut self,
4034 decoder: &mut fidl::encoding::Decoder<
4035 '_,
4036 fidl::encoding::DefaultFuchsiaResourceDialect,
4037 >,
4038 offset: usize,
4039 _depth: fidl::encoding::Depth,
4040 ) -> fidl::Result<()> {
4041 decoder.debug_check_bounds::<Self>(offset);
4042 fidl::decode!(
4044 fidl_fuchsia_hardware_network::DelegatedRxLease,
4045 fidl::encoding::DefaultFuchsiaResourceDialect,
4046 &mut self.lease,
4047 decoder,
4048 offset + 0,
4049 _depth
4050 )?;
4051 Ok(())
4052 }
4053 }
4054
4055 impl fidl::encoding::ResourceTypeMarker for DeviceGetDeviceRequest {
4056 type Borrowed<'a> = &'a mut Self;
4057 fn take_or_borrow<'a>(
4058 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4059 ) -> Self::Borrowed<'a> {
4060 value
4061 }
4062 }
4063
4064 unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceRequest {
4065 type Owned = Self;
4066
4067 #[inline(always)]
4068 fn inline_align(_context: fidl::encoding::Context) -> usize {
4069 4
4070 }
4071
4072 #[inline(always)]
4073 fn inline_size(_context: fidl::encoding::Context) -> usize {
4074 4
4075 }
4076 }
4077
4078 unsafe impl
4079 fidl::encoding::Encode<
4080 DeviceGetDeviceRequest,
4081 fidl::encoding::DefaultFuchsiaResourceDialect,
4082 > for &mut DeviceGetDeviceRequest
4083 {
4084 #[inline]
4085 unsafe fn encode(
4086 self,
4087 encoder: &mut fidl::encoding::Encoder<
4088 '_,
4089 fidl::encoding::DefaultFuchsiaResourceDialect,
4090 >,
4091 offset: usize,
4092 _depth: fidl::encoding::Depth,
4093 ) -> fidl::Result<()> {
4094 encoder.debug_check_bounds::<DeviceGetDeviceRequest>(offset);
4095 fidl::encoding::Encode::<
4097 DeviceGetDeviceRequest,
4098 fidl::encoding::DefaultFuchsiaResourceDialect,
4099 >::encode(
4100 (<fidl::encoding::Endpoint<
4101 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4102 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4103 &mut self.device
4104 ),),
4105 encoder,
4106 offset,
4107 _depth,
4108 )
4109 }
4110 }
4111 unsafe impl<
4112 T0: fidl::encoding::Encode<
4113 fidl::encoding::Endpoint<
4114 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4115 >,
4116 fidl::encoding::DefaultFuchsiaResourceDialect,
4117 >,
4118 >
4119 fidl::encoding::Encode<
4120 DeviceGetDeviceRequest,
4121 fidl::encoding::DefaultFuchsiaResourceDialect,
4122 > for (T0,)
4123 {
4124 #[inline]
4125 unsafe fn encode(
4126 self,
4127 encoder: &mut fidl::encoding::Encoder<
4128 '_,
4129 fidl::encoding::DefaultFuchsiaResourceDialect,
4130 >,
4131 offset: usize,
4132 depth: fidl::encoding::Depth,
4133 ) -> fidl::Result<()> {
4134 encoder.debug_check_bounds::<DeviceGetDeviceRequest>(offset);
4135 self.0.encode(encoder, offset + 0, depth)?;
4139 Ok(())
4140 }
4141 }
4142
4143 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4144 for DeviceGetDeviceRequest
4145 {
4146 #[inline(always)]
4147 fn new_empty() -> Self {
4148 Self {
4149 device: fidl::new_empty!(
4150 fidl::encoding::Endpoint<
4151 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4152 >,
4153 fidl::encoding::DefaultFuchsiaResourceDialect
4154 ),
4155 }
4156 }
4157
4158 #[inline]
4159 unsafe fn decode(
4160 &mut self,
4161 decoder: &mut fidl::encoding::Decoder<
4162 '_,
4163 fidl::encoding::DefaultFuchsiaResourceDialect,
4164 >,
4165 offset: usize,
4166 _depth: fidl::encoding::Depth,
4167 ) -> fidl::Result<()> {
4168 decoder.debug_check_bounds::<Self>(offset);
4169 fidl::decode!(
4171 fidl::encoding::Endpoint<
4172 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4173 >,
4174 fidl::encoding::DefaultFuchsiaResourceDialect,
4175 &mut self.device,
4176 decoder,
4177 offset + 0,
4178 _depth
4179 )?;
4180 Ok(())
4181 }
4182 }
4183
4184 impl fidl::encoding::ResourceTypeMarker for DeviceGetSignalsResponse {
4185 type Borrowed<'a> = &'a mut Self;
4186 fn take_or_borrow<'a>(
4187 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4188 ) -> Self::Borrowed<'a> {
4189 value
4190 }
4191 }
4192
4193 unsafe impl fidl::encoding::TypeMarker for DeviceGetSignalsResponse {
4194 type Owned = Self;
4195
4196 #[inline(always)]
4197 fn inline_align(_context: fidl::encoding::Context) -> usize {
4198 4
4199 }
4200
4201 #[inline(always)]
4202 fn inline_size(_context: fidl::encoding::Context) -> usize {
4203 4
4204 }
4205 }
4206
4207 unsafe impl
4208 fidl::encoding::Encode<
4209 DeviceGetSignalsResponse,
4210 fidl::encoding::DefaultFuchsiaResourceDialect,
4211 > for &mut DeviceGetSignalsResponse
4212 {
4213 #[inline]
4214 unsafe fn encode(
4215 self,
4216 encoder: &mut fidl::encoding::Encoder<
4217 '_,
4218 fidl::encoding::DefaultFuchsiaResourceDialect,
4219 >,
4220 offset: usize,
4221 _depth: fidl::encoding::Depth,
4222 ) -> fidl::Result<()> {
4223 encoder.debug_check_bounds::<DeviceGetSignalsResponse>(offset);
4224 fidl::encoding::Encode::<
4226 DeviceGetSignalsResponse,
4227 fidl::encoding::DefaultFuchsiaResourceDialect,
4228 >::encode(
4229 (<fidl::encoding::HandleType<
4230 fidl::EventPair,
4231 { fidl::ObjectType::EVENTPAIR.into_raw() },
4232 2147483648,
4233 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4234 &mut self.signals
4235 ),),
4236 encoder,
4237 offset,
4238 _depth,
4239 )
4240 }
4241 }
4242 unsafe impl<
4243 T0: fidl::encoding::Encode<
4244 fidl::encoding::HandleType<
4245 fidl::EventPair,
4246 { fidl::ObjectType::EVENTPAIR.into_raw() },
4247 2147483648,
4248 >,
4249 fidl::encoding::DefaultFuchsiaResourceDialect,
4250 >,
4251 >
4252 fidl::encoding::Encode<
4253 DeviceGetSignalsResponse,
4254 fidl::encoding::DefaultFuchsiaResourceDialect,
4255 > for (T0,)
4256 {
4257 #[inline]
4258 unsafe fn encode(
4259 self,
4260 encoder: &mut fidl::encoding::Encoder<
4261 '_,
4262 fidl::encoding::DefaultFuchsiaResourceDialect,
4263 >,
4264 offset: usize,
4265 depth: fidl::encoding::Depth,
4266 ) -> fidl::Result<()> {
4267 encoder.debug_check_bounds::<DeviceGetSignalsResponse>(offset);
4268 self.0.encode(encoder, offset + 0, depth)?;
4272 Ok(())
4273 }
4274 }
4275
4276 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4277 for DeviceGetSignalsResponse
4278 {
4279 #[inline(always)]
4280 fn new_empty() -> Self {
4281 Self {
4282 signals: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4283 }
4284 }
4285
4286 #[inline]
4287 unsafe fn decode(
4288 &mut self,
4289 decoder: &mut fidl::encoding::Decoder<
4290 '_,
4291 fidl::encoding::DefaultFuchsiaResourceDialect,
4292 >,
4293 offset: usize,
4294 _depth: fidl::encoding::Depth,
4295 ) -> fidl::Result<()> {
4296 decoder.debug_check_bounds::<Self>(offset);
4297 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.signals, decoder, offset + 0, _depth)?;
4299 Ok(())
4300 }
4301 }
4302
4303 impl fidl::encoding::ResourceTypeMarker for DevicePairGetLeftPortRequest {
4304 type Borrowed<'a> = &'a mut Self;
4305 fn take_or_borrow<'a>(
4306 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4307 ) -> Self::Borrowed<'a> {
4308 value
4309 }
4310 }
4311
4312 unsafe impl fidl::encoding::TypeMarker for DevicePairGetLeftPortRequest {
4313 type Owned = Self;
4314
4315 #[inline(always)]
4316 fn inline_align(_context: fidl::encoding::Context) -> usize {
4317 4
4318 }
4319
4320 #[inline(always)]
4321 fn inline_size(_context: fidl::encoding::Context) -> usize {
4322 8
4323 }
4324 }
4325
4326 unsafe impl
4327 fidl::encoding::Encode<
4328 DevicePairGetLeftPortRequest,
4329 fidl::encoding::DefaultFuchsiaResourceDialect,
4330 > for &mut DevicePairGetLeftPortRequest
4331 {
4332 #[inline]
4333 unsafe fn encode(
4334 self,
4335 encoder: &mut fidl::encoding::Encoder<
4336 '_,
4337 fidl::encoding::DefaultFuchsiaResourceDialect,
4338 >,
4339 offset: usize,
4340 _depth: fidl::encoding::Depth,
4341 ) -> fidl::Result<()> {
4342 encoder.debug_check_bounds::<DevicePairGetLeftPortRequest>(offset);
4343 fidl::encoding::Encode::<
4345 DevicePairGetLeftPortRequest,
4346 fidl::encoding::DefaultFuchsiaResourceDialect,
4347 >::encode(
4348 (
4349 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4350 <fidl::encoding::Endpoint<
4351 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
4352 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4353 &mut self.port
4354 ),
4355 ),
4356 encoder,
4357 offset,
4358 _depth,
4359 )
4360 }
4361 }
4362 unsafe impl<
4363 T0: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>,
4364 T1: fidl::encoding::Encode<
4365 fidl::encoding::Endpoint<
4366 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
4367 >,
4368 fidl::encoding::DefaultFuchsiaResourceDialect,
4369 >,
4370 >
4371 fidl::encoding::Encode<
4372 DevicePairGetLeftPortRequest,
4373 fidl::encoding::DefaultFuchsiaResourceDialect,
4374 > for (T0, T1)
4375 {
4376 #[inline]
4377 unsafe fn encode(
4378 self,
4379 encoder: &mut fidl::encoding::Encoder<
4380 '_,
4381 fidl::encoding::DefaultFuchsiaResourceDialect,
4382 >,
4383 offset: usize,
4384 depth: fidl::encoding::Depth,
4385 ) -> fidl::Result<()> {
4386 encoder.debug_check_bounds::<DevicePairGetLeftPortRequest>(offset);
4387 unsafe {
4390 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4391 (ptr as *mut u32).write_unaligned(0);
4392 }
4393 self.0.encode(encoder, offset + 0, depth)?;
4395 self.1.encode(encoder, offset + 4, depth)?;
4396 Ok(())
4397 }
4398 }
4399
4400 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4401 for DevicePairGetLeftPortRequest
4402 {
4403 #[inline(always)]
4404 fn new_empty() -> Self {
4405 Self {
4406 id: fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect),
4407 port: fidl::new_empty!(
4408 fidl::encoding::Endpoint<
4409 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
4410 >,
4411 fidl::encoding::DefaultFuchsiaResourceDialect
4412 ),
4413 }
4414 }
4415
4416 #[inline]
4417 unsafe fn decode(
4418 &mut self,
4419 decoder: &mut fidl::encoding::Decoder<
4420 '_,
4421 fidl::encoding::DefaultFuchsiaResourceDialect,
4422 >,
4423 offset: usize,
4424 _depth: fidl::encoding::Depth,
4425 ) -> fidl::Result<()> {
4426 decoder.debug_check_bounds::<Self>(offset);
4427 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4429 let padval = unsafe { (ptr as *const u32).read_unaligned() };
4430 let mask = 0xffffff00u32;
4431 let maskedval = padval & mask;
4432 if maskedval != 0 {
4433 return Err(fidl::Error::NonZeroPadding {
4434 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4435 });
4436 }
4437 fidl::decode!(
4438 u8,
4439 fidl::encoding::DefaultFuchsiaResourceDialect,
4440 &mut self.id,
4441 decoder,
4442 offset + 0,
4443 _depth
4444 )?;
4445 fidl::decode!(
4446 fidl::encoding::Endpoint<
4447 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
4448 >,
4449 fidl::encoding::DefaultFuchsiaResourceDialect,
4450 &mut self.port,
4451 decoder,
4452 offset + 4,
4453 _depth
4454 )?;
4455 Ok(())
4456 }
4457 }
4458
4459 impl fidl::encoding::ResourceTypeMarker for DevicePairGetLeftRequest {
4460 type Borrowed<'a> = &'a mut Self;
4461 fn take_or_borrow<'a>(
4462 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4463 ) -> Self::Borrowed<'a> {
4464 value
4465 }
4466 }
4467
4468 unsafe impl fidl::encoding::TypeMarker for DevicePairGetLeftRequest {
4469 type Owned = Self;
4470
4471 #[inline(always)]
4472 fn inline_align(_context: fidl::encoding::Context) -> usize {
4473 4
4474 }
4475
4476 #[inline(always)]
4477 fn inline_size(_context: fidl::encoding::Context) -> usize {
4478 4
4479 }
4480 }
4481
4482 unsafe impl
4483 fidl::encoding::Encode<
4484 DevicePairGetLeftRequest,
4485 fidl::encoding::DefaultFuchsiaResourceDialect,
4486 > for &mut DevicePairGetLeftRequest
4487 {
4488 #[inline]
4489 unsafe fn encode(
4490 self,
4491 encoder: &mut fidl::encoding::Encoder<
4492 '_,
4493 fidl::encoding::DefaultFuchsiaResourceDialect,
4494 >,
4495 offset: usize,
4496 _depth: fidl::encoding::Depth,
4497 ) -> fidl::Result<()> {
4498 encoder.debug_check_bounds::<DevicePairGetLeftRequest>(offset);
4499 fidl::encoding::Encode::<
4501 DevicePairGetLeftRequest,
4502 fidl::encoding::DefaultFuchsiaResourceDialect,
4503 >::encode(
4504 (<fidl::encoding::Endpoint<
4505 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4506 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4507 &mut self.device
4508 ),),
4509 encoder,
4510 offset,
4511 _depth,
4512 )
4513 }
4514 }
4515 unsafe impl<
4516 T0: fidl::encoding::Encode<
4517 fidl::encoding::Endpoint<
4518 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4519 >,
4520 fidl::encoding::DefaultFuchsiaResourceDialect,
4521 >,
4522 >
4523 fidl::encoding::Encode<
4524 DevicePairGetLeftRequest,
4525 fidl::encoding::DefaultFuchsiaResourceDialect,
4526 > for (T0,)
4527 {
4528 #[inline]
4529 unsafe fn encode(
4530 self,
4531 encoder: &mut fidl::encoding::Encoder<
4532 '_,
4533 fidl::encoding::DefaultFuchsiaResourceDialect,
4534 >,
4535 offset: usize,
4536 depth: fidl::encoding::Depth,
4537 ) -> fidl::Result<()> {
4538 encoder.debug_check_bounds::<DevicePairGetLeftRequest>(offset);
4539 self.0.encode(encoder, offset + 0, depth)?;
4543 Ok(())
4544 }
4545 }
4546
4547 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4548 for DevicePairGetLeftRequest
4549 {
4550 #[inline(always)]
4551 fn new_empty() -> Self {
4552 Self {
4553 device: fidl::new_empty!(
4554 fidl::encoding::Endpoint<
4555 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4556 >,
4557 fidl::encoding::DefaultFuchsiaResourceDialect
4558 ),
4559 }
4560 }
4561
4562 #[inline]
4563 unsafe fn decode(
4564 &mut self,
4565 decoder: &mut fidl::encoding::Decoder<
4566 '_,
4567 fidl::encoding::DefaultFuchsiaResourceDialect,
4568 >,
4569 offset: usize,
4570 _depth: fidl::encoding::Depth,
4571 ) -> fidl::Result<()> {
4572 decoder.debug_check_bounds::<Self>(offset);
4573 fidl::decode!(
4575 fidl::encoding::Endpoint<
4576 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4577 >,
4578 fidl::encoding::DefaultFuchsiaResourceDialect,
4579 &mut self.device,
4580 decoder,
4581 offset + 0,
4582 _depth
4583 )?;
4584 Ok(())
4585 }
4586 }
4587
4588 impl fidl::encoding::ResourceTypeMarker for DevicePairGetRightPortRequest {
4589 type Borrowed<'a> = &'a mut Self;
4590 fn take_or_borrow<'a>(
4591 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4592 ) -> Self::Borrowed<'a> {
4593 value
4594 }
4595 }
4596
4597 unsafe impl fidl::encoding::TypeMarker for DevicePairGetRightPortRequest {
4598 type Owned = Self;
4599
4600 #[inline(always)]
4601 fn inline_align(_context: fidl::encoding::Context) -> usize {
4602 4
4603 }
4604
4605 #[inline(always)]
4606 fn inline_size(_context: fidl::encoding::Context) -> usize {
4607 8
4608 }
4609 }
4610
4611 unsafe impl
4612 fidl::encoding::Encode<
4613 DevicePairGetRightPortRequest,
4614 fidl::encoding::DefaultFuchsiaResourceDialect,
4615 > for &mut DevicePairGetRightPortRequest
4616 {
4617 #[inline]
4618 unsafe fn encode(
4619 self,
4620 encoder: &mut fidl::encoding::Encoder<
4621 '_,
4622 fidl::encoding::DefaultFuchsiaResourceDialect,
4623 >,
4624 offset: usize,
4625 _depth: fidl::encoding::Depth,
4626 ) -> fidl::Result<()> {
4627 encoder.debug_check_bounds::<DevicePairGetRightPortRequest>(offset);
4628 fidl::encoding::Encode::<
4630 DevicePairGetRightPortRequest,
4631 fidl::encoding::DefaultFuchsiaResourceDialect,
4632 >::encode(
4633 (
4634 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4635 <fidl::encoding::Endpoint<
4636 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
4637 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4638 &mut self.port
4639 ),
4640 ),
4641 encoder,
4642 offset,
4643 _depth,
4644 )
4645 }
4646 }
4647 unsafe impl<
4648 T0: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>,
4649 T1: fidl::encoding::Encode<
4650 fidl::encoding::Endpoint<
4651 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
4652 >,
4653 fidl::encoding::DefaultFuchsiaResourceDialect,
4654 >,
4655 >
4656 fidl::encoding::Encode<
4657 DevicePairGetRightPortRequest,
4658 fidl::encoding::DefaultFuchsiaResourceDialect,
4659 > for (T0, T1)
4660 {
4661 #[inline]
4662 unsafe fn encode(
4663 self,
4664 encoder: &mut fidl::encoding::Encoder<
4665 '_,
4666 fidl::encoding::DefaultFuchsiaResourceDialect,
4667 >,
4668 offset: usize,
4669 depth: fidl::encoding::Depth,
4670 ) -> fidl::Result<()> {
4671 encoder.debug_check_bounds::<DevicePairGetRightPortRequest>(offset);
4672 unsafe {
4675 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4676 (ptr as *mut u32).write_unaligned(0);
4677 }
4678 self.0.encode(encoder, offset + 0, depth)?;
4680 self.1.encode(encoder, offset + 4, depth)?;
4681 Ok(())
4682 }
4683 }
4684
4685 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4686 for DevicePairGetRightPortRequest
4687 {
4688 #[inline(always)]
4689 fn new_empty() -> Self {
4690 Self {
4691 id: fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect),
4692 port: fidl::new_empty!(
4693 fidl::encoding::Endpoint<
4694 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
4695 >,
4696 fidl::encoding::DefaultFuchsiaResourceDialect
4697 ),
4698 }
4699 }
4700
4701 #[inline]
4702 unsafe fn decode(
4703 &mut self,
4704 decoder: &mut fidl::encoding::Decoder<
4705 '_,
4706 fidl::encoding::DefaultFuchsiaResourceDialect,
4707 >,
4708 offset: usize,
4709 _depth: fidl::encoding::Depth,
4710 ) -> fidl::Result<()> {
4711 decoder.debug_check_bounds::<Self>(offset);
4712 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4714 let padval = unsafe { (ptr as *const u32).read_unaligned() };
4715 let mask = 0xffffff00u32;
4716 let maskedval = padval & mask;
4717 if maskedval != 0 {
4718 return Err(fidl::Error::NonZeroPadding {
4719 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4720 });
4721 }
4722 fidl::decode!(
4723 u8,
4724 fidl::encoding::DefaultFuchsiaResourceDialect,
4725 &mut self.id,
4726 decoder,
4727 offset + 0,
4728 _depth
4729 )?;
4730 fidl::decode!(
4731 fidl::encoding::Endpoint<
4732 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
4733 >,
4734 fidl::encoding::DefaultFuchsiaResourceDialect,
4735 &mut self.port,
4736 decoder,
4737 offset + 4,
4738 _depth
4739 )?;
4740 Ok(())
4741 }
4742 }
4743
4744 impl fidl::encoding::ResourceTypeMarker for DevicePairGetRightRequest {
4745 type Borrowed<'a> = &'a mut Self;
4746 fn take_or_borrow<'a>(
4747 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4748 ) -> Self::Borrowed<'a> {
4749 value
4750 }
4751 }
4752
4753 unsafe impl fidl::encoding::TypeMarker for DevicePairGetRightRequest {
4754 type Owned = Self;
4755
4756 #[inline(always)]
4757 fn inline_align(_context: fidl::encoding::Context) -> usize {
4758 4
4759 }
4760
4761 #[inline(always)]
4762 fn inline_size(_context: fidl::encoding::Context) -> usize {
4763 4
4764 }
4765 }
4766
4767 unsafe impl
4768 fidl::encoding::Encode<
4769 DevicePairGetRightRequest,
4770 fidl::encoding::DefaultFuchsiaResourceDialect,
4771 > for &mut DevicePairGetRightRequest
4772 {
4773 #[inline]
4774 unsafe fn encode(
4775 self,
4776 encoder: &mut fidl::encoding::Encoder<
4777 '_,
4778 fidl::encoding::DefaultFuchsiaResourceDialect,
4779 >,
4780 offset: usize,
4781 _depth: fidl::encoding::Depth,
4782 ) -> fidl::Result<()> {
4783 encoder.debug_check_bounds::<DevicePairGetRightRequest>(offset);
4784 fidl::encoding::Encode::<
4786 DevicePairGetRightRequest,
4787 fidl::encoding::DefaultFuchsiaResourceDialect,
4788 >::encode(
4789 (<fidl::encoding::Endpoint<
4790 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4791 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4792 &mut self.device
4793 ),),
4794 encoder,
4795 offset,
4796 _depth,
4797 )
4798 }
4799 }
4800 unsafe impl<
4801 T0: fidl::encoding::Encode<
4802 fidl::encoding::Endpoint<
4803 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4804 >,
4805 fidl::encoding::DefaultFuchsiaResourceDialect,
4806 >,
4807 >
4808 fidl::encoding::Encode<
4809 DevicePairGetRightRequest,
4810 fidl::encoding::DefaultFuchsiaResourceDialect,
4811 > for (T0,)
4812 {
4813 #[inline]
4814 unsafe fn encode(
4815 self,
4816 encoder: &mut fidl::encoding::Encoder<
4817 '_,
4818 fidl::encoding::DefaultFuchsiaResourceDialect,
4819 >,
4820 offset: usize,
4821 depth: fidl::encoding::Depth,
4822 ) -> fidl::Result<()> {
4823 encoder.debug_check_bounds::<DevicePairGetRightRequest>(offset);
4824 self.0.encode(encoder, offset + 0, depth)?;
4828 Ok(())
4829 }
4830 }
4831
4832 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4833 for DevicePairGetRightRequest
4834 {
4835 #[inline(always)]
4836 fn new_empty() -> Self {
4837 Self {
4838 device: fidl::new_empty!(
4839 fidl::encoding::Endpoint<
4840 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4841 >,
4842 fidl::encoding::DefaultFuchsiaResourceDialect
4843 ),
4844 }
4845 }
4846
4847 #[inline]
4848 unsafe fn decode(
4849 &mut self,
4850 decoder: &mut fidl::encoding::Decoder<
4851 '_,
4852 fidl::encoding::DefaultFuchsiaResourceDialect,
4853 >,
4854 offset: usize,
4855 _depth: fidl::encoding::Depth,
4856 ) -> fidl::Result<()> {
4857 decoder.debug_check_bounds::<Self>(offset);
4858 fidl::decode!(
4860 fidl::encoding::Endpoint<
4861 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4862 >,
4863 fidl::encoding::DefaultFuchsiaResourceDialect,
4864 &mut self.device,
4865 decoder,
4866 offset + 0,
4867 _depth
4868 )?;
4869 Ok(())
4870 }
4871 }
4872
4873 impl fidl::encoding::ResourceTypeMarker for PortGetPortRequest {
4874 type Borrowed<'a> = &'a mut Self;
4875 fn take_or_borrow<'a>(
4876 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4877 ) -> Self::Borrowed<'a> {
4878 value
4879 }
4880 }
4881
4882 unsafe impl fidl::encoding::TypeMarker for PortGetPortRequest {
4883 type Owned = Self;
4884
4885 #[inline(always)]
4886 fn inline_align(_context: fidl::encoding::Context) -> usize {
4887 4
4888 }
4889
4890 #[inline(always)]
4891 fn inline_size(_context: fidl::encoding::Context) -> usize {
4892 4
4893 }
4894 }
4895
4896 unsafe impl
4897 fidl::encoding::Encode<PortGetPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4898 for &mut PortGetPortRequest
4899 {
4900 #[inline]
4901 unsafe fn encode(
4902 self,
4903 encoder: &mut fidl::encoding::Encoder<
4904 '_,
4905 fidl::encoding::DefaultFuchsiaResourceDialect,
4906 >,
4907 offset: usize,
4908 _depth: fidl::encoding::Depth,
4909 ) -> fidl::Result<()> {
4910 encoder.debug_check_bounds::<PortGetPortRequest>(offset);
4911 fidl::encoding::Encode::<
4913 PortGetPortRequest,
4914 fidl::encoding::DefaultFuchsiaResourceDialect,
4915 >::encode(
4916 (<fidl::encoding::Endpoint<
4917 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
4918 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4919 &mut self.port
4920 ),),
4921 encoder,
4922 offset,
4923 _depth,
4924 )
4925 }
4926 }
4927 unsafe impl<
4928 T0: fidl::encoding::Encode<
4929 fidl::encoding::Endpoint<
4930 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
4931 >,
4932 fidl::encoding::DefaultFuchsiaResourceDialect,
4933 >,
4934 >
4935 fidl::encoding::Encode<PortGetPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4936 for (T0,)
4937 {
4938 #[inline]
4939 unsafe fn encode(
4940 self,
4941 encoder: &mut fidl::encoding::Encoder<
4942 '_,
4943 fidl::encoding::DefaultFuchsiaResourceDialect,
4944 >,
4945 offset: usize,
4946 depth: fidl::encoding::Depth,
4947 ) -> fidl::Result<()> {
4948 encoder.debug_check_bounds::<PortGetPortRequest>(offset);
4949 self.0.encode(encoder, offset + 0, depth)?;
4953 Ok(())
4954 }
4955 }
4956
4957 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4958 for PortGetPortRequest
4959 {
4960 #[inline(always)]
4961 fn new_empty() -> Self {
4962 Self {
4963 port: fidl::new_empty!(
4964 fidl::encoding::Endpoint<
4965 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
4966 >,
4967 fidl::encoding::DefaultFuchsiaResourceDialect
4968 ),
4969 }
4970 }
4971
4972 #[inline]
4973 unsafe fn decode(
4974 &mut self,
4975 decoder: &mut fidl::encoding::Decoder<
4976 '_,
4977 fidl::encoding::DefaultFuchsiaResourceDialect,
4978 >,
4979 offset: usize,
4980 _depth: fidl::encoding::Depth,
4981 ) -> fidl::Result<()> {
4982 decoder.debug_check_bounds::<Self>(offset);
4983 fidl::decode!(
4985 fidl::encoding::Endpoint<
4986 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
4987 >,
4988 fidl::encoding::DefaultFuchsiaResourceDialect,
4989 &mut self.port,
4990 decoder,
4991 offset + 0,
4992 _depth
4993 )?;
4994 Ok(())
4995 }
4996 }
4997}