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>, 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>, 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)
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>,
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>,
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>, fidl::Error> {
809 let _response = fidl::client::decode_transaction_body::<
810 DestructionWatcherWatchResponse,
811 fidl::encoding::DefaultFuchsiaResourceDialect,
812 0x7ce86d7c39821f10,
813 >(_buf?)?;
814 Ok(_response.sockets)
815 }
816 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<IpSocketState>>(
817 (),
818 0x7ce86d7c39821f10,
819 fidl::encoding::DynamicFlags::empty(),
820 _decode,
821 )
822 }
823}
824
825pub struct DestructionWatcherEventStream {
826 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
827}
828
829impl std::marker::Unpin for DestructionWatcherEventStream {}
830
831impl futures::stream::FusedStream for DestructionWatcherEventStream {
832 fn is_terminated(&self) -> bool {
833 self.event_receiver.is_terminated()
834 }
835}
836
837impl futures::Stream for DestructionWatcherEventStream {
838 type Item = Result<DestructionWatcherEvent, fidl::Error>;
839
840 fn poll_next(
841 mut self: std::pin::Pin<&mut Self>,
842 cx: &mut std::task::Context<'_>,
843 ) -> std::task::Poll<Option<Self::Item>> {
844 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
845 &mut self.event_receiver,
846 cx
847 )?) {
848 Some(buf) => std::task::Poll::Ready(Some(DestructionWatcherEvent::decode(buf))),
849 None => std::task::Poll::Ready(None),
850 }
851 }
852}
853
854#[derive(Debug)]
855pub enum DestructionWatcherEvent {
856 #[non_exhaustive]
857 _UnknownEvent {
858 ordinal: u64,
860 },
861}
862
863impl DestructionWatcherEvent {
864 fn decode(
866 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
867 ) -> Result<DestructionWatcherEvent, fidl::Error> {
868 let (bytes, _handles) = buf.split_mut();
869 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
870 debug_assert_eq!(tx_header.tx_id, 0);
871 match tx_header.ordinal {
872 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
873 Ok(DestructionWatcherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
874 }
875 _ => Err(fidl::Error::UnknownOrdinal {
876 ordinal: tx_header.ordinal,
877 protocol_name:
878 <DestructionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
879 }),
880 }
881 }
882}
883
884pub struct DestructionWatcherRequestStream {
886 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
887 is_terminated: bool,
888}
889
890impl std::marker::Unpin for DestructionWatcherRequestStream {}
891
892impl futures::stream::FusedStream for DestructionWatcherRequestStream {
893 fn is_terminated(&self) -> bool {
894 self.is_terminated
895 }
896}
897
898impl fidl::endpoints::RequestStream for DestructionWatcherRequestStream {
899 type Protocol = DestructionWatcherMarker;
900 type ControlHandle = DestructionWatcherControlHandle;
901
902 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
903 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
904 }
905
906 fn control_handle(&self) -> Self::ControlHandle {
907 DestructionWatcherControlHandle { inner: self.inner.clone() }
908 }
909
910 fn into_inner(
911 self,
912 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
913 {
914 (self.inner, self.is_terminated)
915 }
916
917 fn from_inner(
918 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
919 is_terminated: bool,
920 ) -> Self {
921 Self { inner, is_terminated }
922 }
923}
924
925impl futures::Stream for DestructionWatcherRequestStream {
926 type Item = Result<DestructionWatcherRequest, fidl::Error>;
927
928 fn poll_next(
929 mut self: std::pin::Pin<&mut Self>,
930 cx: &mut std::task::Context<'_>,
931 ) -> std::task::Poll<Option<Self::Item>> {
932 let this = &mut *self;
933 if this.inner.check_shutdown(cx) {
934 this.is_terminated = true;
935 return std::task::Poll::Ready(None);
936 }
937 if this.is_terminated {
938 panic!("polled DestructionWatcherRequestStream after completion");
939 }
940 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
941 |bytes, handles| {
942 match this.inner.channel().read_etc(cx, bytes, handles) {
943 std::task::Poll::Ready(Ok(())) => {}
944 std::task::Poll::Pending => return std::task::Poll::Pending,
945 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
946 this.is_terminated = true;
947 return std::task::Poll::Ready(None);
948 }
949 std::task::Poll::Ready(Err(e)) => {
950 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
951 e.into(),
952 ))));
953 }
954 }
955
956 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
958
959 std::task::Poll::Ready(Some(match header.ordinal {
960 0x7ce86d7c39821f10 => {
961 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
962 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
963 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
964 let control_handle = DestructionWatcherControlHandle {
965 inner: this.inner.clone(),
966 };
967 Ok(DestructionWatcherRequest::Watch {
968 responder: DestructionWatcherWatchResponder {
969 control_handle: std::mem::ManuallyDrop::new(control_handle),
970 tx_id: header.tx_id,
971 },
972 })
973 }
974 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
975 Ok(DestructionWatcherRequest::_UnknownMethod {
976 ordinal: header.ordinal,
977 control_handle: DestructionWatcherControlHandle { inner: this.inner.clone() },
978 method_type: fidl::MethodType::OneWay,
979 })
980 }
981 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
982 this.inner.send_framework_err(
983 fidl::encoding::FrameworkErr::UnknownMethod,
984 header.tx_id,
985 header.ordinal,
986 header.dynamic_flags(),
987 (bytes, handles),
988 )?;
989 Ok(DestructionWatcherRequest::_UnknownMethod {
990 ordinal: header.ordinal,
991 control_handle: DestructionWatcherControlHandle { inner: this.inner.clone() },
992 method_type: fidl::MethodType::TwoWay,
993 })
994 }
995 _ => Err(fidl::Error::UnknownOrdinal {
996 ordinal: header.ordinal,
997 protocol_name: <DestructionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
998 }),
999 }))
1000 },
1001 )
1002 }
1003}
1004
1005#[derive(Debug)]
1007pub enum DestructionWatcherRequest {
1008 Watch { responder: DestructionWatcherWatchResponder },
1027 #[non_exhaustive]
1029 _UnknownMethod {
1030 ordinal: u64,
1032 control_handle: DestructionWatcherControlHandle,
1033 method_type: fidl::MethodType,
1034 },
1035}
1036
1037impl DestructionWatcherRequest {
1038 #[allow(irrefutable_let_patterns)]
1039 pub fn into_watch(self) -> Option<(DestructionWatcherWatchResponder)> {
1040 if let DestructionWatcherRequest::Watch { responder } = self {
1041 Some((responder))
1042 } else {
1043 None
1044 }
1045 }
1046
1047 pub fn method_name(&self) -> &'static str {
1049 match *self {
1050 DestructionWatcherRequest::Watch { .. } => "watch",
1051 DestructionWatcherRequest::_UnknownMethod {
1052 method_type: fidl::MethodType::OneWay,
1053 ..
1054 } => "unknown one-way method",
1055 DestructionWatcherRequest::_UnknownMethod {
1056 method_type: fidl::MethodType::TwoWay,
1057 ..
1058 } => "unknown two-way method",
1059 }
1060 }
1061}
1062
1063#[derive(Debug, Clone)]
1064pub struct DestructionWatcherControlHandle {
1065 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1066}
1067
1068impl DestructionWatcherControlHandle {
1069 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1070 self.inner.shutdown_with_epitaph(status.into())
1071 }
1072}
1073
1074impl fidl::endpoints::ControlHandle for DestructionWatcherControlHandle {
1075 fn shutdown(&self) {
1076 self.inner.shutdown()
1077 }
1078
1079 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1080 self.inner.shutdown_with_epitaph(status)
1081 }
1082
1083 fn is_closed(&self) -> bool {
1084 self.inner.channel().is_closed()
1085 }
1086 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1087 self.inner.channel().on_closed()
1088 }
1089
1090 #[cfg(target_os = "fuchsia")]
1091 fn signal_peer(
1092 &self,
1093 clear_mask: zx::Signals,
1094 set_mask: zx::Signals,
1095 ) -> Result<(), zx_status::Status> {
1096 use fidl::Peered;
1097 self.inner.channel().signal_peer(clear_mask, set_mask)
1098 }
1099}
1100
1101impl DestructionWatcherControlHandle {}
1102
1103#[must_use = "FIDL methods require a response to be sent"]
1104#[derive(Debug)]
1105pub struct DestructionWatcherWatchResponder {
1106 control_handle: std::mem::ManuallyDrop<DestructionWatcherControlHandle>,
1107 tx_id: u32,
1108}
1109
1110impl std::ops::Drop for DestructionWatcherWatchResponder {
1114 fn drop(&mut self) {
1115 self.control_handle.shutdown();
1116 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1118 }
1119}
1120
1121impl fidl::endpoints::Responder for DestructionWatcherWatchResponder {
1122 type ControlHandle = DestructionWatcherControlHandle;
1123
1124 fn control_handle(&self) -> &DestructionWatcherControlHandle {
1125 &self.control_handle
1126 }
1127
1128 fn drop_without_shutdown(mut self) {
1129 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1131 std::mem::forget(self);
1133 }
1134}
1135
1136impl DestructionWatcherWatchResponder {
1137 pub fn send(self, mut sockets: &[IpSocketState]) -> Result<(), fidl::Error> {
1141 let _result = self.send_raw(sockets);
1142 if _result.is_err() {
1143 self.control_handle.shutdown();
1144 }
1145 self.drop_without_shutdown();
1146 _result
1147 }
1148
1149 pub fn send_no_shutdown_on_err(self, mut sockets: &[IpSocketState]) -> Result<(), fidl::Error> {
1151 let _result = self.send_raw(sockets);
1152 self.drop_without_shutdown();
1153 _result
1154 }
1155
1156 fn send_raw(&self, mut sockets: &[IpSocketState]) -> Result<(), fidl::Error> {
1157 self.control_handle.inner.send::<DestructionWatcherWatchResponse>(
1158 (sockets,),
1159 self.tx_id,
1160 0x7ce86d7c39821f10,
1161 fidl::encoding::DynamicFlags::empty(),
1162 )
1163 }
1164}
1165
1166#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1167pub struct DiagnosticsMarker;
1168
1169impl fidl::endpoints::ProtocolMarker for DiagnosticsMarker {
1170 type Proxy = DiagnosticsProxy;
1171 type RequestStream = DiagnosticsRequestStream;
1172 #[cfg(target_os = "fuchsia")]
1173 type SynchronousProxy = DiagnosticsSynchronousProxy;
1174
1175 const DEBUG_NAME: &'static str = "fuchsia.net.sockets.Diagnostics";
1176}
1177impl fidl::endpoints::DiscoverableProtocolMarker for DiagnosticsMarker {}
1178
1179pub trait DiagnosticsProxyInterface: Send + Sync {
1180 type IterateIpResponseFut: std::future::Future<Output = Result<IterateIpResult, fidl::Error>>
1181 + Send;
1182 fn r#iterate_ip(
1183 &self,
1184 s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
1185 extensions: Extensions,
1186 matchers: &[IpSocketMatcher],
1187 ) -> Self::IterateIpResponseFut;
1188 type GetDestructionWatcherResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1189 + Send;
1190 fn r#get_destruction_watcher(
1191 &self,
1192 watcher: fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
1193 ) -> Self::GetDestructionWatcherResponseFut;
1194}
1195#[derive(Debug)]
1196#[cfg(target_os = "fuchsia")]
1197pub struct DiagnosticsSynchronousProxy {
1198 client: fidl::client::sync::Client,
1199}
1200
1201#[cfg(target_os = "fuchsia")]
1202impl fidl::endpoints::SynchronousProxy for DiagnosticsSynchronousProxy {
1203 type Proxy = DiagnosticsProxy;
1204 type Protocol = DiagnosticsMarker;
1205
1206 fn from_channel(inner: fidl::Channel) -> Self {
1207 Self::new(inner)
1208 }
1209
1210 fn into_channel(self) -> fidl::Channel {
1211 self.client.into_channel()
1212 }
1213
1214 fn as_channel(&self) -> &fidl::Channel {
1215 self.client.as_channel()
1216 }
1217}
1218
1219#[cfg(target_os = "fuchsia")]
1220impl DiagnosticsSynchronousProxy {
1221 pub fn new(channel: fidl::Channel) -> Self {
1222 Self { client: fidl::client::sync::Client::new(channel) }
1223 }
1224
1225 pub fn into_channel(self) -> fidl::Channel {
1226 self.client.into_channel()
1227 }
1228
1229 pub fn wait_for_event(
1232 &self,
1233 deadline: zx::MonotonicInstant,
1234 ) -> Result<DiagnosticsEvent, fidl::Error> {
1235 DiagnosticsEvent::decode(self.client.wait_for_event::<DiagnosticsMarker>(deadline)?)
1236 }
1237
1238 pub fn r#iterate_ip(
1243 &self,
1244 mut s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
1245 mut extensions: Extensions,
1246 mut matchers: &[IpSocketMatcher],
1247 ___deadline: zx::MonotonicInstant,
1248 ) -> Result<IterateIpResult, fidl::Error> {
1249 let _response = self
1250 .client
1251 .send_query::<DiagnosticsIterateIpRequest, IterateIpResult, DiagnosticsMarker>(
1252 (s, extensions, matchers),
1253 0x7b05425e48d07605,
1254 fidl::encoding::DynamicFlags::empty(),
1255 ___deadline,
1256 )?;
1257 Ok(_response)
1258 }
1259
1260 pub fn r#get_destruction_watcher(
1264 &self,
1265 mut watcher: fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
1266 ___deadline: zx::MonotonicInstant,
1267 ) -> Result<(), fidl::Error> {
1268 let _response = self.client.send_query::<
1269 DiagnosticsGetDestructionWatcherRequest,
1270 fidl::encoding::EmptyPayload,
1271 DiagnosticsMarker,
1272 >(
1273 (watcher,),
1274 0x4b5d70a35a21964f,
1275 fidl::encoding::DynamicFlags::empty(),
1276 ___deadline,
1277 )?;
1278 Ok(_response)
1279 }
1280}
1281
1282#[cfg(target_os = "fuchsia")]
1283impl From<DiagnosticsSynchronousProxy> for zx::NullableHandle {
1284 fn from(value: DiagnosticsSynchronousProxy) -> Self {
1285 value.into_channel().into()
1286 }
1287}
1288
1289#[cfg(target_os = "fuchsia")]
1290impl From<fidl::Channel> for DiagnosticsSynchronousProxy {
1291 fn from(value: fidl::Channel) -> Self {
1292 Self::new(value)
1293 }
1294}
1295
1296#[cfg(target_os = "fuchsia")]
1297impl fidl::endpoints::FromClient for DiagnosticsSynchronousProxy {
1298 type Protocol = DiagnosticsMarker;
1299
1300 fn from_client(value: fidl::endpoints::ClientEnd<DiagnosticsMarker>) -> Self {
1301 Self::new(value.into_channel())
1302 }
1303}
1304
1305#[derive(Debug, Clone)]
1306pub struct DiagnosticsProxy {
1307 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1308}
1309
1310impl fidl::endpoints::Proxy for DiagnosticsProxy {
1311 type Protocol = DiagnosticsMarker;
1312
1313 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1314 Self::new(inner)
1315 }
1316
1317 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1318 self.client.into_channel().map_err(|client| Self { client })
1319 }
1320
1321 fn as_channel(&self) -> &::fidl::AsyncChannel {
1322 self.client.as_channel()
1323 }
1324}
1325
1326impl DiagnosticsProxy {
1327 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1329 let protocol_name = <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1330 Self { client: fidl::client::Client::new(channel, protocol_name) }
1331 }
1332
1333 pub fn take_event_stream(&self) -> DiagnosticsEventStream {
1339 DiagnosticsEventStream { event_receiver: self.client.take_event_receiver() }
1340 }
1341
1342 pub fn r#iterate_ip(
1347 &self,
1348 mut s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
1349 mut extensions: Extensions,
1350 mut matchers: &[IpSocketMatcher],
1351 ) -> fidl::client::QueryResponseFut<
1352 IterateIpResult,
1353 fidl::encoding::DefaultFuchsiaResourceDialect,
1354 > {
1355 DiagnosticsProxyInterface::r#iterate_ip(self, s, extensions, matchers)
1356 }
1357
1358 pub fn r#get_destruction_watcher(
1362 &self,
1363 mut watcher: fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
1364 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1365 DiagnosticsProxyInterface::r#get_destruction_watcher(self, watcher)
1366 }
1367}
1368
1369impl DiagnosticsProxyInterface for DiagnosticsProxy {
1370 type IterateIpResponseFut = fidl::client::QueryResponseFut<
1371 IterateIpResult,
1372 fidl::encoding::DefaultFuchsiaResourceDialect,
1373 >;
1374 fn r#iterate_ip(
1375 &self,
1376 mut s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
1377 mut extensions: Extensions,
1378 mut matchers: &[IpSocketMatcher],
1379 ) -> Self::IterateIpResponseFut {
1380 fn _decode(
1381 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1382 ) -> Result<IterateIpResult, fidl::Error> {
1383 let _response = fidl::client::decode_transaction_body::<
1384 IterateIpResult,
1385 fidl::encoding::DefaultFuchsiaResourceDialect,
1386 0x7b05425e48d07605,
1387 >(_buf?)?;
1388 Ok(_response)
1389 }
1390 self.client.send_query_and_decode::<DiagnosticsIterateIpRequest, IterateIpResult>(
1391 (s, extensions, matchers),
1392 0x7b05425e48d07605,
1393 fidl::encoding::DynamicFlags::empty(),
1394 _decode,
1395 )
1396 }
1397
1398 type GetDestructionWatcherResponseFut =
1399 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1400 fn r#get_destruction_watcher(
1401 &self,
1402 mut watcher: fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
1403 ) -> Self::GetDestructionWatcherResponseFut {
1404 fn _decode(
1405 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1406 ) -> Result<(), fidl::Error> {
1407 let _response = fidl::client::decode_transaction_body::<
1408 fidl::encoding::EmptyPayload,
1409 fidl::encoding::DefaultFuchsiaResourceDialect,
1410 0x4b5d70a35a21964f,
1411 >(_buf?)?;
1412 Ok(_response)
1413 }
1414 self.client.send_query_and_decode::<DiagnosticsGetDestructionWatcherRequest, ()>(
1415 (watcher,),
1416 0x4b5d70a35a21964f,
1417 fidl::encoding::DynamicFlags::empty(),
1418 _decode,
1419 )
1420 }
1421}
1422
1423pub struct DiagnosticsEventStream {
1424 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1425}
1426
1427impl std::marker::Unpin for DiagnosticsEventStream {}
1428
1429impl futures::stream::FusedStream for DiagnosticsEventStream {
1430 fn is_terminated(&self) -> bool {
1431 self.event_receiver.is_terminated()
1432 }
1433}
1434
1435impl futures::Stream for DiagnosticsEventStream {
1436 type Item = Result<DiagnosticsEvent, fidl::Error>;
1437
1438 fn poll_next(
1439 mut self: std::pin::Pin<&mut Self>,
1440 cx: &mut std::task::Context<'_>,
1441 ) -> std::task::Poll<Option<Self::Item>> {
1442 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1443 &mut self.event_receiver,
1444 cx
1445 )?) {
1446 Some(buf) => std::task::Poll::Ready(Some(DiagnosticsEvent::decode(buf))),
1447 None => std::task::Poll::Ready(None),
1448 }
1449 }
1450}
1451
1452#[derive(Debug)]
1453pub enum DiagnosticsEvent {}
1454
1455impl DiagnosticsEvent {
1456 fn decode(
1458 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1459 ) -> Result<DiagnosticsEvent, fidl::Error> {
1460 let (bytes, _handles) = buf.split_mut();
1461 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1462 debug_assert_eq!(tx_header.tx_id, 0);
1463 match tx_header.ordinal {
1464 _ => Err(fidl::Error::UnknownOrdinal {
1465 ordinal: tx_header.ordinal,
1466 protocol_name: <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1467 }),
1468 }
1469 }
1470}
1471
1472pub struct DiagnosticsRequestStream {
1474 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1475 is_terminated: bool,
1476}
1477
1478impl std::marker::Unpin for DiagnosticsRequestStream {}
1479
1480impl futures::stream::FusedStream for DiagnosticsRequestStream {
1481 fn is_terminated(&self) -> bool {
1482 self.is_terminated
1483 }
1484}
1485
1486impl fidl::endpoints::RequestStream for DiagnosticsRequestStream {
1487 type Protocol = DiagnosticsMarker;
1488 type ControlHandle = DiagnosticsControlHandle;
1489
1490 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1491 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1492 }
1493
1494 fn control_handle(&self) -> Self::ControlHandle {
1495 DiagnosticsControlHandle { inner: self.inner.clone() }
1496 }
1497
1498 fn into_inner(
1499 self,
1500 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1501 {
1502 (self.inner, self.is_terminated)
1503 }
1504
1505 fn from_inner(
1506 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1507 is_terminated: bool,
1508 ) -> Self {
1509 Self { inner, is_terminated }
1510 }
1511}
1512
1513impl futures::Stream for DiagnosticsRequestStream {
1514 type Item = Result<DiagnosticsRequest, fidl::Error>;
1515
1516 fn poll_next(
1517 mut self: std::pin::Pin<&mut Self>,
1518 cx: &mut std::task::Context<'_>,
1519 ) -> std::task::Poll<Option<Self::Item>> {
1520 let this = &mut *self;
1521 if this.inner.check_shutdown(cx) {
1522 this.is_terminated = true;
1523 return std::task::Poll::Ready(None);
1524 }
1525 if this.is_terminated {
1526 panic!("polled DiagnosticsRequestStream after completion");
1527 }
1528 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1529 |bytes, handles| {
1530 match this.inner.channel().read_etc(cx, bytes, handles) {
1531 std::task::Poll::Ready(Ok(())) => {}
1532 std::task::Poll::Pending => return std::task::Poll::Pending,
1533 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1534 this.is_terminated = true;
1535 return std::task::Poll::Ready(None);
1536 }
1537 std::task::Poll::Ready(Err(e)) => {
1538 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1539 e.into(),
1540 ))));
1541 }
1542 }
1543
1544 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1546
1547 std::task::Poll::Ready(Some(match header.ordinal {
1548 0x7b05425e48d07605 => {
1549 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1550 let mut req = fidl::new_empty!(
1551 DiagnosticsIterateIpRequest,
1552 fidl::encoding::DefaultFuchsiaResourceDialect
1553 );
1554 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiagnosticsIterateIpRequest>(&header, _body_bytes, handles, &mut req)?;
1555 let control_handle = DiagnosticsControlHandle { inner: this.inner.clone() };
1556 Ok(DiagnosticsRequest::IterateIp {
1557 s: req.s,
1558 extensions: req.extensions,
1559 matchers: req.matchers,
1560
1561 responder: DiagnosticsIterateIpResponder {
1562 control_handle: std::mem::ManuallyDrop::new(control_handle),
1563 tx_id: header.tx_id,
1564 },
1565 })
1566 }
1567 0x4b5d70a35a21964f => {
1568 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1569 let mut req = fidl::new_empty!(
1570 DiagnosticsGetDestructionWatcherRequest,
1571 fidl::encoding::DefaultFuchsiaResourceDialect
1572 );
1573 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiagnosticsGetDestructionWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
1574 let control_handle = DiagnosticsControlHandle { inner: this.inner.clone() };
1575 Ok(DiagnosticsRequest::GetDestructionWatcher {
1576 watcher: req.watcher,
1577
1578 responder: DiagnosticsGetDestructionWatcherResponder {
1579 control_handle: std::mem::ManuallyDrop::new(control_handle),
1580 tx_id: header.tx_id,
1581 },
1582 })
1583 }
1584 _ => Err(fidl::Error::UnknownOrdinal {
1585 ordinal: header.ordinal,
1586 protocol_name:
1587 <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1588 }),
1589 }))
1590 },
1591 )
1592 }
1593}
1594
1595#[derive(Debug)]
1597pub enum DiagnosticsRequest {
1598 IterateIp {
1603 s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
1604 extensions: Extensions,
1605 matchers: Vec<IpSocketMatcher>,
1606 responder: DiagnosticsIterateIpResponder,
1607 },
1608 GetDestructionWatcher {
1612 watcher: fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
1613 responder: DiagnosticsGetDestructionWatcherResponder,
1614 },
1615}
1616
1617impl DiagnosticsRequest {
1618 #[allow(irrefutable_let_patterns)]
1619 pub fn into_iterate_ip(
1620 self,
1621 ) -> Option<(
1622 fidl::endpoints::ServerEnd<IpIteratorMarker>,
1623 Extensions,
1624 Vec<IpSocketMatcher>,
1625 DiagnosticsIterateIpResponder,
1626 )> {
1627 if let DiagnosticsRequest::IterateIp { s, extensions, matchers, responder } = self {
1628 Some((s, extensions, matchers, responder))
1629 } else {
1630 None
1631 }
1632 }
1633
1634 #[allow(irrefutable_let_patterns)]
1635 pub fn into_get_destruction_watcher(
1636 self,
1637 ) -> Option<(
1638 fidl::endpoints::ServerEnd<DestructionWatcherMarker>,
1639 DiagnosticsGetDestructionWatcherResponder,
1640 )> {
1641 if let DiagnosticsRequest::GetDestructionWatcher { watcher, responder } = self {
1642 Some((watcher, responder))
1643 } else {
1644 None
1645 }
1646 }
1647
1648 pub fn method_name(&self) -> &'static str {
1650 match *self {
1651 DiagnosticsRequest::IterateIp { .. } => "iterate_ip",
1652 DiagnosticsRequest::GetDestructionWatcher { .. } => "get_destruction_watcher",
1653 }
1654 }
1655}
1656
1657#[derive(Debug, Clone)]
1658pub struct DiagnosticsControlHandle {
1659 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1660}
1661
1662impl DiagnosticsControlHandle {
1663 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1664 self.inner.shutdown_with_epitaph(status.into())
1665 }
1666}
1667
1668impl fidl::endpoints::ControlHandle for DiagnosticsControlHandle {
1669 fn shutdown(&self) {
1670 self.inner.shutdown()
1671 }
1672
1673 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1674 self.inner.shutdown_with_epitaph(status)
1675 }
1676
1677 fn is_closed(&self) -> bool {
1678 self.inner.channel().is_closed()
1679 }
1680 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1681 self.inner.channel().on_closed()
1682 }
1683
1684 #[cfg(target_os = "fuchsia")]
1685 fn signal_peer(
1686 &self,
1687 clear_mask: zx::Signals,
1688 set_mask: zx::Signals,
1689 ) -> Result<(), zx_status::Status> {
1690 use fidl::Peered;
1691 self.inner.channel().signal_peer(clear_mask, set_mask)
1692 }
1693}
1694
1695impl DiagnosticsControlHandle {}
1696
1697#[must_use = "FIDL methods require a response to be sent"]
1698#[derive(Debug)]
1699pub struct DiagnosticsIterateIpResponder {
1700 control_handle: std::mem::ManuallyDrop<DiagnosticsControlHandle>,
1701 tx_id: u32,
1702}
1703
1704impl std::ops::Drop for DiagnosticsIterateIpResponder {
1708 fn drop(&mut self) {
1709 self.control_handle.shutdown();
1710 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1712 }
1713}
1714
1715impl fidl::endpoints::Responder for DiagnosticsIterateIpResponder {
1716 type ControlHandle = DiagnosticsControlHandle;
1717
1718 fn control_handle(&self) -> &DiagnosticsControlHandle {
1719 &self.control_handle
1720 }
1721
1722 fn drop_without_shutdown(mut self) {
1723 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1725 std::mem::forget(self);
1727 }
1728}
1729
1730impl DiagnosticsIterateIpResponder {
1731 pub fn send(self, mut payload: &IterateIpResult) -> Result<(), fidl::Error> {
1735 let _result = self.send_raw(payload);
1736 if _result.is_err() {
1737 self.control_handle.shutdown();
1738 }
1739 self.drop_without_shutdown();
1740 _result
1741 }
1742
1743 pub fn send_no_shutdown_on_err(self, mut payload: &IterateIpResult) -> Result<(), fidl::Error> {
1745 let _result = self.send_raw(payload);
1746 self.drop_without_shutdown();
1747 _result
1748 }
1749
1750 fn send_raw(&self, mut payload: &IterateIpResult) -> Result<(), fidl::Error> {
1751 self.control_handle.inner.send::<IterateIpResult>(
1752 payload,
1753 self.tx_id,
1754 0x7b05425e48d07605,
1755 fidl::encoding::DynamicFlags::empty(),
1756 )
1757 }
1758}
1759
1760#[must_use = "FIDL methods require a response to be sent"]
1761#[derive(Debug)]
1762pub struct DiagnosticsGetDestructionWatcherResponder {
1763 control_handle: std::mem::ManuallyDrop<DiagnosticsControlHandle>,
1764 tx_id: u32,
1765}
1766
1767impl std::ops::Drop for DiagnosticsGetDestructionWatcherResponder {
1771 fn drop(&mut self) {
1772 self.control_handle.shutdown();
1773 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1775 }
1776}
1777
1778impl fidl::endpoints::Responder for DiagnosticsGetDestructionWatcherResponder {
1779 type ControlHandle = DiagnosticsControlHandle;
1780
1781 fn control_handle(&self) -> &DiagnosticsControlHandle {
1782 &self.control_handle
1783 }
1784
1785 fn drop_without_shutdown(mut self) {
1786 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1788 std::mem::forget(self);
1790 }
1791}
1792
1793impl DiagnosticsGetDestructionWatcherResponder {
1794 pub fn send(self) -> Result<(), fidl::Error> {
1798 let _result = self.send_raw();
1799 if _result.is_err() {
1800 self.control_handle.shutdown();
1801 }
1802 self.drop_without_shutdown();
1803 _result
1804 }
1805
1806 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1808 let _result = self.send_raw();
1809 self.drop_without_shutdown();
1810 _result
1811 }
1812
1813 fn send_raw(&self) -> Result<(), fidl::Error> {
1814 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1815 (),
1816 self.tx_id,
1817 0x4b5d70a35a21964f,
1818 fidl::encoding::DynamicFlags::empty(),
1819 )
1820 }
1821}
1822
1823#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1824pub struct IpIteratorMarker;
1825
1826impl fidl::endpoints::ProtocolMarker for IpIteratorMarker {
1827 type Proxy = IpIteratorProxy;
1828 type RequestStream = IpIteratorRequestStream;
1829 #[cfg(target_os = "fuchsia")]
1830 type SynchronousProxy = IpIteratorSynchronousProxy;
1831
1832 const DEBUG_NAME: &'static str = "(anonymous) IpIterator";
1833}
1834
1835pub trait IpIteratorProxyInterface: Send + Sync {
1836 type NextResponseFut: std::future::Future<Output = Result<(Vec<IpSocketState>, bool), fidl::Error>>
1837 + Send;
1838 fn r#next(&self) -> Self::NextResponseFut;
1839}
1840#[derive(Debug)]
1841#[cfg(target_os = "fuchsia")]
1842pub struct IpIteratorSynchronousProxy {
1843 client: fidl::client::sync::Client,
1844}
1845
1846#[cfg(target_os = "fuchsia")]
1847impl fidl::endpoints::SynchronousProxy for IpIteratorSynchronousProxy {
1848 type Proxy = IpIteratorProxy;
1849 type Protocol = IpIteratorMarker;
1850
1851 fn from_channel(inner: fidl::Channel) -> Self {
1852 Self::new(inner)
1853 }
1854
1855 fn into_channel(self) -> fidl::Channel {
1856 self.client.into_channel()
1857 }
1858
1859 fn as_channel(&self) -> &fidl::Channel {
1860 self.client.as_channel()
1861 }
1862}
1863
1864#[cfg(target_os = "fuchsia")]
1865impl IpIteratorSynchronousProxy {
1866 pub fn new(channel: fidl::Channel) -> Self {
1867 Self { client: fidl::client::sync::Client::new(channel) }
1868 }
1869
1870 pub fn into_channel(self) -> fidl::Channel {
1871 self.client.into_channel()
1872 }
1873
1874 pub fn wait_for_event(
1877 &self,
1878 deadline: zx::MonotonicInstant,
1879 ) -> Result<IpIteratorEvent, fidl::Error> {
1880 IpIteratorEvent::decode(self.client.wait_for_event::<IpIteratorMarker>(deadline)?)
1881 }
1882
1883 pub fn r#next(
1895 &self,
1896 ___deadline: zx::MonotonicInstant,
1897 ) -> Result<(Vec<IpSocketState>, bool), fidl::Error> {
1898 let _response = self
1899 .client
1900 .send_query::<fidl::encoding::EmptyPayload, IpIteratorNextResponse, IpIteratorMarker>(
1901 (),
1902 0x3d50aa08ce641a6b,
1903 fidl::encoding::DynamicFlags::empty(),
1904 ___deadline,
1905 )?;
1906 Ok((_response.sockets, _response.has_more))
1907 }
1908}
1909
1910#[cfg(target_os = "fuchsia")]
1911impl From<IpIteratorSynchronousProxy> for zx::NullableHandle {
1912 fn from(value: IpIteratorSynchronousProxy) -> Self {
1913 value.into_channel().into()
1914 }
1915}
1916
1917#[cfg(target_os = "fuchsia")]
1918impl From<fidl::Channel> for IpIteratorSynchronousProxy {
1919 fn from(value: fidl::Channel) -> Self {
1920 Self::new(value)
1921 }
1922}
1923
1924#[cfg(target_os = "fuchsia")]
1925impl fidl::endpoints::FromClient for IpIteratorSynchronousProxy {
1926 type Protocol = IpIteratorMarker;
1927
1928 fn from_client(value: fidl::endpoints::ClientEnd<IpIteratorMarker>) -> Self {
1929 Self::new(value.into_channel())
1930 }
1931}
1932
1933#[derive(Debug, Clone)]
1934pub struct IpIteratorProxy {
1935 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1936}
1937
1938impl fidl::endpoints::Proxy for IpIteratorProxy {
1939 type Protocol = IpIteratorMarker;
1940
1941 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1942 Self::new(inner)
1943 }
1944
1945 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1946 self.client.into_channel().map_err(|client| Self { client })
1947 }
1948
1949 fn as_channel(&self) -> &::fidl::AsyncChannel {
1950 self.client.as_channel()
1951 }
1952}
1953
1954impl IpIteratorProxy {
1955 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1957 let protocol_name = <IpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1958 Self { client: fidl::client::Client::new(channel, protocol_name) }
1959 }
1960
1961 pub fn take_event_stream(&self) -> IpIteratorEventStream {
1967 IpIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1968 }
1969
1970 pub fn r#next(
1982 &self,
1983 ) -> fidl::client::QueryResponseFut<
1984 (Vec<IpSocketState>, bool),
1985 fidl::encoding::DefaultFuchsiaResourceDialect,
1986 > {
1987 IpIteratorProxyInterface::r#next(self)
1988 }
1989}
1990
1991impl IpIteratorProxyInterface for IpIteratorProxy {
1992 type NextResponseFut = fidl::client::QueryResponseFut<
1993 (Vec<IpSocketState>, bool),
1994 fidl::encoding::DefaultFuchsiaResourceDialect,
1995 >;
1996 fn r#next(&self) -> Self::NextResponseFut {
1997 fn _decode(
1998 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1999 ) -> Result<(Vec<IpSocketState>, bool), fidl::Error> {
2000 let _response = fidl::client::decode_transaction_body::<
2001 IpIteratorNextResponse,
2002 fidl::encoding::DefaultFuchsiaResourceDialect,
2003 0x3d50aa08ce641a6b,
2004 >(_buf?)?;
2005 Ok((_response.sockets, _response.has_more))
2006 }
2007 self.client
2008 .send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<IpSocketState>, bool)>(
2009 (),
2010 0x3d50aa08ce641a6b,
2011 fidl::encoding::DynamicFlags::empty(),
2012 _decode,
2013 )
2014 }
2015}
2016
2017pub struct IpIteratorEventStream {
2018 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2019}
2020
2021impl std::marker::Unpin for IpIteratorEventStream {}
2022
2023impl futures::stream::FusedStream for IpIteratorEventStream {
2024 fn is_terminated(&self) -> bool {
2025 self.event_receiver.is_terminated()
2026 }
2027}
2028
2029impl futures::Stream for IpIteratorEventStream {
2030 type Item = Result<IpIteratorEvent, fidl::Error>;
2031
2032 fn poll_next(
2033 mut self: std::pin::Pin<&mut Self>,
2034 cx: &mut std::task::Context<'_>,
2035 ) -> std::task::Poll<Option<Self::Item>> {
2036 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2037 &mut self.event_receiver,
2038 cx
2039 )?) {
2040 Some(buf) => std::task::Poll::Ready(Some(IpIteratorEvent::decode(buf))),
2041 None => std::task::Poll::Ready(None),
2042 }
2043 }
2044}
2045
2046#[derive(Debug)]
2047pub enum IpIteratorEvent {
2048 #[non_exhaustive]
2049 _UnknownEvent {
2050 ordinal: u64,
2052 },
2053}
2054
2055impl IpIteratorEvent {
2056 fn decode(
2058 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2059 ) -> Result<IpIteratorEvent, fidl::Error> {
2060 let (bytes, _handles) = buf.split_mut();
2061 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2062 debug_assert_eq!(tx_header.tx_id, 0);
2063 match tx_header.ordinal {
2064 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2065 Ok(IpIteratorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2066 }
2067 _ => Err(fidl::Error::UnknownOrdinal {
2068 ordinal: tx_header.ordinal,
2069 protocol_name: <IpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2070 }),
2071 }
2072 }
2073}
2074
2075pub struct IpIteratorRequestStream {
2077 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2078 is_terminated: bool,
2079}
2080
2081impl std::marker::Unpin for IpIteratorRequestStream {}
2082
2083impl futures::stream::FusedStream for IpIteratorRequestStream {
2084 fn is_terminated(&self) -> bool {
2085 self.is_terminated
2086 }
2087}
2088
2089impl fidl::endpoints::RequestStream for IpIteratorRequestStream {
2090 type Protocol = IpIteratorMarker;
2091 type ControlHandle = IpIteratorControlHandle;
2092
2093 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2094 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2095 }
2096
2097 fn control_handle(&self) -> Self::ControlHandle {
2098 IpIteratorControlHandle { inner: self.inner.clone() }
2099 }
2100
2101 fn into_inner(
2102 self,
2103 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2104 {
2105 (self.inner, self.is_terminated)
2106 }
2107
2108 fn from_inner(
2109 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2110 is_terminated: bool,
2111 ) -> Self {
2112 Self { inner, is_terminated }
2113 }
2114}
2115
2116impl futures::Stream for IpIteratorRequestStream {
2117 type Item = Result<IpIteratorRequest, fidl::Error>;
2118
2119 fn poll_next(
2120 mut self: std::pin::Pin<&mut Self>,
2121 cx: &mut std::task::Context<'_>,
2122 ) -> std::task::Poll<Option<Self::Item>> {
2123 let this = &mut *self;
2124 if this.inner.check_shutdown(cx) {
2125 this.is_terminated = true;
2126 return std::task::Poll::Ready(None);
2127 }
2128 if this.is_terminated {
2129 panic!("polled IpIteratorRequestStream after completion");
2130 }
2131 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2132 |bytes, handles| {
2133 match this.inner.channel().read_etc(cx, bytes, handles) {
2134 std::task::Poll::Ready(Ok(())) => {}
2135 std::task::Poll::Pending => return std::task::Poll::Pending,
2136 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2137 this.is_terminated = true;
2138 return std::task::Poll::Ready(None);
2139 }
2140 std::task::Poll::Ready(Err(e)) => {
2141 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2142 e.into(),
2143 ))));
2144 }
2145 }
2146
2147 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2149
2150 std::task::Poll::Ready(Some(match header.ordinal {
2151 0x3d50aa08ce641a6b => {
2152 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2153 let mut req = fidl::new_empty!(
2154 fidl::encoding::EmptyPayload,
2155 fidl::encoding::DefaultFuchsiaResourceDialect
2156 );
2157 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2158 let control_handle = IpIteratorControlHandle { inner: this.inner.clone() };
2159 Ok(IpIteratorRequest::Next {
2160 responder: IpIteratorNextResponder {
2161 control_handle: std::mem::ManuallyDrop::new(control_handle),
2162 tx_id: header.tx_id,
2163 },
2164 })
2165 }
2166 _ if header.tx_id == 0
2167 && header
2168 .dynamic_flags()
2169 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2170 {
2171 Ok(IpIteratorRequest::_UnknownMethod {
2172 ordinal: header.ordinal,
2173 control_handle: IpIteratorControlHandle { inner: this.inner.clone() },
2174 method_type: fidl::MethodType::OneWay,
2175 })
2176 }
2177 _ if header
2178 .dynamic_flags()
2179 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2180 {
2181 this.inner.send_framework_err(
2182 fidl::encoding::FrameworkErr::UnknownMethod,
2183 header.tx_id,
2184 header.ordinal,
2185 header.dynamic_flags(),
2186 (bytes, handles),
2187 )?;
2188 Ok(IpIteratorRequest::_UnknownMethod {
2189 ordinal: header.ordinal,
2190 control_handle: IpIteratorControlHandle { inner: this.inner.clone() },
2191 method_type: fidl::MethodType::TwoWay,
2192 })
2193 }
2194 _ => Err(fidl::Error::UnknownOrdinal {
2195 ordinal: header.ordinal,
2196 protocol_name:
2197 <IpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2198 }),
2199 }))
2200 },
2201 )
2202 }
2203}
2204
2205#[derive(Debug)]
2207pub enum IpIteratorRequest {
2208 Next { responder: IpIteratorNextResponder },
2220 #[non_exhaustive]
2222 _UnknownMethod {
2223 ordinal: u64,
2225 control_handle: IpIteratorControlHandle,
2226 method_type: fidl::MethodType,
2227 },
2228}
2229
2230impl IpIteratorRequest {
2231 #[allow(irrefutable_let_patterns)]
2232 pub fn into_next(self) -> Option<(IpIteratorNextResponder)> {
2233 if let IpIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
2234 }
2235
2236 pub fn method_name(&self) -> &'static str {
2238 match *self {
2239 IpIteratorRequest::Next { .. } => "next",
2240 IpIteratorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2241 "unknown one-way method"
2242 }
2243 IpIteratorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2244 "unknown two-way method"
2245 }
2246 }
2247 }
2248}
2249
2250#[derive(Debug, Clone)]
2251pub struct IpIteratorControlHandle {
2252 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2253}
2254
2255impl IpIteratorControlHandle {
2256 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2257 self.inner.shutdown_with_epitaph(status.into())
2258 }
2259}
2260
2261impl fidl::endpoints::ControlHandle for IpIteratorControlHandle {
2262 fn shutdown(&self) {
2263 self.inner.shutdown()
2264 }
2265
2266 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2267 self.inner.shutdown_with_epitaph(status)
2268 }
2269
2270 fn is_closed(&self) -> bool {
2271 self.inner.channel().is_closed()
2272 }
2273 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2274 self.inner.channel().on_closed()
2275 }
2276
2277 #[cfg(target_os = "fuchsia")]
2278 fn signal_peer(
2279 &self,
2280 clear_mask: zx::Signals,
2281 set_mask: zx::Signals,
2282 ) -> Result<(), zx_status::Status> {
2283 use fidl::Peered;
2284 self.inner.channel().signal_peer(clear_mask, set_mask)
2285 }
2286}
2287
2288impl IpIteratorControlHandle {}
2289
2290#[must_use = "FIDL methods require a response to be sent"]
2291#[derive(Debug)]
2292pub struct IpIteratorNextResponder {
2293 control_handle: std::mem::ManuallyDrop<IpIteratorControlHandle>,
2294 tx_id: u32,
2295}
2296
2297impl std::ops::Drop for IpIteratorNextResponder {
2301 fn drop(&mut self) {
2302 self.control_handle.shutdown();
2303 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2305 }
2306}
2307
2308impl fidl::endpoints::Responder for IpIteratorNextResponder {
2309 type ControlHandle = IpIteratorControlHandle;
2310
2311 fn control_handle(&self) -> &IpIteratorControlHandle {
2312 &self.control_handle
2313 }
2314
2315 fn drop_without_shutdown(mut self) {
2316 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2318 std::mem::forget(self);
2320 }
2321}
2322
2323impl IpIteratorNextResponder {
2324 pub fn send(
2328 self,
2329 mut sockets: &[IpSocketState],
2330 mut has_more: bool,
2331 ) -> Result<(), fidl::Error> {
2332 let _result = self.send_raw(sockets, has_more);
2333 if _result.is_err() {
2334 self.control_handle.shutdown();
2335 }
2336 self.drop_without_shutdown();
2337 _result
2338 }
2339
2340 pub fn send_no_shutdown_on_err(
2342 self,
2343 mut sockets: &[IpSocketState],
2344 mut has_more: bool,
2345 ) -> Result<(), fidl::Error> {
2346 let _result = self.send_raw(sockets, has_more);
2347 self.drop_without_shutdown();
2348 _result
2349 }
2350
2351 fn send_raw(
2352 &self,
2353 mut sockets: &[IpSocketState],
2354 mut has_more: bool,
2355 ) -> Result<(), fidl::Error> {
2356 self.control_handle.inner.send::<IpIteratorNextResponse>(
2357 (sockets, has_more),
2358 self.tx_id,
2359 0x3d50aa08ce641a6b,
2360 fidl::encoding::DynamicFlags::empty(),
2361 )
2362 }
2363}
2364
2365mod internal {
2366 use super::*;
2367
2368 impl fidl::encoding::ResourceTypeMarker for DiagnosticsGetDestructionWatcherRequest {
2369 type Borrowed<'a> = &'a mut Self;
2370 fn take_or_borrow<'a>(
2371 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2372 ) -> Self::Borrowed<'a> {
2373 value
2374 }
2375 }
2376
2377 unsafe impl fidl::encoding::TypeMarker for DiagnosticsGetDestructionWatcherRequest {
2378 type Owned = Self;
2379
2380 #[inline(always)]
2381 fn inline_align(_context: fidl::encoding::Context) -> usize {
2382 4
2383 }
2384
2385 #[inline(always)]
2386 fn inline_size(_context: fidl::encoding::Context) -> usize {
2387 4
2388 }
2389 }
2390
2391 unsafe impl
2392 fidl::encoding::Encode<
2393 DiagnosticsGetDestructionWatcherRequest,
2394 fidl::encoding::DefaultFuchsiaResourceDialect,
2395 > for &mut DiagnosticsGetDestructionWatcherRequest
2396 {
2397 #[inline]
2398 unsafe fn encode(
2399 self,
2400 encoder: &mut fidl::encoding::Encoder<
2401 '_,
2402 fidl::encoding::DefaultFuchsiaResourceDialect,
2403 >,
2404 offset: usize,
2405 _depth: fidl::encoding::Depth,
2406 ) -> fidl::Result<()> {
2407 encoder.debug_check_bounds::<DiagnosticsGetDestructionWatcherRequest>(offset);
2408 fidl::encoding::Encode::<DiagnosticsGetDestructionWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2410 (
2411 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DestructionWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
2412 ),
2413 encoder, offset, _depth
2414 )
2415 }
2416 }
2417 unsafe impl<
2418 T0: fidl::encoding::Encode<
2419 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DestructionWatcherMarker>>,
2420 fidl::encoding::DefaultFuchsiaResourceDialect,
2421 >,
2422 >
2423 fidl::encoding::Encode<
2424 DiagnosticsGetDestructionWatcherRequest,
2425 fidl::encoding::DefaultFuchsiaResourceDialect,
2426 > for (T0,)
2427 {
2428 #[inline]
2429 unsafe fn encode(
2430 self,
2431 encoder: &mut fidl::encoding::Encoder<
2432 '_,
2433 fidl::encoding::DefaultFuchsiaResourceDialect,
2434 >,
2435 offset: usize,
2436 depth: fidl::encoding::Depth,
2437 ) -> fidl::Result<()> {
2438 encoder.debug_check_bounds::<DiagnosticsGetDestructionWatcherRequest>(offset);
2439 self.0.encode(encoder, offset + 0, depth)?;
2443 Ok(())
2444 }
2445 }
2446
2447 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2448 for DiagnosticsGetDestructionWatcherRequest
2449 {
2450 #[inline(always)]
2451 fn new_empty() -> Self {
2452 Self {
2453 watcher: fidl::new_empty!(
2454 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DestructionWatcherMarker>>,
2455 fidl::encoding::DefaultFuchsiaResourceDialect
2456 ),
2457 }
2458 }
2459
2460 #[inline]
2461 unsafe fn decode(
2462 &mut self,
2463 decoder: &mut fidl::encoding::Decoder<
2464 '_,
2465 fidl::encoding::DefaultFuchsiaResourceDialect,
2466 >,
2467 offset: usize,
2468 _depth: fidl::encoding::Depth,
2469 ) -> fidl::Result<()> {
2470 decoder.debug_check_bounds::<Self>(offset);
2471 fidl::decode!(
2473 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DestructionWatcherMarker>>,
2474 fidl::encoding::DefaultFuchsiaResourceDialect,
2475 &mut self.watcher,
2476 decoder,
2477 offset + 0,
2478 _depth
2479 )?;
2480 Ok(())
2481 }
2482 }
2483
2484 impl fidl::encoding::ResourceTypeMarker for DiagnosticsIterateIpRequest {
2485 type Borrowed<'a> = &'a mut Self;
2486 fn take_or_borrow<'a>(
2487 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2488 ) -> Self::Borrowed<'a> {
2489 value
2490 }
2491 }
2492
2493 unsafe impl fidl::encoding::TypeMarker for DiagnosticsIterateIpRequest {
2494 type Owned = Self;
2495
2496 #[inline(always)]
2497 fn inline_align(_context: fidl::encoding::Context) -> usize {
2498 8
2499 }
2500
2501 #[inline(always)]
2502 fn inline_size(_context: fidl::encoding::Context) -> usize {
2503 24
2504 }
2505 }
2506
2507 unsafe impl
2508 fidl::encoding::Encode<
2509 DiagnosticsIterateIpRequest,
2510 fidl::encoding::DefaultFuchsiaResourceDialect,
2511 > for &mut DiagnosticsIterateIpRequest
2512 {
2513 #[inline]
2514 unsafe fn encode(
2515 self,
2516 encoder: &mut fidl::encoding::Encoder<
2517 '_,
2518 fidl::encoding::DefaultFuchsiaResourceDialect,
2519 >,
2520 offset: usize,
2521 _depth: fidl::encoding::Depth,
2522 ) -> fidl::Result<()> {
2523 encoder.debug_check_bounds::<DiagnosticsIterateIpRequest>(offset);
2524 fidl::encoding::Encode::<DiagnosticsIterateIpRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2526 (
2527 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IpIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.s),
2528 <Extensions as fidl::encoding::ValueTypeMarker>::borrow(&self.extensions),
2529 <fidl::encoding::Vector<IpSocketMatcher, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.matchers),
2530 ),
2531 encoder, offset, _depth
2532 )
2533 }
2534 }
2535 unsafe impl<
2536 T0: fidl::encoding::Encode<
2537 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IpIteratorMarker>>,
2538 fidl::encoding::DefaultFuchsiaResourceDialect,
2539 >,
2540 T1: fidl::encoding::Encode<Extensions, fidl::encoding::DefaultFuchsiaResourceDialect>,
2541 T2: fidl::encoding::Encode<
2542 fidl::encoding::Vector<IpSocketMatcher, 128>,
2543 fidl::encoding::DefaultFuchsiaResourceDialect,
2544 >,
2545 >
2546 fidl::encoding::Encode<
2547 DiagnosticsIterateIpRequest,
2548 fidl::encoding::DefaultFuchsiaResourceDialect,
2549 > for (T0, T1, T2)
2550 {
2551 #[inline]
2552 unsafe fn encode(
2553 self,
2554 encoder: &mut fidl::encoding::Encoder<
2555 '_,
2556 fidl::encoding::DefaultFuchsiaResourceDialect,
2557 >,
2558 offset: usize,
2559 depth: fidl::encoding::Depth,
2560 ) -> fidl::Result<()> {
2561 encoder.debug_check_bounds::<DiagnosticsIterateIpRequest>(offset);
2562 self.0.encode(encoder, offset + 0, depth)?;
2566 self.1.encode(encoder, offset + 4, depth)?;
2567 self.2.encode(encoder, offset + 8, depth)?;
2568 Ok(())
2569 }
2570 }
2571
2572 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2573 for DiagnosticsIterateIpRequest
2574 {
2575 #[inline(always)]
2576 fn new_empty() -> Self {
2577 Self {
2578 s: fidl::new_empty!(
2579 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IpIteratorMarker>>,
2580 fidl::encoding::DefaultFuchsiaResourceDialect
2581 ),
2582 extensions: fidl::new_empty!(
2583 Extensions,
2584 fidl::encoding::DefaultFuchsiaResourceDialect
2585 ),
2586 matchers: fidl::new_empty!(fidl::encoding::Vector<IpSocketMatcher, 128>, fidl::encoding::DefaultFuchsiaResourceDialect),
2587 }
2588 }
2589
2590 #[inline]
2591 unsafe fn decode(
2592 &mut self,
2593 decoder: &mut fidl::encoding::Decoder<
2594 '_,
2595 fidl::encoding::DefaultFuchsiaResourceDialect,
2596 >,
2597 offset: usize,
2598 _depth: fidl::encoding::Depth,
2599 ) -> fidl::Result<()> {
2600 decoder.debug_check_bounds::<Self>(offset);
2601 fidl::decode!(
2603 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IpIteratorMarker>>,
2604 fidl::encoding::DefaultFuchsiaResourceDialect,
2605 &mut self.s,
2606 decoder,
2607 offset + 0,
2608 _depth
2609 )?;
2610 fidl::decode!(
2611 Extensions,
2612 fidl::encoding::DefaultFuchsiaResourceDialect,
2613 &mut self.extensions,
2614 decoder,
2615 offset + 4,
2616 _depth
2617 )?;
2618 fidl::decode!(fidl::encoding::Vector<IpSocketMatcher, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.matchers, decoder, offset + 8, _depth)?;
2619 Ok(())
2620 }
2621 }
2622}