1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_net_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 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 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 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#[cfg(target_os = "fuchsia")]
152impl fidl::endpoints::FromClient for DiagnosticsSynchronousProxy {
153 type Protocol = DiagnosticsMarker;
154
155 fn from_client(value: fidl::endpoints::ClientEnd<DiagnosticsMarker>) -> Self {
156 Self::new(value.into_channel())
157 }
158}
159
160#[derive(Debug, Clone)]
161pub struct DiagnosticsProxy {
162 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
163}
164
165impl fidl::endpoints::Proxy for DiagnosticsProxy {
166 type Protocol = DiagnosticsMarker;
167
168 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
169 Self::new(inner)
170 }
171
172 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
173 self.client.into_channel().map_err(|client| Self { client })
174 }
175
176 fn as_channel(&self) -> &::fidl::AsyncChannel {
177 self.client.as_channel()
178 }
179}
180
181impl DiagnosticsProxy {
182 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
184 let protocol_name = <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
185 Self { client: fidl::client::Client::new(channel, protocol_name) }
186 }
187
188 pub fn take_event_stream(&self) -> DiagnosticsEventStream {
194 DiagnosticsEventStream { event_receiver: self.client.take_event_receiver() }
195 }
196
197 pub fn r#log_debug_info_to_syslog(
202 &self,
203 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
204 DiagnosticsProxyInterface::r#log_debug_info_to_syslog(self)
205 }
206
207 pub fn r#get_process_handle_for_inspection(
212 &self,
213 ) -> fidl::client::QueryResponseFut<fidl::Process, fidl::encoding::DefaultFuchsiaResourceDialect>
214 {
215 DiagnosticsProxyInterface::r#get_process_handle_for_inspection(self)
216 }
217}
218
219impl DiagnosticsProxyInterface for DiagnosticsProxy {
220 type LogDebugInfoToSyslogResponseFut =
221 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
222 fn r#log_debug_info_to_syslog(&self) -> Self::LogDebugInfoToSyslogResponseFut {
223 fn _decode(
224 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
225 ) -> Result<(), fidl::Error> {
226 let _response = fidl::client::decode_transaction_body::<
227 fidl::encoding::EmptyPayload,
228 fidl::encoding::DefaultFuchsiaResourceDialect,
229 0x336c39330bd8e1ac,
230 >(_buf?)?;
231 Ok(_response)
232 }
233 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
234 (),
235 0x336c39330bd8e1ac,
236 fidl::encoding::DynamicFlags::empty(),
237 _decode,
238 )
239 }
240
241 type GetProcessHandleForInspectionResponseFut = fidl::client::QueryResponseFut<
242 fidl::Process,
243 fidl::encoding::DefaultFuchsiaResourceDialect,
244 >;
245 fn r#get_process_handle_for_inspection(
246 &self,
247 ) -> Self::GetProcessHandleForInspectionResponseFut {
248 fn _decode(
249 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
250 ) -> Result<fidl::Process, fidl::Error> {
251 let _response = fidl::client::decode_transaction_body::<
252 DiagnosticsGetProcessHandleForInspectionResponse,
253 fidl::encoding::DefaultFuchsiaResourceDialect,
254 0x563e5df030f2f4d5,
255 >(_buf?)?;
256 Ok(_response.process)
257 }
258 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Process>(
259 (),
260 0x563e5df030f2f4d5,
261 fidl::encoding::DynamicFlags::empty(),
262 _decode,
263 )
264 }
265}
266
267pub struct DiagnosticsEventStream {
268 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
269}
270
271impl std::marker::Unpin for DiagnosticsEventStream {}
272
273impl futures::stream::FusedStream for DiagnosticsEventStream {
274 fn is_terminated(&self) -> bool {
275 self.event_receiver.is_terminated()
276 }
277}
278
279impl futures::Stream for DiagnosticsEventStream {
280 type Item = Result<DiagnosticsEvent, fidl::Error>;
281
282 fn poll_next(
283 mut self: std::pin::Pin<&mut Self>,
284 cx: &mut std::task::Context<'_>,
285 ) -> std::task::Poll<Option<Self::Item>> {
286 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
287 &mut self.event_receiver,
288 cx
289 )?) {
290 Some(buf) => std::task::Poll::Ready(Some(DiagnosticsEvent::decode(buf))),
291 None => std::task::Poll::Ready(None),
292 }
293 }
294}
295
296#[derive(Debug)]
297pub enum DiagnosticsEvent {}
298
299impl DiagnosticsEvent {
300 fn decode(
302 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
303 ) -> Result<DiagnosticsEvent, fidl::Error> {
304 let (bytes, _handles) = buf.split_mut();
305 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
306 debug_assert_eq!(tx_header.tx_id, 0);
307 match tx_header.ordinal {
308 _ => Err(fidl::Error::UnknownOrdinal {
309 ordinal: tx_header.ordinal,
310 protocol_name: <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
311 }),
312 }
313 }
314}
315
316pub struct DiagnosticsRequestStream {
318 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
319 is_terminated: bool,
320}
321
322impl std::marker::Unpin for DiagnosticsRequestStream {}
323
324impl futures::stream::FusedStream for DiagnosticsRequestStream {
325 fn is_terminated(&self) -> bool {
326 self.is_terminated
327 }
328}
329
330impl fidl::endpoints::RequestStream for DiagnosticsRequestStream {
331 type Protocol = DiagnosticsMarker;
332 type ControlHandle = DiagnosticsControlHandle;
333
334 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
335 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
336 }
337
338 fn control_handle(&self) -> Self::ControlHandle {
339 DiagnosticsControlHandle { inner: self.inner.clone() }
340 }
341
342 fn into_inner(
343 self,
344 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
345 {
346 (self.inner, self.is_terminated)
347 }
348
349 fn from_inner(
350 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
351 is_terminated: bool,
352 ) -> Self {
353 Self { inner, is_terminated }
354 }
355}
356
357impl futures::Stream for DiagnosticsRequestStream {
358 type Item = Result<DiagnosticsRequest, fidl::Error>;
359
360 fn poll_next(
361 mut self: std::pin::Pin<&mut Self>,
362 cx: &mut std::task::Context<'_>,
363 ) -> std::task::Poll<Option<Self::Item>> {
364 let this = &mut *self;
365 if this.inner.check_shutdown(cx) {
366 this.is_terminated = true;
367 return std::task::Poll::Ready(None);
368 }
369 if this.is_terminated {
370 panic!("polled DiagnosticsRequestStream after completion");
371 }
372 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
373 |bytes, handles| {
374 match this.inner.channel().read_etc(cx, bytes, handles) {
375 std::task::Poll::Ready(Ok(())) => {}
376 std::task::Poll::Pending => return std::task::Poll::Pending,
377 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
378 this.is_terminated = true;
379 return std::task::Poll::Ready(None);
380 }
381 std::task::Poll::Ready(Err(e)) => {
382 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
383 e.into(),
384 ))))
385 }
386 }
387
388 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
390
391 std::task::Poll::Ready(Some(match header.ordinal {
392 0x336c39330bd8e1ac => {
393 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
394 let mut req = fidl::new_empty!(
395 fidl::encoding::EmptyPayload,
396 fidl::encoding::DefaultFuchsiaResourceDialect
397 );
398 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
399 let control_handle = DiagnosticsControlHandle { inner: this.inner.clone() };
400 Ok(DiagnosticsRequest::LogDebugInfoToSyslog {
401 responder: DiagnosticsLogDebugInfoToSyslogResponder {
402 control_handle: std::mem::ManuallyDrop::new(control_handle),
403 tx_id: header.tx_id,
404 },
405 })
406 }
407 0x563e5df030f2f4d5 => {
408 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
409 let mut req = fidl::new_empty!(
410 fidl::encoding::EmptyPayload,
411 fidl::encoding::DefaultFuchsiaResourceDialect
412 );
413 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
414 let control_handle = DiagnosticsControlHandle { inner: this.inner.clone() };
415 Ok(DiagnosticsRequest::GetProcessHandleForInspection {
416 responder: DiagnosticsGetProcessHandleForInspectionResponder {
417 control_handle: std::mem::ManuallyDrop::new(control_handle),
418 tx_id: header.tx_id,
419 },
420 })
421 }
422 _ => Err(fidl::Error::UnknownOrdinal {
423 ordinal: header.ordinal,
424 protocol_name:
425 <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
426 }),
427 }))
428 },
429 )
430 }
431}
432
433#[derive(Debug)]
435pub enum DiagnosticsRequest {
436 LogDebugInfoToSyslog { responder: DiagnosticsLogDebugInfoToSyslogResponder },
441 GetProcessHandleForInspection { responder: DiagnosticsGetProcessHandleForInspectionResponder },
446}
447
448impl DiagnosticsRequest {
449 #[allow(irrefutable_let_patterns)]
450 pub fn into_log_debug_info_to_syslog(
451 self,
452 ) -> Option<(DiagnosticsLogDebugInfoToSyslogResponder)> {
453 if let DiagnosticsRequest::LogDebugInfoToSyslog { responder } = self {
454 Some((responder))
455 } else {
456 None
457 }
458 }
459
460 #[allow(irrefutable_let_patterns)]
461 pub fn into_get_process_handle_for_inspection(
462 self,
463 ) -> Option<(DiagnosticsGetProcessHandleForInspectionResponder)> {
464 if let DiagnosticsRequest::GetProcessHandleForInspection { responder } = self {
465 Some((responder))
466 } else {
467 None
468 }
469 }
470
471 pub fn method_name(&self) -> &'static str {
473 match *self {
474 DiagnosticsRequest::LogDebugInfoToSyslog { .. } => "log_debug_info_to_syslog",
475 DiagnosticsRequest::GetProcessHandleForInspection { .. } => {
476 "get_process_handle_for_inspection"
477 }
478 }
479 }
480}
481
482#[derive(Debug, Clone)]
483pub struct DiagnosticsControlHandle {
484 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
485}
486
487impl fidl::endpoints::ControlHandle for DiagnosticsControlHandle {
488 fn shutdown(&self) {
489 self.inner.shutdown()
490 }
491 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
492 self.inner.shutdown_with_epitaph(status)
493 }
494
495 fn is_closed(&self) -> bool {
496 self.inner.channel().is_closed()
497 }
498 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
499 self.inner.channel().on_closed()
500 }
501
502 #[cfg(target_os = "fuchsia")]
503 fn signal_peer(
504 &self,
505 clear_mask: zx::Signals,
506 set_mask: zx::Signals,
507 ) -> Result<(), zx_status::Status> {
508 use fidl::Peered;
509 self.inner.channel().signal_peer(clear_mask, set_mask)
510 }
511}
512
513impl DiagnosticsControlHandle {}
514
515#[must_use = "FIDL methods require a response to be sent"]
516#[derive(Debug)]
517pub struct DiagnosticsLogDebugInfoToSyslogResponder {
518 control_handle: std::mem::ManuallyDrop<DiagnosticsControlHandle>,
519 tx_id: u32,
520}
521
522impl std::ops::Drop for DiagnosticsLogDebugInfoToSyslogResponder {
526 fn drop(&mut self) {
527 self.control_handle.shutdown();
528 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
530 }
531}
532
533impl fidl::endpoints::Responder for DiagnosticsLogDebugInfoToSyslogResponder {
534 type ControlHandle = DiagnosticsControlHandle;
535
536 fn control_handle(&self) -> &DiagnosticsControlHandle {
537 &self.control_handle
538 }
539
540 fn drop_without_shutdown(mut self) {
541 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
543 std::mem::forget(self);
545 }
546}
547
548impl DiagnosticsLogDebugInfoToSyslogResponder {
549 pub fn send(self) -> Result<(), fidl::Error> {
553 let _result = self.send_raw();
554 if _result.is_err() {
555 self.control_handle.shutdown();
556 }
557 self.drop_without_shutdown();
558 _result
559 }
560
561 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
563 let _result = self.send_raw();
564 self.drop_without_shutdown();
565 _result
566 }
567
568 fn send_raw(&self) -> Result<(), fidl::Error> {
569 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
570 (),
571 self.tx_id,
572 0x336c39330bd8e1ac,
573 fidl::encoding::DynamicFlags::empty(),
574 )
575 }
576}
577
578#[must_use = "FIDL methods require a response to be sent"]
579#[derive(Debug)]
580pub struct DiagnosticsGetProcessHandleForInspectionResponder {
581 control_handle: std::mem::ManuallyDrop<DiagnosticsControlHandle>,
582 tx_id: u32,
583}
584
585impl std::ops::Drop for DiagnosticsGetProcessHandleForInspectionResponder {
589 fn drop(&mut self) {
590 self.control_handle.shutdown();
591 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
593 }
594}
595
596impl fidl::endpoints::Responder for DiagnosticsGetProcessHandleForInspectionResponder {
597 type ControlHandle = DiagnosticsControlHandle;
598
599 fn control_handle(&self) -> &DiagnosticsControlHandle {
600 &self.control_handle
601 }
602
603 fn drop_without_shutdown(mut self) {
604 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
606 std::mem::forget(self);
608 }
609}
610
611impl DiagnosticsGetProcessHandleForInspectionResponder {
612 pub fn send(self, mut process: fidl::Process) -> Result<(), fidl::Error> {
616 let _result = self.send_raw(process);
617 if _result.is_err() {
618 self.control_handle.shutdown();
619 }
620 self.drop_without_shutdown();
621 _result
622 }
623
624 pub fn send_no_shutdown_on_err(self, mut process: fidl::Process) -> Result<(), fidl::Error> {
626 let _result = self.send_raw(process);
627 self.drop_without_shutdown();
628 _result
629 }
630
631 fn send_raw(&self, mut process: fidl::Process) -> Result<(), fidl::Error> {
632 self.control_handle.inner.send::<DiagnosticsGetProcessHandleForInspectionResponse>(
633 (process,),
634 self.tx_id,
635 0x563e5df030f2f4d5,
636 fidl::encoding::DynamicFlags::empty(),
637 )
638 }
639}
640
641#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
642pub struct InterfacesMarker;
643
644impl fidl::endpoints::ProtocolMarker for InterfacesMarker {
645 type Proxy = InterfacesProxy;
646 type RequestStream = InterfacesRequestStream;
647 #[cfg(target_os = "fuchsia")]
648 type SynchronousProxy = InterfacesSynchronousProxy;
649
650 const DEBUG_NAME: &'static str = "fuchsia.net.debug.Interfaces";
651}
652impl fidl::endpoints::DiscoverableProtocolMarker for InterfacesMarker {}
653
654pub trait InterfacesProxyInterface: Send + Sync {
655 fn r#get_port(
656 &self,
657 id: u64,
658 port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
659 ) -> Result<(), fidl::Error>;
660}
661#[derive(Debug)]
662#[cfg(target_os = "fuchsia")]
663pub struct InterfacesSynchronousProxy {
664 client: fidl::client::sync::Client,
665}
666
667#[cfg(target_os = "fuchsia")]
668impl fidl::endpoints::SynchronousProxy for InterfacesSynchronousProxy {
669 type Proxy = InterfacesProxy;
670 type Protocol = InterfacesMarker;
671
672 fn from_channel(inner: fidl::Channel) -> Self {
673 Self::new(inner)
674 }
675
676 fn into_channel(self) -> fidl::Channel {
677 self.client.into_channel()
678 }
679
680 fn as_channel(&self) -> &fidl::Channel {
681 self.client.as_channel()
682 }
683}
684
685#[cfg(target_os = "fuchsia")]
686impl InterfacesSynchronousProxy {
687 pub fn new(channel: fidl::Channel) -> Self {
688 let protocol_name = <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
689 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
690 }
691
692 pub fn into_channel(self) -> fidl::Channel {
693 self.client.into_channel()
694 }
695
696 pub fn wait_for_event(
699 &self,
700 deadline: zx::MonotonicInstant,
701 ) -> Result<InterfacesEvent, fidl::Error> {
702 InterfacesEvent::decode(self.client.wait_for_event(deadline)?)
703 }
704
705 pub fn r#get_port(
714 &self,
715 mut id: u64,
716 mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
717 ) -> Result<(), fidl::Error> {
718 self.client.send::<InterfacesGetPortRequest>(
719 (id, port),
720 0xdd15c4df17fb148,
721 fidl::encoding::DynamicFlags::empty(),
722 )
723 }
724}
725
726#[cfg(target_os = "fuchsia")]
727impl From<InterfacesSynchronousProxy> for zx::Handle {
728 fn from(value: InterfacesSynchronousProxy) -> Self {
729 value.into_channel().into()
730 }
731}
732
733#[cfg(target_os = "fuchsia")]
734impl From<fidl::Channel> for InterfacesSynchronousProxy {
735 fn from(value: fidl::Channel) -> Self {
736 Self::new(value)
737 }
738}
739
740#[cfg(target_os = "fuchsia")]
741impl fidl::endpoints::FromClient for InterfacesSynchronousProxy {
742 type Protocol = InterfacesMarker;
743
744 fn from_client(value: fidl::endpoints::ClientEnd<InterfacesMarker>) -> Self {
745 Self::new(value.into_channel())
746 }
747}
748
749#[derive(Debug, Clone)]
750pub struct InterfacesProxy {
751 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
752}
753
754impl fidl::endpoints::Proxy for InterfacesProxy {
755 type Protocol = InterfacesMarker;
756
757 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
758 Self::new(inner)
759 }
760
761 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
762 self.client.into_channel().map_err(|client| Self { client })
763 }
764
765 fn as_channel(&self) -> &::fidl::AsyncChannel {
766 self.client.as_channel()
767 }
768}
769
770impl InterfacesProxy {
771 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
773 let protocol_name = <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
774 Self { client: fidl::client::Client::new(channel, protocol_name) }
775 }
776
777 pub fn take_event_stream(&self) -> InterfacesEventStream {
783 InterfacesEventStream { event_receiver: self.client.take_event_receiver() }
784 }
785
786 pub fn r#get_port(
795 &self,
796 mut id: u64,
797 mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
798 ) -> Result<(), fidl::Error> {
799 InterfacesProxyInterface::r#get_port(self, id, port)
800 }
801}
802
803impl InterfacesProxyInterface for InterfacesProxy {
804 fn r#get_port(
805 &self,
806 mut id: u64,
807 mut port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
808 ) -> Result<(), fidl::Error> {
809 self.client.send::<InterfacesGetPortRequest>(
810 (id, port),
811 0xdd15c4df17fb148,
812 fidl::encoding::DynamicFlags::empty(),
813 )
814 }
815}
816
817pub struct InterfacesEventStream {
818 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
819}
820
821impl std::marker::Unpin for InterfacesEventStream {}
822
823impl futures::stream::FusedStream for InterfacesEventStream {
824 fn is_terminated(&self) -> bool {
825 self.event_receiver.is_terminated()
826 }
827}
828
829impl futures::Stream for InterfacesEventStream {
830 type Item = Result<InterfacesEvent, fidl::Error>;
831
832 fn poll_next(
833 mut self: std::pin::Pin<&mut Self>,
834 cx: &mut std::task::Context<'_>,
835 ) -> std::task::Poll<Option<Self::Item>> {
836 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
837 &mut self.event_receiver,
838 cx
839 )?) {
840 Some(buf) => std::task::Poll::Ready(Some(InterfacesEvent::decode(buf))),
841 None => std::task::Poll::Ready(None),
842 }
843 }
844}
845
846#[derive(Debug)]
847pub enum InterfacesEvent {}
848
849impl InterfacesEvent {
850 fn decode(
852 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
853 ) -> Result<InterfacesEvent, fidl::Error> {
854 let (bytes, _handles) = buf.split_mut();
855 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
856 debug_assert_eq!(tx_header.tx_id, 0);
857 match tx_header.ordinal {
858 _ => Err(fidl::Error::UnknownOrdinal {
859 ordinal: tx_header.ordinal,
860 protocol_name: <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
861 }),
862 }
863 }
864}
865
866pub struct InterfacesRequestStream {
868 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
869 is_terminated: bool,
870}
871
872impl std::marker::Unpin for InterfacesRequestStream {}
873
874impl futures::stream::FusedStream for InterfacesRequestStream {
875 fn is_terminated(&self) -> bool {
876 self.is_terminated
877 }
878}
879
880impl fidl::endpoints::RequestStream for InterfacesRequestStream {
881 type Protocol = InterfacesMarker;
882 type ControlHandle = InterfacesControlHandle;
883
884 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
885 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
886 }
887
888 fn control_handle(&self) -> Self::ControlHandle {
889 InterfacesControlHandle { inner: self.inner.clone() }
890 }
891
892 fn into_inner(
893 self,
894 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
895 {
896 (self.inner, self.is_terminated)
897 }
898
899 fn from_inner(
900 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
901 is_terminated: bool,
902 ) -> Self {
903 Self { inner, is_terminated }
904 }
905}
906
907impl futures::Stream for InterfacesRequestStream {
908 type Item = Result<InterfacesRequest, fidl::Error>;
909
910 fn poll_next(
911 mut self: std::pin::Pin<&mut Self>,
912 cx: &mut std::task::Context<'_>,
913 ) -> std::task::Poll<Option<Self::Item>> {
914 let this = &mut *self;
915 if this.inner.check_shutdown(cx) {
916 this.is_terminated = true;
917 return std::task::Poll::Ready(None);
918 }
919 if this.is_terminated {
920 panic!("polled InterfacesRequestStream after completion");
921 }
922 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
923 |bytes, handles| {
924 match this.inner.channel().read_etc(cx, bytes, handles) {
925 std::task::Poll::Ready(Ok(())) => {}
926 std::task::Poll::Pending => return std::task::Poll::Pending,
927 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
928 this.is_terminated = true;
929 return std::task::Poll::Ready(None);
930 }
931 std::task::Poll::Ready(Err(e)) => {
932 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
933 e.into(),
934 ))))
935 }
936 }
937
938 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
940
941 std::task::Poll::Ready(Some(match header.ordinal {
942 0xdd15c4df17fb148 => {
943 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
944 let mut req = fidl::new_empty!(
945 InterfacesGetPortRequest,
946 fidl::encoding::DefaultFuchsiaResourceDialect
947 );
948 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InterfacesGetPortRequest>(&header, _body_bytes, handles, &mut req)?;
949 let control_handle = InterfacesControlHandle { inner: this.inner.clone() };
950 Ok(InterfacesRequest::GetPort {
951 id: req.id,
952 port: req.port,
953
954 control_handle,
955 })
956 }
957 _ => Err(fidl::Error::UnknownOrdinal {
958 ordinal: header.ordinal,
959 protocol_name:
960 <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
961 }),
962 }))
963 },
964 )
965 }
966}
967
968#[derive(Debug)]
973pub enum InterfacesRequest {
974 GetPort {
983 id: u64,
984 port: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
985 control_handle: InterfacesControlHandle,
986 },
987}
988
989impl InterfacesRequest {
990 #[allow(irrefutable_let_patterns)]
991 pub fn into_get_port(
992 self,
993 ) -> Option<(
994 u64,
995 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
996 InterfacesControlHandle,
997 )> {
998 if let InterfacesRequest::GetPort { id, port, control_handle } = self {
999 Some((id, port, control_handle))
1000 } else {
1001 None
1002 }
1003 }
1004
1005 pub fn method_name(&self) -> &'static str {
1007 match *self {
1008 InterfacesRequest::GetPort { .. } => "get_port",
1009 }
1010 }
1011}
1012
1013#[derive(Debug, Clone)]
1014pub struct InterfacesControlHandle {
1015 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1016}
1017
1018impl fidl::endpoints::ControlHandle for InterfacesControlHandle {
1019 fn shutdown(&self) {
1020 self.inner.shutdown()
1021 }
1022 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1023 self.inner.shutdown_with_epitaph(status)
1024 }
1025
1026 fn is_closed(&self) -> bool {
1027 self.inner.channel().is_closed()
1028 }
1029 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1030 self.inner.channel().on_closed()
1031 }
1032
1033 #[cfg(target_os = "fuchsia")]
1034 fn signal_peer(
1035 &self,
1036 clear_mask: zx::Signals,
1037 set_mask: zx::Signals,
1038 ) -> Result<(), zx_status::Status> {
1039 use fidl::Peered;
1040 self.inner.channel().signal_peer(clear_mask, set_mask)
1041 }
1042}
1043
1044impl InterfacesControlHandle {}
1045
1046mod internal {
1047 use super::*;
1048
1049 impl fidl::encoding::ResourceTypeMarker for DiagnosticsGetProcessHandleForInspectionResponse {
1050 type Borrowed<'a> = &'a mut Self;
1051 fn take_or_borrow<'a>(
1052 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1053 ) -> Self::Borrowed<'a> {
1054 value
1055 }
1056 }
1057
1058 unsafe impl fidl::encoding::TypeMarker for DiagnosticsGetProcessHandleForInspectionResponse {
1059 type Owned = Self;
1060
1061 #[inline(always)]
1062 fn inline_align(_context: fidl::encoding::Context) -> usize {
1063 4
1064 }
1065
1066 #[inline(always)]
1067 fn inline_size(_context: fidl::encoding::Context) -> usize {
1068 4
1069 }
1070 }
1071
1072 unsafe impl
1073 fidl::encoding::Encode<
1074 DiagnosticsGetProcessHandleForInspectionResponse,
1075 fidl::encoding::DefaultFuchsiaResourceDialect,
1076 > for &mut DiagnosticsGetProcessHandleForInspectionResponse
1077 {
1078 #[inline]
1079 unsafe fn encode(
1080 self,
1081 encoder: &mut fidl::encoding::Encoder<
1082 '_,
1083 fidl::encoding::DefaultFuchsiaResourceDialect,
1084 >,
1085 offset: usize,
1086 _depth: fidl::encoding::Depth,
1087 ) -> fidl::Result<()> {
1088 encoder.debug_check_bounds::<DiagnosticsGetProcessHandleForInspectionResponse>(offset);
1089 fidl::encoding::Encode::<
1091 DiagnosticsGetProcessHandleForInspectionResponse,
1092 fidl::encoding::DefaultFuchsiaResourceDialect,
1093 >::encode(
1094 (<fidl::encoding::HandleType<
1095 fidl::Process,
1096 { fidl::ObjectType::PROCESS.into_raw() },
1097 32768,
1098 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1099 &mut self.process
1100 ),),
1101 encoder,
1102 offset,
1103 _depth,
1104 )
1105 }
1106 }
1107 unsafe impl<
1108 T0: fidl::encoding::Encode<
1109 fidl::encoding::HandleType<
1110 fidl::Process,
1111 { fidl::ObjectType::PROCESS.into_raw() },
1112 32768,
1113 >,
1114 fidl::encoding::DefaultFuchsiaResourceDialect,
1115 >,
1116 >
1117 fidl::encoding::Encode<
1118 DiagnosticsGetProcessHandleForInspectionResponse,
1119 fidl::encoding::DefaultFuchsiaResourceDialect,
1120 > for (T0,)
1121 {
1122 #[inline]
1123 unsafe fn encode(
1124 self,
1125 encoder: &mut fidl::encoding::Encoder<
1126 '_,
1127 fidl::encoding::DefaultFuchsiaResourceDialect,
1128 >,
1129 offset: usize,
1130 depth: fidl::encoding::Depth,
1131 ) -> fidl::Result<()> {
1132 encoder.debug_check_bounds::<DiagnosticsGetProcessHandleForInspectionResponse>(offset);
1133 self.0.encode(encoder, offset + 0, depth)?;
1137 Ok(())
1138 }
1139 }
1140
1141 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1142 for DiagnosticsGetProcessHandleForInspectionResponse
1143 {
1144 #[inline(always)]
1145 fn new_empty() -> Self {
1146 Self {
1147 process: fidl::new_empty!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 32768>, fidl::encoding::DefaultFuchsiaResourceDialect),
1148 }
1149 }
1150
1151 #[inline]
1152 unsafe fn decode(
1153 &mut self,
1154 decoder: &mut fidl::encoding::Decoder<
1155 '_,
1156 fidl::encoding::DefaultFuchsiaResourceDialect,
1157 >,
1158 offset: usize,
1159 _depth: fidl::encoding::Depth,
1160 ) -> fidl::Result<()> {
1161 decoder.debug_check_bounds::<Self>(offset);
1162 fidl::decode!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 32768>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.process, decoder, offset + 0, _depth)?;
1164 Ok(())
1165 }
1166 }
1167
1168 impl fidl::encoding::ResourceTypeMarker for InterfacesGetPortRequest {
1169 type Borrowed<'a> = &'a mut Self;
1170 fn take_or_borrow<'a>(
1171 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1172 ) -> Self::Borrowed<'a> {
1173 value
1174 }
1175 }
1176
1177 unsafe impl fidl::encoding::TypeMarker for InterfacesGetPortRequest {
1178 type Owned = Self;
1179
1180 #[inline(always)]
1181 fn inline_align(_context: fidl::encoding::Context) -> usize {
1182 8
1183 }
1184
1185 #[inline(always)]
1186 fn inline_size(_context: fidl::encoding::Context) -> usize {
1187 16
1188 }
1189 }
1190
1191 unsafe impl
1192 fidl::encoding::Encode<
1193 InterfacesGetPortRequest,
1194 fidl::encoding::DefaultFuchsiaResourceDialect,
1195 > for &mut InterfacesGetPortRequest
1196 {
1197 #[inline]
1198 unsafe fn encode(
1199 self,
1200 encoder: &mut fidl::encoding::Encoder<
1201 '_,
1202 fidl::encoding::DefaultFuchsiaResourceDialect,
1203 >,
1204 offset: usize,
1205 _depth: fidl::encoding::Depth,
1206 ) -> fidl::Result<()> {
1207 encoder.debug_check_bounds::<InterfacesGetPortRequest>(offset);
1208 fidl::encoding::Encode::<
1210 InterfacesGetPortRequest,
1211 fidl::encoding::DefaultFuchsiaResourceDialect,
1212 >::encode(
1213 (
1214 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1215 <fidl::encoding::Endpoint<
1216 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1217 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1218 &mut self.port
1219 ),
1220 ),
1221 encoder,
1222 offset,
1223 _depth,
1224 )
1225 }
1226 }
1227 unsafe impl<
1228 T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
1229 T1: fidl::encoding::Encode<
1230 fidl::encoding::Endpoint<
1231 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1232 >,
1233 fidl::encoding::DefaultFuchsiaResourceDialect,
1234 >,
1235 >
1236 fidl::encoding::Encode<
1237 InterfacesGetPortRequest,
1238 fidl::encoding::DefaultFuchsiaResourceDialect,
1239 > for (T0, T1)
1240 {
1241 #[inline]
1242 unsafe fn encode(
1243 self,
1244 encoder: &mut fidl::encoding::Encoder<
1245 '_,
1246 fidl::encoding::DefaultFuchsiaResourceDialect,
1247 >,
1248 offset: usize,
1249 depth: fidl::encoding::Depth,
1250 ) -> fidl::Result<()> {
1251 encoder.debug_check_bounds::<InterfacesGetPortRequest>(offset);
1252 unsafe {
1255 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1256 (ptr as *mut u64).write_unaligned(0);
1257 }
1258 self.0.encode(encoder, offset + 0, depth)?;
1260 self.1.encode(encoder, offset + 8, depth)?;
1261 Ok(())
1262 }
1263 }
1264
1265 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1266 for InterfacesGetPortRequest
1267 {
1268 #[inline(always)]
1269 fn new_empty() -> Self {
1270 Self {
1271 id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
1272 port: fidl::new_empty!(
1273 fidl::encoding::Endpoint<
1274 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1275 >,
1276 fidl::encoding::DefaultFuchsiaResourceDialect
1277 ),
1278 }
1279 }
1280
1281 #[inline]
1282 unsafe fn decode(
1283 &mut self,
1284 decoder: &mut fidl::encoding::Decoder<
1285 '_,
1286 fidl::encoding::DefaultFuchsiaResourceDialect,
1287 >,
1288 offset: usize,
1289 _depth: fidl::encoding::Depth,
1290 ) -> fidl::Result<()> {
1291 decoder.debug_check_bounds::<Self>(offset);
1292 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
1294 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1295 let mask = 0xffffffff00000000u64;
1296 let maskedval = padval & mask;
1297 if maskedval != 0 {
1298 return Err(fidl::Error::NonZeroPadding {
1299 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1300 });
1301 }
1302 fidl::decode!(
1303 u64,
1304 fidl::encoding::DefaultFuchsiaResourceDialect,
1305 &mut self.id,
1306 decoder,
1307 offset + 0,
1308 _depth
1309 )?;
1310 fidl::decode!(
1311 fidl::encoding::Endpoint<
1312 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_network::PortMarker>,
1313 >,
1314 fidl::encoding::DefaultFuchsiaResourceDialect,
1315 &mut self.port,
1316 decoder,
1317 offset + 8,
1318 _depth
1319 )?;
1320 Ok(())
1321 }
1322 }
1323}