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