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_ndp__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest {
16 pub option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
17 pub params: RouterAdvertisementOptionWatcherParams,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
22{
23}
24
25#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub struct OptionWatcherMarker;
27
28impl fidl::endpoints::ProtocolMarker for OptionWatcherMarker {
29 type Proxy = OptionWatcherProxy;
30 type RequestStream = OptionWatcherRequestStream;
31 #[cfg(target_os = "fuchsia")]
32 type SynchronousProxy = OptionWatcherSynchronousProxy;
33
34 const DEBUG_NAME: &'static str = "(anonymous) OptionWatcher";
35}
36
37pub trait OptionWatcherProxyInterface: Send + Sync {
38 type ProbeResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
39 fn r#probe(&self) -> Self::ProbeResponseFut;
40 type WatchOptionsResponseFut: std::future::Future<Output = Result<(Vec<OptionWatchEntry>, u32), fidl::Error>>
41 + Send;
42 fn r#watch_options(&self) -> Self::WatchOptionsResponseFut;
43}
44#[derive(Debug)]
45#[cfg(target_os = "fuchsia")]
46pub struct OptionWatcherSynchronousProxy {
47 client: fidl::client::sync::Client,
48}
49
50#[cfg(target_os = "fuchsia")]
51impl fidl::endpoints::SynchronousProxy for OptionWatcherSynchronousProxy {
52 type Proxy = OptionWatcherProxy;
53 type Protocol = OptionWatcherMarker;
54
55 fn from_channel(inner: fidl::Channel) -> Self {
56 Self::new(inner)
57 }
58
59 fn into_channel(self) -> fidl::Channel {
60 self.client.into_channel()
61 }
62
63 fn as_channel(&self) -> &fidl::Channel {
64 self.client.as_channel()
65 }
66}
67
68#[cfg(target_os = "fuchsia")]
69impl OptionWatcherSynchronousProxy {
70 pub fn new(channel: fidl::Channel) -> Self {
71 let protocol_name = <OptionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
72 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
73 }
74
75 pub fn into_channel(self) -> fidl::Channel {
76 self.client.into_channel()
77 }
78
79 pub fn wait_for_event(
82 &self,
83 deadline: zx::MonotonicInstant,
84 ) -> Result<OptionWatcherEvent, fidl::Error> {
85 OptionWatcherEvent::decode(self.client.wait_for_event(deadline)?)
86 }
87
88 pub fn r#probe(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
96 let _response =
97 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
98 (),
99 0x11ef2cfafa567e8d,
100 fidl::encoding::DynamicFlags::empty(),
101 ___deadline,
102 )?;
103 Ok(_response)
104 }
105
106 pub fn r#watch_options(
119 &self,
120 ___deadline: zx::MonotonicInstant,
121 ) -> Result<(Vec<OptionWatchEntry>, u32), fidl::Error> {
122 let _response = self
123 .client
124 .send_query::<fidl::encoding::EmptyPayload, OptionWatcherWatchOptionsResponse>(
125 (),
126 0x6d7b8e3d3f84faf5,
127 fidl::encoding::DynamicFlags::empty(),
128 ___deadline,
129 )?;
130 Ok((_response.options, _response.dropped))
131 }
132}
133
134#[cfg(target_os = "fuchsia")]
135impl From<OptionWatcherSynchronousProxy> for zx::Handle {
136 fn from(value: OptionWatcherSynchronousProxy) -> Self {
137 value.into_channel().into()
138 }
139}
140
141#[cfg(target_os = "fuchsia")]
142impl From<fidl::Channel> for OptionWatcherSynchronousProxy {
143 fn from(value: fidl::Channel) -> Self {
144 Self::new(value)
145 }
146}
147
148#[cfg(target_os = "fuchsia")]
149impl fidl::endpoints::FromClient for OptionWatcherSynchronousProxy {
150 type Protocol = OptionWatcherMarker;
151
152 fn from_client(value: fidl::endpoints::ClientEnd<OptionWatcherMarker>) -> Self {
153 Self::new(value.into_channel())
154 }
155}
156
157#[derive(Debug, Clone)]
158pub struct OptionWatcherProxy {
159 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
160}
161
162impl fidl::endpoints::Proxy for OptionWatcherProxy {
163 type Protocol = OptionWatcherMarker;
164
165 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
166 Self::new(inner)
167 }
168
169 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
170 self.client.into_channel().map_err(|client| Self { client })
171 }
172
173 fn as_channel(&self) -> &::fidl::AsyncChannel {
174 self.client.as_channel()
175 }
176}
177
178impl OptionWatcherProxy {
179 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
181 let protocol_name = <OptionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
182 Self { client: fidl::client::Client::new(channel, protocol_name) }
183 }
184
185 pub fn take_event_stream(&self) -> OptionWatcherEventStream {
191 OptionWatcherEventStream { event_receiver: self.client.take_event_receiver() }
192 }
193
194 pub fn r#probe(
202 &self,
203 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
204 OptionWatcherProxyInterface::r#probe(self)
205 }
206
207 pub fn r#watch_options(
220 &self,
221 ) -> fidl::client::QueryResponseFut<
222 (Vec<OptionWatchEntry>, u32),
223 fidl::encoding::DefaultFuchsiaResourceDialect,
224 > {
225 OptionWatcherProxyInterface::r#watch_options(self)
226 }
227}
228
229impl OptionWatcherProxyInterface for OptionWatcherProxy {
230 type ProbeResponseFut =
231 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
232 fn r#probe(&self) -> Self::ProbeResponseFut {
233 fn _decode(
234 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
235 ) -> Result<(), fidl::Error> {
236 let _response = fidl::client::decode_transaction_body::<
237 fidl::encoding::EmptyPayload,
238 fidl::encoding::DefaultFuchsiaResourceDialect,
239 0x11ef2cfafa567e8d,
240 >(_buf?)?;
241 Ok(_response)
242 }
243 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
244 (),
245 0x11ef2cfafa567e8d,
246 fidl::encoding::DynamicFlags::empty(),
247 _decode,
248 )
249 }
250
251 type WatchOptionsResponseFut = fidl::client::QueryResponseFut<
252 (Vec<OptionWatchEntry>, u32),
253 fidl::encoding::DefaultFuchsiaResourceDialect,
254 >;
255 fn r#watch_options(&self) -> Self::WatchOptionsResponseFut {
256 fn _decode(
257 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
258 ) -> Result<(Vec<OptionWatchEntry>, u32), fidl::Error> {
259 let _response = fidl::client::decode_transaction_body::<
260 OptionWatcherWatchOptionsResponse,
261 fidl::encoding::DefaultFuchsiaResourceDialect,
262 0x6d7b8e3d3f84faf5,
263 >(_buf?)?;
264 Ok((_response.options, _response.dropped))
265 }
266 self.client
267 .send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<OptionWatchEntry>, u32)>(
268 (),
269 0x6d7b8e3d3f84faf5,
270 fidl::encoding::DynamicFlags::empty(),
271 _decode,
272 )
273 }
274}
275
276pub struct OptionWatcherEventStream {
277 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
278}
279
280impl std::marker::Unpin for OptionWatcherEventStream {}
281
282impl futures::stream::FusedStream for OptionWatcherEventStream {
283 fn is_terminated(&self) -> bool {
284 self.event_receiver.is_terminated()
285 }
286}
287
288impl futures::Stream for OptionWatcherEventStream {
289 type Item = Result<OptionWatcherEvent, fidl::Error>;
290
291 fn poll_next(
292 mut self: std::pin::Pin<&mut Self>,
293 cx: &mut std::task::Context<'_>,
294 ) -> std::task::Poll<Option<Self::Item>> {
295 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
296 &mut self.event_receiver,
297 cx
298 )?) {
299 Some(buf) => std::task::Poll::Ready(Some(OptionWatcherEvent::decode(buf))),
300 None => std::task::Poll::Ready(None),
301 }
302 }
303}
304
305#[derive(Debug)]
306pub enum OptionWatcherEvent {}
307
308impl OptionWatcherEvent {
309 fn decode(
311 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
312 ) -> Result<OptionWatcherEvent, fidl::Error> {
313 let (bytes, _handles) = buf.split_mut();
314 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
315 debug_assert_eq!(tx_header.tx_id, 0);
316 match tx_header.ordinal {
317 _ => Err(fidl::Error::UnknownOrdinal {
318 ordinal: tx_header.ordinal,
319 protocol_name: <OptionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
320 }),
321 }
322 }
323}
324
325pub struct OptionWatcherRequestStream {
327 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
328 is_terminated: bool,
329}
330
331impl std::marker::Unpin for OptionWatcherRequestStream {}
332
333impl futures::stream::FusedStream for OptionWatcherRequestStream {
334 fn is_terminated(&self) -> bool {
335 self.is_terminated
336 }
337}
338
339impl fidl::endpoints::RequestStream for OptionWatcherRequestStream {
340 type Protocol = OptionWatcherMarker;
341 type ControlHandle = OptionWatcherControlHandle;
342
343 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
344 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
345 }
346
347 fn control_handle(&self) -> Self::ControlHandle {
348 OptionWatcherControlHandle { inner: self.inner.clone() }
349 }
350
351 fn into_inner(
352 self,
353 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
354 {
355 (self.inner, self.is_terminated)
356 }
357
358 fn from_inner(
359 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
360 is_terminated: bool,
361 ) -> Self {
362 Self { inner, is_terminated }
363 }
364}
365
366impl futures::Stream for OptionWatcherRequestStream {
367 type Item = Result<OptionWatcherRequest, fidl::Error>;
368
369 fn poll_next(
370 mut self: std::pin::Pin<&mut Self>,
371 cx: &mut std::task::Context<'_>,
372 ) -> std::task::Poll<Option<Self::Item>> {
373 let this = &mut *self;
374 if this.inner.check_shutdown(cx) {
375 this.is_terminated = true;
376 return std::task::Poll::Ready(None);
377 }
378 if this.is_terminated {
379 panic!("polled OptionWatcherRequestStream after completion");
380 }
381 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
382 |bytes, handles| {
383 match this.inner.channel().read_etc(cx, bytes, handles) {
384 std::task::Poll::Ready(Ok(())) => {}
385 std::task::Poll::Pending => return std::task::Poll::Pending,
386 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
387 this.is_terminated = true;
388 return std::task::Poll::Ready(None);
389 }
390 std::task::Poll::Ready(Err(e)) => {
391 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
392 e.into(),
393 ))))
394 }
395 }
396
397 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
399
400 std::task::Poll::Ready(Some(match header.ordinal {
401 0x11ef2cfafa567e8d => {
402 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
403 let mut req = fidl::new_empty!(
404 fidl::encoding::EmptyPayload,
405 fidl::encoding::DefaultFuchsiaResourceDialect
406 );
407 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
408 let control_handle =
409 OptionWatcherControlHandle { inner: this.inner.clone() };
410 Ok(OptionWatcherRequest::Probe {
411 responder: OptionWatcherProbeResponder {
412 control_handle: std::mem::ManuallyDrop::new(control_handle),
413 tx_id: header.tx_id,
414 },
415 })
416 }
417 0x6d7b8e3d3f84faf5 => {
418 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
419 let mut req = fidl::new_empty!(
420 fidl::encoding::EmptyPayload,
421 fidl::encoding::DefaultFuchsiaResourceDialect
422 );
423 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
424 let control_handle =
425 OptionWatcherControlHandle { inner: this.inner.clone() };
426 Ok(OptionWatcherRequest::WatchOptions {
427 responder: OptionWatcherWatchOptionsResponder {
428 control_handle: std::mem::ManuallyDrop::new(control_handle),
429 tx_id: header.tx_id,
430 },
431 })
432 }
433 _ => Err(fidl::Error::UnknownOrdinal {
434 ordinal: header.ordinal,
435 protocol_name:
436 <OptionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
437 }),
438 }))
439 },
440 )
441 }
442}
443
444#[derive(Debug)]
446pub enum OptionWatcherRequest {
447 Probe { responder: OptionWatcherProbeResponder },
455 WatchOptions { responder: OptionWatcherWatchOptionsResponder },
468}
469
470impl OptionWatcherRequest {
471 #[allow(irrefutable_let_patterns)]
472 pub fn into_probe(self) -> Option<(OptionWatcherProbeResponder)> {
473 if let OptionWatcherRequest::Probe { responder } = self {
474 Some((responder))
475 } else {
476 None
477 }
478 }
479
480 #[allow(irrefutable_let_patterns)]
481 pub fn into_watch_options(self) -> Option<(OptionWatcherWatchOptionsResponder)> {
482 if let OptionWatcherRequest::WatchOptions { responder } = self {
483 Some((responder))
484 } else {
485 None
486 }
487 }
488
489 pub fn method_name(&self) -> &'static str {
491 match *self {
492 OptionWatcherRequest::Probe { .. } => "probe",
493 OptionWatcherRequest::WatchOptions { .. } => "watch_options",
494 }
495 }
496}
497
498#[derive(Debug, Clone)]
499pub struct OptionWatcherControlHandle {
500 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
501}
502
503impl fidl::endpoints::ControlHandle for OptionWatcherControlHandle {
504 fn shutdown(&self) {
505 self.inner.shutdown()
506 }
507 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
508 self.inner.shutdown_with_epitaph(status)
509 }
510
511 fn is_closed(&self) -> bool {
512 self.inner.channel().is_closed()
513 }
514 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
515 self.inner.channel().on_closed()
516 }
517
518 #[cfg(target_os = "fuchsia")]
519 fn signal_peer(
520 &self,
521 clear_mask: zx::Signals,
522 set_mask: zx::Signals,
523 ) -> Result<(), zx_status::Status> {
524 use fidl::Peered;
525 self.inner.channel().signal_peer(clear_mask, set_mask)
526 }
527}
528
529impl OptionWatcherControlHandle {}
530
531#[must_use = "FIDL methods require a response to be sent"]
532#[derive(Debug)]
533pub struct OptionWatcherProbeResponder {
534 control_handle: std::mem::ManuallyDrop<OptionWatcherControlHandle>,
535 tx_id: u32,
536}
537
538impl std::ops::Drop for OptionWatcherProbeResponder {
542 fn drop(&mut self) {
543 self.control_handle.shutdown();
544 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
546 }
547}
548
549impl fidl::endpoints::Responder for OptionWatcherProbeResponder {
550 type ControlHandle = OptionWatcherControlHandle;
551
552 fn control_handle(&self) -> &OptionWatcherControlHandle {
553 &self.control_handle
554 }
555
556 fn drop_without_shutdown(mut self) {
557 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
559 std::mem::forget(self);
561 }
562}
563
564impl OptionWatcherProbeResponder {
565 pub fn send(self) -> Result<(), fidl::Error> {
569 let _result = self.send_raw();
570 if _result.is_err() {
571 self.control_handle.shutdown();
572 }
573 self.drop_without_shutdown();
574 _result
575 }
576
577 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
579 let _result = self.send_raw();
580 self.drop_without_shutdown();
581 _result
582 }
583
584 fn send_raw(&self) -> Result<(), fidl::Error> {
585 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
586 (),
587 self.tx_id,
588 0x11ef2cfafa567e8d,
589 fidl::encoding::DynamicFlags::empty(),
590 )
591 }
592}
593
594#[must_use = "FIDL methods require a response to be sent"]
595#[derive(Debug)]
596pub struct OptionWatcherWatchOptionsResponder {
597 control_handle: std::mem::ManuallyDrop<OptionWatcherControlHandle>,
598 tx_id: u32,
599}
600
601impl std::ops::Drop for OptionWatcherWatchOptionsResponder {
605 fn drop(&mut self) {
606 self.control_handle.shutdown();
607 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
609 }
610}
611
612impl fidl::endpoints::Responder for OptionWatcherWatchOptionsResponder {
613 type ControlHandle = OptionWatcherControlHandle;
614
615 fn control_handle(&self) -> &OptionWatcherControlHandle {
616 &self.control_handle
617 }
618
619 fn drop_without_shutdown(mut self) {
620 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
622 std::mem::forget(self);
624 }
625}
626
627impl OptionWatcherWatchOptionsResponder {
628 pub fn send(
632 self,
633 mut options: &[OptionWatchEntry],
634 mut dropped: u32,
635 ) -> Result<(), fidl::Error> {
636 let _result = self.send_raw(options, dropped);
637 if _result.is_err() {
638 self.control_handle.shutdown();
639 }
640 self.drop_without_shutdown();
641 _result
642 }
643
644 pub fn send_no_shutdown_on_err(
646 self,
647 mut options: &[OptionWatchEntry],
648 mut dropped: u32,
649 ) -> Result<(), fidl::Error> {
650 let _result = self.send_raw(options, dropped);
651 self.drop_without_shutdown();
652 _result
653 }
654
655 fn send_raw(
656 &self,
657 mut options: &[OptionWatchEntry],
658 mut dropped: u32,
659 ) -> Result<(), fidl::Error> {
660 self.control_handle.inner.send::<OptionWatcherWatchOptionsResponse>(
661 (options, dropped),
662 self.tx_id,
663 0x6d7b8e3d3f84faf5,
664 fidl::encoding::DynamicFlags::empty(),
665 )
666 }
667}
668
669#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
670pub struct RouterAdvertisementOptionWatcherProviderMarker;
671
672impl fidl::endpoints::ProtocolMarker for RouterAdvertisementOptionWatcherProviderMarker {
673 type Proxy = RouterAdvertisementOptionWatcherProviderProxy;
674 type RequestStream = RouterAdvertisementOptionWatcherProviderRequestStream;
675 #[cfg(target_os = "fuchsia")]
676 type SynchronousProxy = RouterAdvertisementOptionWatcherProviderSynchronousProxy;
677
678 const DEBUG_NAME: &'static str = "fuchsia.net.ndp.RouterAdvertisementOptionWatcherProvider";
679}
680impl fidl::endpoints::DiscoverableProtocolMarker
681 for RouterAdvertisementOptionWatcherProviderMarker
682{
683}
684
685pub trait RouterAdvertisementOptionWatcherProviderProxyInterface: Send + Sync {
686 fn r#new_router_advertisement_option_watcher(
687 &self,
688 option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
689 params: &RouterAdvertisementOptionWatcherParams,
690 ) -> Result<(), fidl::Error>;
691}
692#[derive(Debug)]
693#[cfg(target_os = "fuchsia")]
694pub struct RouterAdvertisementOptionWatcherProviderSynchronousProxy {
695 client: fidl::client::sync::Client,
696}
697
698#[cfg(target_os = "fuchsia")]
699impl fidl::endpoints::SynchronousProxy
700 for RouterAdvertisementOptionWatcherProviderSynchronousProxy
701{
702 type Proxy = RouterAdvertisementOptionWatcherProviderProxy;
703 type Protocol = RouterAdvertisementOptionWatcherProviderMarker;
704
705 fn from_channel(inner: fidl::Channel) -> Self {
706 Self::new(inner)
707 }
708
709 fn into_channel(self) -> fidl::Channel {
710 self.client.into_channel()
711 }
712
713 fn as_channel(&self) -> &fidl::Channel {
714 self.client.as_channel()
715 }
716}
717
718#[cfg(target_os = "fuchsia")]
719impl RouterAdvertisementOptionWatcherProviderSynchronousProxy {
720 pub fn new(channel: fidl::Channel) -> Self {
721 let protocol_name = <RouterAdvertisementOptionWatcherProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
722 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
723 }
724
725 pub fn into_channel(self) -> fidl::Channel {
726 self.client.into_channel()
727 }
728
729 pub fn wait_for_event(
732 &self,
733 deadline: zx::MonotonicInstant,
734 ) -> Result<RouterAdvertisementOptionWatcherProviderEvent, fidl::Error> {
735 RouterAdvertisementOptionWatcherProviderEvent::decode(self.client.wait_for_event(deadline)?)
736 }
737
738 pub fn r#new_router_advertisement_option_watcher(
742 &self,
743 mut option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
744 mut params: &RouterAdvertisementOptionWatcherParams,
745 ) -> Result<(), fidl::Error> {
746 self.client.send::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(
747 (option_watcher, params,),
748 0x2a90a8bd5fd2bbf4,
749 fidl::encoding::DynamicFlags::empty(),
750 )
751 }
752}
753
754#[cfg(target_os = "fuchsia")]
755impl From<RouterAdvertisementOptionWatcherProviderSynchronousProxy> for zx::Handle {
756 fn from(value: RouterAdvertisementOptionWatcherProviderSynchronousProxy) -> Self {
757 value.into_channel().into()
758 }
759}
760
761#[cfg(target_os = "fuchsia")]
762impl From<fidl::Channel> for RouterAdvertisementOptionWatcherProviderSynchronousProxy {
763 fn from(value: fidl::Channel) -> Self {
764 Self::new(value)
765 }
766}
767
768#[cfg(target_os = "fuchsia")]
769impl fidl::endpoints::FromClient for RouterAdvertisementOptionWatcherProviderSynchronousProxy {
770 type Protocol = RouterAdvertisementOptionWatcherProviderMarker;
771
772 fn from_client(
773 value: fidl::endpoints::ClientEnd<RouterAdvertisementOptionWatcherProviderMarker>,
774 ) -> Self {
775 Self::new(value.into_channel())
776 }
777}
778
779#[derive(Debug, Clone)]
780pub struct RouterAdvertisementOptionWatcherProviderProxy {
781 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
782}
783
784impl fidl::endpoints::Proxy for RouterAdvertisementOptionWatcherProviderProxy {
785 type Protocol = RouterAdvertisementOptionWatcherProviderMarker;
786
787 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
788 Self::new(inner)
789 }
790
791 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
792 self.client.into_channel().map_err(|client| Self { client })
793 }
794
795 fn as_channel(&self) -> &::fidl::AsyncChannel {
796 self.client.as_channel()
797 }
798}
799
800impl RouterAdvertisementOptionWatcherProviderProxy {
801 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
803 let protocol_name = <RouterAdvertisementOptionWatcherProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
804 Self { client: fidl::client::Client::new(channel, protocol_name) }
805 }
806
807 pub fn take_event_stream(&self) -> RouterAdvertisementOptionWatcherProviderEventStream {
813 RouterAdvertisementOptionWatcherProviderEventStream {
814 event_receiver: self.client.take_event_receiver(),
815 }
816 }
817
818 pub fn r#new_router_advertisement_option_watcher(
822 &self,
823 mut option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
824 mut params: &RouterAdvertisementOptionWatcherParams,
825 ) -> Result<(), fidl::Error> {
826 RouterAdvertisementOptionWatcherProviderProxyInterface::r#new_router_advertisement_option_watcher(self,
827 option_watcher,
828 params,
829 )
830 }
831}
832
833impl RouterAdvertisementOptionWatcherProviderProxyInterface
834 for RouterAdvertisementOptionWatcherProviderProxy
835{
836 fn r#new_router_advertisement_option_watcher(
837 &self,
838 mut option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
839 mut params: &RouterAdvertisementOptionWatcherParams,
840 ) -> Result<(), fidl::Error> {
841 self.client.send::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(
842 (option_watcher, params,),
843 0x2a90a8bd5fd2bbf4,
844 fidl::encoding::DynamicFlags::empty(),
845 )
846 }
847}
848
849pub struct RouterAdvertisementOptionWatcherProviderEventStream {
850 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
851}
852
853impl std::marker::Unpin for RouterAdvertisementOptionWatcherProviderEventStream {}
854
855impl futures::stream::FusedStream for RouterAdvertisementOptionWatcherProviderEventStream {
856 fn is_terminated(&self) -> bool {
857 self.event_receiver.is_terminated()
858 }
859}
860
861impl futures::Stream for RouterAdvertisementOptionWatcherProviderEventStream {
862 type Item = Result<RouterAdvertisementOptionWatcherProviderEvent, fidl::Error>;
863
864 fn poll_next(
865 mut self: std::pin::Pin<&mut Self>,
866 cx: &mut std::task::Context<'_>,
867 ) -> std::task::Poll<Option<Self::Item>> {
868 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
869 &mut self.event_receiver,
870 cx
871 )?) {
872 Some(buf) => std::task::Poll::Ready(Some(
873 RouterAdvertisementOptionWatcherProviderEvent::decode(buf),
874 )),
875 None => std::task::Poll::Ready(None),
876 }
877 }
878}
879
880#[derive(Debug)]
881pub enum RouterAdvertisementOptionWatcherProviderEvent {}
882
883impl RouterAdvertisementOptionWatcherProviderEvent {
884 fn decode(
886 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
887 ) -> Result<RouterAdvertisementOptionWatcherProviderEvent, fidl::Error> {
888 let (bytes, _handles) = buf.split_mut();
889 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
890 debug_assert_eq!(tx_header.tx_id, 0);
891 match tx_header.ordinal {
892 _ => Err(fidl::Error::UnknownOrdinal {
893 ordinal: tx_header.ordinal,
894 protocol_name: <RouterAdvertisementOptionWatcherProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
895 })
896 }
897 }
898}
899
900pub struct RouterAdvertisementOptionWatcherProviderRequestStream {
902 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
903 is_terminated: bool,
904}
905
906impl std::marker::Unpin for RouterAdvertisementOptionWatcherProviderRequestStream {}
907
908impl futures::stream::FusedStream for RouterAdvertisementOptionWatcherProviderRequestStream {
909 fn is_terminated(&self) -> bool {
910 self.is_terminated
911 }
912}
913
914impl fidl::endpoints::RequestStream for RouterAdvertisementOptionWatcherProviderRequestStream {
915 type Protocol = RouterAdvertisementOptionWatcherProviderMarker;
916 type ControlHandle = RouterAdvertisementOptionWatcherProviderControlHandle;
917
918 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
919 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
920 }
921
922 fn control_handle(&self) -> Self::ControlHandle {
923 RouterAdvertisementOptionWatcherProviderControlHandle { inner: self.inner.clone() }
924 }
925
926 fn into_inner(
927 self,
928 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
929 {
930 (self.inner, self.is_terminated)
931 }
932
933 fn from_inner(
934 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
935 is_terminated: bool,
936 ) -> Self {
937 Self { inner, is_terminated }
938 }
939}
940
941impl futures::Stream for RouterAdvertisementOptionWatcherProviderRequestStream {
942 type Item = Result<RouterAdvertisementOptionWatcherProviderRequest, fidl::Error>;
943
944 fn poll_next(
945 mut self: std::pin::Pin<&mut Self>,
946 cx: &mut std::task::Context<'_>,
947 ) -> std::task::Poll<Option<Self::Item>> {
948 let this = &mut *self;
949 if this.inner.check_shutdown(cx) {
950 this.is_terminated = true;
951 return std::task::Poll::Ready(None);
952 }
953 if this.is_terminated {
954 panic!("polled RouterAdvertisementOptionWatcherProviderRequestStream after completion");
955 }
956 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
957 |bytes, handles| {
958 match this.inner.channel().read_etc(cx, bytes, handles) {
959 std::task::Poll::Ready(Ok(())) => {}
960 std::task::Poll::Pending => return std::task::Poll::Pending,
961 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
962 this.is_terminated = true;
963 return std::task::Poll::Ready(None);
964 }
965 std::task::Poll::Ready(Err(e)) => {
966 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
967 e.into(),
968 ))))
969 }
970 }
971
972 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
974
975 std::task::Poll::Ready(Some(match header.ordinal {
976 0x2a90a8bd5fd2bbf4 => {
977 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
978 let mut req = fidl::new_empty!(RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
979 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
980 let control_handle = RouterAdvertisementOptionWatcherProviderControlHandle {
981 inner: this.inner.clone(),
982 };
983 Ok(RouterAdvertisementOptionWatcherProviderRequest::NewRouterAdvertisementOptionWatcher {option_watcher: req.option_watcher,
984params: req.params,
985
986 control_handle,
987 })
988 }
989 _ => Err(fidl::Error::UnknownOrdinal {
990 ordinal: header.ordinal,
991 protocol_name: <RouterAdvertisementOptionWatcherProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
992 }),
993 }))
994 },
995 )
996 }
997}
998
999#[derive(Debug)]
1008pub enum RouterAdvertisementOptionWatcherProviderRequest {
1009 NewRouterAdvertisementOptionWatcher {
1013 option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
1014 params: RouterAdvertisementOptionWatcherParams,
1015 control_handle: RouterAdvertisementOptionWatcherProviderControlHandle,
1016 },
1017}
1018
1019impl RouterAdvertisementOptionWatcherProviderRequest {
1020 #[allow(irrefutable_let_patterns)]
1021 pub fn into_new_router_advertisement_option_watcher(
1022 self,
1023 ) -> Option<(
1024 fidl::endpoints::ServerEnd<OptionWatcherMarker>,
1025 RouterAdvertisementOptionWatcherParams,
1026 RouterAdvertisementOptionWatcherProviderControlHandle,
1027 )> {
1028 if let RouterAdvertisementOptionWatcherProviderRequest::NewRouterAdvertisementOptionWatcher {
1029 option_watcher,
1030 params,
1031 control_handle,
1032 } = self {
1033 Some((option_watcher,params,
1034 control_handle))
1035 } else {
1036 None
1037 }
1038 }
1039
1040 pub fn method_name(&self) -> &'static str {
1042 match *self {
1043 RouterAdvertisementOptionWatcherProviderRequest::NewRouterAdvertisementOptionWatcher{..} => "new_router_advertisement_option_watcher",
1044 }
1045 }
1046}
1047
1048#[derive(Debug, Clone)]
1049pub struct RouterAdvertisementOptionWatcherProviderControlHandle {
1050 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1051}
1052
1053impl fidl::endpoints::ControlHandle for RouterAdvertisementOptionWatcherProviderControlHandle {
1054 fn shutdown(&self) {
1055 self.inner.shutdown()
1056 }
1057 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1058 self.inner.shutdown_with_epitaph(status)
1059 }
1060
1061 fn is_closed(&self) -> bool {
1062 self.inner.channel().is_closed()
1063 }
1064 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1065 self.inner.channel().on_closed()
1066 }
1067
1068 #[cfg(target_os = "fuchsia")]
1069 fn signal_peer(
1070 &self,
1071 clear_mask: zx::Signals,
1072 set_mask: zx::Signals,
1073 ) -> Result<(), zx_status::Status> {
1074 use fidl::Peered;
1075 self.inner.channel().signal_peer(clear_mask, set_mask)
1076 }
1077}
1078
1079impl RouterAdvertisementOptionWatcherProviderControlHandle {}
1080
1081mod internal {
1082 use super::*;
1083
1084 impl fidl::encoding::ResourceTypeMarker
1085 for RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
1086 {
1087 type Borrowed<'a> = &'a mut Self;
1088 fn take_or_borrow<'a>(
1089 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1090 ) -> Self::Borrowed<'a> {
1091 value
1092 }
1093 }
1094
1095 unsafe impl fidl::encoding::TypeMarker
1096 for RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
1097 {
1098 type Owned = Self;
1099
1100 #[inline(always)]
1101 fn inline_align(_context: fidl::encoding::Context) -> usize {
1102 8
1103 }
1104
1105 #[inline(always)]
1106 fn inline_size(_context: fidl::encoding::Context) -> usize {
1107 24
1108 }
1109 }
1110
1111 unsafe impl
1112 fidl::encoding::Encode<
1113 RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest,
1114 fidl::encoding::DefaultFuchsiaResourceDialect,
1115 >
1116 for &mut RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
1117 {
1118 #[inline]
1119 unsafe fn encode(
1120 self,
1121 encoder: &mut fidl::encoding::Encoder<
1122 '_,
1123 fidl::encoding::DefaultFuchsiaResourceDialect,
1124 >,
1125 offset: usize,
1126 _depth: fidl::encoding::Depth,
1127 ) -> fidl::Result<()> {
1128 encoder.debug_check_bounds::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(offset);
1129 fidl::encoding::Encode::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1131 (
1132 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<OptionWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.option_watcher),
1133 <RouterAdvertisementOptionWatcherParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
1134 ),
1135 encoder, offset, _depth
1136 )
1137 }
1138 }
1139 unsafe impl<
1140 T0: fidl::encoding::Encode<
1141 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<OptionWatcherMarker>>,
1142 fidl::encoding::DefaultFuchsiaResourceDialect,
1143 >,
1144 T1: fidl::encoding::Encode<
1145 RouterAdvertisementOptionWatcherParams,
1146 fidl::encoding::DefaultFuchsiaResourceDialect,
1147 >,
1148 >
1149 fidl::encoding::Encode<
1150 RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest,
1151 fidl::encoding::DefaultFuchsiaResourceDialect,
1152 > for (T0, T1)
1153 {
1154 #[inline]
1155 unsafe fn encode(
1156 self,
1157 encoder: &mut fidl::encoding::Encoder<
1158 '_,
1159 fidl::encoding::DefaultFuchsiaResourceDialect,
1160 >,
1161 offset: usize,
1162 depth: fidl::encoding::Depth,
1163 ) -> fidl::Result<()> {
1164 encoder.debug_check_bounds::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(offset);
1165 unsafe {
1168 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1169 (ptr as *mut u64).write_unaligned(0);
1170 }
1171 self.0.encode(encoder, offset + 0, depth)?;
1173 self.1.encode(encoder, offset + 8, depth)?;
1174 Ok(())
1175 }
1176 }
1177
1178 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1179 for RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
1180 {
1181 #[inline(always)]
1182 fn new_empty() -> Self {
1183 Self {
1184 option_watcher: fidl::new_empty!(
1185 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<OptionWatcherMarker>>,
1186 fidl::encoding::DefaultFuchsiaResourceDialect
1187 ),
1188 params: fidl::new_empty!(
1189 RouterAdvertisementOptionWatcherParams,
1190 fidl::encoding::DefaultFuchsiaResourceDialect
1191 ),
1192 }
1193 }
1194
1195 #[inline]
1196 unsafe fn decode(
1197 &mut self,
1198 decoder: &mut fidl::encoding::Decoder<
1199 '_,
1200 fidl::encoding::DefaultFuchsiaResourceDialect,
1201 >,
1202 offset: usize,
1203 _depth: fidl::encoding::Depth,
1204 ) -> fidl::Result<()> {
1205 decoder.debug_check_bounds::<Self>(offset);
1206 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1208 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1209 let mask = 0xffffffff00000000u64;
1210 let maskedval = padval & mask;
1211 if maskedval != 0 {
1212 return Err(fidl::Error::NonZeroPadding {
1213 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1214 });
1215 }
1216 fidl::decode!(
1217 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<OptionWatcherMarker>>,
1218 fidl::encoding::DefaultFuchsiaResourceDialect,
1219 &mut self.option_watcher,
1220 decoder,
1221 offset + 0,
1222 _depth
1223 )?;
1224 fidl::decode!(
1225 RouterAdvertisementOptionWatcherParams,
1226 fidl::encoding::DefaultFuchsiaResourceDialect,
1227 &mut self.params,
1228 decoder,
1229 offset + 8,
1230 _depth
1231 )?;
1232 Ok(())
1233 }
1234 }
1235}