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 RuleWatcherV4ControlHandle {
448 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
449 self.inner.shutdown_with_epitaph(status.into())
450 }
451}
452
453impl fidl::endpoints::ControlHandle for RuleWatcherV4ControlHandle {
454 fn shutdown(&self) {
455 self.inner.shutdown()
456 }
457
458 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
459 self.inner.shutdown_with_epitaph(status)
460 }
461
462 fn is_closed(&self) -> bool {
463 self.inner.channel().is_closed()
464 }
465 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
466 self.inner.channel().on_closed()
467 }
468
469 #[cfg(target_os = "fuchsia")]
470 fn signal_peer(
471 &self,
472 clear_mask: zx::Signals,
473 set_mask: zx::Signals,
474 ) -> Result<(), zx_status::Status> {
475 use fidl::Peered;
476 self.inner.channel().signal_peer(clear_mask, set_mask)
477 }
478}
479
480impl RuleWatcherV4ControlHandle {}
481
482#[must_use = "FIDL methods require a response to be sent"]
483#[derive(Debug)]
484pub struct RuleWatcherV4WatchResponder {
485 control_handle: std::mem::ManuallyDrop<RuleWatcherV4ControlHandle>,
486 tx_id: u32,
487}
488
489impl std::ops::Drop for RuleWatcherV4WatchResponder {
493 fn drop(&mut self) {
494 self.control_handle.shutdown();
495 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
497 }
498}
499
500impl fidl::endpoints::Responder for RuleWatcherV4WatchResponder {
501 type ControlHandle = RuleWatcherV4ControlHandle;
502
503 fn control_handle(&self) -> &RuleWatcherV4ControlHandle {
504 &self.control_handle
505 }
506
507 fn drop_without_shutdown(mut self) {
508 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
510 std::mem::forget(self);
512 }
513}
514
515impl RuleWatcherV4WatchResponder {
516 pub fn send(self, mut events: &[RuleEventV4]) -> Result<(), fidl::Error> {
520 let _result = self.send_raw(events);
521 if _result.is_err() {
522 self.control_handle.shutdown();
523 }
524 self.drop_without_shutdown();
525 _result
526 }
527
528 pub fn send_no_shutdown_on_err(self, mut events: &[RuleEventV4]) -> Result<(), fidl::Error> {
530 let _result = self.send_raw(events);
531 self.drop_without_shutdown();
532 _result
533 }
534
535 fn send_raw(&self, mut events: &[RuleEventV4]) -> Result<(), fidl::Error> {
536 self.control_handle.inner.send::<RuleWatcherV4WatchResponse>(
537 (events,),
538 self.tx_id,
539 0x7f94d7ea0f843271,
540 fidl::encoding::DynamicFlags::empty(),
541 )
542 }
543}
544
545#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
546pub struct RuleWatcherV6Marker;
547
548impl fidl::endpoints::ProtocolMarker for RuleWatcherV6Marker {
549 type Proxy = RuleWatcherV6Proxy;
550 type RequestStream = RuleWatcherV6RequestStream;
551 #[cfg(target_os = "fuchsia")]
552 type SynchronousProxy = RuleWatcherV6SynchronousProxy;
553
554 const DEBUG_NAME: &'static str = "(anonymous) RuleWatcherV6";
555}
556
557pub trait RuleWatcherV6ProxyInterface: Send + Sync {
558 type WatchResponseFut: std::future::Future<Output = Result<Vec<RuleEventV6>, fidl::Error>>
559 + Send;
560 fn r#watch(&self) -> Self::WatchResponseFut;
561}
562#[derive(Debug)]
563#[cfg(target_os = "fuchsia")]
564pub struct RuleWatcherV6SynchronousProxy {
565 client: fidl::client::sync::Client,
566}
567
568#[cfg(target_os = "fuchsia")]
569impl fidl::endpoints::SynchronousProxy for RuleWatcherV6SynchronousProxy {
570 type Proxy = RuleWatcherV6Proxy;
571 type Protocol = RuleWatcherV6Marker;
572
573 fn from_channel(inner: fidl::Channel) -> Self {
574 Self::new(inner)
575 }
576
577 fn into_channel(self) -> fidl::Channel {
578 self.client.into_channel()
579 }
580
581 fn as_channel(&self) -> &fidl::Channel {
582 self.client.as_channel()
583 }
584}
585
586#[cfg(target_os = "fuchsia")]
587impl RuleWatcherV6SynchronousProxy {
588 pub fn new(channel: fidl::Channel) -> Self {
589 Self { client: fidl::client::sync::Client::new(channel) }
590 }
591
592 pub fn into_channel(self) -> fidl::Channel {
593 self.client.into_channel()
594 }
595
596 pub fn wait_for_event(
599 &self,
600 deadline: zx::MonotonicInstant,
601 ) -> Result<RuleWatcherV6Event, fidl::Error> {
602 RuleWatcherV6Event::decode(self.client.wait_for_event::<RuleWatcherV6Marker>(deadline)?)
603 }
604
605 pub fn r#watch(
619 &self,
620 ___deadline: zx::MonotonicInstant,
621 ) -> Result<Vec<RuleEventV6>, fidl::Error> {
622 let _response = self.client.send_query::<
623 fidl::encoding::EmptyPayload,
624 RuleWatcherV6WatchResponse,
625 RuleWatcherV6Marker,
626 >(
627 (),
628 0x5ccd746122bfa678,
629 fidl::encoding::DynamicFlags::empty(),
630 ___deadline,
631 )?;
632 Ok(_response.events)
633 }
634}
635
636#[cfg(target_os = "fuchsia")]
637impl From<RuleWatcherV6SynchronousProxy> for zx::NullableHandle {
638 fn from(value: RuleWatcherV6SynchronousProxy) -> Self {
639 value.into_channel().into()
640 }
641}
642
643#[cfg(target_os = "fuchsia")]
644impl From<fidl::Channel> for RuleWatcherV6SynchronousProxy {
645 fn from(value: fidl::Channel) -> Self {
646 Self::new(value)
647 }
648}
649
650#[cfg(target_os = "fuchsia")]
651impl fidl::endpoints::FromClient for RuleWatcherV6SynchronousProxy {
652 type Protocol = RuleWatcherV6Marker;
653
654 fn from_client(value: fidl::endpoints::ClientEnd<RuleWatcherV6Marker>) -> Self {
655 Self::new(value.into_channel())
656 }
657}
658
659#[derive(Debug, Clone)]
660pub struct RuleWatcherV6Proxy {
661 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
662}
663
664impl fidl::endpoints::Proxy for RuleWatcherV6Proxy {
665 type Protocol = RuleWatcherV6Marker;
666
667 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
668 Self::new(inner)
669 }
670
671 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
672 self.client.into_channel().map_err(|client| Self { client })
673 }
674
675 fn as_channel(&self) -> &::fidl::AsyncChannel {
676 self.client.as_channel()
677 }
678}
679
680impl RuleWatcherV6Proxy {
681 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
683 let protocol_name = <RuleWatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
684 Self { client: fidl::client::Client::new(channel, protocol_name) }
685 }
686
687 pub fn take_event_stream(&self) -> RuleWatcherV6EventStream {
693 RuleWatcherV6EventStream { event_receiver: self.client.take_event_receiver() }
694 }
695
696 pub fn r#watch(
710 &self,
711 ) -> fidl::client::QueryResponseFut<
712 Vec<RuleEventV6>,
713 fidl::encoding::DefaultFuchsiaResourceDialect,
714 > {
715 RuleWatcherV6ProxyInterface::r#watch(self)
716 }
717}
718
719impl RuleWatcherV6ProxyInterface for RuleWatcherV6Proxy {
720 type WatchResponseFut = fidl::client::QueryResponseFut<
721 Vec<RuleEventV6>,
722 fidl::encoding::DefaultFuchsiaResourceDialect,
723 >;
724 fn r#watch(&self) -> Self::WatchResponseFut {
725 fn _decode(
726 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
727 ) -> Result<Vec<RuleEventV6>, fidl::Error> {
728 let _response = fidl::client::decode_transaction_body::<
729 RuleWatcherV6WatchResponse,
730 fidl::encoding::DefaultFuchsiaResourceDialect,
731 0x5ccd746122bfa678,
732 >(_buf?)?;
733 Ok(_response.events)
734 }
735 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<RuleEventV6>>(
736 (),
737 0x5ccd746122bfa678,
738 fidl::encoding::DynamicFlags::empty(),
739 _decode,
740 )
741 }
742}
743
744pub struct RuleWatcherV6EventStream {
745 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
746}
747
748impl std::marker::Unpin for RuleWatcherV6EventStream {}
749
750impl futures::stream::FusedStream for RuleWatcherV6EventStream {
751 fn is_terminated(&self) -> bool {
752 self.event_receiver.is_terminated()
753 }
754}
755
756impl futures::Stream for RuleWatcherV6EventStream {
757 type Item = Result<RuleWatcherV6Event, fidl::Error>;
758
759 fn poll_next(
760 mut self: std::pin::Pin<&mut Self>,
761 cx: &mut std::task::Context<'_>,
762 ) -> std::task::Poll<Option<Self::Item>> {
763 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
764 &mut self.event_receiver,
765 cx
766 )?) {
767 Some(buf) => std::task::Poll::Ready(Some(RuleWatcherV6Event::decode(buf))),
768 None => std::task::Poll::Ready(None),
769 }
770 }
771}
772
773#[derive(Debug)]
774pub enum RuleWatcherV6Event {}
775
776impl RuleWatcherV6Event {
777 fn decode(
779 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
780 ) -> Result<RuleWatcherV6Event, fidl::Error> {
781 let (bytes, _handles) = buf.split_mut();
782 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
783 debug_assert_eq!(tx_header.tx_id, 0);
784 match tx_header.ordinal {
785 _ => Err(fidl::Error::UnknownOrdinal {
786 ordinal: tx_header.ordinal,
787 protocol_name: <RuleWatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
788 }),
789 }
790 }
791}
792
793pub struct RuleWatcherV6RequestStream {
795 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
796 is_terminated: bool,
797}
798
799impl std::marker::Unpin for RuleWatcherV6RequestStream {}
800
801impl futures::stream::FusedStream for RuleWatcherV6RequestStream {
802 fn is_terminated(&self) -> bool {
803 self.is_terminated
804 }
805}
806
807impl fidl::endpoints::RequestStream for RuleWatcherV6RequestStream {
808 type Protocol = RuleWatcherV6Marker;
809 type ControlHandle = RuleWatcherV6ControlHandle;
810
811 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
812 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
813 }
814
815 fn control_handle(&self) -> Self::ControlHandle {
816 RuleWatcherV6ControlHandle { inner: self.inner.clone() }
817 }
818
819 fn into_inner(
820 self,
821 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
822 {
823 (self.inner, self.is_terminated)
824 }
825
826 fn from_inner(
827 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
828 is_terminated: bool,
829 ) -> Self {
830 Self { inner, is_terminated }
831 }
832}
833
834impl futures::Stream for RuleWatcherV6RequestStream {
835 type Item = Result<RuleWatcherV6Request, fidl::Error>;
836
837 fn poll_next(
838 mut self: std::pin::Pin<&mut Self>,
839 cx: &mut std::task::Context<'_>,
840 ) -> std::task::Poll<Option<Self::Item>> {
841 let this = &mut *self;
842 if this.inner.check_shutdown(cx) {
843 this.is_terminated = true;
844 return std::task::Poll::Ready(None);
845 }
846 if this.is_terminated {
847 panic!("polled RuleWatcherV6RequestStream after completion");
848 }
849 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
850 |bytes, handles| {
851 match this.inner.channel().read_etc(cx, bytes, handles) {
852 std::task::Poll::Ready(Ok(())) => {}
853 std::task::Poll::Pending => return std::task::Poll::Pending,
854 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
855 this.is_terminated = true;
856 return std::task::Poll::Ready(None);
857 }
858 std::task::Poll::Ready(Err(e)) => {
859 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
860 e.into(),
861 ))));
862 }
863 }
864
865 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
867
868 std::task::Poll::Ready(Some(match header.ordinal {
869 0x5ccd746122bfa678 => {
870 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
871 let mut req = fidl::new_empty!(
872 fidl::encoding::EmptyPayload,
873 fidl::encoding::DefaultFuchsiaResourceDialect
874 );
875 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
876 let control_handle =
877 RuleWatcherV6ControlHandle { inner: this.inner.clone() };
878 Ok(RuleWatcherV6Request::Watch {
879 responder: RuleWatcherV6WatchResponder {
880 control_handle: std::mem::ManuallyDrop::new(control_handle),
881 tx_id: header.tx_id,
882 },
883 })
884 }
885 _ => Err(fidl::Error::UnknownOrdinal {
886 ordinal: header.ordinal,
887 protocol_name:
888 <RuleWatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
889 }),
890 }))
891 },
892 )
893 }
894}
895
896#[derive(Debug)]
898pub enum RuleWatcherV6Request {
899 Watch { responder: RuleWatcherV6WatchResponder },
913}
914
915impl RuleWatcherV6Request {
916 #[allow(irrefutable_let_patterns)]
917 pub fn into_watch(self) -> Option<(RuleWatcherV6WatchResponder)> {
918 if let RuleWatcherV6Request::Watch { responder } = self { Some((responder)) } else { None }
919 }
920
921 pub fn method_name(&self) -> &'static str {
923 match *self {
924 RuleWatcherV6Request::Watch { .. } => "watch",
925 }
926 }
927}
928
929#[derive(Debug, Clone)]
930pub struct RuleWatcherV6ControlHandle {
931 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
932}
933
934impl RuleWatcherV6ControlHandle {
935 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
936 self.inner.shutdown_with_epitaph(status.into())
937 }
938}
939
940impl fidl::endpoints::ControlHandle for RuleWatcherV6ControlHandle {
941 fn shutdown(&self) {
942 self.inner.shutdown()
943 }
944
945 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
946 self.inner.shutdown_with_epitaph(status)
947 }
948
949 fn is_closed(&self) -> bool {
950 self.inner.channel().is_closed()
951 }
952 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
953 self.inner.channel().on_closed()
954 }
955
956 #[cfg(target_os = "fuchsia")]
957 fn signal_peer(
958 &self,
959 clear_mask: zx::Signals,
960 set_mask: zx::Signals,
961 ) -> Result<(), zx_status::Status> {
962 use fidl::Peered;
963 self.inner.channel().signal_peer(clear_mask, set_mask)
964 }
965}
966
967impl RuleWatcherV6ControlHandle {}
968
969#[must_use = "FIDL methods require a response to be sent"]
970#[derive(Debug)]
971pub struct RuleWatcherV6WatchResponder {
972 control_handle: std::mem::ManuallyDrop<RuleWatcherV6ControlHandle>,
973 tx_id: u32,
974}
975
976impl std::ops::Drop for RuleWatcherV6WatchResponder {
980 fn drop(&mut self) {
981 self.control_handle.shutdown();
982 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
984 }
985}
986
987impl fidl::endpoints::Responder for RuleWatcherV6WatchResponder {
988 type ControlHandle = RuleWatcherV6ControlHandle;
989
990 fn control_handle(&self) -> &RuleWatcherV6ControlHandle {
991 &self.control_handle
992 }
993
994 fn drop_without_shutdown(mut self) {
995 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
997 std::mem::forget(self);
999 }
1000}
1001
1002impl RuleWatcherV6WatchResponder {
1003 pub fn send(self, mut events: &[RuleEventV6]) -> Result<(), fidl::Error> {
1007 let _result = self.send_raw(events);
1008 if _result.is_err() {
1009 self.control_handle.shutdown();
1010 }
1011 self.drop_without_shutdown();
1012 _result
1013 }
1014
1015 pub fn send_no_shutdown_on_err(self, mut events: &[RuleEventV6]) -> Result<(), fidl::Error> {
1017 let _result = self.send_raw(events);
1018 self.drop_without_shutdown();
1019 _result
1020 }
1021
1022 fn send_raw(&self, mut events: &[RuleEventV6]) -> Result<(), fidl::Error> {
1023 self.control_handle.inner.send::<RuleWatcherV6WatchResponse>(
1024 (events,),
1025 self.tx_id,
1026 0x5ccd746122bfa678,
1027 fidl::encoding::DynamicFlags::empty(),
1028 )
1029 }
1030}
1031
1032#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1033pub struct StateMarker;
1034
1035impl fidl::endpoints::ProtocolMarker for StateMarker {
1036 type Proxy = StateProxy;
1037 type RequestStream = StateRequestStream;
1038 #[cfg(target_os = "fuchsia")]
1039 type SynchronousProxy = StateSynchronousProxy;
1040
1041 const DEBUG_NAME: &'static str = "fuchsia.net.routes.State";
1042}
1043impl fidl::endpoints::DiscoverableProtocolMarker for StateMarker {}
1044pub type StateResolveResult = Result<Resolved, i32>;
1045pub type StateResolve2Result = Result<ResolveResult, ResolveError>;
1046pub type StateGetRouteTableNameResult = Result<String, StateGetRouteTableNameError>;
1047
1048pub trait StateProxyInterface: Send + Sync {
1049 type ResolveResponseFut: std::future::Future<Output = Result<StateResolveResult, fidl::Error>>
1050 + Send;
1051 fn r#resolve(&self, destination: &fidl_fuchsia_net::IpAddress) -> Self::ResolveResponseFut;
1052 type Resolve2ResponseFut: std::future::Future<Output = Result<StateResolve2Result, fidl::Error>>
1053 + Send;
1054 fn r#resolve2(
1055 &self,
1056 destination: &fidl_fuchsia_net::IpAddress,
1057 options: &ResolveOptions,
1058 ) -> Self::Resolve2ResponseFut;
1059 type GetRouteTableNameResponseFut: std::future::Future<Output = Result<StateGetRouteTableNameResult, fidl::Error>>
1060 + Send;
1061 fn r#get_route_table_name(&self, table_id: u32) -> Self::GetRouteTableNameResponseFut;
1062}
1063#[derive(Debug)]
1064#[cfg(target_os = "fuchsia")]
1065pub struct StateSynchronousProxy {
1066 client: fidl::client::sync::Client,
1067}
1068
1069#[cfg(target_os = "fuchsia")]
1070impl fidl::endpoints::SynchronousProxy for StateSynchronousProxy {
1071 type Proxy = StateProxy;
1072 type Protocol = StateMarker;
1073
1074 fn from_channel(inner: fidl::Channel) -> Self {
1075 Self::new(inner)
1076 }
1077
1078 fn into_channel(self) -> fidl::Channel {
1079 self.client.into_channel()
1080 }
1081
1082 fn as_channel(&self) -> &fidl::Channel {
1083 self.client.as_channel()
1084 }
1085}
1086
1087#[cfg(target_os = "fuchsia")]
1088impl StateSynchronousProxy {
1089 pub fn new(channel: fidl::Channel) -> Self {
1090 Self { client: fidl::client::sync::Client::new(channel) }
1091 }
1092
1093 pub fn into_channel(self) -> fidl::Channel {
1094 self.client.into_channel()
1095 }
1096
1097 pub fn wait_for_event(
1100 &self,
1101 deadline: zx::MonotonicInstant,
1102 ) -> Result<StateEvent, fidl::Error> {
1103 StateEvent::decode(self.client.wait_for_event::<StateMarker>(deadline)?)
1104 }
1105
1106 pub fn r#resolve(
1115 &self,
1116 mut destination: &fidl_fuchsia_net::IpAddress,
1117 ___deadline: zx::MonotonicInstant,
1118 ) -> Result<StateResolveResult, fidl::Error> {
1119 let _response = self.client.send_query::<
1120 StateResolveRequest,
1121 fidl::encoding::ResultType<StateResolveResponse, i32>,
1122 StateMarker,
1123 >(
1124 (destination,),
1125 0x1541bc37d2d1dfb0,
1126 fidl::encoding::DynamicFlags::empty(),
1127 ___deadline,
1128 )?;
1129 Ok(_response.map(|x| x.result))
1130 }
1131
1132 pub fn r#resolve2(
1142 &self,
1143 mut destination: &fidl_fuchsia_net::IpAddress,
1144 mut options: &ResolveOptions,
1145 ___deadline: zx::MonotonicInstant,
1146 ) -> Result<StateResolve2Result, fidl::Error> {
1147 let _response = self.client.send_query::<StateResolve2Request, fidl::encoding::ResultType<
1148 StateResolve2Response,
1149 ResolveError,
1150 >, StateMarker>(
1151 (destination, options),
1152 0x3a37608b6851f75c,
1153 fidl::encoding::DynamicFlags::empty(),
1154 ___deadline,
1155 )?;
1156 Ok(_response.map(|x| x.result))
1157 }
1158
1159 pub fn r#get_route_table_name(
1166 &self,
1167 mut table_id: u32,
1168 ___deadline: zx::MonotonicInstant,
1169 ) -> Result<StateGetRouteTableNameResult, fidl::Error> {
1170 let _response =
1171 self.client.send_query::<StateGetRouteTableNameRequest, fidl::encoding::ResultType<
1172 StateGetRouteTableNameResponse,
1173 StateGetRouteTableNameError,
1174 >, StateMarker>(
1175 (table_id,),
1176 0x6fed5423c7ce421a,
1177 fidl::encoding::DynamicFlags::empty(),
1178 ___deadline,
1179 )?;
1180 Ok(_response.map(|x| x.table_name))
1181 }
1182}
1183
1184#[cfg(target_os = "fuchsia")]
1185impl From<StateSynchronousProxy> for zx::NullableHandle {
1186 fn from(value: StateSynchronousProxy) -> Self {
1187 value.into_channel().into()
1188 }
1189}
1190
1191#[cfg(target_os = "fuchsia")]
1192impl From<fidl::Channel> for StateSynchronousProxy {
1193 fn from(value: fidl::Channel) -> Self {
1194 Self::new(value)
1195 }
1196}
1197
1198#[cfg(target_os = "fuchsia")]
1199impl fidl::endpoints::FromClient for StateSynchronousProxy {
1200 type Protocol = StateMarker;
1201
1202 fn from_client(value: fidl::endpoints::ClientEnd<StateMarker>) -> Self {
1203 Self::new(value.into_channel())
1204 }
1205}
1206
1207#[derive(Debug, Clone)]
1208pub struct StateProxy {
1209 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1210}
1211
1212impl fidl::endpoints::Proxy for StateProxy {
1213 type Protocol = StateMarker;
1214
1215 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1216 Self::new(inner)
1217 }
1218
1219 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1220 self.client.into_channel().map_err(|client| Self { client })
1221 }
1222
1223 fn as_channel(&self) -> &::fidl::AsyncChannel {
1224 self.client.as_channel()
1225 }
1226}
1227
1228impl StateProxy {
1229 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1231 let protocol_name = <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1232 Self { client: fidl::client::Client::new(channel, protocol_name) }
1233 }
1234
1235 pub fn take_event_stream(&self) -> StateEventStream {
1241 StateEventStream { event_receiver: self.client.take_event_receiver() }
1242 }
1243
1244 pub fn r#resolve(
1253 &self,
1254 mut destination: &fidl_fuchsia_net::IpAddress,
1255 ) -> fidl::client::QueryResponseFut<
1256 StateResolveResult,
1257 fidl::encoding::DefaultFuchsiaResourceDialect,
1258 > {
1259 StateProxyInterface::r#resolve(self, destination)
1260 }
1261
1262 pub fn r#resolve2(
1272 &self,
1273 mut destination: &fidl_fuchsia_net::IpAddress,
1274 mut options: &ResolveOptions,
1275 ) -> fidl::client::QueryResponseFut<
1276 StateResolve2Result,
1277 fidl::encoding::DefaultFuchsiaResourceDialect,
1278 > {
1279 StateProxyInterface::r#resolve2(self, destination, options)
1280 }
1281
1282 pub fn r#get_route_table_name(
1289 &self,
1290 mut table_id: u32,
1291 ) -> fidl::client::QueryResponseFut<
1292 StateGetRouteTableNameResult,
1293 fidl::encoding::DefaultFuchsiaResourceDialect,
1294 > {
1295 StateProxyInterface::r#get_route_table_name(self, table_id)
1296 }
1297}
1298
1299impl StateProxyInterface for StateProxy {
1300 type ResolveResponseFut = fidl::client::QueryResponseFut<
1301 StateResolveResult,
1302 fidl::encoding::DefaultFuchsiaResourceDialect,
1303 >;
1304 fn r#resolve(&self, mut destination: &fidl_fuchsia_net::IpAddress) -> Self::ResolveResponseFut {
1305 fn _decode(
1306 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1307 ) -> Result<StateResolveResult, fidl::Error> {
1308 let _response = fidl::client::decode_transaction_body::<
1309 fidl::encoding::ResultType<StateResolveResponse, i32>,
1310 fidl::encoding::DefaultFuchsiaResourceDialect,
1311 0x1541bc37d2d1dfb0,
1312 >(_buf?)?;
1313 Ok(_response.map(|x| x.result))
1314 }
1315 self.client.send_query_and_decode::<StateResolveRequest, StateResolveResult>(
1316 (destination,),
1317 0x1541bc37d2d1dfb0,
1318 fidl::encoding::DynamicFlags::empty(),
1319 _decode,
1320 )
1321 }
1322
1323 type Resolve2ResponseFut = fidl::client::QueryResponseFut<
1324 StateResolve2Result,
1325 fidl::encoding::DefaultFuchsiaResourceDialect,
1326 >;
1327 fn r#resolve2(
1328 &self,
1329 mut destination: &fidl_fuchsia_net::IpAddress,
1330 mut options: &ResolveOptions,
1331 ) -> Self::Resolve2ResponseFut {
1332 fn _decode(
1333 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1334 ) -> Result<StateResolve2Result, fidl::Error> {
1335 let _response = fidl::client::decode_transaction_body::<
1336 fidl::encoding::ResultType<StateResolve2Response, ResolveError>,
1337 fidl::encoding::DefaultFuchsiaResourceDialect,
1338 0x3a37608b6851f75c,
1339 >(_buf?)?;
1340 Ok(_response.map(|x| x.result))
1341 }
1342 self.client.send_query_and_decode::<StateResolve2Request, StateResolve2Result>(
1343 (destination, options),
1344 0x3a37608b6851f75c,
1345 fidl::encoding::DynamicFlags::empty(),
1346 _decode,
1347 )
1348 }
1349
1350 type GetRouteTableNameResponseFut = fidl::client::QueryResponseFut<
1351 StateGetRouteTableNameResult,
1352 fidl::encoding::DefaultFuchsiaResourceDialect,
1353 >;
1354 fn r#get_route_table_name(&self, mut table_id: u32) -> Self::GetRouteTableNameResponseFut {
1355 fn _decode(
1356 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1357 ) -> Result<StateGetRouteTableNameResult, fidl::Error> {
1358 let _response = fidl::client::decode_transaction_body::<
1359 fidl::encoding::ResultType<
1360 StateGetRouteTableNameResponse,
1361 StateGetRouteTableNameError,
1362 >,
1363 fidl::encoding::DefaultFuchsiaResourceDialect,
1364 0x6fed5423c7ce421a,
1365 >(_buf?)?;
1366 Ok(_response.map(|x| x.table_name))
1367 }
1368 self.client
1369 .send_query_and_decode::<StateGetRouteTableNameRequest, StateGetRouteTableNameResult>(
1370 (table_id,),
1371 0x6fed5423c7ce421a,
1372 fidl::encoding::DynamicFlags::empty(),
1373 _decode,
1374 )
1375 }
1376}
1377
1378pub struct StateEventStream {
1379 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1380}
1381
1382impl std::marker::Unpin for StateEventStream {}
1383
1384impl futures::stream::FusedStream for StateEventStream {
1385 fn is_terminated(&self) -> bool {
1386 self.event_receiver.is_terminated()
1387 }
1388}
1389
1390impl futures::Stream for StateEventStream {
1391 type Item = Result<StateEvent, fidl::Error>;
1392
1393 fn poll_next(
1394 mut self: std::pin::Pin<&mut Self>,
1395 cx: &mut std::task::Context<'_>,
1396 ) -> std::task::Poll<Option<Self::Item>> {
1397 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1398 &mut self.event_receiver,
1399 cx
1400 )?) {
1401 Some(buf) => std::task::Poll::Ready(Some(StateEvent::decode(buf))),
1402 None => std::task::Poll::Ready(None),
1403 }
1404 }
1405}
1406
1407#[derive(Debug)]
1408pub enum StateEvent {}
1409
1410impl StateEvent {
1411 fn decode(
1413 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1414 ) -> Result<StateEvent, fidl::Error> {
1415 let (bytes, _handles) = buf.split_mut();
1416 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1417 debug_assert_eq!(tx_header.tx_id, 0);
1418 match tx_header.ordinal {
1419 _ => Err(fidl::Error::UnknownOrdinal {
1420 ordinal: tx_header.ordinal,
1421 protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1422 }),
1423 }
1424 }
1425}
1426
1427pub struct StateRequestStream {
1429 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1430 is_terminated: bool,
1431}
1432
1433impl std::marker::Unpin for StateRequestStream {}
1434
1435impl futures::stream::FusedStream for StateRequestStream {
1436 fn is_terminated(&self) -> bool {
1437 self.is_terminated
1438 }
1439}
1440
1441impl fidl::endpoints::RequestStream for StateRequestStream {
1442 type Protocol = StateMarker;
1443 type ControlHandle = StateControlHandle;
1444
1445 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1446 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1447 }
1448
1449 fn control_handle(&self) -> Self::ControlHandle {
1450 StateControlHandle { inner: self.inner.clone() }
1451 }
1452
1453 fn into_inner(
1454 self,
1455 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1456 {
1457 (self.inner, self.is_terminated)
1458 }
1459
1460 fn from_inner(
1461 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1462 is_terminated: bool,
1463 ) -> Self {
1464 Self { inner, is_terminated }
1465 }
1466}
1467
1468impl futures::Stream for StateRequestStream {
1469 type Item = Result<StateRequest, fidl::Error>;
1470
1471 fn poll_next(
1472 mut self: std::pin::Pin<&mut Self>,
1473 cx: &mut std::task::Context<'_>,
1474 ) -> std::task::Poll<Option<Self::Item>> {
1475 let this = &mut *self;
1476 if this.inner.check_shutdown(cx) {
1477 this.is_terminated = true;
1478 return std::task::Poll::Ready(None);
1479 }
1480 if this.is_terminated {
1481 panic!("polled StateRequestStream after completion");
1482 }
1483 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1484 |bytes, handles| {
1485 match this.inner.channel().read_etc(cx, bytes, handles) {
1486 std::task::Poll::Ready(Ok(())) => {}
1487 std::task::Poll::Pending => return std::task::Poll::Pending,
1488 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1489 this.is_terminated = true;
1490 return std::task::Poll::Ready(None);
1491 }
1492 std::task::Poll::Ready(Err(e)) => {
1493 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1494 e.into(),
1495 ))));
1496 }
1497 }
1498
1499 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1501
1502 std::task::Poll::Ready(Some(match header.ordinal {
1503 0x1541bc37d2d1dfb0 => {
1504 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1505 let mut req = fidl::new_empty!(
1506 StateResolveRequest,
1507 fidl::encoding::DefaultFuchsiaResourceDialect
1508 );
1509 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateResolveRequest>(&header, _body_bytes, handles, &mut req)?;
1510 let control_handle = StateControlHandle { inner: this.inner.clone() };
1511 Ok(StateRequest::Resolve {
1512 destination: req.destination,
1513
1514 responder: StateResolveResponder {
1515 control_handle: std::mem::ManuallyDrop::new(control_handle),
1516 tx_id: header.tx_id,
1517 },
1518 })
1519 }
1520 0x3a37608b6851f75c => {
1521 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1522 let mut req = fidl::new_empty!(
1523 StateResolve2Request,
1524 fidl::encoding::DefaultFuchsiaResourceDialect
1525 );
1526 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateResolve2Request>(&header, _body_bytes, handles, &mut req)?;
1527 let control_handle = StateControlHandle { inner: this.inner.clone() };
1528 Ok(StateRequest::Resolve2 {
1529 destination: req.destination,
1530 options: req.options,
1531
1532 responder: StateResolve2Responder {
1533 control_handle: std::mem::ManuallyDrop::new(control_handle),
1534 tx_id: header.tx_id,
1535 },
1536 })
1537 }
1538 0x6fed5423c7ce421a => {
1539 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1540 let mut req = fidl::new_empty!(
1541 StateGetRouteTableNameRequest,
1542 fidl::encoding::DefaultFuchsiaResourceDialect
1543 );
1544 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateGetRouteTableNameRequest>(&header, _body_bytes, handles, &mut req)?;
1545 let control_handle = StateControlHandle { inner: this.inner.clone() };
1546 Ok(StateRequest::GetRouteTableName {
1547 table_id: req.table_id,
1548
1549 responder: StateGetRouteTableNameResponder {
1550 control_handle: std::mem::ManuallyDrop::new(control_handle),
1551 tx_id: header.tx_id,
1552 },
1553 })
1554 }
1555 _ => Err(fidl::Error::UnknownOrdinal {
1556 ordinal: header.ordinal,
1557 protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1558 }),
1559 }))
1560 },
1561 )
1562 }
1563}
1564
1565#[derive(Debug)]
1567pub enum StateRequest {
1568 Resolve { destination: fidl_fuchsia_net::IpAddress, responder: StateResolveResponder },
1577 Resolve2 {
1587 destination: fidl_fuchsia_net::IpAddress,
1588 options: ResolveOptions,
1589 responder: StateResolve2Responder,
1590 },
1591 GetRouteTableName { table_id: u32, responder: StateGetRouteTableNameResponder },
1598}
1599
1600impl StateRequest {
1601 #[allow(irrefutable_let_patterns)]
1602 pub fn into_resolve(self) -> Option<(fidl_fuchsia_net::IpAddress, StateResolveResponder)> {
1603 if let StateRequest::Resolve { destination, responder } = self {
1604 Some((destination, responder))
1605 } else {
1606 None
1607 }
1608 }
1609
1610 #[allow(irrefutable_let_patterns)]
1611 pub fn into_resolve2(
1612 self,
1613 ) -> Option<(fidl_fuchsia_net::IpAddress, ResolveOptions, StateResolve2Responder)> {
1614 if let StateRequest::Resolve2 { destination, options, responder } = self {
1615 Some((destination, options, responder))
1616 } else {
1617 None
1618 }
1619 }
1620
1621 #[allow(irrefutable_let_patterns)]
1622 pub fn into_get_route_table_name(self) -> Option<(u32, StateGetRouteTableNameResponder)> {
1623 if let StateRequest::GetRouteTableName { table_id, responder } = self {
1624 Some((table_id, responder))
1625 } else {
1626 None
1627 }
1628 }
1629
1630 pub fn method_name(&self) -> &'static str {
1632 match *self {
1633 StateRequest::Resolve { .. } => "resolve",
1634 StateRequest::Resolve2 { .. } => "resolve2",
1635 StateRequest::GetRouteTableName { .. } => "get_route_table_name",
1636 }
1637 }
1638}
1639
1640#[derive(Debug, Clone)]
1641pub struct StateControlHandle {
1642 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1643}
1644
1645impl StateControlHandle {
1646 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1647 self.inner.shutdown_with_epitaph(status.into())
1648 }
1649}
1650
1651impl fidl::endpoints::ControlHandle for StateControlHandle {
1652 fn shutdown(&self) {
1653 self.inner.shutdown()
1654 }
1655
1656 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1657 self.inner.shutdown_with_epitaph(status)
1658 }
1659
1660 fn is_closed(&self) -> bool {
1661 self.inner.channel().is_closed()
1662 }
1663 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1664 self.inner.channel().on_closed()
1665 }
1666
1667 #[cfg(target_os = "fuchsia")]
1668 fn signal_peer(
1669 &self,
1670 clear_mask: zx::Signals,
1671 set_mask: zx::Signals,
1672 ) -> Result<(), zx_status::Status> {
1673 use fidl::Peered;
1674 self.inner.channel().signal_peer(clear_mask, set_mask)
1675 }
1676}
1677
1678impl StateControlHandle {}
1679
1680#[must_use = "FIDL methods require a response to be sent"]
1681#[derive(Debug)]
1682pub struct StateResolveResponder {
1683 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1684 tx_id: u32,
1685}
1686
1687impl std::ops::Drop for StateResolveResponder {
1691 fn drop(&mut self) {
1692 self.control_handle.shutdown();
1693 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1695 }
1696}
1697
1698impl fidl::endpoints::Responder for StateResolveResponder {
1699 type ControlHandle = StateControlHandle;
1700
1701 fn control_handle(&self) -> &StateControlHandle {
1702 &self.control_handle
1703 }
1704
1705 fn drop_without_shutdown(mut self) {
1706 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1708 std::mem::forget(self);
1710 }
1711}
1712
1713impl StateResolveResponder {
1714 pub fn send(self, mut result: Result<&Resolved, i32>) -> Result<(), fidl::Error> {
1718 let _result = self.send_raw(result);
1719 if _result.is_err() {
1720 self.control_handle.shutdown();
1721 }
1722 self.drop_without_shutdown();
1723 _result
1724 }
1725
1726 pub fn send_no_shutdown_on_err(
1728 self,
1729 mut result: Result<&Resolved, i32>,
1730 ) -> Result<(), fidl::Error> {
1731 let _result = self.send_raw(result);
1732 self.drop_without_shutdown();
1733 _result
1734 }
1735
1736 fn send_raw(&self, mut result: Result<&Resolved, i32>) -> Result<(), fidl::Error> {
1737 self.control_handle.inner.send::<fidl::encoding::ResultType<StateResolveResponse, i32>>(
1738 result.map(|result| (result,)),
1739 self.tx_id,
1740 0x1541bc37d2d1dfb0,
1741 fidl::encoding::DynamicFlags::empty(),
1742 )
1743 }
1744}
1745
1746#[must_use = "FIDL methods require a response to be sent"]
1747#[derive(Debug)]
1748pub struct StateResolve2Responder {
1749 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1750 tx_id: u32,
1751}
1752
1753impl std::ops::Drop for StateResolve2Responder {
1757 fn drop(&mut self) {
1758 self.control_handle.shutdown();
1759 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1761 }
1762}
1763
1764impl fidl::endpoints::Responder for StateResolve2Responder {
1765 type ControlHandle = StateControlHandle;
1766
1767 fn control_handle(&self) -> &StateControlHandle {
1768 &self.control_handle
1769 }
1770
1771 fn drop_without_shutdown(mut self) {
1772 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1774 std::mem::forget(self);
1776 }
1777}
1778
1779impl StateResolve2Responder {
1780 pub fn send(self, mut result: Result<&ResolveResult, ResolveError>) -> Result<(), fidl::Error> {
1784 let _result = self.send_raw(result);
1785 if _result.is_err() {
1786 self.control_handle.shutdown();
1787 }
1788 self.drop_without_shutdown();
1789 _result
1790 }
1791
1792 pub fn send_no_shutdown_on_err(
1794 self,
1795 mut result: Result<&ResolveResult, ResolveError>,
1796 ) -> Result<(), fidl::Error> {
1797 let _result = self.send_raw(result);
1798 self.drop_without_shutdown();
1799 _result
1800 }
1801
1802 fn send_raw(
1803 &self,
1804 mut result: Result<&ResolveResult, ResolveError>,
1805 ) -> Result<(), fidl::Error> {
1806 self.control_handle
1807 .inner
1808 .send::<fidl::encoding::ResultType<StateResolve2Response, ResolveError>>(
1809 result.map(|result| (result,)),
1810 self.tx_id,
1811 0x3a37608b6851f75c,
1812 fidl::encoding::DynamicFlags::empty(),
1813 )
1814 }
1815}
1816
1817#[must_use = "FIDL methods require a response to be sent"]
1818#[derive(Debug)]
1819pub struct StateGetRouteTableNameResponder {
1820 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1821 tx_id: u32,
1822}
1823
1824impl std::ops::Drop for StateGetRouteTableNameResponder {
1828 fn drop(&mut self) {
1829 self.control_handle.shutdown();
1830 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1832 }
1833}
1834
1835impl fidl::endpoints::Responder for StateGetRouteTableNameResponder {
1836 type ControlHandle = StateControlHandle;
1837
1838 fn control_handle(&self) -> &StateControlHandle {
1839 &self.control_handle
1840 }
1841
1842 fn drop_without_shutdown(mut self) {
1843 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1845 std::mem::forget(self);
1847 }
1848}
1849
1850impl StateGetRouteTableNameResponder {
1851 pub fn send(
1855 self,
1856 mut result: Result<&str, StateGetRouteTableNameError>,
1857 ) -> Result<(), fidl::Error> {
1858 let _result = self.send_raw(result);
1859 if _result.is_err() {
1860 self.control_handle.shutdown();
1861 }
1862 self.drop_without_shutdown();
1863 _result
1864 }
1865
1866 pub fn send_no_shutdown_on_err(
1868 self,
1869 mut result: Result<&str, StateGetRouteTableNameError>,
1870 ) -> Result<(), fidl::Error> {
1871 let _result = self.send_raw(result);
1872 self.drop_without_shutdown();
1873 _result
1874 }
1875
1876 fn send_raw(
1877 &self,
1878 mut result: Result<&str, StateGetRouteTableNameError>,
1879 ) -> Result<(), fidl::Error> {
1880 self.control_handle.inner.send::<fidl::encoding::ResultType<
1881 StateGetRouteTableNameResponse,
1882 StateGetRouteTableNameError,
1883 >>(
1884 result.map(|table_name| (table_name,)),
1885 self.tx_id,
1886 0x6fed5423c7ce421a,
1887 fidl::encoding::DynamicFlags::empty(),
1888 )
1889 }
1890}
1891
1892#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1893pub struct StateV4Marker;
1894
1895impl fidl::endpoints::ProtocolMarker for StateV4Marker {
1896 type Proxy = StateV4Proxy;
1897 type RequestStream = StateV4RequestStream;
1898 #[cfg(target_os = "fuchsia")]
1899 type SynchronousProxy = StateV4SynchronousProxy;
1900
1901 const DEBUG_NAME: &'static str = "fuchsia.net.routes.StateV4";
1902}
1903impl fidl::endpoints::DiscoverableProtocolMarker for StateV4Marker {}
1904
1905pub trait StateV4ProxyInterface: Send + Sync {
1906 fn r#get_watcher_v4(
1907 &self,
1908 watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
1909 options: &WatcherOptionsV4,
1910 ) -> Result<(), fidl::Error>;
1911 fn r#get_rule_watcher_v4(
1912 &self,
1913 watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
1914 options: &RuleWatcherOptionsV4,
1915 ) -> Result<(), fidl::Error>;
1916}
1917#[derive(Debug)]
1918#[cfg(target_os = "fuchsia")]
1919pub struct StateV4SynchronousProxy {
1920 client: fidl::client::sync::Client,
1921}
1922
1923#[cfg(target_os = "fuchsia")]
1924impl fidl::endpoints::SynchronousProxy for StateV4SynchronousProxy {
1925 type Proxy = StateV4Proxy;
1926 type Protocol = StateV4Marker;
1927
1928 fn from_channel(inner: fidl::Channel) -> Self {
1929 Self::new(inner)
1930 }
1931
1932 fn into_channel(self) -> fidl::Channel {
1933 self.client.into_channel()
1934 }
1935
1936 fn as_channel(&self) -> &fidl::Channel {
1937 self.client.as_channel()
1938 }
1939}
1940
1941#[cfg(target_os = "fuchsia")]
1942impl StateV4SynchronousProxy {
1943 pub fn new(channel: fidl::Channel) -> Self {
1944 Self { client: fidl::client::sync::Client::new(channel) }
1945 }
1946
1947 pub fn into_channel(self) -> fidl::Channel {
1948 self.client.into_channel()
1949 }
1950
1951 pub fn wait_for_event(
1954 &self,
1955 deadline: zx::MonotonicInstant,
1956 ) -> Result<StateV4Event, fidl::Error> {
1957 StateV4Event::decode(self.client.wait_for_event::<StateV4Marker>(deadline)?)
1958 }
1959
1960 pub fn r#get_watcher_v4(
1965 &self,
1966 mut watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
1967 mut options: &WatcherOptionsV4,
1968 ) -> Result<(), fidl::Error> {
1969 self.client.send::<StateV4GetWatcherV4Request>(
1970 (watcher, options),
1971 0x30dcbe770492c20a,
1972 fidl::encoding::DynamicFlags::empty(),
1973 )
1974 }
1975
1976 pub fn r#get_rule_watcher_v4(
1981 &self,
1982 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
1983 mut options: &RuleWatcherOptionsV4,
1984 ) -> Result<(), fidl::Error> {
1985 self.client.send::<StateV4GetRuleWatcherV4Request>(
1986 (watcher, options),
1987 0x2bbcc7012b5147a1,
1988 fidl::encoding::DynamicFlags::empty(),
1989 )
1990 }
1991}
1992
1993#[cfg(target_os = "fuchsia")]
1994impl From<StateV4SynchronousProxy> for zx::NullableHandle {
1995 fn from(value: StateV4SynchronousProxy) -> Self {
1996 value.into_channel().into()
1997 }
1998}
1999
2000#[cfg(target_os = "fuchsia")]
2001impl From<fidl::Channel> for StateV4SynchronousProxy {
2002 fn from(value: fidl::Channel) -> Self {
2003 Self::new(value)
2004 }
2005}
2006
2007#[cfg(target_os = "fuchsia")]
2008impl fidl::endpoints::FromClient for StateV4SynchronousProxy {
2009 type Protocol = StateV4Marker;
2010
2011 fn from_client(value: fidl::endpoints::ClientEnd<StateV4Marker>) -> Self {
2012 Self::new(value.into_channel())
2013 }
2014}
2015
2016#[derive(Debug, Clone)]
2017pub struct StateV4Proxy {
2018 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2019}
2020
2021impl fidl::endpoints::Proxy for StateV4Proxy {
2022 type Protocol = StateV4Marker;
2023
2024 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2025 Self::new(inner)
2026 }
2027
2028 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2029 self.client.into_channel().map_err(|client| Self { client })
2030 }
2031
2032 fn as_channel(&self) -> &::fidl::AsyncChannel {
2033 self.client.as_channel()
2034 }
2035}
2036
2037impl StateV4Proxy {
2038 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2040 let protocol_name = <StateV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2041 Self { client: fidl::client::Client::new(channel, protocol_name) }
2042 }
2043
2044 pub fn take_event_stream(&self) -> StateV4EventStream {
2050 StateV4EventStream { event_receiver: self.client.take_event_receiver() }
2051 }
2052
2053 pub fn r#get_watcher_v4(
2058 &self,
2059 mut watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
2060 mut options: &WatcherOptionsV4,
2061 ) -> Result<(), fidl::Error> {
2062 StateV4ProxyInterface::r#get_watcher_v4(self, watcher, options)
2063 }
2064
2065 pub fn r#get_rule_watcher_v4(
2070 &self,
2071 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
2072 mut options: &RuleWatcherOptionsV4,
2073 ) -> Result<(), fidl::Error> {
2074 StateV4ProxyInterface::r#get_rule_watcher_v4(self, watcher, options)
2075 }
2076}
2077
2078impl StateV4ProxyInterface for StateV4Proxy {
2079 fn r#get_watcher_v4(
2080 &self,
2081 mut watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
2082 mut options: &WatcherOptionsV4,
2083 ) -> Result<(), fidl::Error> {
2084 self.client.send::<StateV4GetWatcherV4Request>(
2085 (watcher, options),
2086 0x30dcbe770492c20a,
2087 fidl::encoding::DynamicFlags::empty(),
2088 )
2089 }
2090
2091 fn r#get_rule_watcher_v4(
2092 &self,
2093 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
2094 mut options: &RuleWatcherOptionsV4,
2095 ) -> Result<(), fidl::Error> {
2096 self.client.send::<StateV4GetRuleWatcherV4Request>(
2097 (watcher, options),
2098 0x2bbcc7012b5147a1,
2099 fidl::encoding::DynamicFlags::empty(),
2100 )
2101 }
2102}
2103
2104pub struct StateV4EventStream {
2105 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2106}
2107
2108impl std::marker::Unpin for StateV4EventStream {}
2109
2110impl futures::stream::FusedStream for StateV4EventStream {
2111 fn is_terminated(&self) -> bool {
2112 self.event_receiver.is_terminated()
2113 }
2114}
2115
2116impl futures::Stream for StateV4EventStream {
2117 type Item = Result<StateV4Event, fidl::Error>;
2118
2119 fn poll_next(
2120 mut self: std::pin::Pin<&mut Self>,
2121 cx: &mut std::task::Context<'_>,
2122 ) -> std::task::Poll<Option<Self::Item>> {
2123 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2124 &mut self.event_receiver,
2125 cx
2126 )?) {
2127 Some(buf) => std::task::Poll::Ready(Some(StateV4Event::decode(buf))),
2128 None => std::task::Poll::Ready(None),
2129 }
2130 }
2131}
2132
2133#[derive(Debug)]
2134pub enum StateV4Event {}
2135
2136impl StateV4Event {
2137 fn decode(
2139 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2140 ) -> Result<StateV4Event, fidl::Error> {
2141 let (bytes, _handles) = buf.split_mut();
2142 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2143 debug_assert_eq!(tx_header.tx_id, 0);
2144 match tx_header.ordinal {
2145 _ => Err(fidl::Error::UnknownOrdinal {
2146 ordinal: tx_header.ordinal,
2147 protocol_name: <StateV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2148 }),
2149 }
2150 }
2151}
2152
2153pub struct StateV4RequestStream {
2155 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2156 is_terminated: bool,
2157}
2158
2159impl std::marker::Unpin for StateV4RequestStream {}
2160
2161impl futures::stream::FusedStream for StateV4RequestStream {
2162 fn is_terminated(&self) -> bool {
2163 self.is_terminated
2164 }
2165}
2166
2167impl fidl::endpoints::RequestStream for StateV4RequestStream {
2168 type Protocol = StateV4Marker;
2169 type ControlHandle = StateV4ControlHandle;
2170
2171 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2172 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2173 }
2174
2175 fn control_handle(&self) -> Self::ControlHandle {
2176 StateV4ControlHandle { inner: self.inner.clone() }
2177 }
2178
2179 fn into_inner(
2180 self,
2181 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2182 {
2183 (self.inner, self.is_terminated)
2184 }
2185
2186 fn from_inner(
2187 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2188 is_terminated: bool,
2189 ) -> Self {
2190 Self { inner, is_terminated }
2191 }
2192}
2193
2194impl futures::Stream for StateV4RequestStream {
2195 type Item = Result<StateV4Request, fidl::Error>;
2196
2197 fn poll_next(
2198 mut self: std::pin::Pin<&mut Self>,
2199 cx: &mut std::task::Context<'_>,
2200 ) -> std::task::Poll<Option<Self::Item>> {
2201 let this = &mut *self;
2202 if this.inner.check_shutdown(cx) {
2203 this.is_terminated = true;
2204 return std::task::Poll::Ready(None);
2205 }
2206 if this.is_terminated {
2207 panic!("polled StateV4RequestStream after completion");
2208 }
2209 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2210 |bytes, handles| {
2211 match this.inner.channel().read_etc(cx, bytes, handles) {
2212 std::task::Poll::Ready(Ok(())) => {}
2213 std::task::Poll::Pending => return std::task::Poll::Pending,
2214 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2215 this.is_terminated = true;
2216 return std::task::Poll::Ready(None);
2217 }
2218 std::task::Poll::Ready(Err(e)) => {
2219 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2220 e.into(),
2221 ))));
2222 }
2223 }
2224
2225 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2227
2228 std::task::Poll::Ready(Some(match header.ordinal {
2229 0x30dcbe770492c20a => {
2230 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2231 let mut req = fidl::new_empty!(
2232 StateV4GetWatcherV4Request,
2233 fidl::encoding::DefaultFuchsiaResourceDialect
2234 );
2235 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateV4GetWatcherV4Request>(&header, _body_bytes, handles, &mut req)?;
2236 let control_handle = StateV4ControlHandle { inner: this.inner.clone() };
2237 Ok(StateV4Request::GetWatcherV4 {
2238 watcher: req.watcher,
2239 options: req.options,
2240
2241 control_handle,
2242 })
2243 }
2244 0x2bbcc7012b5147a1 => {
2245 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2246 let mut req = fidl::new_empty!(
2247 StateV4GetRuleWatcherV4Request,
2248 fidl::encoding::DefaultFuchsiaResourceDialect
2249 );
2250 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateV4GetRuleWatcherV4Request>(&header, _body_bytes, handles, &mut req)?;
2251 let control_handle = StateV4ControlHandle { inner: this.inner.clone() };
2252 Ok(StateV4Request::GetRuleWatcherV4 {
2253 watcher: req.watcher,
2254 options: req.options,
2255
2256 control_handle,
2257 })
2258 }
2259 _ => Err(fidl::Error::UnknownOrdinal {
2260 ordinal: header.ordinal,
2261 protocol_name:
2262 <StateV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2263 }),
2264 }))
2265 },
2266 )
2267 }
2268}
2269
2270#[derive(Debug)]
2272pub enum StateV4Request {
2273 GetWatcherV4 {
2278 watcher: fidl::endpoints::ServerEnd<WatcherV4Marker>,
2279 options: WatcherOptionsV4,
2280 control_handle: StateV4ControlHandle,
2281 },
2282 GetRuleWatcherV4 {
2287 watcher: fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
2288 options: RuleWatcherOptionsV4,
2289 control_handle: StateV4ControlHandle,
2290 },
2291}
2292
2293impl StateV4Request {
2294 #[allow(irrefutable_let_patterns)]
2295 pub fn into_get_watcher_v4(
2296 self,
2297 ) -> Option<(fidl::endpoints::ServerEnd<WatcherV4Marker>, WatcherOptionsV4, StateV4ControlHandle)>
2298 {
2299 if let StateV4Request::GetWatcherV4 { watcher, options, control_handle } = self {
2300 Some((watcher, options, control_handle))
2301 } else {
2302 None
2303 }
2304 }
2305
2306 #[allow(irrefutable_let_patterns)]
2307 pub fn into_get_rule_watcher_v4(
2308 self,
2309 ) -> Option<(
2310 fidl::endpoints::ServerEnd<RuleWatcherV4Marker>,
2311 RuleWatcherOptionsV4,
2312 StateV4ControlHandle,
2313 )> {
2314 if let StateV4Request::GetRuleWatcherV4 { watcher, options, control_handle } = self {
2315 Some((watcher, options, control_handle))
2316 } else {
2317 None
2318 }
2319 }
2320
2321 pub fn method_name(&self) -> &'static str {
2323 match *self {
2324 StateV4Request::GetWatcherV4 { .. } => "get_watcher_v4",
2325 StateV4Request::GetRuleWatcherV4 { .. } => "get_rule_watcher_v4",
2326 }
2327 }
2328}
2329
2330#[derive(Debug, Clone)]
2331pub struct StateV4ControlHandle {
2332 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2333}
2334
2335impl StateV4ControlHandle {
2336 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2337 self.inner.shutdown_with_epitaph(status.into())
2338 }
2339}
2340
2341impl fidl::endpoints::ControlHandle for StateV4ControlHandle {
2342 fn shutdown(&self) {
2343 self.inner.shutdown()
2344 }
2345
2346 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2347 self.inner.shutdown_with_epitaph(status)
2348 }
2349
2350 fn is_closed(&self) -> bool {
2351 self.inner.channel().is_closed()
2352 }
2353 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2354 self.inner.channel().on_closed()
2355 }
2356
2357 #[cfg(target_os = "fuchsia")]
2358 fn signal_peer(
2359 &self,
2360 clear_mask: zx::Signals,
2361 set_mask: zx::Signals,
2362 ) -> Result<(), zx_status::Status> {
2363 use fidl::Peered;
2364 self.inner.channel().signal_peer(clear_mask, set_mask)
2365 }
2366}
2367
2368impl StateV4ControlHandle {}
2369
2370#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2371pub struct StateV6Marker;
2372
2373impl fidl::endpoints::ProtocolMarker for StateV6Marker {
2374 type Proxy = StateV6Proxy;
2375 type RequestStream = StateV6RequestStream;
2376 #[cfg(target_os = "fuchsia")]
2377 type SynchronousProxy = StateV6SynchronousProxy;
2378
2379 const DEBUG_NAME: &'static str = "fuchsia.net.routes.StateV6";
2380}
2381impl fidl::endpoints::DiscoverableProtocolMarker for StateV6Marker {}
2382
2383pub trait StateV6ProxyInterface: Send + Sync {
2384 fn r#get_watcher_v6(
2385 &self,
2386 watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2387 options: &WatcherOptionsV6,
2388 ) -> Result<(), fidl::Error>;
2389 fn r#get_rule_watcher_v6(
2390 &self,
2391 watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2392 options: &RuleWatcherOptionsV6,
2393 ) -> Result<(), fidl::Error>;
2394}
2395#[derive(Debug)]
2396#[cfg(target_os = "fuchsia")]
2397pub struct StateV6SynchronousProxy {
2398 client: fidl::client::sync::Client,
2399}
2400
2401#[cfg(target_os = "fuchsia")]
2402impl fidl::endpoints::SynchronousProxy for StateV6SynchronousProxy {
2403 type Proxy = StateV6Proxy;
2404 type Protocol = StateV6Marker;
2405
2406 fn from_channel(inner: fidl::Channel) -> Self {
2407 Self::new(inner)
2408 }
2409
2410 fn into_channel(self) -> fidl::Channel {
2411 self.client.into_channel()
2412 }
2413
2414 fn as_channel(&self) -> &fidl::Channel {
2415 self.client.as_channel()
2416 }
2417}
2418
2419#[cfg(target_os = "fuchsia")]
2420impl StateV6SynchronousProxy {
2421 pub fn new(channel: fidl::Channel) -> Self {
2422 Self { client: fidl::client::sync::Client::new(channel) }
2423 }
2424
2425 pub fn into_channel(self) -> fidl::Channel {
2426 self.client.into_channel()
2427 }
2428
2429 pub fn wait_for_event(
2432 &self,
2433 deadline: zx::MonotonicInstant,
2434 ) -> Result<StateV6Event, fidl::Error> {
2435 StateV6Event::decode(self.client.wait_for_event::<StateV6Marker>(deadline)?)
2436 }
2437
2438 pub fn r#get_watcher_v6(
2443 &self,
2444 mut watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2445 mut options: &WatcherOptionsV6,
2446 ) -> Result<(), fidl::Error> {
2447 self.client.send::<StateV6GetWatcherV6Request>(
2448 (watcher, options),
2449 0x777e3c40c98f586,
2450 fidl::encoding::DynamicFlags::empty(),
2451 )
2452 }
2453
2454 pub fn r#get_rule_watcher_v6(
2459 &self,
2460 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2461 mut options: &RuleWatcherOptionsV6,
2462 ) -> Result<(), fidl::Error> {
2463 self.client.send::<StateV6GetRuleWatcherV6Request>(
2464 (watcher, options),
2465 0x91433a23d464f6,
2466 fidl::encoding::DynamicFlags::empty(),
2467 )
2468 }
2469}
2470
2471#[cfg(target_os = "fuchsia")]
2472impl From<StateV6SynchronousProxy> for zx::NullableHandle {
2473 fn from(value: StateV6SynchronousProxy) -> Self {
2474 value.into_channel().into()
2475 }
2476}
2477
2478#[cfg(target_os = "fuchsia")]
2479impl From<fidl::Channel> for StateV6SynchronousProxy {
2480 fn from(value: fidl::Channel) -> Self {
2481 Self::new(value)
2482 }
2483}
2484
2485#[cfg(target_os = "fuchsia")]
2486impl fidl::endpoints::FromClient for StateV6SynchronousProxy {
2487 type Protocol = StateV6Marker;
2488
2489 fn from_client(value: fidl::endpoints::ClientEnd<StateV6Marker>) -> Self {
2490 Self::new(value.into_channel())
2491 }
2492}
2493
2494#[derive(Debug, Clone)]
2495pub struct StateV6Proxy {
2496 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2497}
2498
2499impl fidl::endpoints::Proxy for StateV6Proxy {
2500 type Protocol = StateV6Marker;
2501
2502 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2503 Self::new(inner)
2504 }
2505
2506 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2507 self.client.into_channel().map_err(|client| Self { client })
2508 }
2509
2510 fn as_channel(&self) -> &::fidl::AsyncChannel {
2511 self.client.as_channel()
2512 }
2513}
2514
2515impl StateV6Proxy {
2516 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2518 let protocol_name = <StateV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2519 Self { client: fidl::client::Client::new(channel, protocol_name) }
2520 }
2521
2522 pub fn take_event_stream(&self) -> StateV6EventStream {
2528 StateV6EventStream { event_receiver: self.client.take_event_receiver() }
2529 }
2530
2531 pub fn r#get_watcher_v6(
2536 &self,
2537 mut watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2538 mut options: &WatcherOptionsV6,
2539 ) -> Result<(), fidl::Error> {
2540 StateV6ProxyInterface::r#get_watcher_v6(self, watcher, options)
2541 }
2542
2543 pub fn r#get_rule_watcher_v6(
2548 &self,
2549 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2550 mut options: &RuleWatcherOptionsV6,
2551 ) -> Result<(), fidl::Error> {
2552 StateV6ProxyInterface::r#get_rule_watcher_v6(self, watcher, options)
2553 }
2554}
2555
2556impl StateV6ProxyInterface for StateV6Proxy {
2557 fn r#get_watcher_v6(
2558 &self,
2559 mut watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2560 mut options: &WatcherOptionsV6,
2561 ) -> Result<(), fidl::Error> {
2562 self.client.send::<StateV6GetWatcherV6Request>(
2563 (watcher, options),
2564 0x777e3c40c98f586,
2565 fidl::encoding::DynamicFlags::empty(),
2566 )
2567 }
2568
2569 fn r#get_rule_watcher_v6(
2570 &self,
2571 mut watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2572 mut options: &RuleWatcherOptionsV6,
2573 ) -> Result<(), fidl::Error> {
2574 self.client.send::<StateV6GetRuleWatcherV6Request>(
2575 (watcher, options),
2576 0x91433a23d464f6,
2577 fidl::encoding::DynamicFlags::empty(),
2578 )
2579 }
2580}
2581
2582pub struct StateV6EventStream {
2583 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2584}
2585
2586impl std::marker::Unpin for StateV6EventStream {}
2587
2588impl futures::stream::FusedStream for StateV6EventStream {
2589 fn is_terminated(&self) -> bool {
2590 self.event_receiver.is_terminated()
2591 }
2592}
2593
2594impl futures::Stream for StateV6EventStream {
2595 type Item = Result<StateV6Event, fidl::Error>;
2596
2597 fn poll_next(
2598 mut self: std::pin::Pin<&mut Self>,
2599 cx: &mut std::task::Context<'_>,
2600 ) -> std::task::Poll<Option<Self::Item>> {
2601 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2602 &mut self.event_receiver,
2603 cx
2604 )?) {
2605 Some(buf) => std::task::Poll::Ready(Some(StateV6Event::decode(buf))),
2606 None => std::task::Poll::Ready(None),
2607 }
2608 }
2609}
2610
2611#[derive(Debug)]
2612pub enum StateV6Event {}
2613
2614impl StateV6Event {
2615 fn decode(
2617 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2618 ) -> Result<StateV6Event, fidl::Error> {
2619 let (bytes, _handles) = buf.split_mut();
2620 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2621 debug_assert_eq!(tx_header.tx_id, 0);
2622 match tx_header.ordinal {
2623 _ => Err(fidl::Error::UnknownOrdinal {
2624 ordinal: tx_header.ordinal,
2625 protocol_name: <StateV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2626 }),
2627 }
2628 }
2629}
2630
2631pub struct StateV6RequestStream {
2633 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2634 is_terminated: bool,
2635}
2636
2637impl std::marker::Unpin for StateV6RequestStream {}
2638
2639impl futures::stream::FusedStream for StateV6RequestStream {
2640 fn is_terminated(&self) -> bool {
2641 self.is_terminated
2642 }
2643}
2644
2645impl fidl::endpoints::RequestStream for StateV6RequestStream {
2646 type Protocol = StateV6Marker;
2647 type ControlHandle = StateV6ControlHandle;
2648
2649 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2650 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2651 }
2652
2653 fn control_handle(&self) -> Self::ControlHandle {
2654 StateV6ControlHandle { inner: self.inner.clone() }
2655 }
2656
2657 fn into_inner(
2658 self,
2659 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2660 {
2661 (self.inner, self.is_terminated)
2662 }
2663
2664 fn from_inner(
2665 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2666 is_terminated: bool,
2667 ) -> Self {
2668 Self { inner, is_terminated }
2669 }
2670}
2671
2672impl futures::Stream for StateV6RequestStream {
2673 type Item = Result<StateV6Request, fidl::Error>;
2674
2675 fn poll_next(
2676 mut self: std::pin::Pin<&mut Self>,
2677 cx: &mut std::task::Context<'_>,
2678 ) -> std::task::Poll<Option<Self::Item>> {
2679 let this = &mut *self;
2680 if this.inner.check_shutdown(cx) {
2681 this.is_terminated = true;
2682 return std::task::Poll::Ready(None);
2683 }
2684 if this.is_terminated {
2685 panic!("polled StateV6RequestStream after completion");
2686 }
2687 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2688 |bytes, handles| {
2689 match this.inner.channel().read_etc(cx, bytes, handles) {
2690 std::task::Poll::Ready(Ok(())) => {}
2691 std::task::Poll::Pending => return std::task::Poll::Pending,
2692 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2693 this.is_terminated = true;
2694 return std::task::Poll::Ready(None);
2695 }
2696 std::task::Poll::Ready(Err(e)) => {
2697 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2698 e.into(),
2699 ))));
2700 }
2701 }
2702
2703 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2705
2706 std::task::Poll::Ready(Some(match header.ordinal {
2707 0x777e3c40c98f586 => {
2708 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2709 let mut req = fidl::new_empty!(
2710 StateV6GetWatcherV6Request,
2711 fidl::encoding::DefaultFuchsiaResourceDialect
2712 );
2713 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateV6GetWatcherV6Request>(&header, _body_bytes, handles, &mut req)?;
2714 let control_handle = StateV6ControlHandle { inner: this.inner.clone() };
2715 Ok(StateV6Request::GetWatcherV6 {
2716 watcher: req.watcher,
2717 options: req.options,
2718
2719 control_handle,
2720 })
2721 }
2722 0x91433a23d464f6 => {
2723 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2724 let mut req = fidl::new_empty!(
2725 StateV6GetRuleWatcherV6Request,
2726 fidl::encoding::DefaultFuchsiaResourceDialect
2727 );
2728 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateV6GetRuleWatcherV6Request>(&header, _body_bytes, handles, &mut req)?;
2729 let control_handle = StateV6ControlHandle { inner: this.inner.clone() };
2730 Ok(StateV6Request::GetRuleWatcherV6 {
2731 watcher: req.watcher,
2732 options: req.options,
2733
2734 control_handle,
2735 })
2736 }
2737 _ => Err(fidl::Error::UnknownOrdinal {
2738 ordinal: header.ordinal,
2739 protocol_name:
2740 <StateV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2741 }),
2742 }))
2743 },
2744 )
2745 }
2746}
2747
2748#[derive(Debug)]
2750pub enum StateV6Request {
2751 GetWatcherV6 {
2756 watcher: fidl::endpoints::ServerEnd<WatcherV6Marker>,
2757 options: WatcherOptionsV6,
2758 control_handle: StateV6ControlHandle,
2759 },
2760 GetRuleWatcherV6 {
2765 watcher: fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2766 options: RuleWatcherOptionsV6,
2767 control_handle: StateV6ControlHandle,
2768 },
2769}
2770
2771impl StateV6Request {
2772 #[allow(irrefutable_let_patterns)]
2773 pub fn into_get_watcher_v6(
2774 self,
2775 ) -> Option<(fidl::endpoints::ServerEnd<WatcherV6Marker>, WatcherOptionsV6, StateV6ControlHandle)>
2776 {
2777 if let StateV6Request::GetWatcherV6 { watcher, options, control_handle } = self {
2778 Some((watcher, options, control_handle))
2779 } else {
2780 None
2781 }
2782 }
2783
2784 #[allow(irrefutable_let_patterns)]
2785 pub fn into_get_rule_watcher_v6(
2786 self,
2787 ) -> Option<(
2788 fidl::endpoints::ServerEnd<RuleWatcherV6Marker>,
2789 RuleWatcherOptionsV6,
2790 StateV6ControlHandle,
2791 )> {
2792 if let StateV6Request::GetRuleWatcherV6 { watcher, options, control_handle } = self {
2793 Some((watcher, options, control_handle))
2794 } else {
2795 None
2796 }
2797 }
2798
2799 pub fn method_name(&self) -> &'static str {
2801 match *self {
2802 StateV6Request::GetWatcherV6 { .. } => "get_watcher_v6",
2803 StateV6Request::GetRuleWatcherV6 { .. } => "get_rule_watcher_v6",
2804 }
2805 }
2806}
2807
2808#[derive(Debug, Clone)]
2809pub struct StateV6ControlHandle {
2810 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2811}
2812
2813impl StateV6ControlHandle {
2814 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2815 self.inner.shutdown_with_epitaph(status.into())
2816 }
2817}
2818
2819impl fidl::endpoints::ControlHandle for StateV6ControlHandle {
2820 fn shutdown(&self) {
2821 self.inner.shutdown()
2822 }
2823
2824 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2825 self.inner.shutdown_with_epitaph(status)
2826 }
2827
2828 fn is_closed(&self) -> bool {
2829 self.inner.channel().is_closed()
2830 }
2831 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2832 self.inner.channel().on_closed()
2833 }
2834
2835 #[cfg(target_os = "fuchsia")]
2836 fn signal_peer(
2837 &self,
2838 clear_mask: zx::Signals,
2839 set_mask: zx::Signals,
2840 ) -> Result<(), zx_status::Status> {
2841 use fidl::Peered;
2842 self.inner.channel().signal_peer(clear_mask, set_mask)
2843 }
2844}
2845
2846impl StateV6ControlHandle {}
2847
2848#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2849pub struct WatcherV4Marker;
2850
2851impl fidl::endpoints::ProtocolMarker for WatcherV4Marker {
2852 type Proxy = WatcherV4Proxy;
2853 type RequestStream = WatcherV4RequestStream;
2854 #[cfg(target_os = "fuchsia")]
2855 type SynchronousProxy = WatcherV4SynchronousProxy;
2856
2857 const DEBUG_NAME: &'static str = "(anonymous) WatcherV4";
2858}
2859
2860pub trait WatcherV4ProxyInterface: Send + Sync {
2861 type WatchResponseFut: std::future::Future<Output = Result<Vec<EventV4>, fidl::Error>> + Send;
2862 fn r#watch(&self) -> Self::WatchResponseFut;
2863}
2864#[derive(Debug)]
2865#[cfg(target_os = "fuchsia")]
2866pub struct WatcherV4SynchronousProxy {
2867 client: fidl::client::sync::Client,
2868}
2869
2870#[cfg(target_os = "fuchsia")]
2871impl fidl::endpoints::SynchronousProxy for WatcherV4SynchronousProxy {
2872 type Proxy = WatcherV4Proxy;
2873 type Protocol = WatcherV4Marker;
2874
2875 fn from_channel(inner: fidl::Channel) -> Self {
2876 Self::new(inner)
2877 }
2878
2879 fn into_channel(self) -> fidl::Channel {
2880 self.client.into_channel()
2881 }
2882
2883 fn as_channel(&self) -> &fidl::Channel {
2884 self.client.as_channel()
2885 }
2886}
2887
2888#[cfg(target_os = "fuchsia")]
2889impl WatcherV4SynchronousProxy {
2890 pub fn new(channel: fidl::Channel) -> Self {
2891 Self { client: fidl::client::sync::Client::new(channel) }
2892 }
2893
2894 pub fn into_channel(self) -> fidl::Channel {
2895 self.client.into_channel()
2896 }
2897
2898 pub fn wait_for_event(
2901 &self,
2902 deadline: zx::MonotonicInstant,
2903 ) -> Result<WatcherV4Event, fidl::Error> {
2904 WatcherV4Event::decode(self.client.wait_for_event::<WatcherV4Marker>(deadline)?)
2905 }
2906
2907 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<EventV4>, fidl::Error> {
2928 let _response = self
2929 .client
2930 .send_query::<fidl::encoding::EmptyPayload, WatcherV4WatchResponse, WatcherV4Marker>(
2931 (),
2932 0x71f2fdee0b307ac2,
2933 fidl::encoding::DynamicFlags::empty(),
2934 ___deadline,
2935 )?;
2936 Ok(_response.events)
2937 }
2938}
2939
2940#[cfg(target_os = "fuchsia")]
2941impl From<WatcherV4SynchronousProxy> for zx::NullableHandle {
2942 fn from(value: WatcherV4SynchronousProxy) -> Self {
2943 value.into_channel().into()
2944 }
2945}
2946
2947#[cfg(target_os = "fuchsia")]
2948impl From<fidl::Channel> for WatcherV4SynchronousProxy {
2949 fn from(value: fidl::Channel) -> Self {
2950 Self::new(value)
2951 }
2952}
2953
2954#[cfg(target_os = "fuchsia")]
2955impl fidl::endpoints::FromClient for WatcherV4SynchronousProxy {
2956 type Protocol = WatcherV4Marker;
2957
2958 fn from_client(value: fidl::endpoints::ClientEnd<WatcherV4Marker>) -> Self {
2959 Self::new(value.into_channel())
2960 }
2961}
2962
2963#[derive(Debug, Clone)]
2964pub struct WatcherV4Proxy {
2965 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2966}
2967
2968impl fidl::endpoints::Proxy for WatcherV4Proxy {
2969 type Protocol = WatcherV4Marker;
2970
2971 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2972 Self::new(inner)
2973 }
2974
2975 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2976 self.client.into_channel().map_err(|client| Self { client })
2977 }
2978
2979 fn as_channel(&self) -> &::fidl::AsyncChannel {
2980 self.client.as_channel()
2981 }
2982}
2983
2984impl WatcherV4Proxy {
2985 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2987 let protocol_name = <WatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2988 Self { client: fidl::client::Client::new(channel, protocol_name) }
2989 }
2990
2991 pub fn take_event_stream(&self) -> WatcherV4EventStream {
2997 WatcherV4EventStream { event_receiver: self.client.take_event_receiver() }
2998 }
2999
3000 pub fn r#watch(
3021 &self,
3022 ) -> fidl::client::QueryResponseFut<Vec<EventV4>, fidl::encoding::DefaultFuchsiaResourceDialect>
3023 {
3024 WatcherV4ProxyInterface::r#watch(self)
3025 }
3026}
3027
3028impl WatcherV4ProxyInterface for WatcherV4Proxy {
3029 type WatchResponseFut =
3030 fidl::client::QueryResponseFut<Vec<EventV4>, fidl::encoding::DefaultFuchsiaResourceDialect>;
3031 fn r#watch(&self) -> Self::WatchResponseFut {
3032 fn _decode(
3033 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3034 ) -> Result<Vec<EventV4>, fidl::Error> {
3035 let _response = fidl::client::decode_transaction_body::<
3036 WatcherV4WatchResponse,
3037 fidl::encoding::DefaultFuchsiaResourceDialect,
3038 0x71f2fdee0b307ac2,
3039 >(_buf?)?;
3040 Ok(_response.events)
3041 }
3042 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EventV4>>(
3043 (),
3044 0x71f2fdee0b307ac2,
3045 fidl::encoding::DynamicFlags::empty(),
3046 _decode,
3047 )
3048 }
3049}
3050
3051pub struct WatcherV4EventStream {
3052 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3053}
3054
3055impl std::marker::Unpin for WatcherV4EventStream {}
3056
3057impl futures::stream::FusedStream for WatcherV4EventStream {
3058 fn is_terminated(&self) -> bool {
3059 self.event_receiver.is_terminated()
3060 }
3061}
3062
3063impl futures::Stream for WatcherV4EventStream {
3064 type Item = Result<WatcherV4Event, fidl::Error>;
3065
3066 fn poll_next(
3067 mut self: std::pin::Pin<&mut Self>,
3068 cx: &mut std::task::Context<'_>,
3069 ) -> std::task::Poll<Option<Self::Item>> {
3070 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3071 &mut self.event_receiver,
3072 cx
3073 )?) {
3074 Some(buf) => std::task::Poll::Ready(Some(WatcherV4Event::decode(buf))),
3075 None => std::task::Poll::Ready(None),
3076 }
3077 }
3078}
3079
3080#[derive(Debug)]
3081pub enum WatcherV4Event {}
3082
3083impl WatcherV4Event {
3084 fn decode(
3086 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3087 ) -> Result<WatcherV4Event, fidl::Error> {
3088 let (bytes, _handles) = buf.split_mut();
3089 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3090 debug_assert_eq!(tx_header.tx_id, 0);
3091 match tx_header.ordinal {
3092 _ => Err(fidl::Error::UnknownOrdinal {
3093 ordinal: tx_header.ordinal,
3094 protocol_name: <WatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3095 }),
3096 }
3097 }
3098}
3099
3100pub struct WatcherV4RequestStream {
3102 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3103 is_terminated: bool,
3104}
3105
3106impl std::marker::Unpin for WatcherV4RequestStream {}
3107
3108impl futures::stream::FusedStream for WatcherV4RequestStream {
3109 fn is_terminated(&self) -> bool {
3110 self.is_terminated
3111 }
3112}
3113
3114impl fidl::endpoints::RequestStream for WatcherV4RequestStream {
3115 type Protocol = WatcherV4Marker;
3116 type ControlHandle = WatcherV4ControlHandle;
3117
3118 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3119 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3120 }
3121
3122 fn control_handle(&self) -> Self::ControlHandle {
3123 WatcherV4ControlHandle { inner: self.inner.clone() }
3124 }
3125
3126 fn into_inner(
3127 self,
3128 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3129 {
3130 (self.inner, self.is_terminated)
3131 }
3132
3133 fn from_inner(
3134 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3135 is_terminated: bool,
3136 ) -> Self {
3137 Self { inner, is_terminated }
3138 }
3139}
3140
3141impl futures::Stream for WatcherV4RequestStream {
3142 type Item = Result<WatcherV4Request, fidl::Error>;
3143
3144 fn poll_next(
3145 mut self: std::pin::Pin<&mut Self>,
3146 cx: &mut std::task::Context<'_>,
3147 ) -> std::task::Poll<Option<Self::Item>> {
3148 let this = &mut *self;
3149 if this.inner.check_shutdown(cx) {
3150 this.is_terminated = true;
3151 return std::task::Poll::Ready(None);
3152 }
3153 if this.is_terminated {
3154 panic!("polled WatcherV4RequestStream after completion");
3155 }
3156 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3157 |bytes, handles| {
3158 match this.inner.channel().read_etc(cx, bytes, handles) {
3159 std::task::Poll::Ready(Ok(())) => {}
3160 std::task::Poll::Pending => return std::task::Poll::Pending,
3161 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3162 this.is_terminated = true;
3163 return std::task::Poll::Ready(None);
3164 }
3165 std::task::Poll::Ready(Err(e)) => {
3166 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3167 e.into(),
3168 ))));
3169 }
3170 }
3171
3172 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3174
3175 std::task::Poll::Ready(Some(match header.ordinal {
3176 0x71f2fdee0b307ac2 => {
3177 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3178 let mut req = fidl::new_empty!(
3179 fidl::encoding::EmptyPayload,
3180 fidl::encoding::DefaultFuchsiaResourceDialect
3181 );
3182 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3183 let control_handle = WatcherV4ControlHandle { inner: this.inner.clone() };
3184 Ok(WatcherV4Request::Watch {
3185 responder: WatcherV4WatchResponder {
3186 control_handle: std::mem::ManuallyDrop::new(control_handle),
3187 tx_id: header.tx_id,
3188 },
3189 })
3190 }
3191 _ => Err(fidl::Error::UnknownOrdinal {
3192 ordinal: header.ordinal,
3193 protocol_name:
3194 <WatcherV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3195 }),
3196 }))
3197 },
3198 )
3199 }
3200}
3201
3202#[derive(Debug)]
3204pub enum WatcherV4Request {
3205 Watch { responder: WatcherV4WatchResponder },
3226}
3227
3228impl WatcherV4Request {
3229 #[allow(irrefutable_let_patterns)]
3230 pub fn into_watch(self) -> Option<(WatcherV4WatchResponder)> {
3231 if let WatcherV4Request::Watch { responder } = self { Some((responder)) } else { None }
3232 }
3233
3234 pub fn method_name(&self) -> &'static str {
3236 match *self {
3237 WatcherV4Request::Watch { .. } => "watch",
3238 }
3239 }
3240}
3241
3242#[derive(Debug, Clone)]
3243pub struct WatcherV4ControlHandle {
3244 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3245}
3246
3247impl WatcherV4ControlHandle {
3248 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3249 self.inner.shutdown_with_epitaph(status.into())
3250 }
3251}
3252
3253impl fidl::endpoints::ControlHandle for WatcherV4ControlHandle {
3254 fn shutdown(&self) {
3255 self.inner.shutdown()
3256 }
3257
3258 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3259 self.inner.shutdown_with_epitaph(status)
3260 }
3261
3262 fn is_closed(&self) -> bool {
3263 self.inner.channel().is_closed()
3264 }
3265 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3266 self.inner.channel().on_closed()
3267 }
3268
3269 #[cfg(target_os = "fuchsia")]
3270 fn signal_peer(
3271 &self,
3272 clear_mask: zx::Signals,
3273 set_mask: zx::Signals,
3274 ) -> Result<(), zx_status::Status> {
3275 use fidl::Peered;
3276 self.inner.channel().signal_peer(clear_mask, set_mask)
3277 }
3278}
3279
3280impl WatcherV4ControlHandle {}
3281
3282#[must_use = "FIDL methods require a response to be sent"]
3283#[derive(Debug)]
3284pub struct WatcherV4WatchResponder {
3285 control_handle: std::mem::ManuallyDrop<WatcherV4ControlHandle>,
3286 tx_id: u32,
3287}
3288
3289impl std::ops::Drop for WatcherV4WatchResponder {
3293 fn drop(&mut self) {
3294 self.control_handle.shutdown();
3295 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3297 }
3298}
3299
3300impl fidl::endpoints::Responder for WatcherV4WatchResponder {
3301 type ControlHandle = WatcherV4ControlHandle;
3302
3303 fn control_handle(&self) -> &WatcherV4ControlHandle {
3304 &self.control_handle
3305 }
3306
3307 fn drop_without_shutdown(mut self) {
3308 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3310 std::mem::forget(self);
3312 }
3313}
3314
3315impl WatcherV4WatchResponder {
3316 pub fn send(self, mut events: &[EventV4]) -> Result<(), fidl::Error> {
3320 let _result = self.send_raw(events);
3321 if _result.is_err() {
3322 self.control_handle.shutdown();
3323 }
3324 self.drop_without_shutdown();
3325 _result
3326 }
3327
3328 pub fn send_no_shutdown_on_err(self, mut events: &[EventV4]) -> Result<(), fidl::Error> {
3330 let _result = self.send_raw(events);
3331 self.drop_without_shutdown();
3332 _result
3333 }
3334
3335 fn send_raw(&self, mut events: &[EventV4]) -> Result<(), fidl::Error> {
3336 self.control_handle.inner.send::<WatcherV4WatchResponse>(
3337 (events,),
3338 self.tx_id,
3339 0x71f2fdee0b307ac2,
3340 fidl::encoding::DynamicFlags::empty(),
3341 )
3342 }
3343}
3344
3345#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3346pub struct WatcherV6Marker;
3347
3348impl fidl::endpoints::ProtocolMarker for WatcherV6Marker {
3349 type Proxy = WatcherV6Proxy;
3350 type RequestStream = WatcherV6RequestStream;
3351 #[cfg(target_os = "fuchsia")]
3352 type SynchronousProxy = WatcherV6SynchronousProxy;
3353
3354 const DEBUG_NAME: &'static str = "(anonymous) WatcherV6";
3355}
3356
3357pub trait WatcherV6ProxyInterface: Send + Sync {
3358 type WatchResponseFut: std::future::Future<Output = Result<Vec<EventV6>, fidl::Error>> + Send;
3359 fn r#watch(&self) -> Self::WatchResponseFut;
3360}
3361#[derive(Debug)]
3362#[cfg(target_os = "fuchsia")]
3363pub struct WatcherV6SynchronousProxy {
3364 client: fidl::client::sync::Client,
3365}
3366
3367#[cfg(target_os = "fuchsia")]
3368impl fidl::endpoints::SynchronousProxy for WatcherV6SynchronousProxy {
3369 type Proxy = WatcherV6Proxy;
3370 type Protocol = WatcherV6Marker;
3371
3372 fn from_channel(inner: fidl::Channel) -> Self {
3373 Self::new(inner)
3374 }
3375
3376 fn into_channel(self) -> fidl::Channel {
3377 self.client.into_channel()
3378 }
3379
3380 fn as_channel(&self) -> &fidl::Channel {
3381 self.client.as_channel()
3382 }
3383}
3384
3385#[cfg(target_os = "fuchsia")]
3386impl WatcherV6SynchronousProxy {
3387 pub fn new(channel: fidl::Channel) -> Self {
3388 Self { client: fidl::client::sync::Client::new(channel) }
3389 }
3390
3391 pub fn into_channel(self) -> fidl::Channel {
3392 self.client.into_channel()
3393 }
3394
3395 pub fn wait_for_event(
3398 &self,
3399 deadline: zx::MonotonicInstant,
3400 ) -> Result<WatcherV6Event, fidl::Error> {
3401 WatcherV6Event::decode(self.client.wait_for_event::<WatcherV6Marker>(deadline)?)
3402 }
3403
3404 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<EventV6>, fidl::Error> {
3425 let _response = self
3426 .client
3427 .send_query::<fidl::encoding::EmptyPayload, WatcherV6WatchResponse, WatcherV6Marker>(
3428 (),
3429 0x82f5e48afc8811e,
3430 fidl::encoding::DynamicFlags::empty(),
3431 ___deadline,
3432 )?;
3433 Ok(_response.events)
3434 }
3435}
3436
3437#[cfg(target_os = "fuchsia")]
3438impl From<WatcherV6SynchronousProxy> for zx::NullableHandle {
3439 fn from(value: WatcherV6SynchronousProxy) -> Self {
3440 value.into_channel().into()
3441 }
3442}
3443
3444#[cfg(target_os = "fuchsia")]
3445impl From<fidl::Channel> for WatcherV6SynchronousProxy {
3446 fn from(value: fidl::Channel) -> Self {
3447 Self::new(value)
3448 }
3449}
3450
3451#[cfg(target_os = "fuchsia")]
3452impl fidl::endpoints::FromClient for WatcherV6SynchronousProxy {
3453 type Protocol = WatcherV6Marker;
3454
3455 fn from_client(value: fidl::endpoints::ClientEnd<WatcherV6Marker>) -> Self {
3456 Self::new(value.into_channel())
3457 }
3458}
3459
3460#[derive(Debug, Clone)]
3461pub struct WatcherV6Proxy {
3462 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3463}
3464
3465impl fidl::endpoints::Proxy for WatcherV6Proxy {
3466 type Protocol = WatcherV6Marker;
3467
3468 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3469 Self::new(inner)
3470 }
3471
3472 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3473 self.client.into_channel().map_err(|client| Self { client })
3474 }
3475
3476 fn as_channel(&self) -> &::fidl::AsyncChannel {
3477 self.client.as_channel()
3478 }
3479}
3480
3481impl WatcherV6Proxy {
3482 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3484 let protocol_name = <WatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3485 Self { client: fidl::client::Client::new(channel, protocol_name) }
3486 }
3487
3488 pub fn take_event_stream(&self) -> WatcherV6EventStream {
3494 WatcherV6EventStream { event_receiver: self.client.take_event_receiver() }
3495 }
3496
3497 pub fn r#watch(
3518 &self,
3519 ) -> fidl::client::QueryResponseFut<Vec<EventV6>, fidl::encoding::DefaultFuchsiaResourceDialect>
3520 {
3521 WatcherV6ProxyInterface::r#watch(self)
3522 }
3523}
3524
3525impl WatcherV6ProxyInterface for WatcherV6Proxy {
3526 type WatchResponseFut =
3527 fidl::client::QueryResponseFut<Vec<EventV6>, fidl::encoding::DefaultFuchsiaResourceDialect>;
3528 fn r#watch(&self) -> Self::WatchResponseFut {
3529 fn _decode(
3530 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3531 ) -> Result<Vec<EventV6>, fidl::Error> {
3532 let _response = fidl::client::decode_transaction_body::<
3533 WatcherV6WatchResponse,
3534 fidl::encoding::DefaultFuchsiaResourceDialect,
3535 0x82f5e48afc8811e,
3536 >(_buf?)?;
3537 Ok(_response.events)
3538 }
3539 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EventV6>>(
3540 (),
3541 0x82f5e48afc8811e,
3542 fidl::encoding::DynamicFlags::empty(),
3543 _decode,
3544 )
3545 }
3546}
3547
3548pub struct WatcherV6EventStream {
3549 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3550}
3551
3552impl std::marker::Unpin for WatcherV6EventStream {}
3553
3554impl futures::stream::FusedStream for WatcherV6EventStream {
3555 fn is_terminated(&self) -> bool {
3556 self.event_receiver.is_terminated()
3557 }
3558}
3559
3560impl futures::Stream for WatcherV6EventStream {
3561 type Item = Result<WatcherV6Event, fidl::Error>;
3562
3563 fn poll_next(
3564 mut self: std::pin::Pin<&mut Self>,
3565 cx: &mut std::task::Context<'_>,
3566 ) -> std::task::Poll<Option<Self::Item>> {
3567 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3568 &mut self.event_receiver,
3569 cx
3570 )?) {
3571 Some(buf) => std::task::Poll::Ready(Some(WatcherV6Event::decode(buf))),
3572 None => std::task::Poll::Ready(None),
3573 }
3574 }
3575}
3576
3577#[derive(Debug)]
3578pub enum WatcherV6Event {}
3579
3580impl WatcherV6Event {
3581 fn decode(
3583 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3584 ) -> Result<WatcherV6Event, fidl::Error> {
3585 let (bytes, _handles) = buf.split_mut();
3586 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3587 debug_assert_eq!(tx_header.tx_id, 0);
3588 match tx_header.ordinal {
3589 _ => Err(fidl::Error::UnknownOrdinal {
3590 ordinal: tx_header.ordinal,
3591 protocol_name: <WatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3592 }),
3593 }
3594 }
3595}
3596
3597pub struct WatcherV6RequestStream {
3599 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3600 is_terminated: bool,
3601}
3602
3603impl std::marker::Unpin for WatcherV6RequestStream {}
3604
3605impl futures::stream::FusedStream for WatcherV6RequestStream {
3606 fn is_terminated(&self) -> bool {
3607 self.is_terminated
3608 }
3609}
3610
3611impl fidl::endpoints::RequestStream for WatcherV6RequestStream {
3612 type Protocol = WatcherV6Marker;
3613 type ControlHandle = WatcherV6ControlHandle;
3614
3615 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3616 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3617 }
3618
3619 fn control_handle(&self) -> Self::ControlHandle {
3620 WatcherV6ControlHandle { inner: self.inner.clone() }
3621 }
3622
3623 fn into_inner(
3624 self,
3625 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3626 {
3627 (self.inner, self.is_terminated)
3628 }
3629
3630 fn from_inner(
3631 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3632 is_terminated: bool,
3633 ) -> Self {
3634 Self { inner, is_terminated }
3635 }
3636}
3637
3638impl futures::Stream for WatcherV6RequestStream {
3639 type Item = Result<WatcherV6Request, fidl::Error>;
3640
3641 fn poll_next(
3642 mut self: std::pin::Pin<&mut Self>,
3643 cx: &mut std::task::Context<'_>,
3644 ) -> std::task::Poll<Option<Self::Item>> {
3645 let this = &mut *self;
3646 if this.inner.check_shutdown(cx) {
3647 this.is_terminated = true;
3648 return std::task::Poll::Ready(None);
3649 }
3650 if this.is_terminated {
3651 panic!("polled WatcherV6RequestStream after completion");
3652 }
3653 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3654 |bytes, handles| {
3655 match this.inner.channel().read_etc(cx, bytes, handles) {
3656 std::task::Poll::Ready(Ok(())) => {}
3657 std::task::Poll::Pending => return std::task::Poll::Pending,
3658 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3659 this.is_terminated = true;
3660 return std::task::Poll::Ready(None);
3661 }
3662 std::task::Poll::Ready(Err(e)) => {
3663 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3664 e.into(),
3665 ))));
3666 }
3667 }
3668
3669 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3671
3672 std::task::Poll::Ready(Some(match header.ordinal {
3673 0x82f5e48afc8811e => {
3674 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3675 let mut req = fidl::new_empty!(
3676 fidl::encoding::EmptyPayload,
3677 fidl::encoding::DefaultFuchsiaResourceDialect
3678 );
3679 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3680 let control_handle = WatcherV6ControlHandle { inner: this.inner.clone() };
3681 Ok(WatcherV6Request::Watch {
3682 responder: WatcherV6WatchResponder {
3683 control_handle: std::mem::ManuallyDrop::new(control_handle),
3684 tx_id: header.tx_id,
3685 },
3686 })
3687 }
3688 _ => Err(fidl::Error::UnknownOrdinal {
3689 ordinal: header.ordinal,
3690 protocol_name:
3691 <WatcherV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3692 }),
3693 }))
3694 },
3695 )
3696 }
3697}
3698
3699#[derive(Debug)]
3701pub enum WatcherV6Request {
3702 Watch { responder: WatcherV6WatchResponder },
3723}
3724
3725impl WatcherV6Request {
3726 #[allow(irrefutable_let_patterns)]
3727 pub fn into_watch(self) -> Option<(WatcherV6WatchResponder)> {
3728 if let WatcherV6Request::Watch { responder } = self { Some((responder)) } else { None }
3729 }
3730
3731 pub fn method_name(&self) -> &'static str {
3733 match *self {
3734 WatcherV6Request::Watch { .. } => "watch",
3735 }
3736 }
3737}
3738
3739#[derive(Debug, Clone)]
3740pub struct WatcherV6ControlHandle {
3741 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3742}
3743
3744impl WatcherV6ControlHandle {
3745 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3746 self.inner.shutdown_with_epitaph(status.into())
3747 }
3748}
3749
3750impl fidl::endpoints::ControlHandle for WatcherV6ControlHandle {
3751 fn shutdown(&self) {
3752 self.inner.shutdown()
3753 }
3754
3755 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3756 self.inner.shutdown_with_epitaph(status)
3757 }
3758
3759 fn is_closed(&self) -> bool {
3760 self.inner.channel().is_closed()
3761 }
3762 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3763 self.inner.channel().on_closed()
3764 }
3765
3766 #[cfg(target_os = "fuchsia")]
3767 fn signal_peer(
3768 &self,
3769 clear_mask: zx::Signals,
3770 set_mask: zx::Signals,
3771 ) -> Result<(), zx_status::Status> {
3772 use fidl::Peered;
3773 self.inner.channel().signal_peer(clear_mask, set_mask)
3774 }
3775}
3776
3777impl WatcherV6ControlHandle {}
3778
3779#[must_use = "FIDL methods require a response to be sent"]
3780#[derive(Debug)]
3781pub struct WatcherV6WatchResponder {
3782 control_handle: std::mem::ManuallyDrop<WatcherV6ControlHandle>,
3783 tx_id: u32,
3784}
3785
3786impl std::ops::Drop for WatcherV6WatchResponder {
3790 fn drop(&mut self) {
3791 self.control_handle.shutdown();
3792 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3794 }
3795}
3796
3797impl fidl::endpoints::Responder for WatcherV6WatchResponder {
3798 type ControlHandle = WatcherV6ControlHandle;
3799
3800 fn control_handle(&self) -> &WatcherV6ControlHandle {
3801 &self.control_handle
3802 }
3803
3804 fn drop_without_shutdown(mut self) {
3805 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3807 std::mem::forget(self);
3809 }
3810}
3811
3812impl WatcherV6WatchResponder {
3813 pub fn send(self, mut events: &[EventV6]) -> Result<(), fidl::Error> {
3817 let _result = self.send_raw(events);
3818 if _result.is_err() {
3819 self.control_handle.shutdown();
3820 }
3821 self.drop_without_shutdown();
3822 _result
3823 }
3824
3825 pub fn send_no_shutdown_on_err(self, mut events: &[EventV6]) -> Result<(), fidl::Error> {
3827 let _result = self.send_raw(events);
3828 self.drop_without_shutdown();
3829 _result
3830 }
3831
3832 fn send_raw(&self, mut events: &[EventV6]) -> Result<(), fidl::Error> {
3833 self.control_handle.inner.send::<WatcherV6WatchResponse>(
3834 (events,),
3835 self.tx_id,
3836 0x82f5e48afc8811e,
3837 fidl::encoding::DynamicFlags::empty(),
3838 )
3839 }
3840}
3841
3842mod internal {
3843 use super::*;
3844
3845 impl fidl::encoding::ResourceTypeMarker for StateV4GetRuleWatcherV4Request {
3846 type Borrowed<'a> = &'a mut Self;
3847 fn take_or_borrow<'a>(
3848 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3849 ) -> Self::Borrowed<'a> {
3850 value
3851 }
3852 }
3853
3854 unsafe impl fidl::encoding::TypeMarker for StateV4GetRuleWatcherV4Request {
3855 type Owned = Self;
3856
3857 #[inline(always)]
3858 fn inline_align(_context: fidl::encoding::Context) -> usize {
3859 8
3860 }
3861
3862 #[inline(always)]
3863 fn inline_size(_context: fidl::encoding::Context) -> usize {
3864 24
3865 }
3866 }
3867
3868 unsafe impl
3869 fidl::encoding::Encode<
3870 StateV4GetRuleWatcherV4Request,
3871 fidl::encoding::DefaultFuchsiaResourceDialect,
3872 > for &mut StateV4GetRuleWatcherV4Request
3873 {
3874 #[inline]
3875 unsafe fn encode(
3876 self,
3877 encoder: &mut fidl::encoding::Encoder<
3878 '_,
3879 fidl::encoding::DefaultFuchsiaResourceDialect,
3880 >,
3881 offset: usize,
3882 _depth: fidl::encoding::Depth,
3883 ) -> fidl::Result<()> {
3884 encoder.debug_check_bounds::<StateV4GetRuleWatcherV4Request>(offset);
3885 fidl::encoding::Encode::<StateV4GetRuleWatcherV4Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3887 (
3888 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
3889 <RuleWatcherOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3890 ),
3891 encoder, offset, _depth
3892 )
3893 }
3894 }
3895 unsafe impl<
3896 T0: fidl::encoding::Encode<
3897 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV4Marker>>,
3898 fidl::encoding::DefaultFuchsiaResourceDialect,
3899 >,
3900 T1: fidl::encoding::Encode<RuleWatcherOptionsV4, fidl::encoding::DefaultFuchsiaResourceDialect>,
3901 >
3902 fidl::encoding::Encode<
3903 StateV4GetRuleWatcherV4Request,
3904 fidl::encoding::DefaultFuchsiaResourceDialect,
3905 > for (T0, T1)
3906 {
3907 #[inline]
3908 unsafe fn encode(
3909 self,
3910 encoder: &mut fidl::encoding::Encoder<
3911 '_,
3912 fidl::encoding::DefaultFuchsiaResourceDialect,
3913 >,
3914 offset: usize,
3915 depth: fidl::encoding::Depth,
3916 ) -> fidl::Result<()> {
3917 encoder.debug_check_bounds::<StateV4GetRuleWatcherV4Request>(offset);
3918 unsafe {
3921 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3922 (ptr as *mut u64).write_unaligned(0);
3923 }
3924 self.0.encode(encoder, offset + 0, depth)?;
3926 self.1.encode(encoder, offset + 8, depth)?;
3927 Ok(())
3928 }
3929 }
3930
3931 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3932 for StateV4GetRuleWatcherV4Request
3933 {
3934 #[inline(always)]
3935 fn new_empty() -> Self {
3936 Self {
3937 watcher: fidl::new_empty!(
3938 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV4Marker>>,
3939 fidl::encoding::DefaultFuchsiaResourceDialect
3940 ),
3941 options: fidl::new_empty!(
3942 RuleWatcherOptionsV4,
3943 fidl::encoding::DefaultFuchsiaResourceDialect
3944 ),
3945 }
3946 }
3947
3948 #[inline]
3949 unsafe fn decode(
3950 &mut self,
3951 decoder: &mut fidl::encoding::Decoder<
3952 '_,
3953 fidl::encoding::DefaultFuchsiaResourceDialect,
3954 >,
3955 offset: usize,
3956 _depth: fidl::encoding::Depth,
3957 ) -> fidl::Result<()> {
3958 decoder.debug_check_bounds::<Self>(offset);
3959 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3961 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3962 let mask = 0xffffffff00000000u64;
3963 let maskedval = padval & mask;
3964 if maskedval != 0 {
3965 return Err(fidl::Error::NonZeroPadding {
3966 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3967 });
3968 }
3969 fidl::decode!(
3970 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV4Marker>>,
3971 fidl::encoding::DefaultFuchsiaResourceDialect,
3972 &mut self.watcher,
3973 decoder,
3974 offset + 0,
3975 _depth
3976 )?;
3977 fidl::decode!(
3978 RuleWatcherOptionsV4,
3979 fidl::encoding::DefaultFuchsiaResourceDialect,
3980 &mut self.options,
3981 decoder,
3982 offset + 8,
3983 _depth
3984 )?;
3985 Ok(())
3986 }
3987 }
3988
3989 impl fidl::encoding::ResourceTypeMarker for StateV4GetWatcherV4Request {
3990 type Borrowed<'a> = &'a mut Self;
3991 fn take_or_borrow<'a>(
3992 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3993 ) -> Self::Borrowed<'a> {
3994 value
3995 }
3996 }
3997
3998 unsafe impl fidl::encoding::TypeMarker for StateV4GetWatcherV4Request {
3999 type Owned = Self;
4000
4001 #[inline(always)]
4002 fn inline_align(_context: fidl::encoding::Context) -> usize {
4003 8
4004 }
4005
4006 #[inline(always)]
4007 fn inline_size(_context: fidl::encoding::Context) -> usize {
4008 24
4009 }
4010 }
4011
4012 unsafe impl
4013 fidl::encoding::Encode<
4014 StateV4GetWatcherV4Request,
4015 fidl::encoding::DefaultFuchsiaResourceDialect,
4016 > for &mut StateV4GetWatcherV4Request
4017 {
4018 #[inline]
4019 unsafe fn encode(
4020 self,
4021 encoder: &mut fidl::encoding::Encoder<
4022 '_,
4023 fidl::encoding::DefaultFuchsiaResourceDialect,
4024 >,
4025 offset: usize,
4026 _depth: fidl::encoding::Depth,
4027 ) -> fidl::Result<()> {
4028 encoder.debug_check_bounds::<StateV4GetWatcherV4Request>(offset);
4029 fidl::encoding::Encode::<StateV4GetWatcherV4Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4031 (
4032 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
4033 <WatcherOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
4034 ),
4035 encoder, offset, _depth
4036 )
4037 }
4038 }
4039 unsafe impl<
4040 T0: fidl::encoding::Encode<
4041 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV4Marker>>,
4042 fidl::encoding::DefaultFuchsiaResourceDialect,
4043 >,
4044 T1: fidl::encoding::Encode<WatcherOptionsV4, fidl::encoding::DefaultFuchsiaResourceDialect>,
4045 >
4046 fidl::encoding::Encode<
4047 StateV4GetWatcherV4Request,
4048 fidl::encoding::DefaultFuchsiaResourceDialect,
4049 > for (T0, T1)
4050 {
4051 #[inline]
4052 unsafe fn encode(
4053 self,
4054 encoder: &mut fidl::encoding::Encoder<
4055 '_,
4056 fidl::encoding::DefaultFuchsiaResourceDialect,
4057 >,
4058 offset: usize,
4059 depth: fidl::encoding::Depth,
4060 ) -> fidl::Result<()> {
4061 encoder.debug_check_bounds::<StateV4GetWatcherV4Request>(offset);
4062 unsafe {
4065 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4066 (ptr as *mut u64).write_unaligned(0);
4067 }
4068 self.0.encode(encoder, offset + 0, depth)?;
4070 self.1.encode(encoder, offset + 8, depth)?;
4071 Ok(())
4072 }
4073 }
4074
4075 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4076 for StateV4GetWatcherV4Request
4077 {
4078 #[inline(always)]
4079 fn new_empty() -> Self {
4080 Self {
4081 watcher: fidl::new_empty!(
4082 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV4Marker>>,
4083 fidl::encoding::DefaultFuchsiaResourceDialect
4084 ),
4085 options: fidl::new_empty!(
4086 WatcherOptionsV4,
4087 fidl::encoding::DefaultFuchsiaResourceDialect
4088 ),
4089 }
4090 }
4091
4092 #[inline]
4093 unsafe fn decode(
4094 &mut self,
4095 decoder: &mut fidl::encoding::Decoder<
4096 '_,
4097 fidl::encoding::DefaultFuchsiaResourceDialect,
4098 >,
4099 offset: usize,
4100 _depth: fidl::encoding::Depth,
4101 ) -> fidl::Result<()> {
4102 decoder.debug_check_bounds::<Self>(offset);
4103 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4105 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4106 let mask = 0xffffffff00000000u64;
4107 let maskedval = padval & mask;
4108 if maskedval != 0 {
4109 return Err(fidl::Error::NonZeroPadding {
4110 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4111 });
4112 }
4113 fidl::decode!(
4114 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV4Marker>>,
4115 fidl::encoding::DefaultFuchsiaResourceDialect,
4116 &mut self.watcher,
4117 decoder,
4118 offset + 0,
4119 _depth
4120 )?;
4121 fidl::decode!(
4122 WatcherOptionsV4,
4123 fidl::encoding::DefaultFuchsiaResourceDialect,
4124 &mut self.options,
4125 decoder,
4126 offset + 8,
4127 _depth
4128 )?;
4129 Ok(())
4130 }
4131 }
4132
4133 impl fidl::encoding::ResourceTypeMarker for StateV6GetRuleWatcherV6Request {
4134 type Borrowed<'a> = &'a mut Self;
4135 fn take_or_borrow<'a>(
4136 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4137 ) -> Self::Borrowed<'a> {
4138 value
4139 }
4140 }
4141
4142 unsafe impl fidl::encoding::TypeMarker for StateV6GetRuleWatcherV6Request {
4143 type Owned = Self;
4144
4145 #[inline(always)]
4146 fn inline_align(_context: fidl::encoding::Context) -> usize {
4147 8
4148 }
4149
4150 #[inline(always)]
4151 fn inline_size(_context: fidl::encoding::Context) -> usize {
4152 24
4153 }
4154 }
4155
4156 unsafe impl
4157 fidl::encoding::Encode<
4158 StateV6GetRuleWatcherV6Request,
4159 fidl::encoding::DefaultFuchsiaResourceDialect,
4160 > for &mut StateV6GetRuleWatcherV6Request
4161 {
4162 #[inline]
4163 unsafe fn encode(
4164 self,
4165 encoder: &mut fidl::encoding::Encoder<
4166 '_,
4167 fidl::encoding::DefaultFuchsiaResourceDialect,
4168 >,
4169 offset: usize,
4170 _depth: fidl::encoding::Depth,
4171 ) -> fidl::Result<()> {
4172 encoder.debug_check_bounds::<StateV6GetRuleWatcherV6Request>(offset);
4173 fidl::encoding::Encode::<StateV6GetRuleWatcherV6Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4175 (
4176 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
4177 <RuleWatcherOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
4178 ),
4179 encoder, offset, _depth
4180 )
4181 }
4182 }
4183 unsafe impl<
4184 T0: fidl::encoding::Encode<
4185 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV6Marker>>,
4186 fidl::encoding::DefaultFuchsiaResourceDialect,
4187 >,
4188 T1: fidl::encoding::Encode<RuleWatcherOptionsV6, fidl::encoding::DefaultFuchsiaResourceDialect>,
4189 >
4190 fidl::encoding::Encode<
4191 StateV6GetRuleWatcherV6Request,
4192 fidl::encoding::DefaultFuchsiaResourceDialect,
4193 > for (T0, T1)
4194 {
4195 #[inline]
4196 unsafe fn encode(
4197 self,
4198 encoder: &mut fidl::encoding::Encoder<
4199 '_,
4200 fidl::encoding::DefaultFuchsiaResourceDialect,
4201 >,
4202 offset: usize,
4203 depth: fidl::encoding::Depth,
4204 ) -> fidl::Result<()> {
4205 encoder.debug_check_bounds::<StateV6GetRuleWatcherV6Request>(offset);
4206 unsafe {
4209 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4210 (ptr as *mut u64).write_unaligned(0);
4211 }
4212 self.0.encode(encoder, offset + 0, depth)?;
4214 self.1.encode(encoder, offset + 8, depth)?;
4215 Ok(())
4216 }
4217 }
4218
4219 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4220 for StateV6GetRuleWatcherV6Request
4221 {
4222 #[inline(always)]
4223 fn new_empty() -> Self {
4224 Self {
4225 watcher: fidl::new_empty!(
4226 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV6Marker>>,
4227 fidl::encoding::DefaultFuchsiaResourceDialect
4228 ),
4229 options: fidl::new_empty!(
4230 RuleWatcherOptionsV6,
4231 fidl::encoding::DefaultFuchsiaResourceDialect
4232 ),
4233 }
4234 }
4235
4236 #[inline]
4237 unsafe fn decode(
4238 &mut self,
4239 decoder: &mut fidl::encoding::Decoder<
4240 '_,
4241 fidl::encoding::DefaultFuchsiaResourceDialect,
4242 >,
4243 offset: usize,
4244 _depth: fidl::encoding::Depth,
4245 ) -> fidl::Result<()> {
4246 decoder.debug_check_bounds::<Self>(offset);
4247 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4249 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4250 let mask = 0xffffffff00000000u64;
4251 let maskedval = padval & mask;
4252 if maskedval != 0 {
4253 return Err(fidl::Error::NonZeroPadding {
4254 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4255 });
4256 }
4257 fidl::decode!(
4258 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleWatcherV6Marker>>,
4259 fidl::encoding::DefaultFuchsiaResourceDialect,
4260 &mut self.watcher,
4261 decoder,
4262 offset + 0,
4263 _depth
4264 )?;
4265 fidl::decode!(
4266 RuleWatcherOptionsV6,
4267 fidl::encoding::DefaultFuchsiaResourceDialect,
4268 &mut self.options,
4269 decoder,
4270 offset + 8,
4271 _depth
4272 )?;
4273 Ok(())
4274 }
4275 }
4276
4277 impl fidl::encoding::ResourceTypeMarker for StateV6GetWatcherV6Request {
4278 type Borrowed<'a> = &'a mut Self;
4279 fn take_or_borrow<'a>(
4280 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4281 ) -> Self::Borrowed<'a> {
4282 value
4283 }
4284 }
4285
4286 unsafe impl fidl::encoding::TypeMarker for StateV6GetWatcherV6Request {
4287 type Owned = Self;
4288
4289 #[inline(always)]
4290 fn inline_align(_context: fidl::encoding::Context) -> usize {
4291 8
4292 }
4293
4294 #[inline(always)]
4295 fn inline_size(_context: fidl::encoding::Context) -> usize {
4296 24
4297 }
4298 }
4299
4300 unsafe impl
4301 fidl::encoding::Encode<
4302 StateV6GetWatcherV6Request,
4303 fidl::encoding::DefaultFuchsiaResourceDialect,
4304 > for &mut StateV6GetWatcherV6Request
4305 {
4306 #[inline]
4307 unsafe fn encode(
4308 self,
4309 encoder: &mut fidl::encoding::Encoder<
4310 '_,
4311 fidl::encoding::DefaultFuchsiaResourceDialect,
4312 >,
4313 offset: usize,
4314 _depth: fidl::encoding::Depth,
4315 ) -> fidl::Result<()> {
4316 encoder.debug_check_bounds::<StateV6GetWatcherV6Request>(offset);
4317 fidl::encoding::Encode::<StateV6GetWatcherV6Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4319 (
4320 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
4321 <WatcherOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
4322 ),
4323 encoder, offset, _depth
4324 )
4325 }
4326 }
4327 unsafe impl<
4328 T0: fidl::encoding::Encode<
4329 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV6Marker>>,
4330 fidl::encoding::DefaultFuchsiaResourceDialect,
4331 >,
4332 T1: fidl::encoding::Encode<WatcherOptionsV6, fidl::encoding::DefaultFuchsiaResourceDialect>,
4333 >
4334 fidl::encoding::Encode<
4335 StateV6GetWatcherV6Request,
4336 fidl::encoding::DefaultFuchsiaResourceDialect,
4337 > for (T0, T1)
4338 {
4339 #[inline]
4340 unsafe fn encode(
4341 self,
4342 encoder: &mut fidl::encoding::Encoder<
4343 '_,
4344 fidl::encoding::DefaultFuchsiaResourceDialect,
4345 >,
4346 offset: usize,
4347 depth: fidl::encoding::Depth,
4348 ) -> fidl::Result<()> {
4349 encoder.debug_check_bounds::<StateV6GetWatcherV6Request>(offset);
4350 unsafe {
4353 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4354 (ptr as *mut u64).write_unaligned(0);
4355 }
4356 self.0.encode(encoder, offset + 0, depth)?;
4358 self.1.encode(encoder, offset + 8, depth)?;
4359 Ok(())
4360 }
4361 }
4362
4363 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4364 for StateV6GetWatcherV6Request
4365 {
4366 #[inline(always)]
4367 fn new_empty() -> Self {
4368 Self {
4369 watcher: fidl::new_empty!(
4370 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV6Marker>>,
4371 fidl::encoding::DefaultFuchsiaResourceDialect
4372 ),
4373 options: fidl::new_empty!(
4374 WatcherOptionsV6,
4375 fidl::encoding::DefaultFuchsiaResourceDialect
4376 ),
4377 }
4378 }
4379
4380 #[inline]
4381 unsafe fn decode(
4382 &mut self,
4383 decoder: &mut fidl::encoding::Decoder<
4384 '_,
4385 fidl::encoding::DefaultFuchsiaResourceDialect,
4386 >,
4387 offset: usize,
4388 _depth: fidl::encoding::Depth,
4389 ) -> fidl::Result<()> {
4390 decoder.debug_check_bounds::<Self>(offset);
4391 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4393 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4394 let mask = 0xffffffff00000000u64;
4395 let maskedval = padval & mask;
4396 if maskedval != 0 {
4397 return Err(fidl::Error::NonZeroPadding {
4398 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4399 });
4400 }
4401 fidl::decode!(
4402 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherV6Marker>>,
4403 fidl::encoding::DefaultFuchsiaResourceDialect,
4404 &mut self.watcher,
4405 decoder,
4406 offset + 0,
4407 _depth
4408 )?;
4409 fidl::decode!(
4410 WatcherOptionsV6,
4411 fidl::encoding::DefaultFuchsiaResourceDialect,
4412 &mut self.options,
4413 decoder,
4414 offset + 8,
4415 _depth
4416 )?;
4417 Ok(())
4418 }
4419 }
4420}