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_virtualization_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ControlCreateNetworkRequest {
16 pub config: Config,
17 pub network: fidl::endpoints::ServerEnd<NetworkMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for ControlCreateNetworkRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct NetworkAddPortRequest {
27 pub port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
28 pub interface: fidl::endpoints::ServerEnd<InterfaceMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NetworkAddPortRequest {}
32
33#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
34pub struct ControlMarker;
35
36impl fidl::endpoints::ProtocolMarker for ControlMarker {
37 type Proxy = ControlProxy;
38 type RequestStream = ControlRequestStream;
39 #[cfg(target_os = "fuchsia")]
40 type SynchronousProxy = ControlSynchronousProxy;
41
42 const DEBUG_NAME: &'static str = "fuchsia.net.virtualization.Control";
43}
44impl fidl::endpoints::DiscoverableProtocolMarker for ControlMarker {}
45
46pub trait ControlProxyInterface: Send + Sync {
47 fn r#create_network(
48 &self,
49 config: &Config,
50 network: fidl::endpoints::ServerEnd<NetworkMarker>,
51 ) -> Result<(), fidl::Error>;
52}
53#[derive(Debug)]
54#[cfg(target_os = "fuchsia")]
55pub struct ControlSynchronousProxy {
56 client: fidl::client::sync::Client,
57}
58
59#[cfg(target_os = "fuchsia")]
60impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
61 type Proxy = ControlProxy;
62 type Protocol = ControlMarker;
63
64 fn from_channel(inner: fidl::Channel) -> Self {
65 Self::new(inner)
66 }
67
68 fn into_channel(self) -> fidl::Channel {
69 self.client.into_channel()
70 }
71
72 fn as_channel(&self) -> &fidl::Channel {
73 self.client.as_channel()
74 }
75}
76
77#[cfg(target_os = "fuchsia")]
78impl ControlSynchronousProxy {
79 pub fn new(channel: fidl::Channel) -> Self {
80 Self { client: fidl::client::sync::Client::new(channel) }
81 }
82
83 pub fn into_channel(self) -> fidl::Channel {
84 self.client.into_channel()
85 }
86
87 pub fn wait_for_event(
90 &self,
91 deadline: zx::MonotonicInstant,
92 ) -> Result<ControlEvent, fidl::Error> {
93 ControlEvent::decode(self.client.wait_for_event::<ControlMarker>(deadline)?)
94 }
95
96 pub fn r#create_network(
107 &self,
108 mut config: &Config,
109 mut network: fidl::endpoints::ServerEnd<NetworkMarker>,
110 ) -> Result<(), fidl::Error> {
111 self.client.send::<ControlCreateNetworkRequest>(
112 (config, network),
113 0x4e5909b506960eaf,
114 fidl::encoding::DynamicFlags::empty(),
115 )
116 }
117}
118
119#[cfg(target_os = "fuchsia")]
120impl From<ControlSynchronousProxy> for zx::NullableHandle {
121 fn from(value: ControlSynchronousProxy) -> Self {
122 value.into_channel().into()
123 }
124}
125
126#[cfg(target_os = "fuchsia")]
127impl From<fidl::Channel> for ControlSynchronousProxy {
128 fn from(value: fidl::Channel) -> Self {
129 Self::new(value)
130 }
131}
132
133#[cfg(target_os = "fuchsia")]
134impl fidl::endpoints::FromClient for ControlSynchronousProxy {
135 type Protocol = ControlMarker;
136
137 fn from_client(value: fidl::endpoints::ClientEnd<ControlMarker>) -> Self {
138 Self::new(value.into_channel())
139 }
140}
141
142#[derive(Debug, Clone)]
143pub struct ControlProxy {
144 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
145}
146
147impl fidl::endpoints::Proxy for ControlProxy {
148 type Protocol = ControlMarker;
149
150 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
151 Self::new(inner)
152 }
153
154 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
155 self.client.into_channel().map_err(|client| Self { client })
156 }
157
158 fn as_channel(&self) -> &::fidl::AsyncChannel {
159 self.client.as_channel()
160 }
161}
162
163impl ControlProxy {
164 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
166 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
167 Self { client: fidl::client::Client::new(channel, protocol_name) }
168 }
169
170 pub fn take_event_stream(&self) -> ControlEventStream {
176 ControlEventStream { event_receiver: self.client.take_event_receiver() }
177 }
178
179 pub fn r#create_network(
190 &self,
191 mut config: &Config,
192 mut network: fidl::endpoints::ServerEnd<NetworkMarker>,
193 ) -> Result<(), fidl::Error> {
194 ControlProxyInterface::r#create_network(self, config, network)
195 }
196}
197
198impl ControlProxyInterface for ControlProxy {
199 fn r#create_network(
200 &self,
201 mut config: &Config,
202 mut network: fidl::endpoints::ServerEnd<NetworkMarker>,
203 ) -> Result<(), fidl::Error> {
204 self.client.send::<ControlCreateNetworkRequest>(
205 (config, network),
206 0x4e5909b506960eaf,
207 fidl::encoding::DynamicFlags::empty(),
208 )
209 }
210}
211
212pub struct ControlEventStream {
213 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
214}
215
216impl std::marker::Unpin for ControlEventStream {}
217
218impl futures::stream::FusedStream for ControlEventStream {
219 fn is_terminated(&self) -> bool {
220 self.event_receiver.is_terminated()
221 }
222}
223
224impl futures::Stream for ControlEventStream {
225 type Item = Result<ControlEvent, fidl::Error>;
226
227 fn poll_next(
228 mut self: std::pin::Pin<&mut Self>,
229 cx: &mut std::task::Context<'_>,
230 ) -> std::task::Poll<Option<Self::Item>> {
231 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
232 &mut self.event_receiver,
233 cx
234 )?) {
235 Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
236 None => std::task::Poll::Ready(None),
237 }
238 }
239}
240
241#[derive(Debug)]
242pub enum ControlEvent {}
243
244impl ControlEvent {
245 fn decode(
247 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
248 ) -> Result<ControlEvent, fidl::Error> {
249 let (bytes, _handles) = buf.split_mut();
250 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
251 debug_assert_eq!(tx_header.tx_id, 0);
252 match tx_header.ordinal {
253 _ => Err(fidl::Error::UnknownOrdinal {
254 ordinal: tx_header.ordinal,
255 protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
256 }),
257 }
258 }
259}
260
261pub struct ControlRequestStream {
263 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
264 is_terminated: bool,
265}
266
267impl std::marker::Unpin for ControlRequestStream {}
268
269impl futures::stream::FusedStream for ControlRequestStream {
270 fn is_terminated(&self) -> bool {
271 self.is_terminated
272 }
273}
274
275impl fidl::endpoints::RequestStream for ControlRequestStream {
276 type Protocol = ControlMarker;
277 type ControlHandle = ControlControlHandle;
278
279 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
280 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
281 }
282
283 fn control_handle(&self) -> Self::ControlHandle {
284 ControlControlHandle { inner: self.inner.clone() }
285 }
286
287 fn into_inner(
288 self,
289 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
290 {
291 (self.inner, self.is_terminated)
292 }
293
294 fn from_inner(
295 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
296 is_terminated: bool,
297 ) -> Self {
298 Self { inner, is_terminated }
299 }
300}
301
302impl futures::Stream for ControlRequestStream {
303 type Item = Result<ControlRequest, fidl::Error>;
304
305 fn poll_next(
306 mut self: std::pin::Pin<&mut Self>,
307 cx: &mut std::task::Context<'_>,
308 ) -> std::task::Poll<Option<Self::Item>> {
309 let this = &mut *self;
310 if this.inner.check_shutdown(cx) {
311 this.is_terminated = true;
312 return std::task::Poll::Ready(None);
313 }
314 if this.is_terminated {
315 panic!("polled ControlRequestStream after completion");
316 }
317 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
318 |bytes, handles| {
319 match this.inner.channel().read_etc(cx, bytes, handles) {
320 std::task::Poll::Ready(Ok(())) => {}
321 std::task::Poll::Pending => return std::task::Poll::Pending,
322 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
323 this.is_terminated = true;
324 return std::task::Poll::Ready(None);
325 }
326 std::task::Poll::Ready(Err(e)) => {
327 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
328 e.into(),
329 ))));
330 }
331 }
332
333 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
335
336 std::task::Poll::Ready(Some(match header.ordinal {
337 0x4e5909b506960eaf => {
338 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
339 let mut req = fidl::new_empty!(
340 ControlCreateNetworkRequest,
341 fidl::encoding::DefaultFuchsiaResourceDialect
342 );
343 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlCreateNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
344 let control_handle = ControlControlHandle { inner: this.inner.clone() };
345 Ok(ControlRequest::CreateNetwork {
346 config: req.config,
347 network: req.network,
348
349 control_handle,
350 })
351 }
352 _ => Err(fidl::Error::UnknownOrdinal {
353 ordinal: header.ordinal,
354 protocol_name:
355 <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
356 }),
357 }))
358 },
359 )
360 }
361}
362
363#[derive(Debug)]
365pub enum ControlRequest {
366 CreateNetwork {
377 config: Config,
378 network: fidl::endpoints::ServerEnd<NetworkMarker>,
379 control_handle: ControlControlHandle,
380 },
381}
382
383impl ControlRequest {
384 #[allow(irrefutable_let_patterns)]
385 pub fn into_create_network(
386 self,
387 ) -> Option<(Config, fidl::endpoints::ServerEnd<NetworkMarker>, ControlControlHandle)> {
388 if let ControlRequest::CreateNetwork { config, network, control_handle } = self {
389 Some((config, network, control_handle))
390 } else {
391 None
392 }
393 }
394
395 pub fn method_name(&self) -> &'static str {
397 match *self {
398 ControlRequest::CreateNetwork { .. } => "create_network",
399 }
400 }
401}
402
403#[derive(Debug, Clone)]
404pub struct ControlControlHandle {
405 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
406}
407
408impl ControlControlHandle {
409 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
410 self.inner.shutdown_with_epitaph(status.into())
411 }
412}
413
414impl fidl::endpoints::ControlHandle for ControlControlHandle {
415 fn shutdown(&self) {
416 self.inner.shutdown()
417 }
418
419 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
420 self.inner.shutdown_with_epitaph(status)
421 }
422
423 fn is_closed(&self) -> bool {
424 self.inner.channel().is_closed()
425 }
426 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
427 self.inner.channel().on_closed()
428 }
429
430 #[cfg(target_os = "fuchsia")]
431 fn signal_peer(
432 &self,
433 clear_mask: zx::Signals,
434 set_mask: zx::Signals,
435 ) -> Result<(), zx_status::Status> {
436 use fidl::Peered;
437 self.inner.channel().signal_peer(clear_mask, set_mask)
438 }
439}
440
441impl ControlControlHandle {}
442
443#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
444pub struct InterfaceMarker;
445
446impl fidl::endpoints::ProtocolMarker for InterfaceMarker {
447 type Proxy = InterfaceProxy;
448 type RequestStream = InterfaceRequestStream;
449 #[cfg(target_os = "fuchsia")]
450 type SynchronousProxy = InterfaceSynchronousProxy;
451
452 const DEBUG_NAME: &'static str = "(anonymous) Interface";
453}
454
455pub trait InterfaceProxyInterface: Send + Sync {}
456#[derive(Debug)]
457#[cfg(target_os = "fuchsia")]
458pub struct InterfaceSynchronousProxy {
459 client: fidl::client::sync::Client,
460}
461
462#[cfg(target_os = "fuchsia")]
463impl fidl::endpoints::SynchronousProxy for InterfaceSynchronousProxy {
464 type Proxy = InterfaceProxy;
465 type Protocol = InterfaceMarker;
466
467 fn from_channel(inner: fidl::Channel) -> Self {
468 Self::new(inner)
469 }
470
471 fn into_channel(self) -> fidl::Channel {
472 self.client.into_channel()
473 }
474
475 fn as_channel(&self) -> &fidl::Channel {
476 self.client.as_channel()
477 }
478}
479
480#[cfg(target_os = "fuchsia")]
481impl InterfaceSynchronousProxy {
482 pub fn new(channel: fidl::Channel) -> Self {
483 Self { client: fidl::client::sync::Client::new(channel) }
484 }
485
486 pub fn into_channel(self) -> fidl::Channel {
487 self.client.into_channel()
488 }
489
490 pub fn wait_for_event(
493 &self,
494 deadline: zx::MonotonicInstant,
495 ) -> Result<InterfaceEvent, fidl::Error> {
496 InterfaceEvent::decode(self.client.wait_for_event::<InterfaceMarker>(deadline)?)
497 }
498}
499
500#[cfg(target_os = "fuchsia")]
501impl From<InterfaceSynchronousProxy> for zx::NullableHandle {
502 fn from(value: InterfaceSynchronousProxy) -> Self {
503 value.into_channel().into()
504 }
505}
506
507#[cfg(target_os = "fuchsia")]
508impl From<fidl::Channel> for InterfaceSynchronousProxy {
509 fn from(value: fidl::Channel) -> Self {
510 Self::new(value)
511 }
512}
513
514#[cfg(target_os = "fuchsia")]
515impl fidl::endpoints::FromClient for InterfaceSynchronousProxy {
516 type Protocol = InterfaceMarker;
517
518 fn from_client(value: fidl::endpoints::ClientEnd<InterfaceMarker>) -> Self {
519 Self::new(value.into_channel())
520 }
521}
522
523#[derive(Debug, Clone)]
524pub struct InterfaceProxy {
525 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
526}
527
528impl fidl::endpoints::Proxy for InterfaceProxy {
529 type Protocol = InterfaceMarker;
530
531 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
532 Self::new(inner)
533 }
534
535 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
536 self.client.into_channel().map_err(|client| Self { client })
537 }
538
539 fn as_channel(&self) -> &::fidl::AsyncChannel {
540 self.client.as_channel()
541 }
542}
543
544impl InterfaceProxy {
545 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
547 let protocol_name = <InterfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
548 Self { client: fidl::client::Client::new(channel, protocol_name) }
549 }
550
551 pub fn take_event_stream(&self) -> InterfaceEventStream {
557 InterfaceEventStream { event_receiver: self.client.take_event_receiver() }
558 }
559}
560
561impl InterfaceProxyInterface for InterfaceProxy {}
562
563pub struct InterfaceEventStream {
564 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
565}
566
567impl std::marker::Unpin for InterfaceEventStream {}
568
569impl futures::stream::FusedStream for InterfaceEventStream {
570 fn is_terminated(&self) -> bool {
571 self.event_receiver.is_terminated()
572 }
573}
574
575impl futures::Stream for InterfaceEventStream {
576 type Item = Result<InterfaceEvent, fidl::Error>;
577
578 fn poll_next(
579 mut self: std::pin::Pin<&mut Self>,
580 cx: &mut std::task::Context<'_>,
581 ) -> std::task::Poll<Option<Self::Item>> {
582 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
583 &mut self.event_receiver,
584 cx
585 )?) {
586 Some(buf) => std::task::Poll::Ready(Some(InterfaceEvent::decode(buf))),
587 None => std::task::Poll::Ready(None),
588 }
589 }
590}
591
592#[derive(Debug)]
593pub enum InterfaceEvent {
594 OnRemoved { reason: InterfaceRemovalReason },
595}
596
597impl InterfaceEvent {
598 #[allow(irrefutable_let_patterns)]
599 pub fn into_on_removed(self) -> Option<InterfaceRemovalReason> {
600 if let InterfaceEvent::OnRemoved { reason } = self { Some((reason)) } else { None }
601 }
602
603 fn decode(
605 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
606 ) -> Result<InterfaceEvent, fidl::Error> {
607 let (bytes, _handles) = buf.split_mut();
608 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
609 debug_assert_eq!(tx_header.tx_id, 0);
610 match tx_header.ordinal {
611 0x4785571ae39a2617 => {
612 let mut out = fidl::new_empty!(
613 InterfaceOnRemovedRequest,
614 fidl::encoding::DefaultFuchsiaResourceDialect
615 );
616 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InterfaceOnRemovedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
617 Ok((InterfaceEvent::OnRemoved { reason: out.reason }))
618 }
619 _ => Err(fidl::Error::UnknownOrdinal {
620 ordinal: tx_header.ordinal,
621 protocol_name: <InterfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
622 }),
623 }
624 }
625}
626
627pub struct InterfaceRequestStream {
629 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
630 is_terminated: bool,
631}
632
633impl std::marker::Unpin for InterfaceRequestStream {}
634
635impl futures::stream::FusedStream for InterfaceRequestStream {
636 fn is_terminated(&self) -> bool {
637 self.is_terminated
638 }
639}
640
641impl fidl::endpoints::RequestStream for InterfaceRequestStream {
642 type Protocol = InterfaceMarker;
643 type ControlHandle = InterfaceControlHandle;
644
645 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
646 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
647 }
648
649 fn control_handle(&self) -> Self::ControlHandle {
650 InterfaceControlHandle { inner: self.inner.clone() }
651 }
652
653 fn into_inner(
654 self,
655 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
656 {
657 (self.inner, self.is_terminated)
658 }
659
660 fn from_inner(
661 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
662 is_terminated: bool,
663 ) -> Self {
664 Self { inner, is_terminated }
665 }
666}
667
668impl futures::Stream for InterfaceRequestStream {
669 type Item = Result<InterfaceRequest, fidl::Error>;
670
671 fn poll_next(
672 mut self: std::pin::Pin<&mut Self>,
673 cx: &mut std::task::Context<'_>,
674 ) -> std::task::Poll<Option<Self::Item>> {
675 let this = &mut *self;
676 if this.inner.check_shutdown(cx) {
677 this.is_terminated = true;
678 return std::task::Poll::Ready(None);
679 }
680 if this.is_terminated {
681 panic!("polled InterfaceRequestStream after completion");
682 }
683 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
684 |bytes, handles| {
685 match this.inner.channel().read_etc(cx, bytes, handles) {
686 std::task::Poll::Ready(Ok(())) => {}
687 std::task::Poll::Pending => return std::task::Poll::Pending,
688 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
689 this.is_terminated = true;
690 return std::task::Poll::Ready(None);
691 }
692 std::task::Poll::Ready(Err(e)) => {
693 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
694 e.into(),
695 ))));
696 }
697 }
698
699 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
701
702 std::task::Poll::Ready(Some(match header.ordinal {
703 _ => Err(fidl::Error::UnknownOrdinal {
704 ordinal: header.ordinal,
705 protocol_name:
706 <InterfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
707 }),
708 }))
709 },
710 )
711 }
712}
713
714#[derive(Debug)]
723pub enum InterfaceRequest {}
724
725impl InterfaceRequest {
726 pub fn method_name(&self) -> &'static str {
728 match *self {}
729 }
730}
731
732#[derive(Debug, Clone)]
733pub struct InterfaceControlHandle {
734 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
735}
736
737impl InterfaceControlHandle {
738 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
739 self.inner.shutdown_with_epitaph(status.into())
740 }
741}
742
743impl fidl::endpoints::ControlHandle for InterfaceControlHandle {
744 fn shutdown(&self) {
745 self.inner.shutdown()
746 }
747
748 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
749 self.inner.shutdown_with_epitaph(status)
750 }
751
752 fn is_closed(&self) -> bool {
753 self.inner.channel().is_closed()
754 }
755 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
756 self.inner.channel().on_closed()
757 }
758
759 #[cfg(target_os = "fuchsia")]
760 fn signal_peer(
761 &self,
762 clear_mask: zx::Signals,
763 set_mask: zx::Signals,
764 ) -> Result<(), zx_status::Status> {
765 use fidl::Peered;
766 self.inner.channel().signal_peer(clear_mask, set_mask)
767 }
768}
769
770impl InterfaceControlHandle {
771 pub fn send_on_removed(&self, mut reason: InterfaceRemovalReason) -> Result<(), fidl::Error> {
772 self.inner.send::<InterfaceOnRemovedRequest>(
773 (reason,),
774 0,
775 0x4785571ae39a2617,
776 fidl::encoding::DynamicFlags::empty(),
777 )
778 }
779}
780
781#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
782pub struct NetworkMarker;
783
784impl fidl::endpoints::ProtocolMarker for NetworkMarker {
785 type Proxy = NetworkProxy;
786 type RequestStream = NetworkRequestStream;
787 #[cfg(target_os = "fuchsia")]
788 type SynchronousProxy = NetworkSynchronousProxy;
789
790 const DEBUG_NAME: &'static str = "(anonymous) Network";
791}
792
793pub trait NetworkProxyInterface: Send + Sync {
794 fn r#add_port(
795 &self,
796 port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
797 interface: fidl::endpoints::ServerEnd<InterfaceMarker>,
798 ) -> Result<(), fidl::Error>;
799}
800#[derive(Debug)]
801#[cfg(target_os = "fuchsia")]
802pub struct NetworkSynchronousProxy {
803 client: fidl::client::sync::Client,
804}
805
806#[cfg(target_os = "fuchsia")]
807impl fidl::endpoints::SynchronousProxy for NetworkSynchronousProxy {
808 type Proxy = NetworkProxy;
809 type Protocol = NetworkMarker;
810
811 fn from_channel(inner: fidl::Channel) -> Self {
812 Self::new(inner)
813 }
814
815 fn into_channel(self) -> fidl::Channel {
816 self.client.into_channel()
817 }
818
819 fn as_channel(&self) -> &fidl::Channel {
820 self.client.as_channel()
821 }
822}
823
824#[cfg(target_os = "fuchsia")]
825impl NetworkSynchronousProxy {
826 pub fn new(channel: fidl::Channel) -> Self {
827 Self { client: fidl::client::sync::Client::new(channel) }
828 }
829
830 pub fn into_channel(self) -> fidl::Channel {
831 self.client.into_channel()
832 }
833
834 pub fn wait_for_event(
837 &self,
838 deadline: zx::MonotonicInstant,
839 ) -> Result<NetworkEvent, fidl::Error> {
840 NetworkEvent::decode(self.client.wait_for_event::<NetworkMarker>(deadline)?)
841 }
842
843 pub fn r#add_port(
848 &self,
849 mut port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
850 mut interface: fidl::endpoints::ServerEnd<InterfaceMarker>,
851 ) -> Result<(), fidl::Error> {
852 self.client.send::<NetworkAddPortRequest>(
853 (port, interface),
854 0x7ad6a60c931a3f4e,
855 fidl::encoding::DynamicFlags::empty(),
856 )
857 }
858}
859
860#[cfg(target_os = "fuchsia")]
861impl From<NetworkSynchronousProxy> for zx::NullableHandle {
862 fn from(value: NetworkSynchronousProxy) -> Self {
863 value.into_channel().into()
864 }
865}
866
867#[cfg(target_os = "fuchsia")]
868impl From<fidl::Channel> for NetworkSynchronousProxy {
869 fn from(value: fidl::Channel) -> Self {
870 Self::new(value)
871 }
872}
873
874#[cfg(target_os = "fuchsia")]
875impl fidl::endpoints::FromClient for NetworkSynchronousProxy {
876 type Protocol = NetworkMarker;
877
878 fn from_client(value: fidl::endpoints::ClientEnd<NetworkMarker>) -> Self {
879 Self::new(value.into_channel())
880 }
881}
882
883#[derive(Debug, Clone)]
884pub struct NetworkProxy {
885 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
886}
887
888impl fidl::endpoints::Proxy for NetworkProxy {
889 type Protocol = NetworkMarker;
890
891 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
892 Self::new(inner)
893 }
894
895 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
896 self.client.into_channel().map_err(|client| Self { client })
897 }
898
899 fn as_channel(&self) -> &::fidl::AsyncChannel {
900 self.client.as_channel()
901 }
902}
903
904impl NetworkProxy {
905 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
907 let protocol_name = <NetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
908 Self { client: fidl::client::Client::new(channel, protocol_name) }
909 }
910
911 pub fn take_event_stream(&self) -> NetworkEventStream {
917 NetworkEventStream { event_receiver: self.client.take_event_receiver() }
918 }
919
920 pub fn r#add_port(
925 &self,
926 mut port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
927 mut interface: fidl::endpoints::ServerEnd<InterfaceMarker>,
928 ) -> Result<(), fidl::Error> {
929 NetworkProxyInterface::r#add_port(self, port, interface)
930 }
931}
932
933impl NetworkProxyInterface for NetworkProxy {
934 fn r#add_port(
935 &self,
936 mut port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
937 mut interface: fidl::endpoints::ServerEnd<InterfaceMarker>,
938 ) -> Result<(), fidl::Error> {
939 self.client.send::<NetworkAddPortRequest>(
940 (port, interface),
941 0x7ad6a60c931a3f4e,
942 fidl::encoding::DynamicFlags::empty(),
943 )
944 }
945}
946
947pub struct NetworkEventStream {
948 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
949}
950
951impl std::marker::Unpin for NetworkEventStream {}
952
953impl futures::stream::FusedStream for NetworkEventStream {
954 fn is_terminated(&self) -> bool {
955 self.event_receiver.is_terminated()
956 }
957}
958
959impl futures::Stream for NetworkEventStream {
960 type Item = Result<NetworkEvent, fidl::Error>;
961
962 fn poll_next(
963 mut self: std::pin::Pin<&mut Self>,
964 cx: &mut std::task::Context<'_>,
965 ) -> std::task::Poll<Option<Self::Item>> {
966 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
967 &mut self.event_receiver,
968 cx
969 )?) {
970 Some(buf) => std::task::Poll::Ready(Some(NetworkEvent::decode(buf))),
971 None => std::task::Poll::Ready(None),
972 }
973 }
974}
975
976#[derive(Debug)]
977pub enum NetworkEvent {
978 OnRemoved { reason: NetworkRemovalReason },
979}
980
981impl NetworkEvent {
982 #[allow(irrefutable_let_patterns)]
983 pub fn into_on_removed(self) -> Option<NetworkRemovalReason> {
984 if let NetworkEvent::OnRemoved { reason } = self { Some((reason)) } else { None }
985 }
986
987 fn decode(
989 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
990 ) -> Result<NetworkEvent, fidl::Error> {
991 let (bytes, _handles) = buf.split_mut();
992 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
993 debug_assert_eq!(tx_header.tx_id, 0);
994 match tx_header.ordinal {
995 0xfe80656d1e5ec4a => {
996 let mut out = fidl::new_empty!(
997 NetworkOnRemovedRequest,
998 fidl::encoding::DefaultFuchsiaResourceDialect
999 );
1000 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkOnRemovedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1001 Ok((NetworkEvent::OnRemoved { reason: out.reason }))
1002 }
1003 _ => Err(fidl::Error::UnknownOrdinal {
1004 ordinal: tx_header.ordinal,
1005 protocol_name: <NetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1006 }),
1007 }
1008 }
1009}
1010
1011pub struct NetworkRequestStream {
1013 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1014 is_terminated: bool,
1015}
1016
1017impl std::marker::Unpin for NetworkRequestStream {}
1018
1019impl futures::stream::FusedStream for NetworkRequestStream {
1020 fn is_terminated(&self) -> bool {
1021 self.is_terminated
1022 }
1023}
1024
1025impl fidl::endpoints::RequestStream for NetworkRequestStream {
1026 type Protocol = NetworkMarker;
1027 type ControlHandle = NetworkControlHandle;
1028
1029 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1030 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1031 }
1032
1033 fn control_handle(&self) -> Self::ControlHandle {
1034 NetworkControlHandle { inner: self.inner.clone() }
1035 }
1036
1037 fn into_inner(
1038 self,
1039 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1040 {
1041 (self.inner, self.is_terminated)
1042 }
1043
1044 fn from_inner(
1045 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1046 is_terminated: bool,
1047 ) -> Self {
1048 Self { inner, is_terminated }
1049 }
1050}
1051
1052impl futures::Stream for NetworkRequestStream {
1053 type Item = Result<NetworkRequest, fidl::Error>;
1054
1055 fn poll_next(
1056 mut self: std::pin::Pin<&mut Self>,
1057 cx: &mut std::task::Context<'_>,
1058 ) -> std::task::Poll<Option<Self::Item>> {
1059 let this = &mut *self;
1060 if this.inner.check_shutdown(cx) {
1061 this.is_terminated = true;
1062 return std::task::Poll::Ready(None);
1063 }
1064 if this.is_terminated {
1065 panic!("polled NetworkRequestStream after completion");
1066 }
1067 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1068 |bytes, handles| {
1069 match this.inner.channel().read_etc(cx, bytes, handles) {
1070 std::task::Poll::Ready(Ok(())) => {}
1071 std::task::Poll::Pending => return std::task::Poll::Pending,
1072 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1073 this.is_terminated = true;
1074 return std::task::Poll::Ready(None);
1075 }
1076 std::task::Poll::Ready(Err(e)) => {
1077 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1078 e.into(),
1079 ))));
1080 }
1081 }
1082
1083 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1085
1086 std::task::Poll::Ready(Some(match header.ordinal {
1087 0x7ad6a60c931a3f4e => {
1088 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1089 let mut req = fidl::new_empty!(
1090 NetworkAddPortRequest,
1091 fidl::encoding::DefaultFuchsiaResourceDialect
1092 );
1093 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkAddPortRequest>(&header, _body_bytes, handles, &mut req)?;
1094 let control_handle = NetworkControlHandle { inner: this.inner.clone() };
1095 Ok(NetworkRequest::AddPort {
1096 port: req.port,
1097 interface: req.interface,
1098
1099 control_handle,
1100 })
1101 }
1102 _ => Err(fidl::Error::UnknownOrdinal {
1103 ordinal: header.ordinal,
1104 protocol_name:
1105 <NetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1106 }),
1107 }))
1108 },
1109 )
1110 }
1111}
1112
1113#[derive(Debug)]
1123pub enum NetworkRequest {
1124 AddPort {
1129 port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
1130 interface: fidl::endpoints::ServerEnd<InterfaceMarker>,
1131 control_handle: NetworkControlHandle,
1132 },
1133}
1134
1135impl NetworkRequest {
1136 #[allow(irrefutable_let_patterns)]
1137 pub fn into_add_port(
1138 self,
1139 ) -> Option<(
1140 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
1141 fidl::endpoints::ServerEnd<InterfaceMarker>,
1142 NetworkControlHandle,
1143 )> {
1144 if let NetworkRequest::AddPort { port, interface, control_handle } = self {
1145 Some((port, interface, control_handle))
1146 } else {
1147 None
1148 }
1149 }
1150
1151 pub fn method_name(&self) -> &'static str {
1153 match *self {
1154 NetworkRequest::AddPort { .. } => "add_port",
1155 }
1156 }
1157}
1158
1159#[derive(Debug, Clone)]
1160pub struct NetworkControlHandle {
1161 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1162}
1163
1164impl NetworkControlHandle {
1165 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1166 self.inner.shutdown_with_epitaph(status.into())
1167 }
1168}
1169
1170impl fidl::endpoints::ControlHandle for NetworkControlHandle {
1171 fn shutdown(&self) {
1172 self.inner.shutdown()
1173 }
1174
1175 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1176 self.inner.shutdown_with_epitaph(status)
1177 }
1178
1179 fn is_closed(&self) -> bool {
1180 self.inner.channel().is_closed()
1181 }
1182 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1183 self.inner.channel().on_closed()
1184 }
1185
1186 #[cfg(target_os = "fuchsia")]
1187 fn signal_peer(
1188 &self,
1189 clear_mask: zx::Signals,
1190 set_mask: zx::Signals,
1191 ) -> Result<(), zx_status::Status> {
1192 use fidl::Peered;
1193 self.inner.channel().signal_peer(clear_mask, set_mask)
1194 }
1195}
1196
1197impl NetworkControlHandle {
1198 pub fn send_on_removed(&self, mut reason: NetworkRemovalReason) -> Result<(), fidl::Error> {
1199 self.inner.send::<NetworkOnRemovedRequest>(
1200 (reason,),
1201 0,
1202 0xfe80656d1e5ec4a,
1203 fidl::encoding::DynamicFlags::empty(),
1204 )
1205 }
1206}
1207
1208mod internal {
1209 use super::*;
1210
1211 impl fidl::encoding::ResourceTypeMarker for ControlCreateNetworkRequest {
1212 type Borrowed<'a> = &'a mut Self;
1213 fn take_or_borrow<'a>(
1214 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1215 ) -> Self::Borrowed<'a> {
1216 value
1217 }
1218 }
1219
1220 unsafe impl fidl::encoding::TypeMarker for ControlCreateNetworkRequest {
1221 type Owned = Self;
1222
1223 #[inline(always)]
1224 fn inline_align(_context: fidl::encoding::Context) -> usize {
1225 8
1226 }
1227
1228 #[inline(always)]
1229 fn inline_size(_context: fidl::encoding::Context) -> usize {
1230 24
1231 }
1232 }
1233
1234 unsafe impl
1235 fidl::encoding::Encode<
1236 ControlCreateNetworkRequest,
1237 fidl::encoding::DefaultFuchsiaResourceDialect,
1238 > for &mut ControlCreateNetworkRequest
1239 {
1240 #[inline]
1241 unsafe fn encode(
1242 self,
1243 encoder: &mut fidl::encoding::Encoder<
1244 '_,
1245 fidl::encoding::DefaultFuchsiaResourceDialect,
1246 >,
1247 offset: usize,
1248 _depth: fidl::encoding::Depth,
1249 ) -> fidl::Result<()> {
1250 encoder.debug_check_bounds::<ControlCreateNetworkRequest>(offset);
1251 fidl::encoding::Encode::<ControlCreateNetworkRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1253 (
1254 <Config as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
1255 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.network),
1256 ),
1257 encoder, offset, _depth
1258 )
1259 }
1260 }
1261 unsafe impl<
1262 T0: fidl::encoding::Encode<Config, fidl::encoding::DefaultFuchsiaResourceDialect>,
1263 T1: fidl::encoding::Encode<
1264 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkMarker>>,
1265 fidl::encoding::DefaultFuchsiaResourceDialect,
1266 >,
1267 >
1268 fidl::encoding::Encode<
1269 ControlCreateNetworkRequest,
1270 fidl::encoding::DefaultFuchsiaResourceDialect,
1271 > for (T0, T1)
1272 {
1273 #[inline]
1274 unsafe fn encode(
1275 self,
1276 encoder: &mut fidl::encoding::Encoder<
1277 '_,
1278 fidl::encoding::DefaultFuchsiaResourceDialect,
1279 >,
1280 offset: usize,
1281 depth: fidl::encoding::Depth,
1282 ) -> fidl::Result<()> {
1283 encoder.debug_check_bounds::<ControlCreateNetworkRequest>(offset);
1284 unsafe {
1287 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1288 (ptr as *mut u64).write_unaligned(0);
1289 }
1290 self.0.encode(encoder, offset + 0, depth)?;
1292 self.1.encode(encoder, offset + 16, depth)?;
1293 Ok(())
1294 }
1295 }
1296
1297 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1298 for ControlCreateNetworkRequest
1299 {
1300 #[inline(always)]
1301 fn new_empty() -> Self {
1302 Self {
1303 config: fidl::new_empty!(Config, fidl::encoding::DefaultFuchsiaResourceDialect),
1304 network: fidl::new_empty!(
1305 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkMarker>>,
1306 fidl::encoding::DefaultFuchsiaResourceDialect
1307 ),
1308 }
1309 }
1310
1311 #[inline]
1312 unsafe fn decode(
1313 &mut self,
1314 decoder: &mut fidl::encoding::Decoder<
1315 '_,
1316 fidl::encoding::DefaultFuchsiaResourceDialect,
1317 >,
1318 offset: usize,
1319 _depth: fidl::encoding::Depth,
1320 ) -> fidl::Result<()> {
1321 decoder.debug_check_bounds::<Self>(offset);
1322 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1324 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1325 let mask = 0xffffffff00000000u64;
1326 let maskedval = padval & mask;
1327 if maskedval != 0 {
1328 return Err(fidl::Error::NonZeroPadding {
1329 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1330 });
1331 }
1332 fidl::decode!(
1333 Config,
1334 fidl::encoding::DefaultFuchsiaResourceDialect,
1335 &mut self.config,
1336 decoder,
1337 offset + 0,
1338 _depth
1339 )?;
1340 fidl::decode!(
1341 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkMarker>>,
1342 fidl::encoding::DefaultFuchsiaResourceDialect,
1343 &mut self.network,
1344 decoder,
1345 offset + 16,
1346 _depth
1347 )?;
1348 Ok(())
1349 }
1350 }
1351
1352 impl fidl::encoding::ResourceTypeMarker for NetworkAddPortRequest {
1353 type Borrowed<'a> = &'a mut Self;
1354 fn take_or_borrow<'a>(
1355 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1356 ) -> Self::Borrowed<'a> {
1357 value
1358 }
1359 }
1360
1361 unsafe impl fidl::encoding::TypeMarker for NetworkAddPortRequest {
1362 type Owned = Self;
1363
1364 #[inline(always)]
1365 fn inline_align(_context: fidl::encoding::Context) -> usize {
1366 4
1367 }
1368
1369 #[inline(always)]
1370 fn inline_size(_context: fidl::encoding::Context) -> usize {
1371 8
1372 }
1373 }
1374
1375 unsafe impl
1376 fidl::encoding::Encode<NetworkAddPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1377 for &mut NetworkAddPortRequest
1378 {
1379 #[inline]
1380 unsafe fn encode(
1381 self,
1382 encoder: &mut fidl::encoding::Encoder<
1383 '_,
1384 fidl::encoding::DefaultFuchsiaResourceDialect,
1385 >,
1386 offset: usize,
1387 _depth: fidl::encoding::Depth,
1388 ) -> fidl::Result<()> {
1389 encoder.debug_check_bounds::<NetworkAddPortRequest>(offset);
1390 fidl::encoding::Encode::<NetworkAddPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1392 (
1393 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.port),
1394 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InterfaceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.interface),
1395 ),
1396 encoder, offset, _depth
1397 )
1398 }
1399 }
1400 unsafe impl<
1401 T0: fidl::encoding::Encode<
1402 fidl::encoding::Endpoint<
1403 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
1404 >,
1405 fidl::encoding::DefaultFuchsiaResourceDialect,
1406 >,
1407 T1: fidl::encoding::Encode<
1408 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InterfaceMarker>>,
1409 fidl::encoding::DefaultFuchsiaResourceDialect,
1410 >,
1411 >
1412 fidl::encoding::Encode<NetworkAddPortRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1413 for (T0, T1)
1414 {
1415 #[inline]
1416 unsafe fn encode(
1417 self,
1418 encoder: &mut fidl::encoding::Encoder<
1419 '_,
1420 fidl::encoding::DefaultFuchsiaResourceDialect,
1421 >,
1422 offset: usize,
1423 depth: fidl::encoding::Depth,
1424 ) -> fidl::Result<()> {
1425 encoder.debug_check_bounds::<NetworkAddPortRequest>(offset);
1426 self.0.encode(encoder, offset + 0, depth)?;
1430 self.1.encode(encoder, offset + 4, depth)?;
1431 Ok(())
1432 }
1433 }
1434
1435 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1436 for NetworkAddPortRequest
1437 {
1438 #[inline(always)]
1439 fn new_empty() -> Self {
1440 Self {
1441 port: fidl::new_empty!(
1442 fidl::encoding::Endpoint<
1443 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
1444 >,
1445 fidl::encoding::DefaultFuchsiaResourceDialect
1446 ),
1447 interface: fidl::new_empty!(
1448 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InterfaceMarker>>,
1449 fidl::encoding::DefaultFuchsiaResourceDialect
1450 ),
1451 }
1452 }
1453
1454 #[inline]
1455 unsafe fn decode(
1456 &mut self,
1457 decoder: &mut fidl::encoding::Decoder<
1458 '_,
1459 fidl::encoding::DefaultFuchsiaResourceDialect,
1460 >,
1461 offset: usize,
1462 _depth: fidl::encoding::Depth,
1463 ) -> fidl::Result<()> {
1464 decoder.debug_check_bounds::<Self>(offset);
1465 fidl::decode!(
1467 fidl::encoding::Endpoint<
1468 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
1469 >,
1470 fidl::encoding::DefaultFuchsiaResourceDialect,
1471 &mut self.port,
1472 decoder,
1473 offset + 0,
1474 _depth
1475 )?;
1476 fidl::decode!(
1477 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InterfaceMarker>>,
1478 fidl::encoding::DefaultFuchsiaResourceDialect,
1479 &mut self.interface,
1480 decoder,
1481 offset + 4,
1482 _depth
1483 )?;
1484 Ok(())
1485 }
1486 }
1487}