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