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_routes_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct StateV4GetRuleWatcherV4Request {
16 pub watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
17 pub options: RuleWatcherOptionsV4,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for StateV4GetRuleWatcherV4Request
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct StateV4GetWatcherV4Request {
27 pub watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
28 pub options: WatcherOptionsV4,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for StateV4GetWatcherV4Request
33{
34}
35
36#[derive(Debug, PartialEq)]
37pub struct StateV6GetRuleWatcherV6Request {
38 pub watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
39 pub options: RuleWatcherOptionsV6,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43 for StateV6GetRuleWatcherV6Request
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct StateV6GetWatcherV6Request {
49 pub watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
50 pub options: WatcherOptionsV6,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
54 for StateV6GetWatcherV6Request
55{
56}
57
58#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
59pub struct RuleWatcherV4Marker;
60
61impl fidl::endpoints::ProtocolMarker for RuleWatcherV4Marker {
62 type Proxy = RuleWatcherV4Proxy;
63 type RequestStream = RuleWatcherV4RequestStream;
64 #[cfg(target_os = "fuchsia")]
65 type SynchronousProxy = RuleWatcherV4SynchronousProxy;
66
67 const DEBUG_NAME: &'static str = "(anonymous) RuleWatcherV4";
68}
69
70pub trait RuleWatcherV4ProxyInterface: Send + Sync {
71 type WatchResponseFut: std::future::Future<Output = Result<Vec<RuleEventV4>, fidl::Error>>
72 + Send;
73 fn r#watch(&self) -> Self::WatchResponseFut;
74}
75#[derive(Debug)]
76#[cfg(target_os = "fuchsia")]
77pub struct RuleWatcherV4SynchronousProxy {
78 client: fidl::client::sync::Client,
79}
80
81#[cfg(target_os = "fuchsia")]
82impl fidl::endpoints::SynchronousProxy for RuleWatcherV4SynchronousProxy {
83 type Proxy = RuleWatcherV4Proxy;
84 type Protocol = RuleWatcherV4Marker;
85
86 fn from_channel(inner: fidl::Channel) -> Self {
87 Self::new(inner)
88 }
89
90 fn into_channel(self) -> fidl::Channel {
91 self.client.into_channel()
92 }
93
94 fn as_channel(&self) -> &fidl::Channel {
95 self.client.as_channel()
96 }
97}
98
99#[cfg(target_os = "fuchsia")]
100impl RuleWatcherV4SynchronousProxy {
101 pub fn new(channel: fidl::Channel) -> Self {
102 let protocol_name = <RuleWatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
103 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
104 }
105
106 pub fn into_channel(self) -> fidl::Channel {
107 self.client.into_channel()
108 }
109
110 pub fn wait_for_event(
113 &self,
114 deadline: zx::MonotonicInstant,
115 ) -> Result<RuleWatcherV4Event, fidl::Error> {
116 RuleWatcherV4Event::decode(self.client.wait_for_event(deadline)?)
117 }
118
119 pub fn r#watch(
133 &self,
134 ___deadline: zx::MonotonicInstant,
135 ) -> Result<Vec<RuleEventV4>, fidl::Error> {
136 let _response =
137 self.client.send_query::<fidl::encoding::EmptyPayload, RuleWatcherV4WatchResponse>(
138 (),
139 0x7f94d7ea0f843271,
140 fidl::encoding::DynamicFlags::empty(),
141 ___deadline,
142 )?;
143 Ok(_response.events)
144 }
145}
146
147#[derive(Debug, Clone)]
148pub struct RuleWatcherV4Proxy {
149 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
150}
151
152impl fidl::endpoints::Proxy for RuleWatcherV4Proxy {
153 type Protocol = RuleWatcherV4Marker;
154
155 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
156 Self::new(inner)
157 }
158
159 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
160 self.client.into_channel().map_err(|client| Self { client })
161 }
162
163 fn as_channel(&self) -> &::fidl::AsyncChannel {
164 self.client.as_channel()
165 }
166}
167
168impl RuleWatcherV4Proxy {
169 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
171 let protocol_name = <RuleWatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
172 Self { client: fidl::client::Client::new(channel, protocol_name) }
173 }
174
175 pub fn take_event_stream(&self) -> RuleWatcherV4EventStream {
181 RuleWatcherV4EventStream { event_receiver: self.client.take_event_receiver() }
182 }
183
184 pub fn r#watch(
198 &self,
199 ) -> fidl::client::QueryResponseFut<
200 Vec<RuleEventV4>,
201 fidl::encoding::DefaultFuchsiaResourceDialect,
202 > {
203 RuleWatcherV4ProxyInterface::r#watch(self)
204 }
205}
206
207impl RuleWatcherV4ProxyInterface for RuleWatcherV4Proxy {
208 type WatchResponseFut = fidl::client::QueryResponseFut<
209 Vec<RuleEventV4>,
210 fidl::encoding::DefaultFuchsiaResourceDialect,
211 >;
212 fn r#watch(&self) -> Self::WatchResponseFut {
213 fn _decode(
214 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
215 ) -> Result<Vec<RuleEventV4>, fidl::Error> {
216 let _response = fidl::client::decode_transaction_body::<
217 RuleWatcherV4WatchResponse,
218 fidl::encoding::DefaultFuchsiaResourceDialect,
219 0x7f94d7ea0f843271,
220 >(_buf?)?;
221 Ok(_response.events)
222 }
223 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<RuleEventV4>>(
224 (),
225 0x7f94d7ea0f843271,
226 fidl::encoding::DynamicFlags::empty(),
227 _decode,
228 )
229 }
230}
231
232pub struct RuleWatcherV4EventStream {
233 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
234}
235
236impl std::marker::Unpin for RuleWatcherV4EventStream {}
237
238impl futures::stream::FusedStream for RuleWatcherV4EventStream {
239 fn is_terminated(&self) -> bool {
240 self.event_receiver.is_terminated()
241 }
242}
243
244impl futures::Stream for RuleWatcherV4EventStream {
245 type Item = Result<RuleWatcherV4Event, fidl::Error>;
246
247 fn poll_next(
248 mut self: std::pin::Pin<&mut Self>,
249 cx: &mut std::task::Context<'_>,
250 ) -> std::task::Poll<Option<Self::Item>> {
251 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
252 &mut self.event_receiver,
253 cx
254 )?) {
255 Some(buf) => std::task::Poll::Ready(Some(RuleWatcherV4Event::decode(buf))),
256 None => std::task::Poll::Ready(None),
257 }
258 }
259}
260
261#[derive(Debug)]
262pub enum RuleWatcherV4Event {}
263
264impl RuleWatcherV4Event {
265 fn decode(
267 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
268 ) -> Result<RuleWatcherV4Event, fidl::Error> {
269 let (bytes, _handles) = buf.split_mut();
270 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
271 debug_assert_eq!(tx_header.tx_id, 0);
272 match tx_header.ordinal {
273 _ => Err(fidl::Error::UnknownOrdinal {
274 ordinal: tx_header.ordinal,
275 protocol_name: <RuleWatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
276 }),
277 }
278 }
279}
280
281pub struct RuleWatcherV4RequestStream {
283 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
284 is_terminated: bool,
285}
286
287impl std::marker::Unpin for RuleWatcherV4RequestStream {}
288
289impl futures::stream::FusedStream for RuleWatcherV4RequestStream {
290 fn is_terminated(&self) -> bool {
291 self.is_terminated
292 }
293}
294
295impl fidl::endpoints::RequestStream for RuleWatcherV4RequestStream {
296 type Protocol = RuleWatcherV4Marker;
297 type ControlHandle = RuleWatcherV4ControlHandle;
298
299 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
300 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
301 }
302
303 fn control_handle(&self) -> Self::ControlHandle {
304 RuleWatcherV4ControlHandle { inner: self.inner.clone() }
305 }
306
307 fn into_inner(
308 self,
309 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
310 {
311 (self.inner, self.is_terminated)
312 }
313
314 fn from_inner(
315 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
316 is_terminated: bool,
317 ) -> Self {
318 Self { inner, is_terminated }
319 }
320}
321
322impl futures::Stream for RuleWatcherV4RequestStream {
323 type Item = Result<RuleWatcherV4Request, fidl::Error>;
324
325 fn poll_next(
326 mut self: std::pin::Pin<&mut Self>,
327 cx: &mut std::task::Context<'_>,
328 ) -> std::task::Poll<Option<Self::Item>> {
329 let this = &mut *self;
330 if this.inner.check_shutdown(cx) {
331 this.is_terminated = true;
332 return std::task::Poll::Ready(None);
333 }
334 if this.is_terminated {
335 panic!("polled RuleWatcherV4RequestStream after completion");
336 }
337 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
338 |bytes, handles| {
339 match this.inner.channel().read_etc(cx, bytes, handles) {
340 std::task::Poll::Ready(Ok(())) => {}
341 std::task::Poll::Pending => return std::task::Poll::Pending,
342 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
343 this.is_terminated = true;
344 return std::task::Poll::Ready(None);
345 }
346 std::task::Poll::Ready(Err(e)) => {
347 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
348 e.into(),
349 ))))
350 }
351 }
352
353 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
355
356 std::task::Poll::Ready(Some(match header.ordinal {
357 0x7f94d7ea0f843271 => {
358 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
359 let mut req = fidl::new_empty!(
360 fidl::encoding::EmptyPayload,
361 fidl::encoding::DefaultFuchsiaResourceDialect
362 );
363 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
364 let control_handle =
365 RuleWatcherV4ControlHandle { inner: this.inner.clone() };
366 Ok(RuleWatcherV4Request::Watch {
367 responder: RuleWatcherV4WatchResponder {
368 control_handle: std::mem::ManuallyDrop::new(control_handle),
369 tx_id: header.tx_id,
370 },
371 })
372 }
373 _ => Err(fidl::Error::UnknownOrdinal {
374 ordinal: header.ordinal,
375 protocol_name:
376 <RuleWatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
377 }),
378 }))
379 },
380 )
381 }
382}
383
384#[derive(Debug)]
386pub enum RuleWatcherV4Request {
387 Watch { responder: RuleWatcherV4WatchResponder },
401}
402
403impl RuleWatcherV4Request {
404 #[allow(irrefutable_let_patterns)]
405 pub fn into_watch(self) -> Option<(RuleWatcherV4WatchResponder)> {
406 if let RuleWatcherV4Request::Watch { responder } = self {
407 Some((responder))
408 } else {
409 None
410 }
411 }
412
413 pub fn method_name(&self) -> &'static str {
415 match *self {
416 RuleWatcherV4Request::Watch { .. } => "watch",
417 }
418 }
419}
420
421#[derive(Debug, Clone)]
422pub struct RuleWatcherV4ControlHandle {
423 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
424}
425
426impl fidl::endpoints::ControlHandle for RuleWatcherV4ControlHandle {
427 fn shutdown(&self) {
428 self.inner.shutdown()
429 }
430 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
431 self.inner.shutdown_with_epitaph(status)
432 }
433
434 fn is_closed(&self) -> bool {
435 self.inner.channel().is_closed()
436 }
437 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
438 self.inner.channel().on_closed()
439 }
440
441 #[cfg(target_os = "fuchsia")]
442 fn signal_peer(
443 &self,
444 clear_mask: zx::Signals,
445 set_mask: zx::Signals,
446 ) -> Result<(), zx_status::Status> {
447 use fidl::Peered;
448 self.inner.channel().signal_peer(clear_mask, set_mask)
449 }
450}
451
452impl RuleWatcherV4ControlHandle {}
453
454#[must_use = "FIDL methods require a response to be sent"]
455#[derive(Debug)]
456pub struct RuleWatcherV4WatchResponder {
457 control_handle: std::mem::ManuallyDrop<RuleWatcherV4ControlHandle>,
458 tx_id: u32,
459}
460
461impl std::ops::Drop for RuleWatcherV4WatchResponder {
465 fn drop(&mut self) {
466 self.control_handle.shutdown();
467 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
469 }
470}
471
472impl fidl::endpoints::Responder for RuleWatcherV4WatchResponder {
473 type ControlHandle = RuleWatcherV4ControlHandle;
474
475 fn control_handle(&self) -> &RuleWatcherV4ControlHandle {
476 &self.control_handle
477 }
478
479 fn drop_without_shutdown(mut self) {
480 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
482 std::mem::forget(self);
484 }
485}
486
487impl RuleWatcherV4WatchResponder {
488 pub fn send(self, mut events: &[RuleEventV4]) -> Result<(), fidl::Error> {
492 let _result = self.send_raw(events);
493 if _result.is_err() {
494 self.control_handle.shutdown();
495 }
496 self.drop_without_shutdown();
497 _result
498 }
499
500 pub fn send_no_shutdown_on_err(self, mut events: &[RuleEventV4]) -> Result<(), fidl::Error> {
502 let _result = self.send_raw(events);
503 self.drop_without_shutdown();
504 _result
505 }
506
507 fn send_raw(&self, mut events: &[RuleEventV4]) -> Result<(), fidl::Error> {
508 self.control_handle.inner.send::<RuleWatcherV4WatchResponse>(
509 (events,),
510 self.tx_id,
511 0x7f94d7ea0f843271,
512 fidl::encoding::DynamicFlags::empty(),
513 )
514 }
515}
516
517#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
518pub struct RuleWatcherV6Marker;
519
520impl fidl::endpoints::ProtocolMarker for RuleWatcherV6Marker {
521 type Proxy = RuleWatcherV6Proxy;
522 type RequestStream = RuleWatcherV6RequestStream;
523 #[cfg(target_os = "fuchsia")]
524 type SynchronousProxy = RuleWatcherV6SynchronousProxy;
525
526 const DEBUG_NAME: &'static str = "(anonymous) RuleWatcherV6";
527}
528
529pub trait RuleWatcherV6ProxyInterface: Send + Sync {
530 type WatchResponseFut: std::future::Future<Output = Result<Vec<RuleEventV6>, fidl::Error>>
531 + Send;
532 fn r#watch(&self) -> Self::WatchResponseFut;
533}
534#[derive(Debug)]
535#[cfg(target_os = "fuchsia")]
536pub struct RuleWatcherV6SynchronousProxy {
537 client: fidl::client::sync::Client,
538}
539
540#[cfg(target_os = "fuchsia")]
541impl fidl::endpoints::SynchronousProxy for RuleWatcherV6SynchronousProxy {
542 type Proxy = RuleWatcherV6Proxy;
543 type Protocol = RuleWatcherV6Marker;
544
545 fn from_channel(inner: fidl::Channel) -> Self {
546 Self::new(inner)
547 }
548
549 fn into_channel(self) -> fidl::Channel {
550 self.client.into_channel()
551 }
552
553 fn as_channel(&self) -> &fidl::Channel {
554 self.client.as_channel()
555 }
556}
557
558#[cfg(target_os = "fuchsia")]
559impl RuleWatcherV6SynchronousProxy {
560 pub fn new(channel: fidl::Channel) -> Self {
561 let protocol_name = <RuleWatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
562 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
563 }
564
565 pub fn into_channel(self) -> fidl::Channel {
566 self.client.into_channel()
567 }
568
569 pub fn wait_for_event(
572 &self,
573 deadline: zx::MonotonicInstant,
574 ) -> Result<RuleWatcherV6Event, fidl::Error> {
575 RuleWatcherV6Event::decode(self.client.wait_for_event(deadline)?)
576 }
577
578 pub fn r#watch(
592 &self,
593 ___deadline: zx::MonotonicInstant,
594 ) -> Result<Vec<RuleEventV6>, fidl::Error> {
595 let _response =
596 self.client.send_query::<fidl::encoding::EmptyPayload, RuleWatcherV6WatchResponse>(
597 (),
598 0x5ccd746122bfa678,
599 fidl::encoding::DynamicFlags::empty(),
600 ___deadline,
601 )?;
602 Ok(_response.events)
603 }
604}
605
606#[derive(Debug, Clone)]
607pub struct RuleWatcherV6Proxy {
608 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
609}
610
611impl fidl::endpoints::Proxy for RuleWatcherV6Proxy {
612 type Protocol = RuleWatcherV6Marker;
613
614 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
615 Self::new(inner)
616 }
617
618 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
619 self.client.into_channel().map_err(|client| Self { client })
620 }
621
622 fn as_channel(&self) -> &::fidl::AsyncChannel {
623 self.client.as_channel()
624 }
625}
626
627impl RuleWatcherV6Proxy {
628 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
630 let protocol_name = <RuleWatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
631 Self { client: fidl::client::Client::new(channel, protocol_name) }
632 }
633
634 pub fn take_event_stream(&self) -> RuleWatcherV6EventStream {
640 RuleWatcherV6EventStream { event_receiver: self.client.take_event_receiver() }
641 }
642
643 pub fn r#watch(
657 &self,
658 ) -> fidl::client::QueryResponseFut<
659 Vec<RuleEventV6>,
660 fidl::encoding::DefaultFuchsiaResourceDialect,
661 > {
662 RuleWatcherV6ProxyInterface::r#watch(self)
663 }
664}
665
666impl RuleWatcherV6ProxyInterface for RuleWatcherV6Proxy {
667 type WatchResponseFut = fidl::client::QueryResponseFut<
668 Vec<RuleEventV6>,
669 fidl::encoding::DefaultFuchsiaResourceDialect,
670 >;
671 fn r#watch(&self) -> Self::WatchResponseFut {
672 fn _decode(
673 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
674 ) -> Result<Vec<RuleEventV6>, fidl::Error> {
675 let _response = fidl::client::decode_transaction_body::<
676 RuleWatcherV6WatchResponse,
677 fidl::encoding::DefaultFuchsiaResourceDialect,
678 0x5ccd746122bfa678,
679 >(_buf?)?;
680 Ok(_response.events)
681 }
682 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<RuleEventV6>>(
683 (),
684 0x5ccd746122bfa678,
685 fidl::encoding::DynamicFlags::empty(),
686 _decode,
687 )
688 }
689}
690
691pub struct RuleWatcherV6EventStream {
692 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
693}
694
695impl std::marker::Unpin for RuleWatcherV6EventStream {}
696
697impl futures::stream::FusedStream for RuleWatcherV6EventStream {
698 fn is_terminated(&self) -> bool {
699 self.event_receiver.is_terminated()
700 }
701}
702
703impl futures::Stream for RuleWatcherV6EventStream {
704 type Item = Result<RuleWatcherV6Event, fidl::Error>;
705
706 fn poll_next(
707 mut self: std::pin::Pin<&mut Self>,
708 cx: &mut std::task::Context<'_>,
709 ) -> std::task::Poll<Option<Self::Item>> {
710 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
711 &mut self.event_receiver,
712 cx
713 )?) {
714 Some(buf) => std::task::Poll::Ready(Some(RuleWatcherV6Event::decode(buf))),
715 None => std::task::Poll::Ready(None),
716 }
717 }
718}
719
720#[derive(Debug)]
721pub enum RuleWatcherV6Event {}
722
723impl RuleWatcherV6Event {
724 fn decode(
726 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
727 ) -> Result<RuleWatcherV6Event, fidl::Error> {
728 let (bytes, _handles) = buf.split_mut();
729 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
730 debug_assert_eq!(tx_header.tx_id, 0);
731 match tx_header.ordinal {
732 _ => Err(fidl::Error::UnknownOrdinal {
733 ordinal: tx_header.ordinal,
734 protocol_name: <RuleWatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
735 }),
736 }
737 }
738}
739
740pub struct RuleWatcherV6RequestStream {
742 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
743 is_terminated: bool,
744}
745
746impl std::marker::Unpin for RuleWatcherV6RequestStream {}
747
748impl futures::stream::FusedStream for RuleWatcherV6RequestStream {
749 fn is_terminated(&self) -> bool {
750 self.is_terminated
751 }
752}
753
754impl fidl::endpoints::RequestStream for RuleWatcherV6RequestStream {
755 type Protocol = RuleWatcherV6Marker;
756 type ControlHandle = RuleWatcherV6ControlHandle;
757
758 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
759 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
760 }
761
762 fn control_handle(&self) -> Self::ControlHandle {
763 RuleWatcherV6ControlHandle { inner: self.inner.clone() }
764 }
765
766 fn into_inner(
767 self,
768 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
769 {
770 (self.inner, self.is_terminated)
771 }
772
773 fn from_inner(
774 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
775 is_terminated: bool,
776 ) -> Self {
777 Self { inner, is_terminated }
778 }
779}
780
781impl futures::Stream for RuleWatcherV6RequestStream {
782 type Item = Result<RuleWatcherV6Request, fidl::Error>;
783
784 fn poll_next(
785 mut self: std::pin::Pin<&mut Self>,
786 cx: &mut std::task::Context<'_>,
787 ) -> std::task::Poll<Option<Self::Item>> {
788 let this = &mut *self;
789 if this.inner.check_shutdown(cx) {
790 this.is_terminated = true;
791 return std::task::Poll::Ready(None);
792 }
793 if this.is_terminated {
794 panic!("polled RuleWatcherV6RequestStream after completion");
795 }
796 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
797 |bytes, handles| {
798 match this.inner.channel().read_etc(cx, bytes, handles) {
799 std::task::Poll::Ready(Ok(())) => {}
800 std::task::Poll::Pending => return std::task::Poll::Pending,
801 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
802 this.is_terminated = true;
803 return std::task::Poll::Ready(None);
804 }
805 std::task::Poll::Ready(Err(e)) => {
806 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
807 e.into(),
808 ))))
809 }
810 }
811
812 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
814
815 std::task::Poll::Ready(Some(match header.ordinal {
816 0x5ccd746122bfa678 => {
817 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
818 let mut req = fidl::new_empty!(
819 fidl::encoding::EmptyPayload,
820 fidl::encoding::DefaultFuchsiaResourceDialect
821 );
822 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
823 let control_handle =
824 RuleWatcherV6ControlHandle { inner: this.inner.clone() };
825 Ok(RuleWatcherV6Request::Watch {
826 responder: RuleWatcherV6WatchResponder {
827 control_handle: std::mem::ManuallyDrop::new(control_handle),
828 tx_id: header.tx_id,
829 },
830 })
831 }
832 _ => Err(fidl::Error::UnknownOrdinal {
833 ordinal: header.ordinal,
834 protocol_name:
835 <RuleWatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
836 }),
837 }))
838 },
839 )
840 }
841}
842
843#[derive(Debug)]
845pub enum RuleWatcherV6Request {
846 Watch { responder: RuleWatcherV6WatchResponder },
860}
861
862impl RuleWatcherV6Request {
863 #[allow(irrefutable_let_patterns)]
864 pub fn into_watch(self) -> Option<(RuleWatcherV6WatchResponder)> {
865 if let RuleWatcherV6Request::Watch { responder } = self {
866 Some((responder))
867 } else {
868 None
869 }
870 }
871
872 pub fn method_name(&self) -> &'static str {
874 match *self {
875 RuleWatcherV6Request::Watch { .. } => "watch",
876 }
877 }
878}
879
880#[derive(Debug, Clone)]
881pub struct RuleWatcherV6ControlHandle {
882 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
883}
884
885impl fidl::endpoints::ControlHandle for RuleWatcherV6ControlHandle {
886 fn shutdown(&self) {
887 self.inner.shutdown()
888 }
889 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
890 self.inner.shutdown_with_epitaph(status)
891 }
892
893 fn is_closed(&self) -> bool {
894 self.inner.channel().is_closed()
895 }
896 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
897 self.inner.channel().on_closed()
898 }
899
900 #[cfg(target_os = "fuchsia")]
901 fn signal_peer(
902 &self,
903 clear_mask: zx::Signals,
904 set_mask: zx::Signals,
905 ) -> Result<(), zx_status::Status> {
906 use fidl::Peered;
907 self.inner.channel().signal_peer(clear_mask, set_mask)
908 }
909}
910
911impl RuleWatcherV6ControlHandle {}
912
913#[must_use = "FIDL methods require a response to be sent"]
914#[derive(Debug)]
915pub struct RuleWatcherV6WatchResponder {
916 control_handle: std::mem::ManuallyDrop<RuleWatcherV6ControlHandle>,
917 tx_id: u32,
918}
919
920impl std::ops::Drop for RuleWatcherV6WatchResponder {
924 fn drop(&mut self) {
925 self.control_handle.shutdown();
926 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
928 }
929}
930
931impl fidl::endpoints::Responder for RuleWatcherV6WatchResponder {
932 type ControlHandle = RuleWatcherV6ControlHandle;
933
934 fn control_handle(&self) -> &RuleWatcherV6ControlHandle {
935 &self.control_handle
936 }
937
938 fn drop_without_shutdown(mut self) {
939 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
941 std::mem::forget(self);
943 }
944}
945
946impl RuleWatcherV6WatchResponder {
947 pub fn send(self, mut events: &[RuleEventV6]) -> Result<(), fidl::Error> {
951 let _result = self.send_raw(events);
952 if _result.is_err() {
953 self.control_handle.shutdown();
954 }
955 self.drop_without_shutdown();
956 _result
957 }
958
959 pub fn send_no_shutdown_on_err(self, mut events: &[RuleEventV6]) -> Result<(), fidl::Error> {
961 let _result = self.send_raw(events);
962 self.drop_without_shutdown();
963 _result
964 }
965
966 fn send_raw(&self, mut events: &[RuleEventV6]) -> Result<(), fidl::Error> {
967 self.control_handle.inner.send::<RuleWatcherV6WatchResponse>(
968 (events,),
969 self.tx_id,
970 0x5ccd746122bfa678,
971 fidl::encoding::DynamicFlags::empty(),
972 )
973 }
974}
975
976#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
977pub struct StateMarker;
978
979impl fidl::endpoints::ProtocolMarker for StateMarker {
980 type Proxy = StateProxy;
981 type RequestStream = StateRequestStream;
982 #[cfg(target_os = "fuchsia")]
983 type SynchronousProxy = StateSynchronousProxy;
984
985 const DEBUG_NAME: &'static str = "fuchsia.net.routes.State";
986}
987impl fidl::endpoints::DiscoverableProtocolMarker for StateMarker {}
988pub type StateResolveResult = Result<Resolved, i32>;
989pub type StateResolve2Result = Result<ResolveResult, ResolveError>;
990pub type StateGetRouteTableNameResult = Result<String, StateGetRouteTableNameError>;
991
992pub trait StateProxyInterface: Send + Sync {
993 type ResolveResponseFut: std::future::Future<Output = Result<StateResolveResult, fidl::Error>>
994 + Send;
995 fn r#resolve(&self, destination: &fidl_fuchsia_net::IpAddress) -> Self::ResolveResponseFut;
996 type Resolve2ResponseFut: std::future::Future<Output = Result<StateResolve2Result, fidl::Error>>
997 + Send;
998 fn r#resolve2(
999 &self,
1000 destination: &fidl_fuchsia_net::IpAddress,
1001 options: &ResolveOptions,
1002 ) -> Self::Resolve2ResponseFut;
1003 type GetRouteTableNameResponseFut: std::future::Future<Output = Result<StateGetRouteTableNameResult, fidl::Error>>
1004 + Send;
1005 fn r#get_route_table_name(&self, table_id: u32) -> Self::GetRouteTableNameResponseFut;
1006}
1007#[derive(Debug)]
1008#[cfg(target_os = "fuchsia")]
1009pub struct StateSynchronousProxy {
1010 client: fidl::client::sync::Client,
1011}
1012
1013#[cfg(target_os = "fuchsia")]
1014impl fidl::endpoints::SynchronousProxy for StateSynchronousProxy {
1015 type Proxy = StateProxy;
1016 type Protocol = StateMarker;
1017
1018 fn from_channel(inner: fidl::Channel) -> Self {
1019 Self::new(inner)
1020 }
1021
1022 fn into_channel(self) -> fidl::Channel {
1023 self.client.into_channel()
1024 }
1025
1026 fn as_channel(&self) -> &fidl::Channel {
1027 self.client.as_channel()
1028 }
1029}
1030
1031#[cfg(target_os = "fuchsia")]
1032impl StateSynchronousProxy {
1033 pub fn new(channel: fidl::Channel) -> Self {
1034 let protocol_name = <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1035 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1036 }
1037
1038 pub fn into_channel(self) -> fidl::Channel {
1039 self.client.into_channel()
1040 }
1041
1042 pub fn wait_for_event(
1045 &self,
1046 deadline: zx::MonotonicInstant,
1047 ) -> Result<StateEvent, fidl::Error> {
1048 StateEvent::decode(self.client.wait_for_event(deadline)?)
1049 }
1050
1051 pub fn r#resolve(
1060 &self,
1061 mut destination: &fidl_fuchsia_net::IpAddress,
1062 ___deadline: zx::MonotonicInstant,
1063 ) -> Result<StateResolveResult, fidl::Error> {
1064 let _response = self.client.send_query::<
1065 StateResolveRequest,
1066 fidl::encoding::ResultType<StateResolveResponse, i32>,
1067 >(
1068 (destination,),
1069 0x1541bc37d2d1dfb0,
1070 fidl::encoding::DynamicFlags::empty(),
1071 ___deadline,
1072 )?;
1073 Ok(_response.map(|x| x.result))
1074 }
1075
1076 pub fn r#resolve2(
1086 &self,
1087 mut destination: &fidl_fuchsia_net::IpAddress,
1088 mut options: &ResolveOptions,
1089 ___deadline: zx::MonotonicInstant,
1090 ) -> Result<StateResolve2Result, fidl::Error> {
1091 let _response = self.client.send_query::<StateResolve2Request, fidl::encoding::ResultType<
1092 StateResolve2Response,
1093 ResolveError,
1094 >>(
1095 (destination, options),
1096 0x3a37608b6851f75c,
1097 fidl::encoding::DynamicFlags::empty(),
1098 ___deadline,
1099 )?;
1100 Ok(_response.map(|x| x.result))
1101 }
1102
1103 pub fn r#get_route_table_name(
1110 &self,
1111 mut table_id: u32,
1112 ___deadline: zx::MonotonicInstant,
1113 ) -> Result<StateGetRouteTableNameResult, fidl::Error> {
1114 let _response =
1115 self.client.send_query::<StateGetRouteTableNameRequest, fidl::encoding::ResultType<
1116 StateGetRouteTableNameResponse,
1117 StateGetRouteTableNameError,
1118 >>(
1119 (table_id,),
1120 0x6fed5423c7ce421a,
1121 fidl::encoding::DynamicFlags::empty(),
1122 ___deadline,
1123 )?;
1124 Ok(_response.map(|x| x.table_name))
1125 }
1126}
1127
1128#[derive(Debug, Clone)]
1129pub struct StateProxy {
1130 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1131}
1132
1133impl fidl::endpoints::Proxy for StateProxy {
1134 type Protocol = StateMarker;
1135
1136 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1137 Self::new(inner)
1138 }
1139
1140 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1141 self.client.into_channel().map_err(|client| Self { client })
1142 }
1143
1144 fn as_channel(&self) -> &::fidl::AsyncChannel {
1145 self.client.as_channel()
1146 }
1147}
1148
1149impl StateProxy {
1150 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1152 let protocol_name = <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1153 Self { client: fidl::client::Client::new(channel, protocol_name) }
1154 }
1155
1156 pub fn take_event_stream(&self) -> StateEventStream {
1162 StateEventStream { event_receiver: self.client.take_event_receiver() }
1163 }
1164
1165 pub fn r#resolve(
1174 &self,
1175 mut destination: &fidl_fuchsia_net::IpAddress,
1176 ) -> fidl::client::QueryResponseFut<
1177 StateResolveResult,
1178 fidl::encoding::DefaultFuchsiaResourceDialect,
1179 > {
1180 StateProxyInterface::r#resolve(self, destination)
1181 }
1182
1183 pub fn r#resolve2(
1193 &self,
1194 mut destination: &fidl_fuchsia_net::IpAddress,
1195 mut options: &ResolveOptions,
1196 ) -> fidl::client::QueryResponseFut<
1197 StateResolve2Result,
1198 fidl::encoding::DefaultFuchsiaResourceDialect,
1199 > {
1200 StateProxyInterface::r#resolve2(self, destination, options)
1201 }
1202
1203 pub fn r#get_route_table_name(
1210 &self,
1211 mut table_id: u32,
1212 ) -> fidl::client::QueryResponseFut<
1213 StateGetRouteTableNameResult,
1214 fidl::encoding::DefaultFuchsiaResourceDialect,
1215 > {
1216 StateProxyInterface::r#get_route_table_name(self, table_id)
1217 }
1218}
1219
1220impl StateProxyInterface for StateProxy {
1221 type ResolveResponseFut = fidl::client::QueryResponseFut<
1222 StateResolveResult,
1223 fidl::encoding::DefaultFuchsiaResourceDialect,
1224 >;
1225 fn r#resolve(&self, mut destination: &fidl_fuchsia_net::IpAddress) -> Self::ResolveResponseFut {
1226 fn _decode(
1227 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1228 ) -> Result<StateResolveResult, fidl::Error> {
1229 let _response = fidl::client::decode_transaction_body::<
1230 fidl::encoding::ResultType<StateResolveResponse, i32>,
1231 fidl::encoding::DefaultFuchsiaResourceDialect,
1232 0x1541bc37d2d1dfb0,
1233 >(_buf?)?;
1234 Ok(_response.map(|x| x.result))
1235 }
1236 self.client.send_query_and_decode::<StateResolveRequest, StateResolveResult>(
1237 (destination,),
1238 0x1541bc37d2d1dfb0,
1239 fidl::encoding::DynamicFlags::empty(),
1240 _decode,
1241 )
1242 }
1243
1244 type Resolve2ResponseFut = fidl::client::QueryResponseFut<
1245 StateResolve2Result,
1246 fidl::encoding::DefaultFuchsiaResourceDialect,
1247 >;
1248 fn r#resolve2(
1249 &self,
1250 mut destination: &fidl_fuchsia_net::IpAddress,
1251 mut options: &ResolveOptions,
1252 ) -> Self::Resolve2ResponseFut {
1253 fn _decode(
1254 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1255 ) -> Result<StateResolve2Result, fidl::Error> {
1256 let _response = fidl::client::decode_transaction_body::<
1257 fidl::encoding::ResultType<StateResolve2Response, ResolveError>,
1258 fidl::encoding::DefaultFuchsiaResourceDialect,
1259 0x3a37608b6851f75c,
1260 >(_buf?)?;
1261 Ok(_response.map(|x| x.result))
1262 }
1263 self.client.send_query_and_decode::<StateResolve2Request, StateResolve2Result>(
1264 (destination, options),
1265 0x3a37608b6851f75c,
1266 fidl::encoding::DynamicFlags::empty(),
1267 _decode,
1268 )
1269 }
1270
1271 type GetRouteTableNameResponseFut = fidl::client::QueryResponseFut<
1272 StateGetRouteTableNameResult,
1273 fidl::encoding::DefaultFuchsiaResourceDialect,
1274 >;
1275 fn r#get_route_table_name(&self, mut table_id: u32) -> Self::GetRouteTableNameResponseFut {
1276 fn _decode(
1277 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1278 ) -> Result<StateGetRouteTableNameResult, fidl::Error> {
1279 let _response = fidl::client::decode_transaction_body::<
1280 fidl::encoding::ResultType<
1281 StateGetRouteTableNameResponse,
1282 StateGetRouteTableNameError,
1283 >,
1284 fidl::encoding::DefaultFuchsiaResourceDialect,
1285 0x6fed5423c7ce421a,
1286 >(_buf?)?;
1287 Ok(_response.map(|x| x.table_name))
1288 }
1289 self.client
1290 .send_query_and_decode::<StateGetRouteTableNameRequest, StateGetRouteTableNameResult>(
1291 (table_id,),
1292 0x6fed5423c7ce421a,
1293 fidl::encoding::DynamicFlags::empty(),
1294 _decode,
1295 )
1296 }
1297}
1298
1299pub struct StateEventStream {
1300 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1301}
1302
1303impl std::marker::Unpin for StateEventStream {}
1304
1305impl futures::stream::FusedStream for StateEventStream {
1306 fn is_terminated(&self) -> bool {
1307 self.event_receiver.is_terminated()
1308 }
1309}
1310
1311impl futures::Stream for StateEventStream {
1312 type Item = Result<StateEvent, fidl::Error>;
1313
1314 fn poll_next(
1315 mut self: std::pin::Pin<&mut Self>,
1316 cx: &mut std::task::Context<'_>,
1317 ) -> std::task::Poll<Option<Self::Item>> {
1318 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1319 &mut self.event_receiver,
1320 cx
1321 )?) {
1322 Some(buf) => std::task::Poll::Ready(Some(StateEvent::decode(buf))),
1323 None => std::task::Poll::Ready(None),
1324 }
1325 }
1326}
1327
1328#[derive(Debug)]
1329pub enum StateEvent {}
1330
1331impl StateEvent {
1332 fn decode(
1334 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1335 ) -> Result<StateEvent, fidl::Error> {
1336 let (bytes, _handles) = buf.split_mut();
1337 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1338 debug_assert_eq!(tx_header.tx_id, 0);
1339 match tx_header.ordinal {
1340 _ => Err(fidl::Error::UnknownOrdinal {
1341 ordinal: tx_header.ordinal,
1342 protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1343 }),
1344 }
1345 }
1346}
1347
1348pub struct StateRequestStream {
1350 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1351 is_terminated: bool,
1352}
1353
1354impl std::marker::Unpin for StateRequestStream {}
1355
1356impl futures::stream::FusedStream for StateRequestStream {
1357 fn is_terminated(&self) -> bool {
1358 self.is_terminated
1359 }
1360}
1361
1362impl fidl::endpoints::RequestStream for StateRequestStream {
1363 type Protocol = StateMarker;
1364 type ControlHandle = StateControlHandle;
1365
1366 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1367 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1368 }
1369
1370 fn control_handle(&self) -> Self::ControlHandle {
1371 StateControlHandle { inner: self.inner.clone() }
1372 }
1373
1374 fn into_inner(
1375 self,
1376 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1377 {
1378 (self.inner, self.is_terminated)
1379 }
1380
1381 fn from_inner(
1382 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1383 is_terminated: bool,
1384 ) -> Self {
1385 Self { inner, is_terminated }
1386 }
1387}
1388
1389impl futures::Stream for StateRequestStream {
1390 type Item = Result<StateRequest, fidl::Error>;
1391
1392 fn poll_next(
1393 mut self: std::pin::Pin<&mut Self>,
1394 cx: &mut std::task::Context<'_>,
1395 ) -> std::task::Poll<Option<Self::Item>> {
1396 let this = &mut *self;
1397 if this.inner.check_shutdown(cx) {
1398 this.is_terminated = true;
1399 return std::task::Poll::Ready(None);
1400 }
1401 if this.is_terminated {
1402 panic!("polled StateRequestStream after completion");
1403 }
1404 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1405 |bytes, handles| {
1406 match this.inner.channel().read_etc(cx, bytes, handles) {
1407 std::task::Poll::Ready(Ok(())) => {}
1408 std::task::Poll::Pending => return std::task::Poll::Pending,
1409 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1410 this.is_terminated = true;
1411 return std::task::Poll::Ready(None);
1412 }
1413 std::task::Poll::Ready(Err(e)) => {
1414 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1415 e.into(),
1416 ))))
1417 }
1418 }
1419
1420 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1422
1423 std::task::Poll::Ready(Some(match header.ordinal {
1424 0x1541bc37d2d1dfb0 => {
1425 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1426 let mut req = fidl::new_empty!(
1427 StateResolveRequest,
1428 fidl::encoding::DefaultFuchsiaResourceDialect
1429 );
1430 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateResolveRequest>(&header, _body_bytes, handles, &mut req)?;
1431 let control_handle = StateControlHandle { inner: this.inner.clone() };
1432 Ok(StateRequest::Resolve {
1433 destination: req.destination,
1434
1435 responder: StateResolveResponder {
1436 control_handle: std::mem::ManuallyDrop::new(control_handle),
1437 tx_id: header.tx_id,
1438 },
1439 })
1440 }
1441 0x3a37608b6851f75c => {
1442 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1443 let mut req = fidl::new_empty!(
1444 StateResolve2Request,
1445 fidl::encoding::DefaultFuchsiaResourceDialect
1446 );
1447 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateResolve2Request>(&header, _body_bytes, handles, &mut req)?;
1448 let control_handle = StateControlHandle { inner: this.inner.clone() };
1449 Ok(StateRequest::Resolve2 {
1450 destination: req.destination,
1451 options: req.options,
1452
1453 responder: StateResolve2Responder {
1454 control_handle: std::mem::ManuallyDrop::new(control_handle),
1455 tx_id: header.tx_id,
1456 },
1457 })
1458 }
1459 0x6fed5423c7ce421a => {
1460 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1461 let mut req = fidl::new_empty!(
1462 StateGetRouteTableNameRequest,
1463 fidl::encoding::DefaultFuchsiaResourceDialect
1464 );
1465 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateGetRouteTableNameRequest>(&header, _body_bytes, handles, &mut req)?;
1466 let control_handle = StateControlHandle { inner: this.inner.clone() };
1467 Ok(StateRequest::GetRouteTableName {
1468 table_id: req.table_id,
1469
1470 responder: StateGetRouteTableNameResponder {
1471 control_handle: std::mem::ManuallyDrop::new(control_handle),
1472 tx_id: header.tx_id,
1473 },
1474 })
1475 }
1476 _ => Err(fidl::Error::UnknownOrdinal {
1477 ordinal: header.ordinal,
1478 protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1479 }),
1480 }))
1481 },
1482 )
1483 }
1484}
1485
1486#[derive(Debug)]
1488pub enum StateRequest {
1489 Resolve { destination: fidl_fuchsia_net::IpAddress, responder: StateResolveResponder },
1498 Resolve2 {
1508 destination: fidl_fuchsia_net::IpAddress,
1509 options: ResolveOptions,
1510 responder: StateResolve2Responder,
1511 },
1512 GetRouteTableName { table_id: u32, responder: StateGetRouteTableNameResponder },
1519}
1520
1521impl StateRequest {
1522 #[allow(irrefutable_let_patterns)]
1523 pub fn into_resolve(self) -> Option<(fidl_fuchsia_net::IpAddress, StateResolveResponder)> {
1524 if let StateRequest::Resolve { destination, responder } = self {
1525 Some((destination, responder))
1526 } else {
1527 None
1528 }
1529 }
1530
1531 #[allow(irrefutable_let_patterns)]
1532 pub fn into_resolve2(
1533 self,
1534 ) -> Option<(fidl_fuchsia_net::IpAddress, ResolveOptions, StateResolve2Responder)> {
1535 if let StateRequest::Resolve2 { destination, options, responder } = self {
1536 Some((destination, options, responder))
1537 } else {
1538 None
1539 }
1540 }
1541
1542 #[allow(irrefutable_let_patterns)]
1543 pub fn into_get_route_table_name(self) -> Option<(u32, StateGetRouteTableNameResponder)> {
1544 if let StateRequest::GetRouteTableName { table_id, responder } = self {
1545 Some((table_id, responder))
1546 } else {
1547 None
1548 }
1549 }
1550
1551 pub fn method_name(&self) -> &'static str {
1553 match *self {
1554 StateRequest::Resolve { .. } => "resolve",
1555 StateRequest::Resolve2 { .. } => "resolve2",
1556 StateRequest::GetRouteTableName { .. } => "get_route_table_name",
1557 }
1558 }
1559}
1560
1561#[derive(Debug, Clone)]
1562pub struct StateControlHandle {
1563 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1564}
1565
1566impl fidl::endpoints::ControlHandle for StateControlHandle {
1567 fn shutdown(&self) {
1568 self.inner.shutdown()
1569 }
1570 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1571 self.inner.shutdown_with_epitaph(status)
1572 }
1573
1574 fn is_closed(&self) -> bool {
1575 self.inner.channel().is_closed()
1576 }
1577 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1578 self.inner.channel().on_closed()
1579 }
1580
1581 #[cfg(target_os = "fuchsia")]
1582 fn signal_peer(
1583 &self,
1584 clear_mask: zx::Signals,
1585 set_mask: zx::Signals,
1586 ) -> Result<(), zx_status::Status> {
1587 use fidl::Peered;
1588 self.inner.channel().signal_peer(clear_mask, set_mask)
1589 }
1590}
1591
1592impl StateControlHandle {}
1593
1594#[must_use = "FIDL methods require a response to be sent"]
1595#[derive(Debug)]
1596pub struct StateResolveResponder {
1597 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1598 tx_id: u32,
1599}
1600
1601impl std::ops::Drop for StateResolveResponder {
1605 fn drop(&mut self) {
1606 self.control_handle.shutdown();
1607 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1609 }
1610}
1611
1612impl fidl::endpoints::Responder for StateResolveResponder {
1613 type ControlHandle = StateControlHandle;
1614
1615 fn control_handle(&self) -> &StateControlHandle {
1616 &self.control_handle
1617 }
1618
1619 fn drop_without_shutdown(mut self) {
1620 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1622 std::mem::forget(self);
1624 }
1625}
1626
1627impl StateResolveResponder {
1628 pub fn send(self, mut result: Result<&Resolved, i32>) -> Result<(), fidl::Error> {
1632 let _result = self.send_raw(result);
1633 if _result.is_err() {
1634 self.control_handle.shutdown();
1635 }
1636 self.drop_without_shutdown();
1637 _result
1638 }
1639
1640 pub fn send_no_shutdown_on_err(
1642 self,
1643 mut result: Result<&Resolved, i32>,
1644 ) -> Result<(), fidl::Error> {
1645 let _result = self.send_raw(result);
1646 self.drop_without_shutdown();
1647 _result
1648 }
1649
1650 fn send_raw(&self, mut result: Result<&Resolved, i32>) -> Result<(), fidl::Error> {
1651 self.control_handle.inner.send::<fidl::encoding::ResultType<StateResolveResponse, i32>>(
1652 result.map(|result| (result,)),
1653 self.tx_id,
1654 0x1541bc37d2d1dfb0,
1655 fidl::encoding::DynamicFlags::empty(),
1656 )
1657 }
1658}
1659
1660#[must_use = "FIDL methods require a response to be sent"]
1661#[derive(Debug)]
1662pub struct StateResolve2Responder {
1663 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1664 tx_id: u32,
1665}
1666
1667impl std::ops::Drop for StateResolve2Responder {
1671 fn drop(&mut self) {
1672 self.control_handle.shutdown();
1673 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1675 }
1676}
1677
1678impl fidl::endpoints::Responder for StateResolve2Responder {
1679 type ControlHandle = StateControlHandle;
1680
1681 fn control_handle(&self) -> &StateControlHandle {
1682 &self.control_handle
1683 }
1684
1685 fn drop_without_shutdown(mut self) {
1686 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1688 std::mem::forget(self);
1690 }
1691}
1692
1693impl StateResolve2Responder {
1694 pub fn send(self, mut result: Result<&ResolveResult, ResolveError>) -> Result<(), fidl::Error> {
1698 let _result = self.send_raw(result);
1699 if _result.is_err() {
1700 self.control_handle.shutdown();
1701 }
1702 self.drop_without_shutdown();
1703 _result
1704 }
1705
1706 pub fn send_no_shutdown_on_err(
1708 self,
1709 mut result: Result<&ResolveResult, ResolveError>,
1710 ) -> Result<(), fidl::Error> {
1711 let _result = self.send_raw(result);
1712 self.drop_without_shutdown();
1713 _result
1714 }
1715
1716 fn send_raw(
1717 &self,
1718 mut result: Result<&ResolveResult, ResolveError>,
1719 ) -> Result<(), fidl::Error> {
1720 self.control_handle
1721 .inner
1722 .send::<fidl::encoding::ResultType<StateResolve2Response, ResolveError>>(
1723 result.map(|result| (result,)),
1724 self.tx_id,
1725 0x3a37608b6851f75c,
1726 fidl::encoding::DynamicFlags::empty(),
1727 )
1728 }
1729}
1730
1731#[must_use = "FIDL methods require a response to be sent"]
1732#[derive(Debug)]
1733pub struct StateGetRouteTableNameResponder {
1734 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1735 tx_id: u32,
1736}
1737
1738impl std::ops::Drop for StateGetRouteTableNameResponder {
1742 fn drop(&mut self) {
1743 self.control_handle.shutdown();
1744 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1746 }
1747}
1748
1749impl fidl::endpoints::Responder for StateGetRouteTableNameResponder {
1750 type ControlHandle = StateControlHandle;
1751
1752 fn control_handle(&self) -> &StateControlHandle {
1753 &self.control_handle
1754 }
1755
1756 fn drop_without_shutdown(mut self) {
1757 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1759 std::mem::forget(self);
1761 }
1762}
1763
1764impl StateGetRouteTableNameResponder {
1765 pub fn send(
1769 self,
1770 mut result: Result<&str, StateGetRouteTableNameError>,
1771 ) -> Result<(), fidl::Error> {
1772 let _result = self.send_raw(result);
1773 if _result.is_err() {
1774 self.control_handle.shutdown();
1775 }
1776 self.drop_without_shutdown();
1777 _result
1778 }
1779
1780 pub fn send_no_shutdown_on_err(
1782 self,
1783 mut result: Result<&str, StateGetRouteTableNameError>,
1784 ) -> Result<(), fidl::Error> {
1785 let _result = self.send_raw(result);
1786 self.drop_without_shutdown();
1787 _result
1788 }
1789
1790 fn send_raw(
1791 &self,
1792 mut result: Result<&str, StateGetRouteTableNameError>,
1793 ) -> Result<(), fidl::Error> {
1794 self.control_handle.inner.send::<fidl::encoding::ResultType<
1795 StateGetRouteTableNameResponse,
1796 StateGetRouteTableNameError,
1797 >>(
1798 result.map(|table_name| (table_name,)),
1799 self.tx_id,
1800 0x6fed5423c7ce421a,
1801 fidl::encoding::DynamicFlags::empty(),
1802 )
1803 }
1804}
1805
1806#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1807pub struct StateV4Marker;
1808
1809impl fidl::endpoints::ProtocolMarker for StateV4Marker {
1810 type Proxy = StateV4Proxy;
1811 type RequestStream = StateV4RequestStream;
1812 #[cfg(target_os = "fuchsia")]
1813 type SynchronousProxy = StateV4SynchronousProxy;
1814
1815 const DEBUG_NAME: &'static str = "fuchsia.net.routes.StateV4";
1816}
1817impl fidl::endpoints::DiscoverableProtocolMarker for StateV4Marker {}
1818
1819pub trait StateV4ProxyInterface: Send + Sync {
1820 fn r#get_watcher_v4(
1821 &self,
1822 watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
1823 options: &WatcherOptionsV4,
1824 ) -> Result<(), fidl::Error>;
1825 fn r#get_rule_watcher_v4(
1826 &self,
1827 watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
1828 options: &RuleWatcherOptionsV4,
1829 ) -> Result<(), fidl::Error>;
1830}
1831#[derive(Debug)]
1832#[cfg(target_os = "fuchsia")]
1833pub struct StateV4SynchronousProxy {
1834 client: fidl::client::sync::Client,
1835}
1836
1837#[cfg(target_os = "fuchsia")]
1838impl fidl::endpoints::SynchronousProxy for StateV4SynchronousProxy {
1839 type Proxy = StateV4Proxy;
1840 type Protocol = StateV4Marker;
1841
1842 fn from_channel(inner: fidl::Channel) -> Self {
1843 Self::new(inner)
1844 }
1845
1846 fn into_channel(self) -> fidl::Channel {
1847 self.client.into_channel()
1848 }
1849
1850 fn as_channel(&self) -> &fidl::Channel {
1851 self.client.as_channel()
1852 }
1853}
1854
1855#[cfg(target_os = "fuchsia")]
1856impl StateV4SynchronousProxy {
1857 pub fn new(channel: fidl::Channel) -> Self {
1858 let protocol_name = <StateV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1859 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1860 }
1861
1862 pub fn into_channel(self) -> fidl::Channel {
1863 self.client.into_channel()
1864 }
1865
1866 pub fn wait_for_event(
1869 &self,
1870 deadline: zx::MonotonicInstant,
1871 ) -> Result<StateV4Event, fidl::Error> {
1872 StateV4Event::decode(self.client.wait_for_event(deadline)?)
1873 }
1874
1875 pub fn r#get_watcher_v4(
1880 &self,
1881 mut watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
1882 mut options: &WatcherOptionsV4,
1883 ) -> Result<(), fidl::Error> {
1884 self.client.send::<StateV4GetWatcherV4Request>(
1885 (watcher, options),
1886 0x30dcbe770492c20a,
1887 fidl::encoding::DynamicFlags::empty(),
1888 )
1889 }
1890
1891 pub fn r#get_rule_watcher_v4(
1896 &self,
1897 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
1898 mut options: &RuleWatcherOptionsV4,
1899 ) -> Result<(), fidl::Error> {
1900 self.client.send::<StateV4GetRuleWatcherV4Request>(
1901 (watcher, options),
1902 0x2bbcc7012b5147a1,
1903 fidl::encoding::DynamicFlags::empty(),
1904 )
1905 }
1906}
1907
1908#[derive(Debug, Clone)]
1909pub struct StateV4Proxy {
1910 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1911}
1912
1913impl fidl::endpoints::Proxy for StateV4Proxy {
1914 type Protocol = StateV4Marker;
1915
1916 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1917 Self::new(inner)
1918 }
1919
1920 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1921 self.client.into_channel().map_err(|client| Self { client })
1922 }
1923
1924 fn as_channel(&self) -> &::fidl::AsyncChannel {
1925 self.client.as_channel()
1926 }
1927}
1928
1929impl StateV4Proxy {
1930 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1932 let protocol_name = <StateV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1933 Self { client: fidl::client::Client::new(channel, protocol_name) }
1934 }
1935
1936 pub fn take_event_stream(&self) -> StateV4EventStream {
1942 StateV4EventStream { event_receiver: self.client.take_event_receiver() }
1943 }
1944
1945 pub fn r#get_watcher_v4(
1950 &self,
1951 mut watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
1952 mut options: &WatcherOptionsV4,
1953 ) -> Result<(), fidl::Error> {
1954 StateV4ProxyInterface::r#get_watcher_v4(self, watcher, options)
1955 }
1956
1957 pub fn r#get_rule_watcher_v4(
1962 &self,
1963 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
1964 mut options: &RuleWatcherOptionsV4,
1965 ) -> Result<(), fidl::Error> {
1966 StateV4ProxyInterface::r#get_rule_watcher_v4(self, watcher, options)
1967 }
1968}
1969
1970impl StateV4ProxyInterface for StateV4Proxy {
1971 fn r#get_watcher_v4(
1972 &self,
1973 mut watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
1974 mut options: &WatcherOptionsV4,
1975 ) -> Result<(), fidl::Error> {
1976 self.client.send::<StateV4GetWatcherV4Request>(
1977 (watcher, options),
1978 0x30dcbe770492c20a,
1979 fidl::encoding::DynamicFlags::empty(),
1980 )
1981 }
1982
1983 fn r#get_rule_watcher_v4(
1984 &self,
1985 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
1986 mut options: &RuleWatcherOptionsV4,
1987 ) -> Result<(), fidl::Error> {
1988 self.client.send::<StateV4GetRuleWatcherV4Request>(
1989 (watcher, options),
1990 0x2bbcc7012b5147a1,
1991 fidl::encoding::DynamicFlags::empty(),
1992 )
1993 }
1994}
1995
1996pub struct StateV4EventStream {
1997 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1998}
1999
2000impl std::marker::Unpin for StateV4EventStream {}
2001
2002impl futures::stream::FusedStream for StateV4EventStream {
2003 fn is_terminated(&self) -> bool {
2004 self.event_receiver.is_terminated()
2005 }
2006}
2007
2008impl futures::Stream for StateV4EventStream {
2009 type Item = Result<StateV4Event, fidl::Error>;
2010
2011 fn poll_next(
2012 mut self: std::pin::Pin<&mut Self>,
2013 cx: &mut std::task::Context<'_>,
2014 ) -> std::task::Poll<Option<Self::Item>> {
2015 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2016 &mut self.event_receiver,
2017 cx
2018 )?) {
2019 Some(buf) => std::task::Poll::Ready(Some(StateV4Event::decode(buf))),
2020 None => std::task::Poll::Ready(None),
2021 }
2022 }
2023}
2024
2025#[derive(Debug)]
2026pub enum StateV4Event {}
2027
2028impl StateV4Event {
2029 fn decode(
2031 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2032 ) -> Result<StateV4Event, fidl::Error> {
2033 let (bytes, _handles) = buf.split_mut();
2034 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2035 debug_assert_eq!(tx_header.tx_id, 0);
2036 match tx_header.ordinal {
2037 _ => Err(fidl::Error::UnknownOrdinal {
2038 ordinal: tx_header.ordinal,
2039 protocol_name: <StateV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2040 }),
2041 }
2042 }
2043}
2044
2045pub struct StateV4RequestStream {
2047 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2048 is_terminated: bool,
2049}
2050
2051impl std::marker::Unpin for StateV4RequestStream {}
2052
2053impl futures::stream::FusedStream for StateV4RequestStream {
2054 fn is_terminated(&self) -> bool {
2055 self.is_terminated
2056 }
2057}
2058
2059impl fidl::endpoints::RequestStream for StateV4RequestStream {
2060 type Protocol = StateV4Marker;
2061 type ControlHandle = StateV4ControlHandle;
2062
2063 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2064 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2065 }
2066
2067 fn control_handle(&self) -> Self::ControlHandle {
2068 StateV4ControlHandle { inner: self.inner.clone() }
2069 }
2070
2071 fn into_inner(
2072 self,
2073 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2074 {
2075 (self.inner, self.is_terminated)
2076 }
2077
2078 fn from_inner(
2079 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2080 is_terminated: bool,
2081 ) -> Self {
2082 Self { inner, is_terminated }
2083 }
2084}
2085
2086impl futures::Stream for StateV4RequestStream {
2087 type Item = Result<StateV4Request, fidl::Error>;
2088
2089 fn poll_next(
2090 mut self: std::pin::Pin<&mut Self>,
2091 cx: &mut std::task::Context<'_>,
2092 ) -> std::task::Poll<Option<Self::Item>> {
2093 let this = &mut *self;
2094 if this.inner.check_shutdown(cx) {
2095 this.is_terminated = true;
2096 return std::task::Poll::Ready(None);
2097 }
2098 if this.is_terminated {
2099 panic!("polled StateV4RequestStream after completion");
2100 }
2101 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2102 |bytes, handles| {
2103 match this.inner.channel().read_etc(cx, bytes, handles) {
2104 std::task::Poll::Ready(Ok(())) => {}
2105 std::task::Poll::Pending => return std::task::Poll::Pending,
2106 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2107 this.is_terminated = true;
2108 return std::task::Poll::Ready(None);
2109 }
2110 std::task::Poll::Ready(Err(e)) => {
2111 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2112 e.into(),
2113 ))))
2114 }
2115 }
2116
2117 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2119
2120 std::task::Poll::Ready(Some(match header.ordinal {
2121 0x30dcbe770492c20a => {
2122 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2123 let mut req = fidl::new_empty!(
2124 StateV4GetWatcherV4Request,
2125 fidl::encoding::DefaultFuchsiaResourceDialect
2126 );
2127 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateV4GetWatcherV4Request>(&header, _body_bytes, handles, &mut req)?;
2128 let control_handle = StateV4ControlHandle { inner: this.inner.clone() };
2129 Ok(StateV4Request::GetWatcherV4 {
2130 watcher: req.watcher,
2131 options: req.options,
2132
2133 control_handle,
2134 })
2135 }
2136 0x2bbcc7012b5147a1 => {
2137 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2138 let mut req = fidl::new_empty!(
2139 StateV4GetRuleWatcherV4Request,
2140 fidl::encoding::DefaultFuchsiaResourceDialect
2141 );
2142 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateV4GetRuleWatcherV4Request>(&header, _body_bytes, handles, &mut req)?;
2143 let control_handle = StateV4ControlHandle { inner: this.inner.clone() };
2144 Ok(StateV4Request::GetRuleWatcherV4 {
2145 watcher: req.watcher,
2146 options: req.options,
2147
2148 control_handle,
2149 })
2150 }
2151 _ => Err(fidl::Error::UnknownOrdinal {
2152 ordinal: header.ordinal,
2153 protocol_name:
2154 <StateV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2155 }),
2156 }))
2157 },
2158 )
2159 }
2160}
2161
2162#[derive(Debug)]
2164pub enum StateV4Request {
2165 GetWatcherV4 {
2170 watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
2171 options: WatcherOptionsV4,
2172 control_handle: StateV4ControlHandle,
2173 },
2174 GetRuleWatcherV4 {
2179 watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
2180 options: RuleWatcherOptionsV4,
2181 control_handle: StateV4ControlHandle,
2182 },
2183}
2184
2185impl StateV4Request {
2186 #[allow(irrefutable_let_patterns)]
2187 pub fn into_get_watcher_v4(
2188 self,
2189 ) -> Option<(fidl::endpoints::ServerEnd<WatcherV4Marker>, WatcherOptionsV4, StateV4ControlHandle)>
2190 {
2191 if let StateV4Request::GetWatcherV4 { watcher, options, control_handle } = self {
2192 Some((watcher, options, control_handle))
2193 } else {
2194 None
2195 }
2196 }
2197
2198 #[allow(irrefutable_let_patterns)]
2199 pub fn into_get_rule_watcher_v4(
2200 self,
2201 ) -> Option<(
2202 fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
2203 RuleWatcherOptionsV4,
2204 StateV4ControlHandle,
2205 )> {
2206 if let StateV4Request::GetRuleWatcherV4 { watcher, options, control_handle } = self {
2207 Some((watcher, options, control_handle))
2208 } else {
2209 None
2210 }
2211 }
2212
2213 pub fn method_name(&self) -> &'static str {
2215 match *self {
2216 StateV4Request::GetWatcherV4 { .. } => "get_watcher_v4",
2217 StateV4Request::GetRuleWatcherV4 { .. } => "get_rule_watcher_v4",
2218 }
2219 }
2220}
2221
2222#[derive(Debug, Clone)]
2223pub struct StateV4ControlHandle {
2224 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2225}
2226
2227impl fidl::endpoints::ControlHandle for StateV4ControlHandle {
2228 fn shutdown(&self) {
2229 self.inner.shutdown()
2230 }
2231 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2232 self.inner.shutdown_with_epitaph(status)
2233 }
2234
2235 fn is_closed(&self) -> bool {
2236 self.inner.channel().is_closed()
2237 }
2238 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2239 self.inner.channel().on_closed()
2240 }
2241
2242 #[cfg(target_os = "fuchsia")]
2243 fn signal_peer(
2244 &self,
2245 clear_mask: zx::Signals,
2246 set_mask: zx::Signals,
2247 ) -> Result<(), zx_status::Status> {
2248 use fidl::Peered;
2249 self.inner.channel().signal_peer(clear_mask, set_mask)
2250 }
2251}
2252
2253impl StateV4ControlHandle {}
2254
2255#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2256pub struct StateV6Marker;
2257
2258impl fidl::endpoints::ProtocolMarker for StateV6Marker {
2259 type Proxy = StateV6Proxy;
2260 type RequestStream = StateV6RequestStream;
2261 #[cfg(target_os = "fuchsia")]
2262 type SynchronousProxy = StateV6SynchronousProxy;
2263
2264 const DEBUG_NAME: &'static str = "fuchsia.net.routes.StateV6";
2265}
2266impl fidl::endpoints::DiscoverableProtocolMarker for StateV6Marker {}
2267
2268pub trait StateV6ProxyInterface: Send + Sync {
2269 fn r#get_watcher_v6(
2270 &self,
2271 watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2272 options: &WatcherOptionsV6,
2273 ) -> Result<(), fidl::Error>;
2274 fn r#get_rule_watcher_v6(
2275 &self,
2276 watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2277 options: &RuleWatcherOptionsV6,
2278 ) -> Result<(), fidl::Error>;
2279}
2280#[derive(Debug)]
2281#[cfg(target_os = "fuchsia")]
2282pub struct StateV6SynchronousProxy {
2283 client: fidl::client::sync::Client,
2284}
2285
2286#[cfg(target_os = "fuchsia")]
2287impl fidl::endpoints::SynchronousProxy for StateV6SynchronousProxy {
2288 type Proxy = StateV6Proxy;
2289 type Protocol = StateV6Marker;
2290
2291 fn from_channel(inner: fidl::Channel) -> Self {
2292 Self::new(inner)
2293 }
2294
2295 fn into_channel(self) -> fidl::Channel {
2296 self.client.into_channel()
2297 }
2298
2299 fn as_channel(&self) -> &fidl::Channel {
2300 self.client.as_channel()
2301 }
2302}
2303
2304#[cfg(target_os = "fuchsia")]
2305impl StateV6SynchronousProxy {
2306 pub fn new(channel: fidl::Channel) -> Self {
2307 let protocol_name = <StateV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2308 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2309 }
2310
2311 pub fn into_channel(self) -> fidl::Channel {
2312 self.client.into_channel()
2313 }
2314
2315 pub fn wait_for_event(
2318 &self,
2319 deadline: zx::MonotonicInstant,
2320 ) -> Result<StateV6Event, fidl::Error> {
2321 StateV6Event::decode(self.client.wait_for_event(deadline)?)
2322 }
2323
2324 pub fn r#get_watcher_v6(
2329 &self,
2330 mut watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2331 mut options: &WatcherOptionsV6,
2332 ) -> Result<(), fidl::Error> {
2333 self.client.send::<StateV6GetWatcherV6Request>(
2334 (watcher, options),
2335 0x777e3c40c98f586,
2336 fidl::encoding::DynamicFlags::empty(),
2337 )
2338 }
2339
2340 pub fn r#get_rule_watcher_v6(
2345 &self,
2346 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2347 mut options: &RuleWatcherOptionsV6,
2348 ) -> Result<(), fidl::Error> {
2349 self.client.send::<StateV6GetRuleWatcherV6Request>(
2350 (watcher, options),
2351 0x91433a23d464f6,
2352 fidl::encoding::DynamicFlags::empty(),
2353 )
2354 }
2355}
2356
2357#[derive(Debug, Clone)]
2358pub struct StateV6Proxy {
2359 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2360}
2361
2362impl fidl::endpoints::Proxy for StateV6Proxy {
2363 type Protocol = StateV6Marker;
2364
2365 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2366 Self::new(inner)
2367 }
2368
2369 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2370 self.client.into_channel().map_err(|client| Self { client })
2371 }
2372
2373 fn as_channel(&self) -> &::fidl::AsyncChannel {
2374 self.client.as_channel()
2375 }
2376}
2377
2378impl StateV6Proxy {
2379 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2381 let protocol_name = <StateV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2382 Self { client: fidl::client::Client::new(channel, protocol_name) }
2383 }
2384
2385 pub fn take_event_stream(&self) -> StateV6EventStream {
2391 StateV6EventStream { event_receiver: self.client.take_event_receiver() }
2392 }
2393
2394 pub fn r#get_watcher_v6(
2399 &self,
2400 mut watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2401 mut options: &WatcherOptionsV6,
2402 ) -> Result<(), fidl::Error> {
2403 StateV6ProxyInterface::r#get_watcher_v6(self, watcher, options)
2404 }
2405
2406 pub fn r#get_rule_watcher_v6(
2411 &self,
2412 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2413 mut options: &RuleWatcherOptionsV6,
2414 ) -> Result<(), fidl::Error> {
2415 StateV6ProxyInterface::r#get_rule_watcher_v6(self, watcher, options)
2416 }
2417}
2418
2419impl StateV6ProxyInterface for StateV6Proxy {
2420 fn r#get_watcher_v6(
2421 &self,
2422 mut watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2423 mut options: &WatcherOptionsV6,
2424 ) -> Result<(), fidl::Error> {
2425 self.client.send::<StateV6GetWatcherV6Request>(
2426 (watcher, options),
2427 0x777e3c40c98f586,
2428 fidl::encoding::DynamicFlags::empty(),
2429 )
2430 }
2431
2432 fn r#get_rule_watcher_v6(
2433 &self,
2434 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2435 mut options: &RuleWatcherOptionsV6,
2436 ) -> Result<(), fidl::Error> {
2437 self.client.send::<StateV6GetRuleWatcherV6Request>(
2438 (watcher, options),
2439 0x91433a23d464f6,
2440 fidl::encoding::DynamicFlags::empty(),
2441 )
2442 }
2443}
2444
2445pub struct StateV6EventStream {
2446 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2447}
2448
2449impl std::marker::Unpin for StateV6EventStream {}
2450
2451impl futures::stream::FusedStream for StateV6EventStream {
2452 fn is_terminated(&self) -> bool {
2453 self.event_receiver.is_terminated()
2454 }
2455}
2456
2457impl futures::Stream for StateV6EventStream {
2458 type Item = Result<StateV6Event, fidl::Error>;
2459
2460 fn poll_next(
2461 mut self: std::pin::Pin<&mut Self>,
2462 cx: &mut std::task::Context<'_>,
2463 ) -> std::task::Poll<Option<Self::Item>> {
2464 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2465 &mut self.event_receiver,
2466 cx
2467 )?) {
2468 Some(buf) => std::task::Poll::Ready(Some(StateV6Event::decode(buf))),
2469 None => std::task::Poll::Ready(None),
2470 }
2471 }
2472}
2473
2474#[derive(Debug)]
2475pub enum StateV6Event {}
2476
2477impl StateV6Event {
2478 fn decode(
2480 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2481 ) -> Result<StateV6Event, fidl::Error> {
2482 let (bytes, _handles) = buf.split_mut();
2483 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2484 debug_assert_eq!(tx_header.tx_id, 0);
2485 match tx_header.ordinal {
2486 _ => Err(fidl::Error::UnknownOrdinal {
2487 ordinal: tx_header.ordinal,
2488 protocol_name: <StateV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2489 }),
2490 }
2491 }
2492}
2493
2494pub struct StateV6RequestStream {
2496 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2497 is_terminated: bool,
2498}
2499
2500impl std::marker::Unpin for StateV6RequestStream {}
2501
2502impl futures::stream::FusedStream for StateV6RequestStream {
2503 fn is_terminated(&self) -> bool {
2504 self.is_terminated
2505 }
2506}
2507
2508impl fidl::endpoints::RequestStream for StateV6RequestStream {
2509 type Protocol = StateV6Marker;
2510 type ControlHandle = StateV6ControlHandle;
2511
2512 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2513 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2514 }
2515
2516 fn control_handle(&self) -> Self::ControlHandle {
2517 StateV6ControlHandle { inner: self.inner.clone() }
2518 }
2519
2520 fn into_inner(
2521 self,
2522 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2523 {
2524 (self.inner, self.is_terminated)
2525 }
2526
2527 fn from_inner(
2528 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2529 is_terminated: bool,
2530 ) -> Self {
2531 Self { inner, is_terminated }
2532 }
2533}
2534
2535impl futures::Stream for StateV6RequestStream {
2536 type Item = Result<StateV6Request, fidl::Error>;
2537
2538 fn poll_next(
2539 mut self: std::pin::Pin<&mut Self>,
2540 cx: &mut std::task::Context<'_>,
2541 ) -> std::task::Poll<Option<Self::Item>> {
2542 let this = &mut *self;
2543 if this.inner.check_shutdown(cx) {
2544 this.is_terminated = true;
2545 return std::task::Poll::Ready(None);
2546 }
2547 if this.is_terminated {
2548 panic!("polled StateV6RequestStream after completion");
2549 }
2550 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2551 |bytes, handles| {
2552 match this.inner.channel().read_etc(cx, bytes, handles) {
2553 std::task::Poll::Ready(Ok(())) => {}
2554 std::task::Poll::Pending => return std::task::Poll::Pending,
2555 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2556 this.is_terminated = true;
2557 return std::task::Poll::Ready(None);
2558 }
2559 std::task::Poll::Ready(Err(e)) => {
2560 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2561 e.into(),
2562 ))))
2563 }
2564 }
2565
2566 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2568
2569 std::task::Poll::Ready(Some(match header.ordinal {
2570 0x777e3c40c98f586 => {
2571 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2572 let mut req = fidl::new_empty!(
2573 StateV6GetWatcherV6Request,
2574 fidl::encoding::DefaultFuchsiaResourceDialect
2575 );
2576 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateV6GetWatcherV6Request>(&header, _body_bytes, handles, &mut req)?;
2577 let control_handle = StateV6ControlHandle { inner: this.inner.clone() };
2578 Ok(StateV6Request::GetWatcherV6 {
2579 watcher: req.watcher,
2580 options: req.options,
2581
2582 control_handle,
2583 })
2584 }
2585 0x91433a23d464f6 => {
2586 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2587 let mut req = fidl::new_empty!(
2588 StateV6GetRuleWatcherV6Request,
2589 fidl::encoding::DefaultFuchsiaResourceDialect
2590 );
2591 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateV6GetRuleWatcherV6Request>(&header, _body_bytes, handles, &mut req)?;
2592 let control_handle = StateV6ControlHandle { inner: this.inner.clone() };
2593 Ok(StateV6Request::GetRuleWatcherV6 {
2594 watcher: req.watcher,
2595 options: req.options,
2596
2597 control_handle,
2598 })
2599 }
2600 _ => Err(fidl::Error::UnknownOrdinal {
2601 ordinal: header.ordinal,
2602 protocol_name:
2603 <StateV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2604 }),
2605 }))
2606 },
2607 )
2608 }
2609}
2610
2611#[derive(Debug)]
2613pub enum StateV6Request {
2614 GetWatcherV6 {
2619 watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2620 options: WatcherOptionsV6,
2621 control_handle: StateV6ControlHandle,
2622 },
2623 GetRuleWatcherV6 {
2628 watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2629 options: RuleWatcherOptionsV6,
2630 control_handle: StateV6ControlHandle,
2631 },
2632}
2633
2634impl StateV6Request {
2635 #[allow(irrefutable_let_patterns)]
2636 pub fn into_get_watcher_v6(
2637 self,
2638 ) -> Option<(fidl::endpoints::ServerEnd<WatcherV6Marker>, WatcherOptionsV6, StateV6ControlHandle)>
2639 {
2640 if let StateV6Request::GetWatcherV6 { watcher, options, control_handle } = self {
2641 Some((watcher, options, control_handle))
2642 } else {
2643 None
2644 }
2645 }
2646
2647 #[allow(irrefutable_let_patterns)]
2648 pub fn into_get_rule_watcher_v6(
2649 self,
2650 ) -> Option<(
2651 fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2652 RuleWatcherOptionsV6,
2653 StateV6ControlHandle,
2654 )> {
2655 if let StateV6Request::GetRuleWatcherV6 { watcher, options, control_handle } = self {
2656 Some((watcher, options, control_handle))
2657 } else {
2658 None
2659 }
2660 }
2661
2662 pub fn method_name(&self) -> &'static str {
2664 match *self {
2665 StateV6Request::GetWatcherV6 { .. } => "get_watcher_v6",
2666 StateV6Request::GetRuleWatcherV6 { .. } => "get_rule_watcher_v6",
2667 }
2668 }
2669}
2670
2671#[derive(Debug, Clone)]
2672pub struct StateV6ControlHandle {
2673 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2674}
2675
2676impl fidl::endpoints::ControlHandle for StateV6ControlHandle {
2677 fn shutdown(&self) {
2678 self.inner.shutdown()
2679 }
2680 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2681 self.inner.shutdown_with_epitaph(status)
2682 }
2683
2684 fn is_closed(&self) -> bool {
2685 self.inner.channel().is_closed()
2686 }
2687 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2688 self.inner.channel().on_closed()
2689 }
2690
2691 #[cfg(target_os = "fuchsia")]
2692 fn signal_peer(
2693 &self,
2694 clear_mask: zx::Signals,
2695 set_mask: zx::Signals,
2696 ) -> Result<(), zx_status::Status> {
2697 use fidl::Peered;
2698 self.inner.channel().signal_peer(clear_mask, set_mask)
2699 }
2700}
2701
2702impl StateV6ControlHandle {}
2703
2704#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2705pub struct WatcherV4Marker;
2706
2707impl fidl::endpoints::ProtocolMarker for WatcherV4Marker {
2708 type Proxy = WatcherV4Proxy;
2709 type RequestStream = WatcherV4RequestStream;
2710 #[cfg(target_os = "fuchsia")]
2711 type SynchronousProxy = WatcherV4SynchronousProxy;
2712
2713 const DEBUG_NAME: &'static str = "(anonymous) WatcherV4";
2714}
2715
2716pub trait WatcherV4ProxyInterface: Send + Sync {
2717 type WatchResponseFut: std::future::Future<Output = Result<Vec<EventV4>, fidl::Error>> + Send;
2718 fn r#watch(&self) -> Self::WatchResponseFut;
2719}
2720#[derive(Debug)]
2721#[cfg(target_os = "fuchsia")]
2722pub struct WatcherV4SynchronousProxy {
2723 client: fidl::client::sync::Client,
2724}
2725
2726#[cfg(target_os = "fuchsia")]
2727impl fidl::endpoints::SynchronousProxy for WatcherV4SynchronousProxy {
2728 type Proxy = WatcherV4Proxy;
2729 type Protocol = WatcherV4Marker;
2730
2731 fn from_channel(inner: fidl::Channel) -> Self {
2732 Self::new(inner)
2733 }
2734
2735 fn into_channel(self) -> fidl::Channel {
2736 self.client.into_channel()
2737 }
2738
2739 fn as_channel(&self) -> &fidl::Channel {
2740 self.client.as_channel()
2741 }
2742}
2743
2744#[cfg(target_os = "fuchsia")]
2745impl WatcherV4SynchronousProxy {
2746 pub fn new(channel: fidl::Channel) -> Self {
2747 let protocol_name = <WatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2748 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2749 }
2750
2751 pub fn into_channel(self) -> fidl::Channel {
2752 self.client.into_channel()
2753 }
2754
2755 pub fn wait_for_event(
2758 &self,
2759 deadline: zx::MonotonicInstant,
2760 ) -> Result<WatcherV4Event, fidl::Error> {
2761 WatcherV4Event::decode(self.client.wait_for_event(deadline)?)
2762 }
2763
2764 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<EventV4>, fidl::Error> {
2785 let _response =
2786 self.client.send_query::<fidl::encoding::EmptyPayload, WatcherV4WatchResponse>(
2787 (),
2788 0x71f2fdee0b307ac2,
2789 fidl::encoding::DynamicFlags::empty(),
2790 ___deadline,
2791 )?;
2792 Ok(_response.events)
2793 }
2794}
2795
2796#[derive(Debug, Clone)]
2797pub struct WatcherV4Proxy {
2798 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2799}
2800
2801impl fidl::endpoints::Proxy for WatcherV4Proxy {
2802 type Protocol = WatcherV4Marker;
2803
2804 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2805 Self::new(inner)
2806 }
2807
2808 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2809 self.client.into_channel().map_err(|client| Self { client })
2810 }
2811
2812 fn as_channel(&self) -> &::fidl::AsyncChannel {
2813 self.client.as_channel()
2814 }
2815}
2816
2817impl WatcherV4Proxy {
2818 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2820 let protocol_name = <WatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2821 Self { client: fidl::client::Client::new(channel, protocol_name) }
2822 }
2823
2824 pub fn take_event_stream(&self) -> WatcherV4EventStream {
2830 WatcherV4EventStream { event_receiver: self.client.take_event_receiver() }
2831 }
2832
2833 pub fn r#watch(
2854 &self,
2855 ) -> fidl::client::QueryResponseFut<Vec<EventV4>, fidl::encoding::DefaultFuchsiaResourceDialect>
2856 {
2857 WatcherV4ProxyInterface::r#watch(self)
2858 }
2859}
2860
2861impl WatcherV4ProxyInterface for WatcherV4Proxy {
2862 type WatchResponseFut =
2863 fidl::client::QueryResponseFut<Vec<EventV4>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2864 fn r#watch(&self) -> Self::WatchResponseFut {
2865 fn _decode(
2866 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2867 ) -> Result<Vec<EventV4>, fidl::Error> {
2868 let _response = fidl::client::decode_transaction_body::<
2869 WatcherV4WatchResponse,
2870 fidl::encoding::DefaultFuchsiaResourceDialect,
2871 0x71f2fdee0b307ac2,
2872 >(_buf?)?;
2873 Ok(_response.events)
2874 }
2875 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EventV4>>(
2876 (),
2877 0x71f2fdee0b307ac2,
2878 fidl::encoding::DynamicFlags::empty(),
2879 _decode,
2880 )
2881 }
2882}
2883
2884pub struct WatcherV4EventStream {
2885 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2886}
2887
2888impl std::marker::Unpin for WatcherV4EventStream {}
2889
2890impl futures::stream::FusedStream for WatcherV4EventStream {
2891 fn is_terminated(&self) -> bool {
2892 self.event_receiver.is_terminated()
2893 }
2894}
2895
2896impl futures::Stream for WatcherV4EventStream {
2897 type Item = Result<WatcherV4Event, fidl::Error>;
2898
2899 fn poll_next(
2900 mut self: std::pin::Pin<&mut Self>,
2901 cx: &mut std::task::Context<'_>,
2902 ) -> std::task::Poll<Option<Self::Item>> {
2903 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2904 &mut self.event_receiver,
2905 cx
2906 )?) {
2907 Some(buf) => std::task::Poll::Ready(Some(WatcherV4Event::decode(buf))),
2908 None => std::task::Poll::Ready(None),
2909 }
2910 }
2911}
2912
2913#[derive(Debug)]
2914pub enum WatcherV4Event {}
2915
2916impl WatcherV4Event {
2917 fn decode(
2919 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2920 ) -> Result<WatcherV4Event, fidl::Error> {
2921 let (bytes, _handles) = buf.split_mut();
2922 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2923 debug_assert_eq!(tx_header.tx_id, 0);
2924 match tx_header.ordinal {
2925 _ => Err(fidl::Error::UnknownOrdinal {
2926 ordinal: tx_header.ordinal,
2927 protocol_name: <WatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2928 }),
2929 }
2930 }
2931}
2932
2933pub struct WatcherV4RequestStream {
2935 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2936 is_terminated: bool,
2937}
2938
2939impl std::marker::Unpin for WatcherV4RequestStream {}
2940
2941impl futures::stream::FusedStream for WatcherV4RequestStream {
2942 fn is_terminated(&self) -> bool {
2943 self.is_terminated
2944 }
2945}
2946
2947impl fidl::endpoints::RequestStream for WatcherV4RequestStream {
2948 type Protocol = WatcherV4Marker;
2949 type ControlHandle = WatcherV4ControlHandle;
2950
2951 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2952 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2953 }
2954
2955 fn control_handle(&self) -> Self::ControlHandle {
2956 WatcherV4ControlHandle { inner: self.inner.clone() }
2957 }
2958
2959 fn into_inner(
2960 self,
2961 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2962 {
2963 (self.inner, self.is_terminated)
2964 }
2965
2966 fn from_inner(
2967 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2968 is_terminated: bool,
2969 ) -> Self {
2970 Self { inner, is_terminated }
2971 }
2972}
2973
2974impl futures::Stream for WatcherV4RequestStream {
2975 type Item = Result<WatcherV4Request, fidl::Error>;
2976
2977 fn poll_next(
2978 mut self: std::pin::Pin<&mut Self>,
2979 cx: &mut std::task::Context<'_>,
2980 ) -> std::task::Poll<Option<Self::Item>> {
2981 let this = &mut *self;
2982 if this.inner.check_shutdown(cx) {
2983 this.is_terminated = true;
2984 return std::task::Poll::Ready(None);
2985 }
2986 if this.is_terminated {
2987 panic!("polled WatcherV4RequestStream after completion");
2988 }
2989 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2990 |bytes, handles| {
2991 match this.inner.channel().read_etc(cx, bytes, handles) {
2992 std::task::Poll::Ready(Ok(())) => {}
2993 std::task::Poll::Pending => return std::task::Poll::Pending,
2994 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2995 this.is_terminated = true;
2996 return std::task::Poll::Ready(None);
2997 }
2998 std::task::Poll::Ready(Err(e)) => {
2999 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3000 e.into(),
3001 ))))
3002 }
3003 }
3004
3005 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3007
3008 std::task::Poll::Ready(Some(match header.ordinal {
3009 0x71f2fdee0b307ac2 => {
3010 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3011 let mut req = fidl::new_empty!(
3012 fidl::encoding::EmptyPayload,
3013 fidl::encoding::DefaultFuchsiaResourceDialect
3014 );
3015 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3016 let control_handle = WatcherV4ControlHandle { inner: this.inner.clone() };
3017 Ok(WatcherV4Request::Watch {
3018 responder: WatcherV4WatchResponder {
3019 control_handle: std::mem::ManuallyDrop::new(control_handle),
3020 tx_id: header.tx_id,
3021 },
3022 })
3023 }
3024 _ => Err(fidl::Error::UnknownOrdinal {
3025 ordinal: header.ordinal,
3026 protocol_name:
3027 <WatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3028 }),
3029 }))
3030 },
3031 )
3032 }
3033}
3034
3035#[derive(Debug)]
3037pub enum WatcherV4Request {
3038 Watch { responder: WatcherV4WatchResponder },
3059}
3060
3061impl WatcherV4Request {
3062 #[allow(irrefutable_let_patterns)]
3063 pub fn into_watch(self) -> Option<(WatcherV4WatchResponder)> {
3064 if let WatcherV4Request::Watch { responder } = self {
3065 Some((responder))
3066 } else {
3067 None
3068 }
3069 }
3070
3071 pub fn method_name(&self) -> &'static str {
3073 match *self {
3074 WatcherV4Request::Watch { .. } => "watch",
3075 }
3076 }
3077}
3078
3079#[derive(Debug, Clone)]
3080pub struct WatcherV4ControlHandle {
3081 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3082}
3083
3084impl fidl::endpoints::ControlHandle for WatcherV4ControlHandle {
3085 fn shutdown(&self) {
3086 self.inner.shutdown()
3087 }
3088 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3089 self.inner.shutdown_with_epitaph(status)
3090 }
3091
3092 fn is_closed(&self) -> bool {
3093 self.inner.channel().is_closed()
3094 }
3095 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3096 self.inner.channel().on_closed()
3097 }
3098
3099 #[cfg(target_os = "fuchsia")]
3100 fn signal_peer(
3101 &self,
3102 clear_mask: zx::Signals,
3103 set_mask: zx::Signals,
3104 ) -> Result<(), zx_status::Status> {
3105 use fidl::Peered;
3106 self.inner.channel().signal_peer(clear_mask, set_mask)
3107 }
3108}
3109
3110impl WatcherV4ControlHandle {}
3111
3112#[must_use = "FIDL methods require a response to be sent"]
3113#[derive(Debug)]
3114pub struct WatcherV4WatchResponder {
3115 control_handle: std::mem::ManuallyDrop<WatcherV4ControlHandle>,
3116 tx_id: u32,
3117}
3118
3119impl std::ops::Drop for WatcherV4WatchResponder {
3123 fn drop(&mut self) {
3124 self.control_handle.shutdown();
3125 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3127 }
3128}
3129
3130impl fidl::endpoints::Responder for WatcherV4WatchResponder {
3131 type ControlHandle = WatcherV4ControlHandle;
3132
3133 fn control_handle(&self) -> &WatcherV4ControlHandle {
3134 &self.control_handle
3135 }
3136
3137 fn drop_without_shutdown(mut self) {
3138 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3140 std::mem::forget(self);
3142 }
3143}
3144
3145impl WatcherV4WatchResponder {
3146 pub fn send(self, mut events: &[EventV4]) -> Result<(), fidl::Error> {
3150 let _result = self.send_raw(events);
3151 if _result.is_err() {
3152 self.control_handle.shutdown();
3153 }
3154 self.drop_without_shutdown();
3155 _result
3156 }
3157
3158 pub fn send_no_shutdown_on_err(self, mut events: &[EventV4]) -> Result<(), fidl::Error> {
3160 let _result = self.send_raw(events);
3161 self.drop_without_shutdown();
3162 _result
3163 }
3164
3165 fn send_raw(&self, mut events: &[EventV4]) -> Result<(), fidl::Error> {
3166 self.control_handle.inner.send::<WatcherV4WatchResponse>(
3167 (events,),
3168 self.tx_id,
3169 0x71f2fdee0b307ac2,
3170 fidl::encoding::DynamicFlags::empty(),
3171 )
3172 }
3173}
3174
3175#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3176pub struct WatcherV6Marker;
3177
3178impl fidl::endpoints::ProtocolMarker for WatcherV6Marker {
3179 type Proxy = WatcherV6Proxy;
3180 type RequestStream = WatcherV6RequestStream;
3181 #[cfg(target_os = "fuchsia")]
3182 type SynchronousProxy = WatcherV6SynchronousProxy;
3183
3184 const DEBUG_NAME: &'static str = "(anonymous) WatcherV6";
3185}
3186
3187pub trait WatcherV6ProxyInterface: Send + Sync {
3188 type WatchResponseFut: std::future::Future<Output = Result<Vec<EventV6>, fidl::Error>> + Send;
3189 fn r#watch(&self) -> Self::WatchResponseFut;
3190}
3191#[derive(Debug)]
3192#[cfg(target_os = "fuchsia")]
3193pub struct WatcherV6SynchronousProxy {
3194 client: fidl::client::sync::Client,
3195}
3196
3197#[cfg(target_os = "fuchsia")]
3198impl fidl::endpoints::SynchronousProxy for WatcherV6SynchronousProxy {
3199 type Proxy = WatcherV6Proxy;
3200 type Protocol = WatcherV6Marker;
3201
3202 fn from_channel(inner: fidl::Channel) -> Self {
3203 Self::new(inner)
3204 }
3205
3206 fn into_channel(self) -> fidl::Channel {
3207 self.client.into_channel()
3208 }
3209
3210 fn as_channel(&self) -> &fidl::Channel {
3211 self.client.as_channel()
3212 }
3213}
3214
3215#[cfg(target_os = "fuchsia")]
3216impl WatcherV6SynchronousProxy {
3217 pub fn new(channel: fidl::Channel) -> Self {
3218 let protocol_name = <WatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3219 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3220 }
3221
3222 pub fn into_channel(self) -> fidl::Channel {
3223 self.client.into_channel()
3224 }
3225
3226 pub fn wait_for_event(
3229 &self,
3230 deadline: zx::MonotonicInstant,
3231 ) -> Result<WatcherV6Event, fidl::Error> {
3232 WatcherV6Event::decode(self.client.wait_for_event(deadline)?)
3233 }
3234
3235 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<EventV6>, fidl::Error> {
3256 let _response =
3257 self.client.send_query::<fidl::encoding::EmptyPayload, WatcherV6WatchResponse>(
3258 (),
3259 0x82f5e48afc8811e,
3260 fidl::encoding::DynamicFlags::empty(),
3261 ___deadline,
3262 )?;
3263 Ok(_response.events)
3264 }
3265}
3266
3267#[derive(Debug, Clone)]
3268pub struct WatcherV6Proxy {
3269 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3270}
3271
3272impl fidl::endpoints::Proxy for WatcherV6Proxy {
3273 type Protocol = WatcherV6Marker;
3274
3275 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3276 Self::new(inner)
3277 }
3278
3279 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3280 self.client.into_channel().map_err(|client| Self { client })
3281 }
3282
3283 fn as_channel(&self) -> &::fidl::AsyncChannel {
3284 self.client.as_channel()
3285 }
3286}
3287
3288impl WatcherV6Proxy {
3289 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3291 let protocol_name = <WatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3292 Self { client: fidl::client::Client::new(channel, protocol_name) }
3293 }
3294
3295 pub fn take_event_stream(&self) -> WatcherV6EventStream {
3301 WatcherV6EventStream { event_receiver: self.client.take_event_receiver() }
3302 }
3303
3304 pub fn r#watch(
3325 &self,
3326 ) -> fidl::client::QueryResponseFut<Vec<EventV6>, fidl::encoding::DefaultFuchsiaResourceDialect>
3327 {
3328 WatcherV6ProxyInterface::r#watch(self)
3329 }
3330}
3331
3332impl WatcherV6ProxyInterface for WatcherV6Proxy {
3333 type WatchResponseFut =
3334 fidl::client::QueryResponseFut<Vec<EventV6>, fidl::encoding::DefaultFuchsiaResourceDialect>;
3335 fn r#watch(&self) -> Self::WatchResponseFut {
3336 fn _decode(
3337 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3338 ) -> Result<Vec<EventV6>, fidl::Error> {
3339 let _response = fidl::client::decode_transaction_body::<
3340 WatcherV6WatchResponse,
3341 fidl::encoding::DefaultFuchsiaResourceDialect,
3342 0x82f5e48afc8811e,
3343 >(_buf?)?;
3344 Ok(_response.events)
3345 }
3346 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EventV6>>(
3347 (),
3348 0x82f5e48afc8811e,
3349 fidl::encoding::DynamicFlags::empty(),
3350 _decode,
3351 )
3352 }
3353}
3354
3355pub struct WatcherV6EventStream {
3356 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3357}
3358
3359impl std::marker::Unpin for WatcherV6EventStream {}
3360
3361impl futures::stream::FusedStream for WatcherV6EventStream {
3362 fn is_terminated(&self) -> bool {
3363 self.event_receiver.is_terminated()
3364 }
3365}
3366
3367impl futures::Stream for WatcherV6EventStream {
3368 type Item = Result<WatcherV6Event, fidl::Error>;
3369
3370 fn poll_next(
3371 mut self: std::pin::Pin<&mut Self>,
3372 cx: &mut std::task::Context<'_>,
3373 ) -> std::task::Poll<Option<Self::Item>> {
3374 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3375 &mut self.event_receiver,
3376 cx
3377 )?) {
3378 Some(buf) => std::task::Poll::Ready(Some(WatcherV6Event::decode(buf))),
3379 None => std::task::Poll::Ready(None),
3380 }
3381 }
3382}
3383
3384#[derive(Debug)]
3385pub enum WatcherV6Event {}
3386
3387impl WatcherV6Event {
3388 fn decode(
3390 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3391 ) -> Result<WatcherV6Event, fidl::Error> {
3392 let (bytes, _handles) = buf.split_mut();
3393 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3394 debug_assert_eq!(tx_header.tx_id, 0);
3395 match tx_header.ordinal {
3396 _ => Err(fidl::Error::UnknownOrdinal {
3397 ordinal: tx_header.ordinal,
3398 protocol_name: <WatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3399 }),
3400 }
3401 }
3402}
3403
3404pub struct WatcherV6RequestStream {
3406 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3407 is_terminated: bool,
3408}
3409
3410impl std::marker::Unpin for WatcherV6RequestStream {}
3411
3412impl futures::stream::FusedStream for WatcherV6RequestStream {
3413 fn is_terminated(&self) -> bool {
3414 self.is_terminated
3415 }
3416}
3417
3418impl fidl::endpoints::RequestStream for WatcherV6RequestStream {
3419 type Protocol = WatcherV6Marker;
3420 type ControlHandle = WatcherV6ControlHandle;
3421
3422 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3423 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3424 }
3425
3426 fn control_handle(&self) -> Self::ControlHandle {
3427 WatcherV6ControlHandle { inner: self.inner.clone() }
3428 }
3429
3430 fn into_inner(
3431 self,
3432 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3433 {
3434 (self.inner, self.is_terminated)
3435 }
3436
3437 fn from_inner(
3438 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3439 is_terminated: bool,
3440 ) -> Self {
3441 Self { inner, is_terminated }
3442 }
3443}
3444
3445impl futures::Stream for WatcherV6RequestStream {
3446 type Item = Result<WatcherV6Request, fidl::Error>;
3447
3448 fn poll_next(
3449 mut self: std::pin::Pin<&mut Self>,
3450 cx: &mut std::task::Context<'_>,
3451 ) -> std::task::Poll<Option<Self::Item>> {
3452 let this = &mut *self;
3453 if this.inner.check_shutdown(cx) {
3454 this.is_terminated = true;
3455 return std::task::Poll::Ready(None);
3456 }
3457 if this.is_terminated {
3458 panic!("polled WatcherV6RequestStream after completion");
3459 }
3460 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3461 |bytes, handles| {
3462 match this.inner.channel().read_etc(cx, bytes, handles) {
3463 std::task::Poll::Ready(Ok(())) => {}
3464 std::task::Poll::Pending => return std::task::Poll::Pending,
3465 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3466 this.is_terminated = true;
3467 return std::task::Poll::Ready(None);
3468 }
3469 std::task::Poll::Ready(Err(e)) => {
3470 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3471 e.into(),
3472 ))))
3473 }
3474 }
3475
3476 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3478
3479 std::task::Poll::Ready(Some(match header.ordinal {
3480 0x82f5e48afc8811e => {
3481 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3482 let mut req = fidl::new_empty!(
3483 fidl::encoding::EmptyPayload,
3484 fidl::encoding::DefaultFuchsiaResourceDialect
3485 );
3486 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3487 let control_handle = WatcherV6ControlHandle { inner: this.inner.clone() };
3488 Ok(WatcherV6Request::Watch {
3489 responder: WatcherV6WatchResponder {
3490 control_handle: std::mem::ManuallyDrop::new(control_handle),
3491 tx_id: header.tx_id,
3492 },
3493 })
3494 }
3495 _ => Err(fidl::Error::UnknownOrdinal {
3496 ordinal: header.ordinal,
3497 protocol_name:
3498 <WatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3499 }),
3500 }))
3501 },
3502 )
3503 }
3504}
3505
3506#[derive(Debug)]
3508pub enum WatcherV6Request {
3509 Watch { responder: WatcherV6WatchResponder },
3530}
3531
3532impl WatcherV6Request {
3533 #[allow(irrefutable_let_patterns)]
3534 pub fn into_watch(self) -> Option<(WatcherV6WatchResponder)> {
3535 if let WatcherV6Request::Watch { responder } = self {
3536 Some((responder))
3537 } else {
3538 None
3539 }
3540 }
3541
3542 pub fn method_name(&self) -> &'static str {
3544 match *self {
3545 WatcherV6Request::Watch { .. } => "watch",
3546 }
3547 }
3548}
3549
3550#[derive(Debug, Clone)]
3551pub struct WatcherV6ControlHandle {
3552 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3553}
3554
3555impl fidl::endpoints::ControlHandle for WatcherV6ControlHandle {
3556 fn shutdown(&self) {
3557 self.inner.shutdown()
3558 }
3559 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3560 self.inner.shutdown_with_epitaph(status)
3561 }
3562
3563 fn is_closed(&self) -> bool {
3564 self.inner.channel().is_closed()
3565 }
3566 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3567 self.inner.channel().on_closed()
3568 }
3569
3570 #[cfg(target_os = "fuchsia")]
3571 fn signal_peer(
3572 &self,
3573 clear_mask: zx::Signals,
3574 set_mask: zx::Signals,
3575 ) -> Result<(), zx_status::Status> {
3576 use fidl::Peered;
3577 self.inner.channel().signal_peer(clear_mask, set_mask)
3578 }
3579}
3580
3581impl WatcherV6ControlHandle {}
3582
3583#[must_use = "FIDL methods require a response to be sent"]
3584#[derive(Debug)]
3585pub struct WatcherV6WatchResponder {
3586 control_handle: std::mem::ManuallyDrop<WatcherV6ControlHandle>,
3587 tx_id: u32,
3588}
3589
3590impl std::ops::Drop for WatcherV6WatchResponder {
3594 fn drop(&mut self) {
3595 self.control_handle.shutdown();
3596 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3598 }
3599}
3600
3601impl fidl::endpoints::Responder for WatcherV6WatchResponder {
3602 type ControlHandle = WatcherV6ControlHandle;
3603
3604 fn control_handle(&self) -> &WatcherV6ControlHandle {
3605 &self.control_handle
3606 }
3607
3608 fn drop_without_shutdown(mut self) {
3609 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3611 std::mem::forget(self);
3613 }
3614}
3615
3616impl WatcherV6WatchResponder {
3617 pub fn send(self, mut events: &[EventV6]) -> Result<(), fidl::Error> {
3621 let _result = self.send_raw(events);
3622 if _result.is_err() {
3623 self.control_handle.shutdown();
3624 }
3625 self.drop_without_shutdown();
3626 _result
3627 }
3628
3629 pub fn send_no_shutdown_on_err(self, mut events: &[EventV6]) -> Result<(), fidl::Error> {
3631 let _result = self.send_raw(events);
3632 self.drop_without_shutdown();
3633 _result
3634 }
3635
3636 fn send_raw(&self, mut events: &[EventV6]) -> Result<(), fidl::Error> {
3637 self.control_handle.inner.send::<WatcherV6WatchResponse>(
3638 (events,),
3639 self.tx_id,
3640 0x82f5e48afc8811e,
3641 fidl::encoding::DynamicFlags::empty(),
3642 )
3643 }
3644}
3645
3646mod internal {
3647 use super::*;
3648
3649 impl fidl::encoding::ResourceTypeMarker for StateV4GetRuleWatcherV4Request {
3650 type Borrowed<'a> = &'a mut Self;
3651 fn take_or_borrow<'a>(
3652 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3653 ) -> Self::Borrowed<'a> {
3654 value
3655 }
3656 }
3657
3658 unsafe impl fidl::encoding::TypeMarker for StateV4GetRuleWatcherV4Request {
3659 type Owned = Self;
3660
3661 #[inline(always)]
3662 fn inline_align(_context: fidl::encoding::Context) -> usize {
3663 8
3664 }
3665
3666 #[inline(always)]
3667 fn inline_size(_context: fidl::encoding::Context) -> usize {
3668 24
3669 }
3670 }
3671
3672 unsafe impl
3673 fidl::encoding::Encode<
3674 StateV4GetRuleWatcherV4Request,
3675 fidl::encoding::DefaultFuchsiaResourceDialect,
3676 > for &mut StateV4GetRuleWatcherV4Request
3677 {
3678 #[inline]
3679 unsafe fn encode(
3680 self,
3681 encoder: &mut fidl::encoding::Encoder<
3682 '_,
3683 fidl::encoding::DefaultFuchsiaResourceDialect,
3684 >,
3685 offset: usize,
3686 _depth: fidl::encoding::Depth,
3687 ) -> fidl::Result<()> {
3688 encoder.debug_check_bounds::<StateV4GetRuleWatcherV4Request>(offset);
3689 fidl::encoding::Encode::<StateV4GetRuleWatcherV4Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3691 (
3692 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
3693 <RuleWatcherOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3694 ),
3695 encoder, offset, _depth
3696 )
3697 }
3698 }
3699 unsafe impl<
3700 T0: fidl::encoding::Encode<
3701 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV4Marker>>,
3702 fidl::encoding::DefaultFuchsiaResourceDialect,
3703 >,
3704 T1: fidl::encoding::Encode<
3705 RuleWatcherOptionsV4,
3706 fidl::encoding::DefaultFuchsiaResourceDialect,
3707 >,
3708 >
3709 fidl::encoding::Encode<
3710 StateV4GetRuleWatcherV4Request,
3711 fidl::encoding::DefaultFuchsiaResourceDialect,
3712 > for (T0, T1)
3713 {
3714 #[inline]
3715 unsafe fn encode(
3716 self,
3717 encoder: &mut fidl::encoding::Encoder<
3718 '_,
3719 fidl::encoding::DefaultFuchsiaResourceDialect,
3720 >,
3721 offset: usize,
3722 depth: fidl::encoding::Depth,
3723 ) -> fidl::Result<()> {
3724 encoder.debug_check_bounds::<StateV4GetRuleWatcherV4Request>(offset);
3725 unsafe {
3728 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3729 (ptr as *mut u64).write_unaligned(0);
3730 }
3731 self.0.encode(encoder, offset + 0, depth)?;
3733 self.1.encode(encoder, offset + 8, depth)?;
3734 Ok(())
3735 }
3736 }
3737
3738 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3739 for StateV4GetRuleWatcherV4Request
3740 {
3741 #[inline(always)]
3742 fn new_empty() -> Self {
3743 Self {
3744 watcher: fidl::new_empty!(
3745 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV4Marker>>,
3746 fidl::encoding::DefaultFuchsiaResourceDialect
3747 ),
3748 options: fidl::new_empty!(
3749 RuleWatcherOptionsV4,
3750 fidl::encoding::DefaultFuchsiaResourceDialect
3751 ),
3752 }
3753 }
3754
3755 #[inline]
3756 unsafe fn decode(
3757 &mut self,
3758 decoder: &mut fidl::encoding::Decoder<
3759 '_,
3760 fidl::encoding::DefaultFuchsiaResourceDialect,
3761 >,
3762 offset: usize,
3763 _depth: fidl::encoding::Depth,
3764 ) -> fidl::Result<()> {
3765 decoder.debug_check_bounds::<Self>(offset);
3766 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3768 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3769 let mask = 0xffffffff00000000u64;
3770 let maskedval = padval & mask;
3771 if maskedval != 0 {
3772 return Err(fidl::Error::NonZeroPadding {
3773 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3774 });
3775 }
3776 fidl::decode!(
3777 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV4Marker>>,
3778 fidl::encoding::DefaultFuchsiaResourceDialect,
3779 &mut self.watcher,
3780 decoder,
3781 offset + 0,
3782 _depth
3783 )?;
3784 fidl::decode!(
3785 RuleWatcherOptionsV4,
3786 fidl::encoding::DefaultFuchsiaResourceDialect,
3787 &mut self.options,
3788 decoder,
3789 offset + 8,
3790 _depth
3791 )?;
3792 Ok(())
3793 }
3794 }
3795
3796 impl fidl::encoding::ResourceTypeMarker for StateV4GetWatcherV4Request {
3797 type Borrowed<'a> = &'a mut Self;
3798 fn take_or_borrow<'a>(
3799 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3800 ) -> Self::Borrowed<'a> {
3801 value
3802 }
3803 }
3804
3805 unsafe impl fidl::encoding::TypeMarker for StateV4GetWatcherV4Request {
3806 type Owned = Self;
3807
3808 #[inline(always)]
3809 fn inline_align(_context: fidl::encoding::Context) -> usize {
3810 8
3811 }
3812
3813 #[inline(always)]
3814 fn inline_size(_context: fidl::encoding::Context) -> usize {
3815 24
3816 }
3817 }
3818
3819 unsafe impl
3820 fidl::encoding::Encode<
3821 StateV4GetWatcherV4Request,
3822 fidl::encoding::DefaultFuchsiaResourceDialect,
3823 > for &mut StateV4GetWatcherV4Request
3824 {
3825 #[inline]
3826 unsafe fn encode(
3827 self,
3828 encoder: &mut fidl::encoding::Encoder<
3829 '_,
3830 fidl::encoding::DefaultFuchsiaResourceDialect,
3831 >,
3832 offset: usize,
3833 _depth: fidl::encoding::Depth,
3834 ) -> fidl::Result<()> {
3835 encoder.debug_check_bounds::<StateV4GetWatcherV4Request>(offset);
3836 fidl::encoding::Encode::<StateV4GetWatcherV4Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3838 (
3839 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
3840 <WatcherOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3841 ),
3842 encoder, offset, _depth
3843 )
3844 }
3845 }
3846 unsafe impl<
3847 T0: fidl::encoding::Encode<
3848 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV4Marker>>,
3849 fidl::encoding::DefaultFuchsiaResourceDialect,
3850 >,
3851 T1: fidl::encoding::Encode<WatcherOptionsV4, fidl::encoding::DefaultFuchsiaResourceDialect>,
3852 >
3853 fidl::encoding::Encode<
3854 StateV4GetWatcherV4Request,
3855 fidl::encoding::DefaultFuchsiaResourceDialect,
3856 > for (T0, T1)
3857 {
3858 #[inline]
3859 unsafe fn encode(
3860 self,
3861 encoder: &mut fidl::encoding::Encoder<
3862 '_,
3863 fidl::encoding::DefaultFuchsiaResourceDialect,
3864 >,
3865 offset: usize,
3866 depth: fidl::encoding::Depth,
3867 ) -> fidl::Result<()> {
3868 encoder.debug_check_bounds::<StateV4GetWatcherV4Request>(offset);
3869 unsafe {
3872 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3873 (ptr as *mut u64).write_unaligned(0);
3874 }
3875 self.0.encode(encoder, offset + 0, depth)?;
3877 self.1.encode(encoder, offset + 8, depth)?;
3878 Ok(())
3879 }
3880 }
3881
3882 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3883 for StateV4GetWatcherV4Request
3884 {
3885 #[inline(always)]
3886 fn new_empty() -> Self {
3887 Self {
3888 watcher: fidl::new_empty!(
3889 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV4Marker>>,
3890 fidl::encoding::DefaultFuchsiaResourceDialect
3891 ),
3892 options: fidl::new_empty!(
3893 WatcherOptionsV4,
3894 fidl::encoding::DefaultFuchsiaResourceDialect
3895 ),
3896 }
3897 }
3898
3899 #[inline]
3900 unsafe fn decode(
3901 &mut self,
3902 decoder: &mut fidl::encoding::Decoder<
3903 '_,
3904 fidl::encoding::DefaultFuchsiaResourceDialect,
3905 >,
3906 offset: usize,
3907 _depth: fidl::encoding::Depth,
3908 ) -> fidl::Result<()> {
3909 decoder.debug_check_bounds::<Self>(offset);
3910 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3912 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3913 let mask = 0xffffffff00000000u64;
3914 let maskedval = padval & mask;
3915 if maskedval != 0 {
3916 return Err(fidl::Error::NonZeroPadding {
3917 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3918 });
3919 }
3920 fidl::decode!(
3921 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV4Marker>>,
3922 fidl::encoding::DefaultFuchsiaResourceDialect,
3923 &mut self.watcher,
3924 decoder,
3925 offset + 0,
3926 _depth
3927 )?;
3928 fidl::decode!(
3929 WatcherOptionsV4,
3930 fidl::encoding::DefaultFuchsiaResourceDialect,
3931 &mut self.options,
3932 decoder,
3933 offset + 8,
3934 _depth
3935 )?;
3936 Ok(())
3937 }
3938 }
3939
3940 impl fidl::encoding::ResourceTypeMarker for StateV6GetRuleWatcherV6Request {
3941 type Borrowed<'a> = &'a mut Self;
3942 fn take_or_borrow<'a>(
3943 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3944 ) -> Self::Borrowed<'a> {
3945 value
3946 }
3947 }
3948
3949 unsafe impl fidl::encoding::TypeMarker for StateV6GetRuleWatcherV6Request {
3950 type Owned = Self;
3951
3952 #[inline(always)]
3953 fn inline_align(_context: fidl::encoding::Context) -> usize {
3954 8
3955 }
3956
3957 #[inline(always)]
3958 fn inline_size(_context: fidl::encoding::Context) -> usize {
3959 24
3960 }
3961 }
3962
3963 unsafe impl
3964 fidl::encoding::Encode<
3965 StateV6GetRuleWatcherV6Request,
3966 fidl::encoding::DefaultFuchsiaResourceDialect,
3967 > for &mut StateV6GetRuleWatcherV6Request
3968 {
3969 #[inline]
3970 unsafe fn encode(
3971 self,
3972 encoder: &mut fidl::encoding::Encoder<
3973 '_,
3974 fidl::encoding::DefaultFuchsiaResourceDialect,
3975 >,
3976 offset: usize,
3977 _depth: fidl::encoding::Depth,
3978 ) -> fidl::Result<()> {
3979 encoder.debug_check_bounds::<StateV6GetRuleWatcherV6Request>(offset);
3980 fidl::encoding::Encode::<StateV6GetRuleWatcherV6Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3982 (
3983 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
3984 <RuleWatcherOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3985 ),
3986 encoder, offset, _depth
3987 )
3988 }
3989 }
3990 unsafe impl<
3991 T0: fidl::encoding::Encode<
3992 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV6Marker>>,
3993 fidl::encoding::DefaultFuchsiaResourceDialect,
3994 >,
3995 T1: fidl::encoding::Encode<
3996 RuleWatcherOptionsV6,
3997 fidl::encoding::DefaultFuchsiaResourceDialect,
3998 >,
3999 >
4000 fidl::encoding::Encode<
4001 StateV6GetRuleWatcherV6Request,
4002 fidl::encoding::DefaultFuchsiaResourceDialect,
4003 > for (T0, T1)
4004 {
4005 #[inline]
4006 unsafe fn encode(
4007 self,
4008 encoder: &mut fidl::encoding::Encoder<
4009 '_,
4010 fidl::encoding::DefaultFuchsiaResourceDialect,
4011 >,
4012 offset: usize,
4013 depth: fidl::encoding::Depth,
4014 ) -> fidl::Result<()> {
4015 encoder.debug_check_bounds::<StateV6GetRuleWatcherV6Request>(offset);
4016 unsafe {
4019 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4020 (ptr as *mut u64).write_unaligned(0);
4021 }
4022 self.0.encode(encoder, offset + 0, depth)?;
4024 self.1.encode(encoder, offset + 8, depth)?;
4025 Ok(())
4026 }
4027 }
4028
4029 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4030 for StateV6GetRuleWatcherV6Request
4031 {
4032 #[inline(always)]
4033 fn new_empty() -> Self {
4034 Self {
4035 watcher: fidl::new_empty!(
4036 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV6Marker>>,
4037 fidl::encoding::DefaultFuchsiaResourceDialect
4038 ),
4039 options: fidl::new_empty!(
4040 RuleWatcherOptionsV6,
4041 fidl::encoding::DefaultFuchsiaResourceDialect
4042 ),
4043 }
4044 }
4045
4046 #[inline]
4047 unsafe fn decode(
4048 &mut self,
4049 decoder: &mut fidl::encoding::Decoder<
4050 '_,
4051 fidl::encoding::DefaultFuchsiaResourceDialect,
4052 >,
4053 offset: usize,
4054 _depth: fidl::encoding::Depth,
4055 ) -> fidl::Result<()> {
4056 decoder.debug_check_bounds::<Self>(offset);
4057 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4059 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4060 let mask = 0xffffffff00000000u64;
4061 let maskedval = padval & mask;
4062 if maskedval != 0 {
4063 return Err(fidl::Error::NonZeroPadding {
4064 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4065 });
4066 }
4067 fidl::decode!(
4068 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV6Marker>>,
4069 fidl::encoding::DefaultFuchsiaResourceDialect,
4070 &mut self.watcher,
4071 decoder,
4072 offset + 0,
4073 _depth
4074 )?;
4075 fidl::decode!(
4076 RuleWatcherOptionsV6,
4077 fidl::encoding::DefaultFuchsiaResourceDialect,
4078 &mut self.options,
4079 decoder,
4080 offset + 8,
4081 _depth
4082 )?;
4083 Ok(())
4084 }
4085 }
4086
4087 impl fidl::encoding::ResourceTypeMarker for StateV6GetWatcherV6Request {
4088 type Borrowed<'a> = &'a mut Self;
4089 fn take_or_borrow<'a>(
4090 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4091 ) -> Self::Borrowed<'a> {
4092 value
4093 }
4094 }
4095
4096 unsafe impl fidl::encoding::TypeMarker for StateV6GetWatcherV6Request {
4097 type Owned = Self;
4098
4099 #[inline(always)]
4100 fn inline_align(_context: fidl::encoding::Context) -> usize {
4101 8
4102 }
4103
4104 #[inline(always)]
4105 fn inline_size(_context: fidl::encoding::Context) -> usize {
4106 24
4107 }
4108 }
4109
4110 unsafe impl
4111 fidl::encoding::Encode<
4112 StateV6GetWatcherV6Request,
4113 fidl::encoding::DefaultFuchsiaResourceDialect,
4114 > for &mut StateV6GetWatcherV6Request
4115 {
4116 #[inline]
4117 unsafe fn encode(
4118 self,
4119 encoder: &mut fidl::encoding::Encoder<
4120 '_,
4121 fidl::encoding::DefaultFuchsiaResourceDialect,
4122 >,
4123 offset: usize,
4124 _depth: fidl::encoding::Depth,
4125 ) -> fidl::Result<()> {
4126 encoder.debug_check_bounds::<StateV6GetWatcherV6Request>(offset);
4127 fidl::encoding::Encode::<StateV6GetWatcherV6Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4129 (
4130 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
4131 <WatcherOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
4132 ),
4133 encoder, offset, _depth
4134 )
4135 }
4136 }
4137 unsafe impl<
4138 T0: fidl::encoding::Encode<
4139 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV6Marker>>,
4140 fidl::encoding::DefaultFuchsiaResourceDialect,
4141 >,
4142 T1: fidl::encoding::Encode<WatcherOptionsV6, fidl::encoding::DefaultFuchsiaResourceDialect>,
4143 >
4144 fidl::encoding::Encode<
4145 StateV6GetWatcherV6Request,
4146 fidl::encoding::DefaultFuchsiaResourceDialect,
4147 > for (T0, T1)
4148 {
4149 #[inline]
4150 unsafe fn encode(
4151 self,
4152 encoder: &mut fidl::encoding::Encoder<
4153 '_,
4154 fidl::encoding::DefaultFuchsiaResourceDialect,
4155 >,
4156 offset: usize,
4157 depth: fidl::encoding::Depth,
4158 ) -> fidl::Result<()> {
4159 encoder.debug_check_bounds::<StateV6GetWatcherV6Request>(offset);
4160 unsafe {
4163 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4164 (ptr as *mut u64).write_unaligned(0);
4165 }
4166 self.0.encode(encoder, offset + 0, depth)?;
4168 self.1.encode(encoder, offset + 8, depth)?;
4169 Ok(())
4170 }
4171 }
4172
4173 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4174 for StateV6GetWatcherV6Request
4175 {
4176 #[inline(always)]
4177 fn new_empty() -> Self {
4178 Self {
4179 watcher: fidl::new_empty!(
4180 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV6Marker>>,
4181 fidl::encoding::DefaultFuchsiaResourceDialect
4182 ),
4183 options: fidl::new_empty!(
4184 WatcherOptionsV6,
4185 fidl::encoding::DefaultFuchsiaResourceDialect
4186 ),
4187 }
4188 }
4189
4190 #[inline]
4191 unsafe fn decode(
4192 &mut self,
4193 decoder: &mut fidl::encoding::Decoder<
4194 '_,
4195 fidl::encoding::DefaultFuchsiaResourceDialect,
4196 >,
4197 offset: usize,
4198 _depth: fidl::encoding::Depth,
4199 ) -> fidl::Result<()> {
4200 decoder.debug_check_bounds::<Self>(offset);
4201 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4203 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4204 let mask = 0xffffffff00000000u64;
4205 let maskedval = padval & mask;
4206 if maskedval != 0 {
4207 return Err(fidl::Error::NonZeroPadding {
4208 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4209 });
4210 }
4211 fidl::decode!(
4212 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV6Marker>>,
4213 fidl::encoding::DefaultFuchsiaResourceDialect,
4214 &mut self.watcher,
4215 decoder,
4216 offset + 0,
4217 _depth
4218 )?;
4219 fidl::decode!(
4220 WatcherOptionsV6,
4221 fidl::encoding::DefaultFuchsiaResourceDialect,
4222 &mut self.options,
4223 decoder,
4224 offset + 8,
4225 _depth
4226 )?;
4227 Ok(())
4228 }
4229 }
4230}