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_sockets_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DiagnosticsGetDestructionWatcherRequest {
16 pub watcher: fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for DiagnosticsGetDestructionWatcherRequest
21{
22}
23
24#[derive(Debug, PartialEq)]
25pub struct DiagnosticsIterateIpRequest {
26 pub s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
28 pub extensions: Extensions,
32 pub matchers: Vec<IpSocketMatcher>,
64}
65
66impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
67 for DiagnosticsIterateIpRequest
68{
69}
70
71#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
72pub struct ControlMarker;
73
74impl fidl::endpoints::ProtocolMarker for ControlMarker {
75 type Proxy = ControlProxy;
76 type RequestStream = ControlRequestStream;
77 #[cfg(target_os = "fuchsia")]
78 type SynchronousProxy = ControlSynchronousProxy;
79
80 const DEBUG_NAME: &'static str = "fuchsia.net.sockets.Control";
81}
82impl fidl::endpoints::DiscoverableProtocolMarker for ControlMarker {}
83
84pub trait ControlProxyInterface: Send + Sync {
85 type DisconnectIpResponseFut: std::future::Future<Output = Result<DisconnectIpResult, fidl::Error>>
86 + Send;
87 fn r#disconnect_ip(
88 &self,
89 payload: &ControlDisconnectIpRequest,
90 ) -> Self::DisconnectIpResponseFut;
91}
92#[derive(Debug)]
93#[cfg(target_os = "fuchsia")]
94pub struct ControlSynchronousProxy {
95 client: fidl::client::sync::Client,
96}
97
98#[cfg(target_os = "fuchsia")]
99impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
100 type Proxy = ControlProxy;
101 type Protocol = ControlMarker;
102
103 fn from_channel(inner: fidl::Channel) -> Self {
104 Self::new(inner)
105 }
106
107 fn into_channel(self) -> fidl::Channel {
108 self.client.into_channel()
109 }
110
111 fn as_channel(&self) -> &fidl::Channel {
112 self.client.as_channel()
113 }
114}
115
116#[cfg(target_os = "fuchsia")]
117impl ControlSynchronousProxy {
118 pub fn new(channel: fidl::Channel) -> Self {
119 Self { client: fidl::client::sync::Client::new(channel) }
120 }
121
122 pub fn into_channel(self) -> fidl::Channel {
123 self.client.into_channel()
124 }
125
126 pub fn wait_for_event(
129 &self,
130 deadline: zx::MonotonicInstant,
131 ) -> Result<ControlEvent, fidl::Error> {
132 ControlEvent::decode(self.client.wait_for_event::<ControlMarker>(deadline)?)
133 }
134
135 pub fn r#disconnect_ip(
162 &self,
163 mut payload: &ControlDisconnectIpRequest,
164 ___deadline: zx::MonotonicInstant,
165 ) -> Result<DisconnectIpResult, fidl::Error> {
166 let _response = self
167 .client
168 .send_query::<ControlDisconnectIpRequest, DisconnectIpResult, ControlMarker>(
169 payload,
170 0xbdaa66fbb4241a4,
171 fidl::encoding::DynamicFlags::empty(),
172 ___deadline,
173 )?;
174 Ok(_response)
175 }
176}
177
178#[cfg(target_os = "fuchsia")]
179impl From<ControlSynchronousProxy> for zx::NullableHandle {
180 fn from(value: ControlSynchronousProxy) -> Self {
181 value.into_channel().into()
182 }
183}
184
185#[cfg(target_os = "fuchsia")]
186impl From<fidl::Channel> for ControlSynchronousProxy {
187 fn from(value: fidl::Channel) -> Self {
188 Self::new(value)
189 }
190}
191
192#[cfg(target_os = "fuchsia")]
193impl fidl::endpoints::FromClient for ControlSynchronousProxy {
194 type Protocol = ControlMarker;
195
196 fn from_client(value: fidl::endpoints::ClientEnd<ControlMarker>) -> Self {
197 Self::new(value.into_channel())
198 }
199}
200
201#[derive(Debug, Clone)]
202pub struct ControlProxy {
203 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
204}
205
206impl fidl::endpoints::Proxy for ControlProxy {
207 type Protocol = ControlMarker;
208
209 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
210 Self::new(inner)
211 }
212
213 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
214 self.client.into_channel().map_err(|client| Self { client })
215 }
216
217 fn as_channel(&self) -> &::fidl::AsyncChannel {
218 self.client.as_channel()
219 }
220}
221
222impl ControlProxy {
223 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
225 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
226 Self { client: fidl::client::Client::new(channel, protocol_name) }
227 }
228
229 pub fn take_event_stream(&self) -> ControlEventStream {
235 ControlEventStream { event_receiver: self.client.take_event_receiver() }
236 }
237
238 pub fn r#disconnect_ip(
265 &self,
266 mut payload: &ControlDisconnectIpRequest,
267 ) -> fidl::client::QueryResponseFut<
268 DisconnectIpResult,
269 fidl::encoding::DefaultFuchsiaResourceDialect,
270 > {
271 ControlProxyInterface::r#disconnect_ip(self, payload)
272 }
273}
274
275impl ControlProxyInterface for ControlProxy {
276 type DisconnectIpResponseFut = fidl::client::QueryResponseFut<
277 DisconnectIpResult,
278 fidl::encoding::DefaultFuchsiaResourceDialect,
279 >;
280 fn r#disconnect_ip(
281 &self,
282 mut payload: &ControlDisconnectIpRequest,
283 ) -> Self::DisconnectIpResponseFut {
284 fn _decode(
285 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
286 ) -> Result<DisconnectIpResult, fidl::Error> {
287 let _response = fidl::client::decode_transaction_body::<
288 DisconnectIpResult,
289 fidl::encoding::DefaultFuchsiaResourceDialect,
290 0xbdaa66fbb4241a4,
291 >(_buf?)?;
292 Ok(_response)
293 }
294 self.client.send_query_and_decode::<ControlDisconnectIpRequest, DisconnectIpResult>(
295 payload,
296 0xbdaa66fbb4241a4,
297 fidl::encoding::DynamicFlags::empty(),
298 _decode,
299 )
300 }
301}
302
303pub struct ControlEventStream {
304 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
305}
306
307impl std::marker::Unpin for ControlEventStream {}
308
309impl futures::stream::FusedStream for ControlEventStream {
310 fn is_terminated(&self) -> bool {
311 self.event_receiver.is_terminated()
312 }
313}
314
315impl futures::Stream for ControlEventStream {
316 type Item = Result<ControlEvent, fidl::Error>;
317
318 fn poll_next(
319 mut self: std::pin::Pin<&mut Self>,
320 cx: &mut std::task::Context<'_>,
321 ) -> std::task::Poll<Option<Self::Item>> {
322 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
323 &mut self.event_receiver,
324 cx
325 )?) {
326 Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
327 None => std::task::Poll::Ready(None),
328 }
329 }
330}
331
332#[derive(Debug)]
333pub enum ControlEvent {}
334
335impl ControlEvent {
336 fn decode(
338 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
339 ) -> Result<ControlEvent, fidl::Error> {
340 let (bytes, _handles) = buf.split_mut();
341 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
342 debug_assert_eq!(tx_header.tx_id, 0);
343 match tx_header.ordinal {
344 _ => Err(fidl::Error::UnknownOrdinal {
345 ordinal: tx_header.ordinal,
346 protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
347 }),
348 }
349 }
350}
351
352pub struct ControlRequestStream {
354 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
355 is_terminated: bool,
356}
357
358impl std::marker::Unpin for ControlRequestStream {}
359
360impl futures::stream::FusedStream for ControlRequestStream {
361 fn is_terminated(&self) -> bool {
362 self.is_terminated
363 }
364}
365
366impl fidl::endpoints::RequestStream for ControlRequestStream {
367 type Protocol = ControlMarker;
368 type ControlHandle = ControlControlHandle;
369
370 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
371 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
372 }
373
374 fn control_handle(&self) -> Self::ControlHandle {
375 ControlControlHandle { inner: self.inner.clone() }
376 }
377
378 fn into_inner(
379 self,
380 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
381 {
382 (self.inner, self.is_terminated)
383 }
384
385 fn from_inner(
386 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
387 is_terminated: bool,
388 ) -> Self {
389 Self { inner, is_terminated }
390 }
391}
392
393impl futures::Stream for ControlRequestStream {
394 type Item = Result<ControlRequest, fidl::Error>;
395
396 fn poll_next(
397 mut self: std::pin::Pin<&mut Self>,
398 cx: &mut std::task::Context<'_>,
399 ) -> std::task::Poll<Option<Self::Item>> {
400 let this = &mut *self;
401 if this.inner.check_shutdown(cx) {
402 this.is_terminated = true;
403 return std::task::Poll::Ready(None);
404 }
405 if this.is_terminated {
406 panic!("polled ControlRequestStream after completion");
407 }
408 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
409 |bytes, handles| {
410 match this.inner.channel().read_etc(cx, bytes, handles) {
411 std::task::Poll::Ready(Ok(())) => {}
412 std::task::Poll::Pending => return std::task::Poll::Pending,
413 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
414 this.is_terminated = true;
415 return std::task::Poll::Ready(None);
416 }
417 std::task::Poll::Ready(Err(e)) => {
418 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
419 e.into(),
420 ))));
421 }
422 }
423
424 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
426
427 std::task::Poll::Ready(Some(match header.ordinal {
428 0xbdaa66fbb4241a4 => {
429 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
430 let mut req = fidl::new_empty!(
431 ControlDisconnectIpRequest,
432 fidl::encoding::DefaultFuchsiaResourceDialect
433 );
434 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlDisconnectIpRequest>(&header, _body_bytes, handles, &mut req)?;
435 let control_handle = ControlControlHandle { inner: this.inner.clone() };
436 Ok(ControlRequest::DisconnectIp {
437 payload: req,
438 responder: ControlDisconnectIpResponder {
439 control_handle: std::mem::ManuallyDrop::new(control_handle),
440 tx_id: header.tx_id,
441 },
442 })
443 }
444 _ => Err(fidl::Error::UnknownOrdinal {
445 ordinal: header.ordinal,
446 protocol_name:
447 <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
448 }),
449 }))
450 },
451 )
452 }
453}
454
455#[derive(Debug)]
457pub enum ControlRequest {
458 DisconnectIp { payload: ControlDisconnectIpRequest, responder: ControlDisconnectIpResponder },
485}
486
487impl ControlRequest {
488 #[allow(irrefutable_let_patterns)]
489 pub fn into_disconnect_ip(
490 self,
491 ) -> Option<(ControlDisconnectIpRequest, ControlDisconnectIpResponder)> {
492 if let ControlRequest::DisconnectIp { payload, responder } = self {
493 Some((payload, responder))
494 } else {
495 None
496 }
497 }
498
499 pub fn method_name(&self) -> &'static str {
501 match *self {
502 ControlRequest::DisconnectIp { .. } => "disconnect_ip",
503 }
504 }
505}
506
507#[derive(Debug, Clone)]
508pub struct ControlControlHandle {
509 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
510}
511
512impl ControlControlHandle {
513 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
514 self.inner.shutdown_with_epitaph(status.into())
515 }
516}
517
518impl fidl::endpoints::ControlHandle for ControlControlHandle {
519 fn shutdown(&self) {
520 self.inner.shutdown()
521 }
522
523 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
524 self.inner.shutdown_with_epitaph(status)
525 }
526
527 fn is_closed(&self) -> bool {
528 self.inner.channel().is_closed()
529 }
530 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
531 self.inner.channel().on_closed()
532 }
533
534 #[cfg(target_os = "fuchsia")]
535 fn signal_peer(
536 &self,
537 clear_mask: zx::Signals,
538 set_mask: zx::Signals,
539 ) -> Result<(), zx_status::Status> {
540 use fidl::Peered;
541 self.inner.channel().signal_peer(clear_mask, set_mask)
542 }
543}
544
545impl ControlControlHandle {}
546
547#[must_use = "FIDL methods require a response to be sent"]
548#[derive(Debug)]
549pub struct ControlDisconnectIpResponder {
550 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
551 tx_id: u32,
552}
553
554impl std::ops::Drop for ControlDisconnectIpResponder {
558 fn drop(&mut self) {
559 self.control_handle.shutdown();
560 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
562 }
563}
564
565impl fidl::endpoints::Responder for ControlDisconnectIpResponder {
566 type ControlHandle = ControlControlHandle;
567
568 fn control_handle(&self) -> &ControlControlHandle {
569 &self.control_handle
570 }
571
572 fn drop_without_shutdown(mut self) {
573 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
575 std::mem::forget(self);
577 }
578}
579
580impl ControlDisconnectIpResponder {
581 pub fn send(self, mut payload: &DisconnectIpResult) -> Result<(), fidl::Error> {
585 let _result = self.send_raw(payload);
586 if _result.is_err() {
587 self.control_handle.shutdown();
588 }
589 self.drop_without_shutdown();
590 _result
591 }
592
593 pub fn send_no_shutdown_on_err(
595 self,
596 mut payload: &DisconnectIpResult,
597 ) -> Result<(), fidl::Error> {
598 let _result = self.send_raw(payload);
599 self.drop_without_shutdown();
600 _result
601 }
602
603 fn send_raw(&self, mut payload: &DisconnectIpResult) -> Result<(), fidl::Error> {
604 self.control_handle.inner.send::<DisconnectIpResult>(
605 payload,
606 self.tx_id,
607 0xbdaa66fbb4241a4,
608 fidl::encoding::DynamicFlags::empty(),
609 )
610 }
611}
612
613#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
614pub struct DestructionWatcherMarker;
615
616impl fidl::endpoints::ProtocolMarker for DestructionWatcherMarker {
617 type Proxy = DestructionWatcherProxy;
618 type RequestStream = DestructionWatcherRequestStream;
619 #[cfg(target_os = "fuchsia")]
620 type SynchronousProxy = DestructionWatcherSynchronousProxy;
621
622 const DEBUG_NAME: &'static str = "(anonymous) DestructionWatcher";
623}
624
625pub trait DestructionWatcherProxyInterface: Send + Sync {
626 type WatchResponseFut: std::future::Future<Output = Result<(Vec<IpSocketState>, u64), fidl::Error>>
627 + Send;
628 fn r#watch(&self) -> Self::WatchResponseFut;
629}
630#[derive(Debug)]
631#[cfg(target_os = "fuchsia")]
632pub struct DestructionWatcherSynchronousProxy {
633 client: fidl::client::sync::Client,
634}
635
636#[cfg(target_os = "fuchsia")]
637impl fidl::endpoints::SynchronousProxy for DestructionWatcherSynchronousProxy {
638 type Proxy = DestructionWatcherProxy;
639 type Protocol = DestructionWatcherMarker;
640
641 fn from_channel(inner: fidl::Channel) -> Self {
642 Self::new(inner)
643 }
644
645 fn into_channel(self) -> fidl::Channel {
646 self.client.into_channel()
647 }
648
649 fn as_channel(&self) -> &fidl::Channel {
650 self.client.as_channel()
651 }
652}
653
654#[cfg(target_os = "fuchsia")]
655impl DestructionWatcherSynchronousProxy {
656 pub fn new(channel: fidl::Channel) -> Self {
657 Self { client: fidl::client::sync::Client::new(channel) }
658 }
659
660 pub fn into_channel(self) -> fidl::Channel {
661 self.client.into_channel()
662 }
663
664 pub fn wait_for_event(
667 &self,
668 deadline: zx::MonotonicInstant,
669 ) -> Result<DestructionWatcherEvent, fidl::Error> {
670 DestructionWatcherEvent::decode(
671 self.client.wait_for_event::<DestructionWatcherMarker>(deadline)?,
672 )
673 }
674
675 pub fn r#watch(
694 &self,
695 ___deadline: zx::MonotonicInstant,
696 ) -> Result<(Vec<IpSocketState>, u64), fidl::Error> {
697 let _response = self.client.send_query::<
698 fidl::encoding::EmptyPayload,
699 DestructionWatcherWatchResponse,
700 DestructionWatcherMarker,
701 >(
702 (),
703 0x7ce86d7c39821f10,
704 fidl::encoding::DynamicFlags::empty(),
705 ___deadline,
706 )?;
707 Ok((_response.sockets, _response.dropped_events))
708 }
709}
710
711#[cfg(target_os = "fuchsia")]
712impl From<DestructionWatcherSynchronousProxy> for zx::NullableHandle {
713 fn from(value: DestructionWatcherSynchronousProxy) -> Self {
714 value.into_channel().into()
715 }
716}
717
718#[cfg(target_os = "fuchsia")]
719impl From<fidl::Channel> for DestructionWatcherSynchronousProxy {
720 fn from(value: fidl::Channel) -> Self {
721 Self::new(value)
722 }
723}
724
725#[cfg(target_os = "fuchsia")]
726impl fidl::endpoints::FromClient for DestructionWatcherSynchronousProxy {
727 type Protocol = DestructionWatcherMarker;
728
729 fn from_client(value: fidl::endpoints::ClientEnd<DestructionWatcherMarker>) -> Self {
730 Self::new(value.into_channel())
731 }
732}
733
734#[derive(Debug, Clone)]
735pub struct DestructionWatcherProxy {
736 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
737}
738
739impl fidl::endpoints::Proxy for DestructionWatcherProxy {
740 type Protocol = DestructionWatcherMarker;
741
742 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
743 Self::new(inner)
744 }
745
746 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
747 self.client.into_channel().map_err(|client| Self { client })
748 }
749
750 fn as_channel(&self) -> &::fidl::AsyncChannel {
751 self.client.as_channel()
752 }
753}
754
755impl DestructionWatcherProxy {
756 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
758 let protocol_name =
759 <DestructionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
760 Self { client: fidl::client::Client::new(channel, protocol_name) }
761 }
762
763 pub fn take_event_stream(&self) -> DestructionWatcherEventStream {
769 DestructionWatcherEventStream { event_receiver: self.client.take_event_receiver() }
770 }
771
772 pub fn r#watch(
791 &self,
792 ) -> fidl::client::QueryResponseFut<
793 (Vec<IpSocketState>, u64),
794 fidl::encoding::DefaultFuchsiaResourceDialect,
795 > {
796 DestructionWatcherProxyInterface::r#watch(self)
797 }
798}
799
800impl DestructionWatcherProxyInterface for DestructionWatcherProxy {
801 type WatchResponseFut = fidl::client::QueryResponseFut<
802 (Vec<IpSocketState>, u64),
803 fidl::encoding::DefaultFuchsiaResourceDialect,
804 >;
805 fn r#watch(&self) -> Self::WatchResponseFut {
806 fn _decode(
807 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
808 ) -> Result<(Vec<IpSocketState>, u64), fidl::Error> {
809 let _response = fidl::client::decode_transaction_body::<
810 DestructionWatcherWatchResponse,
811 fidl::encoding::DefaultFuchsiaResourceDialect,
812 0x7ce86d7c39821f10,
813 >(_buf?)?;
814 Ok((_response.sockets, _response.dropped_events))
815 }
816 self.client
817 .send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<IpSocketState>, u64)>(
818 (),
819 0x7ce86d7c39821f10,
820 fidl::encoding::DynamicFlags::empty(),
821 _decode,
822 )
823 }
824}
825
826pub struct DestructionWatcherEventStream {
827 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
828}
829
830impl std::marker::Unpin for DestructionWatcherEventStream {}
831
832impl futures::stream::FusedStream for DestructionWatcherEventStream {
833 fn is_terminated(&self) -> bool {
834 self.event_receiver.is_terminated()
835 }
836}
837
838impl futures::Stream for DestructionWatcherEventStream {
839 type Item = Result<DestructionWatcherEvent, fidl::Error>;
840
841 fn poll_next(
842 mut self: std::pin::Pin<&mut Self>,
843 cx: &mut std::task::Context<'_>,
844 ) -> std::task::Poll<Option<Self::Item>> {
845 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
846 &mut self.event_receiver,
847 cx
848 )?) {
849 Some(buf) => std::task::Poll::Ready(Some(DestructionWatcherEvent::decode(buf))),
850 None => std::task::Poll::Ready(None),
851 }
852 }
853}
854
855#[derive(Debug)]
856pub enum DestructionWatcherEvent {
857 #[non_exhaustive]
858 _UnknownEvent {
859 ordinal: u64,
861 },
862}
863
864impl DestructionWatcherEvent {
865 fn decode(
867 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
868 ) -> Result<DestructionWatcherEvent, fidl::Error> {
869 let (bytes, _handles) = buf.split_mut();
870 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
871 debug_assert_eq!(tx_header.tx_id, 0);
872 match tx_header.ordinal {
873 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
874 Ok(DestructionWatcherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
875 }
876 _ => Err(fidl::Error::UnknownOrdinal {
877 ordinal: tx_header.ordinal,
878 protocol_name:
879 <DestructionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
880 }),
881 }
882 }
883}
884
885pub struct DestructionWatcherRequestStream {
887 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
888 is_terminated: bool,
889}
890
891impl std::marker::Unpin for DestructionWatcherRequestStream {}
892
893impl futures::stream::FusedStream for DestructionWatcherRequestStream {
894 fn is_terminated(&self) -> bool {
895 self.is_terminated
896 }
897}
898
899impl fidl::endpoints::RequestStream for DestructionWatcherRequestStream {
900 type Protocol = DestructionWatcherMarker;
901 type ControlHandle = DestructionWatcherControlHandle;
902
903 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
904 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
905 }
906
907 fn control_handle(&self) -> Self::ControlHandle {
908 DestructionWatcherControlHandle { inner: self.inner.clone() }
909 }
910
911 fn into_inner(
912 self,
913 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
914 {
915 (self.inner, self.is_terminated)
916 }
917
918 fn from_inner(
919 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
920 is_terminated: bool,
921 ) -> Self {
922 Self { inner, is_terminated }
923 }
924}
925
926impl futures::Stream for DestructionWatcherRequestStream {
927 type Item = Result<DestructionWatcherRequest, fidl::Error>;
928
929 fn poll_next(
930 mut self: std::pin::Pin<&mut Self>,
931 cx: &mut std::task::Context<'_>,
932 ) -> std::task::Poll<Option<Self::Item>> {
933 let this = &mut *self;
934 if this.inner.check_shutdown(cx) {
935 this.is_terminated = true;
936 return std::task::Poll::Ready(None);
937 }
938 if this.is_terminated {
939 panic!("polled DestructionWatcherRequestStream after completion");
940 }
941 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
942 |bytes, handles| {
943 match this.inner.channel().read_etc(cx, bytes, handles) {
944 std::task::Poll::Ready(Ok(())) => {}
945 std::task::Poll::Pending => return std::task::Poll::Pending,
946 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
947 this.is_terminated = true;
948 return std::task::Poll::Ready(None);
949 }
950 std::task::Poll::Ready(Err(e)) => {
951 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
952 e.into(),
953 ))));
954 }
955 }
956
957 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
959
960 std::task::Poll::Ready(Some(match header.ordinal {
961 0x7ce86d7c39821f10 => {
962 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
963 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
964 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
965 let control_handle = DestructionWatcherControlHandle {
966 inner: this.inner.clone(),
967 };
968 Ok(DestructionWatcherRequest::Watch {
969 responder: DestructionWatcherWatchResponder {
970 control_handle: std::mem::ManuallyDrop::new(control_handle),
971 tx_id: header.tx_id,
972 },
973 })
974 }
975 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
976 Ok(DestructionWatcherRequest::_UnknownMethod {
977 ordinal: header.ordinal,
978 control_handle: DestructionWatcherControlHandle { inner: this.inner.clone() },
979 method_type: fidl::MethodType::OneWay,
980 })
981 }
982 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
983 this.inner.send_framework_err(
984 fidl::encoding::FrameworkErr::UnknownMethod,
985 header.tx_id,
986 header.ordinal,
987 header.dynamic_flags(),
988 (bytes, handles),
989 )?;
990 Ok(DestructionWatcherRequest::_UnknownMethod {
991 ordinal: header.ordinal,
992 control_handle: DestructionWatcherControlHandle { inner: this.inner.clone() },
993 method_type: fidl::MethodType::TwoWay,
994 })
995 }
996 _ => Err(fidl::Error::UnknownOrdinal {
997 ordinal: header.ordinal,
998 protocol_name: <DestructionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
999 }),
1000 }))
1001 },
1002 )
1003 }
1004}
1005
1006#[derive(Debug)]
1008pub enum DestructionWatcherRequest {
1009 Watch { responder: DestructionWatcherWatchResponder },
1028 #[non_exhaustive]
1030 _UnknownMethod {
1031 ordinal: u64,
1033 control_handle: DestructionWatcherControlHandle,
1034 method_type: fidl::MethodType,
1035 },
1036}
1037
1038impl DestructionWatcherRequest {
1039 #[allow(irrefutable_let_patterns)]
1040 pub fn into_watch(self) -> Option<(DestructionWatcherWatchResponder)> {
1041 if let DestructionWatcherRequest::Watch { responder } = self {
1042 Some((responder))
1043 } else {
1044 None
1045 }
1046 }
1047
1048 pub fn method_name(&self) -> &'static str {
1050 match *self {
1051 DestructionWatcherRequest::Watch { .. } => "watch",
1052 DestructionWatcherRequest::_UnknownMethod {
1053 method_type: fidl::MethodType::OneWay,
1054 ..
1055 } => "unknown one-way method",
1056 DestructionWatcherRequest::_UnknownMethod {
1057 method_type: fidl::MethodType::TwoWay,
1058 ..
1059 } => "unknown two-way method",
1060 }
1061 }
1062}
1063
1064#[derive(Debug, Clone)]
1065pub struct DestructionWatcherControlHandle {
1066 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1067}
1068
1069impl DestructionWatcherControlHandle {
1070 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1071 self.inner.shutdown_with_epitaph(status.into())
1072 }
1073}
1074
1075impl fidl::endpoints::ControlHandle for DestructionWatcherControlHandle {
1076 fn shutdown(&self) {
1077 self.inner.shutdown()
1078 }
1079
1080 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1081 self.inner.shutdown_with_epitaph(status)
1082 }
1083
1084 fn is_closed(&self) -> bool {
1085 self.inner.channel().is_closed()
1086 }
1087 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1088 self.inner.channel().on_closed()
1089 }
1090
1091 #[cfg(target_os = "fuchsia")]
1092 fn signal_peer(
1093 &self,
1094 clear_mask: zx::Signals,
1095 set_mask: zx::Signals,
1096 ) -> Result<(), zx_status::Status> {
1097 use fidl::Peered;
1098 self.inner.channel().signal_peer(clear_mask, set_mask)
1099 }
1100}
1101
1102impl DestructionWatcherControlHandle {}
1103
1104#[must_use = "FIDL methods require a response to be sent"]
1105#[derive(Debug)]
1106pub struct DestructionWatcherWatchResponder {
1107 control_handle: std::mem::ManuallyDrop<DestructionWatcherControlHandle>,
1108 tx_id: u32,
1109}
1110
1111impl std::ops::Drop for DestructionWatcherWatchResponder {
1115 fn drop(&mut self) {
1116 self.control_handle.shutdown();
1117 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1119 }
1120}
1121
1122impl fidl::endpoints::Responder for DestructionWatcherWatchResponder {
1123 type ControlHandle = DestructionWatcherControlHandle;
1124
1125 fn control_handle(&self) -> &DestructionWatcherControlHandle {
1126 &self.control_handle
1127 }
1128
1129 fn drop_without_shutdown(mut self) {
1130 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1132 std::mem::forget(self);
1134 }
1135}
1136
1137impl DestructionWatcherWatchResponder {
1138 pub fn send(
1142 self,
1143 mut sockets: &[IpSocketState],
1144 mut dropped_events: u64,
1145 ) -> Result<(), fidl::Error> {
1146 let _result = self.send_raw(sockets, dropped_events);
1147 if _result.is_err() {
1148 self.control_handle.shutdown();
1149 }
1150 self.drop_without_shutdown();
1151 _result
1152 }
1153
1154 pub fn send_no_shutdown_on_err(
1156 self,
1157 mut sockets: &[IpSocketState],
1158 mut dropped_events: u64,
1159 ) -> Result<(), fidl::Error> {
1160 let _result = self.send_raw(sockets, dropped_events);
1161 self.drop_without_shutdown();
1162 _result
1163 }
1164
1165 fn send_raw(
1166 &self,
1167 mut sockets: &[IpSocketState],
1168 mut dropped_events: u64,
1169 ) -> Result<(), fidl::Error> {
1170 self.control_handle.inner.send::<DestructionWatcherWatchResponse>(
1171 (sockets, dropped_events),
1172 self.tx_id,
1173 0x7ce86d7c39821f10,
1174 fidl::encoding::DynamicFlags::empty(),
1175 )
1176 }
1177}
1178
1179#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1180pub struct DiagnosticsMarker;
1181
1182impl fidl::endpoints::ProtocolMarker for DiagnosticsMarker {
1183 type Proxy = DiagnosticsProxy;
1184 type RequestStream = DiagnosticsRequestStream;
1185 #[cfg(target_os = "fuchsia")]
1186 type SynchronousProxy = DiagnosticsSynchronousProxy;
1187
1188 const DEBUG_NAME: &'static str = "fuchsia.net.sockets.Diagnostics";
1189}
1190impl fidl::endpoints::DiscoverableProtocolMarker for DiagnosticsMarker {}
1191
1192pub trait DiagnosticsProxyInterface: Send + Sync {
1193 type IterateIpResponseFut: std::future::Future<Output = Result<IterateIpResult, fidl::Error>>
1194 + Send;
1195 fn r#iterate_ip(
1196 &self,
1197 s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
1198 extensions: Extensions,
1199 matchers: &[IpSocketMatcher],
1200 ) -> Self::IterateIpResponseFut;
1201 type GetDestructionWatcherResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1202 + Send;
1203 fn r#get_destruction_watcher(
1204 &self,
1205 watcher: fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
1206 ) -> Self::GetDestructionWatcherResponseFut;
1207}
1208#[derive(Debug)]
1209#[cfg(target_os = "fuchsia")]
1210pub struct DiagnosticsSynchronousProxy {
1211 client: fidl::client::sync::Client,
1212}
1213
1214#[cfg(target_os = "fuchsia")]
1215impl fidl::endpoints::SynchronousProxy for DiagnosticsSynchronousProxy {
1216 type Proxy = DiagnosticsProxy;
1217 type Protocol = DiagnosticsMarker;
1218
1219 fn from_channel(inner: fidl::Channel) -> Self {
1220 Self::new(inner)
1221 }
1222
1223 fn into_channel(self) -> fidl::Channel {
1224 self.client.into_channel()
1225 }
1226
1227 fn as_channel(&self) -> &fidl::Channel {
1228 self.client.as_channel()
1229 }
1230}
1231
1232#[cfg(target_os = "fuchsia")]
1233impl DiagnosticsSynchronousProxy {
1234 pub fn new(channel: fidl::Channel) -> Self {
1235 Self { client: fidl::client::sync::Client::new(channel) }
1236 }
1237
1238 pub fn into_channel(self) -> fidl::Channel {
1239 self.client.into_channel()
1240 }
1241
1242 pub fn wait_for_event(
1245 &self,
1246 deadline: zx::MonotonicInstant,
1247 ) -> Result<DiagnosticsEvent, fidl::Error> {
1248 DiagnosticsEvent::decode(self.client.wait_for_event::<DiagnosticsMarker>(deadline)?)
1249 }
1250
1251 pub fn r#iterate_ip(
1256 &self,
1257 mut s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
1258 mut extensions: Extensions,
1259 mut matchers: &[IpSocketMatcher],
1260 ___deadline: zx::MonotonicInstant,
1261 ) -> Result<IterateIpResult, fidl::Error> {
1262 let _response = self
1263 .client
1264 .send_query::<DiagnosticsIterateIpRequest, IterateIpResult, DiagnosticsMarker>(
1265 (s, extensions, matchers),
1266 0x7b05425e48d07605,
1267 fidl::encoding::DynamicFlags::empty(),
1268 ___deadline,
1269 )?;
1270 Ok(_response)
1271 }
1272
1273 pub fn r#get_destruction_watcher(
1277 &self,
1278 mut watcher: fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
1279 ___deadline: zx::MonotonicInstant,
1280 ) -> Result<(), fidl::Error> {
1281 let _response = self.client.send_query::<
1282 DiagnosticsGetDestructionWatcherRequest,
1283 fidl::encoding::EmptyPayload,
1284 DiagnosticsMarker,
1285 >(
1286 (watcher,),
1287 0x4b5d70a35a21964f,
1288 fidl::encoding::DynamicFlags::empty(),
1289 ___deadline,
1290 )?;
1291 Ok(_response)
1292 }
1293}
1294
1295#[cfg(target_os = "fuchsia")]
1296impl From<DiagnosticsSynchronousProxy> for zx::NullableHandle {
1297 fn from(value: DiagnosticsSynchronousProxy) -> Self {
1298 value.into_channel().into()
1299 }
1300}
1301
1302#[cfg(target_os = "fuchsia")]
1303impl From<fidl::Channel> for DiagnosticsSynchronousProxy {
1304 fn from(value: fidl::Channel) -> Self {
1305 Self::new(value)
1306 }
1307}
1308
1309#[cfg(target_os = "fuchsia")]
1310impl fidl::endpoints::FromClient for DiagnosticsSynchronousProxy {
1311 type Protocol = DiagnosticsMarker;
1312
1313 fn from_client(value: fidl::endpoints::ClientEnd<DiagnosticsMarker>) -> Self {
1314 Self::new(value.into_channel())
1315 }
1316}
1317
1318#[derive(Debug, Clone)]
1319pub struct DiagnosticsProxy {
1320 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1321}
1322
1323impl fidl::endpoints::Proxy for DiagnosticsProxy {
1324 type Protocol = DiagnosticsMarker;
1325
1326 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1327 Self::new(inner)
1328 }
1329
1330 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1331 self.client.into_channel().map_err(|client| Self { client })
1332 }
1333
1334 fn as_channel(&self) -> &::fidl::AsyncChannel {
1335 self.client.as_channel()
1336 }
1337}
1338
1339impl DiagnosticsProxy {
1340 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1342 let protocol_name = <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1343 Self { client: fidl::client::Client::new(channel, protocol_name) }
1344 }
1345
1346 pub fn take_event_stream(&self) -> DiagnosticsEventStream {
1352 DiagnosticsEventStream { event_receiver: self.client.take_event_receiver() }
1353 }
1354
1355 pub fn r#iterate_ip(
1360 &self,
1361 mut s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
1362 mut extensions: Extensions,
1363 mut matchers: &[IpSocketMatcher],
1364 ) -> fidl::client::QueryResponseFut<
1365 IterateIpResult,
1366 fidl::encoding::DefaultFuchsiaResourceDialect,
1367 > {
1368 DiagnosticsProxyInterface::r#iterate_ip(self, s, extensions, matchers)
1369 }
1370
1371 pub fn r#get_destruction_watcher(
1375 &self,
1376 mut watcher: fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
1377 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1378 DiagnosticsProxyInterface::r#get_destruction_watcher(self, watcher)
1379 }
1380}
1381
1382impl DiagnosticsProxyInterface for DiagnosticsProxy {
1383 type IterateIpResponseFut = fidl::client::QueryResponseFut<
1384 IterateIpResult,
1385 fidl::encoding::DefaultFuchsiaResourceDialect,
1386 >;
1387 fn r#iterate_ip(
1388 &self,
1389 mut s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
1390 mut extensions: Extensions,
1391 mut matchers: &[IpSocketMatcher],
1392 ) -> Self::IterateIpResponseFut {
1393 fn _decode(
1394 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1395 ) -> Result<IterateIpResult, fidl::Error> {
1396 let _response = fidl::client::decode_transaction_body::<
1397 IterateIpResult,
1398 fidl::encoding::DefaultFuchsiaResourceDialect,
1399 0x7b05425e48d07605,
1400 >(_buf?)?;
1401 Ok(_response)
1402 }
1403 self.client.send_query_and_decode::<DiagnosticsIterateIpRequest, IterateIpResult>(
1404 (s, extensions, matchers),
1405 0x7b05425e48d07605,
1406 fidl::encoding::DynamicFlags::empty(),
1407 _decode,
1408 )
1409 }
1410
1411 type GetDestructionWatcherResponseFut =
1412 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1413 fn r#get_destruction_watcher(
1414 &self,
1415 mut watcher: fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
1416 ) -> Self::GetDestructionWatcherResponseFut {
1417 fn _decode(
1418 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1419 ) -> Result<(), fidl::Error> {
1420 let _response = fidl::client::decode_transaction_body::<
1421 fidl::encoding::EmptyPayload,
1422 fidl::encoding::DefaultFuchsiaResourceDialect,
1423 0x4b5d70a35a21964f,
1424 >(_buf?)?;
1425 Ok(_response)
1426 }
1427 self.client.send_query_and_decode::<DiagnosticsGetDestructionWatcherRequest, ()>(
1428 (watcher,),
1429 0x4b5d70a35a21964f,
1430 fidl::encoding::DynamicFlags::empty(),
1431 _decode,
1432 )
1433 }
1434}
1435
1436pub struct DiagnosticsEventStream {
1437 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1438}
1439
1440impl std::marker::Unpin for DiagnosticsEventStream {}
1441
1442impl futures::stream::FusedStream for DiagnosticsEventStream {
1443 fn is_terminated(&self) -> bool {
1444 self.event_receiver.is_terminated()
1445 }
1446}
1447
1448impl futures::Stream for DiagnosticsEventStream {
1449 type Item = Result<DiagnosticsEvent, fidl::Error>;
1450
1451 fn poll_next(
1452 mut self: std::pin::Pin<&mut Self>,
1453 cx: &mut std::task::Context<'_>,
1454 ) -> std::task::Poll<Option<Self::Item>> {
1455 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1456 &mut self.event_receiver,
1457 cx
1458 )?) {
1459 Some(buf) => std::task::Poll::Ready(Some(DiagnosticsEvent::decode(buf))),
1460 None => std::task::Poll::Ready(None),
1461 }
1462 }
1463}
1464
1465#[derive(Debug)]
1466pub enum DiagnosticsEvent {}
1467
1468impl DiagnosticsEvent {
1469 fn decode(
1471 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1472 ) -> Result<DiagnosticsEvent, fidl::Error> {
1473 let (bytes, _handles) = buf.split_mut();
1474 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1475 debug_assert_eq!(tx_header.tx_id, 0);
1476 match tx_header.ordinal {
1477 _ => Err(fidl::Error::UnknownOrdinal {
1478 ordinal: tx_header.ordinal,
1479 protocol_name: <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1480 }),
1481 }
1482 }
1483}
1484
1485pub struct DiagnosticsRequestStream {
1487 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1488 is_terminated: bool,
1489}
1490
1491impl std::marker::Unpin for DiagnosticsRequestStream {}
1492
1493impl futures::stream::FusedStream for DiagnosticsRequestStream {
1494 fn is_terminated(&self) -> bool {
1495 self.is_terminated
1496 }
1497}
1498
1499impl fidl::endpoints::RequestStream for DiagnosticsRequestStream {
1500 type Protocol = DiagnosticsMarker;
1501 type ControlHandle = DiagnosticsControlHandle;
1502
1503 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1504 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1505 }
1506
1507 fn control_handle(&self) -> Self::ControlHandle {
1508 DiagnosticsControlHandle { inner: self.inner.clone() }
1509 }
1510
1511 fn into_inner(
1512 self,
1513 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1514 {
1515 (self.inner, self.is_terminated)
1516 }
1517
1518 fn from_inner(
1519 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1520 is_terminated: bool,
1521 ) -> Self {
1522 Self { inner, is_terminated }
1523 }
1524}
1525
1526impl futures::Stream for DiagnosticsRequestStream {
1527 type Item = Result<DiagnosticsRequest, fidl::Error>;
1528
1529 fn poll_next(
1530 mut self: std::pin::Pin<&mut Self>,
1531 cx: &mut std::task::Context<'_>,
1532 ) -> std::task::Poll<Option<Self::Item>> {
1533 let this = &mut *self;
1534 if this.inner.check_shutdown(cx) {
1535 this.is_terminated = true;
1536 return std::task::Poll::Ready(None);
1537 }
1538 if this.is_terminated {
1539 panic!("polled DiagnosticsRequestStream after completion");
1540 }
1541 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1542 |bytes, handles| {
1543 match this.inner.channel().read_etc(cx, bytes, handles) {
1544 std::task::Poll::Ready(Ok(())) => {}
1545 std::task::Poll::Pending => return std::task::Poll::Pending,
1546 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1547 this.is_terminated = true;
1548 return std::task::Poll::Ready(None);
1549 }
1550 std::task::Poll::Ready(Err(e)) => {
1551 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1552 e.into(),
1553 ))));
1554 }
1555 }
1556
1557 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1559
1560 std::task::Poll::Ready(Some(match header.ordinal {
1561 0x7b05425e48d07605 => {
1562 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1563 let mut req = fidl::new_empty!(
1564 DiagnosticsIterateIpRequest,
1565 fidl::encoding::DefaultFuchsiaResourceDialect
1566 );
1567 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiagnosticsIterateIpRequest>(&header, _body_bytes, handles, &mut req)?;
1568 let control_handle = DiagnosticsControlHandle { inner: this.inner.clone() };
1569 Ok(DiagnosticsRequest::IterateIp {
1570 s: req.s,
1571 extensions: req.extensions,
1572 matchers: req.matchers,
1573
1574 responder: DiagnosticsIterateIpResponder {
1575 control_handle: std::mem::ManuallyDrop::new(control_handle),
1576 tx_id: header.tx_id,
1577 },
1578 })
1579 }
1580 0x4b5d70a35a21964f => {
1581 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1582 let mut req = fidl::new_empty!(
1583 DiagnosticsGetDestructionWatcherRequest,
1584 fidl::encoding::DefaultFuchsiaResourceDialect
1585 );
1586 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiagnosticsGetDestructionWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
1587 let control_handle = DiagnosticsControlHandle { inner: this.inner.clone() };
1588 Ok(DiagnosticsRequest::GetDestructionWatcher {
1589 watcher: req.watcher,
1590
1591 responder: DiagnosticsGetDestructionWatcherResponder {
1592 control_handle: std::mem::ManuallyDrop::new(control_handle),
1593 tx_id: header.tx_id,
1594 },
1595 })
1596 }
1597 _ => Err(fidl::Error::UnknownOrdinal {
1598 ordinal: header.ordinal,
1599 protocol_name:
1600 <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1601 }),
1602 }))
1603 },
1604 )
1605 }
1606}
1607
1608#[derive(Debug)]
1610pub enum DiagnosticsRequest {
1611 IterateIp {
1616 s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
1617 extensions: Extensions,
1618 matchers: Vec<IpSocketMatcher>,
1619 responder: DiagnosticsIterateIpResponder,
1620 },
1621 GetDestructionWatcher {
1625 watcher: fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
1626 responder: DiagnosticsGetDestructionWatcherResponder,
1627 },
1628}
1629
1630impl DiagnosticsRequest {
1631 #[allow(irrefutable_let_patterns)]
1632 pub fn into_iterate_ip(
1633 self,
1634 ) -> Option<(
1635 fidl::endpoints::ServerEnd<IpIteratorMarker>,
1636 Extensions,
1637 Vec<IpSocketMatcher>,
1638 DiagnosticsIterateIpResponder,
1639 )> {
1640 if let DiagnosticsRequest::IterateIp { s, extensions, matchers, responder } = self {
1641 Some((s, extensions, matchers, responder))
1642 } else {
1643 None
1644 }
1645 }
1646
1647 #[allow(irrefutable_let_patterns)]
1648 pub fn into_get_destruction_watcher(
1649 self,
1650 ) -> Option<(
1651 fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
1652 DiagnosticsGetDestructionWatcherResponder,
1653 )> {
1654 if let DiagnosticsRequest::GetDestructionWatcher { watcher, responder } = self {
1655 Some((watcher, responder))
1656 } else {
1657 None
1658 }
1659 }
1660
1661 pub fn method_name(&self) -> &'static str {
1663 match *self {
1664 DiagnosticsRequest::IterateIp { .. } => "iterate_ip",
1665 DiagnosticsRequest::GetDestructionWatcher { .. } => "get_destruction_watcher",
1666 }
1667 }
1668}
1669
1670#[derive(Debug, Clone)]
1671pub struct DiagnosticsControlHandle {
1672 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1673}
1674
1675impl DiagnosticsControlHandle {
1676 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1677 self.inner.shutdown_with_epitaph(status.into())
1678 }
1679}
1680
1681impl fidl::endpoints::ControlHandle for DiagnosticsControlHandle {
1682 fn shutdown(&self) {
1683 self.inner.shutdown()
1684 }
1685
1686 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1687 self.inner.shutdown_with_epitaph(status)
1688 }
1689
1690 fn is_closed(&self) -> bool {
1691 self.inner.channel().is_closed()
1692 }
1693 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1694 self.inner.channel().on_closed()
1695 }
1696
1697 #[cfg(target_os = "fuchsia")]
1698 fn signal_peer(
1699 &self,
1700 clear_mask: zx::Signals,
1701 set_mask: zx::Signals,
1702 ) -> Result<(), zx_status::Status> {
1703 use fidl::Peered;
1704 self.inner.channel().signal_peer(clear_mask, set_mask)
1705 }
1706}
1707
1708impl DiagnosticsControlHandle {}
1709
1710#[must_use = "FIDL methods require a response to be sent"]
1711#[derive(Debug)]
1712pub struct DiagnosticsIterateIpResponder {
1713 control_handle: std::mem::ManuallyDrop<DiagnosticsControlHandle>,
1714 tx_id: u32,
1715}
1716
1717impl std::ops::Drop for DiagnosticsIterateIpResponder {
1721 fn drop(&mut self) {
1722 self.control_handle.shutdown();
1723 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1725 }
1726}
1727
1728impl fidl::endpoints::Responder for DiagnosticsIterateIpResponder {
1729 type ControlHandle = DiagnosticsControlHandle;
1730
1731 fn control_handle(&self) -> &DiagnosticsControlHandle {
1732 &self.control_handle
1733 }
1734
1735 fn drop_without_shutdown(mut self) {
1736 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1738 std::mem::forget(self);
1740 }
1741}
1742
1743impl DiagnosticsIterateIpResponder {
1744 pub fn send(self, mut payload: &IterateIpResult) -> Result<(), fidl::Error> {
1748 let _result = self.send_raw(payload);
1749 if _result.is_err() {
1750 self.control_handle.shutdown();
1751 }
1752 self.drop_without_shutdown();
1753 _result
1754 }
1755
1756 pub fn send_no_shutdown_on_err(self, mut payload: &IterateIpResult) -> Result<(), fidl::Error> {
1758 let _result = self.send_raw(payload);
1759 self.drop_without_shutdown();
1760 _result
1761 }
1762
1763 fn send_raw(&self, mut payload: &IterateIpResult) -> Result<(), fidl::Error> {
1764 self.control_handle.inner.send::<IterateIpResult>(
1765 payload,
1766 self.tx_id,
1767 0x7b05425e48d07605,
1768 fidl::encoding::DynamicFlags::empty(),
1769 )
1770 }
1771}
1772
1773#[must_use = "FIDL methods require a response to be sent"]
1774#[derive(Debug)]
1775pub struct DiagnosticsGetDestructionWatcherResponder {
1776 control_handle: std::mem::ManuallyDrop<DiagnosticsControlHandle>,
1777 tx_id: u32,
1778}
1779
1780impl std::ops::Drop for DiagnosticsGetDestructionWatcherResponder {
1784 fn drop(&mut self) {
1785 self.control_handle.shutdown();
1786 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1788 }
1789}
1790
1791impl fidl::endpoints::Responder for DiagnosticsGetDestructionWatcherResponder {
1792 type ControlHandle = DiagnosticsControlHandle;
1793
1794 fn control_handle(&self) -> &DiagnosticsControlHandle {
1795 &self.control_handle
1796 }
1797
1798 fn drop_without_shutdown(mut self) {
1799 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1801 std::mem::forget(self);
1803 }
1804}
1805
1806impl DiagnosticsGetDestructionWatcherResponder {
1807 pub fn send(self) -> Result<(), fidl::Error> {
1811 let _result = self.send_raw();
1812 if _result.is_err() {
1813 self.control_handle.shutdown();
1814 }
1815 self.drop_without_shutdown();
1816 _result
1817 }
1818
1819 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1821 let _result = self.send_raw();
1822 self.drop_without_shutdown();
1823 _result
1824 }
1825
1826 fn send_raw(&self) -> Result<(), fidl::Error> {
1827 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1828 (),
1829 self.tx_id,
1830 0x4b5d70a35a21964f,
1831 fidl::encoding::DynamicFlags::empty(),
1832 )
1833 }
1834}
1835
1836#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1837pub struct IpIteratorMarker;
1838
1839impl fidl::endpoints::ProtocolMarker for IpIteratorMarker {
1840 type Proxy = IpIteratorProxy;
1841 type RequestStream = IpIteratorRequestStream;
1842 #[cfg(target_os = "fuchsia")]
1843 type SynchronousProxy = IpIteratorSynchronousProxy;
1844
1845 const DEBUG_NAME: &'static str = "(anonymous) IpIterator";
1846}
1847
1848pub trait IpIteratorProxyInterface: Send + Sync {
1849 type NextResponseFut: std::future::Future<Output = Result<(Vec<IpSocketState>, bool), fidl::Error>>
1850 + Send;
1851 fn r#next(&self) -> Self::NextResponseFut;
1852}
1853#[derive(Debug)]
1854#[cfg(target_os = "fuchsia")]
1855pub struct IpIteratorSynchronousProxy {
1856 client: fidl::client::sync::Client,
1857}
1858
1859#[cfg(target_os = "fuchsia")]
1860impl fidl::endpoints::SynchronousProxy for IpIteratorSynchronousProxy {
1861 type Proxy = IpIteratorProxy;
1862 type Protocol = IpIteratorMarker;
1863
1864 fn from_channel(inner: fidl::Channel) -> Self {
1865 Self::new(inner)
1866 }
1867
1868 fn into_channel(self) -> fidl::Channel {
1869 self.client.into_channel()
1870 }
1871
1872 fn as_channel(&self) -> &fidl::Channel {
1873 self.client.as_channel()
1874 }
1875}
1876
1877#[cfg(target_os = "fuchsia")]
1878impl IpIteratorSynchronousProxy {
1879 pub fn new(channel: fidl::Channel) -> Self {
1880 Self { client: fidl::client::sync::Client::new(channel) }
1881 }
1882
1883 pub fn into_channel(self) -> fidl::Channel {
1884 self.client.into_channel()
1885 }
1886
1887 pub fn wait_for_event(
1890 &self,
1891 deadline: zx::MonotonicInstant,
1892 ) -> Result<IpIteratorEvent, fidl::Error> {
1893 IpIteratorEvent::decode(self.client.wait_for_event::<IpIteratorMarker>(deadline)?)
1894 }
1895
1896 pub fn r#next(
1908 &self,
1909 ___deadline: zx::MonotonicInstant,
1910 ) -> Result<(Vec<IpSocketState>, bool), fidl::Error> {
1911 let _response = self
1912 .client
1913 .send_query::<fidl::encoding::EmptyPayload, IpIteratorNextResponse, IpIteratorMarker>(
1914 (),
1915 0x3d50aa08ce641a6b,
1916 fidl::encoding::DynamicFlags::empty(),
1917 ___deadline,
1918 )?;
1919 Ok((_response.sockets, _response.has_more))
1920 }
1921}
1922
1923#[cfg(target_os = "fuchsia")]
1924impl From<IpIteratorSynchronousProxy> for zx::NullableHandle {
1925 fn from(value: IpIteratorSynchronousProxy) -> Self {
1926 value.into_channel().into()
1927 }
1928}
1929
1930#[cfg(target_os = "fuchsia")]
1931impl From<fidl::Channel> for IpIteratorSynchronousProxy {
1932 fn from(value: fidl::Channel) -> Self {
1933 Self::new(value)
1934 }
1935}
1936
1937#[cfg(target_os = "fuchsia")]
1938impl fidl::endpoints::FromClient for IpIteratorSynchronousProxy {
1939 type Protocol = IpIteratorMarker;
1940
1941 fn from_client(value: fidl::endpoints::ClientEnd<IpIteratorMarker>) -> Self {
1942 Self::new(value.into_channel())
1943 }
1944}
1945
1946#[derive(Debug, Clone)]
1947pub struct IpIteratorProxy {
1948 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1949}
1950
1951impl fidl::endpoints::Proxy for IpIteratorProxy {
1952 type Protocol = IpIteratorMarker;
1953
1954 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1955 Self::new(inner)
1956 }
1957
1958 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1959 self.client.into_channel().map_err(|client| Self { client })
1960 }
1961
1962 fn as_channel(&self) -> &::fidl::AsyncChannel {
1963 self.client.as_channel()
1964 }
1965}
1966
1967impl IpIteratorProxy {
1968 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1970 let protocol_name = <IpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1971 Self { client: fidl::client::Client::new(channel, protocol_name) }
1972 }
1973
1974 pub fn take_event_stream(&self) -> IpIteratorEventStream {
1980 IpIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1981 }
1982
1983 pub fn r#next(
1995 &self,
1996 ) -> fidl::client::QueryResponseFut<
1997 (Vec<IpSocketState>, bool),
1998 fidl::encoding::DefaultFuchsiaResourceDialect,
1999 > {
2000 IpIteratorProxyInterface::r#next(self)
2001 }
2002}
2003
2004impl IpIteratorProxyInterface for IpIteratorProxy {
2005 type NextResponseFut = fidl::client::QueryResponseFut<
2006 (Vec<IpSocketState>, bool),
2007 fidl::encoding::DefaultFuchsiaResourceDialect,
2008 >;
2009 fn r#next(&self) -> Self::NextResponseFut {
2010 fn _decode(
2011 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2012 ) -> Result<(Vec<IpSocketState>, bool), fidl::Error> {
2013 let _response = fidl::client::decode_transaction_body::<
2014 IpIteratorNextResponse,
2015 fidl::encoding::DefaultFuchsiaResourceDialect,
2016 0x3d50aa08ce641a6b,
2017 >(_buf?)?;
2018 Ok((_response.sockets, _response.has_more))
2019 }
2020 self.client
2021 .send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<IpSocketState>, bool)>(
2022 (),
2023 0x3d50aa08ce641a6b,
2024 fidl::encoding::DynamicFlags::empty(),
2025 _decode,
2026 )
2027 }
2028}
2029
2030pub struct IpIteratorEventStream {
2031 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2032}
2033
2034impl std::marker::Unpin for IpIteratorEventStream {}
2035
2036impl futures::stream::FusedStream for IpIteratorEventStream {
2037 fn is_terminated(&self) -> bool {
2038 self.event_receiver.is_terminated()
2039 }
2040}
2041
2042impl futures::Stream for IpIteratorEventStream {
2043 type Item = Result<IpIteratorEvent, fidl::Error>;
2044
2045 fn poll_next(
2046 mut self: std::pin::Pin<&mut Self>,
2047 cx: &mut std::task::Context<'_>,
2048 ) -> std::task::Poll<Option<Self::Item>> {
2049 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2050 &mut self.event_receiver,
2051 cx
2052 )?) {
2053 Some(buf) => std::task::Poll::Ready(Some(IpIteratorEvent::decode(buf))),
2054 None => std::task::Poll::Ready(None),
2055 }
2056 }
2057}
2058
2059#[derive(Debug)]
2060pub enum IpIteratorEvent {
2061 #[non_exhaustive]
2062 _UnknownEvent {
2063 ordinal: u64,
2065 },
2066}
2067
2068impl IpIteratorEvent {
2069 fn decode(
2071 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2072 ) -> Result<IpIteratorEvent, fidl::Error> {
2073 let (bytes, _handles) = buf.split_mut();
2074 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2075 debug_assert_eq!(tx_header.tx_id, 0);
2076 match tx_header.ordinal {
2077 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2078 Ok(IpIteratorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2079 }
2080 _ => Err(fidl::Error::UnknownOrdinal {
2081 ordinal: tx_header.ordinal,
2082 protocol_name: <IpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2083 }),
2084 }
2085 }
2086}
2087
2088pub struct IpIteratorRequestStream {
2090 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2091 is_terminated: bool,
2092}
2093
2094impl std::marker::Unpin for IpIteratorRequestStream {}
2095
2096impl futures::stream::FusedStream for IpIteratorRequestStream {
2097 fn is_terminated(&self) -> bool {
2098 self.is_terminated
2099 }
2100}
2101
2102impl fidl::endpoints::RequestStream for IpIteratorRequestStream {
2103 type Protocol = IpIteratorMarker;
2104 type ControlHandle = IpIteratorControlHandle;
2105
2106 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2107 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2108 }
2109
2110 fn control_handle(&self) -> Self::ControlHandle {
2111 IpIteratorControlHandle { inner: self.inner.clone() }
2112 }
2113
2114 fn into_inner(
2115 self,
2116 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2117 {
2118 (self.inner, self.is_terminated)
2119 }
2120
2121 fn from_inner(
2122 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2123 is_terminated: bool,
2124 ) -> Self {
2125 Self { inner, is_terminated }
2126 }
2127}
2128
2129impl futures::Stream for IpIteratorRequestStream {
2130 type Item = Result<IpIteratorRequest, fidl::Error>;
2131
2132 fn poll_next(
2133 mut self: std::pin::Pin<&mut Self>,
2134 cx: &mut std::task::Context<'_>,
2135 ) -> std::task::Poll<Option<Self::Item>> {
2136 let this = &mut *self;
2137 if this.inner.check_shutdown(cx) {
2138 this.is_terminated = true;
2139 return std::task::Poll::Ready(None);
2140 }
2141 if this.is_terminated {
2142 panic!("polled IpIteratorRequestStream after completion");
2143 }
2144 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2145 |bytes, handles| {
2146 match this.inner.channel().read_etc(cx, bytes, handles) {
2147 std::task::Poll::Ready(Ok(())) => {}
2148 std::task::Poll::Pending => return std::task::Poll::Pending,
2149 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2150 this.is_terminated = true;
2151 return std::task::Poll::Ready(None);
2152 }
2153 std::task::Poll::Ready(Err(e)) => {
2154 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2155 e.into(),
2156 ))));
2157 }
2158 }
2159
2160 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2162
2163 std::task::Poll::Ready(Some(match header.ordinal {
2164 0x3d50aa08ce641a6b => {
2165 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2166 let mut req = fidl::new_empty!(
2167 fidl::encoding::EmptyPayload,
2168 fidl::encoding::DefaultFuchsiaResourceDialect
2169 );
2170 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2171 let control_handle = IpIteratorControlHandle { inner: this.inner.clone() };
2172 Ok(IpIteratorRequest::Next {
2173 responder: IpIteratorNextResponder {
2174 control_handle: std::mem::ManuallyDrop::new(control_handle),
2175 tx_id: header.tx_id,
2176 },
2177 })
2178 }
2179 _ if header.tx_id == 0
2180 && header
2181 .dynamic_flags()
2182 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2183 {
2184 Ok(IpIteratorRequest::_UnknownMethod {
2185 ordinal: header.ordinal,
2186 control_handle: IpIteratorControlHandle { inner: this.inner.clone() },
2187 method_type: fidl::MethodType::OneWay,
2188 })
2189 }
2190 _ if header
2191 .dynamic_flags()
2192 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2193 {
2194 this.inner.send_framework_err(
2195 fidl::encoding::FrameworkErr::UnknownMethod,
2196 header.tx_id,
2197 header.ordinal,
2198 header.dynamic_flags(),
2199 (bytes, handles),
2200 )?;
2201 Ok(IpIteratorRequest::_UnknownMethod {
2202 ordinal: header.ordinal,
2203 control_handle: IpIteratorControlHandle { inner: this.inner.clone() },
2204 method_type: fidl::MethodType::TwoWay,
2205 })
2206 }
2207 _ => Err(fidl::Error::UnknownOrdinal {
2208 ordinal: header.ordinal,
2209 protocol_name:
2210 <IpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2211 }),
2212 }))
2213 },
2214 )
2215 }
2216}
2217
2218#[derive(Debug)]
2220pub enum IpIteratorRequest {
2221 Next { responder: IpIteratorNextResponder },
2233 #[non_exhaustive]
2235 _UnknownMethod {
2236 ordinal: u64,
2238 control_handle: IpIteratorControlHandle,
2239 method_type: fidl::MethodType,
2240 },
2241}
2242
2243impl IpIteratorRequest {
2244 #[allow(irrefutable_let_patterns)]
2245 pub fn into_next(self) -> Option<(IpIteratorNextResponder)> {
2246 if let IpIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
2247 }
2248
2249 pub fn method_name(&self) -> &'static str {
2251 match *self {
2252 IpIteratorRequest::Next { .. } => "next",
2253 IpIteratorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2254 "unknown one-way method"
2255 }
2256 IpIteratorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2257 "unknown two-way method"
2258 }
2259 }
2260 }
2261}
2262
2263#[derive(Debug, Clone)]
2264pub struct IpIteratorControlHandle {
2265 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2266}
2267
2268impl IpIteratorControlHandle {
2269 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2270 self.inner.shutdown_with_epitaph(status.into())
2271 }
2272}
2273
2274impl fidl::endpoints::ControlHandle for IpIteratorControlHandle {
2275 fn shutdown(&self) {
2276 self.inner.shutdown()
2277 }
2278
2279 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2280 self.inner.shutdown_with_epitaph(status)
2281 }
2282
2283 fn is_closed(&self) -> bool {
2284 self.inner.channel().is_closed()
2285 }
2286 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2287 self.inner.channel().on_closed()
2288 }
2289
2290 #[cfg(target_os = "fuchsia")]
2291 fn signal_peer(
2292 &self,
2293 clear_mask: zx::Signals,
2294 set_mask: zx::Signals,
2295 ) -> Result<(), zx_status::Status> {
2296 use fidl::Peered;
2297 self.inner.channel().signal_peer(clear_mask, set_mask)
2298 }
2299}
2300
2301impl IpIteratorControlHandle {}
2302
2303#[must_use = "FIDL methods require a response to be sent"]
2304#[derive(Debug)]
2305pub struct IpIteratorNextResponder {
2306 control_handle: std::mem::ManuallyDrop<IpIteratorControlHandle>,
2307 tx_id: u32,
2308}
2309
2310impl std::ops::Drop for IpIteratorNextResponder {
2314 fn drop(&mut self) {
2315 self.control_handle.shutdown();
2316 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2318 }
2319}
2320
2321impl fidl::endpoints::Responder for IpIteratorNextResponder {
2322 type ControlHandle = IpIteratorControlHandle;
2323
2324 fn control_handle(&self) -> &IpIteratorControlHandle {
2325 &self.control_handle
2326 }
2327
2328 fn drop_without_shutdown(mut self) {
2329 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2331 std::mem::forget(self);
2333 }
2334}
2335
2336impl IpIteratorNextResponder {
2337 pub fn send(
2341 self,
2342 mut sockets: &[IpSocketState],
2343 mut has_more: bool,
2344 ) -> Result<(), fidl::Error> {
2345 let _result = self.send_raw(sockets, has_more);
2346 if _result.is_err() {
2347 self.control_handle.shutdown();
2348 }
2349 self.drop_without_shutdown();
2350 _result
2351 }
2352
2353 pub fn send_no_shutdown_on_err(
2355 self,
2356 mut sockets: &[IpSocketState],
2357 mut has_more: bool,
2358 ) -> Result<(), fidl::Error> {
2359 let _result = self.send_raw(sockets, has_more);
2360 self.drop_without_shutdown();
2361 _result
2362 }
2363
2364 fn send_raw(
2365 &self,
2366 mut sockets: &[IpSocketState],
2367 mut has_more: bool,
2368 ) -> Result<(), fidl::Error> {
2369 self.control_handle.inner.send::<IpIteratorNextResponse>(
2370 (sockets, has_more),
2371 self.tx_id,
2372 0x3d50aa08ce641a6b,
2373 fidl::encoding::DynamicFlags::empty(),
2374 )
2375 }
2376}
2377
2378mod internal {
2379 use super::*;
2380
2381 impl fidl::encoding::ResourceTypeMarker for DiagnosticsGetDestructionWatcherRequest {
2382 type Borrowed<'a> = &'a mut Self;
2383 fn take_or_borrow<'a>(
2384 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2385 ) -> Self::Borrowed<'a> {
2386 value
2387 }
2388 }
2389
2390 unsafe impl fidl::encoding::TypeMarker for DiagnosticsGetDestructionWatcherRequest {
2391 type Owned = Self;
2392
2393 #[inline(always)]
2394 fn inline_align(_context: fidl::encoding::Context) -> usize {
2395 4
2396 }
2397
2398 #[inline(always)]
2399 fn inline_size(_context: fidl::encoding::Context) -> usize {
2400 4
2401 }
2402 }
2403
2404 unsafe impl
2405 fidl::encoding::Encode<
2406 DiagnosticsGetDestructionWatcherRequest,
2407 fidl::encoding::DefaultFuchsiaResourceDialect,
2408 > for &mut DiagnosticsGetDestructionWatcherRequest
2409 {
2410 #[inline]
2411 unsafe fn encode(
2412 self,
2413 encoder: &mut fidl::encoding::Encoder<
2414 '_,
2415 fidl::encoding::DefaultFuchsiaResourceDialect,
2416 >,
2417 offset: usize,
2418 _depth: fidl::encoding::Depth,
2419 ) -> fidl::Result<()> {
2420 encoder.debug_check_bounds::<DiagnosticsGetDestructionWatcherRequest>(offset);
2421 fidl::encoding::Encode::<DiagnosticsGetDestructionWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2423 (
2424 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DestructionWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
2425 ),
2426 encoder, offset, _depth
2427 )
2428 }
2429 }
2430 unsafe impl<
2431 T0: fidl::encoding::Encode<
2432 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DestructionWatcherMarker>>,
2433 fidl::encoding::DefaultFuchsiaResourceDialect,
2434 >,
2435 >
2436 fidl::encoding::Encode<
2437 DiagnosticsGetDestructionWatcherRequest,
2438 fidl::encoding::DefaultFuchsiaResourceDialect,
2439 > for (T0,)
2440 {
2441 #[inline]
2442 unsafe fn encode(
2443 self,
2444 encoder: &mut fidl::encoding::Encoder<
2445 '_,
2446 fidl::encoding::DefaultFuchsiaResourceDialect,
2447 >,
2448 offset: usize,
2449 depth: fidl::encoding::Depth,
2450 ) -> fidl::Result<()> {
2451 encoder.debug_check_bounds::<DiagnosticsGetDestructionWatcherRequest>(offset);
2452 self.0.encode(encoder, offset + 0, depth)?;
2456 Ok(())
2457 }
2458 }
2459
2460 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2461 for DiagnosticsGetDestructionWatcherRequest
2462 {
2463 #[inline(always)]
2464 fn new_empty() -> Self {
2465 Self {
2466 watcher: fidl::new_empty!(
2467 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DestructionWatcherMarker>>,
2468 fidl::encoding::DefaultFuchsiaResourceDialect
2469 ),
2470 }
2471 }
2472
2473 #[inline]
2474 unsafe fn decode(
2475 &mut self,
2476 decoder: &mut fidl::encoding::Decoder<
2477 '_,
2478 fidl::encoding::DefaultFuchsiaResourceDialect,
2479 >,
2480 offset: usize,
2481 _depth: fidl::encoding::Depth,
2482 ) -> fidl::Result<()> {
2483 decoder.debug_check_bounds::<Self>(offset);
2484 fidl::decode!(
2486 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DestructionWatcherMarker>>,
2487 fidl::encoding::DefaultFuchsiaResourceDialect,
2488 &mut self.watcher,
2489 decoder,
2490 offset + 0,
2491 _depth
2492 )?;
2493 Ok(())
2494 }
2495 }
2496
2497 impl fidl::encoding::ResourceTypeMarker for DiagnosticsIterateIpRequest {
2498 type Borrowed<'a> = &'a mut Self;
2499 fn take_or_borrow<'a>(
2500 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2501 ) -> Self::Borrowed<'a> {
2502 value
2503 }
2504 }
2505
2506 unsafe impl fidl::encoding::TypeMarker for DiagnosticsIterateIpRequest {
2507 type Owned = Self;
2508
2509 #[inline(always)]
2510 fn inline_align(_context: fidl::encoding::Context) -> usize {
2511 8
2512 }
2513
2514 #[inline(always)]
2515 fn inline_size(_context: fidl::encoding::Context) -> usize {
2516 24
2517 }
2518 }
2519
2520 unsafe impl
2521 fidl::encoding::Encode<
2522 DiagnosticsIterateIpRequest,
2523 fidl::encoding::DefaultFuchsiaResourceDialect,
2524 > for &mut DiagnosticsIterateIpRequest
2525 {
2526 #[inline]
2527 unsafe fn encode(
2528 self,
2529 encoder: &mut fidl::encoding::Encoder<
2530 '_,
2531 fidl::encoding::DefaultFuchsiaResourceDialect,
2532 >,
2533 offset: usize,
2534 _depth: fidl::encoding::Depth,
2535 ) -> fidl::Result<()> {
2536 encoder.debug_check_bounds::<DiagnosticsIterateIpRequest>(offset);
2537 fidl::encoding::Encode::<DiagnosticsIterateIpRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2539 (
2540 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IpIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.s),
2541 <Extensions as fidl::encoding::ValueTypeMarker>::borrow(&self.extensions),
2542 <fidl::encoding::Vector<IpSocketMatcher, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.matchers),
2543 ),
2544 encoder, offset, _depth
2545 )
2546 }
2547 }
2548 unsafe impl<
2549 T0: fidl::encoding::Encode<
2550 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IpIteratorMarker>>,
2551 fidl::encoding::DefaultFuchsiaResourceDialect,
2552 >,
2553 T1: fidl::encoding::Encode<Extensions, fidl::encoding::DefaultFuchsiaResourceDialect>,
2554 T2: fidl::encoding::Encode<
2555 fidl::encoding::Vector<IpSocketMatcher, 128>,
2556 fidl::encoding::DefaultFuchsiaResourceDialect,
2557 >,
2558 >
2559 fidl::encoding::Encode<
2560 DiagnosticsIterateIpRequest,
2561 fidl::encoding::DefaultFuchsiaResourceDialect,
2562 > for (T0, T1, T2)
2563 {
2564 #[inline]
2565 unsafe fn encode(
2566 self,
2567 encoder: &mut fidl::encoding::Encoder<
2568 '_,
2569 fidl::encoding::DefaultFuchsiaResourceDialect,
2570 >,
2571 offset: usize,
2572 depth: fidl::encoding::Depth,
2573 ) -> fidl::Result<()> {
2574 encoder.debug_check_bounds::<DiagnosticsIterateIpRequest>(offset);
2575 self.0.encode(encoder, offset + 0, depth)?;
2579 self.1.encode(encoder, offset + 4, depth)?;
2580 self.2.encode(encoder, offset + 8, depth)?;
2581 Ok(())
2582 }
2583 }
2584
2585 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2586 for DiagnosticsIterateIpRequest
2587 {
2588 #[inline(always)]
2589 fn new_empty() -> Self {
2590 Self {
2591 s: fidl::new_empty!(
2592 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IpIteratorMarker>>,
2593 fidl::encoding::DefaultFuchsiaResourceDialect
2594 ),
2595 extensions: fidl::new_empty!(
2596 Extensions,
2597 fidl::encoding::DefaultFuchsiaResourceDialect
2598 ),
2599 matchers: fidl::new_empty!(fidl::encoding::Vector<IpSocketMatcher, 128>, fidl::encoding::DefaultFuchsiaResourceDialect),
2600 }
2601 }
2602
2603 #[inline]
2604 unsafe fn decode(
2605 &mut self,
2606 decoder: &mut fidl::encoding::Decoder<
2607 '_,
2608 fidl::encoding::DefaultFuchsiaResourceDialect,
2609 >,
2610 offset: usize,
2611 _depth: fidl::encoding::Depth,
2612 ) -> fidl::Result<()> {
2613 decoder.debug_check_bounds::<Self>(offset);
2614 fidl::decode!(
2616 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IpIteratorMarker>>,
2617 fidl::encoding::DefaultFuchsiaResourceDialect,
2618 &mut self.s,
2619 decoder,
2620 offset + 0,
2621 _depth
2622 )?;
2623 fidl::decode!(
2624 Extensions,
2625 fidl::encoding::DefaultFuchsiaResourceDialect,
2626 &mut self.extensions,
2627 decoder,
2628 offset + 4,
2629 _depth
2630 )?;
2631 fidl::decode!(fidl::encoding::Vector<IpSocketMatcher, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.matchers, decoder, offset + 8, _depth)?;
2632 Ok(())
2633 }
2634 }
2635}