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