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 Self { client: fidl::client::sync::Client::new(channel) }
103 }
104
105 pub fn into_channel(self) -> fidl::Channel {
106 self.client.into_channel()
107 }
108
109 pub fn wait_for_event(
112 &self,
113 deadline: zx::MonotonicInstant,
114 ) -> Result<RuleWatcherV4Event, fidl::Error> {
115 RuleWatcherV4Event::decode(self.client.wait_for_event::<RuleWatcherV4Marker>(deadline)?)
116 }
117
118 pub fn r#watch(
132 &self,
133 ___deadline: zx::MonotonicInstant,
134 ) -> Result<Vec<RuleEventV4>, fidl::Error> {
135 let _response = self.client.send_query::<
136 fidl::encoding::EmptyPayload,
137 RuleWatcherV4WatchResponse,
138 RuleWatcherV4Marker,
139 >(
140 (),
141 0x7f94d7ea0f843271,
142 fidl::encoding::DynamicFlags::empty(),
143 ___deadline,
144 )?;
145 Ok(_response.events)
146 }
147}
148
149#[cfg(target_os = "fuchsia")]
150impl From<RuleWatcherV4SynchronousProxy> for zx::NullableHandle {
151 fn from(value: RuleWatcherV4SynchronousProxy) -> Self {
152 value.into_channel().into()
153 }
154}
155
156#[cfg(target_os = "fuchsia")]
157impl From<fidl::Channel> for RuleWatcherV4SynchronousProxy {
158 fn from(value: fidl::Channel) -> Self {
159 Self::new(value)
160 }
161}
162
163#[cfg(target_os = "fuchsia")]
164impl fidl::endpoints::FromClient for RuleWatcherV4SynchronousProxy {
165 type Protocol = RuleWatcherV4Marker;
166
167 fn from_client(value: fidl::endpoints::ClientEnd<RuleWatcherV4Marker>) -> Self {
168 Self::new(value.into_channel())
169 }
170}
171
172#[derive(Debug, Clone)]
173pub struct RuleWatcherV4Proxy {
174 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
175}
176
177impl fidl::endpoints::Proxy for RuleWatcherV4Proxy {
178 type Protocol = RuleWatcherV4Marker;
179
180 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
181 Self::new(inner)
182 }
183
184 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
185 self.client.into_channel().map_err(|client| Self { client })
186 }
187
188 fn as_channel(&self) -> &::fidl::AsyncChannel {
189 self.client.as_channel()
190 }
191}
192
193impl RuleWatcherV4Proxy {
194 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
196 let protocol_name = <RuleWatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
197 Self { client: fidl::client::Client::new(channel, protocol_name) }
198 }
199
200 pub fn take_event_stream(&self) -> RuleWatcherV4EventStream {
206 RuleWatcherV4EventStream { event_receiver: self.client.take_event_receiver() }
207 }
208
209 pub fn r#watch(
223 &self,
224 ) -> fidl::client::QueryResponseFut<
225 Vec<RuleEventV4>,
226 fidl::encoding::DefaultFuchsiaResourceDialect,
227 > {
228 RuleWatcherV4ProxyInterface::r#watch(self)
229 }
230}
231
232impl RuleWatcherV4ProxyInterface for RuleWatcherV4Proxy {
233 type WatchResponseFut = fidl::client::QueryResponseFut<
234 Vec<RuleEventV4>,
235 fidl::encoding::DefaultFuchsiaResourceDialect,
236 >;
237 fn r#watch(&self) -> Self::WatchResponseFut {
238 fn _decode(
239 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
240 ) -> Result<Vec<RuleEventV4>, fidl::Error> {
241 let _response = fidl::client::decode_transaction_body::<
242 RuleWatcherV4WatchResponse,
243 fidl::encoding::DefaultFuchsiaResourceDialect,
244 0x7f94d7ea0f843271,
245 >(_buf?)?;
246 Ok(_response.events)
247 }
248 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<RuleEventV4>>(
249 (),
250 0x7f94d7ea0f843271,
251 fidl::encoding::DynamicFlags::empty(),
252 _decode,
253 )
254 }
255}
256
257pub struct RuleWatcherV4EventStream {
258 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
259}
260
261impl std::marker::Unpin for RuleWatcherV4EventStream {}
262
263impl futures::stream::FusedStream for RuleWatcherV4EventStream {
264 fn is_terminated(&self) -> bool {
265 self.event_receiver.is_terminated()
266 }
267}
268
269impl futures::Stream for RuleWatcherV4EventStream {
270 type Item = Result<RuleWatcherV4Event, fidl::Error>;
271
272 fn poll_next(
273 mut self: std::pin::Pin<&mut Self>,
274 cx: &mut std::task::Context<'_>,
275 ) -> std::task::Poll<Option<Self::Item>> {
276 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
277 &mut self.event_receiver,
278 cx
279 )?) {
280 Some(buf) => std::task::Poll::Ready(Some(RuleWatcherV4Event::decode(buf))),
281 None => std::task::Poll::Ready(None),
282 }
283 }
284}
285
286#[derive(Debug)]
287pub enum RuleWatcherV4Event {}
288
289impl RuleWatcherV4Event {
290 fn decode(
292 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
293 ) -> Result<RuleWatcherV4Event, fidl::Error> {
294 let (bytes, _handles) = buf.split_mut();
295 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
296 debug_assert_eq!(tx_header.tx_id, 0);
297 match tx_header.ordinal {
298 _ => Err(fidl::Error::UnknownOrdinal {
299 ordinal: tx_header.ordinal,
300 protocol_name: <RuleWatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
301 }),
302 }
303 }
304}
305
306pub struct RuleWatcherV4RequestStream {
308 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
309 is_terminated: bool,
310}
311
312impl std::marker::Unpin for RuleWatcherV4RequestStream {}
313
314impl futures::stream::FusedStream for RuleWatcherV4RequestStream {
315 fn is_terminated(&self) -> bool {
316 self.is_terminated
317 }
318}
319
320impl fidl::endpoints::RequestStream for RuleWatcherV4RequestStream {
321 type Protocol = RuleWatcherV4Marker;
322 type ControlHandle = RuleWatcherV4ControlHandle;
323
324 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
325 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
326 }
327
328 fn control_handle(&self) -> Self::ControlHandle {
329 RuleWatcherV4ControlHandle { inner: self.inner.clone() }
330 }
331
332 fn into_inner(
333 self,
334 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
335 {
336 (self.inner, self.is_terminated)
337 }
338
339 fn from_inner(
340 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
341 is_terminated: bool,
342 ) -> Self {
343 Self { inner, is_terminated }
344 }
345}
346
347impl futures::Stream for RuleWatcherV4RequestStream {
348 type Item = Result<RuleWatcherV4Request, fidl::Error>;
349
350 fn poll_next(
351 mut self: std::pin::Pin<&mut Self>,
352 cx: &mut std::task::Context<'_>,
353 ) -> std::task::Poll<Option<Self::Item>> {
354 let this = &mut *self;
355 if this.inner.check_shutdown(cx) {
356 this.is_terminated = true;
357 return std::task::Poll::Ready(None);
358 }
359 if this.is_terminated {
360 panic!("polled RuleWatcherV4RequestStream after completion");
361 }
362 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
363 |bytes, handles| {
364 match this.inner.channel().read_etc(cx, bytes, handles) {
365 std::task::Poll::Ready(Ok(())) => {}
366 std::task::Poll::Pending => return std::task::Poll::Pending,
367 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
368 this.is_terminated = true;
369 return std::task::Poll::Ready(None);
370 }
371 std::task::Poll::Ready(Err(e)) => {
372 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
373 e.into(),
374 ))));
375 }
376 }
377
378 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
380
381 std::task::Poll::Ready(Some(match header.ordinal {
382 0x7f94d7ea0f843271 => {
383 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
384 let mut req = fidl::new_empty!(
385 fidl::encoding::EmptyPayload,
386 fidl::encoding::DefaultFuchsiaResourceDialect
387 );
388 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
389 let control_handle =
390 RuleWatcherV4ControlHandle { inner: this.inner.clone() };
391 Ok(RuleWatcherV4Request::Watch {
392 responder: RuleWatcherV4WatchResponder {
393 control_handle: std::mem::ManuallyDrop::new(control_handle),
394 tx_id: header.tx_id,
395 },
396 })
397 }
398 _ => Err(fidl::Error::UnknownOrdinal {
399 ordinal: header.ordinal,
400 protocol_name:
401 <RuleWatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
402 }),
403 }))
404 },
405 )
406 }
407}
408
409#[derive(Debug)]
411pub enum RuleWatcherV4Request {
412 Watch { responder: RuleWatcherV4WatchResponder },
426}
427
428impl RuleWatcherV4Request {
429 #[allow(irrefutable_let_patterns)]
430 pub fn into_watch(self) -> Option<(RuleWatcherV4WatchResponder)> {
431 if let RuleWatcherV4Request::Watch { responder } = self { Some((responder)) } else { None }
432 }
433
434 pub fn method_name(&self) -> &'static str {
436 match *self {
437 RuleWatcherV4Request::Watch { .. } => "watch",
438 }
439 }
440}
441
442#[derive(Debug, Clone)]
443pub struct RuleWatcherV4ControlHandle {
444 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
445}
446
447impl fidl::endpoints::ControlHandle for RuleWatcherV4ControlHandle {
448 fn shutdown(&self) {
449 self.inner.shutdown()
450 }
451
452 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
453 self.inner.shutdown_with_epitaph(status)
454 }
455
456 fn is_closed(&self) -> bool {
457 self.inner.channel().is_closed()
458 }
459 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
460 self.inner.channel().on_closed()
461 }
462
463 #[cfg(target_os = "fuchsia")]
464 fn signal_peer(
465 &self,
466 clear_mask: zx::Signals,
467 set_mask: zx::Signals,
468 ) -> Result<(), zx_status::Status> {
469 use fidl::Peered;
470 self.inner.channel().signal_peer(clear_mask, set_mask)
471 }
472}
473
474impl RuleWatcherV4ControlHandle {}
475
476#[must_use = "FIDL methods require a response to be sent"]
477#[derive(Debug)]
478pub struct RuleWatcherV4WatchResponder {
479 control_handle: std::mem::ManuallyDrop<RuleWatcherV4ControlHandle>,
480 tx_id: u32,
481}
482
483impl std::ops::Drop for RuleWatcherV4WatchResponder {
487 fn drop(&mut self) {
488 self.control_handle.shutdown();
489 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
491 }
492}
493
494impl fidl::endpoints::Responder for RuleWatcherV4WatchResponder {
495 type ControlHandle = RuleWatcherV4ControlHandle;
496
497 fn control_handle(&self) -> &RuleWatcherV4ControlHandle {
498 &self.control_handle
499 }
500
501 fn drop_without_shutdown(mut self) {
502 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
504 std::mem::forget(self);
506 }
507}
508
509impl RuleWatcherV4WatchResponder {
510 pub fn send(self, mut events: &[RuleEventV4]) -> Result<(), fidl::Error> {
514 let _result = self.send_raw(events);
515 if _result.is_err() {
516 self.control_handle.shutdown();
517 }
518 self.drop_without_shutdown();
519 _result
520 }
521
522 pub fn send_no_shutdown_on_err(self, mut events: &[RuleEventV4]) -> Result<(), fidl::Error> {
524 let _result = self.send_raw(events);
525 self.drop_without_shutdown();
526 _result
527 }
528
529 fn send_raw(&self, mut events: &[RuleEventV4]) -> Result<(), fidl::Error> {
530 self.control_handle.inner.send::<RuleWatcherV4WatchResponse>(
531 (events,),
532 self.tx_id,
533 0x7f94d7ea0f843271,
534 fidl::encoding::DynamicFlags::empty(),
535 )
536 }
537}
538
539#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
540pub struct RuleWatcherV6Marker;
541
542impl fidl::endpoints::ProtocolMarker for RuleWatcherV6Marker {
543 type Proxy = RuleWatcherV6Proxy;
544 type RequestStream = RuleWatcherV6RequestStream;
545 #[cfg(target_os = "fuchsia")]
546 type SynchronousProxy = RuleWatcherV6SynchronousProxy;
547
548 const DEBUG_NAME: &'static str = "(anonymous) RuleWatcherV6";
549}
550
551pub trait RuleWatcherV6ProxyInterface: Send + Sync {
552 type WatchResponseFut: std::future::Future<Output = Result<Vec<RuleEventV6>, fidl::Error>>
553 + Send;
554 fn r#watch(&self) -> Self::WatchResponseFut;
555}
556#[derive(Debug)]
557#[cfg(target_os = "fuchsia")]
558pub struct RuleWatcherV6SynchronousProxy {
559 client: fidl::client::sync::Client,
560}
561
562#[cfg(target_os = "fuchsia")]
563impl fidl::endpoints::SynchronousProxy for RuleWatcherV6SynchronousProxy {
564 type Proxy = RuleWatcherV6Proxy;
565 type Protocol = RuleWatcherV6Marker;
566
567 fn from_channel(inner: fidl::Channel) -> Self {
568 Self::new(inner)
569 }
570
571 fn into_channel(self) -> fidl::Channel {
572 self.client.into_channel()
573 }
574
575 fn as_channel(&self) -> &fidl::Channel {
576 self.client.as_channel()
577 }
578}
579
580#[cfg(target_os = "fuchsia")]
581impl RuleWatcherV6SynchronousProxy {
582 pub fn new(channel: fidl::Channel) -> Self {
583 Self { client: fidl::client::sync::Client::new(channel) }
584 }
585
586 pub fn into_channel(self) -> fidl::Channel {
587 self.client.into_channel()
588 }
589
590 pub fn wait_for_event(
593 &self,
594 deadline: zx::MonotonicInstant,
595 ) -> Result<RuleWatcherV6Event, fidl::Error> {
596 RuleWatcherV6Event::decode(self.client.wait_for_event::<RuleWatcherV6Marker>(deadline)?)
597 }
598
599 pub fn r#watch(
613 &self,
614 ___deadline: zx::MonotonicInstant,
615 ) -> Result<Vec<RuleEventV6>, fidl::Error> {
616 let _response = self.client.send_query::<
617 fidl::encoding::EmptyPayload,
618 RuleWatcherV6WatchResponse,
619 RuleWatcherV6Marker,
620 >(
621 (),
622 0x5ccd746122bfa678,
623 fidl::encoding::DynamicFlags::empty(),
624 ___deadline,
625 )?;
626 Ok(_response.events)
627 }
628}
629
630#[cfg(target_os = "fuchsia")]
631impl From<RuleWatcherV6SynchronousProxy> for zx::NullableHandle {
632 fn from(value: RuleWatcherV6SynchronousProxy) -> Self {
633 value.into_channel().into()
634 }
635}
636
637#[cfg(target_os = "fuchsia")]
638impl From<fidl::Channel> for RuleWatcherV6SynchronousProxy {
639 fn from(value: fidl::Channel) -> Self {
640 Self::new(value)
641 }
642}
643
644#[cfg(target_os = "fuchsia")]
645impl fidl::endpoints::FromClient for RuleWatcherV6SynchronousProxy {
646 type Protocol = RuleWatcherV6Marker;
647
648 fn from_client(value: fidl::endpoints::ClientEnd<RuleWatcherV6Marker>) -> Self {
649 Self::new(value.into_channel())
650 }
651}
652
653#[derive(Debug, Clone)]
654pub struct RuleWatcherV6Proxy {
655 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
656}
657
658impl fidl::endpoints::Proxy for RuleWatcherV6Proxy {
659 type Protocol = RuleWatcherV6Marker;
660
661 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
662 Self::new(inner)
663 }
664
665 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
666 self.client.into_channel().map_err(|client| Self { client })
667 }
668
669 fn as_channel(&self) -> &::fidl::AsyncChannel {
670 self.client.as_channel()
671 }
672}
673
674impl RuleWatcherV6Proxy {
675 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
677 let protocol_name = <RuleWatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
678 Self { client: fidl::client::Client::new(channel, protocol_name) }
679 }
680
681 pub fn take_event_stream(&self) -> RuleWatcherV6EventStream {
687 RuleWatcherV6EventStream { event_receiver: self.client.take_event_receiver() }
688 }
689
690 pub fn r#watch(
704 &self,
705 ) -> fidl::client::QueryResponseFut<
706 Vec<RuleEventV6>,
707 fidl::encoding::DefaultFuchsiaResourceDialect,
708 > {
709 RuleWatcherV6ProxyInterface::r#watch(self)
710 }
711}
712
713impl RuleWatcherV6ProxyInterface for RuleWatcherV6Proxy {
714 type WatchResponseFut = fidl::client::QueryResponseFut<
715 Vec<RuleEventV6>,
716 fidl::encoding::DefaultFuchsiaResourceDialect,
717 >;
718 fn r#watch(&self) -> Self::WatchResponseFut {
719 fn _decode(
720 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
721 ) -> Result<Vec<RuleEventV6>, fidl::Error> {
722 let _response = fidl::client::decode_transaction_body::<
723 RuleWatcherV6WatchResponse,
724 fidl::encoding::DefaultFuchsiaResourceDialect,
725 0x5ccd746122bfa678,
726 >(_buf?)?;
727 Ok(_response.events)
728 }
729 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<RuleEventV6>>(
730 (),
731 0x5ccd746122bfa678,
732 fidl::encoding::DynamicFlags::empty(),
733 _decode,
734 )
735 }
736}
737
738pub struct RuleWatcherV6EventStream {
739 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
740}
741
742impl std::marker::Unpin for RuleWatcherV6EventStream {}
743
744impl futures::stream::FusedStream for RuleWatcherV6EventStream {
745 fn is_terminated(&self) -> bool {
746 self.event_receiver.is_terminated()
747 }
748}
749
750impl futures::Stream for RuleWatcherV6EventStream {
751 type Item = Result<RuleWatcherV6Event, fidl::Error>;
752
753 fn poll_next(
754 mut self: std::pin::Pin<&mut Self>,
755 cx: &mut std::task::Context<'_>,
756 ) -> std::task::Poll<Option<Self::Item>> {
757 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
758 &mut self.event_receiver,
759 cx
760 )?) {
761 Some(buf) => std::task::Poll::Ready(Some(RuleWatcherV6Event::decode(buf))),
762 None => std::task::Poll::Ready(None),
763 }
764 }
765}
766
767#[derive(Debug)]
768pub enum RuleWatcherV6Event {}
769
770impl RuleWatcherV6Event {
771 fn decode(
773 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
774 ) -> Result<RuleWatcherV6Event, fidl::Error> {
775 let (bytes, _handles) = buf.split_mut();
776 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
777 debug_assert_eq!(tx_header.tx_id, 0);
778 match tx_header.ordinal {
779 _ => Err(fidl::Error::UnknownOrdinal {
780 ordinal: tx_header.ordinal,
781 protocol_name: <RuleWatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
782 }),
783 }
784 }
785}
786
787pub struct RuleWatcherV6RequestStream {
789 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
790 is_terminated: bool,
791}
792
793impl std::marker::Unpin for RuleWatcherV6RequestStream {}
794
795impl futures::stream::FusedStream for RuleWatcherV6RequestStream {
796 fn is_terminated(&self) -> bool {
797 self.is_terminated
798 }
799}
800
801impl fidl::endpoints::RequestStream for RuleWatcherV6RequestStream {
802 type Protocol = RuleWatcherV6Marker;
803 type ControlHandle = RuleWatcherV6ControlHandle;
804
805 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
806 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
807 }
808
809 fn control_handle(&self) -> Self::ControlHandle {
810 RuleWatcherV6ControlHandle { inner: self.inner.clone() }
811 }
812
813 fn into_inner(
814 self,
815 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
816 {
817 (self.inner, self.is_terminated)
818 }
819
820 fn from_inner(
821 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
822 is_terminated: bool,
823 ) -> Self {
824 Self { inner, is_terminated }
825 }
826}
827
828impl futures::Stream for RuleWatcherV6RequestStream {
829 type Item = Result<RuleWatcherV6Request, fidl::Error>;
830
831 fn poll_next(
832 mut self: std::pin::Pin<&mut Self>,
833 cx: &mut std::task::Context<'_>,
834 ) -> std::task::Poll<Option<Self::Item>> {
835 let this = &mut *self;
836 if this.inner.check_shutdown(cx) {
837 this.is_terminated = true;
838 return std::task::Poll::Ready(None);
839 }
840 if this.is_terminated {
841 panic!("polled RuleWatcherV6RequestStream after completion");
842 }
843 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
844 |bytes, handles| {
845 match this.inner.channel().read_etc(cx, bytes, handles) {
846 std::task::Poll::Ready(Ok(())) => {}
847 std::task::Poll::Pending => return std::task::Poll::Pending,
848 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
849 this.is_terminated = true;
850 return std::task::Poll::Ready(None);
851 }
852 std::task::Poll::Ready(Err(e)) => {
853 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
854 e.into(),
855 ))));
856 }
857 }
858
859 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
861
862 std::task::Poll::Ready(Some(match header.ordinal {
863 0x5ccd746122bfa678 => {
864 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
865 let mut req = fidl::new_empty!(
866 fidl::encoding::EmptyPayload,
867 fidl::encoding::DefaultFuchsiaResourceDialect
868 );
869 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
870 let control_handle =
871 RuleWatcherV6ControlHandle { inner: this.inner.clone() };
872 Ok(RuleWatcherV6Request::Watch {
873 responder: RuleWatcherV6WatchResponder {
874 control_handle: std::mem::ManuallyDrop::new(control_handle),
875 tx_id: header.tx_id,
876 },
877 })
878 }
879 _ => Err(fidl::Error::UnknownOrdinal {
880 ordinal: header.ordinal,
881 protocol_name:
882 <RuleWatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
883 }),
884 }))
885 },
886 )
887 }
888}
889
890#[derive(Debug)]
892pub enum RuleWatcherV6Request {
893 Watch { responder: RuleWatcherV6WatchResponder },
907}
908
909impl RuleWatcherV6Request {
910 #[allow(irrefutable_let_patterns)]
911 pub fn into_watch(self) -> Option<(RuleWatcherV6WatchResponder)> {
912 if let RuleWatcherV6Request::Watch { responder } = self { Some((responder)) } else { None }
913 }
914
915 pub fn method_name(&self) -> &'static str {
917 match *self {
918 RuleWatcherV6Request::Watch { .. } => "watch",
919 }
920 }
921}
922
923#[derive(Debug, Clone)]
924pub struct RuleWatcherV6ControlHandle {
925 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
926}
927
928impl fidl::endpoints::ControlHandle for RuleWatcherV6ControlHandle {
929 fn shutdown(&self) {
930 self.inner.shutdown()
931 }
932
933 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
934 self.inner.shutdown_with_epitaph(status)
935 }
936
937 fn is_closed(&self) -> bool {
938 self.inner.channel().is_closed()
939 }
940 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
941 self.inner.channel().on_closed()
942 }
943
944 #[cfg(target_os = "fuchsia")]
945 fn signal_peer(
946 &self,
947 clear_mask: zx::Signals,
948 set_mask: zx::Signals,
949 ) -> Result<(), zx_status::Status> {
950 use fidl::Peered;
951 self.inner.channel().signal_peer(clear_mask, set_mask)
952 }
953}
954
955impl RuleWatcherV6ControlHandle {}
956
957#[must_use = "FIDL methods require a response to be sent"]
958#[derive(Debug)]
959pub struct RuleWatcherV6WatchResponder {
960 control_handle: std::mem::ManuallyDrop<RuleWatcherV6ControlHandle>,
961 tx_id: u32,
962}
963
964impl std::ops::Drop for RuleWatcherV6WatchResponder {
968 fn drop(&mut self) {
969 self.control_handle.shutdown();
970 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
972 }
973}
974
975impl fidl::endpoints::Responder for RuleWatcherV6WatchResponder {
976 type ControlHandle = RuleWatcherV6ControlHandle;
977
978 fn control_handle(&self) -> &RuleWatcherV6ControlHandle {
979 &self.control_handle
980 }
981
982 fn drop_without_shutdown(mut self) {
983 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
985 std::mem::forget(self);
987 }
988}
989
990impl RuleWatcherV6WatchResponder {
991 pub fn send(self, mut events: &[RuleEventV6]) -> Result<(), fidl::Error> {
995 let _result = self.send_raw(events);
996 if _result.is_err() {
997 self.control_handle.shutdown();
998 }
999 self.drop_without_shutdown();
1000 _result
1001 }
1002
1003 pub fn send_no_shutdown_on_err(self, mut events: &[RuleEventV6]) -> Result<(), fidl::Error> {
1005 let _result = self.send_raw(events);
1006 self.drop_without_shutdown();
1007 _result
1008 }
1009
1010 fn send_raw(&self, mut events: &[RuleEventV6]) -> Result<(), fidl::Error> {
1011 self.control_handle.inner.send::<RuleWatcherV6WatchResponse>(
1012 (events,),
1013 self.tx_id,
1014 0x5ccd746122bfa678,
1015 fidl::encoding::DynamicFlags::empty(),
1016 )
1017 }
1018}
1019
1020#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1021pub struct StateMarker;
1022
1023impl fidl::endpoints::ProtocolMarker for StateMarker {
1024 type Proxy = StateProxy;
1025 type RequestStream = StateRequestStream;
1026 #[cfg(target_os = "fuchsia")]
1027 type SynchronousProxy = StateSynchronousProxy;
1028
1029 const DEBUG_NAME: &'static str = "fuchsia.net.routes.State";
1030}
1031impl fidl::endpoints::DiscoverableProtocolMarker for StateMarker {}
1032pub type StateResolveResult = Result<Resolved, i32>;
1033pub type StateResolve2Result = Result<ResolveResult, ResolveError>;
1034pub type StateGetRouteTableNameResult = Result<String, StateGetRouteTableNameError>;
1035
1036pub trait StateProxyInterface: Send + Sync {
1037 type ResolveResponseFut: std::future::Future<Output = Result<StateResolveResult, fidl::Error>>
1038 + Send;
1039 fn r#resolve(&self, destination: &fidl_fuchsia_net::IpAddress) -> Self::ResolveResponseFut;
1040 type Resolve2ResponseFut: std::future::Future<Output = Result<StateResolve2Result, fidl::Error>>
1041 + Send;
1042 fn r#resolve2(
1043 &self,
1044 destination: &fidl_fuchsia_net::IpAddress,
1045 options: &ResolveOptions,
1046 ) -> Self::Resolve2ResponseFut;
1047 type GetRouteTableNameResponseFut: std::future::Future<Output = Result<StateGetRouteTableNameResult, fidl::Error>>
1048 + Send;
1049 fn r#get_route_table_name(&self, table_id: u32) -> Self::GetRouteTableNameResponseFut;
1050}
1051#[derive(Debug)]
1052#[cfg(target_os = "fuchsia")]
1053pub struct StateSynchronousProxy {
1054 client: fidl::client::sync::Client,
1055}
1056
1057#[cfg(target_os = "fuchsia")]
1058impl fidl::endpoints::SynchronousProxy for StateSynchronousProxy {
1059 type Proxy = StateProxy;
1060 type Protocol = StateMarker;
1061
1062 fn from_channel(inner: fidl::Channel) -> Self {
1063 Self::new(inner)
1064 }
1065
1066 fn into_channel(self) -> fidl::Channel {
1067 self.client.into_channel()
1068 }
1069
1070 fn as_channel(&self) -> &fidl::Channel {
1071 self.client.as_channel()
1072 }
1073}
1074
1075#[cfg(target_os = "fuchsia")]
1076impl StateSynchronousProxy {
1077 pub fn new(channel: fidl::Channel) -> Self {
1078 Self { client: fidl::client::sync::Client::new(channel) }
1079 }
1080
1081 pub fn into_channel(self) -> fidl::Channel {
1082 self.client.into_channel()
1083 }
1084
1085 pub fn wait_for_event(
1088 &self,
1089 deadline: zx::MonotonicInstant,
1090 ) -> Result<StateEvent, fidl::Error> {
1091 StateEvent::decode(self.client.wait_for_event::<StateMarker>(deadline)?)
1092 }
1093
1094 pub fn r#resolve(
1103 &self,
1104 mut destination: &fidl_fuchsia_net::IpAddress,
1105 ___deadline: zx::MonotonicInstant,
1106 ) -> Result<StateResolveResult, fidl::Error> {
1107 let _response = self.client.send_query::<
1108 StateResolveRequest,
1109 fidl::encoding::ResultType<StateResolveResponse, i32>,
1110 StateMarker,
1111 >(
1112 (destination,),
1113 0x1541bc37d2d1dfb0,
1114 fidl::encoding::DynamicFlags::empty(),
1115 ___deadline,
1116 )?;
1117 Ok(_response.map(|x| x.result))
1118 }
1119
1120 pub fn r#resolve2(
1130 &self,
1131 mut destination: &fidl_fuchsia_net::IpAddress,
1132 mut options: &ResolveOptions,
1133 ___deadline: zx::MonotonicInstant,
1134 ) -> Result<StateResolve2Result, fidl::Error> {
1135 let _response = self.client.send_query::<StateResolve2Request, fidl::encoding::ResultType<
1136 StateResolve2Response,
1137 ResolveError,
1138 >, StateMarker>(
1139 (destination, options),
1140 0x3a37608b6851f75c,
1141 fidl::encoding::DynamicFlags::empty(),
1142 ___deadline,
1143 )?;
1144 Ok(_response.map(|x| x.result))
1145 }
1146
1147 pub fn r#get_route_table_name(
1154 &self,
1155 mut table_id: u32,
1156 ___deadline: zx::MonotonicInstant,
1157 ) -> Result<StateGetRouteTableNameResult, fidl::Error> {
1158 let _response =
1159 self.client.send_query::<StateGetRouteTableNameRequest, fidl::encoding::ResultType<
1160 StateGetRouteTableNameResponse,
1161 StateGetRouteTableNameError,
1162 >, StateMarker>(
1163 (table_id,),
1164 0x6fed5423c7ce421a,
1165 fidl::encoding::DynamicFlags::empty(),
1166 ___deadline,
1167 )?;
1168 Ok(_response.map(|x| x.table_name))
1169 }
1170}
1171
1172#[cfg(target_os = "fuchsia")]
1173impl From<StateSynchronousProxy> for zx::NullableHandle {
1174 fn from(value: StateSynchronousProxy) -> Self {
1175 value.into_channel().into()
1176 }
1177}
1178
1179#[cfg(target_os = "fuchsia")]
1180impl From<fidl::Channel> for StateSynchronousProxy {
1181 fn from(value: fidl::Channel) -> Self {
1182 Self::new(value)
1183 }
1184}
1185
1186#[cfg(target_os = "fuchsia")]
1187impl fidl::endpoints::FromClient for StateSynchronousProxy {
1188 type Protocol = StateMarker;
1189
1190 fn from_client(value: fidl::endpoints::ClientEnd<StateMarker>) -> Self {
1191 Self::new(value.into_channel())
1192 }
1193}
1194
1195#[derive(Debug, Clone)]
1196pub struct StateProxy {
1197 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1198}
1199
1200impl fidl::endpoints::Proxy for StateProxy {
1201 type Protocol = StateMarker;
1202
1203 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1204 Self::new(inner)
1205 }
1206
1207 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1208 self.client.into_channel().map_err(|client| Self { client })
1209 }
1210
1211 fn as_channel(&self) -> &::fidl::AsyncChannel {
1212 self.client.as_channel()
1213 }
1214}
1215
1216impl StateProxy {
1217 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1219 let protocol_name = <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1220 Self { client: fidl::client::Client::new(channel, protocol_name) }
1221 }
1222
1223 pub fn take_event_stream(&self) -> StateEventStream {
1229 StateEventStream { event_receiver: self.client.take_event_receiver() }
1230 }
1231
1232 pub fn r#resolve(
1241 &self,
1242 mut destination: &fidl_fuchsia_net::IpAddress,
1243 ) -> fidl::client::QueryResponseFut<
1244 StateResolveResult,
1245 fidl::encoding::DefaultFuchsiaResourceDialect,
1246 > {
1247 StateProxyInterface::r#resolve(self, destination)
1248 }
1249
1250 pub fn r#resolve2(
1260 &self,
1261 mut destination: &fidl_fuchsia_net::IpAddress,
1262 mut options: &ResolveOptions,
1263 ) -> fidl::client::QueryResponseFut<
1264 StateResolve2Result,
1265 fidl::encoding::DefaultFuchsiaResourceDialect,
1266 > {
1267 StateProxyInterface::r#resolve2(self, destination, options)
1268 }
1269
1270 pub fn r#get_route_table_name(
1277 &self,
1278 mut table_id: u32,
1279 ) -> fidl::client::QueryResponseFut<
1280 StateGetRouteTableNameResult,
1281 fidl::encoding::DefaultFuchsiaResourceDialect,
1282 > {
1283 StateProxyInterface::r#get_route_table_name(self, table_id)
1284 }
1285}
1286
1287impl StateProxyInterface for StateProxy {
1288 type ResolveResponseFut = fidl::client::QueryResponseFut<
1289 StateResolveResult,
1290 fidl::encoding::DefaultFuchsiaResourceDialect,
1291 >;
1292 fn r#resolve(&self, mut destination: &fidl_fuchsia_net::IpAddress) -> Self::ResolveResponseFut {
1293 fn _decode(
1294 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1295 ) -> Result<StateResolveResult, fidl::Error> {
1296 let _response = fidl::client::decode_transaction_body::<
1297 fidl::encoding::ResultType<StateResolveResponse, i32>,
1298 fidl::encoding::DefaultFuchsiaResourceDialect,
1299 0x1541bc37d2d1dfb0,
1300 >(_buf?)?;
1301 Ok(_response.map(|x| x.result))
1302 }
1303 self.client.send_query_and_decode::<StateResolveRequest, StateResolveResult>(
1304 (destination,),
1305 0x1541bc37d2d1dfb0,
1306 fidl::encoding::DynamicFlags::empty(),
1307 _decode,
1308 )
1309 }
1310
1311 type Resolve2ResponseFut = fidl::client::QueryResponseFut<
1312 StateResolve2Result,
1313 fidl::encoding::DefaultFuchsiaResourceDialect,
1314 >;
1315 fn r#resolve2(
1316 &self,
1317 mut destination: &fidl_fuchsia_net::IpAddress,
1318 mut options: &ResolveOptions,
1319 ) -> Self::Resolve2ResponseFut {
1320 fn _decode(
1321 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1322 ) -> Result<StateResolve2Result, fidl::Error> {
1323 let _response = fidl::client::decode_transaction_body::<
1324 fidl::encoding::ResultType<StateResolve2Response, ResolveError>,
1325 fidl::encoding::DefaultFuchsiaResourceDialect,
1326 0x3a37608b6851f75c,
1327 >(_buf?)?;
1328 Ok(_response.map(|x| x.result))
1329 }
1330 self.client.send_query_and_decode::<StateResolve2Request, StateResolve2Result>(
1331 (destination, options),
1332 0x3a37608b6851f75c,
1333 fidl::encoding::DynamicFlags::empty(),
1334 _decode,
1335 )
1336 }
1337
1338 type GetRouteTableNameResponseFut = fidl::client::QueryResponseFut<
1339 StateGetRouteTableNameResult,
1340 fidl::encoding::DefaultFuchsiaResourceDialect,
1341 >;
1342 fn r#get_route_table_name(&self, mut table_id: u32) -> Self::GetRouteTableNameResponseFut {
1343 fn _decode(
1344 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1345 ) -> Result<StateGetRouteTableNameResult, fidl::Error> {
1346 let _response = fidl::client::decode_transaction_body::<
1347 fidl::encoding::ResultType<
1348 StateGetRouteTableNameResponse,
1349 StateGetRouteTableNameError,
1350 >,
1351 fidl::encoding::DefaultFuchsiaResourceDialect,
1352 0x6fed5423c7ce421a,
1353 >(_buf?)?;
1354 Ok(_response.map(|x| x.table_name))
1355 }
1356 self.client
1357 .send_query_and_decode::<StateGetRouteTableNameRequest, StateGetRouteTableNameResult>(
1358 (table_id,),
1359 0x6fed5423c7ce421a,
1360 fidl::encoding::DynamicFlags::empty(),
1361 _decode,
1362 )
1363 }
1364}
1365
1366pub struct StateEventStream {
1367 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1368}
1369
1370impl std::marker::Unpin for StateEventStream {}
1371
1372impl futures::stream::FusedStream for StateEventStream {
1373 fn is_terminated(&self) -> bool {
1374 self.event_receiver.is_terminated()
1375 }
1376}
1377
1378impl futures::Stream for StateEventStream {
1379 type Item = Result<StateEvent, fidl::Error>;
1380
1381 fn poll_next(
1382 mut self: std::pin::Pin<&mut Self>,
1383 cx: &mut std::task::Context<'_>,
1384 ) -> std::task::Poll<Option<Self::Item>> {
1385 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1386 &mut self.event_receiver,
1387 cx
1388 )?) {
1389 Some(buf) => std::task::Poll::Ready(Some(StateEvent::decode(buf))),
1390 None => std::task::Poll::Ready(None),
1391 }
1392 }
1393}
1394
1395#[derive(Debug)]
1396pub enum StateEvent {}
1397
1398impl StateEvent {
1399 fn decode(
1401 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1402 ) -> Result<StateEvent, fidl::Error> {
1403 let (bytes, _handles) = buf.split_mut();
1404 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1405 debug_assert_eq!(tx_header.tx_id, 0);
1406 match tx_header.ordinal {
1407 _ => Err(fidl::Error::UnknownOrdinal {
1408 ordinal: tx_header.ordinal,
1409 protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1410 }),
1411 }
1412 }
1413}
1414
1415pub struct StateRequestStream {
1417 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1418 is_terminated: bool,
1419}
1420
1421impl std::marker::Unpin for StateRequestStream {}
1422
1423impl futures::stream::FusedStream for StateRequestStream {
1424 fn is_terminated(&self) -> bool {
1425 self.is_terminated
1426 }
1427}
1428
1429impl fidl::endpoints::RequestStream for StateRequestStream {
1430 type Protocol = StateMarker;
1431 type ControlHandle = StateControlHandle;
1432
1433 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1434 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1435 }
1436
1437 fn control_handle(&self) -> Self::ControlHandle {
1438 StateControlHandle { inner: self.inner.clone() }
1439 }
1440
1441 fn into_inner(
1442 self,
1443 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1444 {
1445 (self.inner, self.is_terminated)
1446 }
1447
1448 fn from_inner(
1449 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1450 is_terminated: bool,
1451 ) -> Self {
1452 Self { inner, is_terminated }
1453 }
1454}
1455
1456impl futures::Stream for StateRequestStream {
1457 type Item = Result<StateRequest, fidl::Error>;
1458
1459 fn poll_next(
1460 mut self: std::pin::Pin<&mut Self>,
1461 cx: &mut std::task::Context<'_>,
1462 ) -> std::task::Poll<Option<Self::Item>> {
1463 let this = &mut *self;
1464 if this.inner.check_shutdown(cx) {
1465 this.is_terminated = true;
1466 return std::task::Poll::Ready(None);
1467 }
1468 if this.is_terminated {
1469 panic!("polled StateRequestStream after completion");
1470 }
1471 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1472 |bytes, handles| {
1473 match this.inner.channel().read_etc(cx, bytes, handles) {
1474 std::task::Poll::Ready(Ok(())) => {}
1475 std::task::Poll::Pending => return std::task::Poll::Pending,
1476 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1477 this.is_terminated = true;
1478 return std::task::Poll::Ready(None);
1479 }
1480 std::task::Poll::Ready(Err(e)) => {
1481 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1482 e.into(),
1483 ))));
1484 }
1485 }
1486
1487 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1489
1490 std::task::Poll::Ready(Some(match header.ordinal {
1491 0x1541bc37d2d1dfb0 => {
1492 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1493 let mut req = fidl::new_empty!(
1494 StateResolveRequest,
1495 fidl::encoding::DefaultFuchsiaResourceDialect
1496 );
1497 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateResolveRequest>(&header, _body_bytes, handles, &mut req)?;
1498 let control_handle = StateControlHandle { inner: this.inner.clone() };
1499 Ok(StateRequest::Resolve {
1500 destination: req.destination,
1501
1502 responder: StateResolveResponder {
1503 control_handle: std::mem::ManuallyDrop::new(control_handle),
1504 tx_id: header.tx_id,
1505 },
1506 })
1507 }
1508 0x3a37608b6851f75c => {
1509 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1510 let mut req = fidl::new_empty!(
1511 StateResolve2Request,
1512 fidl::encoding::DefaultFuchsiaResourceDialect
1513 );
1514 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateResolve2Request>(&header, _body_bytes, handles, &mut req)?;
1515 let control_handle = StateControlHandle { inner: this.inner.clone() };
1516 Ok(StateRequest::Resolve2 {
1517 destination: req.destination,
1518 options: req.options,
1519
1520 responder: StateResolve2Responder {
1521 control_handle: std::mem::ManuallyDrop::new(control_handle),
1522 tx_id: header.tx_id,
1523 },
1524 })
1525 }
1526 0x6fed5423c7ce421a => {
1527 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1528 let mut req = fidl::new_empty!(
1529 StateGetRouteTableNameRequest,
1530 fidl::encoding::DefaultFuchsiaResourceDialect
1531 );
1532 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateGetRouteTableNameRequest>(&header, _body_bytes, handles, &mut req)?;
1533 let control_handle = StateControlHandle { inner: this.inner.clone() };
1534 Ok(StateRequest::GetRouteTableName {
1535 table_id: req.table_id,
1536
1537 responder: StateGetRouteTableNameResponder {
1538 control_handle: std::mem::ManuallyDrop::new(control_handle),
1539 tx_id: header.tx_id,
1540 },
1541 })
1542 }
1543 _ => Err(fidl::Error::UnknownOrdinal {
1544 ordinal: header.ordinal,
1545 protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1546 }),
1547 }))
1548 },
1549 )
1550 }
1551}
1552
1553#[derive(Debug)]
1555pub enum StateRequest {
1556 Resolve { destination: fidl_fuchsia_net::IpAddress, responder: StateResolveResponder },
1565 Resolve2 {
1575 destination: fidl_fuchsia_net::IpAddress,
1576 options: ResolveOptions,
1577 responder: StateResolve2Responder,
1578 },
1579 GetRouteTableName { table_id: u32, responder: StateGetRouteTableNameResponder },
1586}
1587
1588impl StateRequest {
1589 #[allow(irrefutable_let_patterns)]
1590 pub fn into_resolve(self) -> Option<(fidl_fuchsia_net::IpAddress, StateResolveResponder)> {
1591 if let StateRequest::Resolve { destination, responder } = self {
1592 Some((destination, responder))
1593 } else {
1594 None
1595 }
1596 }
1597
1598 #[allow(irrefutable_let_patterns)]
1599 pub fn into_resolve2(
1600 self,
1601 ) -> Option<(fidl_fuchsia_net::IpAddress, ResolveOptions, StateResolve2Responder)> {
1602 if let StateRequest::Resolve2 { destination, options, responder } = self {
1603 Some((destination, options, responder))
1604 } else {
1605 None
1606 }
1607 }
1608
1609 #[allow(irrefutable_let_patterns)]
1610 pub fn into_get_route_table_name(self) -> Option<(u32, StateGetRouteTableNameResponder)> {
1611 if let StateRequest::GetRouteTableName { table_id, responder } = self {
1612 Some((table_id, responder))
1613 } else {
1614 None
1615 }
1616 }
1617
1618 pub fn method_name(&self) -> &'static str {
1620 match *self {
1621 StateRequest::Resolve { .. } => "resolve",
1622 StateRequest::Resolve2 { .. } => "resolve2",
1623 StateRequest::GetRouteTableName { .. } => "get_route_table_name",
1624 }
1625 }
1626}
1627
1628#[derive(Debug, Clone)]
1629pub struct StateControlHandle {
1630 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1631}
1632
1633impl fidl::endpoints::ControlHandle for StateControlHandle {
1634 fn shutdown(&self) {
1635 self.inner.shutdown()
1636 }
1637
1638 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1639 self.inner.shutdown_with_epitaph(status)
1640 }
1641
1642 fn is_closed(&self) -> bool {
1643 self.inner.channel().is_closed()
1644 }
1645 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1646 self.inner.channel().on_closed()
1647 }
1648
1649 #[cfg(target_os = "fuchsia")]
1650 fn signal_peer(
1651 &self,
1652 clear_mask: zx::Signals,
1653 set_mask: zx::Signals,
1654 ) -> Result<(), zx_status::Status> {
1655 use fidl::Peered;
1656 self.inner.channel().signal_peer(clear_mask, set_mask)
1657 }
1658}
1659
1660impl StateControlHandle {}
1661
1662#[must_use = "FIDL methods require a response to be sent"]
1663#[derive(Debug)]
1664pub struct StateResolveResponder {
1665 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1666 tx_id: u32,
1667}
1668
1669impl std::ops::Drop for StateResolveResponder {
1673 fn drop(&mut self) {
1674 self.control_handle.shutdown();
1675 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1677 }
1678}
1679
1680impl fidl::endpoints::Responder for StateResolveResponder {
1681 type ControlHandle = StateControlHandle;
1682
1683 fn control_handle(&self) -> &StateControlHandle {
1684 &self.control_handle
1685 }
1686
1687 fn drop_without_shutdown(mut self) {
1688 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1690 std::mem::forget(self);
1692 }
1693}
1694
1695impl StateResolveResponder {
1696 pub fn send(self, mut result: Result<&Resolved, i32>) -> Result<(), fidl::Error> {
1700 let _result = self.send_raw(result);
1701 if _result.is_err() {
1702 self.control_handle.shutdown();
1703 }
1704 self.drop_without_shutdown();
1705 _result
1706 }
1707
1708 pub fn send_no_shutdown_on_err(
1710 self,
1711 mut result: Result<&Resolved, i32>,
1712 ) -> Result<(), fidl::Error> {
1713 let _result = self.send_raw(result);
1714 self.drop_without_shutdown();
1715 _result
1716 }
1717
1718 fn send_raw(&self, mut result: Result<&Resolved, i32>) -> Result<(), fidl::Error> {
1719 self.control_handle.inner.send::<fidl::encoding::ResultType<StateResolveResponse, i32>>(
1720 result.map(|result| (result,)),
1721 self.tx_id,
1722 0x1541bc37d2d1dfb0,
1723 fidl::encoding::DynamicFlags::empty(),
1724 )
1725 }
1726}
1727
1728#[must_use = "FIDL methods require a response to be sent"]
1729#[derive(Debug)]
1730pub struct StateResolve2Responder {
1731 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1732 tx_id: u32,
1733}
1734
1735impl std::ops::Drop for StateResolve2Responder {
1739 fn drop(&mut self) {
1740 self.control_handle.shutdown();
1741 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1743 }
1744}
1745
1746impl fidl::endpoints::Responder for StateResolve2Responder {
1747 type ControlHandle = StateControlHandle;
1748
1749 fn control_handle(&self) -> &StateControlHandle {
1750 &self.control_handle
1751 }
1752
1753 fn drop_without_shutdown(mut self) {
1754 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1756 std::mem::forget(self);
1758 }
1759}
1760
1761impl StateResolve2Responder {
1762 pub fn send(self, mut result: Result<&ResolveResult, ResolveError>) -> Result<(), fidl::Error> {
1766 let _result = self.send_raw(result);
1767 if _result.is_err() {
1768 self.control_handle.shutdown();
1769 }
1770 self.drop_without_shutdown();
1771 _result
1772 }
1773
1774 pub fn send_no_shutdown_on_err(
1776 self,
1777 mut result: Result<&ResolveResult, ResolveError>,
1778 ) -> Result<(), fidl::Error> {
1779 let _result = self.send_raw(result);
1780 self.drop_without_shutdown();
1781 _result
1782 }
1783
1784 fn send_raw(
1785 &self,
1786 mut result: Result<&ResolveResult, ResolveError>,
1787 ) -> Result<(), fidl::Error> {
1788 self.control_handle
1789 .inner
1790 .send::<fidl::encoding::ResultType<StateResolve2Response, ResolveError>>(
1791 result.map(|result| (result,)),
1792 self.tx_id,
1793 0x3a37608b6851f75c,
1794 fidl::encoding::DynamicFlags::empty(),
1795 )
1796 }
1797}
1798
1799#[must_use = "FIDL methods require a response to be sent"]
1800#[derive(Debug)]
1801pub struct StateGetRouteTableNameResponder {
1802 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1803 tx_id: u32,
1804}
1805
1806impl std::ops::Drop for StateGetRouteTableNameResponder {
1810 fn drop(&mut self) {
1811 self.control_handle.shutdown();
1812 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1814 }
1815}
1816
1817impl fidl::endpoints::Responder for StateGetRouteTableNameResponder {
1818 type ControlHandle = StateControlHandle;
1819
1820 fn control_handle(&self) -> &StateControlHandle {
1821 &self.control_handle
1822 }
1823
1824 fn drop_without_shutdown(mut self) {
1825 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1827 std::mem::forget(self);
1829 }
1830}
1831
1832impl StateGetRouteTableNameResponder {
1833 pub fn send(
1837 self,
1838 mut result: Result<&str, StateGetRouteTableNameError>,
1839 ) -> Result<(), fidl::Error> {
1840 let _result = self.send_raw(result);
1841 if _result.is_err() {
1842 self.control_handle.shutdown();
1843 }
1844 self.drop_without_shutdown();
1845 _result
1846 }
1847
1848 pub fn send_no_shutdown_on_err(
1850 self,
1851 mut result: Result<&str, StateGetRouteTableNameError>,
1852 ) -> Result<(), fidl::Error> {
1853 let _result = self.send_raw(result);
1854 self.drop_without_shutdown();
1855 _result
1856 }
1857
1858 fn send_raw(
1859 &self,
1860 mut result: Result<&str, StateGetRouteTableNameError>,
1861 ) -> Result<(), fidl::Error> {
1862 self.control_handle.inner.send::<fidl::encoding::ResultType<
1863 StateGetRouteTableNameResponse,
1864 StateGetRouteTableNameError,
1865 >>(
1866 result.map(|table_name| (table_name,)),
1867 self.tx_id,
1868 0x6fed5423c7ce421a,
1869 fidl::encoding::DynamicFlags::empty(),
1870 )
1871 }
1872}
1873
1874#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1875pub struct StateV4Marker;
1876
1877impl fidl::endpoints::ProtocolMarker for StateV4Marker {
1878 type Proxy = StateV4Proxy;
1879 type RequestStream = StateV4RequestStream;
1880 #[cfg(target_os = "fuchsia")]
1881 type SynchronousProxy = StateV4SynchronousProxy;
1882
1883 const DEBUG_NAME: &'static str = "fuchsia.net.routes.StateV4";
1884}
1885impl fidl::endpoints::DiscoverableProtocolMarker for StateV4Marker {}
1886
1887pub trait StateV4ProxyInterface: Send + Sync {
1888 fn r#get_watcher_v4(
1889 &self,
1890 watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
1891 options: &WatcherOptionsV4,
1892 ) -> Result<(), fidl::Error>;
1893 fn r#get_rule_watcher_v4(
1894 &self,
1895 watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
1896 options: &RuleWatcherOptionsV4,
1897 ) -> Result<(), fidl::Error>;
1898}
1899#[derive(Debug)]
1900#[cfg(target_os = "fuchsia")]
1901pub struct StateV4SynchronousProxy {
1902 client: fidl::client::sync::Client,
1903}
1904
1905#[cfg(target_os = "fuchsia")]
1906impl fidl::endpoints::SynchronousProxy for StateV4SynchronousProxy {
1907 type Proxy = StateV4Proxy;
1908 type Protocol = StateV4Marker;
1909
1910 fn from_channel(inner: fidl::Channel) -> Self {
1911 Self::new(inner)
1912 }
1913
1914 fn into_channel(self) -> fidl::Channel {
1915 self.client.into_channel()
1916 }
1917
1918 fn as_channel(&self) -> &fidl::Channel {
1919 self.client.as_channel()
1920 }
1921}
1922
1923#[cfg(target_os = "fuchsia")]
1924impl StateV4SynchronousProxy {
1925 pub fn new(channel: fidl::Channel) -> Self {
1926 Self { client: fidl::client::sync::Client::new(channel) }
1927 }
1928
1929 pub fn into_channel(self) -> fidl::Channel {
1930 self.client.into_channel()
1931 }
1932
1933 pub fn wait_for_event(
1936 &self,
1937 deadline: zx::MonotonicInstant,
1938 ) -> Result<StateV4Event, fidl::Error> {
1939 StateV4Event::decode(self.client.wait_for_event::<StateV4Marker>(deadline)?)
1940 }
1941
1942 pub fn r#get_watcher_v4(
1947 &self,
1948 mut watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
1949 mut options: &WatcherOptionsV4,
1950 ) -> Result<(), fidl::Error> {
1951 self.client.send::<StateV4GetWatcherV4Request>(
1952 (watcher, options),
1953 0x30dcbe770492c20a,
1954 fidl::encoding::DynamicFlags::empty(),
1955 )
1956 }
1957
1958 pub fn r#get_rule_watcher_v4(
1963 &self,
1964 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
1965 mut options: &RuleWatcherOptionsV4,
1966 ) -> Result<(), fidl::Error> {
1967 self.client.send::<StateV4GetRuleWatcherV4Request>(
1968 (watcher, options),
1969 0x2bbcc7012b5147a1,
1970 fidl::encoding::DynamicFlags::empty(),
1971 )
1972 }
1973}
1974
1975#[cfg(target_os = "fuchsia")]
1976impl From<StateV4SynchronousProxy> for zx::NullableHandle {
1977 fn from(value: StateV4SynchronousProxy) -> Self {
1978 value.into_channel().into()
1979 }
1980}
1981
1982#[cfg(target_os = "fuchsia")]
1983impl From<fidl::Channel> for StateV4SynchronousProxy {
1984 fn from(value: fidl::Channel) -> Self {
1985 Self::new(value)
1986 }
1987}
1988
1989#[cfg(target_os = "fuchsia")]
1990impl fidl::endpoints::FromClient for StateV4SynchronousProxy {
1991 type Protocol = StateV4Marker;
1992
1993 fn from_client(value: fidl::endpoints::ClientEnd<StateV4Marker>) -> Self {
1994 Self::new(value.into_channel())
1995 }
1996}
1997
1998#[derive(Debug, Clone)]
1999pub struct StateV4Proxy {
2000 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2001}
2002
2003impl fidl::endpoints::Proxy for StateV4Proxy {
2004 type Protocol = StateV4Marker;
2005
2006 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2007 Self::new(inner)
2008 }
2009
2010 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2011 self.client.into_channel().map_err(|client| Self { client })
2012 }
2013
2014 fn as_channel(&self) -> &::fidl::AsyncChannel {
2015 self.client.as_channel()
2016 }
2017}
2018
2019impl StateV4Proxy {
2020 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2022 let protocol_name = <StateV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2023 Self { client: fidl::client::Client::new(channel, protocol_name) }
2024 }
2025
2026 pub fn take_event_stream(&self) -> StateV4EventStream {
2032 StateV4EventStream { event_receiver: self.client.take_event_receiver() }
2033 }
2034
2035 pub fn r#get_watcher_v4(
2040 &self,
2041 mut watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
2042 mut options: &WatcherOptionsV4,
2043 ) -> Result<(), fidl::Error> {
2044 StateV4ProxyInterface::r#get_watcher_v4(self, watcher, options)
2045 }
2046
2047 pub fn r#get_rule_watcher_v4(
2052 &self,
2053 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
2054 mut options: &RuleWatcherOptionsV4,
2055 ) -> Result<(), fidl::Error> {
2056 StateV4ProxyInterface::r#get_rule_watcher_v4(self, watcher, options)
2057 }
2058}
2059
2060impl StateV4ProxyInterface for StateV4Proxy {
2061 fn r#get_watcher_v4(
2062 &self,
2063 mut watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
2064 mut options: &WatcherOptionsV4,
2065 ) -> Result<(), fidl::Error> {
2066 self.client.send::<StateV4GetWatcherV4Request>(
2067 (watcher, options),
2068 0x30dcbe770492c20a,
2069 fidl::encoding::DynamicFlags::empty(),
2070 )
2071 }
2072
2073 fn r#get_rule_watcher_v4(
2074 &self,
2075 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
2076 mut options: &RuleWatcherOptionsV4,
2077 ) -> Result<(), fidl::Error> {
2078 self.client.send::<StateV4GetRuleWatcherV4Request>(
2079 (watcher, options),
2080 0x2bbcc7012b5147a1,
2081 fidl::encoding::DynamicFlags::empty(),
2082 )
2083 }
2084}
2085
2086pub struct StateV4EventStream {
2087 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2088}
2089
2090impl std::marker::Unpin for StateV4EventStream {}
2091
2092impl futures::stream::FusedStream for StateV4EventStream {
2093 fn is_terminated(&self) -> bool {
2094 self.event_receiver.is_terminated()
2095 }
2096}
2097
2098impl futures::Stream for StateV4EventStream {
2099 type Item = Result<StateV4Event, fidl::Error>;
2100
2101 fn poll_next(
2102 mut self: std::pin::Pin<&mut Self>,
2103 cx: &mut std::task::Context<'_>,
2104 ) -> std::task::Poll<Option<Self::Item>> {
2105 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2106 &mut self.event_receiver,
2107 cx
2108 )?) {
2109 Some(buf) => std::task::Poll::Ready(Some(StateV4Event::decode(buf))),
2110 None => std::task::Poll::Ready(None),
2111 }
2112 }
2113}
2114
2115#[derive(Debug)]
2116pub enum StateV4Event {}
2117
2118impl StateV4Event {
2119 fn decode(
2121 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2122 ) -> Result<StateV4Event, fidl::Error> {
2123 let (bytes, _handles) = buf.split_mut();
2124 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2125 debug_assert_eq!(tx_header.tx_id, 0);
2126 match tx_header.ordinal {
2127 _ => Err(fidl::Error::UnknownOrdinal {
2128 ordinal: tx_header.ordinal,
2129 protocol_name: <StateV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2130 }),
2131 }
2132 }
2133}
2134
2135pub struct StateV4RequestStream {
2137 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2138 is_terminated: bool,
2139}
2140
2141impl std::marker::Unpin for StateV4RequestStream {}
2142
2143impl futures::stream::FusedStream for StateV4RequestStream {
2144 fn is_terminated(&self) -> bool {
2145 self.is_terminated
2146 }
2147}
2148
2149impl fidl::endpoints::RequestStream for StateV4RequestStream {
2150 type Protocol = StateV4Marker;
2151 type ControlHandle = StateV4ControlHandle;
2152
2153 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2154 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2155 }
2156
2157 fn control_handle(&self) -> Self::ControlHandle {
2158 StateV4ControlHandle { inner: self.inner.clone() }
2159 }
2160
2161 fn into_inner(
2162 self,
2163 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2164 {
2165 (self.inner, self.is_terminated)
2166 }
2167
2168 fn from_inner(
2169 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2170 is_terminated: bool,
2171 ) -> Self {
2172 Self { inner, is_terminated }
2173 }
2174}
2175
2176impl futures::Stream for StateV4RequestStream {
2177 type Item = Result<StateV4Request, fidl::Error>;
2178
2179 fn poll_next(
2180 mut self: std::pin::Pin<&mut Self>,
2181 cx: &mut std::task::Context<'_>,
2182 ) -> std::task::Poll<Option<Self::Item>> {
2183 let this = &mut *self;
2184 if this.inner.check_shutdown(cx) {
2185 this.is_terminated = true;
2186 return std::task::Poll::Ready(None);
2187 }
2188 if this.is_terminated {
2189 panic!("polled StateV4RequestStream after completion");
2190 }
2191 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2192 |bytes, handles| {
2193 match this.inner.channel().read_etc(cx, bytes, handles) {
2194 std::task::Poll::Ready(Ok(())) => {}
2195 std::task::Poll::Pending => return std::task::Poll::Pending,
2196 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2197 this.is_terminated = true;
2198 return std::task::Poll::Ready(None);
2199 }
2200 std::task::Poll::Ready(Err(e)) => {
2201 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2202 e.into(),
2203 ))));
2204 }
2205 }
2206
2207 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2209
2210 std::task::Poll::Ready(Some(match header.ordinal {
2211 0x30dcbe770492c20a => {
2212 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2213 let mut req = fidl::new_empty!(
2214 StateV4GetWatcherV4Request,
2215 fidl::encoding::DefaultFuchsiaResourceDialect
2216 );
2217 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateV4GetWatcherV4Request>(&header, _body_bytes, handles, &mut req)?;
2218 let control_handle = StateV4ControlHandle { inner: this.inner.clone() };
2219 Ok(StateV4Request::GetWatcherV4 {
2220 watcher: req.watcher,
2221 options: req.options,
2222
2223 control_handle,
2224 })
2225 }
2226 0x2bbcc7012b5147a1 => {
2227 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2228 let mut req = fidl::new_empty!(
2229 StateV4GetRuleWatcherV4Request,
2230 fidl::encoding::DefaultFuchsiaResourceDialect
2231 );
2232 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateV4GetRuleWatcherV4Request>(&header, _body_bytes, handles, &mut req)?;
2233 let control_handle = StateV4ControlHandle { inner: this.inner.clone() };
2234 Ok(StateV4Request::GetRuleWatcherV4 {
2235 watcher: req.watcher,
2236 options: req.options,
2237
2238 control_handle,
2239 })
2240 }
2241 _ => Err(fidl::Error::UnknownOrdinal {
2242 ordinal: header.ordinal,
2243 protocol_name:
2244 <StateV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2245 }),
2246 }))
2247 },
2248 )
2249 }
2250}
2251
2252#[derive(Debug)]
2254pub enum StateV4Request {
2255 GetWatcherV4 {
2260 watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
2261 options: WatcherOptionsV4,
2262 control_handle: StateV4ControlHandle,
2263 },
2264 GetRuleWatcherV4 {
2269 watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
2270 options: RuleWatcherOptionsV4,
2271 control_handle: StateV4ControlHandle,
2272 },
2273}
2274
2275impl StateV4Request {
2276 #[allow(irrefutable_let_patterns)]
2277 pub fn into_get_watcher_v4(
2278 self,
2279 ) -> Option<(fidl::endpoints::ServerEnd<WatcherV4Marker>, WatcherOptionsV4, StateV4ControlHandle)>
2280 {
2281 if let StateV4Request::GetWatcherV4 { watcher, options, control_handle } = self {
2282 Some((watcher, options, control_handle))
2283 } else {
2284 None
2285 }
2286 }
2287
2288 #[allow(irrefutable_let_patterns)]
2289 pub fn into_get_rule_watcher_v4(
2290 self,
2291 ) -> Option<(
2292 fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
2293 RuleWatcherOptionsV4,
2294 StateV4ControlHandle,
2295 )> {
2296 if let StateV4Request::GetRuleWatcherV4 { watcher, options, control_handle } = self {
2297 Some((watcher, options, control_handle))
2298 } else {
2299 None
2300 }
2301 }
2302
2303 pub fn method_name(&self) -> &'static str {
2305 match *self {
2306 StateV4Request::GetWatcherV4 { .. } => "get_watcher_v4",
2307 StateV4Request::GetRuleWatcherV4 { .. } => "get_rule_watcher_v4",
2308 }
2309 }
2310}
2311
2312#[derive(Debug, Clone)]
2313pub struct StateV4ControlHandle {
2314 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2315}
2316
2317impl fidl::endpoints::ControlHandle for StateV4ControlHandle {
2318 fn shutdown(&self) {
2319 self.inner.shutdown()
2320 }
2321
2322 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2323 self.inner.shutdown_with_epitaph(status)
2324 }
2325
2326 fn is_closed(&self) -> bool {
2327 self.inner.channel().is_closed()
2328 }
2329 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2330 self.inner.channel().on_closed()
2331 }
2332
2333 #[cfg(target_os = "fuchsia")]
2334 fn signal_peer(
2335 &self,
2336 clear_mask: zx::Signals,
2337 set_mask: zx::Signals,
2338 ) -> Result<(), zx_status::Status> {
2339 use fidl::Peered;
2340 self.inner.channel().signal_peer(clear_mask, set_mask)
2341 }
2342}
2343
2344impl StateV4ControlHandle {}
2345
2346#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2347pub struct StateV6Marker;
2348
2349impl fidl::endpoints::ProtocolMarker for StateV6Marker {
2350 type Proxy = StateV6Proxy;
2351 type RequestStream = StateV6RequestStream;
2352 #[cfg(target_os = "fuchsia")]
2353 type SynchronousProxy = StateV6SynchronousProxy;
2354
2355 const DEBUG_NAME: &'static str = "fuchsia.net.routes.StateV6";
2356}
2357impl fidl::endpoints::DiscoverableProtocolMarker for StateV6Marker {}
2358
2359pub trait StateV6ProxyInterface: Send + Sync {
2360 fn r#get_watcher_v6(
2361 &self,
2362 watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2363 options: &WatcherOptionsV6,
2364 ) -> Result<(), fidl::Error>;
2365 fn r#get_rule_watcher_v6(
2366 &self,
2367 watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2368 options: &RuleWatcherOptionsV6,
2369 ) -> Result<(), fidl::Error>;
2370}
2371#[derive(Debug)]
2372#[cfg(target_os = "fuchsia")]
2373pub struct StateV6SynchronousProxy {
2374 client: fidl::client::sync::Client,
2375}
2376
2377#[cfg(target_os = "fuchsia")]
2378impl fidl::endpoints::SynchronousProxy for StateV6SynchronousProxy {
2379 type Proxy = StateV6Proxy;
2380 type Protocol = StateV6Marker;
2381
2382 fn from_channel(inner: fidl::Channel) -> Self {
2383 Self::new(inner)
2384 }
2385
2386 fn into_channel(self) -> fidl::Channel {
2387 self.client.into_channel()
2388 }
2389
2390 fn as_channel(&self) -> &fidl::Channel {
2391 self.client.as_channel()
2392 }
2393}
2394
2395#[cfg(target_os = "fuchsia")]
2396impl StateV6SynchronousProxy {
2397 pub fn new(channel: fidl::Channel) -> Self {
2398 Self { client: fidl::client::sync::Client::new(channel) }
2399 }
2400
2401 pub fn into_channel(self) -> fidl::Channel {
2402 self.client.into_channel()
2403 }
2404
2405 pub fn wait_for_event(
2408 &self,
2409 deadline: zx::MonotonicInstant,
2410 ) -> Result<StateV6Event, fidl::Error> {
2411 StateV6Event::decode(self.client.wait_for_event::<StateV6Marker>(deadline)?)
2412 }
2413
2414 pub fn r#get_watcher_v6(
2419 &self,
2420 mut watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2421 mut options: &WatcherOptionsV6,
2422 ) -> Result<(), fidl::Error> {
2423 self.client.send::<StateV6GetWatcherV6Request>(
2424 (watcher, options),
2425 0x777e3c40c98f586,
2426 fidl::encoding::DynamicFlags::empty(),
2427 )
2428 }
2429
2430 pub fn r#get_rule_watcher_v6(
2435 &self,
2436 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2437 mut options: &RuleWatcherOptionsV6,
2438 ) -> Result<(), fidl::Error> {
2439 self.client.send::<StateV6GetRuleWatcherV6Request>(
2440 (watcher, options),
2441 0x91433a23d464f6,
2442 fidl::encoding::DynamicFlags::empty(),
2443 )
2444 }
2445}
2446
2447#[cfg(target_os = "fuchsia")]
2448impl From<StateV6SynchronousProxy> for zx::NullableHandle {
2449 fn from(value: StateV6SynchronousProxy) -> Self {
2450 value.into_channel().into()
2451 }
2452}
2453
2454#[cfg(target_os = "fuchsia")]
2455impl From<fidl::Channel> for StateV6SynchronousProxy {
2456 fn from(value: fidl::Channel) -> Self {
2457 Self::new(value)
2458 }
2459}
2460
2461#[cfg(target_os = "fuchsia")]
2462impl fidl::endpoints::FromClient for StateV6SynchronousProxy {
2463 type Protocol = StateV6Marker;
2464
2465 fn from_client(value: fidl::endpoints::ClientEnd<StateV6Marker>) -> Self {
2466 Self::new(value.into_channel())
2467 }
2468}
2469
2470#[derive(Debug, Clone)]
2471pub struct StateV6Proxy {
2472 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2473}
2474
2475impl fidl::endpoints::Proxy for StateV6Proxy {
2476 type Protocol = StateV6Marker;
2477
2478 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2479 Self::new(inner)
2480 }
2481
2482 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2483 self.client.into_channel().map_err(|client| Self { client })
2484 }
2485
2486 fn as_channel(&self) -> &::fidl::AsyncChannel {
2487 self.client.as_channel()
2488 }
2489}
2490
2491impl StateV6Proxy {
2492 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2494 let protocol_name = <StateV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2495 Self { client: fidl::client::Client::new(channel, protocol_name) }
2496 }
2497
2498 pub fn take_event_stream(&self) -> StateV6EventStream {
2504 StateV6EventStream { event_receiver: self.client.take_event_receiver() }
2505 }
2506
2507 pub fn r#get_watcher_v6(
2512 &self,
2513 mut watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2514 mut options: &WatcherOptionsV6,
2515 ) -> Result<(), fidl::Error> {
2516 StateV6ProxyInterface::r#get_watcher_v6(self, watcher, options)
2517 }
2518
2519 pub fn r#get_rule_watcher_v6(
2524 &self,
2525 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2526 mut options: &RuleWatcherOptionsV6,
2527 ) -> Result<(), fidl::Error> {
2528 StateV6ProxyInterface::r#get_rule_watcher_v6(self, watcher, options)
2529 }
2530}
2531
2532impl StateV6ProxyInterface for StateV6Proxy {
2533 fn r#get_watcher_v6(
2534 &self,
2535 mut watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2536 mut options: &WatcherOptionsV6,
2537 ) -> Result<(), fidl::Error> {
2538 self.client.send::<StateV6GetWatcherV6Request>(
2539 (watcher, options),
2540 0x777e3c40c98f586,
2541 fidl::encoding::DynamicFlags::empty(),
2542 )
2543 }
2544
2545 fn r#get_rule_watcher_v6(
2546 &self,
2547 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2548 mut options: &RuleWatcherOptionsV6,
2549 ) -> Result<(), fidl::Error> {
2550 self.client.send::<StateV6GetRuleWatcherV6Request>(
2551 (watcher, options),
2552 0x91433a23d464f6,
2553 fidl::encoding::DynamicFlags::empty(),
2554 )
2555 }
2556}
2557
2558pub struct StateV6EventStream {
2559 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2560}
2561
2562impl std::marker::Unpin for StateV6EventStream {}
2563
2564impl futures::stream::FusedStream for StateV6EventStream {
2565 fn is_terminated(&self) -> bool {
2566 self.event_receiver.is_terminated()
2567 }
2568}
2569
2570impl futures::Stream for StateV6EventStream {
2571 type Item = Result<StateV6Event, fidl::Error>;
2572
2573 fn poll_next(
2574 mut self: std::pin::Pin<&mut Self>,
2575 cx: &mut std::task::Context<'_>,
2576 ) -> std::task::Poll<Option<Self::Item>> {
2577 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2578 &mut self.event_receiver,
2579 cx
2580 )?) {
2581 Some(buf) => std::task::Poll::Ready(Some(StateV6Event::decode(buf))),
2582 None => std::task::Poll::Ready(None),
2583 }
2584 }
2585}
2586
2587#[derive(Debug)]
2588pub enum StateV6Event {}
2589
2590impl StateV6Event {
2591 fn decode(
2593 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2594 ) -> Result<StateV6Event, fidl::Error> {
2595 let (bytes, _handles) = buf.split_mut();
2596 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2597 debug_assert_eq!(tx_header.tx_id, 0);
2598 match tx_header.ordinal {
2599 _ => Err(fidl::Error::UnknownOrdinal {
2600 ordinal: tx_header.ordinal,
2601 protocol_name: <StateV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2602 }),
2603 }
2604 }
2605}
2606
2607pub struct StateV6RequestStream {
2609 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2610 is_terminated: bool,
2611}
2612
2613impl std::marker::Unpin for StateV6RequestStream {}
2614
2615impl futures::stream::FusedStream for StateV6RequestStream {
2616 fn is_terminated(&self) -> bool {
2617 self.is_terminated
2618 }
2619}
2620
2621impl fidl::endpoints::RequestStream for StateV6RequestStream {
2622 type Protocol = StateV6Marker;
2623 type ControlHandle = StateV6ControlHandle;
2624
2625 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2626 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2627 }
2628
2629 fn control_handle(&self) -> Self::ControlHandle {
2630 StateV6ControlHandle { inner: self.inner.clone() }
2631 }
2632
2633 fn into_inner(
2634 self,
2635 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2636 {
2637 (self.inner, self.is_terminated)
2638 }
2639
2640 fn from_inner(
2641 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2642 is_terminated: bool,
2643 ) -> Self {
2644 Self { inner, is_terminated }
2645 }
2646}
2647
2648impl futures::Stream for StateV6RequestStream {
2649 type Item = Result<StateV6Request, fidl::Error>;
2650
2651 fn poll_next(
2652 mut self: std::pin::Pin<&mut Self>,
2653 cx: &mut std::task::Context<'_>,
2654 ) -> std::task::Poll<Option<Self::Item>> {
2655 let this = &mut *self;
2656 if this.inner.check_shutdown(cx) {
2657 this.is_terminated = true;
2658 return std::task::Poll::Ready(None);
2659 }
2660 if this.is_terminated {
2661 panic!("polled StateV6RequestStream after completion");
2662 }
2663 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2664 |bytes, handles| {
2665 match this.inner.channel().read_etc(cx, bytes, handles) {
2666 std::task::Poll::Ready(Ok(())) => {}
2667 std::task::Poll::Pending => return std::task::Poll::Pending,
2668 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2669 this.is_terminated = true;
2670 return std::task::Poll::Ready(None);
2671 }
2672 std::task::Poll::Ready(Err(e)) => {
2673 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2674 e.into(),
2675 ))));
2676 }
2677 }
2678
2679 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2681
2682 std::task::Poll::Ready(Some(match header.ordinal {
2683 0x777e3c40c98f586 => {
2684 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2685 let mut req = fidl::new_empty!(
2686 StateV6GetWatcherV6Request,
2687 fidl::encoding::DefaultFuchsiaResourceDialect
2688 );
2689 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateV6GetWatcherV6Request>(&header, _body_bytes, handles, &mut req)?;
2690 let control_handle = StateV6ControlHandle { inner: this.inner.clone() };
2691 Ok(StateV6Request::GetWatcherV6 {
2692 watcher: req.watcher,
2693 options: req.options,
2694
2695 control_handle,
2696 })
2697 }
2698 0x91433a23d464f6 => {
2699 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2700 let mut req = fidl::new_empty!(
2701 StateV6GetRuleWatcherV6Request,
2702 fidl::encoding::DefaultFuchsiaResourceDialect
2703 );
2704 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateV6GetRuleWatcherV6Request>(&header, _body_bytes, handles, &mut req)?;
2705 let control_handle = StateV6ControlHandle { inner: this.inner.clone() };
2706 Ok(StateV6Request::GetRuleWatcherV6 {
2707 watcher: req.watcher,
2708 options: req.options,
2709
2710 control_handle,
2711 })
2712 }
2713 _ => Err(fidl::Error::UnknownOrdinal {
2714 ordinal: header.ordinal,
2715 protocol_name:
2716 <StateV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2717 }),
2718 }))
2719 },
2720 )
2721 }
2722}
2723
2724#[derive(Debug)]
2726pub enum StateV6Request {
2727 GetWatcherV6 {
2732 watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2733 options: WatcherOptionsV6,
2734 control_handle: StateV6ControlHandle,
2735 },
2736 GetRuleWatcherV6 {
2741 watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2742 options: RuleWatcherOptionsV6,
2743 control_handle: StateV6ControlHandle,
2744 },
2745}
2746
2747impl StateV6Request {
2748 #[allow(irrefutable_let_patterns)]
2749 pub fn into_get_watcher_v6(
2750 self,
2751 ) -> Option<(fidl::endpoints::ServerEnd<WatcherV6Marker>, WatcherOptionsV6, StateV6ControlHandle)>
2752 {
2753 if let StateV6Request::GetWatcherV6 { watcher, options, control_handle } = self {
2754 Some((watcher, options, control_handle))
2755 } else {
2756 None
2757 }
2758 }
2759
2760 #[allow(irrefutable_let_patterns)]
2761 pub fn into_get_rule_watcher_v6(
2762 self,
2763 ) -> Option<(
2764 fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2765 RuleWatcherOptionsV6,
2766 StateV6ControlHandle,
2767 )> {
2768 if let StateV6Request::GetRuleWatcherV6 { watcher, options, control_handle } = self {
2769 Some((watcher, options, control_handle))
2770 } else {
2771 None
2772 }
2773 }
2774
2775 pub fn method_name(&self) -> &'static str {
2777 match *self {
2778 StateV6Request::GetWatcherV6 { .. } => "get_watcher_v6",
2779 StateV6Request::GetRuleWatcherV6 { .. } => "get_rule_watcher_v6",
2780 }
2781 }
2782}
2783
2784#[derive(Debug, Clone)]
2785pub struct StateV6ControlHandle {
2786 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2787}
2788
2789impl fidl::endpoints::ControlHandle for StateV6ControlHandle {
2790 fn shutdown(&self) {
2791 self.inner.shutdown()
2792 }
2793
2794 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2795 self.inner.shutdown_with_epitaph(status)
2796 }
2797
2798 fn is_closed(&self) -> bool {
2799 self.inner.channel().is_closed()
2800 }
2801 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2802 self.inner.channel().on_closed()
2803 }
2804
2805 #[cfg(target_os = "fuchsia")]
2806 fn signal_peer(
2807 &self,
2808 clear_mask: zx::Signals,
2809 set_mask: zx::Signals,
2810 ) -> Result<(), zx_status::Status> {
2811 use fidl::Peered;
2812 self.inner.channel().signal_peer(clear_mask, set_mask)
2813 }
2814}
2815
2816impl StateV6ControlHandle {}
2817
2818#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2819pub struct WatcherV4Marker;
2820
2821impl fidl::endpoints::ProtocolMarker for WatcherV4Marker {
2822 type Proxy = WatcherV4Proxy;
2823 type RequestStream = WatcherV4RequestStream;
2824 #[cfg(target_os = "fuchsia")]
2825 type SynchronousProxy = WatcherV4SynchronousProxy;
2826
2827 const DEBUG_NAME: &'static str = "(anonymous) WatcherV4";
2828}
2829
2830pub trait WatcherV4ProxyInterface: Send + Sync {
2831 type WatchResponseFut: std::future::Future<Output = Result<Vec<EventV4>, fidl::Error>> + Send;
2832 fn r#watch(&self) -> Self::WatchResponseFut;
2833}
2834#[derive(Debug)]
2835#[cfg(target_os = "fuchsia")]
2836pub struct WatcherV4SynchronousProxy {
2837 client: fidl::client::sync::Client,
2838}
2839
2840#[cfg(target_os = "fuchsia")]
2841impl fidl::endpoints::SynchronousProxy for WatcherV4SynchronousProxy {
2842 type Proxy = WatcherV4Proxy;
2843 type Protocol = WatcherV4Marker;
2844
2845 fn from_channel(inner: fidl::Channel) -> Self {
2846 Self::new(inner)
2847 }
2848
2849 fn into_channel(self) -> fidl::Channel {
2850 self.client.into_channel()
2851 }
2852
2853 fn as_channel(&self) -> &fidl::Channel {
2854 self.client.as_channel()
2855 }
2856}
2857
2858#[cfg(target_os = "fuchsia")]
2859impl WatcherV4SynchronousProxy {
2860 pub fn new(channel: fidl::Channel) -> Self {
2861 Self { client: fidl::client::sync::Client::new(channel) }
2862 }
2863
2864 pub fn into_channel(self) -> fidl::Channel {
2865 self.client.into_channel()
2866 }
2867
2868 pub fn wait_for_event(
2871 &self,
2872 deadline: zx::MonotonicInstant,
2873 ) -> Result<WatcherV4Event, fidl::Error> {
2874 WatcherV4Event::decode(self.client.wait_for_event::<WatcherV4Marker>(deadline)?)
2875 }
2876
2877 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<EventV4>, fidl::Error> {
2898 let _response = self
2899 .client
2900 .send_query::<fidl::encoding::EmptyPayload, WatcherV4WatchResponse, WatcherV4Marker>(
2901 (),
2902 0x71f2fdee0b307ac2,
2903 fidl::encoding::DynamicFlags::empty(),
2904 ___deadline,
2905 )?;
2906 Ok(_response.events)
2907 }
2908}
2909
2910#[cfg(target_os = "fuchsia")]
2911impl From<WatcherV4SynchronousProxy> for zx::NullableHandle {
2912 fn from(value: WatcherV4SynchronousProxy) -> Self {
2913 value.into_channel().into()
2914 }
2915}
2916
2917#[cfg(target_os = "fuchsia")]
2918impl From<fidl::Channel> for WatcherV4SynchronousProxy {
2919 fn from(value: fidl::Channel) -> Self {
2920 Self::new(value)
2921 }
2922}
2923
2924#[cfg(target_os = "fuchsia")]
2925impl fidl::endpoints::FromClient for WatcherV4SynchronousProxy {
2926 type Protocol = WatcherV4Marker;
2927
2928 fn from_client(value: fidl::endpoints::ClientEnd<WatcherV4Marker>) -> Self {
2929 Self::new(value.into_channel())
2930 }
2931}
2932
2933#[derive(Debug, Clone)]
2934pub struct WatcherV4Proxy {
2935 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2936}
2937
2938impl fidl::endpoints::Proxy for WatcherV4Proxy {
2939 type Protocol = WatcherV4Marker;
2940
2941 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2942 Self::new(inner)
2943 }
2944
2945 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2946 self.client.into_channel().map_err(|client| Self { client })
2947 }
2948
2949 fn as_channel(&self) -> &::fidl::AsyncChannel {
2950 self.client.as_channel()
2951 }
2952}
2953
2954impl WatcherV4Proxy {
2955 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2957 let protocol_name = <WatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2958 Self { client: fidl::client::Client::new(channel, protocol_name) }
2959 }
2960
2961 pub fn take_event_stream(&self) -> WatcherV4EventStream {
2967 WatcherV4EventStream { event_receiver: self.client.take_event_receiver() }
2968 }
2969
2970 pub fn r#watch(
2991 &self,
2992 ) -> fidl::client::QueryResponseFut<Vec<EventV4>, fidl::encoding::DefaultFuchsiaResourceDialect>
2993 {
2994 WatcherV4ProxyInterface::r#watch(self)
2995 }
2996}
2997
2998impl WatcherV4ProxyInterface for WatcherV4Proxy {
2999 type WatchResponseFut =
3000 fidl::client::QueryResponseFut<Vec<EventV4>, fidl::encoding::DefaultFuchsiaResourceDialect>;
3001 fn r#watch(&self) -> Self::WatchResponseFut {
3002 fn _decode(
3003 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3004 ) -> Result<Vec<EventV4>, fidl::Error> {
3005 let _response = fidl::client::decode_transaction_body::<
3006 WatcherV4WatchResponse,
3007 fidl::encoding::DefaultFuchsiaResourceDialect,
3008 0x71f2fdee0b307ac2,
3009 >(_buf?)?;
3010 Ok(_response.events)
3011 }
3012 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EventV4>>(
3013 (),
3014 0x71f2fdee0b307ac2,
3015 fidl::encoding::DynamicFlags::empty(),
3016 _decode,
3017 )
3018 }
3019}
3020
3021pub struct WatcherV4EventStream {
3022 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3023}
3024
3025impl std::marker::Unpin for WatcherV4EventStream {}
3026
3027impl futures::stream::FusedStream for WatcherV4EventStream {
3028 fn is_terminated(&self) -> bool {
3029 self.event_receiver.is_terminated()
3030 }
3031}
3032
3033impl futures::Stream for WatcherV4EventStream {
3034 type Item = Result<WatcherV4Event, fidl::Error>;
3035
3036 fn poll_next(
3037 mut self: std::pin::Pin<&mut Self>,
3038 cx: &mut std::task::Context<'_>,
3039 ) -> std::task::Poll<Option<Self::Item>> {
3040 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3041 &mut self.event_receiver,
3042 cx
3043 )?) {
3044 Some(buf) => std::task::Poll::Ready(Some(WatcherV4Event::decode(buf))),
3045 None => std::task::Poll::Ready(None),
3046 }
3047 }
3048}
3049
3050#[derive(Debug)]
3051pub enum WatcherV4Event {}
3052
3053impl WatcherV4Event {
3054 fn decode(
3056 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3057 ) -> Result<WatcherV4Event, fidl::Error> {
3058 let (bytes, _handles) = buf.split_mut();
3059 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3060 debug_assert_eq!(tx_header.tx_id, 0);
3061 match tx_header.ordinal {
3062 _ => Err(fidl::Error::UnknownOrdinal {
3063 ordinal: tx_header.ordinal,
3064 protocol_name: <WatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3065 }),
3066 }
3067 }
3068}
3069
3070pub struct WatcherV4RequestStream {
3072 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3073 is_terminated: bool,
3074}
3075
3076impl std::marker::Unpin for WatcherV4RequestStream {}
3077
3078impl futures::stream::FusedStream for WatcherV4RequestStream {
3079 fn is_terminated(&self) -> bool {
3080 self.is_terminated
3081 }
3082}
3083
3084impl fidl::endpoints::RequestStream for WatcherV4RequestStream {
3085 type Protocol = WatcherV4Marker;
3086 type ControlHandle = WatcherV4ControlHandle;
3087
3088 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3089 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3090 }
3091
3092 fn control_handle(&self) -> Self::ControlHandle {
3093 WatcherV4ControlHandle { inner: self.inner.clone() }
3094 }
3095
3096 fn into_inner(
3097 self,
3098 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3099 {
3100 (self.inner, self.is_terminated)
3101 }
3102
3103 fn from_inner(
3104 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3105 is_terminated: bool,
3106 ) -> Self {
3107 Self { inner, is_terminated }
3108 }
3109}
3110
3111impl futures::Stream for WatcherV4RequestStream {
3112 type Item = Result<WatcherV4Request, fidl::Error>;
3113
3114 fn poll_next(
3115 mut self: std::pin::Pin<&mut Self>,
3116 cx: &mut std::task::Context<'_>,
3117 ) -> std::task::Poll<Option<Self::Item>> {
3118 let this = &mut *self;
3119 if this.inner.check_shutdown(cx) {
3120 this.is_terminated = true;
3121 return std::task::Poll::Ready(None);
3122 }
3123 if this.is_terminated {
3124 panic!("polled WatcherV4RequestStream after completion");
3125 }
3126 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3127 |bytes, handles| {
3128 match this.inner.channel().read_etc(cx, bytes, handles) {
3129 std::task::Poll::Ready(Ok(())) => {}
3130 std::task::Poll::Pending => return std::task::Poll::Pending,
3131 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3132 this.is_terminated = true;
3133 return std::task::Poll::Ready(None);
3134 }
3135 std::task::Poll::Ready(Err(e)) => {
3136 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3137 e.into(),
3138 ))));
3139 }
3140 }
3141
3142 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3144
3145 std::task::Poll::Ready(Some(match header.ordinal {
3146 0x71f2fdee0b307ac2 => {
3147 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3148 let mut req = fidl::new_empty!(
3149 fidl::encoding::EmptyPayload,
3150 fidl::encoding::DefaultFuchsiaResourceDialect
3151 );
3152 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3153 let control_handle = WatcherV4ControlHandle { inner: this.inner.clone() };
3154 Ok(WatcherV4Request::Watch {
3155 responder: WatcherV4WatchResponder {
3156 control_handle: std::mem::ManuallyDrop::new(control_handle),
3157 tx_id: header.tx_id,
3158 },
3159 })
3160 }
3161 _ => Err(fidl::Error::UnknownOrdinal {
3162 ordinal: header.ordinal,
3163 protocol_name:
3164 <WatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3165 }),
3166 }))
3167 },
3168 )
3169 }
3170}
3171
3172#[derive(Debug)]
3174pub enum WatcherV4Request {
3175 Watch { responder: WatcherV4WatchResponder },
3196}
3197
3198impl WatcherV4Request {
3199 #[allow(irrefutable_let_patterns)]
3200 pub fn into_watch(self) -> Option<(WatcherV4WatchResponder)> {
3201 if let WatcherV4Request::Watch { responder } = self { Some((responder)) } else { None }
3202 }
3203
3204 pub fn method_name(&self) -> &'static str {
3206 match *self {
3207 WatcherV4Request::Watch { .. } => "watch",
3208 }
3209 }
3210}
3211
3212#[derive(Debug, Clone)]
3213pub struct WatcherV4ControlHandle {
3214 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3215}
3216
3217impl fidl::endpoints::ControlHandle for WatcherV4ControlHandle {
3218 fn shutdown(&self) {
3219 self.inner.shutdown()
3220 }
3221
3222 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3223 self.inner.shutdown_with_epitaph(status)
3224 }
3225
3226 fn is_closed(&self) -> bool {
3227 self.inner.channel().is_closed()
3228 }
3229 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3230 self.inner.channel().on_closed()
3231 }
3232
3233 #[cfg(target_os = "fuchsia")]
3234 fn signal_peer(
3235 &self,
3236 clear_mask: zx::Signals,
3237 set_mask: zx::Signals,
3238 ) -> Result<(), zx_status::Status> {
3239 use fidl::Peered;
3240 self.inner.channel().signal_peer(clear_mask, set_mask)
3241 }
3242}
3243
3244impl WatcherV4ControlHandle {}
3245
3246#[must_use = "FIDL methods require a response to be sent"]
3247#[derive(Debug)]
3248pub struct WatcherV4WatchResponder {
3249 control_handle: std::mem::ManuallyDrop<WatcherV4ControlHandle>,
3250 tx_id: u32,
3251}
3252
3253impl std::ops::Drop for WatcherV4WatchResponder {
3257 fn drop(&mut self) {
3258 self.control_handle.shutdown();
3259 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3261 }
3262}
3263
3264impl fidl::endpoints::Responder for WatcherV4WatchResponder {
3265 type ControlHandle = WatcherV4ControlHandle;
3266
3267 fn control_handle(&self) -> &WatcherV4ControlHandle {
3268 &self.control_handle
3269 }
3270
3271 fn drop_without_shutdown(mut self) {
3272 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3274 std::mem::forget(self);
3276 }
3277}
3278
3279impl WatcherV4WatchResponder {
3280 pub fn send(self, mut events: &[EventV4]) -> Result<(), fidl::Error> {
3284 let _result = self.send_raw(events);
3285 if _result.is_err() {
3286 self.control_handle.shutdown();
3287 }
3288 self.drop_without_shutdown();
3289 _result
3290 }
3291
3292 pub fn send_no_shutdown_on_err(self, mut events: &[EventV4]) -> Result<(), fidl::Error> {
3294 let _result = self.send_raw(events);
3295 self.drop_without_shutdown();
3296 _result
3297 }
3298
3299 fn send_raw(&self, mut events: &[EventV4]) -> Result<(), fidl::Error> {
3300 self.control_handle.inner.send::<WatcherV4WatchResponse>(
3301 (events,),
3302 self.tx_id,
3303 0x71f2fdee0b307ac2,
3304 fidl::encoding::DynamicFlags::empty(),
3305 )
3306 }
3307}
3308
3309#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3310pub struct WatcherV6Marker;
3311
3312impl fidl::endpoints::ProtocolMarker for WatcherV6Marker {
3313 type Proxy = WatcherV6Proxy;
3314 type RequestStream = WatcherV6RequestStream;
3315 #[cfg(target_os = "fuchsia")]
3316 type SynchronousProxy = WatcherV6SynchronousProxy;
3317
3318 const DEBUG_NAME: &'static str = "(anonymous) WatcherV6";
3319}
3320
3321pub trait WatcherV6ProxyInterface: Send + Sync {
3322 type WatchResponseFut: std::future::Future<Output = Result<Vec<EventV6>, fidl::Error>> + Send;
3323 fn r#watch(&self) -> Self::WatchResponseFut;
3324}
3325#[derive(Debug)]
3326#[cfg(target_os = "fuchsia")]
3327pub struct WatcherV6SynchronousProxy {
3328 client: fidl::client::sync::Client,
3329}
3330
3331#[cfg(target_os = "fuchsia")]
3332impl fidl::endpoints::SynchronousProxy for WatcherV6SynchronousProxy {
3333 type Proxy = WatcherV6Proxy;
3334 type Protocol = WatcherV6Marker;
3335
3336 fn from_channel(inner: fidl::Channel) -> Self {
3337 Self::new(inner)
3338 }
3339
3340 fn into_channel(self) -> fidl::Channel {
3341 self.client.into_channel()
3342 }
3343
3344 fn as_channel(&self) -> &fidl::Channel {
3345 self.client.as_channel()
3346 }
3347}
3348
3349#[cfg(target_os = "fuchsia")]
3350impl WatcherV6SynchronousProxy {
3351 pub fn new(channel: fidl::Channel) -> Self {
3352 Self { client: fidl::client::sync::Client::new(channel) }
3353 }
3354
3355 pub fn into_channel(self) -> fidl::Channel {
3356 self.client.into_channel()
3357 }
3358
3359 pub fn wait_for_event(
3362 &self,
3363 deadline: zx::MonotonicInstant,
3364 ) -> Result<WatcherV6Event, fidl::Error> {
3365 WatcherV6Event::decode(self.client.wait_for_event::<WatcherV6Marker>(deadline)?)
3366 }
3367
3368 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<EventV6>, fidl::Error> {
3389 let _response = self
3390 .client
3391 .send_query::<fidl::encoding::EmptyPayload, WatcherV6WatchResponse, WatcherV6Marker>(
3392 (),
3393 0x82f5e48afc8811e,
3394 fidl::encoding::DynamicFlags::empty(),
3395 ___deadline,
3396 )?;
3397 Ok(_response.events)
3398 }
3399}
3400
3401#[cfg(target_os = "fuchsia")]
3402impl From<WatcherV6SynchronousProxy> for zx::NullableHandle {
3403 fn from(value: WatcherV6SynchronousProxy) -> Self {
3404 value.into_channel().into()
3405 }
3406}
3407
3408#[cfg(target_os = "fuchsia")]
3409impl From<fidl::Channel> for WatcherV6SynchronousProxy {
3410 fn from(value: fidl::Channel) -> Self {
3411 Self::new(value)
3412 }
3413}
3414
3415#[cfg(target_os = "fuchsia")]
3416impl fidl::endpoints::FromClient for WatcherV6SynchronousProxy {
3417 type Protocol = WatcherV6Marker;
3418
3419 fn from_client(value: fidl::endpoints::ClientEnd<WatcherV6Marker>) -> Self {
3420 Self::new(value.into_channel())
3421 }
3422}
3423
3424#[derive(Debug, Clone)]
3425pub struct WatcherV6Proxy {
3426 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3427}
3428
3429impl fidl::endpoints::Proxy for WatcherV6Proxy {
3430 type Protocol = WatcherV6Marker;
3431
3432 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3433 Self::new(inner)
3434 }
3435
3436 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3437 self.client.into_channel().map_err(|client| Self { client })
3438 }
3439
3440 fn as_channel(&self) -> &::fidl::AsyncChannel {
3441 self.client.as_channel()
3442 }
3443}
3444
3445impl WatcherV6Proxy {
3446 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3448 let protocol_name = <WatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3449 Self { client: fidl::client::Client::new(channel, protocol_name) }
3450 }
3451
3452 pub fn take_event_stream(&self) -> WatcherV6EventStream {
3458 WatcherV6EventStream { event_receiver: self.client.take_event_receiver() }
3459 }
3460
3461 pub fn r#watch(
3482 &self,
3483 ) -> fidl::client::QueryResponseFut<Vec<EventV6>, fidl::encoding::DefaultFuchsiaResourceDialect>
3484 {
3485 WatcherV6ProxyInterface::r#watch(self)
3486 }
3487}
3488
3489impl WatcherV6ProxyInterface for WatcherV6Proxy {
3490 type WatchResponseFut =
3491 fidl::client::QueryResponseFut<Vec<EventV6>, fidl::encoding::DefaultFuchsiaResourceDialect>;
3492 fn r#watch(&self) -> Self::WatchResponseFut {
3493 fn _decode(
3494 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3495 ) -> Result<Vec<EventV6>, fidl::Error> {
3496 let _response = fidl::client::decode_transaction_body::<
3497 WatcherV6WatchResponse,
3498 fidl::encoding::DefaultFuchsiaResourceDialect,
3499 0x82f5e48afc8811e,
3500 >(_buf?)?;
3501 Ok(_response.events)
3502 }
3503 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EventV6>>(
3504 (),
3505 0x82f5e48afc8811e,
3506 fidl::encoding::DynamicFlags::empty(),
3507 _decode,
3508 )
3509 }
3510}
3511
3512pub struct WatcherV6EventStream {
3513 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3514}
3515
3516impl std::marker::Unpin for WatcherV6EventStream {}
3517
3518impl futures::stream::FusedStream for WatcherV6EventStream {
3519 fn is_terminated(&self) -> bool {
3520 self.event_receiver.is_terminated()
3521 }
3522}
3523
3524impl futures::Stream for WatcherV6EventStream {
3525 type Item = Result<WatcherV6Event, fidl::Error>;
3526
3527 fn poll_next(
3528 mut self: std::pin::Pin<&mut Self>,
3529 cx: &mut std::task::Context<'_>,
3530 ) -> std::task::Poll<Option<Self::Item>> {
3531 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3532 &mut self.event_receiver,
3533 cx
3534 )?) {
3535 Some(buf) => std::task::Poll::Ready(Some(WatcherV6Event::decode(buf))),
3536 None => std::task::Poll::Ready(None),
3537 }
3538 }
3539}
3540
3541#[derive(Debug)]
3542pub enum WatcherV6Event {}
3543
3544impl WatcherV6Event {
3545 fn decode(
3547 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3548 ) -> Result<WatcherV6Event, fidl::Error> {
3549 let (bytes, _handles) = buf.split_mut();
3550 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3551 debug_assert_eq!(tx_header.tx_id, 0);
3552 match tx_header.ordinal {
3553 _ => Err(fidl::Error::UnknownOrdinal {
3554 ordinal: tx_header.ordinal,
3555 protocol_name: <WatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3556 }),
3557 }
3558 }
3559}
3560
3561pub struct WatcherV6RequestStream {
3563 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3564 is_terminated: bool,
3565}
3566
3567impl std::marker::Unpin for WatcherV6RequestStream {}
3568
3569impl futures::stream::FusedStream for WatcherV6RequestStream {
3570 fn is_terminated(&self) -> bool {
3571 self.is_terminated
3572 }
3573}
3574
3575impl fidl::endpoints::RequestStream for WatcherV6RequestStream {
3576 type Protocol = WatcherV6Marker;
3577 type ControlHandle = WatcherV6ControlHandle;
3578
3579 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3580 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3581 }
3582
3583 fn control_handle(&self) -> Self::ControlHandle {
3584 WatcherV6ControlHandle { inner: self.inner.clone() }
3585 }
3586
3587 fn into_inner(
3588 self,
3589 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3590 {
3591 (self.inner, self.is_terminated)
3592 }
3593
3594 fn from_inner(
3595 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3596 is_terminated: bool,
3597 ) -> Self {
3598 Self { inner, is_terminated }
3599 }
3600}
3601
3602impl futures::Stream for WatcherV6RequestStream {
3603 type Item = Result<WatcherV6Request, fidl::Error>;
3604
3605 fn poll_next(
3606 mut self: std::pin::Pin<&mut Self>,
3607 cx: &mut std::task::Context<'_>,
3608 ) -> std::task::Poll<Option<Self::Item>> {
3609 let this = &mut *self;
3610 if this.inner.check_shutdown(cx) {
3611 this.is_terminated = true;
3612 return std::task::Poll::Ready(None);
3613 }
3614 if this.is_terminated {
3615 panic!("polled WatcherV6RequestStream after completion");
3616 }
3617 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3618 |bytes, handles| {
3619 match this.inner.channel().read_etc(cx, bytes, handles) {
3620 std::task::Poll::Ready(Ok(())) => {}
3621 std::task::Poll::Pending => return std::task::Poll::Pending,
3622 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3623 this.is_terminated = true;
3624 return std::task::Poll::Ready(None);
3625 }
3626 std::task::Poll::Ready(Err(e)) => {
3627 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3628 e.into(),
3629 ))));
3630 }
3631 }
3632
3633 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3635
3636 std::task::Poll::Ready(Some(match header.ordinal {
3637 0x82f5e48afc8811e => {
3638 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3639 let mut req = fidl::new_empty!(
3640 fidl::encoding::EmptyPayload,
3641 fidl::encoding::DefaultFuchsiaResourceDialect
3642 );
3643 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3644 let control_handle = WatcherV6ControlHandle { inner: this.inner.clone() };
3645 Ok(WatcherV6Request::Watch {
3646 responder: WatcherV6WatchResponder {
3647 control_handle: std::mem::ManuallyDrop::new(control_handle),
3648 tx_id: header.tx_id,
3649 },
3650 })
3651 }
3652 _ => Err(fidl::Error::UnknownOrdinal {
3653 ordinal: header.ordinal,
3654 protocol_name:
3655 <WatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3656 }),
3657 }))
3658 },
3659 )
3660 }
3661}
3662
3663#[derive(Debug)]
3665pub enum WatcherV6Request {
3666 Watch { responder: WatcherV6WatchResponder },
3687}
3688
3689impl WatcherV6Request {
3690 #[allow(irrefutable_let_patterns)]
3691 pub fn into_watch(self) -> Option<(WatcherV6WatchResponder)> {
3692 if let WatcherV6Request::Watch { responder } = self { Some((responder)) } else { None }
3693 }
3694
3695 pub fn method_name(&self) -> &'static str {
3697 match *self {
3698 WatcherV6Request::Watch { .. } => "watch",
3699 }
3700 }
3701}
3702
3703#[derive(Debug, Clone)]
3704pub struct WatcherV6ControlHandle {
3705 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3706}
3707
3708impl fidl::endpoints::ControlHandle for WatcherV6ControlHandle {
3709 fn shutdown(&self) {
3710 self.inner.shutdown()
3711 }
3712
3713 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3714 self.inner.shutdown_with_epitaph(status)
3715 }
3716
3717 fn is_closed(&self) -> bool {
3718 self.inner.channel().is_closed()
3719 }
3720 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3721 self.inner.channel().on_closed()
3722 }
3723
3724 #[cfg(target_os = "fuchsia")]
3725 fn signal_peer(
3726 &self,
3727 clear_mask: zx::Signals,
3728 set_mask: zx::Signals,
3729 ) -> Result<(), zx_status::Status> {
3730 use fidl::Peered;
3731 self.inner.channel().signal_peer(clear_mask, set_mask)
3732 }
3733}
3734
3735impl WatcherV6ControlHandle {}
3736
3737#[must_use = "FIDL methods require a response to be sent"]
3738#[derive(Debug)]
3739pub struct WatcherV6WatchResponder {
3740 control_handle: std::mem::ManuallyDrop<WatcherV6ControlHandle>,
3741 tx_id: u32,
3742}
3743
3744impl std::ops::Drop for WatcherV6WatchResponder {
3748 fn drop(&mut self) {
3749 self.control_handle.shutdown();
3750 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3752 }
3753}
3754
3755impl fidl::endpoints::Responder for WatcherV6WatchResponder {
3756 type ControlHandle = WatcherV6ControlHandle;
3757
3758 fn control_handle(&self) -> &WatcherV6ControlHandle {
3759 &self.control_handle
3760 }
3761
3762 fn drop_without_shutdown(mut self) {
3763 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3765 std::mem::forget(self);
3767 }
3768}
3769
3770impl WatcherV6WatchResponder {
3771 pub fn send(self, mut events: &[EventV6]) -> Result<(), fidl::Error> {
3775 let _result = self.send_raw(events);
3776 if _result.is_err() {
3777 self.control_handle.shutdown();
3778 }
3779 self.drop_without_shutdown();
3780 _result
3781 }
3782
3783 pub fn send_no_shutdown_on_err(self, mut events: &[EventV6]) -> Result<(), fidl::Error> {
3785 let _result = self.send_raw(events);
3786 self.drop_without_shutdown();
3787 _result
3788 }
3789
3790 fn send_raw(&self, mut events: &[EventV6]) -> Result<(), fidl::Error> {
3791 self.control_handle.inner.send::<WatcherV6WatchResponse>(
3792 (events,),
3793 self.tx_id,
3794 0x82f5e48afc8811e,
3795 fidl::encoding::DynamicFlags::empty(),
3796 )
3797 }
3798}
3799
3800mod internal {
3801 use super::*;
3802
3803 impl fidl::encoding::ResourceTypeMarker for StateV4GetRuleWatcherV4Request {
3804 type Borrowed<'a> = &'a mut Self;
3805 fn take_or_borrow<'a>(
3806 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3807 ) -> Self::Borrowed<'a> {
3808 value
3809 }
3810 }
3811
3812 unsafe impl fidl::encoding::TypeMarker for StateV4GetRuleWatcherV4Request {
3813 type Owned = Self;
3814
3815 #[inline(always)]
3816 fn inline_align(_context: fidl::encoding::Context) -> usize {
3817 8
3818 }
3819
3820 #[inline(always)]
3821 fn inline_size(_context: fidl::encoding::Context) -> usize {
3822 24
3823 }
3824 }
3825
3826 unsafe impl
3827 fidl::encoding::Encode<
3828 StateV4GetRuleWatcherV4Request,
3829 fidl::encoding::DefaultFuchsiaResourceDialect,
3830 > for &mut StateV4GetRuleWatcherV4Request
3831 {
3832 #[inline]
3833 unsafe fn encode(
3834 self,
3835 encoder: &mut fidl::encoding::Encoder<
3836 '_,
3837 fidl::encoding::DefaultFuchsiaResourceDialect,
3838 >,
3839 offset: usize,
3840 _depth: fidl::encoding::Depth,
3841 ) -> fidl::Result<()> {
3842 encoder.debug_check_bounds::<StateV4GetRuleWatcherV4Request>(offset);
3843 fidl::encoding::Encode::<StateV4GetRuleWatcherV4Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3845 (
3846 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
3847 <RuleWatcherOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3848 ),
3849 encoder, offset, _depth
3850 )
3851 }
3852 }
3853 unsafe impl<
3854 T0: fidl::encoding::Encode<
3855 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV4Marker>>,
3856 fidl::encoding::DefaultFuchsiaResourceDialect,
3857 >,
3858 T1: fidl::encoding::Encode<RuleWatcherOptionsV4, fidl::encoding::DefaultFuchsiaResourceDialect>,
3859 >
3860 fidl::encoding::Encode<
3861 StateV4GetRuleWatcherV4Request,
3862 fidl::encoding::DefaultFuchsiaResourceDialect,
3863 > for (T0, T1)
3864 {
3865 #[inline]
3866 unsafe fn encode(
3867 self,
3868 encoder: &mut fidl::encoding::Encoder<
3869 '_,
3870 fidl::encoding::DefaultFuchsiaResourceDialect,
3871 >,
3872 offset: usize,
3873 depth: fidl::encoding::Depth,
3874 ) -> fidl::Result<()> {
3875 encoder.debug_check_bounds::<StateV4GetRuleWatcherV4Request>(offset);
3876 unsafe {
3879 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3880 (ptr as *mut u64).write_unaligned(0);
3881 }
3882 self.0.encode(encoder, offset + 0, depth)?;
3884 self.1.encode(encoder, offset + 8, depth)?;
3885 Ok(())
3886 }
3887 }
3888
3889 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3890 for StateV4GetRuleWatcherV4Request
3891 {
3892 #[inline(always)]
3893 fn new_empty() -> Self {
3894 Self {
3895 watcher: fidl::new_empty!(
3896 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV4Marker>>,
3897 fidl::encoding::DefaultFuchsiaResourceDialect
3898 ),
3899 options: fidl::new_empty!(
3900 RuleWatcherOptionsV4,
3901 fidl::encoding::DefaultFuchsiaResourceDialect
3902 ),
3903 }
3904 }
3905
3906 #[inline]
3907 unsafe fn decode(
3908 &mut self,
3909 decoder: &mut fidl::encoding::Decoder<
3910 '_,
3911 fidl::encoding::DefaultFuchsiaResourceDialect,
3912 >,
3913 offset: usize,
3914 _depth: fidl::encoding::Depth,
3915 ) -> fidl::Result<()> {
3916 decoder.debug_check_bounds::<Self>(offset);
3917 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3919 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3920 let mask = 0xffffffff00000000u64;
3921 let maskedval = padval & mask;
3922 if maskedval != 0 {
3923 return Err(fidl::Error::NonZeroPadding {
3924 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3925 });
3926 }
3927 fidl::decode!(
3928 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV4Marker>>,
3929 fidl::encoding::DefaultFuchsiaResourceDialect,
3930 &mut self.watcher,
3931 decoder,
3932 offset + 0,
3933 _depth
3934 )?;
3935 fidl::decode!(
3936 RuleWatcherOptionsV4,
3937 fidl::encoding::DefaultFuchsiaResourceDialect,
3938 &mut self.options,
3939 decoder,
3940 offset + 8,
3941 _depth
3942 )?;
3943 Ok(())
3944 }
3945 }
3946
3947 impl fidl::encoding::ResourceTypeMarker for StateV4GetWatcherV4Request {
3948 type Borrowed<'a> = &'a mut Self;
3949 fn take_or_borrow<'a>(
3950 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3951 ) -> Self::Borrowed<'a> {
3952 value
3953 }
3954 }
3955
3956 unsafe impl fidl::encoding::TypeMarker for StateV4GetWatcherV4Request {
3957 type Owned = Self;
3958
3959 #[inline(always)]
3960 fn inline_align(_context: fidl::encoding::Context) -> usize {
3961 8
3962 }
3963
3964 #[inline(always)]
3965 fn inline_size(_context: fidl::encoding::Context) -> usize {
3966 24
3967 }
3968 }
3969
3970 unsafe impl
3971 fidl::encoding::Encode<
3972 StateV4GetWatcherV4Request,
3973 fidl::encoding::DefaultFuchsiaResourceDialect,
3974 > for &mut StateV4GetWatcherV4Request
3975 {
3976 #[inline]
3977 unsafe fn encode(
3978 self,
3979 encoder: &mut fidl::encoding::Encoder<
3980 '_,
3981 fidl::encoding::DefaultFuchsiaResourceDialect,
3982 >,
3983 offset: usize,
3984 _depth: fidl::encoding::Depth,
3985 ) -> fidl::Result<()> {
3986 encoder.debug_check_bounds::<StateV4GetWatcherV4Request>(offset);
3987 fidl::encoding::Encode::<StateV4GetWatcherV4Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3989 (
3990 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
3991 <WatcherOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3992 ),
3993 encoder, offset, _depth
3994 )
3995 }
3996 }
3997 unsafe impl<
3998 T0: fidl::encoding::Encode<
3999 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV4Marker>>,
4000 fidl::encoding::DefaultFuchsiaResourceDialect,
4001 >,
4002 T1: fidl::encoding::Encode<WatcherOptionsV4, fidl::encoding::DefaultFuchsiaResourceDialect>,
4003 >
4004 fidl::encoding::Encode<
4005 StateV4GetWatcherV4Request,
4006 fidl::encoding::DefaultFuchsiaResourceDialect,
4007 > for (T0, T1)
4008 {
4009 #[inline]
4010 unsafe fn encode(
4011 self,
4012 encoder: &mut fidl::encoding::Encoder<
4013 '_,
4014 fidl::encoding::DefaultFuchsiaResourceDialect,
4015 >,
4016 offset: usize,
4017 depth: fidl::encoding::Depth,
4018 ) -> fidl::Result<()> {
4019 encoder.debug_check_bounds::<StateV4GetWatcherV4Request>(offset);
4020 unsafe {
4023 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4024 (ptr as *mut u64).write_unaligned(0);
4025 }
4026 self.0.encode(encoder, offset + 0, depth)?;
4028 self.1.encode(encoder, offset + 8, depth)?;
4029 Ok(())
4030 }
4031 }
4032
4033 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4034 for StateV4GetWatcherV4Request
4035 {
4036 #[inline(always)]
4037 fn new_empty() -> Self {
4038 Self {
4039 watcher: fidl::new_empty!(
4040 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV4Marker>>,
4041 fidl::encoding::DefaultFuchsiaResourceDialect
4042 ),
4043 options: fidl::new_empty!(
4044 WatcherOptionsV4,
4045 fidl::encoding::DefaultFuchsiaResourceDialect
4046 ),
4047 }
4048 }
4049
4050 #[inline]
4051 unsafe fn decode(
4052 &mut self,
4053 decoder: &mut fidl::encoding::Decoder<
4054 '_,
4055 fidl::encoding::DefaultFuchsiaResourceDialect,
4056 >,
4057 offset: usize,
4058 _depth: fidl::encoding::Depth,
4059 ) -> fidl::Result<()> {
4060 decoder.debug_check_bounds::<Self>(offset);
4061 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4063 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4064 let mask = 0xffffffff00000000u64;
4065 let maskedval = padval & mask;
4066 if maskedval != 0 {
4067 return Err(fidl::Error::NonZeroPadding {
4068 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4069 });
4070 }
4071 fidl::decode!(
4072 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV4Marker>>,
4073 fidl::encoding::DefaultFuchsiaResourceDialect,
4074 &mut self.watcher,
4075 decoder,
4076 offset + 0,
4077 _depth
4078 )?;
4079 fidl::decode!(
4080 WatcherOptionsV4,
4081 fidl::encoding::DefaultFuchsiaResourceDialect,
4082 &mut self.options,
4083 decoder,
4084 offset + 8,
4085 _depth
4086 )?;
4087 Ok(())
4088 }
4089 }
4090
4091 impl fidl::encoding::ResourceTypeMarker for StateV6GetRuleWatcherV6Request {
4092 type Borrowed<'a> = &'a mut Self;
4093 fn take_or_borrow<'a>(
4094 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4095 ) -> Self::Borrowed<'a> {
4096 value
4097 }
4098 }
4099
4100 unsafe impl fidl::encoding::TypeMarker for StateV6GetRuleWatcherV6Request {
4101 type Owned = Self;
4102
4103 #[inline(always)]
4104 fn inline_align(_context: fidl::encoding::Context) -> usize {
4105 8
4106 }
4107
4108 #[inline(always)]
4109 fn inline_size(_context: fidl::encoding::Context) -> usize {
4110 24
4111 }
4112 }
4113
4114 unsafe impl
4115 fidl::encoding::Encode<
4116 StateV6GetRuleWatcherV6Request,
4117 fidl::encoding::DefaultFuchsiaResourceDialect,
4118 > for &mut StateV6GetRuleWatcherV6Request
4119 {
4120 #[inline]
4121 unsafe fn encode(
4122 self,
4123 encoder: &mut fidl::encoding::Encoder<
4124 '_,
4125 fidl::encoding::DefaultFuchsiaResourceDialect,
4126 >,
4127 offset: usize,
4128 _depth: fidl::encoding::Depth,
4129 ) -> fidl::Result<()> {
4130 encoder.debug_check_bounds::<StateV6GetRuleWatcherV6Request>(offset);
4131 fidl::encoding::Encode::<StateV6GetRuleWatcherV6Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4133 (
4134 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
4135 <RuleWatcherOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
4136 ),
4137 encoder, offset, _depth
4138 )
4139 }
4140 }
4141 unsafe impl<
4142 T0: fidl::encoding::Encode<
4143 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV6Marker>>,
4144 fidl::encoding::DefaultFuchsiaResourceDialect,
4145 >,
4146 T1: fidl::encoding::Encode<RuleWatcherOptionsV6, fidl::encoding::DefaultFuchsiaResourceDialect>,
4147 >
4148 fidl::encoding::Encode<
4149 StateV6GetRuleWatcherV6Request,
4150 fidl::encoding::DefaultFuchsiaResourceDialect,
4151 > for (T0, T1)
4152 {
4153 #[inline]
4154 unsafe fn encode(
4155 self,
4156 encoder: &mut fidl::encoding::Encoder<
4157 '_,
4158 fidl::encoding::DefaultFuchsiaResourceDialect,
4159 >,
4160 offset: usize,
4161 depth: fidl::encoding::Depth,
4162 ) -> fidl::Result<()> {
4163 encoder.debug_check_bounds::<StateV6GetRuleWatcherV6Request>(offset);
4164 unsafe {
4167 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4168 (ptr as *mut u64).write_unaligned(0);
4169 }
4170 self.0.encode(encoder, offset + 0, depth)?;
4172 self.1.encode(encoder, offset + 8, depth)?;
4173 Ok(())
4174 }
4175 }
4176
4177 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4178 for StateV6GetRuleWatcherV6Request
4179 {
4180 #[inline(always)]
4181 fn new_empty() -> Self {
4182 Self {
4183 watcher: fidl::new_empty!(
4184 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV6Marker>>,
4185 fidl::encoding::DefaultFuchsiaResourceDialect
4186 ),
4187 options: fidl::new_empty!(
4188 RuleWatcherOptionsV6,
4189 fidl::encoding::DefaultFuchsiaResourceDialect
4190 ),
4191 }
4192 }
4193
4194 #[inline]
4195 unsafe fn decode(
4196 &mut self,
4197 decoder: &mut fidl::encoding::Decoder<
4198 '_,
4199 fidl::encoding::DefaultFuchsiaResourceDialect,
4200 >,
4201 offset: usize,
4202 _depth: fidl::encoding::Depth,
4203 ) -> fidl::Result<()> {
4204 decoder.debug_check_bounds::<Self>(offset);
4205 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4207 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4208 let mask = 0xffffffff00000000u64;
4209 let maskedval = padval & mask;
4210 if maskedval != 0 {
4211 return Err(fidl::Error::NonZeroPadding {
4212 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4213 });
4214 }
4215 fidl::decode!(
4216 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV6Marker>>,
4217 fidl::encoding::DefaultFuchsiaResourceDialect,
4218 &mut self.watcher,
4219 decoder,
4220 offset + 0,
4221 _depth
4222 )?;
4223 fidl::decode!(
4224 RuleWatcherOptionsV6,
4225 fidl::encoding::DefaultFuchsiaResourceDialect,
4226 &mut self.options,
4227 decoder,
4228 offset + 8,
4229 _depth
4230 )?;
4231 Ok(())
4232 }
4233 }
4234
4235 impl fidl::encoding::ResourceTypeMarker for StateV6GetWatcherV6Request {
4236 type Borrowed<'a> = &'a mut Self;
4237 fn take_or_borrow<'a>(
4238 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4239 ) -> Self::Borrowed<'a> {
4240 value
4241 }
4242 }
4243
4244 unsafe impl fidl::encoding::TypeMarker for StateV6GetWatcherV6Request {
4245 type Owned = Self;
4246
4247 #[inline(always)]
4248 fn inline_align(_context: fidl::encoding::Context) -> usize {
4249 8
4250 }
4251
4252 #[inline(always)]
4253 fn inline_size(_context: fidl::encoding::Context) -> usize {
4254 24
4255 }
4256 }
4257
4258 unsafe impl
4259 fidl::encoding::Encode<
4260 StateV6GetWatcherV6Request,
4261 fidl::encoding::DefaultFuchsiaResourceDialect,
4262 > for &mut StateV6GetWatcherV6Request
4263 {
4264 #[inline]
4265 unsafe fn encode(
4266 self,
4267 encoder: &mut fidl::encoding::Encoder<
4268 '_,
4269 fidl::encoding::DefaultFuchsiaResourceDialect,
4270 >,
4271 offset: usize,
4272 _depth: fidl::encoding::Depth,
4273 ) -> fidl::Result<()> {
4274 encoder.debug_check_bounds::<StateV6GetWatcherV6Request>(offset);
4275 fidl::encoding::Encode::<StateV6GetWatcherV6Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4277 (
4278 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
4279 <WatcherOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
4280 ),
4281 encoder, offset, _depth
4282 )
4283 }
4284 }
4285 unsafe impl<
4286 T0: fidl::encoding::Encode<
4287 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV6Marker>>,
4288 fidl::encoding::DefaultFuchsiaResourceDialect,
4289 >,
4290 T1: fidl::encoding::Encode<WatcherOptionsV6, fidl::encoding::DefaultFuchsiaResourceDialect>,
4291 >
4292 fidl::encoding::Encode<
4293 StateV6GetWatcherV6Request,
4294 fidl::encoding::DefaultFuchsiaResourceDialect,
4295 > for (T0, T1)
4296 {
4297 #[inline]
4298 unsafe fn encode(
4299 self,
4300 encoder: &mut fidl::encoding::Encoder<
4301 '_,
4302 fidl::encoding::DefaultFuchsiaResourceDialect,
4303 >,
4304 offset: usize,
4305 depth: fidl::encoding::Depth,
4306 ) -> fidl::Result<()> {
4307 encoder.debug_check_bounds::<StateV6GetWatcherV6Request>(offset);
4308 unsafe {
4311 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4312 (ptr as *mut u64).write_unaligned(0);
4313 }
4314 self.0.encode(encoder, offset + 0, depth)?;
4316 self.1.encode(encoder, offset + 8, depth)?;
4317 Ok(())
4318 }
4319 }
4320
4321 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4322 for StateV6GetWatcherV6Request
4323 {
4324 #[inline(always)]
4325 fn new_empty() -> Self {
4326 Self {
4327 watcher: fidl::new_empty!(
4328 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV6Marker>>,
4329 fidl::encoding::DefaultFuchsiaResourceDialect
4330 ),
4331 options: fidl::new_empty!(
4332 WatcherOptionsV6,
4333 fidl::encoding::DefaultFuchsiaResourceDialect
4334 ),
4335 }
4336 }
4337
4338 #[inline]
4339 unsafe fn decode(
4340 &mut self,
4341 decoder: &mut fidl::encoding::Decoder<
4342 '_,
4343 fidl::encoding::DefaultFuchsiaResourceDialect,
4344 >,
4345 offset: usize,
4346 _depth: fidl::encoding::Depth,
4347 ) -> fidl::Result<()> {
4348 decoder.debug_check_bounds::<Self>(offset);
4349 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4351 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4352 let mask = 0xffffffff00000000u64;
4353 let maskedval = padval & mask;
4354 if maskedval != 0 {
4355 return Err(fidl::Error::NonZeroPadding {
4356 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4357 });
4358 }
4359 fidl::decode!(
4360 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV6Marker>>,
4361 fidl::encoding::DefaultFuchsiaResourceDialect,
4362 &mut self.watcher,
4363 decoder,
4364 offset + 0,
4365 _depth
4366 )?;
4367 fidl::decode!(
4368 WatcherOptionsV6,
4369 fidl::encoding::DefaultFuchsiaResourceDialect,
4370 &mut self.options,
4371 decoder,
4372 offset + 8,
4373 _depth
4374 )?;
4375 Ok(())
4376 }
4377 }
4378}