fidl_fuchsia_netemul_network/
fidl_fuchsia_netemul_network.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13pub const MAX_NAME_LENGTH: u32 = 256;
14
15#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16pub struct DeviceProxyServeControllerRequest {
17    pub req: fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for DeviceProxyServeControllerRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct DeviceProxyServeDeviceRequest {
27    pub req: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for DeviceProxyServeDeviceRequest
32{
33}
34
35/// Configuration used to create an endpoint.
36#[derive(Clone, Debug, PartialEq)]
37pub struct EndpointConfig {
38    /// Fake ethernet mtu.
39    pub mtu: u16,
40    /// Fake ethernet mac address, if not provided will be set to randomized local mac,
41    /// using endpoint name as seed.
42    pub mac: Option<Box<fidl_fuchsia_net::MacAddress>>,
43    /// Port class of the endpoint.
44    pub port_class: fidl_fuchsia_hardware_network::PortClass,
45}
46
47impl fidl::Persistable for EndpointConfig {}
48
49#[derive(Clone, Debug, PartialEq)]
50pub struct EndpointGetConfigResponse {
51    pub config: EndpointConfig,
52}
53
54impl fidl::Persistable for EndpointGetConfigResponse {}
55
56#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
57pub struct EndpointGetNameResponse {
58    pub name: String,
59}
60
61impl fidl::Persistable for EndpointGetNameResponse {}
62
63#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
64pub struct EndpointGetPortRequest {
65    pub port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
66}
67
68impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EndpointGetPortRequest {}
69
70#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
71pub struct EndpointGetProxyRequest {
72    pub proxy: fidl::endpoints::ServerEnd<DeviceProxy_Marker>,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EndpointGetProxyRequest {}
76
77#[derive(Clone, Debug, PartialEq)]
78pub struct EndpointManagerCreateEndpointRequest {
79    pub name: String,
80    pub config: EndpointConfig,
81}
82
83impl fidl::Persistable for EndpointManagerCreateEndpointRequest {}
84
85#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86pub struct EndpointManagerCreateEndpointResponse {
87    pub status: i32,
88    pub endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
89}
90
91impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
92    for EndpointManagerCreateEndpointResponse
93{
94}
95
96#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
97pub struct EndpointManagerGetEndpointRequest {
98    pub name: String,
99}
100
101impl fidl::Persistable for EndpointManagerGetEndpointRequest {}
102
103#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
104pub struct EndpointManagerGetEndpointResponse {
105    pub endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
106}
107
108impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
109    for EndpointManagerGetEndpointResponse
110{
111}
112
113#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
114pub struct EndpointManagerListEndpointsResponse {
115    pub endp: Vec<String>,
116}
117
118impl fidl::Persistable for EndpointManagerListEndpointsResponse {}
119
120#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
121pub struct EndpointSetLinkUpRequest {
122    pub up: bool,
123}
124
125impl fidl::Persistable for EndpointSetLinkUpRequest {}
126
127/// Convenience struct for creating endpoints along with network setup.
128#[derive(Clone, Debug, PartialEq)]
129pub struct EndpointSetup {
130    /// Endpoint name, must be unique in network context.
131    pub name: String,
132    /// Optional endpoint config, if not provided defaults will be used. Default
133    /// values are: mtu = 1500,  mac = randomized, port_class = Virtual.
134    pub config: Option<Box<EndpointConfig>>,
135    /// Start endpoint with link status up.
136    pub link_up: bool,
137}
138
139impl fidl::Persistable for EndpointSetup {}
140
141#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
142pub struct FakeEndpointReadResponse {
143    pub data: Vec<u8>,
144    pub dropped_frames: u64,
145}
146
147impl fidl::Persistable for FakeEndpointReadResponse {}
148
149#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
150pub struct FakeEndpointWriteRequest {
151    pub data: Vec<u8>,
152}
153
154impl fidl::Persistable for FakeEndpointWriteRequest {}
155
156/// Provides emulated latency configuration.
157#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
158#[repr(C)]
159pub struct LatencyConfig {
160    /// Average latency, in ms.
161    pub average: u64,
162    /// Latency standard deviation, in ms.
163    pub std_dev: u64,
164}
165
166impl fidl::Persistable for LatencyConfig {}
167
168#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
169pub struct NetworkAttachEndpointRequest {
170    pub name: String,
171}
172
173impl fidl::Persistable for NetworkAttachEndpointRequest {}
174
175#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
176#[repr(C)]
177pub struct NetworkAttachEndpointResponse {
178    pub status: i32,
179}
180
181impl fidl::Persistable for NetworkAttachEndpointResponse {}
182
183#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
184pub struct NetworkContextCloneRequest {
185    pub network_context: fidl::endpoints::ServerEnd<NetworkContextMarker>,
186}
187
188impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
189    for NetworkContextCloneRequest
190{
191}
192
193#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
194pub struct NetworkContextGetEndpointManagerRequest {
195    pub endp_manager: fidl::endpoints::ServerEnd<EndpointManagerMarker>,
196}
197
198impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
199    for NetworkContextGetEndpointManagerRequest
200{
201}
202
203#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
204pub struct NetworkContextGetNetworkManagerRequest {
205    pub net_manager: fidl::endpoints::ServerEnd<NetworkManagerMarker>,
206}
207
208impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
209    for NetworkContextGetNetworkManagerRequest
210{
211}
212
213#[derive(Clone, Debug, PartialEq)]
214pub struct NetworkContextSetupRequest {
215    pub networks: Vec<NetworkSetup>,
216}
217
218impl fidl::Persistable for NetworkContextSetupRequest {}
219
220#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
221pub struct NetworkContextSetupResponse {
222    pub status: i32,
223    pub setup_handle: Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
224}
225
226impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
227    for NetworkContextSetupResponse
228{
229}
230
231#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
232pub struct NetworkCreateFakeEndpointRequest {
233    pub ep: fidl::endpoints::ServerEnd<FakeEndpointMarker>,
234}
235
236impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
237    for NetworkCreateFakeEndpointRequest
238{
239}
240
241#[derive(Clone, Debug, PartialEq)]
242pub struct NetworkGetConfigResponse {
243    pub config: NetworkConfig,
244}
245
246impl fidl::Persistable for NetworkGetConfigResponse {}
247
248#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
249pub struct NetworkGetNameResponse {
250    pub name: String,
251}
252
253impl fidl::Persistable for NetworkGetNameResponse {}
254
255#[derive(Clone, Debug, PartialEq)]
256pub struct NetworkManagerCreateNetworkRequest {
257    pub name: String,
258    pub config: NetworkConfig,
259}
260
261impl fidl::Persistable for NetworkManagerCreateNetworkRequest {}
262
263#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
264pub struct NetworkManagerCreateNetworkResponse {
265    pub status: i32,
266    pub net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
267}
268
269impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
270    for NetworkManagerCreateNetworkResponse
271{
272}
273
274#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
275pub struct NetworkManagerGetNetworkRequest {
276    pub name: String,
277}
278
279impl fidl::Persistable for NetworkManagerGetNetworkRequest {}
280
281#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
282pub struct NetworkManagerGetNetworkResponse {
283    pub net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
284}
285
286impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
287    for NetworkManagerGetNetworkResponse
288{
289}
290
291#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
292pub struct NetworkManagerListNetworksResponse {
293    pub nets: Vec<String>,
294}
295
296impl fidl::Persistable for NetworkManagerListNetworksResponse {}
297
298#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
299pub struct NetworkRemoveEndpointRequest {
300    pub name: String,
301}
302
303impl fidl::Persistable for NetworkRemoveEndpointRequest {}
304
305#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
306#[repr(C)]
307pub struct NetworkRemoveEndpointResponse {
308    pub status: i32,
309}
310
311impl fidl::Persistable for NetworkRemoveEndpointResponse {}
312
313#[derive(Clone, Debug, PartialEq)]
314pub struct NetworkSetConfigRequest {
315    pub config: NetworkConfig,
316}
317
318impl fidl::Persistable for NetworkSetConfigRequest {}
319
320#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
321#[repr(C)]
322pub struct NetworkSetConfigResponse {
323    pub status: i32,
324}
325
326impl fidl::Persistable for NetworkSetConfigResponse {}
327
328/// Convenience struct for creating entire network setups.
329#[derive(Clone, Debug, PartialEq)]
330pub struct NetworkSetup {
331    /// Network name, must be unique in network context.
332    pub name: String,
333    /// NetworkConfig to use when creating network.
334    pub config: NetworkConfig,
335    /// Collection of endpoints to create and attach to network.
336    pub endpoints: Vec<EndpointSetup>,
337}
338
339impl fidl::Persistable for NetworkSetup {}
340
341#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
342pub struct NetworkStartCaptureRequest {
343    pub name: String,
344}
345
346impl fidl::Persistable for NetworkStartCaptureRequest {}
347
348#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
349#[repr(C)]
350pub struct NetworkStartCaptureResponse {
351    pub status: i32,
352}
353
354impl fidl::Persistable for NetworkStartCaptureResponse {}
355
356/// Provides emulated packet reordering configuration.
357#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
358#[repr(C)]
359pub struct ReorderConfig {
360    /// Size of buffer, in packets, to store and forward with randomized order.
361    pub store_buff: u32,
362    /// Tick/deadline in ms to empty buffer, regardless of full state.
363    /// 0 will cause buffer to flush only when full (dangerous).
364    pub tick: u64,
365}
366
367impl fidl::Persistable for ReorderConfig {}
368
369/// Used to configure a network with emulated adversity conditions.
370#[derive(Clone, Debug, Default, PartialEq)]
371pub struct NetworkConfig {
372    /// Latency configuration.
373    pub latency: Option<LatencyConfig>,
374    /// Packet loss configuration.
375    pub packet_loss: Option<LossConfig>,
376    /// Packet reordering configuration.
377    pub reorder: Option<ReorderConfig>,
378    #[doc(hidden)]
379    pub __source_breaking: fidl::marker::SourceBreaking,
380}
381
382impl fidl::Persistable for NetworkConfig {}
383
384/// Provides emulated packet loss configuration.
385#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
386pub enum LossConfig {
387    /// Rate of packet loss expressed as independent drop probability [0-100].
388    RandomRate(u8),
389}
390
391impl LossConfig {
392    #[inline]
393    pub fn ordinal(&self) -> u64 {
394        match *self {
395            Self::RandomRate(_) => 1,
396        }
397    }
398
399    #[deprecated = "Strict unions should not use `is_unknown`"]
400    #[inline]
401    pub fn is_unknown(&self) -> bool {
402        false
403    }
404}
405
406impl fidl::Persistable for LossConfig {}
407
408#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
409pub struct DeviceProxy_Marker;
410
411impl fidl::endpoints::ProtocolMarker for DeviceProxy_Marker {
412    type Proxy = DeviceProxy_Proxy;
413    type RequestStream = DeviceProxy_RequestStream;
414    #[cfg(target_os = "fuchsia")]
415    type SynchronousProxy = DeviceProxy_SynchronousProxy;
416
417    const DEBUG_NAME: &'static str = "(anonymous) DeviceProxy_";
418}
419
420pub trait DeviceProxy_ProxyInterface: Send + Sync {
421    fn r#serve_controller(
422        &self,
423        req: fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
424    ) -> Result<(), fidl::Error>;
425    fn r#serve_device(
426        &self,
427        req: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
428    ) -> Result<(), fidl::Error>;
429}
430#[derive(Debug)]
431#[cfg(target_os = "fuchsia")]
432pub struct DeviceProxy_SynchronousProxy {
433    client: fidl::client::sync::Client,
434}
435
436#[cfg(target_os = "fuchsia")]
437impl fidl::endpoints::SynchronousProxy for DeviceProxy_SynchronousProxy {
438    type Proxy = DeviceProxy_Proxy;
439    type Protocol = DeviceProxy_Marker;
440
441    fn from_channel(inner: fidl::Channel) -> Self {
442        Self::new(inner)
443    }
444
445    fn into_channel(self) -> fidl::Channel {
446        self.client.into_channel()
447    }
448
449    fn as_channel(&self) -> &fidl::Channel {
450        self.client.as_channel()
451    }
452}
453
454#[cfg(target_os = "fuchsia")]
455impl DeviceProxy_SynchronousProxy {
456    pub fn new(channel: fidl::Channel) -> Self {
457        let protocol_name = <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
458        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
459    }
460
461    pub fn into_channel(self) -> fidl::Channel {
462        self.client.into_channel()
463    }
464
465    /// Waits until an event arrives and returns it. It is safe for other
466    /// threads to make concurrent requests while waiting for an event.
467    pub fn wait_for_event(
468        &self,
469        deadline: zx::MonotonicInstant,
470    ) -> Result<DeviceProxy_Event, fidl::Error> {
471        DeviceProxy_Event::decode(self.client.wait_for_event(deadline)?)
472    }
473
474    /// Serve the Controller protocol for this device.
475    pub fn r#serve_controller(
476        &self,
477        mut req: fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
478    ) -> Result<(), fidl::Error> {
479        self.client.send::<DeviceProxyServeControllerRequest>(
480            (req,),
481            0x326c17ad2d3879ee,
482            fidl::encoding::DynamicFlags::empty(),
483        )
484    }
485
486    /// Serve the device's FIDL protocol.
487    pub fn r#serve_device(
488        &self,
489        mut req: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
490    ) -> Result<(), fidl::Error> {
491        self.client.send::<DeviceProxyServeDeviceRequest>(
492            (req,),
493            0x645dae2573613288,
494            fidl::encoding::DynamicFlags::empty(),
495        )
496    }
497}
498
499#[derive(Debug, Clone)]
500pub struct DeviceProxy_Proxy {
501    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
502}
503
504impl fidl::endpoints::Proxy for DeviceProxy_Proxy {
505    type Protocol = DeviceProxy_Marker;
506
507    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
508        Self::new(inner)
509    }
510
511    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
512        self.client.into_channel().map_err(|client| Self { client })
513    }
514
515    fn as_channel(&self) -> &::fidl::AsyncChannel {
516        self.client.as_channel()
517    }
518}
519
520impl DeviceProxy_Proxy {
521    /// Create a new Proxy for fuchsia.netemul.network/DeviceProxy.
522    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
523        let protocol_name = <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
524        Self { client: fidl::client::Client::new(channel, protocol_name) }
525    }
526
527    /// Get a Stream of events from the remote end of the protocol.
528    ///
529    /// # Panics
530    ///
531    /// Panics if the event stream was already taken.
532    pub fn take_event_stream(&self) -> DeviceProxy_EventStream {
533        DeviceProxy_EventStream { event_receiver: self.client.take_event_receiver() }
534    }
535
536    /// Serve the Controller protocol for this device.
537    pub fn r#serve_controller(
538        &self,
539        mut req: fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
540    ) -> Result<(), fidl::Error> {
541        DeviceProxy_ProxyInterface::r#serve_controller(self, req)
542    }
543
544    /// Serve the device's FIDL protocol.
545    pub fn r#serve_device(
546        &self,
547        mut req: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
548    ) -> Result<(), fidl::Error> {
549        DeviceProxy_ProxyInterface::r#serve_device(self, req)
550    }
551}
552
553impl DeviceProxy_ProxyInterface for DeviceProxy_Proxy {
554    fn r#serve_controller(
555        &self,
556        mut req: fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
557    ) -> Result<(), fidl::Error> {
558        self.client.send::<DeviceProxyServeControllerRequest>(
559            (req,),
560            0x326c17ad2d3879ee,
561            fidl::encoding::DynamicFlags::empty(),
562        )
563    }
564
565    fn r#serve_device(
566        &self,
567        mut req: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
568    ) -> Result<(), fidl::Error> {
569        self.client.send::<DeviceProxyServeDeviceRequest>(
570            (req,),
571            0x645dae2573613288,
572            fidl::encoding::DynamicFlags::empty(),
573        )
574    }
575}
576
577pub struct DeviceProxy_EventStream {
578    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
579}
580
581impl std::marker::Unpin for DeviceProxy_EventStream {}
582
583impl futures::stream::FusedStream for DeviceProxy_EventStream {
584    fn is_terminated(&self) -> bool {
585        self.event_receiver.is_terminated()
586    }
587}
588
589impl futures::Stream for DeviceProxy_EventStream {
590    type Item = Result<DeviceProxy_Event, fidl::Error>;
591
592    fn poll_next(
593        mut self: std::pin::Pin<&mut Self>,
594        cx: &mut std::task::Context<'_>,
595    ) -> std::task::Poll<Option<Self::Item>> {
596        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
597            &mut self.event_receiver,
598            cx
599        )?) {
600            Some(buf) => std::task::Poll::Ready(Some(DeviceProxy_Event::decode(buf))),
601            None => std::task::Poll::Ready(None),
602        }
603    }
604}
605
606#[derive(Debug)]
607pub enum DeviceProxy_Event {}
608
609impl DeviceProxy_Event {
610    /// Decodes a message buffer as a [`DeviceProxy_Event`].
611    fn decode(
612        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
613    ) -> Result<DeviceProxy_Event, fidl::Error> {
614        let (bytes, _handles) = buf.split_mut();
615        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
616        debug_assert_eq!(tx_header.tx_id, 0);
617        match tx_header.ordinal {
618            _ => Err(fidl::Error::UnknownOrdinal {
619                ordinal: tx_header.ordinal,
620                protocol_name: <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
621            }),
622        }
623    }
624}
625
626/// A Stream of incoming requests for fuchsia.netemul.network/DeviceProxy.
627pub struct DeviceProxy_RequestStream {
628    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
629    is_terminated: bool,
630}
631
632impl std::marker::Unpin for DeviceProxy_RequestStream {}
633
634impl futures::stream::FusedStream for DeviceProxy_RequestStream {
635    fn is_terminated(&self) -> bool {
636        self.is_terminated
637    }
638}
639
640impl fidl::endpoints::RequestStream for DeviceProxy_RequestStream {
641    type Protocol = DeviceProxy_Marker;
642    type ControlHandle = DeviceProxy_ControlHandle;
643
644    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
645        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
646    }
647
648    fn control_handle(&self) -> Self::ControlHandle {
649        DeviceProxy_ControlHandle { inner: self.inner.clone() }
650    }
651
652    fn into_inner(
653        self,
654    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
655    {
656        (self.inner, self.is_terminated)
657    }
658
659    fn from_inner(
660        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
661        is_terminated: bool,
662    ) -> Self {
663        Self { inner, is_terminated }
664    }
665}
666
667impl futures::Stream for DeviceProxy_RequestStream {
668    type Item = Result<DeviceProxy_Request, fidl::Error>;
669
670    fn poll_next(
671        mut self: std::pin::Pin<&mut Self>,
672        cx: &mut std::task::Context<'_>,
673    ) -> std::task::Poll<Option<Self::Item>> {
674        let this = &mut *self;
675        if this.inner.check_shutdown(cx) {
676            this.is_terminated = true;
677            return std::task::Poll::Ready(None);
678        }
679        if this.is_terminated {
680            panic!("polled DeviceProxy_RequestStream after completion");
681        }
682        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
683            |bytes, handles| {
684                match this.inner.channel().read_etc(cx, bytes, handles) {
685                    std::task::Poll::Ready(Ok(())) => {}
686                    std::task::Poll::Pending => return std::task::Poll::Pending,
687                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
688                        this.is_terminated = true;
689                        return std::task::Poll::Ready(None);
690                    }
691                    std::task::Poll::Ready(Err(e)) => {
692                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
693                            e.into(),
694                        ))))
695                    }
696                }
697
698                // A message has been received from the channel
699                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
700
701                std::task::Poll::Ready(Some(match header.ordinal {
702                    0x326c17ad2d3879ee => {
703                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
704                        let mut req = fidl::new_empty!(
705                            DeviceProxyServeControllerRequest,
706                            fidl::encoding::DefaultFuchsiaResourceDialect
707                        );
708                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceProxyServeControllerRequest>(&header, _body_bytes, handles, &mut req)?;
709                        let control_handle =
710                            DeviceProxy_ControlHandle { inner: this.inner.clone() };
711                        Ok(DeviceProxy_Request::ServeController { req: req.req, control_handle })
712                    }
713                    0x645dae2573613288 => {
714                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
715                        let mut req = fidl::new_empty!(
716                            DeviceProxyServeDeviceRequest,
717                            fidl::encoding::DefaultFuchsiaResourceDialect
718                        );
719                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceProxyServeDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
720                        let control_handle =
721                            DeviceProxy_ControlHandle { inner: this.inner.clone() };
722                        Ok(DeviceProxy_Request::ServeDevice { req: req.req, control_handle })
723                    }
724                    _ => Err(fidl::Error::UnknownOrdinal {
725                        ordinal: header.ordinal,
726                        protocol_name:
727                            <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
728                    }),
729                }))
730            },
731        )
732    }
733}
734
735/// Simple interface to serve devices over fidl.
736#[derive(Debug)]
737pub enum DeviceProxy_Request {
738    /// Serve the Controller protocol for this device.
739    ServeController {
740        req: fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
741        control_handle: DeviceProxy_ControlHandle,
742    },
743    /// Serve the device's FIDL protocol.
744    ServeDevice {
745        req: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
746        control_handle: DeviceProxy_ControlHandle,
747    },
748}
749
750impl DeviceProxy_Request {
751    #[allow(irrefutable_let_patterns)]
752    pub fn into_serve_controller(
753        self,
754    ) -> Option<(
755        fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
756        DeviceProxy_ControlHandle,
757    )> {
758        if let DeviceProxy_Request::ServeController { req, control_handle } = self {
759            Some((req, control_handle))
760        } else {
761            None
762        }
763    }
764
765    #[allow(irrefutable_let_patterns)]
766    pub fn into_serve_device(
767        self,
768    ) -> Option<(
769        fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
770        DeviceProxy_ControlHandle,
771    )> {
772        if let DeviceProxy_Request::ServeDevice { req, control_handle } = self {
773            Some((req, control_handle))
774        } else {
775            None
776        }
777    }
778
779    /// Name of the method defined in FIDL
780    pub fn method_name(&self) -> &'static str {
781        match *self {
782            DeviceProxy_Request::ServeController { .. } => "serve_controller",
783            DeviceProxy_Request::ServeDevice { .. } => "serve_device",
784        }
785    }
786}
787
788#[derive(Debug, Clone)]
789pub struct DeviceProxy_ControlHandle {
790    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
791}
792
793impl fidl::endpoints::ControlHandle for DeviceProxy_ControlHandle {
794    fn shutdown(&self) {
795        self.inner.shutdown()
796    }
797    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
798        self.inner.shutdown_with_epitaph(status)
799    }
800
801    fn is_closed(&self) -> bool {
802        self.inner.channel().is_closed()
803    }
804    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
805        self.inner.channel().on_closed()
806    }
807
808    #[cfg(target_os = "fuchsia")]
809    fn signal_peer(
810        &self,
811        clear_mask: zx::Signals,
812        set_mask: zx::Signals,
813    ) -> Result<(), zx_status::Status> {
814        use fidl::Peered;
815        self.inner.channel().signal_peer(clear_mask, set_mask)
816    }
817}
818
819impl DeviceProxy_ControlHandle {}
820
821#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
822pub struct EndpointMarker;
823
824impl fidl::endpoints::ProtocolMarker for EndpointMarker {
825    type Proxy = EndpointProxy;
826    type RequestStream = EndpointRequestStream;
827    #[cfg(target_os = "fuchsia")]
828    type SynchronousProxy = EndpointSynchronousProxy;
829
830    const DEBUG_NAME: &'static str = "(anonymous) Endpoint";
831}
832
833pub trait EndpointProxyInterface: Send + Sync {
834    type GetConfigResponseFut: std::future::Future<Output = Result<EndpointConfig, fidl::Error>>
835        + Send;
836    fn r#get_config(&self) -> Self::GetConfigResponseFut;
837    type GetNameResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
838    fn r#get_name(&self) -> Self::GetNameResponseFut;
839    type SetLinkUpResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
840    fn r#set_link_up(&self, up: bool) -> Self::SetLinkUpResponseFut;
841    fn r#get_port(
842        &self,
843        port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
844    ) -> Result<(), fidl::Error>;
845    fn r#get_proxy_(
846        &self,
847        proxy: fidl::endpoints::ServerEnd<DeviceProxy_Marker>,
848    ) -> Result<(), fidl::Error>;
849}
850#[derive(Debug)]
851#[cfg(target_os = "fuchsia")]
852pub struct EndpointSynchronousProxy {
853    client: fidl::client::sync::Client,
854}
855
856#[cfg(target_os = "fuchsia")]
857impl fidl::endpoints::SynchronousProxy for EndpointSynchronousProxy {
858    type Proxy = EndpointProxy;
859    type Protocol = EndpointMarker;
860
861    fn from_channel(inner: fidl::Channel) -> Self {
862        Self::new(inner)
863    }
864
865    fn into_channel(self) -> fidl::Channel {
866        self.client.into_channel()
867    }
868
869    fn as_channel(&self) -> &fidl::Channel {
870        self.client.as_channel()
871    }
872}
873
874#[cfg(target_os = "fuchsia")]
875impl EndpointSynchronousProxy {
876    pub fn new(channel: fidl::Channel) -> Self {
877        let protocol_name = <EndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
878        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
879    }
880
881    pub fn into_channel(self) -> fidl::Channel {
882        self.client.into_channel()
883    }
884
885    /// Waits until an event arrives and returns it. It is safe for other
886    /// threads to make concurrent requests while waiting for an event.
887    pub fn wait_for_event(
888        &self,
889        deadline: zx::MonotonicInstant,
890    ) -> Result<EndpointEvent, fidl::Error> {
891        EndpointEvent::decode(self.client.wait_for_event(deadline)?)
892    }
893
894    pub fn r#get_config(
895        &self,
896        ___deadline: zx::MonotonicInstant,
897    ) -> Result<EndpointConfig, fidl::Error> {
898        let _response =
899            self.client.send_query::<fidl::encoding::EmptyPayload, EndpointGetConfigResponse>(
900                (),
901                0x3589f54aa3748539,
902                fidl::encoding::DynamicFlags::empty(),
903                ___deadline,
904            )?;
905        Ok(_response.config)
906    }
907
908    /// Gets endpoint name.
909    pub fn r#get_name(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
910        let _response =
911            self.client.send_query::<fidl::encoding::EmptyPayload, EndpointGetNameResponse>(
912                (),
913                0x7d69650823557aab,
914                fidl::encoding::DynamicFlags::empty(),
915                ___deadline,
916            )?;
917        Ok(_response.name)
918    }
919
920    /// Sends link up or down signal
921    pub fn r#set_link_up(
922        &self,
923        mut up: bool,
924        ___deadline: zx::MonotonicInstant,
925    ) -> Result<(), fidl::Error> {
926        let _response =
927            self.client.send_query::<EndpointSetLinkUpRequest, fidl::encoding::EmptyPayload>(
928                (up,),
929                0x4dde77de68d02e11,
930                fidl::encoding::DynamicFlags::empty(),
931                ___deadline,
932            )?;
933        Ok(_response)
934    }
935
936    /// Connects to the underlying device port.
937    pub fn r#get_port(
938        &self,
939        mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
940    ) -> Result<(), fidl::Error> {
941        self.client.send::<EndpointGetPortRequest>(
942            (port,),
943            0x68151e034eccc958,
944            fidl::encoding::DynamicFlags::empty(),
945        )
946    }
947
948    /// Gets a proxy to open requests with zircon ethernet device.
949    pub fn r#get_proxy_(
950        &self,
951        mut proxy: fidl::endpoints::ServerEnd<DeviceProxy_Marker>,
952    ) -> Result<(), fidl::Error> {
953        self.client.send::<EndpointGetProxyRequest>(
954            (proxy,),
955            0x476e5a57c4288ee9,
956            fidl::encoding::DynamicFlags::empty(),
957        )
958    }
959}
960
961#[derive(Debug, Clone)]
962pub struct EndpointProxy {
963    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
964}
965
966impl fidl::endpoints::Proxy for EndpointProxy {
967    type Protocol = EndpointMarker;
968
969    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
970        Self::new(inner)
971    }
972
973    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
974        self.client.into_channel().map_err(|client| Self { client })
975    }
976
977    fn as_channel(&self) -> &::fidl::AsyncChannel {
978        self.client.as_channel()
979    }
980}
981
982impl EndpointProxy {
983    /// Create a new Proxy for fuchsia.netemul.network/Endpoint.
984    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
985        let protocol_name = <EndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
986        Self { client: fidl::client::Client::new(channel, protocol_name) }
987    }
988
989    /// Get a Stream of events from the remote end of the protocol.
990    ///
991    /// # Panics
992    ///
993    /// Panics if the event stream was already taken.
994    pub fn take_event_stream(&self) -> EndpointEventStream {
995        EndpointEventStream { event_receiver: self.client.take_event_receiver() }
996    }
997
998    pub fn r#get_config(
999        &self,
1000    ) -> fidl::client::QueryResponseFut<EndpointConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
1001    {
1002        EndpointProxyInterface::r#get_config(self)
1003    }
1004
1005    /// Gets endpoint name.
1006    pub fn r#get_name(
1007        &self,
1008    ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
1009        EndpointProxyInterface::r#get_name(self)
1010    }
1011
1012    /// Sends link up or down signal
1013    pub fn r#set_link_up(
1014        &self,
1015        mut up: bool,
1016    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1017        EndpointProxyInterface::r#set_link_up(self, up)
1018    }
1019
1020    /// Connects to the underlying device port.
1021    pub fn r#get_port(
1022        &self,
1023        mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1024    ) -> Result<(), fidl::Error> {
1025        EndpointProxyInterface::r#get_port(self, port)
1026    }
1027
1028    /// Gets a proxy to open requests with zircon ethernet device.
1029    pub fn r#get_proxy_(
1030        &self,
1031        mut proxy: fidl::endpoints::ServerEnd<DeviceProxy_Marker>,
1032    ) -> Result<(), fidl::Error> {
1033        EndpointProxyInterface::r#get_proxy_(self, proxy)
1034    }
1035}
1036
1037impl EndpointProxyInterface for EndpointProxy {
1038    type GetConfigResponseFut = fidl::client::QueryResponseFut<
1039        EndpointConfig,
1040        fidl::encoding::DefaultFuchsiaResourceDialect,
1041    >;
1042    fn r#get_config(&self) -> Self::GetConfigResponseFut {
1043        fn _decode(
1044            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1045        ) -> Result<EndpointConfig, fidl::Error> {
1046            let _response = fidl::client::decode_transaction_body::<
1047                EndpointGetConfigResponse,
1048                fidl::encoding::DefaultFuchsiaResourceDialect,
1049                0x3589f54aa3748539,
1050            >(_buf?)?;
1051            Ok(_response.config)
1052        }
1053        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, EndpointConfig>(
1054            (),
1055            0x3589f54aa3748539,
1056            fidl::encoding::DynamicFlags::empty(),
1057            _decode,
1058        )
1059    }
1060
1061    type GetNameResponseFut =
1062        fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
1063    fn r#get_name(&self) -> Self::GetNameResponseFut {
1064        fn _decode(
1065            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1066        ) -> Result<String, fidl::Error> {
1067            let _response = fidl::client::decode_transaction_body::<
1068                EndpointGetNameResponse,
1069                fidl::encoding::DefaultFuchsiaResourceDialect,
1070                0x7d69650823557aab,
1071            >(_buf?)?;
1072            Ok(_response.name)
1073        }
1074        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
1075            (),
1076            0x7d69650823557aab,
1077            fidl::encoding::DynamicFlags::empty(),
1078            _decode,
1079        )
1080    }
1081
1082    type SetLinkUpResponseFut =
1083        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1084    fn r#set_link_up(&self, mut up: bool) -> Self::SetLinkUpResponseFut {
1085        fn _decode(
1086            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1087        ) -> Result<(), fidl::Error> {
1088            let _response = fidl::client::decode_transaction_body::<
1089                fidl::encoding::EmptyPayload,
1090                fidl::encoding::DefaultFuchsiaResourceDialect,
1091                0x4dde77de68d02e11,
1092            >(_buf?)?;
1093            Ok(_response)
1094        }
1095        self.client.send_query_and_decode::<EndpointSetLinkUpRequest, ()>(
1096            (up,),
1097            0x4dde77de68d02e11,
1098            fidl::encoding::DynamicFlags::empty(),
1099            _decode,
1100        )
1101    }
1102
1103    fn r#get_port(
1104        &self,
1105        mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1106    ) -> Result<(), fidl::Error> {
1107        self.client.send::<EndpointGetPortRequest>(
1108            (port,),
1109            0x68151e034eccc958,
1110            fidl::encoding::DynamicFlags::empty(),
1111        )
1112    }
1113
1114    fn r#get_proxy_(
1115        &self,
1116        mut proxy: fidl::endpoints::ServerEnd<DeviceProxy_Marker>,
1117    ) -> Result<(), fidl::Error> {
1118        self.client.send::<EndpointGetProxyRequest>(
1119            (proxy,),
1120            0x476e5a57c4288ee9,
1121            fidl::encoding::DynamicFlags::empty(),
1122        )
1123    }
1124}
1125
1126pub struct EndpointEventStream {
1127    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1128}
1129
1130impl std::marker::Unpin for EndpointEventStream {}
1131
1132impl futures::stream::FusedStream for EndpointEventStream {
1133    fn is_terminated(&self) -> bool {
1134        self.event_receiver.is_terminated()
1135    }
1136}
1137
1138impl futures::Stream for EndpointEventStream {
1139    type Item = Result<EndpointEvent, fidl::Error>;
1140
1141    fn poll_next(
1142        mut self: std::pin::Pin<&mut Self>,
1143        cx: &mut std::task::Context<'_>,
1144    ) -> std::task::Poll<Option<Self::Item>> {
1145        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1146            &mut self.event_receiver,
1147            cx
1148        )?) {
1149            Some(buf) => std::task::Poll::Ready(Some(EndpointEvent::decode(buf))),
1150            None => std::task::Poll::Ready(None),
1151        }
1152    }
1153}
1154
1155#[derive(Debug)]
1156pub enum EndpointEvent {}
1157
1158impl EndpointEvent {
1159    /// Decodes a message buffer as a [`EndpointEvent`].
1160    fn decode(
1161        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1162    ) -> Result<EndpointEvent, fidl::Error> {
1163        let (bytes, _handles) = buf.split_mut();
1164        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1165        debug_assert_eq!(tx_header.tx_id, 0);
1166        match tx_header.ordinal {
1167            _ => Err(fidl::Error::UnknownOrdinal {
1168                ordinal: tx_header.ordinal,
1169                protocol_name: <EndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1170            }),
1171        }
1172    }
1173}
1174
1175/// A Stream of incoming requests for fuchsia.netemul.network/Endpoint.
1176pub struct EndpointRequestStream {
1177    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1178    is_terminated: bool,
1179}
1180
1181impl std::marker::Unpin for EndpointRequestStream {}
1182
1183impl futures::stream::FusedStream for EndpointRequestStream {
1184    fn is_terminated(&self) -> bool {
1185        self.is_terminated
1186    }
1187}
1188
1189impl fidl::endpoints::RequestStream for EndpointRequestStream {
1190    type Protocol = EndpointMarker;
1191    type ControlHandle = EndpointControlHandle;
1192
1193    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1194        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1195    }
1196
1197    fn control_handle(&self) -> Self::ControlHandle {
1198        EndpointControlHandle { inner: self.inner.clone() }
1199    }
1200
1201    fn into_inner(
1202        self,
1203    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1204    {
1205        (self.inner, self.is_terminated)
1206    }
1207
1208    fn from_inner(
1209        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1210        is_terminated: bool,
1211    ) -> Self {
1212        Self { inner, is_terminated }
1213    }
1214}
1215
1216impl futures::Stream for EndpointRequestStream {
1217    type Item = Result<EndpointRequest, fidl::Error>;
1218
1219    fn poll_next(
1220        mut self: std::pin::Pin<&mut Self>,
1221        cx: &mut std::task::Context<'_>,
1222    ) -> std::task::Poll<Option<Self::Item>> {
1223        let this = &mut *self;
1224        if this.inner.check_shutdown(cx) {
1225            this.is_terminated = true;
1226            return std::task::Poll::Ready(None);
1227        }
1228        if this.is_terminated {
1229            panic!("polled EndpointRequestStream after completion");
1230        }
1231        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1232            |bytes, handles| {
1233                match this.inner.channel().read_etc(cx, bytes, handles) {
1234                    std::task::Poll::Ready(Ok(())) => {}
1235                    std::task::Poll::Pending => return std::task::Poll::Pending,
1236                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1237                        this.is_terminated = true;
1238                        return std::task::Poll::Ready(None);
1239                    }
1240                    std::task::Poll::Ready(Err(e)) => {
1241                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1242                            e.into(),
1243                        ))))
1244                    }
1245                }
1246
1247                // A message has been received from the channel
1248                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1249
1250                std::task::Poll::Ready(Some(match header.ordinal {
1251                    0x3589f54aa3748539 => {
1252                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1253                        let mut req = fidl::new_empty!(
1254                            fidl::encoding::EmptyPayload,
1255                            fidl::encoding::DefaultFuchsiaResourceDialect
1256                        );
1257                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1258                        let control_handle = EndpointControlHandle { inner: this.inner.clone() };
1259                        Ok(EndpointRequest::GetConfig {
1260                            responder: EndpointGetConfigResponder {
1261                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1262                                tx_id: header.tx_id,
1263                            },
1264                        })
1265                    }
1266                    0x7d69650823557aab => {
1267                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1268                        let mut req = fidl::new_empty!(
1269                            fidl::encoding::EmptyPayload,
1270                            fidl::encoding::DefaultFuchsiaResourceDialect
1271                        );
1272                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1273                        let control_handle = EndpointControlHandle { inner: this.inner.clone() };
1274                        Ok(EndpointRequest::GetName {
1275                            responder: EndpointGetNameResponder {
1276                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1277                                tx_id: header.tx_id,
1278                            },
1279                        })
1280                    }
1281                    0x4dde77de68d02e11 => {
1282                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1283                        let mut req = fidl::new_empty!(
1284                            EndpointSetLinkUpRequest,
1285                            fidl::encoding::DefaultFuchsiaResourceDialect
1286                        );
1287                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EndpointSetLinkUpRequest>(&header, _body_bytes, handles, &mut req)?;
1288                        let control_handle = EndpointControlHandle { inner: this.inner.clone() };
1289                        Ok(EndpointRequest::SetLinkUp {
1290                            up: req.up,
1291
1292                            responder: EndpointSetLinkUpResponder {
1293                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1294                                tx_id: header.tx_id,
1295                            },
1296                        })
1297                    }
1298                    0x68151e034eccc958 => {
1299                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1300                        let mut req = fidl::new_empty!(
1301                            EndpointGetPortRequest,
1302                            fidl::encoding::DefaultFuchsiaResourceDialect
1303                        );
1304                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EndpointGetPortRequest>(&header, _body_bytes, handles, &mut req)?;
1305                        let control_handle = EndpointControlHandle { inner: this.inner.clone() };
1306                        Ok(EndpointRequest::GetPort { port: req.port, control_handle })
1307                    }
1308                    0x476e5a57c4288ee9 => {
1309                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1310                        let mut req = fidl::new_empty!(
1311                            EndpointGetProxyRequest,
1312                            fidl::encoding::DefaultFuchsiaResourceDialect
1313                        );
1314                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EndpointGetProxyRequest>(&header, _body_bytes, handles, &mut req)?;
1315                        let control_handle = EndpointControlHandle { inner: this.inner.clone() };
1316                        Ok(EndpointRequest::GetProxy_ { proxy: req.proxy, control_handle })
1317                    }
1318                    _ => Err(fidl::Error::UnknownOrdinal {
1319                        ordinal: header.ordinal,
1320                        protocol_name:
1321                            <EndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1322                    }),
1323                }))
1324            },
1325        )
1326    }
1327}
1328
1329/// Virtual ethernet endpoint.
1330#[derive(Debug)]
1331pub enum EndpointRequest {
1332    GetConfig {
1333        responder: EndpointGetConfigResponder,
1334    },
1335    /// Gets endpoint name.
1336    GetName {
1337        responder: EndpointGetNameResponder,
1338    },
1339    /// Sends link up or down signal
1340    SetLinkUp {
1341        up: bool,
1342        responder: EndpointSetLinkUpResponder,
1343    },
1344    /// Connects to the underlying device port.
1345    GetPort {
1346        port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1347        control_handle: EndpointControlHandle,
1348    },
1349    /// Gets a proxy to open requests with zircon ethernet device.
1350    GetProxy_ {
1351        proxy: fidl::endpoints::ServerEnd<DeviceProxy_Marker>,
1352        control_handle: EndpointControlHandle,
1353    },
1354}
1355
1356impl EndpointRequest {
1357    #[allow(irrefutable_let_patterns)]
1358    pub fn into_get_config(self) -> Option<(EndpointGetConfigResponder)> {
1359        if let EndpointRequest::GetConfig { responder } = self {
1360            Some((responder))
1361        } else {
1362            None
1363        }
1364    }
1365
1366    #[allow(irrefutable_let_patterns)]
1367    pub fn into_get_name(self) -> Option<(EndpointGetNameResponder)> {
1368        if let EndpointRequest::GetName { responder } = self {
1369            Some((responder))
1370        } else {
1371            None
1372        }
1373    }
1374
1375    #[allow(irrefutable_let_patterns)]
1376    pub fn into_set_link_up(self) -> Option<(bool, EndpointSetLinkUpResponder)> {
1377        if let EndpointRequest::SetLinkUp { up, responder } = self {
1378            Some((up, responder))
1379        } else {
1380            None
1381        }
1382    }
1383
1384    #[allow(irrefutable_let_patterns)]
1385    pub fn into_get_port(
1386        self,
1387    ) -> Option<(
1388        fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1389        EndpointControlHandle,
1390    )> {
1391        if let EndpointRequest::GetPort { port, control_handle } = self {
1392            Some((port, control_handle))
1393        } else {
1394            None
1395        }
1396    }
1397
1398    #[allow(irrefutable_let_patterns)]
1399    pub fn into_get_proxy_(
1400        self,
1401    ) -> Option<(fidl::endpoints::ServerEnd<DeviceProxy_Marker>, EndpointControlHandle)> {
1402        if let EndpointRequest::GetProxy_ { proxy, control_handle } = self {
1403            Some((proxy, control_handle))
1404        } else {
1405            None
1406        }
1407    }
1408
1409    /// Name of the method defined in FIDL
1410    pub fn method_name(&self) -> &'static str {
1411        match *self {
1412            EndpointRequest::GetConfig { .. } => "get_config",
1413            EndpointRequest::GetName { .. } => "get_name",
1414            EndpointRequest::SetLinkUp { .. } => "set_link_up",
1415            EndpointRequest::GetPort { .. } => "get_port",
1416            EndpointRequest::GetProxy_ { .. } => "get_proxy_",
1417        }
1418    }
1419}
1420
1421#[derive(Debug, Clone)]
1422pub struct EndpointControlHandle {
1423    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1424}
1425
1426impl fidl::endpoints::ControlHandle for EndpointControlHandle {
1427    fn shutdown(&self) {
1428        self.inner.shutdown()
1429    }
1430    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1431        self.inner.shutdown_with_epitaph(status)
1432    }
1433
1434    fn is_closed(&self) -> bool {
1435        self.inner.channel().is_closed()
1436    }
1437    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1438        self.inner.channel().on_closed()
1439    }
1440
1441    #[cfg(target_os = "fuchsia")]
1442    fn signal_peer(
1443        &self,
1444        clear_mask: zx::Signals,
1445        set_mask: zx::Signals,
1446    ) -> Result<(), zx_status::Status> {
1447        use fidl::Peered;
1448        self.inner.channel().signal_peer(clear_mask, set_mask)
1449    }
1450}
1451
1452impl EndpointControlHandle {}
1453
1454#[must_use = "FIDL methods require a response to be sent"]
1455#[derive(Debug)]
1456pub struct EndpointGetConfigResponder {
1457    control_handle: std::mem::ManuallyDrop<EndpointControlHandle>,
1458    tx_id: u32,
1459}
1460
1461/// Set the the channel to be shutdown (see [`EndpointControlHandle::shutdown`])
1462/// if the responder is dropped without sending a response, so that the client
1463/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1464impl std::ops::Drop for EndpointGetConfigResponder {
1465    fn drop(&mut self) {
1466        self.control_handle.shutdown();
1467        // Safety: drops once, never accessed again
1468        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1469    }
1470}
1471
1472impl fidl::endpoints::Responder for EndpointGetConfigResponder {
1473    type ControlHandle = EndpointControlHandle;
1474
1475    fn control_handle(&self) -> &EndpointControlHandle {
1476        &self.control_handle
1477    }
1478
1479    fn drop_without_shutdown(mut self) {
1480        // Safety: drops once, never accessed again due to mem::forget
1481        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1482        // Prevent Drop from running (which would shut down the channel)
1483        std::mem::forget(self);
1484    }
1485}
1486
1487impl EndpointGetConfigResponder {
1488    /// Sends a response to the FIDL transaction.
1489    ///
1490    /// Sets the channel to shutdown if an error occurs.
1491    pub fn send(self, mut config: &EndpointConfig) -> Result<(), fidl::Error> {
1492        let _result = self.send_raw(config);
1493        if _result.is_err() {
1494            self.control_handle.shutdown();
1495        }
1496        self.drop_without_shutdown();
1497        _result
1498    }
1499
1500    /// Similar to "send" but does not shutdown the channel if an error occurs.
1501    pub fn send_no_shutdown_on_err(self, mut config: &EndpointConfig) -> Result<(), fidl::Error> {
1502        let _result = self.send_raw(config);
1503        self.drop_without_shutdown();
1504        _result
1505    }
1506
1507    fn send_raw(&self, mut config: &EndpointConfig) -> Result<(), fidl::Error> {
1508        self.control_handle.inner.send::<EndpointGetConfigResponse>(
1509            (config,),
1510            self.tx_id,
1511            0x3589f54aa3748539,
1512            fidl::encoding::DynamicFlags::empty(),
1513        )
1514    }
1515}
1516
1517#[must_use = "FIDL methods require a response to be sent"]
1518#[derive(Debug)]
1519pub struct EndpointGetNameResponder {
1520    control_handle: std::mem::ManuallyDrop<EndpointControlHandle>,
1521    tx_id: u32,
1522}
1523
1524/// Set the the channel to be shutdown (see [`EndpointControlHandle::shutdown`])
1525/// if the responder is dropped without sending a response, so that the client
1526/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1527impl std::ops::Drop for EndpointGetNameResponder {
1528    fn drop(&mut self) {
1529        self.control_handle.shutdown();
1530        // Safety: drops once, never accessed again
1531        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1532    }
1533}
1534
1535impl fidl::endpoints::Responder for EndpointGetNameResponder {
1536    type ControlHandle = EndpointControlHandle;
1537
1538    fn control_handle(&self) -> &EndpointControlHandle {
1539        &self.control_handle
1540    }
1541
1542    fn drop_without_shutdown(mut self) {
1543        // Safety: drops once, never accessed again due to mem::forget
1544        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1545        // Prevent Drop from running (which would shut down the channel)
1546        std::mem::forget(self);
1547    }
1548}
1549
1550impl EndpointGetNameResponder {
1551    /// Sends a response to the FIDL transaction.
1552    ///
1553    /// Sets the channel to shutdown if an error occurs.
1554    pub fn send(self, mut name: &str) -> Result<(), fidl::Error> {
1555        let _result = self.send_raw(name);
1556        if _result.is_err() {
1557            self.control_handle.shutdown();
1558        }
1559        self.drop_without_shutdown();
1560        _result
1561    }
1562
1563    /// Similar to "send" but does not shutdown the channel if an error occurs.
1564    pub fn send_no_shutdown_on_err(self, mut name: &str) -> Result<(), fidl::Error> {
1565        let _result = self.send_raw(name);
1566        self.drop_without_shutdown();
1567        _result
1568    }
1569
1570    fn send_raw(&self, mut name: &str) -> Result<(), fidl::Error> {
1571        self.control_handle.inner.send::<EndpointGetNameResponse>(
1572            (name,),
1573            self.tx_id,
1574            0x7d69650823557aab,
1575            fidl::encoding::DynamicFlags::empty(),
1576        )
1577    }
1578}
1579
1580#[must_use = "FIDL methods require a response to be sent"]
1581#[derive(Debug)]
1582pub struct EndpointSetLinkUpResponder {
1583    control_handle: std::mem::ManuallyDrop<EndpointControlHandle>,
1584    tx_id: u32,
1585}
1586
1587/// Set the the channel to be shutdown (see [`EndpointControlHandle::shutdown`])
1588/// if the responder is dropped without sending a response, so that the client
1589/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1590impl std::ops::Drop for EndpointSetLinkUpResponder {
1591    fn drop(&mut self) {
1592        self.control_handle.shutdown();
1593        // Safety: drops once, never accessed again
1594        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1595    }
1596}
1597
1598impl fidl::endpoints::Responder for EndpointSetLinkUpResponder {
1599    type ControlHandle = EndpointControlHandle;
1600
1601    fn control_handle(&self) -> &EndpointControlHandle {
1602        &self.control_handle
1603    }
1604
1605    fn drop_without_shutdown(mut self) {
1606        // Safety: drops once, never accessed again due to mem::forget
1607        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1608        // Prevent Drop from running (which would shut down the channel)
1609        std::mem::forget(self);
1610    }
1611}
1612
1613impl EndpointSetLinkUpResponder {
1614    /// Sends a response to the FIDL transaction.
1615    ///
1616    /// Sets the channel to shutdown if an error occurs.
1617    pub fn send(self) -> Result<(), fidl::Error> {
1618        let _result = self.send_raw();
1619        if _result.is_err() {
1620            self.control_handle.shutdown();
1621        }
1622        self.drop_without_shutdown();
1623        _result
1624    }
1625
1626    /// Similar to "send" but does not shutdown the channel if an error occurs.
1627    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1628        let _result = self.send_raw();
1629        self.drop_without_shutdown();
1630        _result
1631    }
1632
1633    fn send_raw(&self) -> Result<(), fidl::Error> {
1634        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1635            (),
1636            self.tx_id,
1637            0x4dde77de68d02e11,
1638            fidl::encoding::DynamicFlags::empty(),
1639        )
1640    }
1641}
1642
1643#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1644pub struct EndpointManagerMarker;
1645
1646impl fidl::endpoints::ProtocolMarker for EndpointManagerMarker {
1647    type Proxy = EndpointManagerProxy;
1648    type RequestStream = EndpointManagerRequestStream;
1649    #[cfg(target_os = "fuchsia")]
1650    type SynchronousProxy = EndpointManagerSynchronousProxy;
1651
1652    const DEBUG_NAME: &'static str = "(anonymous) EndpointManager";
1653}
1654
1655pub trait EndpointManagerProxyInterface: Send + Sync {
1656    type ListEndpointsResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
1657        + Send;
1658    fn r#list_endpoints(&self) -> Self::ListEndpointsResponseFut;
1659    type CreateEndpointResponseFut: std::future::Future<
1660            Output = Result<(i32, Option<fidl::endpoints::ClientEnd<EndpointMarker>>), fidl::Error>,
1661        > + Send;
1662    fn r#create_endpoint(
1663        &self,
1664        name: &str,
1665        config: &EndpointConfig,
1666    ) -> Self::CreateEndpointResponseFut;
1667    type GetEndpointResponseFut: std::future::Future<
1668            Output = Result<Option<fidl::endpoints::ClientEnd<EndpointMarker>>, fidl::Error>,
1669        > + Send;
1670    fn r#get_endpoint(&self, name: &str) -> Self::GetEndpointResponseFut;
1671}
1672#[derive(Debug)]
1673#[cfg(target_os = "fuchsia")]
1674pub struct EndpointManagerSynchronousProxy {
1675    client: fidl::client::sync::Client,
1676}
1677
1678#[cfg(target_os = "fuchsia")]
1679impl fidl::endpoints::SynchronousProxy for EndpointManagerSynchronousProxy {
1680    type Proxy = EndpointManagerProxy;
1681    type Protocol = EndpointManagerMarker;
1682
1683    fn from_channel(inner: fidl::Channel) -> Self {
1684        Self::new(inner)
1685    }
1686
1687    fn into_channel(self) -> fidl::Channel {
1688        self.client.into_channel()
1689    }
1690
1691    fn as_channel(&self) -> &fidl::Channel {
1692        self.client.as_channel()
1693    }
1694}
1695
1696#[cfg(target_os = "fuchsia")]
1697impl EndpointManagerSynchronousProxy {
1698    pub fn new(channel: fidl::Channel) -> Self {
1699        let protocol_name = <EndpointManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1700        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1701    }
1702
1703    pub fn into_channel(self) -> fidl::Channel {
1704        self.client.into_channel()
1705    }
1706
1707    /// Waits until an event arrives and returns it. It is safe for other
1708    /// threads to make concurrent requests while waiting for an event.
1709    pub fn wait_for_event(
1710        &self,
1711        deadline: zx::MonotonicInstant,
1712    ) -> Result<EndpointManagerEvent, fidl::Error> {
1713        EndpointManagerEvent::decode(self.client.wait_for_event(deadline)?)
1714    }
1715
1716    /// Lists endpoints by name.
1717    pub fn r#list_endpoints(
1718        &self,
1719        ___deadline: zx::MonotonicInstant,
1720    ) -> Result<Vec<String>, fidl::Error> {
1721        let _response = self
1722            .client
1723            .send_query::<fidl::encoding::EmptyPayload, EndpointManagerListEndpointsResponse>(
1724                (),
1725                0x78c83d9454e3d228,
1726                fidl::encoding::DynamicFlags::empty(),
1727                ___deadline,
1728            )?;
1729        Ok(_response.endp)
1730    }
1731
1732    /// Creates endpoint with given name and config.
1733    pub fn r#create_endpoint(
1734        &self,
1735        mut name: &str,
1736        mut config: &EndpointConfig,
1737        ___deadline: zx::MonotonicInstant,
1738    ) -> Result<(i32, Option<fidl::endpoints::ClientEnd<EndpointMarker>>), fidl::Error> {
1739        let _response = self.client.send_query::<
1740            EndpointManagerCreateEndpointRequest,
1741            EndpointManagerCreateEndpointResponse,
1742        >(
1743            (name, config,),
1744            0x7defe4cd5e4e7d7c,
1745            fidl::encoding::DynamicFlags::empty(),
1746            ___deadline,
1747        )?;
1748        Ok((_response.status, _response.endpoint))
1749    }
1750
1751    /// Gets a handle to an endpoint.
1752    pub fn r#get_endpoint(
1753        &self,
1754        mut name: &str,
1755        ___deadline: zx::MonotonicInstant,
1756    ) -> Result<Option<fidl::endpoints::ClientEnd<EndpointMarker>>, fidl::Error> {
1757        let _response = self
1758            .client
1759            .send_query::<EndpointManagerGetEndpointRequest, EndpointManagerGetEndpointResponse>(
1760                (name,),
1761                0x437e956b7b860751,
1762                fidl::encoding::DynamicFlags::empty(),
1763                ___deadline,
1764            )?;
1765        Ok(_response.endpoint)
1766    }
1767}
1768
1769#[derive(Debug, Clone)]
1770pub struct EndpointManagerProxy {
1771    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1772}
1773
1774impl fidl::endpoints::Proxy for EndpointManagerProxy {
1775    type Protocol = EndpointManagerMarker;
1776
1777    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1778        Self::new(inner)
1779    }
1780
1781    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1782        self.client.into_channel().map_err(|client| Self { client })
1783    }
1784
1785    fn as_channel(&self) -> &::fidl::AsyncChannel {
1786        self.client.as_channel()
1787    }
1788}
1789
1790impl EndpointManagerProxy {
1791    /// Create a new Proxy for fuchsia.netemul.network/EndpointManager.
1792    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1793        let protocol_name = <EndpointManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1794        Self { client: fidl::client::Client::new(channel, protocol_name) }
1795    }
1796
1797    /// Get a Stream of events from the remote end of the protocol.
1798    ///
1799    /// # Panics
1800    ///
1801    /// Panics if the event stream was already taken.
1802    pub fn take_event_stream(&self) -> EndpointManagerEventStream {
1803        EndpointManagerEventStream { event_receiver: self.client.take_event_receiver() }
1804    }
1805
1806    /// Lists endpoints by name.
1807    pub fn r#list_endpoints(
1808        &self,
1809    ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
1810    {
1811        EndpointManagerProxyInterface::r#list_endpoints(self)
1812    }
1813
1814    /// Creates endpoint with given name and config.
1815    pub fn r#create_endpoint(
1816        &self,
1817        mut name: &str,
1818        mut config: &EndpointConfig,
1819    ) -> fidl::client::QueryResponseFut<
1820        (i32, Option<fidl::endpoints::ClientEnd<EndpointMarker>>),
1821        fidl::encoding::DefaultFuchsiaResourceDialect,
1822    > {
1823        EndpointManagerProxyInterface::r#create_endpoint(self, name, config)
1824    }
1825
1826    /// Gets a handle to an endpoint.
1827    pub fn r#get_endpoint(
1828        &self,
1829        mut name: &str,
1830    ) -> fidl::client::QueryResponseFut<
1831        Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
1832        fidl::encoding::DefaultFuchsiaResourceDialect,
1833    > {
1834        EndpointManagerProxyInterface::r#get_endpoint(self, name)
1835    }
1836}
1837
1838impl EndpointManagerProxyInterface for EndpointManagerProxy {
1839    type ListEndpointsResponseFut =
1840        fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
1841    fn r#list_endpoints(&self) -> Self::ListEndpointsResponseFut {
1842        fn _decode(
1843            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1844        ) -> Result<Vec<String>, fidl::Error> {
1845            let _response = fidl::client::decode_transaction_body::<
1846                EndpointManagerListEndpointsResponse,
1847                fidl::encoding::DefaultFuchsiaResourceDialect,
1848                0x78c83d9454e3d228,
1849            >(_buf?)?;
1850            Ok(_response.endp)
1851        }
1852        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
1853            (),
1854            0x78c83d9454e3d228,
1855            fidl::encoding::DynamicFlags::empty(),
1856            _decode,
1857        )
1858    }
1859
1860    type CreateEndpointResponseFut = fidl::client::QueryResponseFut<
1861        (i32, Option<fidl::endpoints::ClientEnd<EndpointMarker>>),
1862        fidl::encoding::DefaultFuchsiaResourceDialect,
1863    >;
1864    fn r#create_endpoint(
1865        &self,
1866        mut name: &str,
1867        mut config: &EndpointConfig,
1868    ) -> Self::CreateEndpointResponseFut {
1869        fn _decode(
1870            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1871        ) -> Result<(i32, Option<fidl::endpoints::ClientEnd<EndpointMarker>>), fidl::Error>
1872        {
1873            let _response = fidl::client::decode_transaction_body::<
1874                EndpointManagerCreateEndpointResponse,
1875                fidl::encoding::DefaultFuchsiaResourceDialect,
1876                0x7defe4cd5e4e7d7c,
1877            >(_buf?)?;
1878            Ok((_response.status, _response.endpoint))
1879        }
1880        self.client.send_query_and_decode::<
1881            EndpointManagerCreateEndpointRequest,
1882            (i32, Option<fidl::endpoints::ClientEnd<EndpointMarker>>),
1883        >(
1884            (name, config,),
1885            0x7defe4cd5e4e7d7c,
1886            fidl::encoding::DynamicFlags::empty(),
1887            _decode,
1888        )
1889    }
1890
1891    type GetEndpointResponseFut = fidl::client::QueryResponseFut<
1892        Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
1893        fidl::encoding::DefaultFuchsiaResourceDialect,
1894    >;
1895    fn r#get_endpoint(&self, mut name: &str) -> Self::GetEndpointResponseFut {
1896        fn _decode(
1897            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1898        ) -> Result<Option<fidl::endpoints::ClientEnd<EndpointMarker>>, fidl::Error> {
1899            let _response = fidl::client::decode_transaction_body::<
1900                EndpointManagerGetEndpointResponse,
1901                fidl::encoding::DefaultFuchsiaResourceDialect,
1902                0x437e956b7b860751,
1903            >(_buf?)?;
1904            Ok(_response.endpoint)
1905        }
1906        self.client.send_query_and_decode::<
1907            EndpointManagerGetEndpointRequest,
1908            Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
1909        >(
1910            (name,),
1911            0x437e956b7b860751,
1912            fidl::encoding::DynamicFlags::empty(),
1913            _decode,
1914        )
1915    }
1916}
1917
1918pub struct EndpointManagerEventStream {
1919    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1920}
1921
1922impl std::marker::Unpin for EndpointManagerEventStream {}
1923
1924impl futures::stream::FusedStream for EndpointManagerEventStream {
1925    fn is_terminated(&self) -> bool {
1926        self.event_receiver.is_terminated()
1927    }
1928}
1929
1930impl futures::Stream for EndpointManagerEventStream {
1931    type Item = Result<EndpointManagerEvent, fidl::Error>;
1932
1933    fn poll_next(
1934        mut self: std::pin::Pin<&mut Self>,
1935        cx: &mut std::task::Context<'_>,
1936    ) -> std::task::Poll<Option<Self::Item>> {
1937        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1938            &mut self.event_receiver,
1939            cx
1940        )?) {
1941            Some(buf) => std::task::Poll::Ready(Some(EndpointManagerEvent::decode(buf))),
1942            None => std::task::Poll::Ready(None),
1943        }
1944    }
1945}
1946
1947#[derive(Debug)]
1948pub enum EndpointManagerEvent {}
1949
1950impl EndpointManagerEvent {
1951    /// Decodes a message buffer as a [`EndpointManagerEvent`].
1952    fn decode(
1953        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1954    ) -> Result<EndpointManagerEvent, fidl::Error> {
1955        let (bytes, _handles) = buf.split_mut();
1956        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1957        debug_assert_eq!(tx_header.tx_id, 0);
1958        match tx_header.ordinal {
1959            _ => Err(fidl::Error::UnknownOrdinal {
1960                ordinal: tx_header.ordinal,
1961                protocol_name:
1962                    <EndpointManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1963            }),
1964        }
1965    }
1966}
1967
1968/// A Stream of incoming requests for fuchsia.netemul.network/EndpointManager.
1969pub struct EndpointManagerRequestStream {
1970    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1971    is_terminated: bool,
1972}
1973
1974impl std::marker::Unpin for EndpointManagerRequestStream {}
1975
1976impl futures::stream::FusedStream for EndpointManagerRequestStream {
1977    fn is_terminated(&self) -> bool {
1978        self.is_terminated
1979    }
1980}
1981
1982impl fidl::endpoints::RequestStream for EndpointManagerRequestStream {
1983    type Protocol = EndpointManagerMarker;
1984    type ControlHandle = EndpointManagerControlHandle;
1985
1986    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1987        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1988    }
1989
1990    fn control_handle(&self) -> Self::ControlHandle {
1991        EndpointManagerControlHandle { inner: self.inner.clone() }
1992    }
1993
1994    fn into_inner(
1995        self,
1996    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1997    {
1998        (self.inner, self.is_terminated)
1999    }
2000
2001    fn from_inner(
2002        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2003        is_terminated: bool,
2004    ) -> Self {
2005        Self { inner, is_terminated }
2006    }
2007}
2008
2009impl futures::Stream for EndpointManagerRequestStream {
2010    type Item = Result<EndpointManagerRequest, fidl::Error>;
2011
2012    fn poll_next(
2013        mut self: std::pin::Pin<&mut Self>,
2014        cx: &mut std::task::Context<'_>,
2015    ) -> std::task::Poll<Option<Self::Item>> {
2016        let this = &mut *self;
2017        if this.inner.check_shutdown(cx) {
2018            this.is_terminated = true;
2019            return std::task::Poll::Ready(None);
2020        }
2021        if this.is_terminated {
2022            panic!("polled EndpointManagerRequestStream after completion");
2023        }
2024        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2025            |bytes, handles| {
2026                match this.inner.channel().read_etc(cx, bytes, handles) {
2027                    std::task::Poll::Ready(Ok(())) => {}
2028                    std::task::Poll::Pending => return std::task::Poll::Pending,
2029                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2030                        this.is_terminated = true;
2031                        return std::task::Poll::Ready(None);
2032                    }
2033                    std::task::Poll::Ready(Err(e)) => {
2034                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2035                            e.into(),
2036                        ))))
2037                    }
2038                }
2039
2040                // A message has been received from the channel
2041                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2042
2043                std::task::Poll::Ready(Some(match header.ordinal {
2044                    0x78c83d9454e3d228 => {
2045                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2046                        let mut req = fidl::new_empty!(
2047                            fidl::encoding::EmptyPayload,
2048                            fidl::encoding::DefaultFuchsiaResourceDialect
2049                        );
2050                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2051                        let control_handle =
2052                            EndpointManagerControlHandle { inner: this.inner.clone() };
2053                        Ok(EndpointManagerRequest::ListEndpoints {
2054                            responder: EndpointManagerListEndpointsResponder {
2055                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2056                                tx_id: header.tx_id,
2057                            },
2058                        })
2059                    }
2060                    0x7defe4cd5e4e7d7c => {
2061                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2062                        let mut req = fidl::new_empty!(
2063                            EndpointManagerCreateEndpointRequest,
2064                            fidl::encoding::DefaultFuchsiaResourceDialect
2065                        );
2066                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EndpointManagerCreateEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
2067                        let control_handle =
2068                            EndpointManagerControlHandle { inner: this.inner.clone() };
2069                        Ok(EndpointManagerRequest::CreateEndpoint {
2070                            name: req.name,
2071                            config: req.config,
2072
2073                            responder: EndpointManagerCreateEndpointResponder {
2074                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2075                                tx_id: header.tx_id,
2076                            },
2077                        })
2078                    }
2079                    0x437e956b7b860751 => {
2080                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2081                        let mut req = fidl::new_empty!(
2082                            EndpointManagerGetEndpointRequest,
2083                            fidl::encoding::DefaultFuchsiaResourceDialect
2084                        );
2085                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EndpointManagerGetEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
2086                        let control_handle =
2087                            EndpointManagerControlHandle { inner: this.inner.clone() };
2088                        Ok(EndpointManagerRequest::GetEndpoint {
2089                            name: req.name,
2090
2091                            responder: EndpointManagerGetEndpointResponder {
2092                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2093                                tx_id: header.tx_id,
2094                            },
2095                        })
2096                    }
2097                    _ => Err(fidl::Error::UnknownOrdinal {
2098                        ordinal: header.ordinal,
2099                        protocol_name:
2100                            <EndpointManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2101                    }),
2102                }))
2103            },
2104        )
2105    }
2106}
2107
2108/// Manages virtual endpoints.
2109#[derive(Debug)]
2110pub enum EndpointManagerRequest {
2111    /// Lists endpoints by name.
2112    ListEndpoints { responder: EndpointManagerListEndpointsResponder },
2113    /// Creates endpoint with given name and config.
2114    CreateEndpoint {
2115        name: String,
2116        config: EndpointConfig,
2117        responder: EndpointManagerCreateEndpointResponder,
2118    },
2119    /// Gets a handle to an endpoint.
2120    GetEndpoint { name: String, responder: EndpointManagerGetEndpointResponder },
2121}
2122
2123impl EndpointManagerRequest {
2124    #[allow(irrefutable_let_patterns)]
2125    pub fn into_list_endpoints(self) -> Option<(EndpointManagerListEndpointsResponder)> {
2126        if let EndpointManagerRequest::ListEndpoints { responder } = self {
2127            Some((responder))
2128        } else {
2129            None
2130        }
2131    }
2132
2133    #[allow(irrefutable_let_patterns)]
2134    pub fn into_create_endpoint(
2135        self,
2136    ) -> Option<(String, EndpointConfig, EndpointManagerCreateEndpointResponder)> {
2137        if let EndpointManagerRequest::CreateEndpoint { name, config, responder } = self {
2138            Some((name, config, responder))
2139        } else {
2140            None
2141        }
2142    }
2143
2144    #[allow(irrefutable_let_patterns)]
2145    pub fn into_get_endpoint(self) -> Option<(String, EndpointManagerGetEndpointResponder)> {
2146        if let EndpointManagerRequest::GetEndpoint { name, responder } = self {
2147            Some((name, responder))
2148        } else {
2149            None
2150        }
2151    }
2152
2153    /// Name of the method defined in FIDL
2154    pub fn method_name(&self) -> &'static str {
2155        match *self {
2156            EndpointManagerRequest::ListEndpoints { .. } => "list_endpoints",
2157            EndpointManagerRequest::CreateEndpoint { .. } => "create_endpoint",
2158            EndpointManagerRequest::GetEndpoint { .. } => "get_endpoint",
2159        }
2160    }
2161}
2162
2163#[derive(Debug, Clone)]
2164pub struct EndpointManagerControlHandle {
2165    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2166}
2167
2168impl fidl::endpoints::ControlHandle for EndpointManagerControlHandle {
2169    fn shutdown(&self) {
2170        self.inner.shutdown()
2171    }
2172    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2173        self.inner.shutdown_with_epitaph(status)
2174    }
2175
2176    fn is_closed(&self) -> bool {
2177        self.inner.channel().is_closed()
2178    }
2179    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2180        self.inner.channel().on_closed()
2181    }
2182
2183    #[cfg(target_os = "fuchsia")]
2184    fn signal_peer(
2185        &self,
2186        clear_mask: zx::Signals,
2187        set_mask: zx::Signals,
2188    ) -> Result<(), zx_status::Status> {
2189        use fidl::Peered;
2190        self.inner.channel().signal_peer(clear_mask, set_mask)
2191    }
2192}
2193
2194impl EndpointManagerControlHandle {}
2195
2196#[must_use = "FIDL methods require a response to be sent"]
2197#[derive(Debug)]
2198pub struct EndpointManagerListEndpointsResponder {
2199    control_handle: std::mem::ManuallyDrop<EndpointManagerControlHandle>,
2200    tx_id: u32,
2201}
2202
2203/// Set the the channel to be shutdown (see [`EndpointManagerControlHandle::shutdown`])
2204/// if the responder is dropped without sending a response, so that the client
2205/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2206impl std::ops::Drop for EndpointManagerListEndpointsResponder {
2207    fn drop(&mut self) {
2208        self.control_handle.shutdown();
2209        // Safety: drops once, never accessed again
2210        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2211    }
2212}
2213
2214impl fidl::endpoints::Responder for EndpointManagerListEndpointsResponder {
2215    type ControlHandle = EndpointManagerControlHandle;
2216
2217    fn control_handle(&self) -> &EndpointManagerControlHandle {
2218        &self.control_handle
2219    }
2220
2221    fn drop_without_shutdown(mut self) {
2222        // Safety: drops once, never accessed again due to mem::forget
2223        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2224        // Prevent Drop from running (which would shut down the channel)
2225        std::mem::forget(self);
2226    }
2227}
2228
2229impl EndpointManagerListEndpointsResponder {
2230    /// Sends a response to the FIDL transaction.
2231    ///
2232    /// Sets the channel to shutdown if an error occurs.
2233    pub fn send(self, mut endp: &[String]) -> Result<(), fidl::Error> {
2234        let _result = self.send_raw(endp);
2235        if _result.is_err() {
2236            self.control_handle.shutdown();
2237        }
2238        self.drop_without_shutdown();
2239        _result
2240    }
2241
2242    /// Similar to "send" but does not shutdown the channel if an error occurs.
2243    pub fn send_no_shutdown_on_err(self, mut endp: &[String]) -> Result<(), fidl::Error> {
2244        let _result = self.send_raw(endp);
2245        self.drop_without_shutdown();
2246        _result
2247    }
2248
2249    fn send_raw(&self, mut endp: &[String]) -> Result<(), fidl::Error> {
2250        self.control_handle.inner.send::<EndpointManagerListEndpointsResponse>(
2251            (endp,),
2252            self.tx_id,
2253            0x78c83d9454e3d228,
2254            fidl::encoding::DynamicFlags::empty(),
2255        )
2256    }
2257}
2258
2259#[must_use = "FIDL methods require a response to be sent"]
2260#[derive(Debug)]
2261pub struct EndpointManagerCreateEndpointResponder {
2262    control_handle: std::mem::ManuallyDrop<EndpointManagerControlHandle>,
2263    tx_id: u32,
2264}
2265
2266/// Set the the channel to be shutdown (see [`EndpointManagerControlHandle::shutdown`])
2267/// if the responder is dropped without sending a response, so that the client
2268/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2269impl std::ops::Drop for EndpointManagerCreateEndpointResponder {
2270    fn drop(&mut self) {
2271        self.control_handle.shutdown();
2272        // Safety: drops once, never accessed again
2273        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2274    }
2275}
2276
2277impl fidl::endpoints::Responder for EndpointManagerCreateEndpointResponder {
2278    type ControlHandle = EndpointManagerControlHandle;
2279
2280    fn control_handle(&self) -> &EndpointManagerControlHandle {
2281        &self.control_handle
2282    }
2283
2284    fn drop_without_shutdown(mut self) {
2285        // Safety: drops once, never accessed again due to mem::forget
2286        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2287        // Prevent Drop from running (which would shut down the channel)
2288        std::mem::forget(self);
2289    }
2290}
2291
2292impl EndpointManagerCreateEndpointResponder {
2293    /// Sends a response to the FIDL transaction.
2294    ///
2295    /// Sets the channel to shutdown if an error occurs.
2296    pub fn send(
2297        self,
2298        mut status: i32,
2299        mut endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
2300    ) -> Result<(), fidl::Error> {
2301        let _result = self.send_raw(status, endpoint);
2302        if _result.is_err() {
2303            self.control_handle.shutdown();
2304        }
2305        self.drop_without_shutdown();
2306        _result
2307    }
2308
2309    /// Similar to "send" but does not shutdown the channel if an error occurs.
2310    pub fn send_no_shutdown_on_err(
2311        self,
2312        mut status: i32,
2313        mut endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
2314    ) -> Result<(), fidl::Error> {
2315        let _result = self.send_raw(status, endpoint);
2316        self.drop_without_shutdown();
2317        _result
2318    }
2319
2320    fn send_raw(
2321        &self,
2322        mut status: i32,
2323        mut endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
2324    ) -> Result<(), fidl::Error> {
2325        self.control_handle.inner.send::<EndpointManagerCreateEndpointResponse>(
2326            (status, endpoint),
2327            self.tx_id,
2328            0x7defe4cd5e4e7d7c,
2329            fidl::encoding::DynamicFlags::empty(),
2330        )
2331    }
2332}
2333
2334#[must_use = "FIDL methods require a response to be sent"]
2335#[derive(Debug)]
2336pub struct EndpointManagerGetEndpointResponder {
2337    control_handle: std::mem::ManuallyDrop<EndpointManagerControlHandle>,
2338    tx_id: u32,
2339}
2340
2341/// Set the the channel to be shutdown (see [`EndpointManagerControlHandle::shutdown`])
2342/// if the responder is dropped without sending a response, so that the client
2343/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2344impl std::ops::Drop for EndpointManagerGetEndpointResponder {
2345    fn drop(&mut self) {
2346        self.control_handle.shutdown();
2347        // Safety: drops once, never accessed again
2348        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2349    }
2350}
2351
2352impl fidl::endpoints::Responder for EndpointManagerGetEndpointResponder {
2353    type ControlHandle = EndpointManagerControlHandle;
2354
2355    fn control_handle(&self) -> &EndpointManagerControlHandle {
2356        &self.control_handle
2357    }
2358
2359    fn drop_without_shutdown(mut self) {
2360        // Safety: drops once, never accessed again due to mem::forget
2361        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2362        // Prevent Drop from running (which would shut down the channel)
2363        std::mem::forget(self);
2364    }
2365}
2366
2367impl EndpointManagerGetEndpointResponder {
2368    /// Sends a response to the FIDL transaction.
2369    ///
2370    /// Sets the channel to shutdown if an error occurs.
2371    pub fn send(
2372        self,
2373        mut endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
2374    ) -> Result<(), fidl::Error> {
2375        let _result = self.send_raw(endpoint);
2376        if _result.is_err() {
2377            self.control_handle.shutdown();
2378        }
2379        self.drop_without_shutdown();
2380        _result
2381    }
2382
2383    /// Similar to "send" but does not shutdown the channel if an error occurs.
2384    pub fn send_no_shutdown_on_err(
2385        self,
2386        mut endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
2387    ) -> Result<(), fidl::Error> {
2388        let _result = self.send_raw(endpoint);
2389        self.drop_without_shutdown();
2390        _result
2391    }
2392
2393    fn send_raw(
2394        &self,
2395        mut endpoint: Option<fidl::endpoints::ClientEnd<EndpointMarker>>,
2396    ) -> Result<(), fidl::Error> {
2397        self.control_handle.inner.send::<EndpointManagerGetEndpointResponse>(
2398            (endpoint,),
2399            self.tx_id,
2400            0x437e956b7b860751,
2401            fidl::encoding::DynamicFlags::empty(),
2402        )
2403    }
2404}
2405
2406#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2407pub struct FakeEndpointMarker;
2408
2409impl fidl::endpoints::ProtocolMarker for FakeEndpointMarker {
2410    type Proxy = FakeEndpointProxy;
2411    type RequestStream = FakeEndpointRequestStream;
2412    #[cfg(target_os = "fuchsia")]
2413    type SynchronousProxy = FakeEndpointSynchronousProxy;
2414
2415    const DEBUG_NAME: &'static str = "(anonymous) FakeEndpoint";
2416}
2417
2418pub trait FakeEndpointProxyInterface: Send + Sync {
2419    type WriteResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2420    fn r#write(&self, data: &[u8]) -> Self::WriteResponseFut;
2421    type ReadResponseFut: std::future::Future<Output = Result<(Vec<u8>, u64), fidl::Error>> + Send;
2422    fn r#read(&self) -> Self::ReadResponseFut;
2423}
2424#[derive(Debug)]
2425#[cfg(target_os = "fuchsia")]
2426pub struct FakeEndpointSynchronousProxy {
2427    client: fidl::client::sync::Client,
2428}
2429
2430#[cfg(target_os = "fuchsia")]
2431impl fidl::endpoints::SynchronousProxy for FakeEndpointSynchronousProxy {
2432    type Proxy = FakeEndpointProxy;
2433    type Protocol = FakeEndpointMarker;
2434
2435    fn from_channel(inner: fidl::Channel) -> Self {
2436        Self::new(inner)
2437    }
2438
2439    fn into_channel(self) -> fidl::Channel {
2440        self.client.into_channel()
2441    }
2442
2443    fn as_channel(&self) -> &fidl::Channel {
2444        self.client.as_channel()
2445    }
2446}
2447
2448#[cfg(target_os = "fuchsia")]
2449impl FakeEndpointSynchronousProxy {
2450    pub fn new(channel: fidl::Channel) -> Self {
2451        let protocol_name = <FakeEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2452        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2453    }
2454
2455    pub fn into_channel(self) -> fidl::Channel {
2456        self.client.into_channel()
2457    }
2458
2459    /// Waits until an event arrives and returns it. It is safe for other
2460    /// threads to make concurrent requests while waiting for an event.
2461    pub fn wait_for_event(
2462        &self,
2463        deadline: zx::MonotonicInstant,
2464    ) -> Result<FakeEndpointEvent, fidl::Error> {
2465        FakeEndpointEvent::decode(self.client.wait_for_event(deadline)?)
2466    }
2467
2468    /// Writes a frame to the network.
2469    pub fn r#write(
2470        &self,
2471        mut data: &[u8],
2472        ___deadline: zx::MonotonicInstant,
2473    ) -> Result<(), fidl::Error> {
2474        let _response =
2475            self.client.send_query::<FakeEndpointWriteRequest, fidl::encoding::EmptyPayload>(
2476                (data,),
2477                0x2c54af94338c523b,
2478                fidl::encoding::DynamicFlags::empty(),
2479                ___deadline,
2480            )?;
2481        Ok(_response)
2482    }
2483
2484    /// Reads a single frame from the network.
2485    ///
2486    /// Blocks until new data is available to be read. FakeEndpoint will keep a limited amount of
2487    /// frames to be read, dropping the oldest ones if the data is not fetched fast enough. The
2488    /// number of dropped frames since the last call to `Read` is returned in `dropped_frames`.
2489    ///
2490    /// Issuing a second `Read` request when the first one is still pending will cause the channel
2491    /// to be closed with `ZX_ERR_BAD_STATE`.
2492    pub fn r#read(&self, ___deadline: zx::MonotonicInstant) -> Result<(Vec<u8>, u64), fidl::Error> {
2493        let _response =
2494            self.client.send_query::<fidl::encoding::EmptyPayload, FakeEndpointReadResponse>(
2495                (),
2496                0x58e2d032a8f36234,
2497                fidl::encoding::DynamicFlags::empty(),
2498                ___deadline,
2499            )?;
2500        Ok((_response.data, _response.dropped_frames))
2501    }
2502}
2503
2504#[derive(Debug, Clone)]
2505pub struct FakeEndpointProxy {
2506    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2507}
2508
2509impl fidl::endpoints::Proxy for FakeEndpointProxy {
2510    type Protocol = FakeEndpointMarker;
2511
2512    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2513        Self::new(inner)
2514    }
2515
2516    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2517        self.client.into_channel().map_err(|client| Self { client })
2518    }
2519
2520    fn as_channel(&self) -> &::fidl::AsyncChannel {
2521        self.client.as_channel()
2522    }
2523}
2524
2525impl FakeEndpointProxy {
2526    /// Create a new Proxy for fuchsia.netemul.network/FakeEndpoint.
2527    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2528        let protocol_name = <FakeEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2529        Self { client: fidl::client::Client::new(channel, protocol_name) }
2530    }
2531
2532    /// Get a Stream of events from the remote end of the protocol.
2533    ///
2534    /// # Panics
2535    ///
2536    /// Panics if the event stream was already taken.
2537    pub fn take_event_stream(&self) -> FakeEndpointEventStream {
2538        FakeEndpointEventStream { event_receiver: self.client.take_event_receiver() }
2539    }
2540
2541    /// Writes a frame to the network.
2542    pub fn r#write(
2543        &self,
2544        mut data: &[u8],
2545    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2546        FakeEndpointProxyInterface::r#write(self, data)
2547    }
2548
2549    /// Reads a single frame from the network.
2550    ///
2551    /// Blocks until new data is available to be read. FakeEndpoint will keep a limited amount of
2552    /// frames to be read, dropping the oldest ones if the data is not fetched fast enough. The
2553    /// number of dropped frames since the last call to `Read` is returned in `dropped_frames`.
2554    ///
2555    /// Issuing a second `Read` request when the first one is still pending will cause the channel
2556    /// to be closed with `ZX_ERR_BAD_STATE`.
2557    pub fn r#read(
2558        &self,
2559    ) -> fidl::client::QueryResponseFut<(Vec<u8>, u64), fidl::encoding::DefaultFuchsiaResourceDialect>
2560    {
2561        FakeEndpointProxyInterface::r#read(self)
2562    }
2563}
2564
2565impl FakeEndpointProxyInterface for FakeEndpointProxy {
2566    type WriteResponseFut =
2567        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2568    fn r#write(&self, mut data: &[u8]) -> Self::WriteResponseFut {
2569        fn _decode(
2570            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2571        ) -> Result<(), fidl::Error> {
2572            let _response = fidl::client::decode_transaction_body::<
2573                fidl::encoding::EmptyPayload,
2574                fidl::encoding::DefaultFuchsiaResourceDialect,
2575                0x2c54af94338c523b,
2576            >(_buf?)?;
2577            Ok(_response)
2578        }
2579        self.client.send_query_and_decode::<FakeEndpointWriteRequest, ()>(
2580            (data,),
2581            0x2c54af94338c523b,
2582            fidl::encoding::DynamicFlags::empty(),
2583            _decode,
2584        )
2585    }
2586
2587    type ReadResponseFut = fidl::client::QueryResponseFut<
2588        (Vec<u8>, u64),
2589        fidl::encoding::DefaultFuchsiaResourceDialect,
2590    >;
2591    fn r#read(&self) -> Self::ReadResponseFut {
2592        fn _decode(
2593            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2594        ) -> Result<(Vec<u8>, u64), fidl::Error> {
2595            let _response = fidl::client::decode_transaction_body::<
2596                FakeEndpointReadResponse,
2597                fidl::encoding::DefaultFuchsiaResourceDialect,
2598                0x58e2d032a8f36234,
2599            >(_buf?)?;
2600            Ok((_response.data, _response.dropped_frames))
2601        }
2602        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<u8>, u64)>(
2603            (),
2604            0x58e2d032a8f36234,
2605            fidl::encoding::DynamicFlags::empty(),
2606            _decode,
2607        )
2608    }
2609}
2610
2611pub struct FakeEndpointEventStream {
2612    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2613}
2614
2615impl std::marker::Unpin for FakeEndpointEventStream {}
2616
2617impl futures::stream::FusedStream for FakeEndpointEventStream {
2618    fn is_terminated(&self) -> bool {
2619        self.event_receiver.is_terminated()
2620    }
2621}
2622
2623impl futures::Stream for FakeEndpointEventStream {
2624    type Item = Result<FakeEndpointEvent, fidl::Error>;
2625
2626    fn poll_next(
2627        mut self: std::pin::Pin<&mut Self>,
2628        cx: &mut std::task::Context<'_>,
2629    ) -> std::task::Poll<Option<Self::Item>> {
2630        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2631            &mut self.event_receiver,
2632            cx
2633        )?) {
2634            Some(buf) => std::task::Poll::Ready(Some(FakeEndpointEvent::decode(buf))),
2635            None => std::task::Poll::Ready(None),
2636        }
2637    }
2638}
2639
2640#[derive(Debug)]
2641pub enum FakeEndpointEvent {}
2642
2643impl FakeEndpointEvent {
2644    /// Decodes a message buffer as a [`FakeEndpointEvent`].
2645    fn decode(
2646        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2647    ) -> Result<FakeEndpointEvent, fidl::Error> {
2648        let (bytes, _handles) = buf.split_mut();
2649        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2650        debug_assert_eq!(tx_header.tx_id, 0);
2651        match tx_header.ordinal {
2652            _ => Err(fidl::Error::UnknownOrdinal {
2653                ordinal: tx_header.ordinal,
2654                protocol_name: <FakeEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2655            }),
2656        }
2657    }
2658}
2659
2660/// A Stream of incoming requests for fuchsia.netemul.network/FakeEndpoint.
2661pub struct FakeEndpointRequestStream {
2662    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2663    is_terminated: bool,
2664}
2665
2666impl std::marker::Unpin for FakeEndpointRequestStream {}
2667
2668impl futures::stream::FusedStream for FakeEndpointRequestStream {
2669    fn is_terminated(&self) -> bool {
2670        self.is_terminated
2671    }
2672}
2673
2674impl fidl::endpoints::RequestStream for FakeEndpointRequestStream {
2675    type Protocol = FakeEndpointMarker;
2676    type ControlHandle = FakeEndpointControlHandle;
2677
2678    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2679        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2680    }
2681
2682    fn control_handle(&self) -> Self::ControlHandle {
2683        FakeEndpointControlHandle { inner: self.inner.clone() }
2684    }
2685
2686    fn into_inner(
2687        self,
2688    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2689    {
2690        (self.inner, self.is_terminated)
2691    }
2692
2693    fn from_inner(
2694        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2695        is_terminated: bool,
2696    ) -> Self {
2697        Self { inner, is_terminated }
2698    }
2699}
2700
2701impl futures::Stream for FakeEndpointRequestStream {
2702    type Item = Result<FakeEndpointRequest, fidl::Error>;
2703
2704    fn poll_next(
2705        mut self: std::pin::Pin<&mut Self>,
2706        cx: &mut std::task::Context<'_>,
2707    ) -> std::task::Poll<Option<Self::Item>> {
2708        let this = &mut *self;
2709        if this.inner.check_shutdown(cx) {
2710            this.is_terminated = true;
2711            return std::task::Poll::Ready(None);
2712        }
2713        if this.is_terminated {
2714            panic!("polled FakeEndpointRequestStream after completion");
2715        }
2716        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2717            |bytes, handles| {
2718                match this.inner.channel().read_etc(cx, bytes, handles) {
2719                    std::task::Poll::Ready(Ok(())) => {}
2720                    std::task::Poll::Pending => return std::task::Poll::Pending,
2721                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2722                        this.is_terminated = true;
2723                        return std::task::Poll::Ready(None);
2724                    }
2725                    std::task::Poll::Ready(Err(e)) => {
2726                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2727                            e.into(),
2728                        ))))
2729                    }
2730                }
2731
2732                // A message has been received from the channel
2733                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2734
2735                std::task::Poll::Ready(Some(match header.ordinal {
2736                    0x2c54af94338c523b => {
2737                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2738                        let mut req = fidl::new_empty!(
2739                            FakeEndpointWriteRequest,
2740                            fidl::encoding::DefaultFuchsiaResourceDialect
2741                        );
2742                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FakeEndpointWriteRequest>(&header, _body_bytes, handles, &mut req)?;
2743                        let control_handle =
2744                            FakeEndpointControlHandle { inner: this.inner.clone() };
2745                        Ok(FakeEndpointRequest::Write {
2746                            data: req.data,
2747
2748                            responder: FakeEndpointWriteResponder {
2749                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2750                                tx_id: header.tx_id,
2751                            },
2752                        })
2753                    }
2754                    0x58e2d032a8f36234 => {
2755                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2756                        let mut req = fidl::new_empty!(
2757                            fidl::encoding::EmptyPayload,
2758                            fidl::encoding::DefaultFuchsiaResourceDialect
2759                        );
2760                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2761                        let control_handle =
2762                            FakeEndpointControlHandle { inner: this.inner.clone() };
2763                        Ok(FakeEndpointRequest::Read {
2764                            responder: FakeEndpointReadResponder {
2765                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2766                                tx_id: header.tx_id,
2767                            },
2768                        })
2769                    }
2770                    _ => Err(fidl::Error::UnknownOrdinal {
2771                        ordinal: header.ordinal,
2772                        protocol_name:
2773                            <FakeEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2774                    }),
2775                }))
2776            },
2777        )
2778    }
2779}
2780
2781/// Fake endpoint can be added to a network to snoop or inject packets.
2782#[derive(Debug)]
2783pub enum FakeEndpointRequest {
2784    /// Writes a frame to the network.
2785    Write { data: Vec<u8>, responder: FakeEndpointWriteResponder },
2786    /// Reads a single frame from the network.
2787    ///
2788    /// Blocks until new data is available to be read. FakeEndpoint will keep a limited amount of
2789    /// frames to be read, dropping the oldest ones if the data is not fetched fast enough. The
2790    /// number of dropped frames since the last call to `Read` is returned in `dropped_frames`.
2791    ///
2792    /// Issuing a second `Read` request when the first one is still pending will cause the channel
2793    /// to be closed with `ZX_ERR_BAD_STATE`.
2794    Read { responder: FakeEndpointReadResponder },
2795}
2796
2797impl FakeEndpointRequest {
2798    #[allow(irrefutable_let_patterns)]
2799    pub fn into_write(self) -> Option<(Vec<u8>, FakeEndpointWriteResponder)> {
2800        if let FakeEndpointRequest::Write { data, responder } = self {
2801            Some((data, responder))
2802        } else {
2803            None
2804        }
2805    }
2806
2807    #[allow(irrefutable_let_patterns)]
2808    pub fn into_read(self) -> Option<(FakeEndpointReadResponder)> {
2809        if let FakeEndpointRequest::Read { responder } = self {
2810            Some((responder))
2811        } else {
2812            None
2813        }
2814    }
2815
2816    /// Name of the method defined in FIDL
2817    pub fn method_name(&self) -> &'static str {
2818        match *self {
2819            FakeEndpointRequest::Write { .. } => "write",
2820            FakeEndpointRequest::Read { .. } => "read",
2821        }
2822    }
2823}
2824
2825#[derive(Debug, Clone)]
2826pub struct FakeEndpointControlHandle {
2827    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2828}
2829
2830impl fidl::endpoints::ControlHandle for FakeEndpointControlHandle {
2831    fn shutdown(&self) {
2832        self.inner.shutdown()
2833    }
2834    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2835        self.inner.shutdown_with_epitaph(status)
2836    }
2837
2838    fn is_closed(&self) -> bool {
2839        self.inner.channel().is_closed()
2840    }
2841    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2842        self.inner.channel().on_closed()
2843    }
2844
2845    #[cfg(target_os = "fuchsia")]
2846    fn signal_peer(
2847        &self,
2848        clear_mask: zx::Signals,
2849        set_mask: zx::Signals,
2850    ) -> Result<(), zx_status::Status> {
2851        use fidl::Peered;
2852        self.inner.channel().signal_peer(clear_mask, set_mask)
2853    }
2854}
2855
2856impl FakeEndpointControlHandle {}
2857
2858#[must_use = "FIDL methods require a response to be sent"]
2859#[derive(Debug)]
2860pub struct FakeEndpointWriteResponder {
2861    control_handle: std::mem::ManuallyDrop<FakeEndpointControlHandle>,
2862    tx_id: u32,
2863}
2864
2865/// Set the the channel to be shutdown (see [`FakeEndpointControlHandle::shutdown`])
2866/// if the responder is dropped without sending a response, so that the client
2867/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2868impl std::ops::Drop for FakeEndpointWriteResponder {
2869    fn drop(&mut self) {
2870        self.control_handle.shutdown();
2871        // Safety: drops once, never accessed again
2872        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2873    }
2874}
2875
2876impl fidl::endpoints::Responder for FakeEndpointWriteResponder {
2877    type ControlHandle = FakeEndpointControlHandle;
2878
2879    fn control_handle(&self) -> &FakeEndpointControlHandle {
2880        &self.control_handle
2881    }
2882
2883    fn drop_without_shutdown(mut self) {
2884        // Safety: drops once, never accessed again due to mem::forget
2885        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2886        // Prevent Drop from running (which would shut down the channel)
2887        std::mem::forget(self);
2888    }
2889}
2890
2891impl FakeEndpointWriteResponder {
2892    /// Sends a response to the FIDL transaction.
2893    ///
2894    /// Sets the channel to shutdown if an error occurs.
2895    pub fn send(self) -> Result<(), fidl::Error> {
2896        let _result = self.send_raw();
2897        if _result.is_err() {
2898            self.control_handle.shutdown();
2899        }
2900        self.drop_without_shutdown();
2901        _result
2902    }
2903
2904    /// Similar to "send" but does not shutdown the channel if an error occurs.
2905    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2906        let _result = self.send_raw();
2907        self.drop_without_shutdown();
2908        _result
2909    }
2910
2911    fn send_raw(&self) -> Result<(), fidl::Error> {
2912        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2913            (),
2914            self.tx_id,
2915            0x2c54af94338c523b,
2916            fidl::encoding::DynamicFlags::empty(),
2917        )
2918    }
2919}
2920
2921#[must_use = "FIDL methods require a response to be sent"]
2922#[derive(Debug)]
2923pub struct FakeEndpointReadResponder {
2924    control_handle: std::mem::ManuallyDrop<FakeEndpointControlHandle>,
2925    tx_id: u32,
2926}
2927
2928/// Set the the channel to be shutdown (see [`FakeEndpointControlHandle::shutdown`])
2929/// if the responder is dropped without sending a response, so that the client
2930/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2931impl std::ops::Drop for FakeEndpointReadResponder {
2932    fn drop(&mut self) {
2933        self.control_handle.shutdown();
2934        // Safety: drops once, never accessed again
2935        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2936    }
2937}
2938
2939impl fidl::endpoints::Responder for FakeEndpointReadResponder {
2940    type ControlHandle = FakeEndpointControlHandle;
2941
2942    fn control_handle(&self) -> &FakeEndpointControlHandle {
2943        &self.control_handle
2944    }
2945
2946    fn drop_without_shutdown(mut self) {
2947        // Safety: drops once, never accessed again due to mem::forget
2948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2949        // Prevent Drop from running (which would shut down the channel)
2950        std::mem::forget(self);
2951    }
2952}
2953
2954impl FakeEndpointReadResponder {
2955    /// Sends a response to the FIDL transaction.
2956    ///
2957    /// Sets the channel to shutdown if an error occurs.
2958    pub fn send(self, mut data: &[u8], mut dropped_frames: u64) -> Result<(), fidl::Error> {
2959        let _result = self.send_raw(data, dropped_frames);
2960        if _result.is_err() {
2961            self.control_handle.shutdown();
2962        }
2963        self.drop_without_shutdown();
2964        _result
2965    }
2966
2967    /// Similar to "send" but does not shutdown the channel if an error occurs.
2968    pub fn send_no_shutdown_on_err(
2969        self,
2970        mut data: &[u8],
2971        mut dropped_frames: u64,
2972    ) -> Result<(), fidl::Error> {
2973        let _result = self.send_raw(data, dropped_frames);
2974        self.drop_without_shutdown();
2975        _result
2976    }
2977
2978    fn send_raw(&self, mut data: &[u8], mut dropped_frames: u64) -> Result<(), fidl::Error> {
2979        self.control_handle.inner.send::<FakeEndpointReadResponse>(
2980            (data, dropped_frames),
2981            self.tx_id,
2982            0x58e2d032a8f36234,
2983            fidl::encoding::DynamicFlags::empty(),
2984        )
2985    }
2986}
2987
2988#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2989pub struct NetworkMarker;
2990
2991impl fidl::endpoints::ProtocolMarker for NetworkMarker {
2992    type Proxy = NetworkProxy;
2993    type RequestStream = NetworkRequestStream;
2994    #[cfg(target_os = "fuchsia")]
2995    type SynchronousProxy = NetworkSynchronousProxy;
2996
2997    const DEBUG_NAME: &'static str = "(anonymous) Network";
2998}
2999
3000pub trait NetworkProxyInterface: Send + Sync {
3001    fn r#add_port(
3002        &self,
3003        port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
3004        interface: fidl::endpoints::ServerEnd<fidl_fuchsia_net_virtualization::InterfaceMarker>,
3005    ) -> Result<(), fidl::Error>;
3006    type GetConfigResponseFut: std::future::Future<Output = Result<NetworkConfig, fidl::Error>>
3007        + Send;
3008    fn r#get_config(&self) -> Self::GetConfigResponseFut;
3009    type GetNameResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
3010    fn r#get_name(&self) -> Self::GetNameResponseFut;
3011    type SetConfigResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
3012    fn r#set_config(&self, config: &NetworkConfig) -> Self::SetConfigResponseFut;
3013    type AttachEndpointResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
3014    fn r#attach_endpoint(&self, name: &str) -> Self::AttachEndpointResponseFut;
3015    type RemoveEndpointResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
3016    fn r#remove_endpoint(&self, name: &str) -> Self::RemoveEndpointResponseFut;
3017    fn r#create_fake_endpoint(
3018        &self,
3019        ep: fidl::endpoints::ServerEnd<FakeEndpointMarker>,
3020    ) -> Result<(), fidl::Error>;
3021    type StartCaptureResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
3022    fn r#start_capture(&self, name: &str) -> Self::StartCaptureResponseFut;
3023    type StopCaptureResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3024    fn r#stop_capture(&self) -> Self::StopCaptureResponseFut;
3025}
3026#[derive(Debug)]
3027#[cfg(target_os = "fuchsia")]
3028pub struct NetworkSynchronousProxy {
3029    client: fidl::client::sync::Client,
3030}
3031
3032#[cfg(target_os = "fuchsia")]
3033impl fidl::endpoints::SynchronousProxy for NetworkSynchronousProxy {
3034    type Proxy = NetworkProxy;
3035    type Protocol = NetworkMarker;
3036
3037    fn from_channel(inner: fidl::Channel) -> Self {
3038        Self::new(inner)
3039    }
3040
3041    fn into_channel(self) -> fidl::Channel {
3042        self.client.into_channel()
3043    }
3044
3045    fn as_channel(&self) -> &fidl::Channel {
3046        self.client.as_channel()
3047    }
3048}
3049
3050#[cfg(target_os = "fuchsia")]
3051impl NetworkSynchronousProxy {
3052    pub fn new(channel: fidl::Channel) -> Self {
3053        let protocol_name = <NetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3054        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3055    }
3056
3057    pub fn into_channel(self) -> fidl::Channel {
3058        self.client.into_channel()
3059    }
3060
3061    /// Waits until an event arrives and returns it. It is safe for other
3062    /// threads to make concurrent requests while waiting for an event.
3063    pub fn wait_for_event(
3064        &self,
3065        deadline: zx::MonotonicInstant,
3066    ) -> Result<NetworkEvent, fidl::Error> {
3067        NetworkEvent::decode(self.client.wait_for_event(deadline)?)
3068    }
3069
3070    /// Adds a port to the network.
3071    ///
3072    /// + request `port` port to be added.
3073    /// + request `interface` provides control over the interface.
3074    pub fn r#add_port(
3075        &self,
3076        mut port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
3077        mut interface: fidl::endpoints::ServerEnd<fidl_fuchsia_net_virtualization::InterfaceMarker>,
3078    ) -> Result<(), fidl::Error> {
3079        self.client.send::<fidl_fuchsia_net_virtualization::NetworkAddPortRequest>(
3080            (port, interface),
3081            0x7ad6a60c931a3f4e,
3082            fidl::encoding::DynamicFlags::empty(),
3083        )
3084    }
3085
3086    /// Gets network configuration.
3087    pub fn r#get_config(
3088        &self,
3089        ___deadline: zx::MonotonicInstant,
3090    ) -> Result<NetworkConfig, fidl::Error> {
3091        let _response =
3092            self.client.send_query::<fidl::encoding::EmptyPayload, NetworkGetConfigResponse>(
3093                (),
3094                0x8dc04557e2ab069,
3095                fidl::encoding::DynamicFlags::empty(),
3096                ___deadline,
3097            )?;
3098        Ok(_response.config)
3099    }
3100
3101    /// Gets network name.
3102    pub fn r#get_name(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
3103        let _response =
3104            self.client.send_query::<fidl::encoding::EmptyPayload, NetworkGetNameResponse>(
3105                (),
3106                0x57b7701d1ffeedb1,
3107                fidl::encoding::DynamicFlags::empty(),
3108                ___deadline,
3109            )?;
3110        Ok(_response.name)
3111    }
3112
3113    /// Updates network configuration.
3114    pub fn r#set_config(
3115        &self,
3116        mut config: &NetworkConfig,
3117        ___deadline: zx::MonotonicInstant,
3118    ) -> Result<i32, fidl::Error> {
3119        let _response =
3120            self.client.send_query::<NetworkSetConfigRequest, NetworkSetConfigResponse>(
3121                (config,),
3122                0x18a490ee9d4bfa16,
3123                fidl::encoding::DynamicFlags::empty(),
3124                ___deadline,
3125            )?;
3126        Ok(_response.status)
3127    }
3128
3129    /// Attaches endpoint with given name to network.
3130    pub fn r#attach_endpoint(
3131        &self,
3132        mut name: &str,
3133        ___deadline: zx::MonotonicInstant,
3134    ) -> Result<i32, fidl::Error> {
3135        let _response =
3136            self.client.send_query::<NetworkAttachEndpointRequest, NetworkAttachEndpointResponse>(
3137                (name,),
3138                0x6e8ff8e9ea1b9a98,
3139                fidl::encoding::DynamicFlags::empty(),
3140                ___deadline,
3141            )?;
3142        Ok(_response.status)
3143    }
3144
3145    /// Removes endpoint with given name from network.
3146    pub fn r#remove_endpoint(
3147        &self,
3148        mut name: &str,
3149        ___deadline: zx::MonotonicInstant,
3150    ) -> Result<i32, fidl::Error> {
3151        let _response =
3152            self.client.send_query::<NetworkRemoveEndpointRequest, NetworkRemoveEndpointResponse>(
3153                (name,),
3154                0x298eaac56bfcdd25,
3155                fidl::encoding::DynamicFlags::empty(),
3156                ___deadline,
3157            )?;
3158        Ok(_response.status)
3159    }
3160
3161    /// Injects a fake endpoint.
3162    pub fn r#create_fake_endpoint(
3163        &self,
3164        mut ep: fidl::endpoints::ServerEnd<FakeEndpointMarker>,
3165    ) -> Result<(), fidl::Error> {
3166        self.client.send::<NetworkCreateFakeEndpointRequest>(
3167            (ep,),
3168            0x3eb8f71b45e1e1f3,
3169            fidl::encoding::DynamicFlags::empty(),
3170        )
3171    }
3172
3173    /// Starts capturing packet in this network.
3174    ///
3175    /// The packet capture will be stored at `/custom_artifacts/{name}.pcapng`.
3176    ///
3177    /// Returns [`ZX_ERR_ALREADY_EXISTS`] if the capturing is already started
3178    /// in this network.
3179    pub fn r#start_capture(
3180        &self,
3181        mut name: &str,
3182        ___deadline: zx::MonotonicInstant,
3183    ) -> Result<i32, fidl::Error> {
3184        let _response =
3185            self.client.send_query::<NetworkStartCaptureRequest, NetworkStartCaptureResponse>(
3186                (name,),
3187                0x3ca44940622932c,
3188                fidl::encoding::DynamicFlags::empty(),
3189                ___deadline,
3190            )?;
3191        Ok(_response.status)
3192    }
3193
3194    /// Stops capturing packets. This function is guaranteed to succeed.
3195    ///
3196    /// The packet capture will be stored in the file at the path chosen when
3197    /// capturing started. The packet capture will stop automatically once the
3198    /// network is destroyed regardless of whether this method is called.
3199    pub fn r#stop_capture(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
3200        let _response =
3201            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
3202                (),
3203                0x1d7827adad109468,
3204                fidl::encoding::DynamicFlags::empty(),
3205                ___deadline,
3206            )?;
3207        Ok(_response)
3208    }
3209}
3210
3211#[derive(Debug, Clone)]
3212pub struct NetworkProxy {
3213    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3214}
3215
3216impl fidl::endpoints::Proxy for NetworkProxy {
3217    type Protocol = NetworkMarker;
3218
3219    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3220        Self::new(inner)
3221    }
3222
3223    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3224        self.client.into_channel().map_err(|client| Self { client })
3225    }
3226
3227    fn as_channel(&self) -> &::fidl::AsyncChannel {
3228        self.client.as_channel()
3229    }
3230}
3231
3232impl NetworkProxy {
3233    /// Create a new Proxy for fuchsia.netemul.network/Network.
3234    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3235        let protocol_name = <NetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3236        Self { client: fidl::client::Client::new(channel, protocol_name) }
3237    }
3238
3239    /// Get a Stream of events from the remote end of the protocol.
3240    ///
3241    /// # Panics
3242    ///
3243    /// Panics if the event stream was already taken.
3244    pub fn take_event_stream(&self) -> NetworkEventStream {
3245        NetworkEventStream { event_receiver: self.client.take_event_receiver() }
3246    }
3247
3248    /// Adds a port to the network.
3249    ///
3250    /// + request `port` port to be added.
3251    /// + request `interface` provides control over the interface.
3252    pub fn r#add_port(
3253        &self,
3254        mut port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
3255        mut interface: fidl::endpoints::ServerEnd<fidl_fuchsia_net_virtualization::InterfaceMarker>,
3256    ) -> Result<(), fidl::Error> {
3257        NetworkProxyInterface::r#add_port(self, port, interface)
3258    }
3259
3260    /// Gets network configuration.
3261    pub fn r#get_config(
3262        &self,
3263    ) -> fidl::client::QueryResponseFut<NetworkConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
3264    {
3265        NetworkProxyInterface::r#get_config(self)
3266    }
3267
3268    /// Gets network name.
3269    pub fn r#get_name(
3270        &self,
3271    ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
3272        NetworkProxyInterface::r#get_name(self)
3273    }
3274
3275    /// Updates network configuration.
3276    pub fn r#set_config(
3277        &self,
3278        mut config: &NetworkConfig,
3279    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
3280        NetworkProxyInterface::r#set_config(self, config)
3281    }
3282
3283    /// Attaches endpoint with given name to network.
3284    pub fn r#attach_endpoint(
3285        &self,
3286        mut name: &str,
3287    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
3288        NetworkProxyInterface::r#attach_endpoint(self, name)
3289    }
3290
3291    /// Removes endpoint with given name from network.
3292    pub fn r#remove_endpoint(
3293        &self,
3294        mut name: &str,
3295    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
3296        NetworkProxyInterface::r#remove_endpoint(self, name)
3297    }
3298
3299    /// Injects a fake endpoint.
3300    pub fn r#create_fake_endpoint(
3301        &self,
3302        mut ep: fidl::endpoints::ServerEnd<FakeEndpointMarker>,
3303    ) -> Result<(), fidl::Error> {
3304        NetworkProxyInterface::r#create_fake_endpoint(self, ep)
3305    }
3306
3307    /// Starts capturing packet in this network.
3308    ///
3309    /// The packet capture will be stored at `/custom_artifacts/{name}.pcapng`.
3310    ///
3311    /// Returns [`ZX_ERR_ALREADY_EXISTS`] if the capturing is already started
3312    /// in this network.
3313    pub fn r#start_capture(
3314        &self,
3315        mut name: &str,
3316    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
3317        NetworkProxyInterface::r#start_capture(self, name)
3318    }
3319
3320    /// Stops capturing packets. This function is guaranteed to succeed.
3321    ///
3322    /// The packet capture will be stored in the file at the path chosen when
3323    /// capturing started. The packet capture will stop automatically once the
3324    /// network is destroyed regardless of whether this method is called.
3325    pub fn r#stop_capture(
3326        &self,
3327    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3328        NetworkProxyInterface::r#stop_capture(self)
3329    }
3330}
3331
3332impl NetworkProxyInterface for NetworkProxy {
3333    fn r#add_port(
3334        &self,
3335        mut port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
3336        mut interface: fidl::endpoints::ServerEnd<fidl_fuchsia_net_virtualization::InterfaceMarker>,
3337    ) -> Result<(), fidl::Error> {
3338        self.client.send::<fidl_fuchsia_net_virtualization::NetworkAddPortRequest>(
3339            (port, interface),
3340            0x7ad6a60c931a3f4e,
3341            fidl::encoding::DynamicFlags::empty(),
3342        )
3343    }
3344
3345    type GetConfigResponseFut = fidl::client::QueryResponseFut<
3346        NetworkConfig,
3347        fidl::encoding::DefaultFuchsiaResourceDialect,
3348    >;
3349    fn r#get_config(&self) -> Self::GetConfigResponseFut {
3350        fn _decode(
3351            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3352        ) -> Result<NetworkConfig, fidl::Error> {
3353            let _response = fidl::client::decode_transaction_body::<
3354                NetworkGetConfigResponse,
3355                fidl::encoding::DefaultFuchsiaResourceDialect,
3356                0x8dc04557e2ab069,
3357            >(_buf?)?;
3358            Ok(_response.config)
3359        }
3360        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, NetworkConfig>(
3361            (),
3362            0x8dc04557e2ab069,
3363            fidl::encoding::DynamicFlags::empty(),
3364            _decode,
3365        )
3366    }
3367
3368    type GetNameResponseFut =
3369        fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
3370    fn r#get_name(&self) -> Self::GetNameResponseFut {
3371        fn _decode(
3372            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3373        ) -> Result<String, fidl::Error> {
3374            let _response = fidl::client::decode_transaction_body::<
3375                NetworkGetNameResponse,
3376                fidl::encoding::DefaultFuchsiaResourceDialect,
3377                0x57b7701d1ffeedb1,
3378            >(_buf?)?;
3379            Ok(_response.name)
3380        }
3381        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
3382            (),
3383            0x57b7701d1ffeedb1,
3384            fidl::encoding::DynamicFlags::empty(),
3385            _decode,
3386        )
3387    }
3388
3389    type SetConfigResponseFut =
3390        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
3391    fn r#set_config(&self, mut config: &NetworkConfig) -> Self::SetConfigResponseFut {
3392        fn _decode(
3393            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3394        ) -> Result<i32, fidl::Error> {
3395            let _response = fidl::client::decode_transaction_body::<
3396                NetworkSetConfigResponse,
3397                fidl::encoding::DefaultFuchsiaResourceDialect,
3398                0x18a490ee9d4bfa16,
3399            >(_buf?)?;
3400            Ok(_response.status)
3401        }
3402        self.client.send_query_and_decode::<NetworkSetConfigRequest, i32>(
3403            (config,),
3404            0x18a490ee9d4bfa16,
3405            fidl::encoding::DynamicFlags::empty(),
3406            _decode,
3407        )
3408    }
3409
3410    type AttachEndpointResponseFut =
3411        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
3412    fn r#attach_endpoint(&self, mut name: &str) -> Self::AttachEndpointResponseFut {
3413        fn _decode(
3414            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3415        ) -> Result<i32, fidl::Error> {
3416            let _response = fidl::client::decode_transaction_body::<
3417                NetworkAttachEndpointResponse,
3418                fidl::encoding::DefaultFuchsiaResourceDialect,
3419                0x6e8ff8e9ea1b9a98,
3420            >(_buf?)?;
3421            Ok(_response.status)
3422        }
3423        self.client.send_query_and_decode::<NetworkAttachEndpointRequest, i32>(
3424            (name,),
3425            0x6e8ff8e9ea1b9a98,
3426            fidl::encoding::DynamicFlags::empty(),
3427            _decode,
3428        )
3429    }
3430
3431    type RemoveEndpointResponseFut =
3432        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
3433    fn r#remove_endpoint(&self, mut name: &str) -> Self::RemoveEndpointResponseFut {
3434        fn _decode(
3435            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3436        ) -> Result<i32, fidl::Error> {
3437            let _response = fidl::client::decode_transaction_body::<
3438                NetworkRemoveEndpointResponse,
3439                fidl::encoding::DefaultFuchsiaResourceDialect,
3440                0x298eaac56bfcdd25,
3441            >(_buf?)?;
3442            Ok(_response.status)
3443        }
3444        self.client.send_query_and_decode::<NetworkRemoveEndpointRequest, i32>(
3445            (name,),
3446            0x298eaac56bfcdd25,
3447            fidl::encoding::DynamicFlags::empty(),
3448            _decode,
3449        )
3450    }
3451
3452    fn r#create_fake_endpoint(
3453        &self,
3454        mut ep: fidl::endpoints::ServerEnd<FakeEndpointMarker>,
3455    ) -> Result<(), fidl::Error> {
3456        self.client.send::<NetworkCreateFakeEndpointRequest>(
3457            (ep,),
3458            0x3eb8f71b45e1e1f3,
3459            fidl::encoding::DynamicFlags::empty(),
3460        )
3461    }
3462
3463    type StartCaptureResponseFut =
3464        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
3465    fn r#start_capture(&self, mut name: &str) -> Self::StartCaptureResponseFut {
3466        fn _decode(
3467            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3468        ) -> Result<i32, fidl::Error> {
3469            let _response = fidl::client::decode_transaction_body::<
3470                NetworkStartCaptureResponse,
3471                fidl::encoding::DefaultFuchsiaResourceDialect,
3472                0x3ca44940622932c,
3473            >(_buf?)?;
3474            Ok(_response.status)
3475        }
3476        self.client.send_query_and_decode::<NetworkStartCaptureRequest, i32>(
3477            (name,),
3478            0x3ca44940622932c,
3479            fidl::encoding::DynamicFlags::empty(),
3480            _decode,
3481        )
3482    }
3483
3484    type StopCaptureResponseFut =
3485        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3486    fn r#stop_capture(&self) -> Self::StopCaptureResponseFut {
3487        fn _decode(
3488            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3489        ) -> Result<(), fidl::Error> {
3490            let _response = fidl::client::decode_transaction_body::<
3491                fidl::encoding::EmptyPayload,
3492                fidl::encoding::DefaultFuchsiaResourceDialect,
3493                0x1d7827adad109468,
3494            >(_buf?)?;
3495            Ok(_response)
3496        }
3497        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
3498            (),
3499            0x1d7827adad109468,
3500            fidl::encoding::DynamicFlags::empty(),
3501            _decode,
3502        )
3503    }
3504}
3505
3506pub struct NetworkEventStream {
3507    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3508}
3509
3510impl std::marker::Unpin for NetworkEventStream {}
3511
3512impl futures::stream::FusedStream for NetworkEventStream {
3513    fn is_terminated(&self) -> bool {
3514        self.event_receiver.is_terminated()
3515    }
3516}
3517
3518impl futures::Stream for NetworkEventStream {
3519    type Item = Result<NetworkEvent, fidl::Error>;
3520
3521    fn poll_next(
3522        mut self: std::pin::Pin<&mut Self>,
3523        cx: &mut std::task::Context<'_>,
3524    ) -> std::task::Poll<Option<Self::Item>> {
3525        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3526            &mut self.event_receiver,
3527            cx
3528        )?) {
3529            Some(buf) => std::task::Poll::Ready(Some(NetworkEvent::decode(buf))),
3530            None => std::task::Poll::Ready(None),
3531        }
3532    }
3533}
3534
3535#[derive(Debug)]
3536pub enum NetworkEvent {
3537    OnRemoved { reason: fidl_fuchsia_net_virtualization::NetworkRemovalReason },
3538}
3539
3540impl NetworkEvent {
3541    #[allow(irrefutable_let_patterns)]
3542    pub fn into_on_removed(self) -> Option<fidl_fuchsia_net_virtualization::NetworkRemovalReason> {
3543        if let NetworkEvent::OnRemoved { reason } = self {
3544            Some((reason))
3545        } else {
3546            None
3547        }
3548    }
3549
3550    /// Decodes a message buffer as a [`NetworkEvent`].
3551    fn decode(
3552        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3553    ) -> Result<NetworkEvent, fidl::Error> {
3554        let (bytes, _handles) = buf.split_mut();
3555        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3556        debug_assert_eq!(tx_header.tx_id, 0);
3557        match tx_header.ordinal {
3558            0xfe80656d1e5ec4a => {
3559                let mut out = fidl::new_empty!(
3560                    fidl_fuchsia_net_virtualization::NetworkOnRemovedRequest,
3561                    fidl::encoding::DefaultFuchsiaResourceDialect
3562                );
3563                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_net_virtualization::NetworkOnRemovedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3564                Ok((NetworkEvent::OnRemoved { reason: out.reason }))
3565            }
3566            _ => Err(fidl::Error::UnknownOrdinal {
3567                ordinal: tx_header.ordinal,
3568                protocol_name: <NetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3569            }),
3570        }
3571    }
3572}
3573
3574/// A Stream of incoming requests for fuchsia.netemul.network/Network.
3575pub struct NetworkRequestStream {
3576    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3577    is_terminated: bool,
3578}
3579
3580impl std::marker::Unpin for NetworkRequestStream {}
3581
3582impl futures::stream::FusedStream for NetworkRequestStream {
3583    fn is_terminated(&self) -> bool {
3584        self.is_terminated
3585    }
3586}
3587
3588impl fidl::endpoints::RequestStream for NetworkRequestStream {
3589    type Protocol = NetworkMarker;
3590    type ControlHandle = NetworkControlHandle;
3591
3592    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3593        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3594    }
3595
3596    fn control_handle(&self) -> Self::ControlHandle {
3597        NetworkControlHandle { inner: self.inner.clone() }
3598    }
3599
3600    fn into_inner(
3601        self,
3602    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3603    {
3604        (self.inner, self.is_terminated)
3605    }
3606
3607    fn from_inner(
3608        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3609        is_terminated: bool,
3610    ) -> Self {
3611        Self { inner, is_terminated }
3612    }
3613}
3614
3615impl futures::Stream for NetworkRequestStream {
3616    type Item = Result<NetworkRequest, fidl::Error>;
3617
3618    fn poll_next(
3619        mut self: std::pin::Pin<&mut Self>,
3620        cx: &mut std::task::Context<'_>,
3621    ) -> std::task::Poll<Option<Self::Item>> {
3622        let this = &mut *self;
3623        if this.inner.check_shutdown(cx) {
3624            this.is_terminated = true;
3625            return std::task::Poll::Ready(None);
3626        }
3627        if this.is_terminated {
3628            panic!("polled NetworkRequestStream after completion");
3629        }
3630        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3631            |bytes, handles| {
3632                match this.inner.channel().read_etc(cx, bytes, handles) {
3633                    std::task::Poll::Ready(Ok(())) => {}
3634                    std::task::Poll::Pending => return std::task::Poll::Pending,
3635                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3636                        this.is_terminated = true;
3637                        return std::task::Poll::Ready(None);
3638                    }
3639                    std::task::Poll::Ready(Err(e)) => {
3640                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3641                            e.into(),
3642                        ))))
3643                    }
3644                }
3645
3646                // A message has been received from the channel
3647                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3648
3649                std::task::Poll::Ready(Some(match header.ordinal {
3650                    0x7ad6a60c931a3f4e => {
3651                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3652                        let mut req = fidl::new_empty!(
3653                            fidl_fuchsia_net_virtualization::NetworkAddPortRequest,
3654                            fidl::encoding::DefaultFuchsiaResourceDialect
3655                        );
3656                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_net_virtualization::NetworkAddPortRequest>(&header, _body_bytes, handles, &mut req)?;
3657                        let control_handle = NetworkControlHandle { inner: this.inner.clone() };
3658                        Ok(NetworkRequest::AddPort {
3659                            port: req.port,
3660                            interface: req.interface,
3661
3662                            control_handle,
3663                        })
3664                    }
3665                    0x8dc04557e2ab069 => {
3666                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3667                        let mut req = fidl::new_empty!(
3668                            fidl::encoding::EmptyPayload,
3669                            fidl::encoding::DefaultFuchsiaResourceDialect
3670                        );
3671                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3672                        let control_handle = NetworkControlHandle { inner: this.inner.clone() };
3673                        Ok(NetworkRequest::GetConfig {
3674                            responder: NetworkGetConfigResponder {
3675                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3676                                tx_id: header.tx_id,
3677                            },
3678                        })
3679                    }
3680                    0x57b7701d1ffeedb1 => {
3681                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3682                        let mut req = fidl::new_empty!(
3683                            fidl::encoding::EmptyPayload,
3684                            fidl::encoding::DefaultFuchsiaResourceDialect
3685                        );
3686                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3687                        let control_handle = NetworkControlHandle { inner: this.inner.clone() };
3688                        Ok(NetworkRequest::GetName {
3689                            responder: NetworkGetNameResponder {
3690                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3691                                tx_id: header.tx_id,
3692                            },
3693                        })
3694                    }
3695                    0x18a490ee9d4bfa16 => {
3696                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3697                        let mut req = fidl::new_empty!(
3698                            NetworkSetConfigRequest,
3699                            fidl::encoding::DefaultFuchsiaResourceDialect
3700                        );
3701                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkSetConfigRequest>(&header, _body_bytes, handles, &mut req)?;
3702                        let control_handle = NetworkControlHandle { inner: this.inner.clone() };
3703                        Ok(NetworkRequest::SetConfig {
3704                            config: req.config,
3705
3706                            responder: NetworkSetConfigResponder {
3707                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3708                                tx_id: header.tx_id,
3709                            },
3710                        })
3711                    }
3712                    0x6e8ff8e9ea1b9a98 => {
3713                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3714                        let mut req = fidl::new_empty!(
3715                            NetworkAttachEndpointRequest,
3716                            fidl::encoding::DefaultFuchsiaResourceDialect
3717                        );
3718                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkAttachEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
3719                        let control_handle = NetworkControlHandle { inner: this.inner.clone() };
3720                        Ok(NetworkRequest::AttachEndpoint {
3721                            name: req.name,
3722
3723                            responder: NetworkAttachEndpointResponder {
3724                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3725                                tx_id: header.tx_id,
3726                            },
3727                        })
3728                    }
3729                    0x298eaac56bfcdd25 => {
3730                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3731                        let mut req = fidl::new_empty!(
3732                            NetworkRemoveEndpointRequest,
3733                            fidl::encoding::DefaultFuchsiaResourceDialect
3734                        );
3735                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRemoveEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
3736                        let control_handle = NetworkControlHandle { inner: this.inner.clone() };
3737                        Ok(NetworkRequest::RemoveEndpoint {
3738                            name: req.name,
3739
3740                            responder: NetworkRemoveEndpointResponder {
3741                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3742                                tx_id: header.tx_id,
3743                            },
3744                        })
3745                    }
3746                    0x3eb8f71b45e1e1f3 => {
3747                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3748                        let mut req = fidl::new_empty!(
3749                            NetworkCreateFakeEndpointRequest,
3750                            fidl::encoding::DefaultFuchsiaResourceDialect
3751                        );
3752                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkCreateFakeEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
3753                        let control_handle = NetworkControlHandle { inner: this.inner.clone() };
3754                        Ok(NetworkRequest::CreateFakeEndpoint { ep: req.ep, control_handle })
3755                    }
3756                    0x3ca44940622932c => {
3757                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3758                        let mut req = fidl::new_empty!(
3759                            NetworkStartCaptureRequest,
3760                            fidl::encoding::DefaultFuchsiaResourceDialect
3761                        );
3762                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkStartCaptureRequest>(&header, _body_bytes, handles, &mut req)?;
3763                        let control_handle = NetworkControlHandle { inner: this.inner.clone() };
3764                        Ok(NetworkRequest::StartCapture {
3765                            name: req.name,
3766
3767                            responder: NetworkStartCaptureResponder {
3768                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3769                                tx_id: header.tx_id,
3770                            },
3771                        })
3772                    }
3773                    0x1d7827adad109468 => {
3774                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3775                        let mut req = fidl::new_empty!(
3776                            fidl::encoding::EmptyPayload,
3777                            fidl::encoding::DefaultFuchsiaResourceDialect
3778                        );
3779                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3780                        let control_handle = NetworkControlHandle { inner: this.inner.clone() };
3781                        Ok(NetworkRequest::StopCapture {
3782                            responder: NetworkStopCaptureResponder {
3783                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3784                                tx_id: header.tx_id,
3785                            },
3786                        })
3787                    }
3788                    _ => Err(fidl::Error::UnknownOrdinal {
3789                        ordinal: header.ordinal,
3790                        protocol_name:
3791                            <NetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3792                    }),
3793                }))
3794            },
3795        )
3796    }
3797}
3798
3799/// Virtual network.
3800#[derive(Debug)]
3801pub enum NetworkRequest {
3802    /// Adds a port to the network.
3803    ///
3804    /// + request `port` port to be added.
3805    /// + request `interface` provides control over the interface.
3806    AddPort {
3807        port: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
3808        interface: fidl::endpoints::ServerEnd<fidl_fuchsia_net_virtualization::InterfaceMarker>,
3809        control_handle: NetworkControlHandle,
3810    },
3811    /// Gets network configuration.
3812    GetConfig { responder: NetworkGetConfigResponder },
3813    /// Gets network name.
3814    GetName { responder: NetworkGetNameResponder },
3815    /// Updates network configuration.
3816    SetConfig { config: NetworkConfig, responder: NetworkSetConfigResponder },
3817    /// Attaches endpoint with given name to network.
3818    AttachEndpoint { name: String, responder: NetworkAttachEndpointResponder },
3819    /// Removes endpoint with given name from network.
3820    RemoveEndpoint { name: String, responder: NetworkRemoveEndpointResponder },
3821    /// Injects a fake endpoint.
3822    CreateFakeEndpoint {
3823        ep: fidl::endpoints::ServerEnd<FakeEndpointMarker>,
3824        control_handle: NetworkControlHandle,
3825    },
3826    /// Starts capturing packet in this network.
3827    ///
3828    /// The packet capture will be stored at `/custom_artifacts/{name}.pcapng`.
3829    ///
3830    /// Returns [`ZX_ERR_ALREADY_EXISTS`] if the capturing is already started
3831    /// in this network.
3832    StartCapture { name: String, responder: NetworkStartCaptureResponder },
3833    /// Stops capturing packets. This function is guaranteed to succeed.
3834    ///
3835    /// The packet capture will be stored in the file at the path chosen when
3836    /// capturing started. The packet capture will stop automatically once the
3837    /// network is destroyed regardless of whether this method is called.
3838    StopCapture { responder: NetworkStopCaptureResponder },
3839}
3840
3841impl NetworkRequest {
3842    #[allow(irrefutable_let_patterns)]
3843    pub fn into_add_port(
3844        self,
3845    ) -> Option<(
3846        fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
3847        fidl::endpoints::ServerEnd<fidl_fuchsia_net_virtualization::InterfaceMarker>,
3848        NetworkControlHandle,
3849    )> {
3850        if let NetworkRequest::AddPort { port, interface, control_handle } = self {
3851            Some((port, interface, control_handle))
3852        } else {
3853            None
3854        }
3855    }
3856
3857    #[allow(irrefutable_let_patterns)]
3858    pub fn into_get_config(self) -> Option<(NetworkGetConfigResponder)> {
3859        if let NetworkRequest::GetConfig { responder } = self {
3860            Some((responder))
3861        } else {
3862            None
3863        }
3864    }
3865
3866    #[allow(irrefutable_let_patterns)]
3867    pub fn into_get_name(self) -> Option<(NetworkGetNameResponder)> {
3868        if let NetworkRequest::GetName { responder } = self {
3869            Some((responder))
3870        } else {
3871            None
3872        }
3873    }
3874
3875    #[allow(irrefutable_let_patterns)]
3876    pub fn into_set_config(self) -> Option<(NetworkConfig, NetworkSetConfigResponder)> {
3877        if let NetworkRequest::SetConfig { config, responder } = self {
3878            Some((config, responder))
3879        } else {
3880            None
3881        }
3882    }
3883
3884    #[allow(irrefutable_let_patterns)]
3885    pub fn into_attach_endpoint(self) -> Option<(String, NetworkAttachEndpointResponder)> {
3886        if let NetworkRequest::AttachEndpoint { name, responder } = self {
3887            Some((name, responder))
3888        } else {
3889            None
3890        }
3891    }
3892
3893    #[allow(irrefutable_let_patterns)]
3894    pub fn into_remove_endpoint(self) -> Option<(String, NetworkRemoveEndpointResponder)> {
3895        if let NetworkRequest::RemoveEndpoint { name, responder } = self {
3896            Some((name, responder))
3897        } else {
3898            None
3899        }
3900    }
3901
3902    #[allow(irrefutable_let_patterns)]
3903    pub fn into_create_fake_endpoint(
3904        self,
3905    ) -> Option<(fidl::endpoints::ServerEnd<FakeEndpointMarker>, NetworkControlHandle)> {
3906        if let NetworkRequest::CreateFakeEndpoint { ep, control_handle } = self {
3907            Some((ep, control_handle))
3908        } else {
3909            None
3910        }
3911    }
3912
3913    #[allow(irrefutable_let_patterns)]
3914    pub fn into_start_capture(self) -> Option<(String, NetworkStartCaptureResponder)> {
3915        if let NetworkRequest::StartCapture { name, responder } = self {
3916            Some((name, responder))
3917        } else {
3918            None
3919        }
3920    }
3921
3922    #[allow(irrefutable_let_patterns)]
3923    pub fn into_stop_capture(self) -> Option<(NetworkStopCaptureResponder)> {
3924        if let NetworkRequest::StopCapture { responder } = self {
3925            Some((responder))
3926        } else {
3927            None
3928        }
3929    }
3930
3931    /// Name of the method defined in FIDL
3932    pub fn method_name(&self) -> &'static str {
3933        match *self {
3934            NetworkRequest::AddPort { .. } => "add_port",
3935            NetworkRequest::GetConfig { .. } => "get_config",
3936            NetworkRequest::GetName { .. } => "get_name",
3937            NetworkRequest::SetConfig { .. } => "set_config",
3938            NetworkRequest::AttachEndpoint { .. } => "attach_endpoint",
3939            NetworkRequest::RemoveEndpoint { .. } => "remove_endpoint",
3940            NetworkRequest::CreateFakeEndpoint { .. } => "create_fake_endpoint",
3941            NetworkRequest::StartCapture { .. } => "start_capture",
3942            NetworkRequest::StopCapture { .. } => "stop_capture",
3943        }
3944    }
3945}
3946
3947#[derive(Debug, Clone)]
3948pub struct NetworkControlHandle {
3949    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3950}
3951
3952impl fidl::endpoints::ControlHandle for NetworkControlHandle {
3953    fn shutdown(&self) {
3954        self.inner.shutdown()
3955    }
3956    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3957        self.inner.shutdown_with_epitaph(status)
3958    }
3959
3960    fn is_closed(&self) -> bool {
3961        self.inner.channel().is_closed()
3962    }
3963    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3964        self.inner.channel().on_closed()
3965    }
3966
3967    #[cfg(target_os = "fuchsia")]
3968    fn signal_peer(
3969        &self,
3970        clear_mask: zx::Signals,
3971        set_mask: zx::Signals,
3972    ) -> Result<(), zx_status::Status> {
3973        use fidl::Peered;
3974        self.inner.channel().signal_peer(clear_mask, set_mask)
3975    }
3976}
3977
3978impl NetworkControlHandle {
3979    pub fn send_on_removed(
3980        &self,
3981        mut reason: fidl_fuchsia_net_virtualization::NetworkRemovalReason,
3982    ) -> Result<(), fidl::Error> {
3983        self.inner.send::<fidl_fuchsia_net_virtualization::NetworkOnRemovedRequest>(
3984            (reason,),
3985            0,
3986            0xfe80656d1e5ec4a,
3987            fidl::encoding::DynamicFlags::empty(),
3988        )
3989    }
3990}
3991
3992#[must_use = "FIDL methods require a response to be sent"]
3993#[derive(Debug)]
3994pub struct NetworkGetConfigResponder {
3995    control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
3996    tx_id: u32,
3997}
3998
3999/// Set the the channel to be shutdown (see [`NetworkControlHandle::shutdown`])
4000/// if the responder is dropped without sending a response, so that the client
4001/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4002impl std::ops::Drop for NetworkGetConfigResponder {
4003    fn drop(&mut self) {
4004        self.control_handle.shutdown();
4005        // Safety: drops once, never accessed again
4006        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4007    }
4008}
4009
4010impl fidl::endpoints::Responder for NetworkGetConfigResponder {
4011    type ControlHandle = NetworkControlHandle;
4012
4013    fn control_handle(&self) -> &NetworkControlHandle {
4014        &self.control_handle
4015    }
4016
4017    fn drop_without_shutdown(mut self) {
4018        // Safety: drops once, never accessed again due to mem::forget
4019        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4020        // Prevent Drop from running (which would shut down the channel)
4021        std::mem::forget(self);
4022    }
4023}
4024
4025impl NetworkGetConfigResponder {
4026    /// Sends a response to the FIDL transaction.
4027    ///
4028    /// Sets the channel to shutdown if an error occurs.
4029    pub fn send(self, mut config: &NetworkConfig) -> Result<(), fidl::Error> {
4030        let _result = self.send_raw(config);
4031        if _result.is_err() {
4032            self.control_handle.shutdown();
4033        }
4034        self.drop_without_shutdown();
4035        _result
4036    }
4037
4038    /// Similar to "send" but does not shutdown the channel if an error occurs.
4039    pub fn send_no_shutdown_on_err(self, mut config: &NetworkConfig) -> Result<(), fidl::Error> {
4040        let _result = self.send_raw(config);
4041        self.drop_without_shutdown();
4042        _result
4043    }
4044
4045    fn send_raw(&self, mut config: &NetworkConfig) -> Result<(), fidl::Error> {
4046        self.control_handle.inner.send::<NetworkGetConfigResponse>(
4047            (config,),
4048            self.tx_id,
4049            0x8dc04557e2ab069,
4050            fidl::encoding::DynamicFlags::empty(),
4051        )
4052    }
4053}
4054
4055#[must_use = "FIDL methods require a response to be sent"]
4056#[derive(Debug)]
4057pub struct NetworkGetNameResponder {
4058    control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
4059    tx_id: u32,
4060}
4061
4062/// Set the the channel to be shutdown (see [`NetworkControlHandle::shutdown`])
4063/// if the responder is dropped without sending a response, so that the client
4064/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4065impl std::ops::Drop for NetworkGetNameResponder {
4066    fn drop(&mut self) {
4067        self.control_handle.shutdown();
4068        // Safety: drops once, never accessed again
4069        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4070    }
4071}
4072
4073impl fidl::endpoints::Responder for NetworkGetNameResponder {
4074    type ControlHandle = NetworkControlHandle;
4075
4076    fn control_handle(&self) -> &NetworkControlHandle {
4077        &self.control_handle
4078    }
4079
4080    fn drop_without_shutdown(mut self) {
4081        // Safety: drops once, never accessed again due to mem::forget
4082        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4083        // Prevent Drop from running (which would shut down the channel)
4084        std::mem::forget(self);
4085    }
4086}
4087
4088impl NetworkGetNameResponder {
4089    /// Sends a response to the FIDL transaction.
4090    ///
4091    /// Sets the channel to shutdown if an error occurs.
4092    pub fn send(self, mut name: &str) -> Result<(), fidl::Error> {
4093        let _result = self.send_raw(name);
4094        if _result.is_err() {
4095            self.control_handle.shutdown();
4096        }
4097        self.drop_without_shutdown();
4098        _result
4099    }
4100
4101    /// Similar to "send" but does not shutdown the channel if an error occurs.
4102    pub fn send_no_shutdown_on_err(self, mut name: &str) -> Result<(), fidl::Error> {
4103        let _result = self.send_raw(name);
4104        self.drop_without_shutdown();
4105        _result
4106    }
4107
4108    fn send_raw(&self, mut name: &str) -> Result<(), fidl::Error> {
4109        self.control_handle.inner.send::<NetworkGetNameResponse>(
4110            (name,),
4111            self.tx_id,
4112            0x57b7701d1ffeedb1,
4113            fidl::encoding::DynamicFlags::empty(),
4114        )
4115    }
4116}
4117
4118#[must_use = "FIDL methods require a response to be sent"]
4119#[derive(Debug)]
4120pub struct NetworkSetConfigResponder {
4121    control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
4122    tx_id: u32,
4123}
4124
4125/// Set the the channel to be shutdown (see [`NetworkControlHandle::shutdown`])
4126/// if the responder is dropped without sending a response, so that the client
4127/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4128impl std::ops::Drop for NetworkSetConfigResponder {
4129    fn drop(&mut self) {
4130        self.control_handle.shutdown();
4131        // Safety: drops once, never accessed again
4132        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4133    }
4134}
4135
4136impl fidl::endpoints::Responder for NetworkSetConfigResponder {
4137    type ControlHandle = NetworkControlHandle;
4138
4139    fn control_handle(&self) -> &NetworkControlHandle {
4140        &self.control_handle
4141    }
4142
4143    fn drop_without_shutdown(mut self) {
4144        // Safety: drops once, never accessed again due to mem::forget
4145        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4146        // Prevent Drop from running (which would shut down the channel)
4147        std::mem::forget(self);
4148    }
4149}
4150
4151impl NetworkSetConfigResponder {
4152    /// Sends a response to the FIDL transaction.
4153    ///
4154    /// Sets the channel to shutdown if an error occurs.
4155    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
4156        let _result = self.send_raw(status);
4157        if _result.is_err() {
4158            self.control_handle.shutdown();
4159        }
4160        self.drop_without_shutdown();
4161        _result
4162    }
4163
4164    /// Similar to "send" but does not shutdown the channel if an error occurs.
4165    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
4166        let _result = self.send_raw(status);
4167        self.drop_without_shutdown();
4168        _result
4169    }
4170
4171    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
4172        self.control_handle.inner.send::<NetworkSetConfigResponse>(
4173            (status,),
4174            self.tx_id,
4175            0x18a490ee9d4bfa16,
4176            fidl::encoding::DynamicFlags::empty(),
4177        )
4178    }
4179}
4180
4181#[must_use = "FIDL methods require a response to be sent"]
4182#[derive(Debug)]
4183pub struct NetworkAttachEndpointResponder {
4184    control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
4185    tx_id: u32,
4186}
4187
4188/// Set the the channel to be shutdown (see [`NetworkControlHandle::shutdown`])
4189/// if the responder is dropped without sending a response, so that the client
4190/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4191impl std::ops::Drop for NetworkAttachEndpointResponder {
4192    fn drop(&mut self) {
4193        self.control_handle.shutdown();
4194        // Safety: drops once, never accessed again
4195        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4196    }
4197}
4198
4199impl fidl::endpoints::Responder for NetworkAttachEndpointResponder {
4200    type ControlHandle = NetworkControlHandle;
4201
4202    fn control_handle(&self) -> &NetworkControlHandle {
4203        &self.control_handle
4204    }
4205
4206    fn drop_without_shutdown(mut self) {
4207        // Safety: drops once, never accessed again due to mem::forget
4208        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4209        // Prevent Drop from running (which would shut down the channel)
4210        std::mem::forget(self);
4211    }
4212}
4213
4214impl NetworkAttachEndpointResponder {
4215    /// Sends a response to the FIDL transaction.
4216    ///
4217    /// Sets the channel to shutdown if an error occurs.
4218    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
4219        let _result = self.send_raw(status);
4220        if _result.is_err() {
4221            self.control_handle.shutdown();
4222        }
4223        self.drop_without_shutdown();
4224        _result
4225    }
4226
4227    /// Similar to "send" but does not shutdown the channel if an error occurs.
4228    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
4229        let _result = self.send_raw(status);
4230        self.drop_without_shutdown();
4231        _result
4232    }
4233
4234    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
4235        self.control_handle.inner.send::<NetworkAttachEndpointResponse>(
4236            (status,),
4237            self.tx_id,
4238            0x6e8ff8e9ea1b9a98,
4239            fidl::encoding::DynamicFlags::empty(),
4240        )
4241    }
4242}
4243
4244#[must_use = "FIDL methods require a response to be sent"]
4245#[derive(Debug)]
4246pub struct NetworkRemoveEndpointResponder {
4247    control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
4248    tx_id: u32,
4249}
4250
4251/// Set the the channel to be shutdown (see [`NetworkControlHandle::shutdown`])
4252/// if the responder is dropped without sending a response, so that the client
4253/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4254impl std::ops::Drop for NetworkRemoveEndpointResponder {
4255    fn drop(&mut self) {
4256        self.control_handle.shutdown();
4257        // Safety: drops once, never accessed again
4258        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4259    }
4260}
4261
4262impl fidl::endpoints::Responder for NetworkRemoveEndpointResponder {
4263    type ControlHandle = NetworkControlHandle;
4264
4265    fn control_handle(&self) -> &NetworkControlHandle {
4266        &self.control_handle
4267    }
4268
4269    fn drop_without_shutdown(mut self) {
4270        // Safety: drops once, never accessed again due to mem::forget
4271        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4272        // Prevent Drop from running (which would shut down the channel)
4273        std::mem::forget(self);
4274    }
4275}
4276
4277impl NetworkRemoveEndpointResponder {
4278    /// Sends a response to the FIDL transaction.
4279    ///
4280    /// Sets the channel to shutdown if an error occurs.
4281    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
4282        let _result = self.send_raw(status);
4283        if _result.is_err() {
4284            self.control_handle.shutdown();
4285        }
4286        self.drop_without_shutdown();
4287        _result
4288    }
4289
4290    /// Similar to "send" but does not shutdown the channel if an error occurs.
4291    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
4292        let _result = self.send_raw(status);
4293        self.drop_without_shutdown();
4294        _result
4295    }
4296
4297    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
4298        self.control_handle.inner.send::<NetworkRemoveEndpointResponse>(
4299            (status,),
4300            self.tx_id,
4301            0x298eaac56bfcdd25,
4302            fidl::encoding::DynamicFlags::empty(),
4303        )
4304    }
4305}
4306
4307#[must_use = "FIDL methods require a response to be sent"]
4308#[derive(Debug)]
4309pub struct NetworkStartCaptureResponder {
4310    control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
4311    tx_id: u32,
4312}
4313
4314/// Set the the channel to be shutdown (see [`NetworkControlHandle::shutdown`])
4315/// if the responder is dropped without sending a response, so that the client
4316/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4317impl std::ops::Drop for NetworkStartCaptureResponder {
4318    fn drop(&mut self) {
4319        self.control_handle.shutdown();
4320        // Safety: drops once, never accessed again
4321        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4322    }
4323}
4324
4325impl fidl::endpoints::Responder for NetworkStartCaptureResponder {
4326    type ControlHandle = NetworkControlHandle;
4327
4328    fn control_handle(&self) -> &NetworkControlHandle {
4329        &self.control_handle
4330    }
4331
4332    fn drop_without_shutdown(mut self) {
4333        // Safety: drops once, never accessed again due to mem::forget
4334        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4335        // Prevent Drop from running (which would shut down the channel)
4336        std::mem::forget(self);
4337    }
4338}
4339
4340impl NetworkStartCaptureResponder {
4341    /// Sends a response to the FIDL transaction.
4342    ///
4343    /// Sets the channel to shutdown if an error occurs.
4344    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
4345        let _result = self.send_raw(status);
4346        if _result.is_err() {
4347            self.control_handle.shutdown();
4348        }
4349        self.drop_without_shutdown();
4350        _result
4351    }
4352
4353    /// Similar to "send" but does not shutdown the channel if an error occurs.
4354    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
4355        let _result = self.send_raw(status);
4356        self.drop_without_shutdown();
4357        _result
4358    }
4359
4360    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
4361        self.control_handle.inner.send::<NetworkStartCaptureResponse>(
4362            (status,),
4363            self.tx_id,
4364            0x3ca44940622932c,
4365            fidl::encoding::DynamicFlags::empty(),
4366        )
4367    }
4368}
4369
4370#[must_use = "FIDL methods require a response to be sent"]
4371#[derive(Debug)]
4372pub struct NetworkStopCaptureResponder {
4373    control_handle: std::mem::ManuallyDrop<NetworkControlHandle>,
4374    tx_id: u32,
4375}
4376
4377/// Set the the channel to be shutdown (see [`NetworkControlHandle::shutdown`])
4378/// if the responder is dropped without sending a response, so that the client
4379/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4380impl std::ops::Drop for NetworkStopCaptureResponder {
4381    fn drop(&mut self) {
4382        self.control_handle.shutdown();
4383        // Safety: drops once, never accessed again
4384        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4385    }
4386}
4387
4388impl fidl::endpoints::Responder for NetworkStopCaptureResponder {
4389    type ControlHandle = NetworkControlHandle;
4390
4391    fn control_handle(&self) -> &NetworkControlHandle {
4392        &self.control_handle
4393    }
4394
4395    fn drop_without_shutdown(mut self) {
4396        // Safety: drops once, never accessed again due to mem::forget
4397        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4398        // Prevent Drop from running (which would shut down the channel)
4399        std::mem::forget(self);
4400    }
4401}
4402
4403impl NetworkStopCaptureResponder {
4404    /// Sends a response to the FIDL transaction.
4405    ///
4406    /// Sets the channel to shutdown if an error occurs.
4407    pub fn send(self) -> Result<(), fidl::Error> {
4408        let _result = self.send_raw();
4409        if _result.is_err() {
4410            self.control_handle.shutdown();
4411        }
4412        self.drop_without_shutdown();
4413        _result
4414    }
4415
4416    /// Similar to "send" but does not shutdown the channel if an error occurs.
4417    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4418        let _result = self.send_raw();
4419        self.drop_without_shutdown();
4420        _result
4421    }
4422
4423    fn send_raw(&self) -> Result<(), fidl::Error> {
4424        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4425            (),
4426            self.tx_id,
4427            0x1d7827adad109468,
4428            fidl::encoding::DynamicFlags::empty(),
4429        )
4430    }
4431}
4432
4433#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4434pub struct NetworkContextMarker;
4435
4436impl fidl::endpoints::ProtocolMarker for NetworkContextMarker {
4437    type Proxy = NetworkContextProxy;
4438    type RequestStream = NetworkContextRequestStream;
4439    #[cfg(target_os = "fuchsia")]
4440    type SynchronousProxy = NetworkContextSynchronousProxy;
4441
4442    const DEBUG_NAME: &'static str = "fuchsia.netemul.network.NetworkContext";
4443}
4444impl fidl::endpoints::DiscoverableProtocolMarker for NetworkContextMarker {}
4445
4446pub trait NetworkContextProxyInterface: Send + Sync {
4447    fn r#clone(
4448        &self,
4449        network_context: fidl::endpoints::ServerEnd<NetworkContextMarker>,
4450    ) -> Result<(), fidl::Error>;
4451    fn r#get_network_manager(
4452        &self,
4453        net_manager: fidl::endpoints::ServerEnd<NetworkManagerMarker>,
4454    ) -> Result<(), fidl::Error>;
4455    fn r#get_endpoint_manager(
4456        &self,
4457        endp_manager: fidl::endpoints::ServerEnd<EndpointManagerMarker>,
4458    ) -> Result<(), fidl::Error>;
4459    type SetupResponseFut: std::future::Future<
4460            Output = Result<
4461                (i32, Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>),
4462                fidl::Error,
4463            >,
4464        > + Send;
4465    fn r#setup(&self, networks: &[NetworkSetup]) -> Self::SetupResponseFut;
4466}
4467#[derive(Debug)]
4468#[cfg(target_os = "fuchsia")]
4469pub struct NetworkContextSynchronousProxy {
4470    client: fidl::client::sync::Client,
4471}
4472
4473#[cfg(target_os = "fuchsia")]
4474impl fidl::endpoints::SynchronousProxy for NetworkContextSynchronousProxy {
4475    type Proxy = NetworkContextProxy;
4476    type Protocol = NetworkContextMarker;
4477
4478    fn from_channel(inner: fidl::Channel) -> Self {
4479        Self::new(inner)
4480    }
4481
4482    fn into_channel(self) -> fidl::Channel {
4483        self.client.into_channel()
4484    }
4485
4486    fn as_channel(&self) -> &fidl::Channel {
4487        self.client.as_channel()
4488    }
4489}
4490
4491#[cfg(target_os = "fuchsia")]
4492impl NetworkContextSynchronousProxy {
4493    pub fn new(channel: fidl::Channel) -> Self {
4494        let protocol_name = <NetworkContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4495        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4496    }
4497
4498    pub fn into_channel(self) -> fidl::Channel {
4499        self.client.into_channel()
4500    }
4501
4502    /// Waits until an event arrives and returns it. It is safe for other
4503    /// threads to make concurrent requests while waiting for an event.
4504    pub fn wait_for_event(
4505        &self,
4506        deadline: zx::MonotonicInstant,
4507    ) -> Result<NetworkContextEvent, fidl::Error> {
4508        NetworkContextEvent::decode(self.client.wait_for_event(deadline)?)
4509    }
4510
4511    pub fn r#clone(
4512        &self,
4513        mut network_context: fidl::endpoints::ServerEnd<NetworkContextMarker>,
4514    ) -> Result<(), fidl::Error> {
4515        self.client.send::<NetworkContextCloneRequest>(
4516            (network_context,),
4517            0x1f7eb1b78a2ad2b0,
4518            fidl::encoding::DynamicFlags::empty(),
4519        )
4520    }
4521
4522    pub fn r#get_network_manager(
4523        &self,
4524        mut net_manager: fidl::endpoints::ServerEnd<NetworkManagerMarker>,
4525    ) -> Result<(), fidl::Error> {
4526        self.client.send::<NetworkContextGetNetworkManagerRequest>(
4527            (net_manager,),
4528            0x379899a30766afd4,
4529            fidl::encoding::DynamicFlags::empty(),
4530        )
4531    }
4532
4533    pub fn r#get_endpoint_manager(
4534        &self,
4535        mut endp_manager: fidl::endpoints::ServerEnd<EndpointManagerMarker>,
4536    ) -> Result<(), fidl::Error> {
4537        self.client.send::<NetworkContextGetEndpointManagerRequest>(
4538            (endp_manager,),
4539            0x5e64360363b9bd81,
4540            fidl::encoding::DynamicFlags::empty(),
4541        )
4542    }
4543
4544    /// Creates a collection of networks described by `networks`.
4545    /// `status` is `ZX_OK` for success
4546    /// `setup_handle` is a resource that references and maintains the lifecycle of
4547    ///                the created networks and endpoints.
4548    pub fn r#setup(
4549        &self,
4550        mut networks: &[NetworkSetup],
4551        ___deadline: zx::MonotonicInstant,
4552    ) -> Result<(i32, Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>), fidl::Error> {
4553        let _response =
4554            self.client.send_query::<NetworkContextSetupRequest, NetworkContextSetupResponse>(
4555                (networks,),
4556                0x1680e0b13823fc8c,
4557                fidl::encoding::DynamicFlags::empty(),
4558                ___deadline,
4559            )?;
4560        Ok((_response.status, _response.setup_handle))
4561    }
4562}
4563
4564#[derive(Debug, Clone)]
4565pub struct NetworkContextProxy {
4566    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4567}
4568
4569impl fidl::endpoints::Proxy for NetworkContextProxy {
4570    type Protocol = NetworkContextMarker;
4571
4572    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4573        Self::new(inner)
4574    }
4575
4576    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4577        self.client.into_channel().map_err(|client| Self { client })
4578    }
4579
4580    fn as_channel(&self) -> &::fidl::AsyncChannel {
4581        self.client.as_channel()
4582    }
4583}
4584
4585impl NetworkContextProxy {
4586    /// Create a new Proxy for fuchsia.netemul.network/NetworkContext.
4587    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4588        let protocol_name = <NetworkContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4589        Self { client: fidl::client::Client::new(channel, protocol_name) }
4590    }
4591
4592    /// Get a Stream of events from the remote end of the protocol.
4593    ///
4594    /// # Panics
4595    ///
4596    /// Panics if the event stream was already taken.
4597    pub fn take_event_stream(&self) -> NetworkContextEventStream {
4598        NetworkContextEventStream { event_receiver: self.client.take_event_receiver() }
4599    }
4600
4601    pub fn r#clone(
4602        &self,
4603        mut network_context: fidl::endpoints::ServerEnd<NetworkContextMarker>,
4604    ) -> Result<(), fidl::Error> {
4605        NetworkContextProxyInterface::r#clone(self, network_context)
4606    }
4607
4608    pub fn r#get_network_manager(
4609        &self,
4610        mut net_manager: fidl::endpoints::ServerEnd<NetworkManagerMarker>,
4611    ) -> Result<(), fidl::Error> {
4612        NetworkContextProxyInterface::r#get_network_manager(self, net_manager)
4613    }
4614
4615    pub fn r#get_endpoint_manager(
4616        &self,
4617        mut endp_manager: fidl::endpoints::ServerEnd<EndpointManagerMarker>,
4618    ) -> Result<(), fidl::Error> {
4619        NetworkContextProxyInterface::r#get_endpoint_manager(self, endp_manager)
4620    }
4621
4622    /// Creates a collection of networks described by `networks`.
4623    /// `status` is `ZX_OK` for success
4624    /// `setup_handle` is a resource that references and maintains the lifecycle of
4625    ///                the created networks and endpoints.
4626    pub fn r#setup(
4627        &self,
4628        mut networks: &[NetworkSetup],
4629    ) -> fidl::client::QueryResponseFut<
4630        (i32, Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>),
4631        fidl::encoding::DefaultFuchsiaResourceDialect,
4632    > {
4633        NetworkContextProxyInterface::r#setup(self, networks)
4634    }
4635}
4636
4637impl NetworkContextProxyInterface for NetworkContextProxy {
4638    fn r#clone(
4639        &self,
4640        mut network_context: fidl::endpoints::ServerEnd<NetworkContextMarker>,
4641    ) -> Result<(), fidl::Error> {
4642        self.client.send::<NetworkContextCloneRequest>(
4643            (network_context,),
4644            0x1f7eb1b78a2ad2b0,
4645            fidl::encoding::DynamicFlags::empty(),
4646        )
4647    }
4648
4649    fn r#get_network_manager(
4650        &self,
4651        mut net_manager: fidl::endpoints::ServerEnd<NetworkManagerMarker>,
4652    ) -> Result<(), fidl::Error> {
4653        self.client.send::<NetworkContextGetNetworkManagerRequest>(
4654            (net_manager,),
4655            0x379899a30766afd4,
4656            fidl::encoding::DynamicFlags::empty(),
4657        )
4658    }
4659
4660    fn r#get_endpoint_manager(
4661        &self,
4662        mut endp_manager: fidl::endpoints::ServerEnd<EndpointManagerMarker>,
4663    ) -> Result<(), fidl::Error> {
4664        self.client.send::<NetworkContextGetEndpointManagerRequest>(
4665            (endp_manager,),
4666            0x5e64360363b9bd81,
4667            fidl::encoding::DynamicFlags::empty(),
4668        )
4669    }
4670
4671    type SetupResponseFut = fidl::client::QueryResponseFut<
4672        (i32, Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>),
4673        fidl::encoding::DefaultFuchsiaResourceDialect,
4674    >;
4675    fn r#setup(&self, mut networks: &[NetworkSetup]) -> Self::SetupResponseFut {
4676        fn _decode(
4677            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4678        ) -> Result<(i32, Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>), fidl::Error>
4679        {
4680            let _response = fidl::client::decode_transaction_body::<
4681                NetworkContextSetupResponse,
4682                fidl::encoding::DefaultFuchsiaResourceDialect,
4683                0x1680e0b13823fc8c,
4684            >(_buf?)?;
4685            Ok((_response.status, _response.setup_handle))
4686        }
4687        self.client.send_query_and_decode::<
4688            NetworkContextSetupRequest,
4689            (i32, Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>),
4690        >(
4691            (networks,),
4692            0x1680e0b13823fc8c,
4693            fidl::encoding::DynamicFlags::empty(),
4694            _decode,
4695        )
4696    }
4697}
4698
4699pub struct NetworkContextEventStream {
4700    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4701}
4702
4703impl std::marker::Unpin for NetworkContextEventStream {}
4704
4705impl futures::stream::FusedStream for NetworkContextEventStream {
4706    fn is_terminated(&self) -> bool {
4707        self.event_receiver.is_terminated()
4708    }
4709}
4710
4711impl futures::Stream for NetworkContextEventStream {
4712    type Item = Result<NetworkContextEvent, fidl::Error>;
4713
4714    fn poll_next(
4715        mut self: std::pin::Pin<&mut Self>,
4716        cx: &mut std::task::Context<'_>,
4717    ) -> std::task::Poll<Option<Self::Item>> {
4718        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4719            &mut self.event_receiver,
4720            cx
4721        )?) {
4722            Some(buf) => std::task::Poll::Ready(Some(NetworkContextEvent::decode(buf))),
4723            None => std::task::Poll::Ready(None),
4724        }
4725    }
4726}
4727
4728#[derive(Debug)]
4729pub enum NetworkContextEvent {}
4730
4731impl NetworkContextEvent {
4732    /// Decodes a message buffer as a [`NetworkContextEvent`].
4733    fn decode(
4734        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4735    ) -> Result<NetworkContextEvent, fidl::Error> {
4736        let (bytes, _handles) = buf.split_mut();
4737        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4738        debug_assert_eq!(tx_header.tx_id, 0);
4739        match tx_header.ordinal {
4740            _ => Err(fidl::Error::UnknownOrdinal {
4741                ordinal: tx_header.ordinal,
4742                protocol_name:
4743                    <NetworkContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4744            }),
4745        }
4746    }
4747}
4748
4749/// A Stream of incoming requests for fuchsia.netemul.network/NetworkContext.
4750pub struct NetworkContextRequestStream {
4751    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4752    is_terminated: bool,
4753}
4754
4755impl std::marker::Unpin for NetworkContextRequestStream {}
4756
4757impl futures::stream::FusedStream for NetworkContextRequestStream {
4758    fn is_terminated(&self) -> bool {
4759        self.is_terminated
4760    }
4761}
4762
4763impl fidl::endpoints::RequestStream for NetworkContextRequestStream {
4764    type Protocol = NetworkContextMarker;
4765    type ControlHandle = NetworkContextControlHandle;
4766
4767    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4768        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4769    }
4770
4771    fn control_handle(&self) -> Self::ControlHandle {
4772        NetworkContextControlHandle { inner: self.inner.clone() }
4773    }
4774
4775    fn into_inner(
4776        self,
4777    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4778    {
4779        (self.inner, self.is_terminated)
4780    }
4781
4782    fn from_inner(
4783        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4784        is_terminated: bool,
4785    ) -> Self {
4786        Self { inner, is_terminated }
4787    }
4788}
4789
4790impl futures::Stream for NetworkContextRequestStream {
4791    type Item = Result<NetworkContextRequest, fidl::Error>;
4792
4793    fn poll_next(
4794        mut self: std::pin::Pin<&mut Self>,
4795        cx: &mut std::task::Context<'_>,
4796    ) -> std::task::Poll<Option<Self::Item>> {
4797        let this = &mut *self;
4798        if this.inner.check_shutdown(cx) {
4799            this.is_terminated = true;
4800            return std::task::Poll::Ready(None);
4801        }
4802        if this.is_terminated {
4803            panic!("polled NetworkContextRequestStream after completion");
4804        }
4805        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4806            |bytes, handles| {
4807                match this.inner.channel().read_etc(cx, bytes, handles) {
4808                    std::task::Poll::Ready(Ok(())) => {}
4809                    std::task::Poll::Pending => return std::task::Poll::Pending,
4810                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4811                        this.is_terminated = true;
4812                        return std::task::Poll::Ready(None);
4813                    }
4814                    std::task::Poll::Ready(Err(e)) => {
4815                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4816                            e.into(),
4817                        ))))
4818                    }
4819                }
4820
4821                // A message has been received from the channel
4822                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4823
4824                std::task::Poll::Ready(Some(match header.ordinal {
4825                    0x1f7eb1b78a2ad2b0 => {
4826                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4827                        let mut req = fidl::new_empty!(
4828                            NetworkContextCloneRequest,
4829                            fidl::encoding::DefaultFuchsiaResourceDialect
4830                        );
4831                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkContextCloneRequest>(&header, _body_bytes, handles, &mut req)?;
4832                        let control_handle =
4833                            NetworkContextControlHandle { inner: this.inner.clone() };
4834                        Ok(NetworkContextRequest::Clone {
4835                            network_context: req.network_context,
4836
4837                            control_handle,
4838                        })
4839                    }
4840                    0x379899a30766afd4 => {
4841                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4842                        let mut req = fidl::new_empty!(
4843                            NetworkContextGetNetworkManagerRequest,
4844                            fidl::encoding::DefaultFuchsiaResourceDialect
4845                        );
4846                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkContextGetNetworkManagerRequest>(&header, _body_bytes, handles, &mut req)?;
4847                        let control_handle =
4848                            NetworkContextControlHandle { inner: this.inner.clone() };
4849                        Ok(NetworkContextRequest::GetNetworkManager {
4850                            net_manager: req.net_manager,
4851
4852                            control_handle,
4853                        })
4854                    }
4855                    0x5e64360363b9bd81 => {
4856                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4857                        let mut req = fidl::new_empty!(
4858                            NetworkContextGetEndpointManagerRequest,
4859                            fidl::encoding::DefaultFuchsiaResourceDialect
4860                        );
4861                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkContextGetEndpointManagerRequest>(&header, _body_bytes, handles, &mut req)?;
4862                        let control_handle =
4863                            NetworkContextControlHandle { inner: this.inner.clone() };
4864                        Ok(NetworkContextRequest::GetEndpointManager {
4865                            endp_manager: req.endp_manager,
4866
4867                            control_handle,
4868                        })
4869                    }
4870                    0x1680e0b13823fc8c => {
4871                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4872                        let mut req = fidl::new_empty!(
4873                            NetworkContextSetupRequest,
4874                            fidl::encoding::DefaultFuchsiaResourceDialect
4875                        );
4876                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkContextSetupRequest>(&header, _body_bytes, handles, &mut req)?;
4877                        let control_handle =
4878                            NetworkContextControlHandle { inner: this.inner.clone() };
4879                        Ok(NetworkContextRequest::Setup {
4880                            networks: req.networks,
4881
4882                            responder: NetworkContextSetupResponder {
4883                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4884                                tx_id: header.tx_id,
4885                            },
4886                        })
4887                    }
4888                    _ => Err(fidl::Error::UnknownOrdinal {
4889                        ordinal: header.ordinal,
4890                        protocol_name:
4891                            <NetworkContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4892                    }),
4893                }))
4894            },
4895        )
4896    }
4897}
4898
4899/// Main entry point to manage virtual networks and endpoints.
4900///
4901/// Every new connection to NetworkContext provides access to a an isolated
4902/// namespace for networks and endpoints. `Clone` is the only means by which a
4903/// client can acquire a new connection to the same network context.
4904#[derive(Debug)]
4905pub enum NetworkContextRequest {
4906    Clone {
4907        network_context: fidl::endpoints::ServerEnd<NetworkContextMarker>,
4908        control_handle: NetworkContextControlHandle,
4909    },
4910    GetNetworkManager {
4911        net_manager: fidl::endpoints::ServerEnd<NetworkManagerMarker>,
4912        control_handle: NetworkContextControlHandle,
4913    },
4914    GetEndpointManager {
4915        endp_manager: fidl::endpoints::ServerEnd<EndpointManagerMarker>,
4916        control_handle: NetworkContextControlHandle,
4917    },
4918    /// Creates a collection of networks described by `networks`.
4919    /// `status` is `ZX_OK` for success
4920    /// `setup_handle` is a resource that references and maintains the lifecycle of
4921    ///                the created networks and endpoints.
4922    Setup { networks: Vec<NetworkSetup>, responder: NetworkContextSetupResponder },
4923}
4924
4925impl NetworkContextRequest {
4926    #[allow(irrefutable_let_patterns)]
4927    pub fn into_clone(
4928        self,
4929    ) -> Option<(fidl::endpoints::ServerEnd<NetworkContextMarker>, NetworkContextControlHandle)>
4930    {
4931        if let NetworkContextRequest::Clone { network_context, control_handle } = self {
4932            Some((network_context, control_handle))
4933        } else {
4934            None
4935        }
4936    }
4937
4938    #[allow(irrefutable_let_patterns)]
4939    pub fn into_get_network_manager(
4940        self,
4941    ) -> Option<(fidl::endpoints::ServerEnd<NetworkManagerMarker>, NetworkContextControlHandle)>
4942    {
4943        if let NetworkContextRequest::GetNetworkManager { net_manager, control_handle } = self {
4944            Some((net_manager, control_handle))
4945        } else {
4946            None
4947        }
4948    }
4949
4950    #[allow(irrefutable_let_patterns)]
4951    pub fn into_get_endpoint_manager(
4952        self,
4953    ) -> Option<(fidl::endpoints::ServerEnd<EndpointManagerMarker>, NetworkContextControlHandle)>
4954    {
4955        if let NetworkContextRequest::GetEndpointManager { endp_manager, control_handle } = self {
4956            Some((endp_manager, control_handle))
4957        } else {
4958            None
4959        }
4960    }
4961
4962    #[allow(irrefutable_let_patterns)]
4963    pub fn into_setup(self) -> Option<(Vec<NetworkSetup>, NetworkContextSetupResponder)> {
4964        if let NetworkContextRequest::Setup { networks, responder } = self {
4965            Some((networks, responder))
4966        } else {
4967            None
4968        }
4969    }
4970
4971    /// Name of the method defined in FIDL
4972    pub fn method_name(&self) -> &'static str {
4973        match *self {
4974            NetworkContextRequest::Clone { .. } => "clone",
4975            NetworkContextRequest::GetNetworkManager { .. } => "get_network_manager",
4976            NetworkContextRequest::GetEndpointManager { .. } => "get_endpoint_manager",
4977            NetworkContextRequest::Setup { .. } => "setup",
4978        }
4979    }
4980}
4981
4982#[derive(Debug, Clone)]
4983pub struct NetworkContextControlHandle {
4984    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4985}
4986
4987impl fidl::endpoints::ControlHandle for NetworkContextControlHandle {
4988    fn shutdown(&self) {
4989        self.inner.shutdown()
4990    }
4991    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4992        self.inner.shutdown_with_epitaph(status)
4993    }
4994
4995    fn is_closed(&self) -> bool {
4996        self.inner.channel().is_closed()
4997    }
4998    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4999        self.inner.channel().on_closed()
5000    }
5001
5002    #[cfg(target_os = "fuchsia")]
5003    fn signal_peer(
5004        &self,
5005        clear_mask: zx::Signals,
5006        set_mask: zx::Signals,
5007    ) -> Result<(), zx_status::Status> {
5008        use fidl::Peered;
5009        self.inner.channel().signal_peer(clear_mask, set_mask)
5010    }
5011}
5012
5013impl NetworkContextControlHandle {}
5014
5015#[must_use = "FIDL methods require a response to be sent"]
5016#[derive(Debug)]
5017pub struct NetworkContextSetupResponder {
5018    control_handle: std::mem::ManuallyDrop<NetworkContextControlHandle>,
5019    tx_id: u32,
5020}
5021
5022/// Set the the channel to be shutdown (see [`NetworkContextControlHandle::shutdown`])
5023/// if the responder is dropped without sending a response, so that the client
5024/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5025impl std::ops::Drop for NetworkContextSetupResponder {
5026    fn drop(&mut self) {
5027        self.control_handle.shutdown();
5028        // Safety: drops once, never accessed again
5029        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5030    }
5031}
5032
5033impl fidl::endpoints::Responder for NetworkContextSetupResponder {
5034    type ControlHandle = NetworkContextControlHandle;
5035
5036    fn control_handle(&self) -> &NetworkContextControlHandle {
5037        &self.control_handle
5038    }
5039
5040    fn drop_without_shutdown(mut self) {
5041        // Safety: drops once, never accessed again due to mem::forget
5042        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5043        // Prevent Drop from running (which would shut down the channel)
5044        std::mem::forget(self);
5045    }
5046}
5047
5048impl NetworkContextSetupResponder {
5049    /// Sends a response to the FIDL transaction.
5050    ///
5051    /// Sets the channel to shutdown if an error occurs.
5052    pub fn send(
5053        self,
5054        mut status: i32,
5055        mut setup_handle: Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
5056    ) -> Result<(), fidl::Error> {
5057        let _result = self.send_raw(status, setup_handle);
5058        if _result.is_err() {
5059            self.control_handle.shutdown();
5060        }
5061        self.drop_without_shutdown();
5062        _result
5063    }
5064
5065    /// Similar to "send" but does not shutdown the channel if an error occurs.
5066    pub fn send_no_shutdown_on_err(
5067        self,
5068        mut status: i32,
5069        mut setup_handle: Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
5070    ) -> Result<(), fidl::Error> {
5071        let _result = self.send_raw(status, setup_handle);
5072        self.drop_without_shutdown();
5073        _result
5074    }
5075
5076    fn send_raw(
5077        &self,
5078        mut status: i32,
5079        mut setup_handle: Option<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
5080    ) -> Result<(), fidl::Error> {
5081        self.control_handle.inner.send::<NetworkContextSetupResponse>(
5082            (status, setup_handle),
5083            self.tx_id,
5084            0x1680e0b13823fc8c,
5085            fidl::encoding::DynamicFlags::empty(),
5086        )
5087    }
5088}
5089
5090#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5091pub struct NetworkManagerMarker;
5092
5093impl fidl::endpoints::ProtocolMarker for NetworkManagerMarker {
5094    type Proxy = NetworkManagerProxy;
5095    type RequestStream = NetworkManagerRequestStream;
5096    #[cfg(target_os = "fuchsia")]
5097    type SynchronousProxy = NetworkManagerSynchronousProxy;
5098
5099    const DEBUG_NAME: &'static str = "(anonymous) NetworkManager";
5100}
5101
5102pub trait NetworkManagerProxyInterface: Send + Sync {
5103    type ListNetworksResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
5104        + Send;
5105    fn r#list_networks(&self) -> Self::ListNetworksResponseFut;
5106    type CreateNetworkResponseFut: std::future::Future<
5107            Output = Result<(i32, Option<fidl::endpoints::ClientEnd<NetworkMarker>>), fidl::Error>,
5108        > + Send;
5109    fn r#create_network(
5110        &self,
5111        name: &str,
5112        config: &NetworkConfig,
5113    ) -> Self::CreateNetworkResponseFut;
5114    type GetNetworkResponseFut: std::future::Future<
5115            Output = Result<Option<fidl::endpoints::ClientEnd<NetworkMarker>>, fidl::Error>,
5116        > + Send;
5117    fn r#get_network(&self, name: &str) -> Self::GetNetworkResponseFut;
5118}
5119#[derive(Debug)]
5120#[cfg(target_os = "fuchsia")]
5121pub struct NetworkManagerSynchronousProxy {
5122    client: fidl::client::sync::Client,
5123}
5124
5125#[cfg(target_os = "fuchsia")]
5126impl fidl::endpoints::SynchronousProxy for NetworkManagerSynchronousProxy {
5127    type Proxy = NetworkManagerProxy;
5128    type Protocol = NetworkManagerMarker;
5129
5130    fn from_channel(inner: fidl::Channel) -> Self {
5131        Self::new(inner)
5132    }
5133
5134    fn into_channel(self) -> fidl::Channel {
5135        self.client.into_channel()
5136    }
5137
5138    fn as_channel(&self) -> &fidl::Channel {
5139        self.client.as_channel()
5140    }
5141}
5142
5143#[cfg(target_os = "fuchsia")]
5144impl NetworkManagerSynchronousProxy {
5145    pub fn new(channel: fidl::Channel) -> Self {
5146        let protocol_name = <NetworkManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5147        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5148    }
5149
5150    pub fn into_channel(self) -> fidl::Channel {
5151        self.client.into_channel()
5152    }
5153
5154    /// Waits until an event arrives and returns it. It is safe for other
5155    /// threads to make concurrent requests while waiting for an event.
5156    pub fn wait_for_event(
5157        &self,
5158        deadline: zx::MonotonicInstant,
5159    ) -> Result<NetworkManagerEvent, fidl::Error> {
5160        NetworkManagerEvent::decode(self.client.wait_for_event(deadline)?)
5161    }
5162
5163    /// Lists emulated networks by name.
5164    pub fn r#list_networks(
5165        &self,
5166        ___deadline: zx::MonotonicInstant,
5167    ) -> Result<Vec<String>, fidl::Error> {
5168        let _response = self
5169            .client
5170            .send_query::<fidl::encoding::EmptyPayload, NetworkManagerListNetworksResponse>(
5171                (),
5172                0x2488653e0974cc62,
5173                fidl::encoding::DynamicFlags::empty(),
5174                ___deadline,
5175            )?;
5176        Ok(_response.nets)
5177    }
5178
5179    /// Creates a new network with given name and config.
5180    pub fn r#create_network(
5181        &self,
5182        mut name: &str,
5183        mut config: &NetworkConfig,
5184        ___deadline: zx::MonotonicInstant,
5185    ) -> Result<(i32, Option<fidl::endpoints::ClientEnd<NetworkMarker>>), fidl::Error> {
5186        let _response = self
5187            .client
5188            .send_query::<NetworkManagerCreateNetworkRequest, NetworkManagerCreateNetworkResponse>(
5189                (name, config),
5190                0x6052eb5ac709af,
5191                fidl::encoding::DynamicFlags::empty(),
5192                ___deadline,
5193            )?;
5194        Ok((_response.status, _response.net))
5195    }
5196
5197    /// Gets a handle to a network.
5198    pub fn r#get_network(
5199        &self,
5200        mut name: &str,
5201        ___deadline: zx::MonotonicInstant,
5202    ) -> Result<Option<fidl::endpoints::ClientEnd<NetworkMarker>>, fidl::Error> {
5203        let _response = self
5204            .client
5205            .send_query::<NetworkManagerGetNetworkRequest, NetworkManagerGetNetworkResponse>(
5206                (name,),
5207                0x59930bf23acc7d9a,
5208                fidl::encoding::DynamicFlags::empty(),
5209                ___deadline,
5210            )?;
5211        Ok(_response.net)
5212    }
5213}
5214
5215#[derive(Debug, Clone)]
5216pub struct NetworkManagerProxy {
5217    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5218}
5219
5220impl fidl::endpoints::Proxy for NetworkManagerProxy {
5221    type Protocol = NetworkManagerMarker;
5222
5223    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5224        Self::new(inner)
5225    }
5226
5227    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5228        self.client.into_channel().map_err(|client| Self { client })
5229    }
5230
5231    fn as_channel(&self) -> &::fidl::AsyncChannel {
5232        self.client.as_channel()
5233    }
5234}
5235
5236impl NetworkManagerProxy {
5237    /// Create a new Proxy for fuchsia.netemul.network/NetworkManager.
5238    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5239        let protocol_name = <NetworkManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5240        Self { client: fidl::client::Client::new(channel, protocol_name) }
5241    }
5242
5243    /// Get a Stream of events from the remote end of the protocol.
5244    ///
5245    /// # Panics
5246    ///
5247    /// Panics if the event stream was already taken.
5248    pub fn take_event_stream(&self) -> NetworkManagerEventStream {
5249        NetworkManagerEventStream { event_receiver: self.client.take_event_receiver() }
5250    }
5251
5252    /// Lists emulated networks by name.
5253    pub fn r#list_networks(
5254        &self,
5255    ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
5256    {
5257        NetworkManagerProxyInterface::r#list_networks(self)
5258    }
5259
5260    /// Creates a new network with given name and config.
5261    pub fn r#create_network(
5262        &self,
5263        mut name: &str,
5264        mut config: &NetworkConfig,
5265    ) -> fidl::client::QueryResponseFut<
5266        (i32, Option<fidl::endpoints::ClientEnd<NetworkMarker>>),
5267        fidl::encoding::DefaultFuchsiaResourceDialect,
5268    > {
5269        NetworkManagerProxyInterface::r#create_network(self, name, config)
5270    }
5271
5272    /// Gets a handle to a network.
5273    pub fn r#get_network(
5274        &self,
5275        mut name: &str,
5276    ) -> fidl::client::QueryResponseFut<
5277        Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
5278        fidl::encoding::DefaultFuchsiaResourceDialect,
5279    > {
5280        NetworkManagerProxyInterface::r#get_network(self, name)
5281    }
5282}
5283
5284impl NetworkManagerProxyInterface for NetworkManagerProxy {
5285    type ListNetworksResponseFut =
5286        fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
5287    fn r#list_networks(&self) -> Self::ListNetworksResponseFut {
5288        fn _decode(
5289            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5290        ) -> Result<Vec<String>, fidl::Error> {
5291            let _response = fidl::client::decode_transaction_body::<
5292                NetworkManagerListNetworksResponse,
5293                fidl::encoding::DefaultFuchsiaResourceDialect,
5294                0x2488653e0974cc62,
5295            >(_buf?)?;
5296            Ok(_response.nets)
5297        }
5298        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
5299            (),
5300            0x2488653e0974cc62,
5301            fidl::encoding::DynamicFlags::empty(),
5302            _decode,
5303        )
5304    }
5305
5306    type CreateNetworkResponseFut = fidl::client::QueryResponseFut<
5307        (i32, Option<fidl::endpoints::ClientEnd<NetworkMarker>>),
5308        fidl::encoding::DefaultFuchsiaResourceDialect,
5309    >;
5310    fn r#create_network(
5311        &self,
5312        mut name: &str,
5313        mut config: &NetworkConfig,
5314    ) -> Self::CreateNetworkResponseFut {
5315        fn _decode(
5316            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5317        ) -> Result<(i32, Option<fidl::endpoints::ClientEnd<NetworkMarker>>), fidl::Error> {
5318            let _response = fidl::client::decode_transaction_body::<
5319                NetworkManagerCreateNetworkResponse,
5320                fidl::encoding::DefaultFuchsiaResourceDialect,
5321                0x6052eb5ac709af,
5322            >(_buf?)?;
5323            Ok((_response.status, _response.net))
5324        }
5325        self.client.send_query_and_decode::<
5326            NetworkManagerCreateNetworkRequest,
5327            (i32, Option<fidl::endpoints::ClientEnd<NetworkMarker>>),
5328        >(
5329            (name, config,),
5330            0x6052eb5ac709af,
5331            fidl::encoding::DynamicFlags::empty(),
5332            _decode,
5333        )
5334    }
5335
5336    type GetNetworkResponseFut = fidl::client::QueryResponseFut<
5337        Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
5338        fidl::encoding::DefaultFuchsiaResourceDialect,
5339    >;
5340    fn r#get_network(&self, mut name: &str) -> Self::GetNetworkResponseFut {
5341        fn _decode(
5342            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5343        ) -> Result<Option<fidl::endpoints::ClientEnd<NetworkMarker>>, fidl::Error> {
5344            let _response = fidl::client::decode_transaction_body::<
5345                NetworkManagerGetNetworkResponse,
5346                fidl::encoding::DefaultFuchsiaResourceDialect,
5347                0x59930bf23acc7d9a,
5348            >(_buf?)?;
5349            Ok(_response.net)
5350        }
5351        self.client.send_query_and_decode::<
5352            NetworkManagerGetNetworkRequest,
5353            Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
5354        >(
5355            (name,),
5356            0x59930bf23acc7d9a,
5357            fidl::encoding::DynamicFlags::empty(),
5358            _decode,
5359        )
5360    }
5361}
5362
5363pub struct NetworkManagerEventStream {
5364    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5365}
5366
5367impl std::marker::Unpin for NetworkManagerEventStream {}
5368
5369impl futures::stream::FusedStream for NetworkManagerEventStream {
5370    fn is_terminated(&self) -> bool {
5371        self.event_receiver.is_terminated()
5372    }
5373}
5374
5375impl futures::Stream for NetworkManagerEventStream {
5376    type Item = Result<NetworkManagerEvent, fidl::Error>;
5377
5378    fn poll_next(
5379        mut self: std::pin::Pin<&mut Self>,
5380        cx: &mut std::task::Context<'_>,
5381    ) -> std::task::Poll<Option<Self::Item>> {
5382        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5383            &mut self.event_receiver,
5384            cx
5385        )?) {
5386            Some(buf) => std::task::Poll::Ready(Some(NetworkManagerEvent::decode(buf))),
5387            None => std::task::Poll::Ready(None),
5388        }
5389    }
5390}
5391
5392#[derive(Debug)]
5393pub enum NetworkManagerEvent {}
5394
5395impl NetworkManagerEvent {
5396    /// Decodes a message buffer as a [`NetworkManagerEvent`].
5397    fn decode(
5398        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5399    ) -> Result<NetworkManagerEvent, fidl::Error> {
5400        let (bytes, _handles) = buf.split_mut();
5401        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5402        debug_assert_eq!(tx_header.tx_id, 0);
5403        match tx_header.ordinal {
5404            _ => Err(fidl::Error::UnknownOrdinal {
5405                ordinal: tx_header.ordinal,
5406                protocol_name:
5407                    <NetworkManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5408            }),
5409        }
5410    }
5411}
5412
5413/// A Stream of incoming requests for fuchsia.netemul.network/NetworkManager.
5414pub struct NetworkManagerRequestStream {
5415    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5416    is_terminated: bool,
5417}
5418
5419impl std::marker::Unpin for NetworkManagerRequestStream {}
5420
5421impl futures::stream::FusedStream for NetworkManagerRequestStream {
5422    fn is_terminated(&self) -> bool {
5423        self.is_terminated
5424    }
5425}
5426
5427impl fidl::endpoints::RequestStream for NetworkManagerRequestStream {
5428    type Protocol = NetworkManagerMarker;
5429    type ControlHandle = NetworkManagerControlHandle;
5430
5431    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5432        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5433    }
5434
5435    fn control_handle(&self) -> Self::ControlHandle {
5436        NetworkManagerControlHandle { inner: self.inner.clone() }
5437    }
5438
5439    fn into_inner(
5440        self,
5441    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5442    {
5443        (self.inner, self.is_terminated)
5444    }
5445
5446    fn from_inner(
5447        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5448        is_terminated: bool,
5449    ) -> Self {
5450        Self { inner, is_terminated }
5451    }
5452}
5453
5454impl futures::Stream for NetworkManagerRequestStream {
5455    type Item = Result<NetworkManagerRequest, fidl::Error>;
5456
5457    fn poll_next(
5458        mut self: std::pin::Pin<&mut Self>,
5459        cx: &mut std::task::Context<'_>,
5460    ) -> std::task::Poll<Option<Self::Item>> {
5461        let this = &mut *self;
5462        if this.inner.check_shutdown(cx) {
5463            this.is_terminated = true;
5464            return std::task::Poll::Ready(None);
5465        }
5466        if this.is_terminated {
5467            panic!("polled NetworkManagerRequestStream after completion");
5468        }
5469        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5470            |bytes, handles| {
5471                match this.inner.channel().read_etc(cx, bytes, handles) {
5472                    std::task::Poll::Ready(Ok(())) => {}
5473                    std::task::Poll::Pending => return std::task::Poll::Pending,
5474                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5475                        this.is_terminated = true;
5476                        return std::task::Poll::Ready(None);
5477                    }
5478                    std::task::Poll::Ready(Err(e)) => {
5479                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5480                            e.into(),
5481                        ))))
5482                    }
5483                }
5484
5485                // A message has been received from the channel
5486                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5487
5488                std::task::Poll::Ready(Some(match header.ordinal {
5489                    0x2488653e0974cc62 => {
5490                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5491                        let mut req = fidl::new_empty!(
5492                            fidl::encoding::EmptyPayload,
5493                            fidl::encoding::DefaultFuchsiaResourceDialect
5494                        );
5495                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5496                        let control_handle =
5497                            NetworkManagerControlHandle { inner: this.inner.clone() };
5498                        Ok(NetworkManagerRequest::ListNetworks {
5499                            responder: NetworkManagerListNetworksResponder {
5500                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5501                                tx_id: header.tx_id,
5502                            },
5503                        })
5504                    }
5505                    0x6052eb5ac709af => {
5506                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5507                        let mut req = fidl::new_empty!(
5508                            NetworkManagerCreateNetworkRequest,
5509                            fidl::encoding::DefaultFuchsiaResourceDialect
5510                        );
5511                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkManagerCreateNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
5512                        let control_handle =
5513                            NetworkManagerControlHandle { inner: this.inner.clone() };
5514                        Ok(NetworkManagerRequest::CreateNetwork {
5515                            name: req.name,
5516                            config: req.config,
5517
5518                            responder: NetworkManagerCreateNetworkResponder {
5519                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5520                                tx_id: header.tx_id,
5521                            },
5522                        })
5523                    }
5524                    0x59930bf23acc7d9a => {
5525                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5526                        let mut req = fidl::new_empty!(
5527                            NetworkManagerGetNetworkRequest,
5528                            fidl::encoding::DefaultFuchsiaResourceDialect
5529                        );
5530                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkManagerGetNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
5531                        let control_handle =
5532                            NetworkManagerControlHandle { inner: this.inner.clone() };
5533                        Ok(NetworkManagerRequest::GetNetwork {
5534                            name: req.name,
5535
5536                            responder: NetworkManagerGetNetworkResponder {
5537                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5538                                tx_id: header.tx_id,
5539                            },
5540                        })
5541                    }
5542                    _ => Err(fidl::Error::UnknownOrdinal {
5543                        ordinal: header.ordinal,
5544                        protocol_name:
5545                            <NetworkManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5546                    }),
5547                }))
5548            },
5549        )
5550    }
5551}
5552
5553/// Manages virtual networks.
5554#[derive(Debug)]
5555pub enum NetworkManagerRequest {
5556    /// Lists emulated networks by name.
5557    ListNetworks { responder: NetworkManagerListNetworksResponder },
5558    /// Creates a new network with given name and config.
5559    CreateNetwork {
5560        name: String,
5561        config: NetworkConfig,
5562        responder: NetworkManagerCreateNetworkResponder,
5563    },
5564    /// Gets a handle to a network.
5565    GetNetwork { name: String, responder: NetworkManagerGetNetworkResponder },
5566}
5567
5568impl NetworkManagerRequest {
5569    #[allow(irrefutable_let_patterns)]
5570    pub fn into_list_networks(self) -> Option<(NetworkManagerListNetworksResponder)> {
5571        if let NetworkManagerRequest::ListNetworks { responder } = self {
5572            Some((responder))
5573        } else {
5574            None
5575        }
5576    }
5577
5578    #[allow(irrefutable_let_patterns)]
5579    pub fn into_create_network(
5580        self,
5581    ) -> Option<(String, NetworkConfig, NetworkManagerCreateNetworkResponder)> {
5582        if let NetworkManagerRequest::CreateNetwork { name, config, responder } = self {
5583            Some((name, config, responder))
5584        } else {
5585            None
5586        }
5587    }
5588
5589    #[allow(irrefutable_let_patterns)]
5590    pub fn into_get_network(self) -> Option<(String, NetworkManagerGetNetworkResponder)> {
5591        if let NetworkManagerRequest::GetNetwork { name, responder } = self {
5592            Some((name, responder))
5593        } else {
5594            None
5595        }
5596    }
5597
5598    /// Name of the method defined in FIDL
5599    pub fn method_name(&self) -> &'static str {
5600        match *self {
5601            NetworkManagerRequest::ListNetworks { .. } => "list_networks",
5602            NetworkManagerRequest::CreateNetwork { .. } => "create_network",
5603            NetworkManagerRequest::GetNetwork { .. } => "get_network",
5604        }
5605    }
5606}
5607
5608#[derive(Debug, Clone)]
5609pub struct NetworkManagerControlHandle {
5610    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5611}
5612
5613impl fidl::endpoints::ControlHandle for NetworkManagerControlHandle {
5614    fn shutdown(&self) {
5615        self.inner.shutdown()
5616    }
5617    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5618        self.inner.shutdown_with_epitaph(status)
5619    }
5620
5621    fn is_closed(&self) -> bool {
5622        self.inner.channel().is_closed()
5623    }
5624    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5625        self.inner.channel().on_closed()
5626    }
5627
5628    #[cfg(target_os = "fuchsia")]
5629    fn signal_peer(
5630        &self,
5631        clear_mask: zx::Signals,
5632        set_mask: zx::Signals,
5633    ) -> Result<(), zx_status::Status> {
5634        use fidl::Peered;
5635        self.inner.channel().signal_peer(clear_mask, set_mask)
5636    }
5637}
5638
5639impl NetworkManagerControlHandle {}
5640
5641#[must_use = "FIDL methods require a response to be sent"]
5642#[derive(Debug)]
5643pub struct NetworkManagerListNetworksResponder {
5644    control_handle: std::mem::ManuallyDrop<NetworkManagerControlHandle>,
5645    tx_id: u32,
5646}
5647
5648/// Set the the channel to be shutdown (see [`NetworkManagerControlHandle::shutdown`])
5649/// if the responder is dropped without sending a response, so that the client
5650/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5651impl std::ops::Drop for NetworkManagerListNetworksResponder {
5652    fn drop(&mut self) {
5653        self.control_handle.shutdown();
5654        // Safety: drops once, never accessed again
5655        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5656    }
5657}
5658
5659impl fidl::endpoints::Responder for NetworkManagerListNetworksResponder {
5660    type ControlHandle = NetworkManagerControlHandle;
5661
5662    fn control_handle(&self) -> &NetworkManagerControlHandle {
5663        &self.control_handle
5664    }
5665
5666    fn drop_without_shutdown(mut self) {
5667        // Safety: drops once, never accessed again due to mem::forget
5668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5669        // Prevent Drop from running (which would shut down the channel)
5670        std::mem::forget(self);
5671    }
5672}
5673
5674impl NetworkManagerListNetworksResponder {
5675    /// Sends a response to the FIDL transaction.
5676    ///
5677    /// Sets the channel to shutdown if an error occurs.
5678    pub fn send(self, mut nets: &[String]) -> Result<(), fidl::Error> {
5679        let _result = self.send_raw(nets);
5680        if _result.is_err() {
5681            self.control_handle.shutdown();
5682        }
5683        self.drop_without_shutdown();
5684        _result
5685    }
5686
5687    /// Similar to "send" but does not shutdown the channel if an error occurs.
5688    pub fn send_no_shutdown_on_err(self, mut nets: &[String]) -> Result<(), fidl::Error> {
5689        let _result = self.send_raw(nets);
5690        self.drop_without_shutdown();
5691        _result
5692    }
5693
5694    fn send_raw(&self, mut nets: &[String]) -> Result<(), fidl::Error> {
5695        self.control_handle.inner.send::<NetworkManagerListNetworksResponse>(
5696            (nets,),
5697            self.tx_id,
5698            0x2488653e0974cc62,
5699            fidl::encoding::DynamicFlags::empty(),
5700        )
5701    }
5702}
5703
5704#[must_use = "FIDL methods require a response to be sent"]
5705#[derive(Debug)]
5706pub struct NetworkManagerCreateNetworkResponder {
5707    control_handle: std::mem::ManuallyDrop<NetworkManagerControlHandle>,
5708    tx_id: u32,
5709}
5710
5711/// Set the the channel to be shutdown (see [`NetworkManagerControlHandle::shutdown`])
5712/// if the responder is dropped without sending a response, so that the client
5713/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5714impl std::ops::Drop for NetworkManagerCreateNetworkResponder {
5715    fn drop(&mut self) {
5716        self.control_handle.shutdown();
5717        // Safety: drops once, never accessed again
5718        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5719    }
5720}
5721
5722impl fidl::endpoints::Responder for NetworkManagerCreateNetworkResponder {
5723    type ControlHandle = NetworkManagerControlHandle;
5724
5725    fn control_handle(&self) -> &NetworkManagerControlHandle {
5726        &self.control_handle
5727    }
5728
5729    fn drop_without_shutdown(mut self) {
5730        // Safety: drops once, never accessed again due to mem::forget
5731        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5732        // Prevent Drop from running (which would shut down the channel)
5733        std::mem::forget(self);
5734    }
5735}
5736
5737impl NetworkManagerCreateNetworkResponder {
5738    /// Sends a response to the FIDL transaction.
5739    ///
5740    /// Sets the channel to shutdown if an error occurs.
5741    pub fn send(
5742        self,
5743        mut status: i32,
5744        mut net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
5745    ) -> Result<(), fidl::Error> {
5746        let _result = self.send_raw(status, net);
5747        if _result.is_err() {
5748            self.control_handle.shutdown();
5749        }
5750        self.drop_without_shutdown();
5751        _result
5752    }
5753
5754    /// Similar to "send" but does not shutdown the channel if an error occurs.
5755    pub fn send_no_shutdown_on_err(
5756        self,
5757        mut status: i32,
5758        mut net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
5759    ) -> Result<(), fidl::Error> {
5760        let _result = self.send_raw(status, net);
5761        self.drop_without_shutdown();
5762        _result
5763    }
5764
5765    fn send_raw(
5766        &self,
5767        mut status: i32,
5768        mut net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
5769    ) -> Result<(), fidl::Error> {
5770        self.control_handle.inner.send::<NetworkManagerCreateNetworkResponse>(
5771            (status, net),
5772            self.tx_id,
5773            0x6052eb5ac709af,
5774            fidl::encoding::DynamicFlags::empty(),
5775        )
5776    }
5777}
5778
5779#[must_use = "FIDL methods require a response to be sent"]
5780#[derive(Debug)]
5781pub struct NetworkManagerGetNetworkResponder {
5782    control_handle: std::mem::ManuallyDrop<NetworkManagerControlHandle>,
5783    tx_id: u32,
5784}
5785
5786/// Set the the channel to be shutdown (see [`NetworkManagerControlHandle::shutdown`])
5787/// if the responder is dropped without sending a response, so that the client
5788/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5789impl std::ops::Drop for NetworkManagerGetNetworkResponder {
5790    fn drop(&mut self) {
5791        self.control_handle.shutdown();
5792        // Safety: drops once, never accessed again
5793        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5794    }
5795}
5796
5797impl fidl::endpoints::Responder for NetworkManagerGetNetworkResponder {
5798    type ControlHandle = NetworkManagerControlHandle;
5799
5800    fn control_handle(&self) -> &NetworkManagerControlHandle {
5801        &self.control_handle
5802    }
5803
5804    fn drop_without_shutdown(mut self) {
5805        // Safety: drops once, never accessed again due to mem::forget
5806        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5807        // Prevent Drop from running (which would shut down the channel)
5808        std::mem::forget(self);
5809    }
5810}
5811
5812impl NetworkManagerGetNetworkResponder {
5813    /// Sends a response to the FIDL transaction.
5814    ///
5815    /// Sets the channel to shutdown if an error occurs.
5816    pub fn send(
5817        self,
5818        mut net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
5819    ) -> Result<(), fidl::Error> {
5820        let _result = self.send_raw(net);
5821        if _result.is_err() {
5822            self.control_handle.shutdown();
5823        }
5824        self.drop_without_shutdown();
5825        _result
5826    }
5827
5828    /// Similar to "send" but does not shutdown the channel if an error occurs.
5829    pub fn send_no_shutdown_on_err(
5830        self,
5831        mut net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
5832    ) -> Result<(), fidl::Error> {
5833        let _result = self.send_raw(net);
5834        self.drop_without_shutdown();
5835        _result
5836    }
5837
5838    fn send_raw(
5839        &self,
5840        mut net: Option<fidl::endpoints::ClientEnd<NetworkMarker>>,
5841    ) -> Result<(), fidl::Error> {
5842        self.control_handle.inner.send::<NetworkManagerGetNetworkResponse>(
5843            (net,),
5844            self.tx_id,
5845            0x59930bf23acc7d9a,
5846            fidl::encoding::DynamicFlags::empty(),
5847        )
5848    }
5849}
5850
5851#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5852pub struct SetupHandleMarker;
5853
5854impl fidl::endpoints::ProtocolMarker for SetupHandleMarker {
5855    type Proxy = SetupHandleProxy;
5856    type RequestStream = SetupHandleRequestStream;
5857    #[cfg(target_os = "fuchsia")]
5858    type SynchronousProxy = SetupHandleSynchronousProxy;
5859
5860    const DEBUG_NAME: &'static str = "(anonymous) SetupHandle";
5861}
5862
5863pub trait SetupHandleProxyInterface: Send + Sync {}
5864#[derive(Debug)]
5865#[cfg(target_os = "fuchsia")]
5866pub struct SetupHandleSynchronousProxy {
5867    client: fidl::client::sync::Client,
5868}
5869
5870#[cfg(target_os = "fuchsia")]
5871impl fidl::endpoints::SynchronousProxy for SetupHandleSynchronousProxy {
5872    type Proxy = SetupHandleProxy;
5873    type Protocol = SetupHandleMarker;
5874
5875    fn from_channel(inner: fidl::Channel) -> Self {
5876        Self::new(inner)
5877    }
5878
5879    fn into_channel(self) -> fidl::Channel {
5880        self.client.into_channel()
5881    }
5882
5883    fn as_channel(&self) -> &fidl::Channel {
5884        self.client.as_channel()
5885    }
5886}
5887
5888#[cfg(target_os = "fuchsia")]
5889impl SetupHandleSynchronousProxy {
5890    pub fn new(channel: fidl::Channel) -> Self {
5891        let protocol_name = <SetupHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5892        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5893    }
5894
5895    pub fn into_channel(self) -> fidl::Channel {
5896        self.client.into_channel()
5897    }
5898
5899    /// Waits until an event arrives and returns it. It is safe for other
5900    /// threads to make concurrent requests while waiting for an event.
5901    pub fn wait_for_event(
5902        &self,
5903        deadline: zx::MonotonicInstant,
5904    ) -> Result<SetupHandleEvent, fidl::Error> {
5905        SetupHandleEvent::decode(self.client.wait_for_event(deadline)?)
5906    }
5907}
5908
5909#[derive(Debug, Clone)]
5910pub struct SetupHandleProxy {
5911    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5912}
5913
5914impl fidl::endpoints::Proxy for SetupHandleProxy {
5915    type Protocol = SetupHandleMarker;
5916
5917    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5918        Self::new(inner)
5919    }
5920
5921    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5922        self.client.into_channel().map_err(|client| Self { client })
5923    }
5924
5925    fn as_channel(&self) -> &::fidl::AsyncChannel {
5926        self.client.as_channel()
5927    }
5928}
5929
5930impl SetupHandleProxy {
5931    /// Create a new Proxy for fuchsia.netemul.network/SetupHandle.
5932    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5933        let protocol_name = <SetupHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5934        Self { client: fidl::client::Client::new(channel, protocol_name) }
5935    }
5936
5937    /// Get a Stream of events from the remote end of the protocol.
5938    ///
5939    /// # Panics
5940    ///
5941    /// Panics if the event stream was already taken.
5942    pub fn take_event_stream(&self) -> SetupHandleEventStream {
5943        SetupHandleEventStream { event_receiver: self.client.take_event_receiver() }
5944    }
5945}
5946
5947impl SetupHandleProxyInterface for SetupHandleProxy {}
5948
5949pub struct SetupHandleEventStream {
5950    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5951}
5952
5953impl std::marker::Unpin for SetupHandleEventStream {}
5954
5955impl futures::stream::FusedStream for SetupHandleEventStream {
5956    fn is_terminated(&self) -> bool {
5957        self.event_receiver.is_terminated()
5958    }
5959}
5960
5961impl futures::Stream for SetupHandleEventStream {
5962    type Item = Result<SetupHandleEvent, fidl::Error>;
5963
5964    fn poll_next(
5965        mut self: std::pin::Pin<&mut Self>,
5966        cx: &mut std::task::Context<'_>,
5967    ) -> std::task::Poll<Option<Self::Item>> {
5968        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5969            &mut self.event_receiver,
5970            cx
5971        )?) {
5972            Some(buf) => std::task::Poll::Ready(Some(SetupHandleEvent::decode(buf))),
5973            None => std::task::Poll::Ready(None),
5974        }
5975    }
5976}
5977
5978#[derive(Debug)]
5979pub enum SetupHandleEvent {}
5980
5981impl SetupHandleEvent {
5982    /// Decodes a message buffer as a [`SetupHandleEvent`].
5983    fn decode(
5984        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5985    ) -> Result<SetupHandleEvent, fidl::Error> {
5986        let (bytes, _handles) = buf.split_mut();
5987        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5988        debug_assert_eq!(tx_header.tx_id, 0);
5989        match tx_header.ordinal {
5990            _ => Err(fidl::Error::UnknownOrdinal {
5991                ordinal: tx_header.ordinal,
5992                protocol_name: <SetupHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5993            }),
5994        }
5995    }
5996}
5997
5998/// A Stream of incoming requests for fuchsia.netemul.network/SetupHandle.
5999pub struct SetupHandleRequestStream {
6000    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6001    is_terminated: bool,
6002}
6003
6004impl std::marker::Unpin for SetupHandleRequestStream {}
6005
6006impl futures::stream::FusedStream for SetupHandleRequestStream {
6007    fn is_terminated(&self) -> bool {
6008        self.is_terminated
6009    }
6010}
6011
6012impl fidl::endpoints::RequestStream for SetupHandleRequestStream {
6013    type Protocol = SetupHandleMarker;
6014    type ControlHandle = SetupHandleControlHandle;
6015
6016    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6017        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6018    }
6019
6020    fn control_handle(&self) -> Self::ControlHandle {
6021        SetupHandleControlHandle { inner: self.inner.clone() }
6022    }
6023
6024    fn into_inner(
6025        self,
6026    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6027    {
6028        (self.inner, self.is_terminated)
6029    }
6030
6031    fn from_inner(
6032        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6033        is_terminated: bool,
6034    ) -> Self {
6035        Self { inner, is_terminated }
6036    }
6037}
6038
6039impl futures::Stream for SetupHandleRequestStream {
6040    type Item = Result<SetupHandleRequest, fidl::Error>;
6041
6042    fn poll_next(
6043        mut self: std::pin::Pin<&mut Self>,
6044        cx: &mut std::task::Context<'_>,
6045    ) -> std::task::Poll<Option<Self::Item>> {
6046        let this = &mut *self;
6047        if this.inner.check_shutdown(cx) {
6048            this.is_terminated = true;
6049            return std::task::Poll::Ready(None);
6050        }
6051        if this.is_terminated {
6052            panic!("polled SetupHandleRequestStream after completion");
6053        }
6054        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6055            |bytes, handles| {
6056                match this.inner.channel().read_etc(cx, bytes, handles) {
6057                    std::task::Poll::Ready(Ok(())) => {}
6058                    std::task::Poll::Pending => return std::task::Poll::Pending,
6059                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6060                        this.is_terminated = true;
6061                        return std::task::Poll::Ready(None);
6062                    }
6063                    std::task::Poll::Ready(Err(e)) => {
6064                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6065                            e.into(),
6066                        ))))
6067                    }
6068                }
6069
6070                // A message has been received from the channel
6071                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6072
6073                std::task::Poll::Ready(Some(match header.ordinal {
6074                    _ => Err(fidl::Error::UnknownOrdinal {
6075                        ordinal: header.ordinal,
6076                        protocol_name:
6077                            <SetupHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6078                    }),
6079                }))
6080            },
6081        )
6082    }
6083}
6084
6085/// Handle returned when using NetworkContext.Setup for quick network configuration.
6086/// Networks and endpoints created by Setup are tied to the lifecycle of the SetupHandle's channel.
6087#[derive(Debug)]
6088pub enum SetupHandleRequest {}
6089
6090impl SetupHandleRequest {
6091    /// Name of the method defined in FIDL
6092    pub fn method_name(&self) -> &'static str {
6093        match *self {}
6094    }
6095}
6096
6097#[derive(Debug, Clone)]
6098pub struct SetupHandleControlHandle {
6099    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6100}
6101
6102impl fidl::endpoints::ControlHandle for SetupHandleControlHandle {
6103    fn shutdown(&self) {
6104        self.inner.shutdown()
6105    }
6106    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6107        self.inner.shutdown_with_epitaph(status)
6108    }
6109
6110    fn is_closed(&self) -> bool {
6111        self.inner.channel().is_closed()
6112    }
6113    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6114        self.inner.channel().on_closed()
6115    }
6116
6117    #[cfg(target_os = "fuchsia")]
6118    fn signal_peer(
6119        &self,
6120        clear_mask: zx::Signals,
6121        set_mask: zx::Signals,
6122    ) -> Result<(), zx_status::Status> {
6123        use fidl::Peered;
6124        self.inner.channel().signal_peer(clear_mask, set_mask)
6125    }
6126}
6127
6128impl SetupHandleControlHandle {}
6129
6130mod internal {
6131    use super::*;
6132
6133    impl fidl::encoding::ResourceTypeMarker for DeviceProxyServeControllerRequest {
6134        type Borrowed<'a> = &'a mut Self;
6135        fn take_or_borrow<'a>(
6136            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6137        ) -> Self::Borrowed<'a> {
6138            value
6139        }
6140    }
6141
6142    unsafe impl fidl::encoding::TypeMarker for DeviceProxyServeControllerRequest {
6143        type Owned = Self;
6144
6145        #[inline(always)]
6146        fn inline_align(_context: fidl::encoding::Context) -> usize {
6147            4
6148        }
6149
6150        #[inline(always)]
6151        fn inline_size(_context: fidl::encoding::Context) -> usize {
6152            4
6153        }
6154    }
6155
6156    unsafe impl
6157        fidl::encoding::Encode<
6158            DeviceProxyServeControllerRequest,
6159            fidl::encoding::DefaultFuchsiaResourceDialect,
6160        > for &mut DeviceProxyServeControllerRequest
6161    {
6162        #[inline]
6163        unsafe fn encode(
6164            self,
6165            encoder: &mut fidl::encoding::Encoder<
6166                '_,
6167                fidl::encoding::DefaultFuchsiaResourceDialect,
6168            >,
6169            offset: usize,
6170            _depth: fidl::encoding::Depth,
6171        ) -> fidl::Result<()> {
6172            encoder.debug_check_bounds::<DeviceProxyServeControllerRequest>(offset);
6173            // Delegate to tuple encoding.
6174            fidl::encoding::Encode::<
6175                DeviceProxyServeControllerRequest,
6176                fidl::encoding::DefaultFuchsiaResourceDialect,
6177            >::encode(
6178                (<fidl::encoding::Endpoint<
6179                    fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
6180                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6181                    &mut self.req
6182                ),),
6183                encoder,
6184                offset,
6185                _depth,
6186            )
6187        }
6188    }
6189    unsafe impl<
6190            T0: fidl::encoding::Encode<
6191                fidl::encoding::Endpoint<
6192                    fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
6193                >,
6194                fidl::encoding::DefaultFuchsiaResourceDialect,
6195            >,
6196        >
6197        fidl::encoding::Encode<
6198            DeviceProxyServeControllerRequest,
6199            fidl::encoding::DefaultFuchsiaResourceDialect,
6200        > for (T0,)
6201    {
6202        #[inline]
6203        unsafe fn encode(
6204            self,
6205            encoder: &mut fidl::encoding::Encoder<
6206                '_,
6207                fidl::encoding::DefaultFuchsiaResourceDialect,
6208            >,
6209            offset: usize,
6210            depth: fidl::encoding::Depth,
6211        ) -> fidl::Result<()> {
6212            encoder.debug_check_bounds::<DeviceProxyServeControllerRequest>(offset);
6213            // Zero out padding regions. There's no need to apply masks
6214            // because the unmasked parts will be overwritten by fields.
6215            // Write the fields.
6216            self.0.encode(encoder, offset + 0, depth)?;
6217            Ok(())
6218        }
6219    }
6220
6221    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6222        for DeviceProxyServeControllerRequest
6223    {
6224        #[inline(always)]
6225        fn new_empty() -> Self {
6226            Self {
6227                req: fidl::new_empty!(
6228                    fidl::encoding::Endpoint<
6229                        fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
6230                    >,
6231                    fidl::encoding::DefaultFuchsiaResourceDialect
6232                ),
6233            }
6234        }
6235
6236        #[inline]
6237        unsafe fn decode(
6238            &mut self,
6239            decoder: &mut fidl::encoding::Decoder<
6240                '_,
6241                fidl::encoding::DefaultFuchsiaResourceDialect,
6242            >,
6243            offset: usize,
6244            _depth: fidl::encoding::Depth,
6245        ) -> fidl::Result<()> {
6246            decoder.debug_check_bounds::<Self>(offset);
6247            // Verify that padding bytes are zero.
6248            fidl::decode!(
6249                fidl::encoding::Endpoint<
6250                    fidl::endpoints::ServerEnd<fidl_fuchsia_device::ControllerMarker>,
6251                >,
6252                fidl::encoding::DefaultFuchsiaResourceDialect,
6253                &mut self.req,
6254                decoder,
6255                offset + 0,
6256                _depth
6257            )?;
6258            Ok(())
6259        }
6260    }
6261
6262    impl fidl::encoding::ResourceTypeMarker for DeviceProxyServeDeviceRequest {
6263        type Borrowed<'a> = &'a mut Self;
6264        fn take_or_borrow<'a>(
6265            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6266        ) -> Self::Borrowed<'a> {
6267            value
6268        }
6269    }
6270
6271    unsafe impl fidl::encoding::TypeMarker for DeviceProxyServeDeviceRequest {
6272        type Owned = Self;
6273
6274        #[inline(always)]
6275        fn inline_align(_context: fidl::encoding::Context) -> usize {
6276            4
6277        }
6278
6279        #[inline(always)]
6280        fn inline_size(_context: fidl::encoding::Context) -> usize {
6281            4
6282        }
6283    }
6284
6285    unsafe impl
6286        fidl::encoding::Encode<
6287            DeviceProxyServeDeviceRequest,
6288            fidl::encoding::DefaultFuchsiaResourceDialect,
6289        > for &mut DeviceProxyServeDeviceRequest
6290    {
6291        #[inline]
6292        unsafe fn encode(
6293            self,
6294            encoder: &mut fidl::encoding::Encoder<
6295                '_,
6296                fidl::encoding::DefaultFuchsiaResourceDialect,
6297            >,
6298            offset: usize,
6299            _depth: fidl::encoding::Depth,
6300        ) -> fidl::Result<()> {
6301            encoder.debug_check_bounds::<DeviceProxyServeDeviceRequest>(offset);
6302            // Delegate to tuple encoding.
6303            fidl::encoding::Encode::<
6304                DeviceProxyServeDeviceRequest,
6305                fidl::encoding::DefaultFuchsiaResourceDialect,
6306            >::encode(
6307                (<fidl::encoding::Endpoint<
6308                    fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
6309                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6310                    &mut self.req
6311                ),),
6312                encoder,
6313                offset,
6314                _depth,
6315            )
6316        }
6317    }
6318    unsafe impl<
6319            T0: fidl::encoding::Encode<
6320                fidl::encoding::Endpoint<
6321                    fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
6322                >,
6323                fidl::encoding::DefaultFuchsiaResourceDialect,
6324            >,
6325        >
6326        fidl::encoding::Encode<
6327            DeviceProxyServeDeviceRequest,
6328            fidl::encoding::DefaultFuchsiaResourceDialect,
6329        > for (T0,)
6330    {
6331        #[inline]
6332        unsafe fn encode(
6333            self,
6334            encoder: &mut fidl::encoding::Encoder<
6335                '_,
6336                fidl::encoding::DefaultFuchsiaResourceDialect,
6337            >,
6338            offset: usize,
6339            depth: fidl::encoding::Depth,
6340        ) -> fidl::Result<()> {
6341            encoder.debug_check_bounds::<DeviceProxyServeDeviceRequest>(offset);
6342            // Zero out padding regions. There's no need to apply masks
6343            // because the unmasked parts will be overwritten by fields.
6344            // Write the fields.
6345            self.0.encode(encoder, offset + 0, depth)?;
6346            Ok(())
6347        }
6348    }
6349
6350    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6351        for DeviceProxyServeDeviceRequest
6352    {
6353        #[inline(always)]
6354        fn new_empty() -> Self {
6355            Self {
6356                req: fidl::new_empty!(
6357                    fidl::encoding::Endpoint<
6358                        fidl::endpoints::ServerEnd<
6359                            fidl_fuchsia_hardware_network::DeviceInstanceMarker,
6360                        >,
6361                    >,
6362                    fidl::encoding::DefaultFuchsiaResourceDialect
6363                ),
6364            }
6365        }
6366
6367        #[inline]
6368        unsafe fn decode(
6369            &mut self,
6370            decoder: &mut fidl::encoding::Decoder<
6371                '_,
6372                fidl::encoding::DefaultFuchsiaResourceDialect,
6373            >,
6374            offset: usize,
6375            _depth: fidl::encoding::Depth,
6376        ) -> fidl::Result<()> {
6377            decoder.debug_check_bounds::<Self>(offset);
6378            // Verify that padding bytes are zero.
6379            fidl::decode!(
6380                fidl::encoding::Endpoint<
6381                    fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::DeviceInstanceMarker>,
6382                >,
6383                fidl::encoding::DefaultFuchsiaResourceDialect,
6384                &mut self.req,
6385                decoder,
6386                offset + 0,
6387                _depth
6388            )?;
6389            Ok(())
6390        }
6391    }
6392
6393    impl fidl::encoding::ValueTypeMarker for EndpointConfig {
6394        type Borrowed<'a> = &'a Self;
6395        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6396            value
6397        }
6398    }
6399
6400    unsafe impl fidl::encoding::TypeMarker for EndpointConfig {
6401        type Owned = Self;
6402
6403        #[inline(always)]
6404        fn inline_align(_context: fidl::encoding::Context) -> usize {
6405            8
6406        }
6407
6408        #[inline(always)]
6409        fn inline_size(_context: fidl::encoding::Context) -> usize {
6410            24
6411        }
6412    }
6413
6414    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EndpointConfig, D>
6415        for &EndpointConfig
6416    {
6417        #[inline]
6418        unsafe fn encode(
6419            self,
6420            encoder: &mut fidl::encoding::Encoder<'_, D>,
6421            offset: usize,
6422            _depth: fidl::encoding::Depth,
6423        ) -> fidl::Result<()> {
6424            encoder.debug_check_bounds::<EndpointConfig>(offset);
6425            // Delegate to tuple encoding.
6426            fidl::encoding::Encode::<EndpointConfig, D>::encode(
6427                (
6428                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.mtu),
6429                    <fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.mac),
6430                    <fidl_fuchsia_hardware_network::PortClass as fidl::encoding::ValueTypeMarker>::borrow(&self.port_class),
6431                ),
6432                encoder, offset, _depth
6433            )
6434        }
6435    }
6436    unsafe impl<
6437            D: fidl::encoding::ResourceDialect,
6438            T0: fidl::encoding::Encode<u16, D>,
6439            T1: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>, D>,
6440            T2: fidl::encoding::Encode<fidl_fuchsia_hardware_network::PortClass, D>,
6441        > fidl::encoding::Encode<EndpointConfig, D> for (T0, T1, T2)
6442    {
6443        #[inline]
6444        unsafe fn encode(
6445            self,
6446            encoder: &mut fidl::encoding::Encoder<'_, D>,
6447            offset: usize,
6448            depth: fidl::encoding::Depth,
6449        ) -> fidl::Result<()> {
6450            encoder.debug_check_bounds::<EndpointConfig>(offset);
6451            // Zero out padding regions. There's no need to apply masks
6452            // because the unmasked parts will be overwritten by fields.
6453            unsafe {
6454                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
6455                (ptr as *mut u64).write_unaligned(0);
6456            }
6457            unsafe {
6458                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
6459                (ptr as *mut u64).write_unaligned(0);
6460            }
6461            // Write the fields.
6462            self.0.encode(encoder, offset + 0, depth)?;
6463            self.1.encode(encoder, offset + 8, depth)?;
6464            self.2.encode(encoder, offset + 16, depth)?;
6465            Ok(())
6466        }
6467    }
6468
6469    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EndpointConfig {
6470        #[inline(always)]
6471        fn new_empty() -> Self {
6472            Self {
6473                mtu: fidl::new_empty!(u16, D),
6474                mac: fidl::new_empty!(fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>, D),
6475                port_class: fidl::new_empty!(fidl_fuchsia_hardware_network::PortClass, D),
6476            }
6477        }
6478
6479        #[inline]
6480        unsafe fn decode(
6481            &mut self,
6482            decoder: &mut fidl::encoding::Decoder<'_, D>,
6483            offset: usize,
6484            _depth: fidl::encoding::Depth,
6485        ) -> fidl::Result<()> {
6486            decoder.debug_check_bounds::<Self>(offset);
6487            // Verify that padding bytes are zero.
6488            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
6489            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6490            let mask = 0xffffffffffff0000u64;
6491            let maskedval = padval & mask;
6492            if maskedval != 0 {
6493                return Err(fidl::Error::NonZeroPadding {
6494                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
6495                });
6496            }
6497            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
6498            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6499            let mask = 0xffffffffffff0000u64;
6500            let maskedval = padval & mask;
6501            if maskedval != 0 {
6502                return Err(fidl::Error::NonZeroPadding {
6503                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
6504                });
6505            }
6506            fidl::decode!(u16, D, &mut self.mtu, decoder, offset + 0, _depth)?;
6507            fidl::decode!(
6508                fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>,
6509                D,
6510                &mut self.mac,
6511                decoder,
6512                offset + 8,
6513                _depth
6514            )?;
6515            fidl::decode!(
6516                fidl_fuchsia_hardware_network::PortClass,
6517                D,
6518                &mut self.port_class,
6519                decoder,
6520                offset + 16,
6521                _depth
6522            )?;
6523            Ok(())
6524        }
6525    }
6526
6527    impl fidl::encoding::ValueTypeMarker for EndpointGetConfigResponse {
6528        type Borrowed<'a> = &'a Self;
6529        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6530            value
6531        }
6532    }
6533
6534    unsafe impl fidl::encoding::TypeMarker for EndpointGetConfigResponse {
6535        type Owned = Self;
6536
6537        #[inline(always)]
6538        fn inline_align(_context: fidl::encoding::Context) -> usize {
6539            8
6540        }
6541
6542        #[inline(always)]
6543        fn inline_size(_context: fidl::encoding::Context) -> usize {
6544            24
6545        }
6546    }
6547
6548    unsafe impl<D: fidl::encoding::ResourceDialect>
6549        fidl::encoding::Encode<EndpointGetConfigResponse, D> for &EndpointGetConfigResponse
6550    {
6551        #[inline]
6552        unsafe fn encode(
6553            self,
6554            encoder: &mut fidl::encoding::Encoder<'_, D>,
6555            offset: usize,
6556            _depth: fidl::encoding::Depth,
6557        ) -> fidl::Result<()> {
6558            encoder.debug_check_bounds::<EndpointGetConfigResponse>(offset);
6559            // Delegate to tuple encoding.
6560            fidl::encoding::Encode::<EndpointGetConfigResponse, D>::encode(
6561                (<EndpointConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
6562                encoder,
6563                offset,
6564                _depth,
6565            )
6566        }
6567    }
6568    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<EndpointConfig, D>>
6569        fidl::encoding::Encode<EndpointGetConfigResponse, D> for (T0,)
6570    {
6571        #[inline]
6572        unsafe fn encode(
6573            self,
6574            encoder: &mut fidl::encoding::Encoder<'_, D>,
6575            offset: usize,
6576            depth: fidl::encoding::Depth,
6577        ) -> fidl::Result<()> {
6578            encoder.debug_check_bounds::<EndpointGetConfigResponse>(offset);
6579            // Zero out padding regions. There's no need to apply masks
6580            // because the unmasked parts will be overwritten by fields.
6581            // Write the fields.
6582            self.0.encode(encoder, offset + 0, depth)?;
6583            Ok(())
6584        }
6585    }
6586
6587    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6588        for EndpointGetConfigResponse
6589    {
6590        #[inline(always)]
6591        fn new_empty() -> Self {
6592            Self { config: fidl::new_empty!(EndpointConfig, D) }
6593        }
6594
6595        #[inline]
6596        unsafe fn decode(
6597            &mut self,
6598            decoder: &mut fidl::encoding::Decoder<'_, D>,
6599            offset: usize,
6600            _depth: fidl::encoding::Depth,
6601        ) -> fidl::Result<()> {
6602            decoder.debug_check_bounds::<Self>(offset);
6603            // Verify that padding bytes are zero.
6604            fidl::decode!(EndpointConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
6605            Ok(())
6606        }
6607    }
6608
6609    impl fidl::encoding::ValueTypeMarker for EndpointGetNameResponse {
6610        type Borrowed<'a> = &'a Self;
6611        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6612            value
6613        }
6614    }
6615
6616    unsafe impl fidl::encoding::TypeMarker for EndpointGetNameResponse {
6617        type Owned = Self;
6618
6619        #[inline(always)]
6620        fn inline_align(_context: fidl::encoding::Context) -> usize {
6621            8
6622        }
6623
6624        #[inline(always)]
6625        fn inline_size(_context: fidl::encoding::Context) -> usize {
6626            16
6627        }
6628    }
6629
6630    unsafe impl<D: fidl::encoding::ResourceDialect>
6631        fidl::encoding::Encode<EndpointGetNameResponse, D> for &EndpointGetNameResponse
6632    {
6633        #[inline]
6634        unsafe fn encode(
6635            self,
6636            encoder: &mut fidl::encoding::Encoder<'_, D>,
6637            offset: usize,
6638            _depth: fidl::encoding::Depth,
6639        ) -> fidl::Result<()> {
6640            encoder.debug_check_bounds::<EndpointGetNameResponse>(offset);
6641            // Delegate to tuple encoding.
6642            fidl::encoding::Encode::<EndpointGetNameResponse, D>::encode(
6643                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
6644                    &self.name,
6645                ),),
6646                encoder,
6647                offset,
6648                _depth,
6649            )
6650        }
6651    }
6652    unsafe impl<
6653            D: fidl::encoding::ResourceDialect,
6654            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
6655        > fidl::encoding::Encode<EndpointGetNameResponse, D> for (T0,)
6656    {
6657        #[inline]
6658        unsafe fn encode(
6659            self,
6660            encoder: &mut fidl::encoding::Encoder<'_, D>,
6661            offset: usize,
6662            depth: fidl::encoding::Depth,
6663        ) -> fidl::Result<()> {
6664            encoder.debug_check_bounds::<EndpointGetNameResponse>(offset);
6665            // Zero out padding regions. There's no need to apply masks
6666            // because the unmasked parts will be overwritten by fields.
6667            // Write the fields.
6668            self.0.encode(encoder, offset + 0, depth)?;
6669            Ok(())
6670        }
6671    }
6672
6673    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6674        for EndpointGetNameResponse
6675    {
6676        #[inline(always)]
6677        fn new_empty() -> Self {
6678            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
6679        }
6680
6681        #[inline]
6682        unsafe fn decode(
6683            &mut self,
6684            decoder: &mut fidl::encoding::Decoder<'_, D>,
6685            offset: usize,
6686            _depth: fidl::encoding::Depth,
6687        ) -> fidl::Result<()> {
6688            decoder.debug_check_bounds::<Self>(offset);
6689            // Verify that padding bytes are zero.
6690            fidl::decode!(
6691                fidl::encoding::BoundedString<256>,
6692                D,
6693                &mut self.name,
6694                decoder,
6695                offset + 0,
6696                _depth
6697            )?;
6698            Ok(())
6699        }
6700    }
6701
6702    impl fidl::encoding::ResourceTypeMarker for EndpointGetPortRequest {
6703        type Borrowed<'a> = &'a mut Self;
6704        fn take_or_borrow<'a>(
6705            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6706        ) -> Self::Borrowed<'a> {
6707            value
6708        }
6709    }
6710
6711    unsafe impl fidl::encoding::TypeMarker for EndpointGetPortRequest {
6712        type Owned = Self;
6713
6714        #[inline(always)]
6715        fn inline_align(_context: fidl::encoding::Context) -> usize {
6716            4
6717        }
6718
6719        #[inline(always)]
6720        fn inline_size(_context: fidl::encoding::Context) -> usize {
6721            4
6722        }
6723    }
6724
6725    unsafe impl
6726        fidl::encoding::Encode<
6727            EndpointGetPortRequest,
6728            fidl::encoding::DefaultFuchsiaResourceDialect,
6729        > for &mut EndpointGetPortRequest
6730    {
6731        #[inline]
6732        unsafe fn encode(
6733            self,
6734            encoder: &mut fidl::encoding::Encoder<
6735                '_,
6736                fidl::encoding::DefaultFuchsiaResourceDialect,
6737            >,
6738            offset: usize,
6739            _depth: fidl::encoding::Depth,
6740        ) -> fidl::Result<()> {
6741            encoder.debug_check_bounds::<EndpointGetPortRequest>(offset);
6742            // Delegate to tuple encoding.
6743            fidl::encoding::Encode::<
6744                EndpointGetPortRequest,
6745                fidl::encoding::DefaultFuchsiaResourceDialect,
6746            >::encode(
6747                (<fidl::encoding::Endpoint<
6748                    fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
6749                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6750                    &mut self.port
6751                ),),
6752                encoder,
6753                offset,
6754                _depth,
6755            )
6756        }
6757    }
6758    unsafe impl<
6759            T0: fidl::encoding::Encode<
6760                fidl::encoding::Endpoint<
6761                    fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
6762                >,
6763                fidl::encoding::DefaultFuchsiaResourceDialect,
6764            >,
6765        >
6766        fidl::encoding::Encode<
6767            EndpointGetPortRequest,
6768            fidl::encoding::DefaultFuchsiaResourceDialect,
6769        > for (T0,)
6770    {
6771        #[inline]
6772        unsafe fn encode(
6773            self,
6774            encoder: &mut fidl::encoding::Encoder<
6775                '_,
6776                fidl::encoding::DefaultFuchsiaResourceDialect,
6777            >,
6778            offset: usize,
6779            depth: fidl::encoding::Depth,
6780        ) -> fidl::Result<()> {
6781            encoder.debug_check_bounds::<EndpointGetPortRequest>(offset);
6782            // Zero out padding regions. There's no need to apply masks
6783            // because the unmasked parts will be overwritten by fields.
6784            // Write the fields.
6785            self.0.encode(encoder, offset + 0, depth)?;
6786            Ok(())
6787        }
6788    }
6789
6790    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6791        for EndpointGetPortRequest
6792    {
6793        #[inline(always)]
6794        fn new_empty() -> Self {
6795            Self {
6796                port: fidl::new_empty!(
6797                    fidl::encoding::Endpoint<
6798                        fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
6799                    >,
6800                    fidl::encoding::DefaultFuchsiaResourceDialect
6801                ),
6802            }
6803        }
6804
6805        #[inline]
6806        unsafe fn decode(
6807            &mut self,
6808            decoder: &mut fidl::encoding::Decoder<
6809                '_,
6810                fidl::encoding::DefaultFuchsiaResourceDialect,
6811            >,
6812            offset: usize,
6813            _depth: fidl::encoding::Depth,
6814        ) -> fidl::Result<()> {
6815            decoder.debug_check_bounds::<Self>(offset);
6816            // Verify that padding bytes are zero.
6817            fidl::decode!(
6818                fidl::encoding::Endpoint<
6819                    fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
6820                >,
6821                fidl::encoding::DefaultFuchsiaResourceDialect,
6822                &mut self.port,
6823                decoder,
6824                offset + 0,
6825                _depth
6826            )?;
6827            Ok(())
6828        }
6829    }
6830
6831    impl fidl::encoding::ResourceTypeMarker for EndpointGetProxyRequest {
6832        type Borrowed<'a> = &'a mut Self;
6833        fn take_or_borrow<'a>(
6834            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6835        ) -> Self::Borrowed<'a> {
6836            value
6837        }
6838    }
6839
6840    unsafe impl fidl::encoding::TypeMarker for EndpointGetProxyRequest {
6841        type Owned = Self;
6842
6843        #[inline(always)]
6844        fn inline_align(_context: fidl::encoding::Context) -> usize {
6845            4
6846        }
6847
6848        #[inline(always)]
6849        fn inline_size(_context: fidl::encoding::Context) -> usize {
6850            4
6851        }
6852    }
6853
6854    unsafe impl
6855        fidl::encoding::Encode<
6856            EndpointGetProxyRequest,
6857            fidl::encoding::DefaultFuchsiaResourceDialect,
6858        > for &mut EndpointGetProxyRequest
6859    {
6860        #[inline]
6861        unsafe fn encode(
6862            self,
6863            encoder: &mut fidl::encoding::Encoder<
6864                '_,
6865                fidl::encoding::DefaultFuchsiaResourceDialect,
6866            >,
6867            offset: usize,
6868            _depth: fidl::encoding::Depth,
6869        ) -> fidl::Result<()> {
6870            encoder.debug_check_bounds::<EndpointGetProxyRequest>(offset);
6871            // Delegate to tuple encoding.
6872            fidl::encoding::Encode::<EndpointGetProxyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6873                (
6874                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceProxy_Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.proxy),
6875                ),
6876                encoder, offset, _depth
6877            )
6878        }
6879    }
6880    unsafe impl<
6881            T0: fidl::encoding::Encode<
6882                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceProxy_Marker>>,
6883                fidl::encoding::DefaultFuchsiaResourceDialect,
6884            >,
6885        >
6886        fidl::encoding::Encode<
6887            EndpointGetProxyRequest,
6888            fidl::encoding::DefaultFuchsiaResourceDialect,
6889        > for (T0,)
6890    {
6891        #[inline]
6892        unsafe fn encode(
6893            self,
6894            encoder: &mut fidl::encoding::Encoder<
6895                '_,
6896                fidl::encoding::DefaultFuchsiaResourceDialect,
6897            >,
6898            offset: usize,
6899            depth: fidl::encoding::Depth,
6900        ) -> fidl::Result<()> {
6901            encoder.debug_check_bounds::<EndpointGetProxyRequest>(offset);
6902            // Zero out padding regions. There's no need to apply masks
6903            // because the unmasked parts will be overwritten by fields.
6904            // Write the fields.
6905            self.0.encode(encoder, offset + 0, depth)?;
6906            Ok(())
6907        }
6908    }
6909
6910    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6911        for EndpointGetProxyRequest
6912    {
6913        #[inline(always)]
6914        fn new_empty() -> Self {
6915            Self {
6916                proxy: fidl::new_empty!(
6917                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceProxy_Marker>>,
6918                    fidl::encoding::DefaultFuchsiaResourceDialect
6919                ),
6920            }
6921        }
6922
6923        #[inline]
6924        unsafe fn decode(
6925            &mut self,
6926            decoder: &mut fidl::encoding::Decoder<
6927                '_,
6928                fidl::encoding::DefaultFuchsiaResourceDialect,
6929            >,
6930            offset: usize,
6931            _depth: fidl::encoding::Depth,
6932        ) -> fidl::Result<()> {
6933            decoder.debug_check_bounds::<Self>(offset);
6934            // Verify that padding bytes are zero.
6935            fidl::decode!(
6936                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceProxy_Marker>>,
6937                fidl::encoding::DefaultFuchsiaResourceDialect,
6938                &mut self.proxy,
6939                decoder,
6940                offset + 0,
6941                _depth
6942            )?;
6943            Ok(())
6944        }
6945    }
6946
6947    impl fidl::encoding::ValueTypeMarker for EndpointManagerCreateEndpointRequest {
6948        type Borrowed<'a> = &'a Self;
6949        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6950            value
6951        }
6952    }
6953
6954    unsafe impl fidl::encoding::TypeMarker for EndpointManagerCreateEndpointRequest {
6955        type Owned = Self;
6956
6957        #[inline(always)]
6958        fn inline_align(_context: fidl::encoding::Context) -> usize {
6959            8
6960        }
6961
6962        #[inline(always)]
6963        fn inline_size(_context: fidl::encoding::Context) -> usize {
6964            40
6965        }
6966    }
6967
6968    unsafe impl<D: fidl::encoding::ResourceDialect>
6969        fidl::encoding::Encode<EndpointManagerCreateEndpointRequest, D>
6970        for &EndpointManagerCreateEndpointRequest
6971    {
6972        #[inline]
6973        unsafe fn encode(
6974            self,
6975            encoder: &mut fidl::encoding::Encoder<'_, D>,
6976            offset: usize,
6977            _depth: fidl::encoding::Depth,
6978        ) -> fidl::Result<()> {
6979            encoder.debug_check_bounds::<EndpointManagerCreateEndpointRequest>(offset);
6980            // Delegate to tuple encoding.
6981            fidl::encoding::Encode::<EndpointManagerCreateEndpointRequest, D>::encode(
6982                (
6983                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
6984                        &self.name,
6985                    ),
6986                    <EndpointConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
6987                ),
6988                encoder,
6989                offset,
6990                _depth,
6991            )
6992        }
6993    }
6994    unsafe impl<
6995            D: fidl::encoding::ResourceDialect,
6996            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
6997            T1: fidl::encoding::Encode<EndpointConfig, D>,
6998        > fidl::encoding::Encode<EndpointManagerCreateEndpointRequest, D> for (T0, T1)
6999    {
7000        #[inline]
7001        unsafe fn encode(
7002            self,
7003            encoder: &mut fidl::encoding::Encoder<'_, D>,
7004            offset: usize,
7005            depth: fidl::encoding::Depth,
7006        ) -> fidl::Result<()> {
7007            encoder.debug_check_bounds::<EndpointManagerCreateEndpointRequest>(offset);
7008            // Zero out padding regions. There's no need to apply masks
7009            // because the unmasked parts will be overwritten by fields.
7010            // Write the fields.
7011            self.0.encode(encoder, offset + 0, depth)?;
7012            self.1.encode(encoder, offset + 16, depth)?;
7013            Ok(())
7014        }
7015    }
7016
7017    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7018        for EndpointManagerCreateEndpointRequest
7019    {
7020        #[inline(always)]
7021        fn new_empty() -> Self {
7022            Self {
7023                name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
7024                config: fidl::new_empty!(EndpointConfig, D),
7025            }
7026        }
7027
7028        #[inline]
7029        unsafe fn decode(
7030            &mut self,
7031            decoder: &mut fidl::encoding::Decoder<'_, D>,
7032            offset: usize,
7033            _depth: fidl::encoding::Depth,
7034        ) -> fidl::Result<()> {
7035            decoder.debug_check_bounds::<Self>(offset);
7036            // Verify that padding bytes are zero.
7037            fidl::decode!(
7038                fidl::encoding::BoundedString<256>,
7039                D,
7040                &mut self.name,
7041                decoder,
7042                offset + 0,
7043                _depth
7044            )?;
7045            fidl::decode!(EndpointConfig, D, &mut self.config, decoder, offset + 16, _depth)?;
7046            Ok(())
7047        }
7048    }
7049
7050    impl fidl::encoding::ResourceTypeMarker for EndpointManagerCreateEndpointResponse {
7051        type Borrowed<'a> = &'a mut Self;
7052        fn take_or_borrow<'a>(
7053            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7054        ) -> Self::Borrowed<'a> {
7055            value
7056        }
7057    }
7058
7059    unsafe impl fidl::encoding::TypeMarker for EndpointManagerCreateEndpointResponse {
7060        type Owned = Self;
7061
7062        #[inline(always)]
7063        fn inline_align(_context: fidl::encoding::Context) -> usize {
7064            4
7065        }
7066
7067        #[inline(always)]
7068        fn inline_size(_context: fidl::encoding::Context) -> usize {
7069            8
7070        }
7071    }
7072
7073    unsafe impl
7074        fidl::encoding::Encode<
7075            EndpointManagerCreateEndpointResponse,
7076            fidl::encoding::DefaultFuchsiaResourceDialect,
7077        > for &mut EndpointManagerCreateEndpointResponse
7078    {
7079        #[inline]
7080        unsafe fn encode(
7081            self,
7082            encoder: &mut fidl::encoding::Encoder<
7083                '_,
7084                fidl::encoding::DefaultFuchsiaResourceDialect,
7085            >,
7086            offset: usize,
7087            _depth: fidl::encoding::Depth,
7088        ) -> fidl::Result<()> {
7089            encoder.debug_check_bounds::<EndpointManagerCreateEndpointResponse>(offset);
7090            // Delegate to tuple encoding.
7091            fidl::encoding::Encode::<
7092                EndpointManagerCreateEndpointResponse,
7093                fidl::encoding::DefaultFuchsiaResourceDialect,
7094            >::encode(
7095                (
7096                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
7097                    <fidl::encoding::Optional<
7098                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
7099                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7100                        &mut self.endpoint
7101                    ),
7102                ),
7103                encoder,
7104                offset,
7105                _depth,
7106            )
7107        }
7108    }
7109    unsafe impl<
7110            T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
7111            T1: fidl::encoding::Encode<
7112                fidl::encoding::Optional<
7113                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
7114                >,
7115                fidl::encoding::DefaultFuchsiaResourceDialect,
7116            >,
7117        >
7118        fidl::encoding::Encode<
7119            EndpointManagerCreateEndpointResponse,
7120            fidl::encoding::DefaultFuchsiaResourceDialect,
7121        > for (T0, T1)
7122    {
7123        #[inline]
7124        unsafe fn encode(
7125            self,
7126            encoder: &mut fidl::encoding::Encoder<
7127                '_,
7128                fidl::encoding::DefaultFuchsiaResourceDialect,
7129            >,
7130            offset: usize,
7131            depth: fidl::encoding::Depth,
7132        ) -> fidl::Result<()> {
7133            encoder.debug_check_bounds::<EndpointManagerCreateEndpointResponse>(offset);
7134            // Zero out padding regions. There's no need to apply masks
7135            // because the unmasked parts will be overwritten by fields.
7136            // Write the fields.
7137            self.0.encode(encoder, offset + 0, depth)?;
7138            self.1.encode(encoder, offset + 4, depth)?;
7139            Ok(())
7140        }
7141    }
7142
7143    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7144        for EndpointManagerCreateEndpointResponse
7145    {
7146        #[inline(always)]
7147        fn new_empty() -> Self {
7148            Self {
7149                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
7150                endpoint: fidl::new_empty!(
7151                    fidl::encoding::Optional<
7152                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
7153                    >,
7154                    fidl::encoding::DefaultFuchsiaResourceDialect
7155                ),
7156            }
7157        }
7158
7159        #[inline]
7160        unsafe fn decode(
7161            &mut self,
7162            decoder: &mut fidl::encoding::Decoder<
7163                '_,
7164                fidl::encoding::DefaultFuchsiaResourceDialect,
7165            >,
7166            offset: usize,
7167            _depth: fidl::encoding::Depth,
7168        ) -> fidl::Result<()> {
7169            decoder.debug_check_bounds::<Self>(offset);
7170            // Verify that padding bytes are zero.
7171            fidl::decode!(
7172                i32,
7173                fidl::encoding::DefaultFuchsiaResourceDialect,
7174                &mut self.status,
7175                decoder,
7176                offset + 0,
7177                _depth
7178            )?;
7179            fidl::decode!(
7180                fidl::encoding::Optional<
7181                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
7182                >,
7183                fidl::encoding::DefaultFuchsiaResourceDialect,
7184                &mut self.endpoint,
7185                decoder,
7186                offset + 4,
7187                _depth
7188            )?;
7189            Ok(())
7190        }
7191    }
7192
7193    impl fidl::encoding::ValueTypeMarker for EndpointManagerGetEndpointRequest {
7194        type Borrowed<'a> = &'a Self;
7195        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7196            value
7197        }
7198    }
7199
7200    unsafe impl fidl::encoding::TypeMarker for EndpointManagerGetEndpointRequest {
7201        type Owned = Self;
7202
7203        #[inline(always)]
7204        fn inline_align(_context: fidl::encoding::Context) -> usize {
7205            8
7206        }
7207
7208        #[inline(always)]
7209        fn inline_size(_context: fidl::encoding::Context) -> usize {
7210            16
7211        }
7212    }
7213
7214    unsafe impl<D: fidl::encoding::ResourceDialect>
7215        fidl::encoding::Encode<EndpointManagerGetEndpointRequest, D>
7216        for &EndpointManagerGetEndpointRequest
7217    {
7218        #[inline]
7219        unsafe fn encode(
7220            self,
7221            encoder: &mut fidl::encoding::Encoder<'_, D>,
7222            offset: usize,
7223            _depth: fidl::encoding::Depth,
7224        ) -> fidl::Result<()> {
7225            encoder.debug_check_bounds::<EndpointManagerGetEndpointRequest>(offset);
7226            // Delegate to tuple encoding.
7227            fidl::encoding::Encode::<EndpointManagerGetEndpointRequest, D>::encode(
7228                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
7229                    &self.name,
7230                ),),
7231                encoder,
7232                offset,
7233                _depth,
7234            )
7235        }
7236    }
7237    unsafe impl<
7238            D: fidl::encoding::ResourceDialect,
7239            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
7240        > fidl::encoding::Encode<EndpointManagerGetEndpointRequest, D> for (T0,)
7241    {
7242        #[inline]
7243        unsafe fn encode(
7244            self,
7245            encoder: &mut fidl::encoding::Encoder<'_, D>,
7246            offset: usize,
7247            depth: fidl::encoding::Depth,
7248        ) -> fidl::Result<()> {
7249            encoder.debug_check_bounds::<EndpointManagerGetEndpointRequest>(offset);
7250            // Zero out padding regions. There's no need to apply masks
7251            // because the unmasked parts will be overwritten by fields.
7252            // Write the fields.
7253            self.0.encode(encoder, offset + 0, depth)?;
7254            Ok(())
7255        }
7256    }
7257
7258    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7259        for EndpointManagerGetEndpointRequest
7260    {
7261        #[inline(always)]
7262        fn new_empty() -> Self {
7263            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
7264        }
7265
7266        #[inline]
7267        unsafe fn decode(
7268            &mut self,
7269            decoder: &mut fidl::encoding::Decoder<'_, D>,
7270            offset: usize,
7271            _depth: fidl::encoding::Depth,
7272        ) -> fidl::Result<()> {
7273            decoder.debug_check_bounds::<Self>(offset);
7274            // Verify that padding bytes are zero.
7275            fidl::decode!(
7276                fidl::encoding::BoundedString<256>,
7277                D,
7278                &mut self.name,
7279                decoder,
7280                offset + 0,
7281                _depth
7282            )?;
7283            Ok(())
7284        }
7285    }
7286
7287    impl fidl::encoding::ResourceTypeMarker for EndpointManagerGetEndpointResponse {
7288        type Borrowed<'a> = &'a mut Self;
7289        fn take_or_borrow<'a>(
7290            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7291        ) -> Self::Borrowed<'a> {
7292            value
7293        }
7294    }
7295
7296    unsafe impl fidl::encoding::TypeMarker for EndpointManagerGetEndpointResponse {
7297        type Owned = Self;
7298
7299        #[inline(always)]
7300        fn inline_align(_context: fidl::encoding::Context) -> usize {
7301            4
7302        }
7303
7304        #[inline(always)]
7305        fn inline_size(_context: fidl::encoding::Context) -> usize {
7306            4
7307        }
7308    }
7309
7310    unsafe impl
7311        fidl::encoding::Encode<
7312            EndpointManagerGetEndpointResponse,
7313            fidl::encoding::DefaultFuchsiaResourceDialect,
7314        > for &mut EndpointManagerGetEndpointResponse
7315    {
7316        #[inline]
7317        unsafe fn encode(
7318            self,
7319            encoder: &mut fidl::encoding::Encoder<
7320                '_,
7321                fidl::encoding::DefaultFuchsiaResourceDialect,
7322            >,
7323            offset: usize,
7324            _depth: fidl::encoding::Depth,
7325        ) -> fidl::Result<()> {
7326            encoder.debug_check_bounds::<EndpointManagerGetEndpointResponse>(offset);
7327            // Delegate to tuple encoding.
7328            fidl::encoding::Encode::<
7329                EndpointManagerGetEndpointResponse,
7330                fidl::encoding::DefaultFuchsiaResourceDialect,
7331            >::encode(
7332                (<fidl::encoding::Optional<
7333                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
7334                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7335                    &mut self.endpoint
7336                ),),
7337                encoder,
7338                offset,
7339                _depth,
7340            )
7341        }
7342    }
7343    unsafe impl<
7344            T0: fidl::encoding::Encode<
7345                fidl::encoding::Optional<
7346                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
7347                >,
7348                fidl::encoding::DefaultFuchsiaResourceDialect,
7349            >,
7350        >
7351        fidl::encoding::Encode<
7352            EndpointManagerGetEndpointResponse,
7353            fidl::encoding::DefaultFuchsiaResourceDialect,
7354        > for (T0,)
7355    {
7356        #[inline]
7357        unsafe fn encode(
7358            self,
7359            encoder: &mut fidl::encoding::Encoder<
7360                '_,
7361                fidl::encoding::DefaultFuchsiaResourceDialect,
7362            >,
7363            offset: usize,
7364            depth: fidl::encoding::Depth,
7365        ) -> fidl::Result<()> {
7366            encoder.debug_check_bounds::<EndpointManagerGetEndpointResponse>(offset);
7367            // Zero out padding regions. There's no need to apply masks
7368            // because the unmasked parts will be overwritten by fields.
7369            // Write the fields.
7370            self.0.encode(encoder, offset + 0, depth)?;
7371            Ok(())
7372        }
7373    }
7374
7375    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7376        for EndpointManagerGetEndpointResponse
7377    {
7378        #[inline(always)]
7379        fn new_empty() -> Self {
7380            Self {
7381                endpoint: fidl::new_empty!(
7382                    fidl::encoding::Optional<
7383                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
7384                    >,
7385                    fidl::encoding::DefaultFuchsiaResourceDialect
7386                ),
7387            }
7388        }
7389
7390        #[inline]
7391        unsafe fn decode(
7392            &mut self,
7393            decoder: &mut fidl::encoding::Decoder<
7394                '_,
7395                fidl::encoding::DefaultFuchsiaResourceDialect,
7396            >,
7397            offset: usize,
7398            _depth: fidl::encoding::Depth,
7399        ) -> fidl::Result<()> {
7400            decoder.debug_check_bounds::<Self>(offset);
7401            // Verify that padding bytes are zero.
7402            fidl::decode!(
7403                fidl::encoding::Optional<
7404                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<EndpointMarker>>,
7405                >,
7406                fidl::encoding::DefaultFuchsiaResourceDialect,
7407                &mut self.endpoint,
7408                decoder,
7409                offset + 0,
7410                _depth
7411            )?;
7412            Ok(())
7413        }
7414    }
7415
7416    impl fidl::encoding::ValueTypeMarker for EndpointManagerListEndpointsResponse {
7417        type Borrowed<'a> = &'a Self;
7418        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7419            value
7420        }
7421    }
7422
7423    unsafe impl fidl::encoding::TypeMarker for EndpointManagerListEndpointsResponse {
7424        type Owned = Self;
7425
7426        #[inline(always)]
7427        fn inline_align(_context: fidl::encoding::Context) -> usize {
7428            8
7429        }
7430
7431        #[inline(always)]
7432        fn inline_size(_context: fidl::encoding::Context) -> usize {
7433            16
7434        }
7435    }
7436
7437    unsafe impl<D: fidl::encoding::ResourceDialect>
7438        fidl::encoding::Encode<EndpointManagerListEndpointsResponse, D>
7439        for &EndpointManagerListEndpointsResponse
7440    {
7441        #[inline]
7442        unsafe fn encode(
7443            self,
7444            encoder: &mut fidl::encoding::Encoder<'_, D>,
7445            offset: usize,
7446            _depth: fidl::encoding::Depth,
7447        ) -> fidl::Result<()> {
7448            encoder.debug_check_bounds::<EndpointManagerListEndpointsResponse>(offset);
7449            // Delegate to tuple encoding.
7450            fidl::encoding::Encode::<EndpointManagerListEndpointsResponse, D>::encode(
7451                (
7452                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>> as fidl::encoding::ValueTypeMarker>::borrow(&self.endp),
7453                ),
7454                encoder, offset, _depth
7455            )
7456        }
7457    }
7458    unsafe impl<
7459            D: fidl::encoding::ResourceDialect,
7460            T0: fidl::encoding::Encode<
7461                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
7462                D,
7463            >,
7464        > fidl::encoding::Encode<EndpointManagerListEndpointsResponse, D> for (T0,)
7465    {
7466        #[inline]
7467        unsafe fn encode(
7468            self,
7469            encoder: &mut fidl::encoding::Encoder<'_, D>,
7470            offset: usize,
7471            depth: fidl::encoding::Depth,
7472        ) -> fidl::Result<()> {
7473            encoder.debug_check_bounds::<EndpointManagerListEndpointsResponse>(offset);
7474            // Zero out padding regions. There's no need to apply masks
7475            // because the unmasked parts will be overwritten by fields.
7476            // Write the fields.
7477            self.0.encode(encoder, offset + 0, depth)?;
7478            Ok(())
7479        }
7480    }
7481
7482    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7483        for EndpointManagerListEndpointsResponse
7484    {
7485        #[inline(always)]
7486        fn new_empty() -> Self {
7487            Self {
7488                endp: fidl::new_empty!(
7489                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
7490                    D
7491                ),
7492            }
7493        }
7494
7495        #[inline]
7496        unsafe fn decode(
7497            &mut self,
7498            decoder: &mut fidl::encoding::Decoder<'_, D>,
7499            offset: usize,
7500            _depth: fidl::encoding::Depth,
7501        ) -> fidl::Result<()> {
7502            decoder.debug_check_bounds::<Self>(offset);
7503            // Verify that padding bytes are zero.
7504            fidl::decode!(
7505                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
7506                D,
7507                &mut self.endp,
7508                decoder,
7509                offset + 0,
7510                _depth
7511            )?;
7512            Ok(())
7513        }
7514    }
7515
7516    impl fidl::encoding::ValueTypeMarker for EndpointSetLinkUpRequest {
7517        type Borrowed<'a> = &'a Self;
7518        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7519            value
7520        }
7521    }
7522
7523    unsafe impl fidl::encoding::TypeMarker for EndpointSetLinkUpRequest {
7524        type Owned = Self;
7525
7526        #[inline(always)]
7527        fn inline_align(_context: fidl::encoding::Context) -> usize {
7528            1
7529        }
7530
7531        #[inline(always)]
7532        fn inline_size(_context: fidl::encoding::Context) -> usize {
7533            1
7534        }
7535    }
7536
7537    unsafe impl<D: fidl::encoding::ResourceDialect>
7538        fidl::encoding::Encode<EndpointSetLinkUpRequest, D> for &EndpointSetLinkUpRequest
7539    {
7540        #[inline]
7541        unsafe fn encode(
7542            self,
7543            encoder: &mut fidl::encoding::Encoder<'_, D>,
7544            offset: usize,
7545            _depth: fidl::encoding::Depth,
7546        ) -> fidl::Result<()> {
7547            encoder.debug_check_bounds::<EndpointSetLinkUpRequest>(offset);
7548            // Delegate to tuple encoding.
7549            fidl::encoding::Encode::<EndpointSetLinkUpRequest, D>::encode(
7550                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.up),),
7551                encoder,
7552                offset,
7553                _depth,
7554            )
7555        }
7556    }
7557    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
7558        fidl::encoding::Encode<EndpointSetLinkUpRequest, D> for (T0,)
7559    {
7560        #[inline]
7561        unsafe fn encode(
7562            self,
7563            encoder: &mut fidl::encoding::Encoder<'_, D>,
7564            offset: usize,
7565            depth: fidl::encoding::Depth,
7566        ) -> fidl::Result<()> {
7567            encoder.debug_check_bounds::<EndpointSetLinkUpRequest>(offset);
7568            // Zero out padding regions. There's no need to apply masks
7569            // because the unmasked parts will be overwritten by fields.
7570            // Write the fields.
7571            self.0.encode(encoder, offset + 0, depth)?;
7572            Ok(())
7573        }
7574    }
7575
7576    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7577        for EndpointSetLinkUpRequest
7578    {
7579        #[inline(always)]
7580        fn new_empty() -> Self {
7581            Self { up: fidl::new_empty!(bool, D) }
7582        }
7583
7584        #[inline]
7585        unsafe fn decode(
7586            &mut self,
7587            decoder: &mut fidl::encoding::Decoder<'_, D>,
7588            offset: usize,
7589            _depth: fidl::encoding::Depth,
7590        ) -> fidl::Result<()> {
7591            decoder.debug_check_bounds::<Self>(offset);
7592            // Verify that padding bytes are zero.
7593            fidl::decode!(bool, D, &mut self.up, decoder, offset + 0, _depth)?;
7594            Ok(())
7595        }
7596    }
7597
7598    impl fidl::encoding::ValueTypeMarker for EndpointSetup {
7599        type Borrowed<'a> = &'a Self;
7600        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7601            value
7602        }
7603    }
7604
7605    unsafe impl fidl::encoding::TypeMarker for EndpointSetup {
7606        type Owned = Self;
7607
7608        #[inline(always)]
7609        fn inline_align(_context: fidl::encoding::Context) -> usize {
7610            8
7611        }
7612
7613        #[inline(always)]
7614        fn inline_size(_context: fidl::encoding::Context) -> usize {
7615            32
7616        }
7617    }
7618
7619    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EndpointSetup, D>
7620        for &EndpointSetup
7621    {
7622        #[inline]
7623        unsafe fn encode(
7624            self,
7625            encoder: &mut fidl::encoding::Encoder<'_, D>,
7626            offset: usize,
7627            _depth: fidl::encoding::Depth,
7628        ) -> fidl::Result<()> {
7629            encoder.debug_check_bounds::<EndpointSetup>(offset);
7630            // Delegate to tuple encoding.
7631            fidl::encoding::Encode::<EndpointSetup, D>::encode(
7632                (
7633                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
7634                    <fidl::encoding::Boxed<EndpointConfig> as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
7635                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.link_up),
7636                ),
7637                encoder, offset, _depth
7638            )
7639        }
7640    }
7641    unsafe impl<
7642            D: fidl::encoding::ResourceDialect,
7643            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
7644            T1: fidl::encoding::Encode<fidl::encoding::Boxed<EndpointConfig>, D>,
7645            T2: fidl::encoding::Encode<bool, D>,
7646        > fidl::encoding::Encode<EndpointSetup, D> for (T0, T1, T2)
7647    {
7648        #[inline]
7649        unsafe fn encode(
7650            self,
7651            encoder: &mut fidl::encoding::Encoder<'_, D>,
7652            offset: usize,
7653            depth: fidl::encoding::Depth,
7654        ) -> fidl::Result<()> {
7655            encoder.debug_check_bounds::<EndpointSetup>(offset);
7656            // Zero out padding regions. There's no need to apply masks
7657            // because the unmasked parts will be overwritten by fields.
7658            unsafe {
7659                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
7660                (ptr as *mut u64).write_unaligned(0);
7661            }
7662            // Write the fields.
7663            self.0.encode(encoder, offset + 0, depth)?;
7664            self.1.encode(encoder, offset + 16, depth)?;
7665            self.2.encode(encoder, offset + 24, depth)?;
7666            Ok(())
7667        }
7668    }
7669
7670    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EndpointSetup {
7671        #[inline(always)]
7672        fn new_empty() -> Self {
7673            Self {
7674                name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
7675                config: fidl::new_empty!(fidl::encoding::Boxed<EndpointConfig>, D),
7676                link_up: fidl::new_empty!(bool, D),
7677            }
7678        }
7679
7680        #[inline]
7681        unsafe fn decode(
7682            &mut self,
7683            decoder: &mut fidl::encoding::Decoder<'_, D>,
7684            offset: usize,
7685            _depth: fidl::encoding::Depth,
7686        ) -> fidl::Result<()> {
7687            decoder.debug_check_bounds::<Self>(offset);
7688            // Verify that padding bytes are zero.
7689            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
7690            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7691            let mask = 0xffffffffffffff00u64;
7692            let maskedval = padval & mask;
7693            if maskedval != 0 {
7694                return Err(fidl::Error::NonZeroPadding {
7695                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
7696                });
7697            }
7698            fidl::decode!(
7699                fidl::encoding::BoundedString<256>,
7700                D,
7701                &mut self.name,
7702                decoder,
7703                offset + 0,
7704                _depth
7705            )?;
7706            fidl::decode!(
7707                fidl::encoding::Boxed<EndpointConfig>,
7708                D,
7709                &mut self.config,
7710                decoder,
7711                offset + 16,
7712                _depth
7713            )?;
7714            fidl::decode!(bool, D, &mut self.link_up, decoder, offset + 24, _depth)?;
7715            Ok(())
7716        }
7717    }
7718
7719    impl fidl::encoding::ValueTypeMarker for FakeEndpointReadResponse {
7720        type Borrowed<'a> = &'a Self;
7721        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7722            value
7723        }
7724    }
7725
7726    unsafe impl fidl::encoding::TypeMarker for FakeEndpointReadResponse {
7727        type Owned = Self;
7728
7729        #[inline(always)]
7730        fn inline_align(_context: fidl::encoding::Context) -> usize {
7731            8
7732        }
7733
7734        #[inline(always)]
7735        fn inline_size(_context: fidl::encoding::Context) -> usize {
7736            24
7737        }
7738    }
7739
7740    unsafe impl<D: fidl::encoding::ResourceDialect>
7741        fidl::encoding::Encode<FakeEndpointReadResponse, D> for &FakeEndpointReadResponse
7742    {
7743        #[inline]
7744        unsafe fn encode(
7745            self,
7746            encoder: &mut fidl::encoding::Encoder<'_, D>,
7747            offset: usize,
7748            _depth: fidl::encoding::Depth,
7749        ) -> fidl::Result<()> {
7750            encoder.debug_check_bounds::<FakeEndpointReadResponse>(offset);
7751            // Delegate to tuple encoding.
7752            fidl::encoding::Encode::<FakeEndpointReadResponse, D>::encode(
7753                (
7754                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
7755                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dropped_frames),
7756                ),
7757                encoder, offset, _depth
7758            )
7759        }
7760    }
7761    unsafe impl<
7762            D: fidl::encoding::ResourceDialect,
7763            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
7764            T1: fidl::encoding::Encode<u64, D>,
7765        > fidl::encoding::Encode<FakeEndpointReadResponse, D> for (T0, T1)
7766    {
7767        #[inline]
7768        unsafe fn encode(
7769            self,
7770            encoder: &mut fidl::encoding::Encoder<'_, D>,
7771            offset: usize,
7772            depth: fidl::encoding::Depth,
7773        ) -> fidl::Result<()> {
7774            encoder.debug_check_bounds::<FakeEndpointReadResponse>(offset);
7775            // Zero out padding regions. There's no need to apply masks
7776            // because the unmasked parts will be overwritten by fields.
7777            // Write the fields.
7778            self.0.encode(encoder, offset + 0, depth)?;
7779            self.1.encode(encoder, offset + 16, depth)?;
7780            Ok(())
7781        }
7782    }
7783
7784    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7785        for FakeEndpointReadResponse
7786    {
7787        #[inline(always)]
7788        fn new_empty() -> Self {
7789            Self {
7790                data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
7791                dropped_frames: fidl::new_empty!(u64, D),
7792            }
7793        }
7794
7795        #[inline]
7796        unsafe fn decode(
7797            &mut self,
7798            decoder: &mut fidl::encoding::Decoder<'_, D>,
7799            offset: usize,
7800            _depth: fidl::encoding::Depth,
7801        ) -> fidl::Result<()> {
7802            decoder.debug_check_bounds::<Self>(offset);
7803            // Verify that padding bytes are zero.
7804            fidl::decode!(
7805                fidl::encoding::UnboundedVector<u8>,
7806                D,
7807                &mut self.data,
7808                decoder,
7809                offset + 0,
7810                _depth
7811            )?;
7812            fidl::decode!(u64, D, &mut self.dropped_frames, decoder, offset + 16, _depth)?;
7813            Ok(())
7814        }
7815    }
7816
7817    impl fidl::encoding::ValueTypeMarker for FakeEndpointWriteRequest {
7818        type Borrowed<'a> = &'a Self;
7819        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7820            value
7821        }
7822    }
7823
7824    unsafe impl fidl::encoding::TypeMarker for FakeEndpointWriteRequest {
7825        type Owned = Self;
7826
7827        #[inline(always)]
7828        fn inline_align(_context: fidl::encoding::Context) -> usize {
7829            8
7830        }
7831
7832        #[inline(always)]
7833        fn inline_size(_context: fidl::encoding::Context) -> usize {
7834            16
7835        }
7836    }
7837
7838    unsafe impl<D: fidl::encoding::ResourceDialect>
7839        fidl::encoding::Encode<FakeEndpointWriteRequest, D> for &FakeEndpointWriteRequest
7840    {
7841        #[inline]
7842        unsafe fn encode(
7843            self,
7844            encoder: &mut fidl::encoding::Encoder<'_, D>,
7845            offset: usize,
7846            _depth: fidl::encoding::Depth,
7847        ) -> fidl::Result<()> {
7848            encoder.debug_check_bounds::<FakeEndpointWriteRequest>(offset);
7849            // Delegate to tuple encoding.
7850            fidl::encoding::Encode::<FakeEndpointWriteRequest, D>::encode(
7851                (<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
7852                    &self.data,
7853                ),),
7854                encoder,
7855                offset,
7856                _depth,
7857            )
7858        }
7859    }
7860    unsafe impl<
7861            D: fidl::encoding::ResourceDialect,
7862            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
7863        > fidl::encoding::Encode<FakeEndpointWriteRequest, D> for (T0,)
7864    {
7865        #[inline]
7866        unsafe fn encode(
7867            self,
7868            encoder: &mut fidl::encoding::Encoder<'_, D>,
7869            offset: usize,
7870            depth: fidl::encoding::Depth,
7871        ) -> fidl::Result<()> {
7872            encoder.debug_check_bounds::<FakeEndpointWriteRequest>(offset);
7873            // Zero out padding regions. There's no need to apply masks
7874            // because the unmasked parts will be overwritten by fields.
7875            // Write the fields.
7876            self.0.encode(encoder, offset + 0, depth)?;
7877            Ok(())
7878        }
7879    }
7880
7881    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7882        for FakeEndpointWriteRequest
7883    {
7884        #[inline(always)]
7885        fn new_empty() -> Self {
7886            Self { data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D) }
7887        }
7888
7889        #[inline]
7890        unsafe fn decode(
7891            &mut self,
7892            decoder: &mut fidl::encoding::Decoder<'_, D>,
7893            offset: usize,
7894            _depth: fidl::encoding::Depth,
7895        ) -> fidl::Result<()> {
7896            decoder.debug_check_bounds::<Self>(offset);
7897            // Verify that padding bytes are zero.
7898            fidl::decode!(
7899                fidl::encoding::UnboundedVector<u8>,
7900                D,
7901                &mut self.data,
7902                decoder,
7903                offset + 0,
7904                _depth
7905            )?;
7906            Ok(())
7907        }
7908    }
7909
7910    impl fidl::encoding::ValueTypeMarker for LatencyConfig {
7911        type Borrowed<'a> = &'a Self;
7912        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7913            value
7914        }
7915    }
7916
7917    unsafe impl fidl::encoding::TypeMarker for LatencyConfig {
7918        type Owned = Self;
7919
7920        #[inline(always)]
7921        fn inline_align(_context: fidl::encoding::Context) -> usize {
7922            8
7923        }
7924
7925        #[inline(always)]
7926        fn inline_size(_context: fidl::encoding::Context) -> usize {
7927            16
7928        }
7929        #[inline(always)]
7930        fn encode_is_copy() -> bool {
7931            true
7932        }
7933
7934        #[inline(always)]
7935        fn decode_is_copy() -> bool {
7936            true
7937        }
7938    }
7939
7940    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LatencyConfig, D>
7941        for &LatencyConfig
7942    {
7943        #[inline]
7944        unsafe fn encode(
7945            self,
7946            encoder: &mut fidl::encoding::Encoder<'_, D>,
7947            offset: usize,
7948            _depth: fidl::encoding::Depth,
7949        ) -> fidl::Result<()> {
7950            encoder.debug_check_bounds::<LatencyConfig>(offset);
7951            unsafe {
7952                // Copy the object into the buffer.
7953                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
7954                (buf_ptr as *mut LatencyConfig)
7955                    .write_unaligned((self as *const LatencyConfig).read());
7956                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
7957                // done second because the memcpy will write garbage to these bytes.
7958            }
7959            Ok(())
7960        }
7961    }
7962    unsafe impl<
7963            D: fidl::encoding::ResourceDialect,
7964            T0: fidl::encoding::Encode<u64, D>,
7965            T1: fidl::encoding::Encode<u64, D>,
7966        > fidl::encoding::Encode<LatencyConfig, D> for (T0, T1)
7967    {
7968        #[inline]
7969        unsafe fn encode(
7970            self,
7971            encoder: &mut fidl::encoding::Encoder<'_, D>,
7972            offset: usize,
7973            depth: fidl::encoding::Depth,
7974        ) -> fidl::Result<()> {
7975            encoder.debug_check_bounds::<LatencyConfig>(offset);
7976            // Zero out padding regions. There's no need to apply masks
7977            // because the unmasked parts will be overwritten by fields.
7978            // Write the fields.
7979            self.0.encode(encoder, offset + 0, depth)?;
7980            self.1.encode(encoder, offset + 8, depth)?;
7981            Ok(())
7982        }
7983    }
7984
7985    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LatencyConfig {
7986        #[inline(always)]
7987        fn new_empty() -> Self {
7988            Self { average: fidl::new_empty!(u64, D), std_dev: fidl::new_empty!(u64, D) }
7989        }
7990
7991        #[inline]
7992        unsafe fn decode(
7993            &mut self,
7994            decoder: &mut fidl::encoding::Decoder<'_, D>,
7995            offset: usize,
7996            _depth: fidl::encoding::Depth,
7997        ) -> fidl::Result<()> {
7998            decoder.debug_check_bounds::<Self>(offset);
7999            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8000            // Verify that padding bytes are zero.
8001            // Copy from the buffer into the object.
8002            unsafe {
8003                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
8004            }
8005            Ok(())
8006        }
8007    }
8008
8009    impl fidl::encoding::ValueTypeMarker for NetworkAttachEndpointRequest {
8010        type Borrowed<'a> = &'a Self;
8011        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8012            value
8013        }
8014    }
8015
8016    unsafe impl fidl::encoding::TypeMarker for NetworkAttachEndpointRequest {
8017        type Owned = Self;
8018
8019        #[inline(always)]
8020        fn inline_align(_context: fidl::encoding::Context) -> usize {
8021            8
8022        }
8023
8024        #[inline(always)]
8025        fn inline_size(_context: fidl::encoding::Context) -> usize {
8026            16
8027        }
8028    }
8029
8030    unsafe impl<D: fidl::encoding::ResourceDialect>
8031        fidl::encoding::Encode<NetworkAttachEndpointRequest, D> for &NetworkAttachEndpointRequest
8032    {
8033        #[inline]
8034        unsafe fn encode(
8035            self,
8036            encoder: &mut fidl::encoding::Encoder<'_, D>,
8037            offset: usize,
8038            _depth: fidl::encoding::Depth,
8039        ) -> fidl::Result<()> {
8040            encoder.debug_check_bounds::<NetworkAttachEndpointRequest>(offset);
8041            // Delegate to tuple encoding.
8042            fidl::encoding::Encode::<NetworkAttachEndpointRequest, D>::encode(
8043                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
8044                    &self.name,
8045                ),),
8046                encoder,
8047                offset,
8048                _depth,
8049            )
8050        }
8051    }
8052    unsafe impl<
8053            D: fidl::encoding::ResourceDialect,
8054            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
8055        > fidl::encoding::Encode<NetworkAttachEndpointRequest, D> for (T0,)
8056    {
8057        #[inline]
8058        unsafe fn encode(
8059            self,
8060            encoder: &mut fidl::encoding::Encoder<'_, D>,
8061            offset: usize,
8062            depth: fidl::encoding::Depth,
8063        ) -> fidl::Result<()> {
8064            encoder.debug_check_bounds::<NetworkAttachEndpointRequest>(offset);
8065            // Zero out padding regions. There's no need to apply masks
8066            // because the unmasked parts will be overwritten by fields.
8067            // Write the fields.
8068            self.0.encode(encoder, offset + 0, depth)?;
8069            Ok(())
8070        }
8071    }
8072
8073    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8074        for NetworkAttachEndpointRequest
8075    {
8076        #[inline(always)]
8077        fn new_empty() -> Self {
8078            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
8079        }
8080
8081        #[inline]
8082        unsafe fn decode(
8083            &mut self,
8084            decoder: &mut fidl::encoding::Decoder<'_, D>,
8085            offset: usize,
8086            _depth: fidl::encoding::Depth,
8087        ) -> fidl::Result<()> {
8088            decoder.debug_check_bounds::<Self>(offset);
8089            // Verify that padding bytes are zero.
8090            fidl::decode!(
8091                fidl::encoding::BoundedString<256>,
8092                D,
8093                &mut self.name,
8094                decoder,
8095                offset + 0,
8096                _depth
8097            )?;
8098            Ok(())
8099        }
8100    }
8101
8102    impl fidl::encoding::ValueTypeMarker for NetworkAttachEndpointResponse {
8103        type Borrowed<'a> = &'a Self;
8104        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8105            value
8106        }
8107    }
8108
8109    unsafe impl fidl::encoding::TypeMarker for NetworkAttachEndpointResponse {
8110        type Owned = Self;
8111
8112        #[inline(always)]
8113        fn inline_align(_context: fidl::encoding::Context) -> usize {
8114            4
8115        }
8116
8117        #[inline(always)]
8118        fn inline_size(_context: fidl::encoding::Context) -> usize {
8119            4
8120        }
8121        #[inline(always)]
8122        fn encode_is_copy() -> bool {
8123            true
8124        }
8125
8126        #[inline(always)]
8127        fn decode_is_copy() -> bool {
8128            true
8129        }
8130    }
8131
8132    unsafe impl<D: fidl::encoding::ResourceDialect>
8133        fidl::encoding::Encode<NetworkAttachEndpointResponse, D>
8134        for &NetworkAttachEndpointResponse
8135    {
8136        #[inline]
8137        unsafe fn encode(
8138            self,
8139            encoder: &mut fidl::encoding::Encoder<'_, D>,
8140            offset: usize,
8141            _depth: fidl::encoding::Depth,
8142        ) -> fidl::Result<()> {
8143            encoder.debug_check_bounds::<NetworkAttachEndpointResponse>(offset);
8144            unsafe {
8145                // Copy the object into the buffer.
8146                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
8147                (buf_ptr as *mut NetworkAttachEndpointResponse)
8148                    .write_unaligned((self as *const NetworkAttachEndpointResponse).read());
8149                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
8150                // done second because the memcpy will write garbage to these bytes.
8151            }
8152            Ok(())
8153        }
8154    }
8155    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
8156        fidl::encoding::Encode<NetworkAttachEndpointResponse, D> for (T0,)
8157    {
8158        #[inline]
8159        unsafe fn encode(
8160            self,
8161            encoder: &mut fidl::encoding::Encoder<'_, D>,
8162            offset: usize,
8163            depth: fidl::encoding::Depth,
8164        ) -> fidl::Result<()> {
8165            encoder.debug_check_bounds::<NetworkAttachEndpointResponse>(offset);
8166            // Zero out padding regions. There's no need to apply masks
8167            // because the unmasked parts will be overwritten by fields.
8168            // Write the fields.
8169            self.0.encode(encoder, offset + 0, depth)?;
8170            Ok(())
8171        }
8172    }
8173
8174    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8175        for NetworkAttachEndpointResponse
8176    {
8177        #[inline(always)]
8178        fn new_empty() -> Self {
8179            Self { status: fidl::new_empty!(i32, D) }
8180        }
8181
8182        #[inline]
8183        unsafe fn decode(
8184            &mut self,
8185            decoder: &mut fidl::encoding::Decoder<'_, D>,
8186            offset: usize,
8187            _depth: fidl::encoding::Depth,
8188        ) -> fidl::Result<()> {
8189            decoder.debug_check_bounds::<Self>(offset);
8190            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8191            // Verify that padding bytes are zero.
8192            // Copy from the buffer into the object.
8193            unsafe {
8194                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
8195            }
8196            Ok(())
8197        }
8198    }
8199
8200    impl fidl::encoding::ResourceTypeMarker for NetworkContextCloneRequest {
8201        type Borrowed<'a> = &'a mut Self;
8202        fn take_or_borrow<'a>(
8203            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8204        ) -> Self::Borrowed<'a> {
8205            value
8206        }
8207    }
8208
8209    unsafe impl fidl::encoding::TypeMarker for NetworkContextCloneRequest {
8210        type Owned = Self;
8211
8212        #[inline(always)]
8213        fn inline_align(_context: fidl::encoding::Context) -> usize {
8214            4
8215        }
8216
8217        #[inline(always)]
8218        fn inline_size(_context: fidl::encoding::Context) -> usize {
8219            4
8220        }
8221    }
8222
8223    unsafe impl
8224        fidl::encoding::Encode<
8225            NetworkContextCloneRequest,
8226            fidl::encoding::DefaultFuchsiaResourceDialect,
8227        > for &mut NetworkContextCloneRequest
8228    {
8229        #[inline]
8230        unsafe fn encode(
8231            self,
8232            encoder: &mut fidl::encoding::Encoder<
8233                '_,
8234                fidl::encoding::DefaultFuchsiaResourceDialect,
8235            >,
8236            offset: usize,
8237            _depth: fidl::encoding::Depth,
8238        ) -> fidl::Result<()> {
8239            encoder.debug_check_bounds::<NetworkContextCloneRequest>(offset);
8240            // Delegate to tuple encoding.
8241            fidl::encoding::Encode::<NetworkContextCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8242                (
8243                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkContextMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.network_context),
8244                ),
8245                encoder, offset, _depth
8246            )
8247        }
8248    }
8249    unsafe impl<
8250            T0: fidl::encoding::Encode<
8251                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkContextMarker>>,
8252                fidl::encoding::DefaultFuchsiaResourceDialect,
8253            >,
8254        >
8255        fidl::encoding::Encode<
8256            NetworkContextCloneRequest,
8257            fidl::encoding::DefaultFuchsiaResourceDialect,
8258        > for (T0,)
8259    {
8260        #[inline]
8261        unsafe fn encode(
8262            self,
8263            encoder: &mut fidl::encoding::Encoder<
8264                '_,
8265                fidl::encoding::DefaultFuchsiaResourceDialect,
8266            >,
8267            offset: usize,
8268            depth: fidl::encoding::Depth,
8269        ) -> fidl::Result<()> {
8270            encoder.debug_check_bounds::<NetworkContextCloneRequest>(offset);
8271            // Zero out padding regions. There's no need to apply masks
8272            // because the unmasked parts will be overwritten by fields.
8273            // Write the fields.
8274            self.0.encode(encoder, offset + 0, depth)?;
8275            Ok(())
8276        }
8277    }
8278
8279    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8280        for NetworkContextCloneRequest
8281    {
8282        #[inline(always)]
8283        fn new_empty() -> Self {
8284            Self {
8285                network_context: fidl::new_empty!(
8286                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkContextMarker>>,
8287                    fidl::encoding::DefaultFuchsiaResourceDialect
8288                ),
8289            }
8290        }
8291
8292        #[inline]
8293        unsafe fn decode(
8294            &mut self,
8295            decoder: &mut fidl::encoding::Decoder<
8296                '_,
8297                fidl::encoding::DefaultFuchsiaResourceDialect,
8298            >,
8299            offset: usize,
8300            _depth: fidl::encoding::Depth,
8301        ) -> fidl::Result<()> {
8302            decoder.debug_check_bounds::<Self>(offset);
8303            // Verify that padding bytes are zero.
8304            fidl::decode!(
8305                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkContextMarker>>,
8306                fidl::encoding::DefaultFuchsiaResourceDialect,
8307                &mut self.network_context,
8308                decoder,
8309                offset + 0,
8310                _depth
8311            )?;
8312            Ok(())
8313        }
8314    }
8315
8316    impl fidl::encoding::ResourceTypeMarker for NetworkContextGetEndpointManagerRequest {
8317        type Borrowed<'a> = &'a mut Self;
8318        fn take_or_borrow<'a>(
8319            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8320        ) -> Self::Borrowed<'a> {
8321            value
8322        }
8323    }
8324
8325    unsafe impl fidl::encoding::TypeMarker for NetworkContextGetEndpointManagerRequest {
8326        type Owned = Self;
8327
8328        #[inline(always)]
8329        fn inline_align(_context: fidl::encoding::Context) -> usize {
8330            4
8331        }
8332
8333        #[inline(always)]
8334        fn inline_size(_context: fidl::encoding::Context) -> usize {
8335            4
8336        }
8337    }
8338
8339    unsafe impl
8340        fidl::encoding::Encode<
8341            NetworkContextGetEndpointManagerRequest,
8342            fidl::encoding::DefaultFuchsiaResourceDialect,
8343        > for &mut NetworkContextGetEndpointManagerRequest
8344    {
8345        #[inline]
8346        unsafe fn encode(
8347            self,
8348            encoder: &mut fidl::encoding::Encoder<
8349                '_,
8350                fidl::encoding::DefaultFuchsiaResourceDialect,
8351            >,
8352            offset: usize,
8353            _depth: fidl::encoding::Depth,
8354        ) -> fidl::Result<()> {
8355            encoder.debug_check_bounds::<NetworkContextGetEndpointManagerRequest>(offset);
8356            // Delegate to tuple encoding.
8357            fidl::encoding::Encode::<NetworkContextGetEndpointManagerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8358                (
8359                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EndpointManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endp_manager),
8360                ),
8361                encoder, offset, _depth
8362            )
8363        }
8364    }
8365    unsafe impl<
8366            T0: fidl::encoding::Encode<
8367                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EndpointManagerMarker>>,
8368                fidl::encoding::DefaultFuchsiaResourceDialect,
8369            >,
8370        >
8371        fidl::encoding::Encode<
8372            NetworkContextGetEndpointManagerRequest,
8373            fidl::encoding::DefaultFuchsiaResourceDialect,
8374        > for (T0,)
8375    {
8376        #[inline]
8377        unsafe fn encode(
8378            self,
8379            encoder: &mut fidl::encoding::Encoder<
8380                '_,
8381                fidl::encoding::DefaultFuchsiaResourceDialect,
8382            >,
8383            offset: usize,
8384            depth: fidl::encoding::Depth,
8385        ) -> fidl::Result<()> {
8386            encoder.debug_check_bounds::<NetworkContextGetEndpointManagerRequest>(offset);
8387            // Zero out padding regions. There's no need to apply masks
8388            // because the unmasked parts will be overwritten by fields.
8389            // Write the fields.
8390            self.0.encode(encoder, offset + 0, depth)?;
8391            Ok(())
8392        }
8393    }
8394
8395    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8396        for NetworkContextGetEndpointManagerRequest
8397    {
8398        #[inline(always)]
8399        fn new_empty() -> Self {
8400            Self {
8401                endp_manager: fidl::new_empty!(
8402                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EndpointManagerMarker>>,
8403                    fidl::encoding::DefaultFuchsiaResourceDialect
8404                ),
8405            }
8406        }
8407
8408        #[inline]
8409        unsafe fn decode(
8410            &mut self,
8411            decoder: &mut fidl::encoding::Decoder<
8412                '_,
8413                fidl::encoding::DefaultFuchsiaResourceDialect,
8414            >,
8415            offset: usize,
8416            _depth: fidl::encoding::Depth,
8417        ) -> fidl::Result<()> {
8418            decoder.debug_check_bounds::<Self>(offset);
8419            // Verify that padding bytes are zero.
8420            fidl::decode!(
8421                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EndpointManagerMarker>>,
8422                fidl::encoding::DefaultFuchsiaResourceDialect,
8423                &mut self.endp_manager,
8424                decoder,
8425                offset + 0,
8426                _depth
8427            )?;
8428            Ok(())
8429        }
8430    }
8431
8432    impl fidl::encoding::ResourceTypeMarker for NetworkContextGetNetworkManagerRequest {
8433        type Borrowed<'a> = &'a mut Self;
8434        fn take_or_borrow<'a>(
8435            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8436        ) -> Self::Borrowed<'a> {
8437            value
8438        }
8439    }
8440
8441    unsafe impl fidl::encoding::TypeMarker for NetworkContextGetNetworkManagerRequest {
8442        type Owned = Self;
8443
8444        #[inline(always)]
8445        fn inline_align(_context: fidl::encoding::Context) -> usize {
8446            4
8447        }
8448
8449        #[inline(always)]
8450        fn inline_size(_context: fidl::encoding::Context) -> usize {
8451            4
8452        }
8453    }
8454
8455    unsafe impl
8456        fidl::encoding::Encode<
8457            NetworkContextGetNetworkManagerRequest,
8458            fidl::encoding::DefaultFuchsiaResourceDialect,
8459        > for &mut NetworkContextGetNetworkManagerRequest
8460    {
8461        #[inline]
8462        unsafe fn encode(
8463            self,
8464            encoder: &mut fidl::encoding::Encoder<
8465                '_,
8466                fidl::encoding::DefaultFuchsiaResourceDialect,
8467            >,
8468            offset: usize,
8469            _depth: fidl::encoding::Depth,
8470        ) -> fidl::Result<()> {
8471            encoder.debug_check_bounds::<NetworkContextGetNetworkManagerRequest>(offset);
8472            // Delegate to tuple encoding.
8473            fidl::encoding::Encode::<NetworkContextGetNetworkManagerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8474                (
8475                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.net_manager),
8476                ),
8477                encoder, offset, _depth
8478            )
8479        }
8480    }
8481    unsafe impl<
8482            T0: fidl::encoding::Encode<
8483                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkManagerMarker>>,
8484                fidl::encoding::DefaultFuchsiaResourceDialect,
8485            >,
8486        >
8487        fidl::encoding::Encode<
8488            NetworkContextGetNetworkManagerRequest,
8489            fidl::encoding::DefaultFuchsiaResourceDialect,
8490        > for (T0,)
8491    {
8492        #[inline]
8493        unsafe fn encode(
8494            self,
8495            encoder: &mut fidl::encoding::Encoder<
8496                '_,
8497                fidl::encoding::DefaultFuchsiaResourceDialect,
8498            >,
8499            offset: usize,
8500            depth: fidl::encoding::Depth,
8501        ) -> fidl::Result<()> {
8502            encoder.debug_check_bounds::<NetworkContextGetNetworkManagerRequest>(offset);
8503            // Zero out padding regions. There's no need to apply masks
8504            // because the unmasked parts will be overwritten by fields.
8505            // Write the fields.
8506            self.0.encode(encoder, offset + 0, depth)?;
8507            Ok(())
8508        }
8509    }
8510
8511    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8512        for NetworkContextGetNetworkManagerRequest
8513    {
8514        #[inline(always)]
8515        fn new_empty() -> Self {
8516            Self {
8517                net_manager: fidl::new_empty!(
8518                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkManagerMarker>>,
8519                    fidl::encoding::DefaultFuchsiaResourceDialect
8520                ),
8521            }
8522        }
8523
8524        #[inline]
8525        unsafe fn decode(
8526            &mut self,
8527            decoder: &mut fidl::encoding::Decoder<
8528                '_,
8529                fidl::encoding::DefaultFuchsiaResourceDialect,
8530            >,
8531            offset: usize,
8532            _depth: fidl::encoding::Depth,
8533        ) -> fidl::Result<()> {
8534            decoder.debug_check_bounds::<Self>(offset);
8535            // Verify that padding bytes are zero.
8536            fidl::decode!(
8537                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkManagerMarker>>,
8538                fidl::encoding::DefaultFuchsiaResourceDialect,
8539                &mut self.net_manager,
8540                decoder,
8541                offset + 0,
8542                _depth
8543            )?;
8544            Ok(())
8545        }
8546    }
8547
8548    impl fidl::encoding::ValueTypeMarker for NetworkContextSetupRequest {
8549        type Borrowed<'a> = &'a Self;
8550        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8551            value
8552        }
8553    }
8554
8555    unsafe impl fidl::encoding::TypeMarker for NetworkContextSetupRequest {
8556        type Owned = Self;
8557
8558        #[inline(always)]
8559        fn inline_align(_context: fidl::encoding::Context) -> usize {
8560            8
8561        }
8562
8563        #[inline(always)]
8564        fn inline_size(_context: fidl::encoding::Context) -> usize {
8565            16
8566        }
8567    }
8568
8569    unsafe impl<D: fidl::encoding::ResourceDialect>
8570        fidl::encoding::Encode<NetworkContextSetupRequest, D> for &NetworkContextSetupRequest
8571    {
8572        #[inline]
8573        unsafe fn encode(
8574            self,
8575            encoder: &mut fidl::encoding::Encoder<'_, D>,
8576            offset: usize,
8577            _depth: fidl::encoding::Depth,
8578        ) -> fidl::Result<()> {
8579            encoder.debug_check_bounds::<NetworkContextSetupRequest>(offset);
8580            // Delegate to tuple encoding.
8581            fidl::encoding::Encode::<NetworkContextSetupRequest, D>::encode(
8582                (
8583                    <fidl::encoding::UnboundedVector<NetworkSetup> as fidl::encoding::ValueTypeMarker>::borrow(&self.networks),
8584                ),
8585                encoder, offset, _depth
8586            )
8587        }
8588    }
8589    unsafe impl<
8590            D: fidl::encoding::ResourceDialect,
8591            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<NetworkSetup>, D>,
8592        > fidl::encoding::Encode<NetworkContextSetupRequest, D> for (T0,)
8593    {
8594        #[inline]
8595        unsafe fn encode(
8596            self,
8597            encoder: &mut fidl::encoding::Encoder<'_, D>,
8598            offset: usize,
8599            depth: fidl::encoding::Depth,
8600        ) -> fidl::Result<()> {
8601            encoder.debug_check_bounds::<NetworkContextSetupRequest>(offset);
8602            // Zero out padding regions. There's no need to apply masks
8603            // because the unmasked parts will be overwritten by fields.
8604            // Write the fields.
8605            self.0.encode(encoder, offset + 0, depth)?;
8606            Ok(())
8607        }
8608    }
8609
8610    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8611        for NetworkContextSetupRequest
8612    {
8613        #[inline(always)]
8614        fn new_empty() -> Self {
8615            Self { networks: fidl::new_empty!(fidl::encoding::UnboundedVector<NetworkSetup>, D) }
8616        }
8617
8618        #[inline]
8619        unsafe fn decode(
8620            &mut self,
8621            decoder: &mut fidl::encoding::Decoder<'_, D>,
8622            offset: usize,
8623            _depth: fidl::encoding::Depth,
8624        ) -> fidl::Result<()> {
8625            decoder.debug_check_bounds::<Self>(offset);
8626            // Verify that padding bytes are zero.
8627            fidl::decode!(
8628                fidl::encoding::UnboundedVector<NetworkSetup>,
8629                D,
8630                &mut self.networks,
8631                decoder,
8632                offset + 0,
8633                _depth
8634            )?;
8635            Ok(())
8636        }
8637    }
8638
8639    impl fidl::encoding::ResourceTypeMarker for NetworkContextSetupResponse {
8640        type Borrowed<'a> = &'a mut Self;
8641        fn take_or_borrow<'a>(
8642            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8643        ) -> Self::Borrowed<'a> {
8644            value
8645        }
8646    }
8647
8648    unsafe impl fidl::encoding::TypeMarker for NetworkContextSetupResponse {
8649        type Owned = Self;
8650
8651        #[inline(always)]
8652        fn inline_align(_context: fidl::encoding::Context) -> usize {
8653            4
8654        }
8655
8656        #[inline(always)]
8657        fn inline_size(_context: fidl::encoding::Context) -> usize {
8658            8
8659        }
8660    }
8661
8662    unsafe impl
8663        fidl::encoding::Encode<
8664            NetworkContextSetupResponse,
8665            fidl::encoding::DefaultFuchsiaResourceDialect,
8666        > for &mut NetworkContextSetupResponse
8667    {
8668        #[inline]
8669        unsafe fn encode(
8670            self,
8671            encoder: &mut fidl::encoding::Encoder<
8672                '_,
8673                fidl::encoding::DefaultFuchsiaResourceDialect,
8674            >,
8675            offset: usize,
8676            _depth: fidl::encoding::Depth,
8677        ) -> fidl::Result<()> {
8678            encoder.debug_check_bounds::<NetworkContextSetupResponse>(offset);
8679            // Delegate to tuple encoding.
8680            fidl::encoding::Encode::<
8681                NetworkContextSetupResponse,
8682                fidl::encoding::DefaultFuchsiaResourceDialect,
8683            >::encode(
8684                (
8685                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
8686                    <fidl::encoding::Optional<
8687                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
8688                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8689                        &mut self.setup_handle,
8690                    ),
8691                ),
8692                encoder,
8693                offset,
8694                _depth,
8695            )
8696        }
8697    }
8698    unsafe impl<
8699            T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
8700            T1: fidl::encoding::Encode<
8701                fidl::encoding::Optional<
8702                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
8703                >,
8704                fidl::encoding::DefaultFuchsiaResourceDialect,
8705            >,
8706        >
8707        fidl::encoding::Encode<
8708            NetworkContextSetupResponse,
8709            fidl::encoding::DefaultFuchsiaResourceDialect,
8710        > for (T0, T1)
8711    {
8712        #[inline]
8713        unsafe fn encode(
8714            self,
8715            encoder: &mut fidl::encoding::Encoder<
8716                '_,
8717                fidl::encoding::DefaultFuchsiaResourceDialect,
8718            >,
8719            offset: usize,
8720            depth: fidl::encoding::Depth,
8721        ) -> fidl::Result<()> {
8722            encoder.debug_check_bounds::<NetworkContextSetupResponse>(offset);
8723            // Zero out padding regions. There's no need to apply masks
8724            // because the unmasked parts will be overwritten by fields.
8725            // Write the fields.
8726            self.0.encode(encoder, offset + 0, depth)?;
8727            self.1.encode(encoder, offset + 4, depth)?;
8728            Ok(())
8729        }
8730    }
8731
8732    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8733        for NetworkContextSetupResponse
8734    {
8735        #[inline(always)]
8736        fn new_empty() -> Self {
8737            Self {
8738                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
8739                setup_handle: fidl::new_empty!(
8740                    fidl::encoding::Optional<
8741                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
8742                    >,
8743                    fidl::encoding::DefaultFuchsiaResourceDialect
8744                ),
8745            }
8746        }
8747
8748        #[inline]
8749        unsafe fn decode(
8750            &mut self,
8751            decoder: &mut fidl::encoding::Decoder<
8752                '_,
8753                fidl::encoding::DefaultFuchsiaResourceDialect,
8754            >,
8755            offset: usize,
8756            _depth: fidl::encoding::Depth,
8757        ) -> fidl::Result<()> {
8758            decoder.debug_check_bounds::<Self>(offset);
8759            // Verify that padding bytes are zero.
8760            fidl::decode!(
8761                i32,
8762                fidl::encoding::DefaultFuchsiaResourceDialect,
8763                &mut self.status,
8764                decoder,
8765                offset + 0,
8766                _depth
8767            )?;
8768            fidl::decode!(
8769                fidl::encoding::Optional<
8770                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SetupHandleMarker>>,
8771                >,
8772                fidl::encoding::DefaultFuchsiaResourceDialect,
8773                &mut self.setup_handle,
8774                decoder,
8775                offset + 4,
8776                _depth
8777            )?;
8778            Ok(())
8779        }
8780    }
8781
8782    impl fidl::encoding::ResourceTypeMarker for NetworkCreateFakeEndpointRequest {
8783        type Borrowed<'a> = &'a mut Self;
8784        fn take_or_borrow<'a>(
8785            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8786        ) -> Self::Borrowed<'a> {
8787            value
8788        }
8789    }
8790
8791    unsafe impl fidl::encoding::TypeMarker for NetworkCreateFakeEndpointRequest {
8792        type Owned = Self;
8793
8794        #[inline(always)]
8795        fn inline_align(_context: fidl::encoding::Context) -> usize {
8796            4
8797        }
8798
8799        #[inline(always)]
8800        fn inline_size(_context: fidl::encoding::Context) -> usize {
8801            4
8802        }
8803    }
8804
8805    unsafe impl
8806        fidl::encoding::Encode<
8807            NetworkCreateFakeEndpointRequest,
8808            fidl::encoding::DefaultFuchsiaResourceDialect,
8809        > for &mut NetworkCreateFakeEndpointRequest
8810    {
8811        #[inline]
8812        unsafe fn encode(
8813            self,
8814            encoder: &mut fidl::encoding::Encoder<
8815                '_,
8816                fidl::encoding::DefaultFuchsiaResourceDialect,
8817            >,
8818            offset: usize,
8819            _depth: fidl::encoding::Depth,
8820        ) -> fidl::Result<()> {
8821            encoder.debug_check_bounds::<NetworkCreateFakeEndpointRequest>(offset);
8822            // Delegate to tuple encoding.
8823            fidl::encoding::Encode::<NetworkCreateFakeEndpointRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8824                (
8825                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FakeEndpointMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ep),
8826                ),
8827                encoder, offset, _depth
8828            )
8829        }
8830    }
8831    unsafe impl<
8832            T0: fidl::encoding::Encode<
8833                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FakeEndpointMarker>>,
8834                fidl::encoding::DefaultFuchsiaResourceDialect,
8835            >,
8836        >
8837        fidl::encoding::Encode<
8838            NetworkCreateFakeEndpointRequest,
8839            fidl::encoding::DefaultFuchsiaResourceDialect,
8840        > for (T0,)
8841    {
8842        #[inline]
8843        unsafe fn encode(
8844            self,
8845            encoder: &mut fidl::encoding::Encoder<
8846                '_,
8847                fidl::encoding::DefaultFuchsiaResourceDialect,
8848            >,
8849            offset: usize,
8850            depth: fidl::encoding::Depth,
8851        ) -> fidl::Result<()> {
8852            encoder.debug_check_bounds::<NetworkCreateFakeEndpointRequest>(offset);
8853            // Zero out padding regions. There's no need to apply masks
8854            // because the unmasked parts will be overwritten by fields.
8855            // Write the fields.
8856            self.0.encode(encoder, offset + 0, depth)?;
8857            Ok(())
8858        }
8859    }
8860
8861    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8862        for NetworkCreateFakeEndpointRequest
8863    {
8864        #[inline(always)]
8865        fn new_empty() -> Self {
8866            Self {
8867                ep: fidl::new_empty!(
8868                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FakeEndpointMarker>>,
8869                    fidl::encoding::DefaultFuchsiaResourceDialect
8870                ),
8871            }
8872        }
8873
8874        #[inline]
8875        unsafe fn decode(
8876            &mut self,
8877            decoder: &mut fidl::encoding::Decoder<
8878                '_,
8879                fidl::encoding::DefaultFuchsiaResourceDialect,
8880            >,
8881            offset: usize,
8882            _depth: fidl::encoding::Depth,
8883        ) -> fidl::Result<()> {
8884            decoder.debug_check_bounds::<Self>(offset);
8885            // Verify that padding bytes are zero.
8886            fidl::decode!(
8887                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FakeEndpointMarker>>,
8888                fidl::encoding::DefaultFuchsiaResourceDialect,
8889                &mut self.ep,
8890                decoder,
8891                offset + 0,
8892                _depth
8893            )?;
8894            Ok(())
8895        }
8896    }
8897
8898    impl fidl::encoding::ValueTypeMarker for NetworkGetConfigResponse {
8899        type Borrowed<'a> = &'a Self;
8900        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8901            value
8902        }
8903    }
8904
8905    unsafe impl fidl::encoding::TypeMarker for NetworkGetConfigResponse {
8906        type Owned = Self;
8907
8908        #[inline(always)]
8909        fn inline_align(_context: fidl::encoding::Context) -> usize {
8910            8
8911        }
8912
8913        #[inline(always)]
8914        fn inline_size(_context: fidl::encoding::Context) -> usize {
8915            16
8916        }
8917    }
8918
8919    unsafe impl<D: fidl::encoding::ResourceDialect>
8920        fidl::encoding::Encode<NetworkGetConfigResponse, D> for &NetworkGetConfigResponse
8921    {
8922        #[inline]
8923        unsafe fn encode(
8924            self,
8925            encoder: &mut fidl::encoding::Encoder<'_, D>,
8926            offset: usize,
8927            _depth: fidl::encoding::Depth,
8928        ) -> fidl::Result<()> {
8929            encoder.debug_check_bounds::<NetworkGetConfigResponse>(offset);
8930            // Delegate to tuple encoding.
8931            fidl::encoding::Encode::<NetworkGetConfigResponse, D>::encode(
8932                (<NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
8933                encoder,
8934                offset,
8935                _depth,
8936            )
8937        }
8938    }
8939    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NetworkConfig, D>>
8940        fidl::encoding::Encode<NetworkGetConfigResponse, D> for (T0,)
8941    {
8942        #[inline]
8943        unsafe fn encode(
8944            self,
8945            encoder: &mut fidl::encoding::Encoder<'_, D>,
8946            offset: usize,
8947            depth: fidl::encoding::Depth,
8948        ) -> fidl::Result<()> {
8949            encoder.debug_check_bounds::<NetworkGetConfigResponse>(offset);
8950            // Zero out padding regions. There's no need to apply masks
8951            // because the unmasked parts will be overwritten by fields.
8952            // Write the fields.
8953            self.0.encode(encoder, offset + 0, depth)?;
8954            Ok(())
8955        }
8956    }
8957
8958    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8959        for NetworkGetConfigResponse
8960    {
8961        #[inline(always)]
8962        fn new_empty() -> Self {
8963            Self { config: fidl::new_empty!(NetworkConfig, D) }
8964        }
8965
8966        #[inline]
8967        unsafe fn decode(
8968            &mut self,
8969            decoder: &mut fidl::encoding::Decoder<'_, D>,
8970            offset: usize,
8971            _depth: fidl::encoding::Depth,
8972        ) -> fidl::Result<()> {
8973            decoder.debug_check_bounds::<Self>(offset);
8974            // Verify that padding bytes are zero.
8975            fidl::decode!(NetworkConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
8976            Ok(())
8977        }
8978    }
8979
8980    impl fidl::encoding::ValueTypeMarker for NetworkGetNameResponse {
8981        type Borrowed<'a> = &'a Self;
8982        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8983            value
8984        }
8985    }
8986
8987    unsafe impl fidl::encoding::TypeMarker for NetworkGetNameResponse {
8988        type Owned = Self;
8989
8990        #[inline(always)]
8991        fn inline_align(_context: fidl::encoding::Context) -> usize {
8992            8
8993        }
8994
8995        #[inline(always)]
8996        fn inline_size(_context: fidl::encoding::Context) -> usize {
8997            16
8998        }
8999    }
9000
9001    unsafe impl<D: fidl::encoding::ResourceDialect>
9002        fidl::encoding::Encode<NetworkGetNameResponse, D> for &NetworkGetNameResponse
9003    {
9004        #[inline]
9005        unsafe fn encode(
9006            self,
9007            encoder: &mut fidl::encoding::Encoder<'_, D>,
9008            offset: usize,
9009            _depth: fidl::encoding::Depth,
9010        ) -> fidl::Result<()> {
9011            encoder.debug_check_bounds::<NetworkGetNameResponse>(offset);
9012            // Delegate to tuple encoding.
9013            fidl::encoding::Encode::<NetworkGetNameResponse, D>::encode(
9014                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
9015                    &self.name,
9016                ),),
9017                encoder,
9018                offset,
9019                _depth,
9020            )
9021        }
9022    }
9023    unsafe impl<
9024            D: fidl::encoding::ResourceDialect,
9025            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
9026        > fidl::encoding::Encode<NetworkGetNameResponse, D> for (T0,)
9027    {
9028        #[inline]
9029        unsafe fn encode(
9030            self,
9031            encoder: &mut fidl::encoding::Encoder<'_, D>,
9032            offset: usize,
9033            depth: fidl::encoding::Depth,
9034        ) -> fidl::Result<()> {
9035            encoder.debug_check_bounds::<NetworkGetNameResponse>(offset);
9036            // Zero out padding regions. There's no need to apply masks
9037            // because the unmasked parts will be overwritten by fields.
9038            // Write the fields.
9039            self.0.encode(encoder, offset + 0, depth)?;
9040            Ok(())
9041        }
9042    }
9043
9044    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9045        for NetworkGetNameResponse
9046    {
9047        #[inline(always)]
9048        fn new_empty() -> Self {
9049            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
9050        }
9051
9052        #[inline]
9053        unsafe fn decode(
9054            &mut self,
9055            decoder: &mut fidl::encoding::Decoder<'_, D>,
9056            offset: usize,
9057            _depth: fidl::encoding::Depth,
9058        ) -> fidl::Result<()> {
9059            decoder.debug_check_bounds::<Self>(offset);
9060            // Verify that padding bytes are zero.
9061            fidl::decode!(
9062                fidl::encoding::BoundedString<256>,
9063                D,
9064                &mut self.name,
9065                decoder,
9066                offset + 0,
9067                _depth
9068            )?;
9069            Ok(())
9070        }
9071    }
9072
9073    impl fidl::encoding::ValueTypeMarker for NetworkManagerCreateNetworkRequest {
9074        type Borrowed<'a> = &'a Self;
9075        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9076            value
9077        }
9078    }
9079
9080    unsafe impl fidl::encoding::TypeMarker for NetworkManagerCreateNetworkRequest {
9081        type Owned = Self;
9082
9083        #[inline(always)]
9084        fn inline_align(_context: fidl::encoding::Context) -> usize {
9085            8
9086        }
9087
9088        #[inline(always)]
9089        fn inline_size(_context: fidl::encoding::Context) -> usize {
9090            32
9091        }
9092    }
9093
9094    unsafe impl<D: fidl::encoding::ResourceDialect>
9095        fidl::encoding::Encode<NetworkManagerCreateNetworkRequest, D>
9096        for &NetworkManagerCreateNetworkRequest
9097    {
9098        #[inline]
9099        unsafe fn encode(
9100            self,
9101            encoder: &mut fidl::encoding::Encoder<'_, D>,
9102            offset: usize,
9103            _depth: fidl::encoding::Depth,
9104        ) -> fidl::Result<()> {
9105            encoder.debug_check_bounds::<NetworkManagerCreateNetworkRequest>(offset);
9106            // Delegate to tuple encoding.
9107            fidl::encoding::Encode::<NetworkManagerCreateNetworkRequest, D>::encode(
9108                (
9109                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
9110                        &self.name,
9111                    ),
9112                    <NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
9113                ),
9114                encoder,
9115                offset,
9116                _depth,
9117            )
9118        }
9119    }
9120    unsafe impl<
9121            D: fidl::encoding::ResourceDialect,
9122            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
9123            T1: fidl::encoding::Encode<NetworkConfig, D>,
9124        > fidl::encoding::Encode<NetworkManagerCreateNetworkRequest, D> for (T0, T1)
9125    {
9126        #[inline]
9127        unsafe fn encode(
9128            self,
9129            encoder: &mut fidl::encoding::Encoder<'_, D>,
9130            offset: usize,
9131            depth: fidl::encoding::Depth,
9132        ) -> fidl::Result<()> {
9133            encoder.debug_check_bounds::<NetworkManagerCreateNetworkRequest>(offset);
9134            // Zero out padding regions. There's no need to apply masks
9135            // because the unmasked parts will be overwritten by fields.
9136            // Write the fields.
9137            self.0.encode(encoder, offset + 0, depth)?;
9138            self.1.encode(encoder, offset + 16, depth)?;
9139            Ok(())
9140        }
9141    }
9142
9143    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9144        for NetworkManagerCreateNetworkRequest
9145    {
9146        #[inline(always)]
9147        fn new_empty() -> Self {
9148            Self {
9149                name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
9150                config: fidl::new_empty!(NetworkConfig, D),
9151            }
9152        }
9153
9154        #[inline]
9155        unsafe fn decode(
9156            &mut self,
9157            decoder: &mut fidl::encoding::Decoder<'_, D>,
9158            offset: usize,
9159            _depth: fidl::encoding::Depth,
9160        ) -> fidl::Result<()> {
9161            decoder.debug_check_bounds::<Self>(offset);
9162            // Verify that padding bytes are zero.
9163            fidl::decode!(
9164                fidl::encoding::BoundedString<256>,
9165                D,
9166                &mut self.name,
9167                decoder,
9168                offset + 0,
9169                _depth
9170            )?;
9171            fidl::decode!(NetworkConfig, D, &mut self.config, decoder, offset + 16, _depth)?;
9172            Ok(())
9173        }
9174    }
9175
9176    impl fidl::encoding::ResourceTypeMarker for NetworkManagerCreateNetworkResponse {
9177        type Borrowed<'a> = &'a mut Self;
9178        fn take_or_borrow<'a>(
9179            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9180        ) -> Self::Borrowed<'a> {
9181            value
9182        }
9183    }
9184
9185    unsafe impl fidl::encoding::TypeMarker for NetworkManagerCreateNetworkResponse {
9186        type Owned = Self;
9187
9188        #[inline(always)]
9189        fn inline_align(_context: fidl::encoding::Context) -> usize {
9190            4
9191        }
9192
9193        #[inline(always)]
9194        fn inline_size(_context: fidl::encoding::Context) -> usize {
9195            8
9196        }
9197    }
9198
9199    unsafe impl
9200        fidl::encoding::Encode<
9201            NetworkManagerCreateNetworkResponse,
9202            fidl::encoding::DefaultFuchsiaResourceDialect,
9203        > for &mut NetworkManagerCreateNetworkResponse
9204    {
9205        #[inline]
9206        unsafe fn encode(
9207            self,
9208            encoder: &mut fidl::encoding::Encoder<
9209                '_,
9210                fidl::encoding::DefaultFuchsiaResourceDialect,
9211            >,
9212            offset: usize,
9213            _depth: fidl::encoding::Depth,
9214        ) -> fidl::Result<()> {
9215            encoder.debug_check_bounds::<NetworkManagerCreateNetworkResponse>(offset);
9216            // Delegate to tuple encoding.
9217            fidl::encoding::Encode::<
9218                NetworkManagerCreateNetworkResponse,
9219                fidl::encoding::DefaultFuchsiaResourceDialect,
9220            >::encode(
9221                (
9222                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
9223                    <fidl::encoding::Optional<
9224                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
9225                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9226                        &mut self.net
9227                    ),
9228                ),
9229                encoder,
9230                offset,
9231                _depth,
9232            )
9233        }
9234    }
9235    unsafe impl<
9236            T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9237            T1: fidl::encoding::Encode<
9238                fidl::encoding::Optional<
9239                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
9240                >,
9241                fidl::encoding::DefaultFuchsiaResourceDialect,
9242            >,
9243        >
9244        fidl::encoding::Encode<
9245            NetworkManagerCreateNetworkResponse,
9246            fidl::encoding::DefaultFuchsiaResourceDialect,
9247        > for (T0, T1)
9248    {
9249        #[inline]
9250        unsafe fn encode(
9251            self,
9252            encoder: &mut fidl::encoding::Encoder<
9253                '_,
9254                fidl::encoding::DefaultFuchsiaResourceDialect,
9255            >,
9256            offset: usize,
9257            depth: fidl::encoding::Depth,
9258        ) -> fidl::Result<()> {
9259            encoder.debug_check_bounds::<NetworkManagerCreateNetworkResponse>(offset);
9260            // Zero out padding regions. There's no need to apply masks
9261            // because the unmasked parts will be overwritten by fields.
9262            // Write the fields.
9263            self.0.encode(encoder, offset + 0, depth)?;
9264            self.1.encode(encoder, offset + 4, depth)?;
9265            Ok(())
9266        }
9267    }
9268
9269    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9270        for NetworkManagerCreateNetworkResponse
9271    {
9272        #[inline(always)]
9273        fn new_empty() -> Self {
9274            Self {
9275                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
9276                net: fidl::new_empty!(
9277                    fidl::encoding::Optional<
9278                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
9279                    >,
9280                    fidl::encoding::DefaultFuchsiaResourceDialect
9281                ),
9282            }
9283        }
9284
9285        #[inline]
9286        unsafe fn decode(
9287            &mut self,
9288            decoder: &mut fidl::encoding::Decoder<
9289                '_,
9290                fidl::encoding::DefaultFuchsiaResourceDialect,
9291            >,
9292            offset: usize,
9293            _depth: fidl::encoding::Depth,
9294        ) -> fidl::Result<()> {
9295            decoder.debug_check_bounds::<Self>(offset);
9296            // Verify that padding bytes are zero.
9297            fidl::decode!(
9298                i32,
9299                fidl::encoding::DefaultFuchsiaResourceDialect,
9300                &mut self.status,
9301                decoder,
9302                offset + 0,
9303                _depth
9304            )?;
9305            fidl::decode!(
9306                fidl::encoding::Optional<
9307                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
9308                >,
9309                fidl::encoding::DefaultFuchsiaResourceDialect,
9310                &mut self.net,
9311                decoder,
9312                offset + 4,
9313                _depth
9314            )?;
9315            Ok(())
9316        }
9317    }
9318
9319    impl fidl::encoding::ValueTypeMarker for NetworkManagerGetNetworkRequest {
9320        type Borrowed<'a> = &'a Self;
9321        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9322            value
9323        }
9324    }
9325
9326    unsafe impl fidl::encoding::TypeMarker for NetworkManagerGetNetworkRequest {
9327        type Owned = Self;
9328
9329        #[inline(always)]
9330        fn inline_align(_context: fidl::encoding::Context) -> usize {
9331            8
9332        }
9333
9334        #[inline(always)]
9335        fn inline_size(_context: fidl::encoding::Context) -> usize {
9336            16
9337        }
9338    }
9339
9340    unsafe impl<D: fidl::encoding::ResourceDialect>
9341        fidl::encoding::Encode<NetworkManagerGetNetworkRequest, D>
9342        for &NetworkManagerGetNetworkRequest
9343    {
9344        #[inline]
9345        unsafe fn encode(
9346            self,
9347            encoder: &mut fidl::encoding::Encoder<'_, D>,
9348            offset: usize,
9349            _depth: fidl::encoding::Depth,
9350        ) -> fidl::Result<()> {
9351            encoder.debug_check_bounds::<NetworkManagerGetNetworkRequest>(offset);
9352            // Delegate to tuple encoding.
9353            fidl::encoding::Encode::<NetworkManagerGetNetworkRequest, D>::encode(
9354                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
9355                    &self.name,
9356                ),),
9357                encoder,
9358                offset,
9359                _depth,
9360            )
9361        }
9362    }
9363    unsafe impl<
9364            D: fidl::encoding::ResourceDialect,
9365            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
9366        > fidl::encoding::Encode<NetworkManagerGetNetworkRequest, D> for (T0,)
9367    {
9368        #[inline]
9369        unsafe fn encode(
9370            self,
9371            encoder: &mut fidl::encoding::Encoder<'_, D>,
9372            offset: usize,
9373            depth: fidl::encoding::Depth,
9374        ) -> fidl::Result<()> {
9375            encoder.debug_check_bounds::<NetworkManagerGetNetworkRequest>(offset);
9376            // Zero out padding regions. There's no need to apply masks
9377            // because the unmasked parts will be overwritten by fields.
9378            // Write the fields.
9379            self.0.encode(encoder, offset + 0, depth)?;
9380            Ok(())
9381        }
9382    }
9383
9384    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9385        for NetworkManagerGetNetworkRequest
9386    {
9387        #[inline(always)]
9388        fn new_empty() -> Self {
9389            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
9390        }
9391
9392        #[inline]
9393        unsafe fn decode(
9394            &mut self,
9395            decoder: &mut fidl::encoding::Decoder<'_, D>,
9396            offset: usize,
9397            _depth: fidl::encoding::Depth,
9398        ) -> fidl::Result<()> {
9399            decoder.debug_check_bounds::<Self>(offset);
9400            // Verify that padding bytes are zero.
9401            fidl::decode!(
9402                fidl::encoding::BoundedString<256>,
9403                D,
9404                &mut self.name,
9405                decoder,
9406                offset + 0,
9407                _depth
9408            )?;
9409            Ok(())
9410        }
9411    }
9412
9413    impl fidl::encoding::ResourceTypeMarker for NetworkManagerGetNetworkResponse {
9414        type Borrowed<'a> = &'a mut Self;
9415        fn take_or_borrow<'a>(
9416            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9417        ) -> Self::Borrowed<'a> {
9418            value
9419        }
9420    }
9421
9422    unsafe impl fidl::encoding::TypeMarker for NetworkManagerGetNetworkResponse {
9423        type Owned = Self;
9424
9425        #[inline(always)]
9426        fn inline_align(_context: fidl::encoding::Context) -> usize {
9427            4
9428        }
9429
9430        #[inline(always)]
9431        fn inline_size(_context: fidl::encoding::Context) -> usize {
9432            4
9433        }
9434    }
9435
9436    unsafe impl
9437        fidl::encoding::Encode<
9438            NetworkManagerGetNetworkResponse,
9439            fidl::encoding::DefaultFuchsiaResourceDialect,
9440        > for &mut NetworkManagerGetNetworkResponse
9441    {
9442        #[inline]
9443        unsafe fn encode(
9444            self,
9445            encoder: &mut fidl::encoding::Encoder<
9446                '_,
9447                fidl::encoding::DefaultFuchsiaResourceDialect,
9448            >,
9449            offset: usize,
9450            _depth: fidl::encoding::Depth,
9451        ) -> fidl::Result<()> {
9452            encoder.debug_check_bounds::<NetworkManagerGetNetworkResponse>(offset);
9453            // Delegate to tuple encoding.
9454            fidl::encoding::Encode::<
9455                NetworkManagerGetNetworkResponse,
9456                fidl::encoding::DefaultFuchsiaResourceDialect,
9457            >::encode(
9458                (<fidl::encoding::Optional<
9459                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
9460                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9461                    &mut self.net
9462                ),),
9463                encoder,
9464                offset,
9465                _depth,
9466            )
9467        }
9468    }
9469    unsafe impl<
9470            T0: fidl::encoding::Encode<
9471                fidl::encoding::Optional<
9472                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
9473                >,
9474                fidl::encoding::DefaultFuchsiaResourceDialect,
9475            >,
9476        >
9477        fidl::encoding::Encode<
9478            NetworkManagerGetNetworkResponse,
9479            fidl::encoding::DefaultFuchsiaResourceDialect,
9480        > for (T0,)
9481    {
9482        #[inline]
9483        unsafe fn encode(
9484            self,
9485            encoder: &mut fidl::encoding::Encoder<
9486                '_,
9487                fidl::encoding::DefaultFuchsiaResourceDialect,
9488            >,
9489            offset: usize,
9490            depth: fidl::encoding::Depth,
9491        ) -> fidl::Result<()> {
9492            encoder.debug_check_bounds::<NetworkManagerGetNetworkResponse>(offset);
9493            // Zero out padding regions. There's no need to apply masks
9494            // because the unmasked parts will be overwritten by fields.
9495            // Write the fields.
9496            self.0.encode(encoder, offset + 0, depth)?;
9497            Ok(())
9498        }
9499    }
9500
9501    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9502        for NetworkManagerGetNetworkResponse
9503    {
9504        #[inline(always)]
9505        fn new_empty() -> Self {
9506            Self {
9507                net: fidl::new_empty!(
9508                    fidl::encoding::Optional<
9509                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
9510                    >,
9511                    fidl::encoding::DefaultFuchsiaResourceDialect
9512                ),
9513            }
9514        }
9515
9516        #[inline]
9517        unsafe fn decode(
9518            &mut self,
9519            decoder: &mut fidl::encoding::Decoder<
9520                '_,
9521                fidl::encoding::DefaultFuchsiaResourceDialect,
9522            >,
9523            offset: usize,
9524            _depth: fidl::encoding::Depth,
9525        ) -> fidl::Result<()> {
9526            decoder.debug_check_bounds::<Self>(offset);
9527            // Verify that padding bytes are zero.
9528            fidl::decode!(
9529                fidl::encoding::Optional<
9530                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NetworkMarker>>,
9531                >,
9532                fidl::encoding::DefaultFuchsiaResourceDialect,
9533                &mut self.net,
9534                decoder,
9535                offset + 0,
9536                _depth
9537            )?;
9538            Ok(())
9539        }
9540    }
9541
9542    impl fidl::encoding::ValueTypeMarker for NetworkManagerListNetworksResponse {
9543        type Borrowed<'a> = &'a Self;
9544        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9545            value
9546        }
9547    }
9548
9549    unsafe impl fidl::encoding::TypeMarker for NetworkManagerListNetworksResponse {
9550        type Owned = Self;
9551
9552        #[inline(always)]
9553        fn inline_align(_context: fidl::encoding::Context) -> usize {
9554            8
9555        }
9556
9557        #[inline(always)]
9558        fn inline_size(_context: fidl::encoding::Context) -> usize {
9559            16
9560        }
9561    }
9562
9563    unsafe impl<D: fidl::encoding::ResourceDialect>
9564        fidl::encoding::Encode<NetworkManagerListNetworksResponse, D>
9565        for &NetworkManagerListNetworksResponse
9566    {
9567        #[inline]
9568        unsafe fn encode(
9569            self,
9570            encoder: &mut fidl::encoding::Encoder<'_, D>,
9571            offset: usize,
9572            _depth: fidl::encoding::Depth,
9573        ) -> fidl::Result<()> {
9574            encoder.debug_check_bounds::<NetworkManagerListNetworksResponse>(offset);
9575            // Delegate to tuple encoding.
9576            fidl::encoding::Encode::<NetworkManagerListNetworksResponse, D>::encode(
9577                (
9578                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>> as fidl::encoding::ValueTypeMarker>::borrow(&self.nets),
9579                ),
9580                encoder, offset, _depth
9581            )
9582        }
9583    }
9584    unsafe impl<
9585            D: fidl::encoding::ResourceDialect,
9586            T0: fidl::encoding::Encode<
9587                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
9588                D,
9589            >,
9590        > fidl::encoding::Encode<NetworkManagerListNetworksResponse, D> for (T0,)
9591    {
9592        #[inline]
9593        unsafe fn encode(
9594            self,
9595            encoder: &mut fidl::encoding::Encoder<'_, D>,
9596            offset: usize,
9597            depth: fidl::encoding::Depth,
9598        ) -> fidl::Result<()> {
9599            encoder.debug_check_bounds::<NetworkManagerListNetworksResponse>(offset);
9600            // Zero out padding regions. There's no need to apply masks
9601            // because the unmasked parts will be overwritten by fields.
9602            // Write the fields.
9603            self.0.encode(encoder, offset + 0, depth)?;
9604            Ok(())
9605        }
9606    }
9607
9608    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9609        for NetworkManagerListNetworksResponse
9610    {
9611        #[inline(always)]
9612        fn new_empty() -> Self {
9613            Self {
9614                nets: fidl::new_empty!(
9615                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
9616                    D
9617                ),
9618            }
9619        }
9620
9621        #[inline]
9622        unsafe fn decode(
9623            &mut self,
9624            decoder: &mut fidl::encoding::Decoder<'_, D>,
9625            offset: usize,
9626            _depth: fidl::encoding::Depth,
9627        ) -> fidl::Result<()> {
9628            decoder.debug_check_bounds::<Self>(offset);
9629            // Verify that padding bytes are zero.
9630            fidl::decode!(
9631                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
9632                D,
9633                &mut self.nets,
9634                decoder,
9635                offset + 0,
9636                _depth
9637            )?;
9638            Ok(())
9639        }
9640    }
9641
9642    impl fidl::encoding::ValueTypeMarker for NetworkRemoveEndpointRequest {
9643        type Borrowed<'a> = &'a Self;
9644        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9645            value
9646        }
9647    }
9648
9649    unsafe impl fidl::encoding::TypeMarker for NetworkRemoveEndpointRequest {
9650        type Owned = Self;
9651
9652        #[inline(always)]
9653        fn inline_align(_context: fidl::encoding::Context) -> usize {
9654            8
9655        }
9656
9657        #[inline(always)]
9658        fn inline_size(_context: fidl::encoding::Context) -> usize {
9659            16
9660        }
9661    }
9662
9663    unsafe impl<D: fidl::encoding::ResourceDialect>
9664        fidl::encoding::Encode<NetworkRemoveEndpointRequest, D> for &NetworkRemoveEndpointRequest
9665    {
9666        #[inline]
9667        unsafe fn encode(
9668            self,
9669            encoder: &mut fidl::encoding::Encoder<'_, D>,
9670            offset: usize,
9671            _depth: fidl::encoding::Depth,
9672        ) -> fidl::Result<()> {
9673            encoder.debug_check_bounds::<NetworkRemoveEndpointRequest>(offset);
9674            // Delegate to tuple encoding.
9675            fidl::encoding::Encode::<NetworkRemoveEndpointRequest, D>::encode(
9676                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
9677                    &self.name,
9678                ),),
9679                encoder,
9680                offset,
9681                _depth,
9682            )
9683        }
9684    }
9685    unsafe impl<
9686            D: fidl::encoding::ResourceDialect,
9687            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
9688        > fidl::encoding::Encode<NetworkRemoveEndpointRequest, D> for (T0,)
9689    {
9690        #[inline]
9691        unsafe fn encode(
9692            self,
9693            encoder: &mut fidl::encoding::Encoder<'_, D>,
9694            offset: usize,
9695            depth: fidl::encoding::Depth,
9696        ) -> fidl::Result<()> {
9697            encoder.debug_check_bounds::<NetworkRemoveEndpointRequest>(offset);
9698            // Zero out padding regions. There's no need to apply masks
9699            // because the unmasked parts will be overwritten by fields.
9700            // Write the fields.
9701            self.0.encode(encoder, offset + 0, depth)?;
9702            Ok(())
9703        }
9704    }
9705
9706    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9707        for NetworkRemoveEndpointRequest
9708    {
9709        #[inline(always)]
9710        fn new_empty() -> Self {
9711            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
9712        }
9713
9714        #[inline]
9715        unsafe fn decode(
9716            &mut self,
9717            decoder: &mut fidl::encoding::Decoder<'_, D>,
9718            offset: usize,
9719            _depth: fidl::encoding::Depth,
9720        ) -> fidl::Result<()> {
9721            decoder.debug_check_bounds::<Self>(offset);
9722            // Verify that padding bytes are zero.
9723            fidl::decode!(
9724                fidl::encoding::BoundedString<256>,
9725                D,
9726                &mut self.name,
9727                decoder,
9728                offset + 0,
9729                _depth
9730            )?;
9731            Ok(())
9732        }
9733    }
9734
9735    impl fidl::encoding::ValueTypeMarker for NetworkRemoveEndpointResponse {
9736        type Borrowed<'a> = &'a Self;
9737        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9738            value
9739        }
9740    }
9741
9742    unsafe impl fidl::encoding::TypeMarker for NetworkRemoveEndpointResponse {
9743        type Owned = Self;
9744
9745        #[inline(always)]
9746        fn inline_align(_context: fidl::encoding::Context) -> usize {
9747            4
9748        }
9749
9750        #[inline(always)]
9751        fn inline_size(_context: fidl::encoding::Context) -> usize {
9752            4
9753        }
9754        #[inline(always)]
9755        fn encode_is_copy() -> bool {
9756            true
9757        }
9758
9759        #[inline(always)]
9760        fn decode_is_copy() -> bool {
9761            true
9762        }
9763    }
9764
9765    unsafe impl<D: fidl::encoding::ResourceDialect>
9766        fidl::encoding::Encode<NetworkRemoveEndpointResponse, D>
9767        for &NetworkRemoveEndpointResponse
9768    {
9769        #[inline]
9770        unsafe fn encode(
9771            self,
9772            encoder: &mut fidl::encoding::Encoder<'_, D>,
9773            offset: usize,
9774            _depth: fidl::encoding::Depth,
9775        ) -> fidl::Result<()> {
9776            encoder.debug_check_bounds::<NetworkRemoveEndpointResponse>(offset);
9777            unsafe {
9778                // Copy the object into the buffer.
9779                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9780                (buf_ptr as *mut NetworkRemoveEndpointResponse)
9781                    .write_unaligned((self as *const NetworkRemoveEndpointResponse).read());
9782                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9783                // done second because the memcpy will write garbage to these bytes.
9784            }
9785            Ok(())
9786        }
9787    }
9788    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
9789        fidl::encoding::Encode<NetworkRemoveEndpointResponse, D> for (T0,)
9790    {
9791        #[inline]
9792        unsafe fn encode(
9793            self,
9794            encoder: &mut fidl::encoding::Encoder<'_, D>,
9795            offset: usize,
9796            depth: fidl::encoding::Depth,
9797        ) -> fidl::Result<()> {
9798            encoder.debug_check_bounds::<NetworkRemoveEndpointResponse>(offset);
9799            // Zero out padding regions. There's no need to apply masks
9800            // because the unmasked parts will be overwritten by fields.
9801            // Write the fields.
9802            self.0.encode(encoder, offset + 0, depth)?;
9803            Ok(())
9804        }
9805    }
9806
9807    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9808        for NetworkRemoveEndpointResponse
9809    {
9810        #[inline(always)]
9811        fn new_empty() -> Self {
9812            Self { status: fidl::new_empty!(i32, D) }
9813        }
9814
9815        #[inline]
9816        unsafe fn decode(
9817            &mut self,
9818            decoder: &mut fidl::encoding::Decoder<'_, D>,
9819            offset: usize,
9820            _depth: fidl::encoding::Depth,
9821        ) -> fidl::Result<()> {
9822            decoder.debug_check_bounds::<Self>(offset);
9823            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9824            // Verify that padding bytes are zero.
9825            // Copy from the buffer into the object.
9826            unsafe {
9827                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
9828            }
9829            Ok(())
9830        }
9831    }
9832
9833    impl fidl::encoding::ValueTypeMarker for NetworkSetConfigRequest {
9834        type Borrowed<'a> = &'a Self;
9835        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9836            value
9837        }
9838    }
9839
9840    unsafe impl fidl::encoding::TypeMarker for NetworkSetConfigRequest {
9841        type Owned = Self;
9842
9843        #[inline(always)]
9844        fn inline_align(_context: fidl::encoding::Context) -> usize {
9845            8
9846        }
9847
9848        #[inline(always)]
9849        fn inline_size(_context: fidl::encoding::Context) -> usize {
9850            16
9851        }
9852    }
9853
9854    unsafe impl<D: fidl::encoding::ResourceDialect>
9855        fidl::encoding::Encode<NetworkSetConfigRequest, D> for &NetworkSetConfigRequest
9856    {
9857        #[inline]
9858        unsafe fn encode(
9859            self,
9860            encoder: &mut fidl::encoding::Encoder<'_, D>,
9861            offset: usize,
9862            _depth: fidl::encoding::Depth,
9863        ) -> fidl::Result<()> {
9864            encoder.debug_check_bounds::<NetworkSetConfigRequest>(offset);
9865            // Delegate to tuple encoding.
9866            fidl::encoding::Encode::<NetworkSetConfigRequest, D>::encode(
9867                (<NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
9868                encoder,
9869                offset,
9870                _depth,
9871            )
9872        }
9873    }
9874    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NetworkConfig, D>>
9875        fidl::encoding::Encode<NetworkSetConfigRequest, D> for (T0,)
9876    {
9877        #[inline]
9878        unsafe fn encode(
9879            self,
9880            encoder: &mut fidl::encoding::Encoder<'_, D>,
9881            offset: usize,
9882            depth: fidl::encoding::Depth,
9883        ) -> fidl::Result<()> {
9884            encoder.debug_check_bounds::<NetworkSetConfigRequest>(offset);
9885            // Zero out padding regions. There's no need to apply masks
9886            // because the unmasked parts will be overwritten by fields.
9887            // Write the fields.
9888            self.0.encode(encoder, offset + 0, depth)?;
9889            Ok(())
9890        }
9891    }
9892
9893    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9894        for NetworkSetConfigRequest
9895    {
9896        #[inline(always)]
9897        fn new_empty() -> Self {
9898            Self { config: fidl::new_empty!(NetworkConfig, D) }
9899        }
9900
9901        #[inline]
9902        unsafe fn decode(
9903            &mut self,
9904            decoder: &mut fidl::encoding::Decoder<'_, D>,
9905            offset: usize,
9906            _depth: fidl::encoding::Depth,
9907        ) -> fidl::Result<()> {
9908            decoder.debug_check_bounds::<Self>(offset);
9909            // Verify that padding bytes are zero.
9910            fidl::decode!(NetworkConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
9911            Ok(())
9912        }
9913    }
9914
9915    impl fidl::encoding::ValueTypeMarker for NetworkSetConfigResponse {
9916        type Borrowed<'a> = &'a Self;
9917        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9918            value
9919        }
9920    }
9921
9922    unsafe impl fidl::encoding::TypeMarker for NetworkSetConfigResponse {
9923        type Owned = Self;
9924
9925        #[inline(always)]
9926        fn inline_align(_context: fidl::encoding::Context) -> usize {
9927            4
9928        }
9929
9930        #[inline(always)]
9931        fn inline_size(_context: fidl::encoding::Context) -> usize {
9932            4
9933        }
9934        #[inline(always)]
9935        fn encode_is_copy() -> bool {
9936            true
9937        }
9938
9939        #[inline(always)]
9940        fn decode_is_copy() -> bool {
9941            true
9942        }
9943    }
9944
9945    unsafe impl<D: fidl::encoding::ResourceDialect>
9946        fidl::encoding::Encode<NetworkSetConfigResponse, D> for &NetworkSetConfigResponse
9947    {
9948        #[inline]
9949        unsafe fn encode(
9950            self,
9951            encoder: &mut fidl::encoding::Encoder<'_, D>,
9952            offset: usize,
9953            _depth: fidl::encoding::Depth,
9954        ) -> fidl::Result<()> {
9955            encoder.debug_check_bounds::<NetworkSetConfigResponse>(offset);
9956            unsafe {
9957                // Copy the object into the buffer.
9958                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9959                (buf_ptr as *mut NetworkSetConfigResponse)
9960                    .write_unaligned((self as *const NetworkSetConfigResponse).read());
9961                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9962                // done second because the memcpy will write garbage to these bytes.
9963            }
9964            Ok(())
9965        }
9966    }
9967    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
9968        fidl::encoding::Encode<NetworkSetConfigResponse, D> for (T0,)
9969    {
9970        #[inline]
9971        unsafe fn encode(
9972            self,
9973            encoder: &mut fidl::encoding::Encoder<'_, D>,
9974            offset: usize,
9975            depth: fidl::encoding::Depth,
9976        ) -> fidl::Result<()> {
9977            encoder.debug_check_bounds::<NetworkSetConfigResponse>(offset);
9978            // Zero out padding regions. There's no need to apply masks
9979            // because the unmasked parts will be overwritten by fields.
9980            // Write the fields.
9981            self.0.encode(encoder, offset + 0, depth)?;
9982            Ok(())
9983        }
9984    }
9985
9986    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9987        for NetworkSetConfigResponse
9988    {
9989        #[inline(always)]
9990        fn new_empty() -> Self {
9991            Self { status: fidl::new_empty!(i32, D) }
9992        }
9993
9994        #[inline]
9995        unsafe fn decode(
9996            &mut self,
9997            decoder: &mut fidl::encoding::Decoder<'_, D>,
9998            offset: usize,
9999            _depth: fidl::encoding::Depth,
10000        ) -> fidl::Result<()> {
10001            decoder.debug_check_bounds::<Self>(offset);
10002            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
10003            // Verify that padding bytes are zero.
10004            // Copy from the buffer into the object.
10005            unsafe {
10006                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
10007            }
10008            Ok(())
10009        }
10010    }
10011
10012    impl fidl::encoding::ValueTypeMarker for NetworkSetup {
10013        type Borrowed<'a> = &'a Self;
10014        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10015            value
10016        }
10017    }
10018
10019    unsafe impl fidl::encoding::TypeMarker for NetworkSetup {
10020        type Owned = Self;
10021
10022        #[inline(always)]
10023        fn inline_align(_context: fidl::encoding::Context) -> usize {
10024            8
10025        }
10026
10027        #[inline(always)]
10028        fn inline_size(_context: fidl::encoding::Context) -> usize {
10029            48
10030        }
10031    }
10032
10033    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkSetup, D>
10034        for &NetworkSetup
10035    {
10036        #[inline]
10037        unsafe fn encode(
10038            self,
10039            encoder: &mut fidl::encoding::Encoder<'_, D>,
10040            offset: usize,
10041            _depth: fidl::encoding::Depth,
10042        ) -> fidl::Result<()> {
10043            encoder.debug_check_bounds::<NetworkSetup>(offset);
10044            // Delegate to tuple encoding.
10045            fidl::encoding::Encode::<NetworkSetup, D>::encode(
10046                (
10047                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
10048                    <NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
10049                    <fidl::encoding::UnboundedVector<EndpointSetup> as fidl::encoding::ValueTypeMarker>::borrow(&self.endpoints),
10050                ),
10051                encoder, offset, _depth
10052            )
10053        }
10054    }
10055    unsafe impl<
10056            D: fidl::encoding::ResourceDialect,
10057            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
10058            T1: fidl::encoding::Encode<NetworkConfig, D>,
10059            T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<EndpointSetup>, D>,
10060        > fidl::encoding::Encode<NetworkSetup, D> for (T0, T1, T2)
10061    {
10062        #[inline]
10063        unsafe fn encode(
10064            self,
10065            encoder: &mut fidl::encoding::Encoder<'_, D>,
10066            offset: usize,
10067            depth: fidl::encoding::Depth,
10068        ) -> fidl::Result<()> {
10069            encoder.debug_check_bounds::<NetworkSetup>(offset);
10070            // Zero out padding regions. There's no need to apply masks
10071            // because the unmasked parts will be overwritten by fields.
10072            // Write the fields.
10073            self.0.encode(encoder, offset + 0, depth)?;
10074            self.1.encode(encoder, offset + 16, depth)?;
10075            self.2.encode(encoder, offset + 32, depth)?;
10076            Ok(())
10077        }
10078    }
10079
10080    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkSetup {
10081        #[inline(always)]
10082        fn new_empty() -> Self {
10083            Self {
10084                name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
10085                config: fidl::new_empty!(NetworkConfig, D),
10086                endpoints: fidl::new_empty!(fidl::encoding::UnboundedVector<EndpointSetup>, D),
10087            }
10088        }
10089
10090        #[inline]
10091        unsafe fn decode(
10092            &mut self,
10093            decoder: &mut fidl::encoding::Decoder<'_, D>,
10094            offset: usize,
10095            _depth: fidl::encoding::Depth,
10096        ) -> fidl::Result<()> {
10097            decoder.debug_check_bounds::<Self>(offset);
10098            // Verify that padding bytes are zero.
10099            fidl::decode!(
10100                fidl::encoding::BoundedString<256>,
10101                D,
10102                &mut self.name,
10103                decoder,
10104                offset + 0,
10105                _depth
10106            )?;
10107            fidl::decode!(NetworkConfig, D, &mut self.config, decoder, offset + 16, _depth)?;
10108            fidl::decode!(
10109                fidl::encoding::UnboundedVector<EndpointSetup>,
10110                D,
10111                &mut self.endpoints,
10112                decoder,
10113                offset + 32,
10114                _depth
10115            )?;
10116            Ok(())
10117        }
10118    }
10119
10120    impl fidl::encoding::ValueTypeMarker for NetworkStartCaptureRequest {
10121        type Borrowed<'a> = &'a Self;
10122        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10123            value
10124        }
10125    }
10126
10127    unsafe impl fidl::encoding::TypeMarker for NetworkStartCaptureRequest {
10128        type Owned = Self;
10129
10130        #[inline(always)]
10131        fn inline_align(_context: fidl::encoding::Context) -> usize {
10132            8
10133        }
10134
10135        #[inline(always)]
10136        fn inline_size(_context: fidl::encoding::Context) -> usize {
10137            16
10138        }
10139    }
10140
10141    unsafe impl<D: fidl::encoding::ResourceDialect>
10142        fidl::encoding::Encode<NetworkStartCaptureRequest, D> for &NetworkStartCaptureRequest
10143    {
10144        #[inline]
10145        unsafe fn encode(
10146            self,
10147            encoder: &mut fidl::encoding::Encoder<'_, D>,
10148            offset: usize,
10149            _depth: fidl::encoding::Depth,
10150        ) -> fidl::Result<()> {
10151            encoder.debug_check_bounds::<NetworkStartCaptureRequest>(offset);
10152            // Delegate to tuple encoding.
10153            fidl::encoding::Encode::<NetworkStartCaptureRequest, D>::encode(
10154                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
10155                    &self.name,
10156                ),),
10157                encoder,
10158                offset,
10159                _depth,
10160            )
10161        }
10162    }
10163    unsafe impl<
10164            D: fidl::encoding::ResourceDialect,
10165            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
10166        > fidl::encoding::Encode<NetworkStartCaptureRequest, D> for (T0,)
10167    {
10168        #[inline]
10169        unsafe fn encode(
10170            self,
10171            encoder: &mut fidl::encoding::Encoder<'_, D>,
10172            offset: usize,
10173            depth: fidl::encoding::Depth,
10174        ) -> fidl::Result<()> {
10175            encoder.debug_check_bounds::<NetworkStartCaptureRequest>(offset);
10176            // Zero out padding regions. There's no need to apply masks
10177            // because the unmasked parts will be overwritten by fields.
10178            // Write the fields.
10179            self.0.encode(encoder, offset + 0, depth)?;
10180            Ok(())
10181        }
10182    }
10183
10184    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10185        for NetworkStartCaptureRequest
10186    {
10187        #[inline(always)]
10188        fn new_empty() -> Self {
10189            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
10190        }
10191
10192        #[inline]
10193        unsafe fn decode(
10194            &mut self,
10195            decoder: &mut fidl::encoding::Decoder<'_, D>,
10196            offset: usize,
10197            _depth: fidl::encoding::Depth,
10198        ) -> fidl::Result<()> {
10199            decoder.debug_check_bounds::<Self>(offset);
10200            // Verify that padding bytes are zero.
10201            fidl::decode!(
10202                fidl::encoding::BoundedString<256>,
10203                D,
10204                &mut self.name,
10205                decoder,
10206                offset + 0,
10207                _depth
10208            )?;
10209            Ok(())
10210        }
10211    }
10212
10213    impl fidl::encoding::ValueTypeMarker for NetworkStartCaptureResponse {
10214        type Borrowed<'a> = &'a Self;
10215        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10216            value
10217        }
10218    }
10219
10220    unsafe impl fidl::encoding::TypeMarker for NetworkStartCaptureResponse {
10221        type Owned = Self;
10222
10223        #[inline(always)]
10224        fn inline_align(_context: fidl::encoding::Context) -> usize {
10225            4
10226        }
10227
10228        #[inline(always)]
10229        fn inline_size(_context: fidl::encoding::Context) -> usize {
10230            4
10231        }
10232        #[inline(always)]
10233        fn encode_is_copy() -> bool {
10234            true
10235        }
10236
10237        #[inline(always)]
10238        fn decode_is_copy() -> bool {
10239            true
10240        }
10241    }
10242
10243    unsafe impl<D: fidl::encoding::ResourceDialect>
10244        fidl::encoding::Encode<NetworkStartCaptureResponse, D> for &NetworkStartCaptureResponse
10245    {
10246        #[inline]
10247        unsafe fn encode(
10248            self,
10249            encoder: &mut fidl::encoding::Encoder<'_, D>,
10250            offset: usize,
10251            _depth: fidl::encoding::Depth,
10252        ) -> fidl::Result<()> {
10253            encoder.debug_check_bounds::<NetworkStartCaptureResponse>(offset);
10254            unsafe {
10255                // Copy the object into the buffer.
10256                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
10257                (buf_ptr as *mut NetworkStartCaptureResponse)
10258                    .write_unaligned((self as *const NetworkStartCaptureResponse).read());
10259                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
10260                // done second because the memcpy will write garbage to these bytes.
10261            }
10262            Ok(())
10263        }
10264    }
10265    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
10266        fidl::encoding::Encode<NetworkStartCaptureResponse, D> for (T0,)
10267    {
10268        #[inline]
10269        unsafe fn encode(
10270            self,
10271            encoder: &mut fidl::encoding::Encoder<'_, D>,
10272            offset: usize,
10273            depth: fidl::encoding::Depth,
10274        ) -> fidl::Result<()> {
10275            encoder.debug_check_bounds::<NetworkStartCaptureResponse>(offset);
10276            // Zero out padding regions. There's no need to apply masks
10277            // because the unmasked parts will be overwritten by fields.
10278            // Write the fields.
10279            self.0.encode(encoder, offset + 0, depth)?;
10280            Ok(())
10281        }
10282    }
10283
10284    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10285        for NetworkStartCaptureResponse
10286    {
10287        #[inline(always)]
10288        fn new_empty() -> Self {
10289            Self { status: fidl::new_empty!(i32, D) }
10290        }
10291
10292        #[inline]
10293        unsafe fn decode(
10294            &mut self,
10295            decoder: &mut fidl::encoding::Decoder<'_, D>,
10296            offset: usize,
10297            _depth: fidl::encoding::Depth,
10298        ) -> fidl::Result<()> {
10299            decoder.debug_check_bounds::<Self>(offset);
10300            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
10301            // Verify that padding bytes are zero.
10302            // Copy from the buffer into the object.
10303            unsafe {
10304                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
10305            }
10306            Ok(())
10307        }
10308    }
10309
10310    impl fidl::encoding::ValueTypeMarker for ReorderConfig {
10311        type Borrowed<'a> = &'a Self;
10312        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10313            value
10314        }
10315    }
10316
10317    unsafe impl fidl::encoding::TypeMarker for ReorderConfig {
10318        type Owned = Self;
10319
10320        #[inline(always)]
10321        fn inline_align(_context: fidl::encoding::Context) -> usize {
10322            8
10323        }
10324
10325        #[inline(always)]
10326        fn inline_size(_context: fidl::encoding::Context) -> usize {
10327            16
10328        }
10329    }
10330
10331    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ReorderConfig, D>
10332        for &ReorderConfig
10333    {
10334        #[inline]
10335        unsafe fn encode(
10336            self,
10337            encoder: &mut fidl::encoding::Encoder<'_, D>,
10338            offset: usize,
10339            _depth: fidl::encoding::Depth,
10340        ) -> fidl::Result<()> {
10341            encoder.debug_check_bounds::<ReorderConfig>(offset);
10342            unsafe {
10343                // Copy the object into the buffer.
10344                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
10345                (buf_ptr as *mut ReorderConfig)
10346                    .write_unaligned((self as *const ReorderConfig).read());
10347                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
10348                // done second because the memcpy will write garbage to these bytes.
10349                let padding_ptr = buf_ptr.offset(0) as *mut u64;
10350                let padding_mask = 0xffffffff00000000u64;
10351                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
10352            }
10353            Ok(())
10354        }
10355    }
10356    unsafe impl<
10357            D: fidl::encoding::ResourceDialect,
10358            T0: fidl::encoding::Encode<u32, D>,
10359            T1: fidl::encoding::Encode<u64, D>,
10360        > fidl::encoding::Encode<ReorderConfig, D> for (T0, T1)
10361    {
10362        #[inline]
10363        unsafe fn encode(
10364            self,
10365            encoder: &mut fidl::encoding::Encoder<'_, D>,
10366            offset: usize,
10367            depth: fidl::encoding::Depth,
10368        ) -> fidl::Result<()> {
10369            encoder.debug_check_bounds::<ReorderConfig>(offset);
10370            // Zero out padding regions. There's no need to apply masks
10371            // because the unmasked parts will be overwritten by fields.
10372            unsafe {
10373                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10374                (ptr as *mut u64).write_unaligned(0);
10375            }
10376            // Write the fields.
10377            self.0.encode(encoder, offset + 0, depth)?;
10378            self.1.encode(encoder, offset + 8, depth)?;
10379            Ok(())
10380        }
10381    }
10382
10383    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReorderConfig {
10384        #[inline(always)]
10385        fn new_empty() -> Self {
10386            Self { store_buff: fidl::new_empty!(u32, D), tick: fidl::new_empty!(u64, D) }
10387        }
10388
10389        #[inline]
10390        unsafe fn decode(
10391            &mut self,
10392            decoder: &mut fidl::encoding::Decoder<'_, D>,
10393            offset: usize,
10394            _depth: fidl::encoding::Depth,
10395        ) -> fidl::Result<()> {
10396            decoder.debug_check_bounds::<Self>(offset);
10397            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
10398            // Verify that padding bytes are zero.
10399            let ptr = unsafe { buf_ptr.offset(0) };
10400            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10401            let mask = 0xffffffff00000000u64;
10402            let maskedval = padval & mask;
10403            if maskedval != 0 {
10404                return Err(fidl::Error::NonZeroPadding {
10405                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
10406                });
10407            }
10408            // Copy from the buffer into the object.
10409            unsafe {
10410                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
10411            }
10412            Ok(())
10413        }
10414    }
10415
10416    impl NetworkConfig {
10417        #[inline(always)]
10418        fn max_ordinal_present(&self) -> u64 {
10419            if let Some(_) = self.reorder {
10420                return 3;
10421            }
10422            if let Some(_) = self.packet_loss {
10423                return 2;
10424            }
10425            if let Some(_) = self.latency {
10426                return 1;
10427            }
10428            0
10429        }
10430    }
10431
10432    impl fidl::encoding::ValueTypeMarker for NetworkConfig {
10433        type Borrowed<'a> = &'a Self;
10434        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10435            value
10436        }
10437    }
10438
10439    unsafe impl fidl::encoding::TypeMarker for NetworkConfig {
10440        type Owned = Self;
10441
10442        #[inline(always)]
10443        fn inline_align(_context: fidl::encoding::Context) -> usize {
10444            8
10445        }
10446
10447        #[inline(always)]
10448        fn inline_size(_context: fidl::encoding::Context) -> usize {
10449            16
10450        }
10451    }
10452
10453    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkConfig, D>
10454        for &NetworkConfig
10455    {
10456        unsafe fn encode(
10457            self,
10458            encoder: &mut fidl::encoding::Encoder<'_, D>,
10459            offset: usize,
10460            mut depth: fidl::encoding::Depth,
10461        ) -> fidl::Result<()> {
10462            encoder.debug_check_bounds::<NetworkConfig>(offset);
10463            // Vector header
10464            let max_ordinal: u64 = self.max_ordinal_present();
10465            encoder.write_num(max_ordinal, offset);
10466            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10467            // Calling encoder.out_of_line_offset(0) is not allowed.
10468            if max_ordinal == 0 {
10469                return Ok(());
10470            }
10471            depth.increment()?;
10472            let envelope_size = 8;
10473            let bytes_len = max_ordinal as usize * envelope_size;
10474            #[allow(unused_variables)]
10475            let offset = encoder.out_of_line_offset(bytes_len);
10476            let mut _prev_end_offset: usize = 0;
10477            if 1 > max_ordinal {
10478                return Ok(());
10479            }
10480
10481            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10482            // are envelope_size bytes.
10483            let cur_offset: usize = (1 - 1) * envelope_size;
10484
10485            // Zero reserved fields.
10486            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10487
10488            // Safety:
10489            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10490            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10491            //   envelope_size bytes, there is always sufficient room.
10492            fidl::encoding::encode_in_envelope_optional::<LatencyConfig, D>(
10493                self.latency
10494                    .as_ref()
10495                    .map(<LatencyConfig as fidl::encoding::ValueTypeMarker>::borrow),
10496                encoder,
10497                offset + cur_offset,
10498                depth,
10499            )?;
10500
10501            _prev_end_offset = cur_offset + envelope_size;
10502            if 2 > max_ordinal {
10503                return Ok(());
10504            }
10505
10506            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10507            // are envelope_size bytes.
10508            let cur_offset: usize = (2 - 1) * envelope_size;
10509
10510            // Zero reserved fields.
10511            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10512
10513            // Safety:
10514            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10515            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10516            //   envelope_size bytes, there is always sufficient room.
10517            fidl::encoding::encode_in_envelope_optional::<LossConfig, D>(
10518                self.packet_loss
10519                    .as_ref()
10520                    .map(<LossConfig as fidl::encoding::ValueTypeMarker>::borrow),
10521                encoder,
10522                offset + cur_offset,
10523                depth,
10524            )?;
10525
10526            _prev_end_offset = cur_offset + envelope_size;
10527            if 3 > max_ordinal {
10528                return Ok(());
10529            }
10530
10531            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10532            // are envelope_size bytes.
10533            let cur_offset: usize = (3 - 1) * envelope_size;
10534
10535            // Zero reserved fields.
10536            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10537
10538            // Safety:
10539            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10540            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10541            //   envelope_size bytes, there is always sufficient room.
10542            fidl::encoding::encode_in_envelope_optional::<ReorderConfig, D>(
10543                self.reorder
10544                    .as_ref()
10545                    .map(<ReorderConfig as fidl::encoding::ValueTypeMarker>::borrow),
10546                encoder,
10547                offset + cur_offset,
10548                depth,
10549            )?;
10550
10551            _prev_end_offset = cur_offset + envelope_size;
10552
10553            Ok(())
10554        }
10555    }
10556
10557    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkConfig {
10558        #[inline(always)]
10559        fn new_empty() -> Self {
10560            Self::default()
10561        }
10562
10563        unsafe fn decode(
10564            &mut self,
10565            decoder: &mut fidl::encoding::Decoder<'_, D>,
10566            offset: usize,
10567            mut depth: fidl::encoding::Depth,
10568        ) -> fidl::Result<()> {
10569            decoder.debug_check_bounds::<Self>(offset);
10570            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10571                None => return Err(fidl::Error::NotNullable),
10572                Some(len) => len,
10573            };
10574            // Calling decoder.out_of_line_offset(0) is not allowed.
10575            if len == 0 {
10576                return Ok(());
10577            };
10578            depth.increment()?;
10579            let envelope_size = 8;
10580            let bytes_len = len * envelope_size;
10581            let offset = decoder.out_of_line_offset(bytes_len)?;
10582            // Decode the envelope for each type.
10583            let mut _next_ordinal_to_read = 0;
10584            let mut next_offset = offset;
10585            let end_offset = offset + bytes_len;
10586            _next_ordinal_to_read += 1;
10587            if next_offset >= end_offset {
10588                return Ok(());
10589            }
10590
10591            // Decode unknown envelopes for gaps in ordinals.
10592            while _next_ordinal_to_read < 1 {
10593                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10594                _next_ordinal_to_read += 1;
10595                next_offset += envelope_size;
10596            }
10597
10598            let next_out_of_line = decoder.next_out_of_line();
10599            let handles_before = decoder.remaining_handles();
10600            if let Some((inlined, num_bytes, num_handles)) =
10601                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10602            {
10603                let member_inline_size =
10604                    <LatencyConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10605                if inlined != (member_inline_size <= 4) {
10606                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10607                }
10608                let inner_offset;
10609                let mut inner_depth = depth.clone();
10610                if inlined {
10611                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10612                    inner_offset = next_offset;
10613                } else {
10614                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10615                    inner_depth.increment()?;
10616                }
10617                let val_ref =
10618                    self.latency.get_or_insert_with(|| fidl::new_empty!(LatencyConfig, D));
10619                fidl::decode!(LatencyConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
10620                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10621                {
10622                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10623                }
10624                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10625                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10626                }
10627            }
10628
10629            next_offset += envelope_size;
10630            _next_ordinal_to_read += 1;
10631            if next_offset >= end_offset {
10632                return Ok(());
10633            }
10634
10635            // Decode unknown envelopes for gaps in ordinals.
10636            while _next_ordinal_to_read < 2 {
10637                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10638                _next_ordinal_to_read += 1;
10639                next_offset += envelope_size;
10640            }
10641
10642            let next_out_of_line = decoder.next_out_of_line();
10643            let handles_before = decoder.remaining_handles();
10644            if let Some((inlined, num_bytes, num_handles)) =
10645                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10646            {
10647                let member_inline_size =
10648                    <LossConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10649                if inlined != (member_inline_size <= 4) {
10650                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10651                }
10652                let inner_offset;
10653                let mut inner_depth = depth.clone();
10654                if inlined {
10655                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10656                    inner_offset = next_offset;
10657                } else {
10658                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10659                    inner_depth.increment()?;
10660                }
10661                let val_ref =
10662                    self.packet_loss.get_or_insert_with(|| fidl::new_empty!(LossConfig, D));
10663                fidl::decode!(LossConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
10664                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10665                {
10666                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10667                }
10668                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10669                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10670                }
10671            }
10672
10673            next_offset += envelope_size;
10674            _next_ordinal_to_read += 1;
10675            if next_offset >= end_offset {
10676                return Ok(());
10677            }
10678
10679            // Decode unknown envelopes for gaps in ordinals.
10680            while _next_ordinal_to_read < 3 {
10681                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10682                _next_ordinal_to_read += 1;
10683                next_offset += envelope_size;
10684            }
10685
10686            let next_out_of_line = decoder.next_out_of_line();
10687            let handles_before = decoder.remaining_handles();
10688            if let Some((inlined, num_bytes, num_handles)) =
10689                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10690            {
10691                let member_inline_size =
10692                    <ReorderConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10693                if inlined != (member_inline_size <= 4) {
10694                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10695                }
10696                let inner_offset;
10697                let mut inner_depth = depth.clone();
10698                if inlined {
10699                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10700                    inner_offset = next_offset;
10701                } else {
10702                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10703                    inner_depth.increment()?;
10704                }
10705                let val_ref =
10706                    self.reorder.get_or_insert_with(|| fidl::new_empty!(ReorderConfig, D));
10707                fidl::decode!(ReorderConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
10708                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10709                {
10710                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10711                }
10712                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10713                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10714                }
10715            }
10716
10717            next_offset += envelope_size;
10718
10719            // Decode the remaining unknown envelopes.
10720            while next_offset < end_offset {
10721                _next_ordinal_to_read += 1;
10722                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10723                next_offset += envelope_size;
10724            }
10725
10726            Ok(())
10727        }
10728    }
10729
10730    impl fidl::encoding::ValueTypeMarker for LossConfig {
10731        type Borrowed<'a> = &'a Self;
10732        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10733            value
10734        }
10735    }
10736
10737    unsafe impl fidl::encoding::TypeMarker for LossConfig {
10738        type Owned = Self;
10739
10740        #[inline(always)]
10741        fn inline_align(_context: fidl::encoding::Context) -> usize {
10742            8
10743        }
10744
10745        #[inline(always)]
10746        fn inline_size(_context: fidl::encoding::Context) -> usize {
10747            16
10748        }
10749    }
10750
10751    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LossConfig, D>
10752        for &LossConfig
10753    {
10754        #[inline]
10755        unsafe fn encode(
10756            self,
10757            encoder: &mut fidl::encoding::Encoder<'_, D>,
10758            offset: usize,
10759            _depth: fidl::encoding::Depth,
10760        ) -> fidl::Result<()> {
10761            encoder.debug_check_bounds::<LossConfig>(offset);
10762            encoder.write_num::<u64>(self.ordinal(), offset);
10763            match self {
10764                LossConfig::RandomRate(ref val) => fidl::encoding::encode_in_envelope::<u8, D>(
10765                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(val),
10766                    encoder,
10767                    offset + 8,
10768                    _depth,
10769                ),
10770            }
10771        }
10772    }
10773
10774    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LossConfig {
10775        #[inline(always)]
10776        fn new_empty() -> Self {
10777            Self::RandomRate(fidl::new_empty!(u8, D))
10778        }
10779
10780        #[inline]
10781        unsafe fn decode(
10782            &mut self,
10783            decoder: &mut fidl::encoding::Decoder<'_, D>,
10784            offset: usize,
10785            mut depth: fidl::encoding::Depth,
10786        ) -> fidl::Result<()> {
10787            decoder.debug_check_bounds::<Self>(offset);
10788            #[allow(unused_variables)]
10789            let next_out_of_line = decoder.next_out_of_line();
10790            let handles_before = decoder.remaining_handles();
10791            let (ordinal, inlined, num_bytes, num_handles) =
10792                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
10793
10794            let member_inline_size = match ordinal {
10795                1 => <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
10796                _ => return Err(fidl::Error::UnknownUnionTag),
10797            };
10798
10799            if inlined != (member_inline_size <= 4) {
10800                return Err(fidl::Error::InvalidInlineBitInEnvelope);
10801            }
10802            let _inner_offset;
10803            if inlined {
10804                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
10805                _inner_offset = offset + 8;
10806            } else {
10807                depth.increment()?;
10808                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10809            }
10810            match ordinal {
10811                1 => {
10812                    #[allow(irrefutable_let_patterns)]
10813                    if let LossConfig::RandomRate(_) = self {
10814                        // Do nothing, read the value into the object
10815                    } else {
10816                        // Initialize `self` to the right variant
10817                        *self = LossConfig::RandomRate(fidl::new_empty!(u8, D));
10818                    }
10819                    #[allow(irrefutable_let_patterns)]
10820                    if let LossConfig::RandomRate(ref mut val) = self {
10821                        fidl::decode!(u8, D, val, decoder, _inner_offset, depth)?;
10822                    } else {
10823                        unreachable!()
10824                    }
10825                }
10826                ordinal => panic!("unexpected ordinal {:?}", ordinal),
10827            }
10828            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
10829                return Err(fidl::Error::InvalidNumBytesInEnvelope);
10830            }
10831            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10832                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10833            }
10834            Ok(())
10835        }
10836    }
10837}