fidl_fuchsia_net_debug/
fidl_fuchsia_net_debug.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 _};
10pub use fidl_fuchsia_net_debug_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DiagnosticsGetProcessHandleForInspectionResponse {
16    pub process: fidl::Process,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for DiagnosticsGetProcessHandleForInspectionResponse
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct InterfacesGetPortRequest {
26    pub id: u64,
27    pub port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InterfacesGetPortRequest {}
31
32#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
33pub struct DiagnosticsMarker;
34
35impl fidl::endpoints::ProtocolMarker for DiagnosticsMarker {
36    type Proxy = DiagnosticsProxy;
37    type RequestStream = DiagnosticsRequestStream;
38    #[cfg(target_os = "fuchsia")]
39    type SynchronousProxy = DiagnosticsSynchronousProxy;
40
41    const DEBUG_NAME: &'static str = "fuchsia.net.debug.Diagnostics";
42}
43impl fidl::endpoints::DiscoverableProtocolMarker for DiagnosticsMarker {}
44
45pub trait DiagnosticsProxyInterface: Send + Sync {
46    type LogDebugInfoToSyslogResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
47        + Send;
48    fn r#log_debug_info_to_syslog(&self) -> Self::LogDebugInfoToSyslogResponseFut;
49    type GetProcessHandleForInspectionResponseFut: std::future::Future<Output = Result<fidl::Process, fidl::Error>>
50        + Send;
51    fn r#get_process_handle_for_inspection(&self)
52        -> Self::GetProcessHandleForInspectionResponseFut;
53}
54#[derive(Debug)]
55#[cfg(target_os = "fuchsia")]
56pub struct DiagnosticsSynchronousProxy {
57    client: fidl::client::sync::Client,
58}
59
60#[cfg(target_os = "fuchsia")]
61impl fidl::endpoints::SynchronousProxy for DiagnosticsSynchronousProxy {
62    type Proxy = DiagnosticsProxy;
63    type Protocol = DiagnosticsMarker;
64
65    fn from_channel(inner: fidl::Channel) -> Self {
66        Self::new(inner)
67    }
68
69    fn into_channel(self) -> fidl::Channel {
70        self.client.into_channel()
71    }
72
73    fn as_channel(&self) -> &fidl::Channel {
74        self.client.as_channel()
75    }
76}
77
78#[cfg(target_os = "fuchsia")]
79impl DiagnosticsSynchronousProxy {
80    pub fn new(channel: fidl::Channel) -> Self {
81        let protocol_name = <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
82        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
83    }
84
85    pub fn into_channel(self) -> fidl::Channel {
86        self.client.into_channel()
87    }
88
89    /// Waits until an event arrives and returns it. It is safe for other
90    /// threads to make concurrent requests while waiting for an event.
91    pub fn wait_for_event(
92        &self,
93        deadline: zx::MonotonicInstant,
94    ) -> Result<DiagnosticsEvent, fidl::Error> {
95        DiagnosticsEvent::decode(self.client.wait_for_event(deadline)?)
96    }
97
98    /// Requests that the network stack produces debugging information in the
99    /// system logs.
100    ///
101    /// The call returns once debug information has been produced.
102    pub fn r#log_debug_info_to_syslog(
103        &self,
104        ___deadline: zx::MonotonicInstant,
105    ) -> Result<(), fidl::Error> {
106        let _response =
107            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
108                (),
109                0x336c39330bd8e1ac,
110                fidl::encoding::DynamicFlags::empty(),
111                ___deadline,
112            )?;
113        Ok(_response)
114    }
115
116    /// Requests a handle to the netstack's process.
117    ///
118    /// This handle is not meant to be used for anything other than diagnostics,
119    /// so only the `INSPECT` right is provided to the caller.
120    pub fn r#get_process_handle_for_inspection(
121        &self,
122        ___deadline: zx::MonotonicInstant,
123    ) -> Result<fidl::Process, fidl::Error> {
124        let _response = self.client.send_query::<
125            fidl::encoding::EmptyPayload,
126            DiagnosticsGetProcessHandleForInspectionResponse,
127        >(
128            (),
129            0x563e5df030f2f4d5,
130            fidl::encoding::DynamicFlags::empty(),
131            ___deadline,
132        )?;
133        Ok(_response.process)
134    }
135}
136
137#[cfg(target_os = "fuchsia")]
138impl From<DiagnosticsSynchronousProxy> for zx::Handle {
139    fn from(value: DiagnosticsSynchronousProxy) -> Self {
140        value.into_channel().into()
141    }
142}
143
144#[cfg(target_os = "fuchsia")]
145impl From<fidl::Channel> for DiagnosticsSynchronousProxy {
146    fn from(value: fidl::Channel) -> Self {
147        Self::new(value)
148    }
149}
150
151#[derive(Debug, Clone)]
152pub struct DiagnosticsProxy {
153    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
154}
155
156impl fidl::endpoints::Proxy for DiagnosticsProxy {
157    type Protocol = DiagnosticsMarker;
158
159    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
160        Self::new(inner)
161    }
162
163    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
164        self.client.into_channel().map_err(|client| Self { client })
165    }
166
167    fn as_channel(&self) -> &::fidl::AsyncChannel {
168        self.client.as_channel()
169    }
170}
171
172impl DiagnosticsProxy {
173    /// Create a new Proxy for fuchsia.net.debug/Diagnostics.
174    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
175        let protocol_name = <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
176        Self { client: fidl::client::Client::new(channel, protocol_name) }
177    }
178
179    /// Get a Stream of events from the remote end of the protocol.
180    ///
181    /// # Panics
182    ///
183    /// Panics if the event stream was already taken.
184    pub fn take_event_stream(&self) -> DiagnosticsEventStream {
185        DiagnosticsEventStream { event_receiver: self.client.take_event_receiver() }
186    }
187
188    /// Requests that the network stack produces debugging information in the
189    /// system logs.
190    ///
191    /// The call returns once debug information has been produced.
192    pub fn r#log_debug_info_to_syslog(
193        &self,
194    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
195        DiagnosticsProxyInterface::r#log_debug_info_to_syslog(self)
196    }
197
198    /// Requests a handle to the netstack's process.
199    ///
200    /// This handle is not meant to be used for anything other than diagnostics,
201    /// so only the `INSPECT` right is provided to the caller.
202    pub fn r#get_process_handle_for_inspection(
203        &self,
204    ) -> fidl::client::QueryResponseFut<fidl::Process, fidl::encoding::DefaultFuchsiaResourceDialect>
205    {
206        DiagnosticsProxyInterface::r#get_process_handle_for_inspection(self)
207    }
208}
209
210impl DiagnosticsProxyInterface for DiagnosticsProxy {
211    type LogDebugInfoToSyslogResponseFut =
212        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
213    fn r#log_debug_info_to_syslog(&self) -> Self::LogDebugInfoToSyslogResponseFut {
214        fn _decode(
215            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
216        ) -> Result<(), fidl::Error> {
217            let _response = fidl::client::decode_transaction_body::<
218                fidl::encoding::EmptyPayload,
219                fidl::encoding::DefaultFuchsiaResourceDialect,
220                0x336c39330bd8e1ac,
221            >(_buf?)?;
222            Ok(_response)
223        }
224        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
225            (),
226            0x336c39330bd8e1ac,
227            fidl::encoding::DynamicFlags::empty(),
228            _decode,
229        )
230    }
231
232    type GetProcessHandleForInspectionResponseFut = fidl::client::QueryResponseFut<
233        fidl::Process,
234        fidl::encoding::DefaultFuchsiaResourceDialect,
235    >;
236    fn r#get_process_handle_for_inspection(
237        &self,
238    ) -> Self::GetProcessHandleForInspectionResponseFut {
239        fn _decode(
240            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
241        ) -> Result<fidl::Process, fidl::Error> {
242            let _response = fidl::client::decode_transaction_body::<
243                DiagnosticsGetProcessHandleForInspectionResponse,
244                fidl::encoding::DefaultFuchsiaResourceDialect,
245                0x563e5df030f2f4d5,
246            >(_buf?)?;
247            Ok(_response.process)
248        }
249        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Process>(
250            (),
251            0x563e5df030f2f4d5,
252            fidl::encoding::DynamicFlags::empty(),
253            _decode,
254        )
255    }
256}
257
258pub struct DiagnosticsEventStream {
259    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
260}
261
262impl std::marker::Unpin for DiagnosticsEventStream {}
263
264impl futures::stream::FusedStream for DiagnosticsEventStream {
265    fn is_terminated(&self) -> bool {
266        self.event_receiver.is_terminated()
267    }
268}
269
270impl futures::Stream for DiagnosticsEventStream {
271    type Item = Result<DiagnosticsEvent, fidl::Error>;
272
273    fn poll_next(
274        mut self: std::pin::Pin<&mut Self>,
275        cx: &mut std::task::Context<'_>,
276    ) -> std::task::Poll<Option<Self::Item>> {
277        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
278            &mut self.event_receiver,
279            cx
280        )?) {
281            Some(buf) => std::task::Poll::Ready(Some(DiagnosticsEvent::decode(buf))),
282            None => std::task::Poll::Ready(None),
283        }
284    }
285}
286
287#[derive(Debug)]
288pub enum DiagnosticsEvent {}
289
290impl DiagnosticsEvent {
291    /// Decodes a message buffer as a [`DiagnosticsEvent`].
292    fn decode(
293        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
294    ) -> Result<DiagnosticsEvent, fidl::Error> {
295        let (bytes, _handles) = buf.split_mut();
296        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
297        debug_assert_eq!(tx_header.tx_id, 0);
298        match tx_header.ordinal {
299            _ => Err(fidl::Error::UnknownOrdinal {
300                ordinal: tx_header.ordinal,
301                protocol_name: <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
302            }),
303        }
304    }
305}
306
307/// A Stream of incoming requests for fuchsia.net.debug/Diagnostics.
308pub struct DiagnosticsRequestStream {
309    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
310    is_terminated: bool,
311}
312
313impl std::marker::Unpin for DiagnosticsRequestStream {}
314
315impl futures::stream::FusedStream for DiagnosticsRequestStream {
316    fn is_terminated(&self) -> bool {
317        self.is_terminated
318    }
319}
320
321impl fidl::endpoints::RequestStream for DiagnosticsRequestStream {
322    type Protocol = DiagnosticsMarker;
323    type ControlHandle = DiagnosticsControlHandle;
324
325    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
326        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
327    }
328
329    fn control_handle(&self) -> Self::ControlHandle {
330        DiagnosticsControlHandle { inner: self.inner.clone() }
331    }
332
333    fn into_inner(
334        self,
335    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
336    {
337        (self.inner, self.is_terminated)
338    }
339
340    fn from_inner(
341        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
342        is_terminated: bool,
343    ) -> Self {
344        Self { inner, is_terminated }
345    }
346}
347
348impl futures::Stream for DiagnosticsRequestStream {
349    type Item = Result<DiagnosticsRequest, fidl::Error>;
350
351    fn poll_next(
352        mut self: std::pin::Pin<&mut Self>,
353        cx: &mut std::task::Context<'_>,
354    ) -> std::task::Poll<Option<Self::Item>> {
355        let this = &mut *self;
356        if this.inner.check_shutdown(cx) {
357            this.is_terminated = true;
358            return std::task::Poll::Ready(None);
359        }
360        if this.is_terminated {
361            panic!("polled DiagnosticsRequestStream after completion");
362        }
363        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
364            |bytes, handles| {
365                match this.inner.channel().read_etc(cx, bytes, handles) {
366                    std::task::Poll::Ready(Ok(())) => {}
367                    std::task::Poll::Pending => return std::task::Poll::Pending,
368                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
369                        this.is_terminated = true;
370                        return std::task::Poll::Ready(None);
371                    }
372                    std::task::Poll::Ready(Err(e)) => {
373                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
374                            e.into(),
375                        ))))
376                    }
377                }
378
379                // A message has been received from the channel
380                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
381
382                std::task::Poll::Ready(Some(match header.ordinal {
383                    0x336c39330bd8e1ac => {
384                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
385                        let mut req = fidl::new_empty!(
386                            fidl::encoding::EmptyPayload,
387                            fidl::encoding::DefaultFuchsiaResourceDialect
388                        );
389                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
390                        let control_handle = DiagnosticsControlHandle { inner: this.inner.clone() };
391                        Ok(DiagnosticsRequest::LogDebugInfoToSyslog {
392                            responder: DiagnosticsLogDebugInfoToSyslogResponder {
393                                control_handle: std::mem::ManuallyDrop::new(control_handle),
394                                tx_id: header.tx_id,
395                            },
396                        })
397                    }
398                    0x563e5df030f2f4d5 => {
399                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
400                        let mut req = fidl::new_empty!(
401                            fidl::encoding::EmptyPayload,
402                            fidl::encoding::DefaultFuchsiaResourceDialect
403                        );
404                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
405                        let control_handle = DiagnosticsControlHandle { inner: this.inner.clone() };
406                        Ok(DiagnosticsRequest::GetProcessHandleForInspection {
407                            responder: DiagnosticsGetProcessHandleForInspectionResponder {
408                                control_handle: std::mem::ManuallyDrop::new(control_handle),
409                                tx_id: header.tx_id,
410                            },
411                        })
412                    }
413                    _ => Err(fidl::Error::UnknownOrdinal {
414                        ordinal: header.ordinal,
415                        protocol_name:
416                            <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
417                    }),
418                }))
419            },
420        )
421    }
422}
423
424/// Provides access to Network stack diagnostics information.
425#[derive(Debug)]
426pub enum DiagnosticsRequest {
427    /// Requests that the network stack produces debugging information in the
428    /// system logs.
429    ///
430    /// The call returns once debug information has been produced.
431    LogDebugInfoToSyslog { responder: DiagnosticsLogDebugInfoToSyslogResponder },
432    /// Requests a handle to the netstack's process.
433    ///
434    /// This handle is not meant to be used for anything other than diagnostics,
435    /// so only the `INSPECT` right is provided to the caller.
436    GetProcessHandleForInspection { responder: DiagnosticsGetProcessHandleForInspectionResponder },
437}
438
439impl DiagnosticsRequest {
440    #[allow(irrefutable_let_patterns)]
441    pub fn into_log_debug_info_to_syslog(
442        self,
443    ) -> Option<(DiagnosticsLogDebugInfoToSyslogResponder)> {
444        if let DiagnosticsRequest::LogDebugInfoToSyslog { responder } = self {
445            Some((responder))
446        } else {
447            None
448        }
449    }
450
451    #[allow(irrefutable_let_patterns)]
452    pub fn into_get_process_handle_for_inspection(
453        self,
454    ) -> Option<(DiagnosticsGetProcessHandleForInspectionResponder)> {
455        if let DiagnosticsRequest::GetProcessHandleForInspection { responder } = self {
456            Some((responder))
457        } else {
458            None
459        }
460    }
461
462    /// Name of the method defined in FIDL
463    pub fn method_name(&self) -> &'static str {
464        match *self {
465            DiagnosticsRequest::LogDebugInfoToSyslog { .. } => "log_debug_info_to_syslog",
466            DiagnosticsRequest::GetProcessHandleForInspection { .. } => {
467                "get_process_handle_for_inspection"
468            }
469        }
470    }
471}
472
473#[derive(Debug, Clone)]
474pub struct DiagnosticsControlHandle {
475    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
476}
477
478impl fidl::endpoints::ControlHandle for DiagnosticsControlHandle {
479    fn shutdown(&self) {
480        self.inner.shutdown()
481    }
482    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
483        self.inner.shutdown_with_epitaph(status)
484    }
485
486    fn is_closed(&self) -> bool {
487        self.inner.channel().is_closed()
488    }
489    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
490        self.inner.channel().on_closed()
491    }
492
493    #[cfg(target_os = "fuchsia")]
494    fn signal_peer(
495        &self,
496        clear_mask: zx::Signals,
497        set_mask: zx::Signals,
498    ) -> Result<(), zx_status::Status> {
499        use fidl::Peered;
500        self.inner.channel().signal_peer(clear_mask, set_mask)
501    }
502}
503
504impl DiagnosticsControlHandle {}
505
506#[must_use = "FIDL methods require a response to be sent"]
507#[derive(Debug)]
508pub struct DiagnosticsLogDebugInfoToSyslogResponder {
509    control_handle: std::mem::ManuallyDrop<DiagnosticsControlHandle>,
510    tx_id: u32,
511}
512
513/// Set the the channel to be shutdown (see [`DiagnosticsControlHandle::shutdown`])
514/// if the responder is dropped without sending a response, so that the client
515/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
516impl std::ops::Drop for DiagnosticsLogDebugInfoToSyslogResponder {
517    fn drop(&mut self) {
518        self.control_handle.shutdown();
519        // Safety: drops once, never accessed again
520        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
521    }
522}
523
524impl fidl::endpoints::Responder for DiagnosticsLogDebugInfoToSyslogResponder {
525    type ControlHandle = DiagnosticsControlHandle;
526
527    fn control_handle(&self) -> &DiagnosticsControlHandle {
528        &self.control_handle
529    }
530
531    fn drop_without_shutdown(mut self) {
532        // Safety: drops once, never accessed again due to mem::forget
533        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
534        // Prevent Drop from running (which would shut down the channel)
535        std::mem::forget(self);
536    }
537}
538
539impl DiagnosticsLogDebugInfoToSyslogResponder {
540    /// Sends a response to the FIDL transaction.
541    ///
542    /// Sets the channel to shutdown if an error occurs.
543    pub fn send(self) -> Result<(), fidl::Error> {
544        let _result = self.send_raw();
545        if _result.is_err() {
546            self.control_handle.shutdown();
547        }
548        self.drop_without_shutdown();
549        _result
550    }
551
552    /// Similar to "send" but does not shutdown the channel if an error occurs.
553    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
554        let _result = self.send_raw();
555        self.drop_without_shutdown();
556        _result
557    }
558
559    fn send_raw(&self) -> Result<(), fidl::Error> {
560        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
561            (),
562            self.tx_id,
563            0x336c39330bd8e1ac,
564            fidl::encoding::DynamicFlags::empty(),
565        )
566    }
567}
568
569#[must_use = "FIDL methods require a response to be sent"]
570#[derive(Debug)]
571pub struct DiagnosticsGetProcessHandleForInspectionResponder {
572    control_handle: std::mem::ManuallyDrop<DiagnosticsControlHandle>,
573    tx_id: u32,
574}
575
576/// Set the the channel to be shutdown (see [`DiagnosticsControlHandle::shutdown`])
577/// if the responder is dropped without sending a response, so that the client
578/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
579impl std::ops::Drop for DiagnosticsGetProcessHandleForInspectionResponder {
580    fn drop(&mut self) {
581        self.control_handle.shutdown();
582        // Safety: drops once, never accessed again
583        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
584    }
585}
586
587impl fidl::endpoints::Responder for DiagnosticsGetProcessHandleForInspectionResponder {
588    type ControlHandle = DiagnosticsControlHandle;
589
590    fn control_handle(&self) -> &DiagnosticsControlHandle {
591        &self.control_handle
592    }
593
594    fn drop_without_shutdown(mut self) {
595        // Safety: drops once, never accessed again due to mem::forget
596        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
597        // Prevent Drop from running (which would shut down the channel)
598        std::mem::forget(self);
599    }
600}
601
602impl DiagnosticsGetProcessHandleForInspectionResponder {
603    /// Sends a response to the FIDL transaction.
604    ///
605    /// Sets the channel to shutdown if an error occurs.
606    pub fn send(self, mut process: fidl::Process) -> Result<(), fidl::Error> {
607        let _result = self.send_raw(process);
608        if _result.is_err() {
609            self.control_handle.shutdown();
610        }
611        self.drop_without_shutdown();
612        _result
613    }
614
615    /// Similar to "send" but does not shutdown the channel if an error occurs.
616    pub fn send_no_shutdown_on_err(self, mut process: fidl::Process) -> Result<(), fidl::Error> {
617        let _result = self.send_raw(process);
618        self.drop_without_shutdown();
619        _result
620    }
621
622    fn send_raw(&self, mut process: fidl::Process) -> Result<(), fidl::Error> {
623        self.control_handle.inner.send::<DiagnosticsGetProcessHandleForInspectionResponse>(
624            (process,),
625            self.tx_id,
626            0x563e5df030f2f4d5,
627            fidl::encoding::DynamicFlags::empty(),
628        )
629    }
630}
631
632#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
633pub struct InterfacesMarker;
634
635impl fidl::endpoints::ProtocolMarker for InterfacesMarker {
636    type Proxy = InterfacesProxy;
637    type RequestStream = InterfacesRequestStream;
638    #[cfg(target_os = "fuchsia")]
639    type SynchronousProxy = InterfacesSynchronousProxy;
640
641    const DEBUG_NAME: &'static str = "fuchsia.net.debug.Interfaces";
642}
643impl fidl::endpoints::DiscoverableProtocolMarker for InterfacesMarker {}
644
645pub trait InterfacesProxyInterface: Send + Sync {
646    fn r#get_port(
647        &self,
648        id: u64,
649        port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
650    ) -> Result<(), fidl::Error>;
651}
652#[derive(Debug)]
653#[cfg(target_os = "fuchsia")]
654pub struct InterfacesSynchronousProxy {
655    client: fidl::client::sync::Client,
656}
657
658#[cfg(target_os = "fuchsia")]
659impl fidl::endpoints::SynchronousProxy for InterfacesSynchronousProxy {
660    type Proxy = InterfacesProxy;
661    type Protocol = InterfacesMarker;
662
663    fn from_channel(inner: fidl::Channel) -> Self {
664        Self::new(inner)
665    }
666
667    fn into_channel(self) -> fidl::Channel {
668        self.client.into_channel()
669    }
670
671    fn as_channel(&self) -> &fidl::Channel {
672        self.client.as_channel()
673    }
674}
675
676#[cfg(target_os = "fuchsia")]
677impl InterfacesSynchronousProxy {
678    pub fn new(channel: fidl::Channel) -> Self {
679        let protocol_name = <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
680        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
681    }
682
683    pub fn into_channel(self) -> fidl::Channel {
684        self.client.into_channel()
685    }
686
687    /// Waits until an event arrives and returns it. It is safe for other
688    /// threads to make concurrent requests while waiting for an event.
689    pub fn wait_for_event(
690        &self,
691        deadline: zx::MonotonicInstant,
692    ) -> Result<InterfacesEvent, fidl::Error> {
693        InterfacesEvent::decode(self.client.wait_for_event(deadline)?)
694    }
695
696    /// Provides access to the port backing an interface.
697    ///
698    /// `port` is closed with `ZX_ERR_NOT_FOUND` if an interface referenced by
699    /// `id` does not exist or `ZX_ERR_NOT_SUPPORTED` if it is not backed by a
700    /// [`fuchsia.hardware.network/Port`].
701    ///
702    /// + request `id` identifies the interface whose port is granted.
703    /// + request `port` grants access to the interface's device port.
704    pub fn r#get_port(
705        &self,
706        mut id: u64,
707        mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
708    ) -> Result<(), fidl::Error> {
709        self.client.send::<InterfacesGetPortRequest>(
710            (id, port),
711            0xdd15c4df17fb148,
712            fidl::encoding::DynamicFlags::empty(),
713        )
714    }
715}
716
717#[cfg(target_os = "fuchsia")]
718impl From<InterfacesSynchronousProxy> for zx::Handle {
719    fn from(value: InterfacesSynchronousProxy) -> Self {
720        value.into_channel().into()
721    }
722}
723
724#[cfg(target_os = "fuchsia")]
725impl From<fidl::Channel> for InterfacesSynchronousProxy {
726    fn from(value: fidl::Channel) -> Self {
727        Self::new(value)
728    }
729}
730
731#[derive(Debug, Clone)]
732pub struct InterfacesProxy {
733    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
734}
735
736impl fidl::endpoints::Proxy for InterfacesProxy {
737    type Protocol = InterfacesMarker;
738
739    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
740        Self::new(inner)
741    }
742
743    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
744        self.client.into_channel().map_err(|client| Self { client })
745    }
746
747    fn as_channel(&self) -> &::fidl::AsyncChannel {
748        self.client.as_channel()
749    }
750}
751
752impl InterfacesProxy {
753    /// Create a new Proxy for fuchsia.net.debug/Interfaces.
754    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
755        let protocol_name = <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
756        Self { client: fidl::client::Client::new(channel, protocol_name) }
757    }
758
759    /// Get a Stream of events from the remote end of the protocol.
760    ///
761    /// # Panics
762    ///
763    /// Panics if the event stream was already taken.
764    pub fn take_event_stream(&self) -> InterfacesEventStream {
765        InterfacesEventStream { event_receiver: self.client.take_event_receiver() }
766    }
767
768    /// Provides access to the port backing an interface.
769    ///
770    /// `port` is closed with `ZX_ERR_NOT_FOUND` if an interface referenced by
771    /// `id` does not exist or `ZX_ERR_NOT_SUPPORTED` if it is not backed by a
772    /// [`fuchsia.hardware.network/Port`].
773    ///
774    /// + request `id` identifies the interface whose port is granted.
775    /// + request `port` grants access to the interface's device port.
776    pub fn r#get_port(
777        &self,
778        mut id: u64,
779        mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
780    ) -> Result<(), fidl::Error> {
781        InterfacesProxyInterface::r#get_port(self, id, port)
782    }
783}
784
785impl InterfacesProxyInterface for InterfacesProxy {
786    fn r#get_port(
787        &self,
788        mut id: u64,
789        mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
790    ) -> Result<(), fidl::Error> {
791        self.client.send::<InterfacesGetPortRequest>(
792            (id, port),
793            0xdd15c4df17fb148,
794            fidl::encoding::DynamicFlags::empty(),
795        )
796    }
797}
798
799pub struct InterfacesEventStream {
800    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
801}
802
803impl std::marker::Unpin for InterfacesEventStream {}
804
805impl futures::stream::FusedStream for InterfacesEventStream {
806    fn is_terminated(&self) -> bool {
807        self.event_receiver.is_terminated()
808    }
809}
810
811impl futures::Stream for InterfacesEventStream {
812    type Item = Result<InterfacesEvent, fidl::Error>;
813
814    fn poll_next(
815        mut self: std::pin::Pin<&mut Self>,
816        cx: &mut std::task::Context<'_>,
817    ) -> std::task::Poll<Option<Self::Item>> {
818        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
819            &mut self.event_receiver,
820            cx
821        )?) {
822            Some(buf) => std::task::Poll::Ready(Some(InterfacesEvent::decode(buf))),
823            None => std::task::Poll::Ready(None),
824        }
825    }
826}
827
828#[derive(Debug)]
829pub enum InterfacesEvent {}
830
831impl InterfacesEvent {
832    /// Decodes a message buffer as a [`InterfacesEvent`].
833    fn decode(
834        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
835    ) -> Result<InterfacesEvent, fidl::Error> {
836        let (bytes, _handles) = buf.split_mut();
837        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
838        debug_assert_eq!(tx_header.tx_id, 0);
839        match tx_header.ordinal {
840            _ => Err(fidl::Error::UnknownOrdinal {
841                ordinal: tx_header.ordinal,
842                protocol_name: <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
843            }),
844        }
845    }
846}
847
848/// A Stream of incoming requests for fuchsia.net.debug/Interfaces.
849pub struct InterfacesRequestStream {
850    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
851    is_terminated: bool,
852}
853
854impl std::marker::Unpin for InterfacesRequestStream {}
855
856impl futures::stream::FusedStream for InterfacesRequestStream {
857    fn is_terminated(&self) -> bool {
858        self.is_terminated
859    }
860}
861
862impl fidl::endpoints::RequestStream for InterfacesRequestStream {
863    type Protocol = InterfacesMarker;
864    type ControlHandle = InterfacesControlHandle;
865
866    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
867        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
868    }
869
870    fn control_handle(&self) -> Self::ControlHandle {
871        InterfacesControlHandle { inner: self.inner.clone() }
872    }
873
874    fn into_inner(
875        self,
876    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
877    {
878        (self.inner, self.is_terminated)
879    }
880
881    fn from_inner(
882        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
883        is_terminated: bool,
884    ) -> Self {
885        Self { inner, is_terminated }
886    }
887}
888
889impl futures::Stream for InterfacesRequestStream {
890    type Item = Result<InterfacesRequest, fidl::Error>;
891
892    fn poll_next(
893        mut self: std::pin::Pin<&mut Self>,
894        cx: &mut std::task::Context<'_>,
895    ) -> std::task::Poll<Option<Self::Item>> {
896        let this = &mut *self;
897        if this.inner.check_shutdown(cx) {
898            this.is_terminated = true;
899            return std::task::Poll::Ready(None);
900        }
901        if this.is_terminated {
902            panic!("polled InterfacesRequestStream after completion");
903        }
904        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
905            |bytes, handles| {
906                match this.inner.channel().read_etc(cx, bytes, handles) {
907                    std::task::Poll::Ready(Ok(())) => {}
908                    std::task::Poll::Pending => return std::task::Poll::Pending,
909                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
910                        this.is_terminated = true;
911                        return std::task::Poll::Ready(None);
912                    }
913                    std::task::Poll::Ready(Err(e)) => {
914                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
915                            e.into(),
916                        ))))
917                    }
918                }
919
920                // A message has been received from the channel
921                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
922
923                std::task::Poll::Ready(Some(match header.ordinal {
924                    0xdd15c4df17fb148 => {
925                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
926                        let mut req = fidl::new_empty!(
927                            InterfacesGetPortRequest,
928                            fidl::encoding::DefaultFuchsiaResourceDialect
929                        );
930                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InterfacesGetPortRequest>(&header, _body_bytes, handles, &mut req)?;
931                        let control_handle = InterfacesControlHandle { inner: this.inner.clone() };
932                        Ok(InterfacesRequest::GetPort {
933                            id: req.id,
934                            port: req.port,
935
936                            control_handle,
937                        })
938                    }
939                    _ => Err(fidl::Error::UnknownOrdinal {
940                        ordinal: header.ordinal,
941                        protocol_name:
942                            <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
943                    }),
944                }))
945            },
946        )
947    }
948}
949
950/// Network interface debugging functionality.
951///
952/// This protocol is intended for debugging and testing only; and not meant for
953/// load-bearing code.
954#[derive(Debug)]
955pub enum InterfacesRequest {
956    /// Provides access to the port backing an interface.
957    ///
958    /// `port` is closed with `ZX_ERR_NOT_FOUND` if an interface referenced by
959    /// `id` does not exist or `ZX_ERR_NOT_SUPPORTED` if it is not backed by a
960    /// [`fuchsia.hardware.network/Port`].
961    ///
962    /// + request `id` identifies the interface whose port is granted.
963    /// + request `port` grants access to the interface's device port.
964    GetPort {
965        id: u64,
966        port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
967        control_handle: InterfacesControlHandle,
968    },
969}
970
971impl InterfacesRequest {
972    #[allow(irrefutable_let_patterns)]
973    pub fn into_get_port(
974        self,
975    ) -> Option<(
976        u64,
977        fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
978        InterfacesControlHandle,
979    )> {
980        if let InterfacesRequest::GetPort { id, port, control_handle } = self {
981            Some((id, port, control_handle))
982        } else {
983            None
984        }
985    }
986
987    /// Name of the method defined in FIDL
988    pub fn method_name(&self) -> &'static str {
989        match *self {
990            InterfacesRequest::GetPort { .. } => "get_port",
991        }
992    }
993}
994
995#[derive(Debug, Clone)]
996pub struct InterfacesControlHandle {
997    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
998}
999
1000impl fidl::endpoints::ControlHandle for InterfacesControlHandle {
1001    fn shutdown(&self) {
1002        self.inner.shutdown()
1003    }
1004    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1005        self.inner.shutdown_with_epitaph(status)
1006    }
1007
1008    fn is_closed(&self) -> bool {
1009        self.inner.channel().is_closed()
1010    }
1011    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1012        self.inner.channel().on_closed()
1013    }
1014
1015    #[cfg(target_os = "fuchsia")]
1016    fn signal_peer(
1017        &self,
1018        clear_mask: zx::Signals,
1019        set_mask: zx::Signals,
1020    ) -> Result<(), zx_status::Status> {
1021        use fidl::Peered;
1022        self.inner.channel().signal_peer(clear_mask, set_mask)
1023    }
1024}
1025
1026impl InterfacesControlHandle {}
1027
1028mod internal {
1029    use super::*;
1030
1031    impl fidl::encoding::ResourceTypeMarker for DiagnosticsGetProcessHandleForInspectionResponse {
1032        type Borrowed<'a> = &'a mut Self;
1033        fn take_or_borrow<'a>(
1034            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1035        ) -> Self::Borrowed<'a> {
1036            value
1037        }
1038    }
1039
1040    unsafe impl fidl::encoding::TypeMarker for DiagnosticsGetProcessHandleForInspectionResponse {
1041        type Owned = Self;
1042
1043        #[inline(always)]
1044        fn inline_align(_context: fidl::encoding::Context) -> usize {
1045            4
1046        }
1047
1048        #[inline(always)]
1049        fn inline_size(_context: fidl::encoding::Context) -> usize {
1050            4
1051        }
1052    }
1053
1054    unsafe impl
1055        fidl::encoding::Encode<
1056            DiagnosticsGetProcessHandleForInspectionResponse,
1057            fidl::encoding::DefaultFuchsiaResourceDialect,
1058        > for &mut DiagnosticsGetProcessHandleForInspectionResponse
1059    {
1060        #[inline]
1061        unsafe fn encode(
1062            self,
1063            encoder: &mut fidl::encoding::Encoder<
1064                '_,
1065                fidl::encoding::DefaultFuchsiaResourceDialect,
1066            >,
1067            offset: usize,
1068            _depth: fidl::encoding::Depth,
1069        ) -> fidl::Result<()> {
1070            encoder.debug_check_bounds::<DiagnosticsGetProcessHandleForInspectionResponse>(offset);
1071            // Delegate to tuple encoding.
1072            fidl::encoding::Encode::<
1073                DiagnosticsGetProcessHandleForInspectionResponse,
1074                fidl::encoding::DefaultFuchsiaResourceDialect,
1075            >::encode(
1076                (<fidl::encoding::HandleType<
1077                    fidl::Process,
1078                    { fidl::ObjectType::PROCESS.into_raw() },
1079                    32768,
1080                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1081                    &mut self.process
1082                ),),
1083                encoder,
1084                offset,
1085                _depth,
1086            )
1087        }
1088    }
1089    unsafe impl<
1090            T0: fidl::encoding::Encode<
1091                fidl::encoding::HandleType<
1092                    fidl::Process,
1093                    { fidl::ObjectType::PROCESS.into_raw() },
1094                    32768,
1095                >,
1096                fidl::encoding::DefaultFuchsiaResourceDialect,
1097            >,
1098        >
1099        fidl::encoding::Encode<
1100            DiagnosticsGetProcessHandleForInspectionResponse,
1101            fidl::encoding::DefaultFuchsiaResourceDialect,
1102        > for (T0,)
1103    {
1104        #[inline]
1105        unsafe fn encode(
1106            self,
1107            encoder: &mut fidl::encoding::Encoder<
1108                '_,
1109                fidl::encoding::DefaultFuchsiaResourceDialect,
1110            >,
1111            offset: usize,
1112            depth: fidl::encoding::Depth,
1113        ) -> fidl::Result<()> {
1114            encoder.debug_check_bounds::<DiagnosticsGetProcessHandleForInspectionResponse>(offset);
1115            // Zero out padding regions. There's no need to apply masks
1116            // because the unmasked parts will be overwritten by fields.
1117            // Write the fields.
1118            self.0.encode(encoder, offset + 0, depth)?;
1119            Ok(())
1120        }
1121    }
1122
1123    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1124        for DiagnosticsGetProcessHandleForInspectionResponse
1125    {
1126        #[inline(always)]
1127        fn new_empty() -> Self {
1128            Self {
1129                process: fidl::new_empty!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 32768>, fidl::encoding::DefaultFuchsiaResourceDialect),
1130            }
1131        }
1132
1133        #[inline]
1134        unsafe fn decode(
1135            &mut self,
1136            decoder: &mut fidl::encoding::Decoder<
1137                '_,
1138                fidl::encoding::DefaultFuchsiaResourceDialect,
1139            >,
1140            offset: usize,
1141            _depth: fidl::encoding::Depth,
1142        ) -> fidl::Result<()> {
1143            decoder.debug_check_bounds::<Self>(offset);
1144            // Verify that padding bytes are zero.
1145            fidl::decode!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 32768>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.process, decoder, offset + 0, _depth)?;
1146            Ok(())
1147        }
1148    }
1149
1150    impl fidl::encoding::ResourceTypeMarker for InterfacesGetPortRequest {
1151        type Borrowed<'a> = &'a mut Self;
1152        fn take_or_borrow<'a>(
1153            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1154        ) -> Self::Borrowed<'a> {
1155            value
1156        }
1157    }
1158
1159    unsafe impl fidl::encoding::TypeMarker for InterfacesGetPortRequest {
1160        type Owned = Self;
1161
1162        #[inline(always)]
1163        fn inline_align(_context: fidl::encoding::Context) -> usize {
1164            8
1165        }
1166
1167        #[inline(always)]
1168        fn inline_size(_context: fidl::encoding::Context) -> usize {
1169            16
1170        }
1171    }
1172
1173    unsafe impl
1174        fidl::encoding::Encode<
1175            InterfacesGetPortRequest,
1176            fidl::encoding::DefaultFuchsiaResourceDialect,
1177        > for &mut InterfacesGetPortRequest
1178    {
1179        #[inline]
1180        unsafe fn encode(
1181            self,
1182            encoder: &mut fidl::encoding::Encoder<
1183                '_,
1184                fidl::encoding::DefaultFuchsiaResourceDialect,
1185            >,
1186            offset: usize,
1187            _depth: fidl::encoding::Depth,
1188        ) -> fidl::Result<()> {
1189            encoder.debug_check_bounds::<InterfacesGetPortRequest>(offset);
1190            // Delegate to tuple encoding.
1191            fidl::encoding::Encode::<
1192                InterfacesGetPortRequest,
1193                fidl::encoding::DefaultFuchsiaResourceDialect,
1194            >::encode(
1195                (
1196                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1197                    <fidl::encoding::Endpoint<
1198                        fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1199                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1200                        &mut self.port
1201                    ),
1202                ),
1203                encoder,
1204                offset,
1205                _depth,
1206            )
1207        }
1208    }
1209    unsafe impl<
1210            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
1211            T1: fidl::encoding::Encode<
1212                fidl::encoding::Endpoint<
1213                    fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1214                >,
1215                fidl::encoding::DefaultFuchsiaResourceDialect,
1216            >,
1217        >
1218        fidl::encoding::Encode<
1219            InterfacesGetPortRequest,
1220            fidl::encoding::DefaultFuchsiaResourceDialect,
1221        > for (T0, T1)
1222    {
1223        #[inline]
1224        unsafe fn encode(
1225            self,
1226            encoder: &mut fidl::encoding::Encoder<
1227                '_,
1228                fidl::encoding::DefaultFuchsiaResourceDialect,
1229            >,
1230            offset: usize,
1231            depth: fidl::encoding::Depth,
1232        ) -> fidl::Result<()> {
1233            encoder.debug_check_bounds::<InterfacesGetPortRequest>(offset);
1234            // Zero out padding regions. There's no need to apply masks
1235            // because the unmasked parts will be overwritten by fields.
1236            unsafe {
1237                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1238                (ptr as *mut u64).write_unaligned(0);
1239            }
1240            // Write the fields.
1241            self.0.encode(encoder, offset + 0, depth)?;
1242            self.1.encode(encoder, offset + 8, depth)?;
1243            Ok(())
1244        }
1245    }
1246
1247    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1248        for InterfacesGetPortRequest
1249    {
1250        #[inline(always)]
1251        fn new_empty() -> Self {
1252            Self {
1253                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
1254                port: fidl::new_empty!(
1255                    fidl::encoding::Endpoint<
1256                        fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1257                    >,
1258                    fidl::encoding::DefaultFuchsiaResourceDialect
1259                ),
1260            }
1261        }
1262
1263        #[inline]
1264        unsafe fn decode(
1265            &mut self,
1266            decoder: &mut fidl::encoding::Decoder<
1267                '_,
1268                fidl::encoding::DefaultFuchsiaResourceDialect,
1269            >,
1270            offset: usize,
1271            _depth: fidl::encoding::Depth,
1272        ) -> fidl::Result<()> {
1273            decoder.debug_check_bounds::<Self>(offset);
1274            // Verify that padding bytes are zero.
1275            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
1276            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1277            let mask = 0xffffffff00000000u64;
1278            let maskedval = padval & mask;
1279            if maskedval != 0 {
1280                return Err(fidl::Error::NonZeroPadding {
1281                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1282                });
1283            }
1284            fidl::decode!(
1285                u64,
1286                fidl::encoding::DefaultFuchsiaResourceDialect,
1287                &mut self.id,
1288                decoder,
1289                offset + 0,
1290                _depth
1291            )?;
1292            fidl::decode!(
1293                fidl::encoding::Endpoint<
1294                    fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1295                >,
1296                fidl::encoding::DefaultFuchsiaResourceDialect,
1297                &mut self.port,
1298                decoder,
1299                offset + 8,
1300                _depth
1301            )?;
1302            Ok(())
1303        }
1304    }
1305}