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#[derive(Debug, Clone)]
135pub struct OptionWatcherProxy {
136 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
137}
138
139impl fidl::endpoints::Proxy for OptionWatcherProxy {
140 type Protocol = OptionWatcherMarker;
141
142 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
143 Self::new(inner)
144 }
145
146 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
147 self.client.into_channel().map_err(|client| Self { client })
148 }
149
150 fn as_channel(&self) -> &::fidl::AsyncChannel {
151 self.client.as_channel()
152 }
153}
154
155impl OptionWatcherProxy {
156 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
158 let protocol_name = <OptionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
159 Self { client: fidl::client::Client::new(channel, protocol_name) }
160 }
161
162 pub fn take_event_stream(&self) -> OptionWatcherEventStream {
168 OptionWatcherEventStream { event_receiver: self.client.take_event_receiver() }
169 }
170
171 pub fn r#probe(
179 &self,
180 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
181 OptionWatcherProxyInterface::r#probe(self)
182 }
183
184 pub fn r#watch_options(
197 &self,
198 ) -> fidl::client::QueryResponseFut<
199 (Vec<OptionWatchEntry>, u32),
200 fidl::encoding::DefaultFuchsiaResourceDialect,
201 > {
202 OptionWatcherProxyInterface::r#watch_options(self)
203 }
204}
205
206impl OptionWatcherProxyInterface for OptionWatcherProxy {
207 type ProbeResponseFut =
208 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
209 fn r#probe(&self) -> Self::ProbeResponseFut {
210 fn _decode(
211 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
212 ) -> Result<(), fidl::Error> {
213 let _response = fidl::client::decode_transaction_body::<
214 fidl::encoding::EmptyPayload,
215 fidl::encoding::DefaultFuchsiaResourceDialect,
216 0x11ef2cfafa567e8d,
217 >(_buf?)?;
218 Ok(_response)
219 }
220 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
221 (),
222 0x11ef2cfafa567e8d,
223 fidl::encoding::DynamicFlags::empty(),
224 _decode,
225 )
226 }
227
228 type WatchOptionsResponseFut = fidl::client::QueryResponseFut<
229 (Vec<OptionWatchEntry>, u32),
230 fidl::encoding::DefaultFuchsiaResourceDialect,
231 >;
232 fn r#watch_options(&self) -> Self::WatchOptionsResponseFut {
233 fn _decode(
234 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
235 ) -> Result<(Vec<OptionWatchEntry>, u32), fidl::Error> {
236 let _response = fidl::client::decode_transaction_body::<
237 OptionWatcherWatchOptionsResponse,
238 fidl::encoding::DefaultFuchsiaResourceDialect,
239 0x6d7b8e3d3f84faf5,
240 >(_buf?)?;
241 Ok((_response.options, _response.dropped))
242 }
243 self.client
244 .send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<OptionWatchEntry>, u32)>(
245 (),
246 0x6d7b8e3d3f84faf5,
247 fidl::encoding::DynamicFlags::empty(),
248 _decode,
249 )
250 }
251}
252
253pub struct OptionWatcherEventStream {
254 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
255}
256
257impl std::marker::Unpin for OptionWatcherEventStream {}
258
259impl futures::stream::FusedStream for OptionWatcherEventStream {
260 fn is_terminated(&self) -> bool {
261 self.event_receiver.is_terminated()
262 }
263}
264
265impl futures::Stream for OptionWatcherEventStream {
266 type Item = Result<OptionWatcherEvent, fidl::Error>;
267
268 fn poll_next(
269 mut self: std::pin::Pin<&mut Self>,
270 cx: &mut std::task::Context<'_>,
271 ) -> std::task::Poll<Option<Self::Item>> {
272 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
273 &mut self.event_receiver,
274 cx
275 )?) {
276 Some(buf) => std::task::Poll::Ready(Some(OptionWatcherEvent::decode(buf))),
277 None => std::task::Poll::Ready(None),
278 }
279 }
280}
281
282#[derive(Debug)]
283pub enum OptionWatcherEvent {}
284
285impl OptionWatcherEvent {
286 fn decode(
288 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
289 ) -> Result<OptionWatcherEvent, fidl::Error> {
290 let (bytes, _handles) = buf.split_mut();
291 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
292 debug_assert_eq!(tx_header.tx_id, 0);
293 match tx_header.ordinal {
294 _ => Err(fidl::Error::UnknownOrdinal {
295 ordinal: tx_header.ordinal,
296 protocol_name: <OptionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
297 }),
298 }
299 }
300}
301
302pub struct OptionWatcherRequestStream {
304 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
305 is_terminated: bool,
306}
307
308impl std::marker::Unpin for OptionWatcherRequestStream {}
309
310impl futures::stream::FusedStream for OptionWatcherRequestStream {
311 fn is_terminated(&self) -> bool {
312 self.is_terminated
313 }
314}
315
316impl fidl::endpoints::RequestStream for OptionWatcherRequestStream {
317 type Protocol = OptionWatcherMarker;
318 type ControlHandle = OptionWatcherControlHandle;
319
320 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
321 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
322 }
323
324 fn control_handle(&self) -> Self::ControlHandle {
325 OptionWatcherControlHandle { inner: self.inner.clone() }
326 }
327
328 fn into_inner(
329 self,
330 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
331 {
332 (self.inner, self.is_terminated)
333 }
334
335 fn from_inner(
336 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
337 is_terminated: bool,
338 ) -> Self {
339 Self { inner, is_terminated }
340 }
341}
342
343impl futures::Stream for OptionWatcherRequestStream {
344 type Item = Result<OptionWatcherRequest, fidl::Error>;
345
346 fn poll_next(
347 mut self: std::pin::Pin<&mut Self>,
348 cx: &mut std::task::Context<'_>,
349 ) -> std::task::Poll<Option<Self::Item>> {
350 let this = &mut *self;
351 if this.inner.check_shutdown(cx) {
352 this.is_terminated = true;
353 return std::task::Poll::Ready(None);
354 }
355 if this.is_terminated {
356 panic!("polled OptionWatcherRequestStream after completion");
357 }
358 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
359 |bytes, handles| {
360 match this.inner.channel().read_etc(cx, bytes, handles) {
361 std::task::Poll::Ready(Ok(())) => {}
362 std::task::Poll::Pending => return std::task::Poll::Pending,
363 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
364 this.is_terminated = true;
365 return std::task::Poll::Ready(None);
366 }
367 std::task::Poll::Ready(Err(e)) => {
368 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
369 e.into(),
370 ))))
371 }
372 }
373
374 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
376
377 std::task::Poll::Ready(Some(match header.ordinal {
378 0x11ef2cfafa567e8d => {
379 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
380 let mut req = fidl::new_empty!(
381 fidl::encoding::EmptyPayload,
382 fidl::encoding::DefaultFuchsiaResourceDialect
383 );
384 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
385 let control_handle =
386 OptionWatcherControlHandle { inner: this.inner.clone() };
387 Ok(OptionWatcherRequest::Probe {
388 responder: OptionWatcherProbeResponder {
389 control_handle: std::mem::ManuallyDrop::new(control_handle),
390 tx_id: header.tx_id,
391 },
392 })
393 }
394 0x6d7b8e3d3f84faf5 => {
395 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
396 let mut req = fidl::new_empty!(
397 fidl::encoding::EmptyPayload,
398 fidl::encoding::DefaultFuchsiaResourceDialect
399 );
400 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
401 let control_handle =
402 OptionWatcherControlHandle { inner: this.inner.clone() };
403 Ok(OptionWatcherRequest::WatchOptions {
404 responder: OptionWatcherWatchOptionsResponder {
405 control_handle: std::mem::ManuallyDrop::new(control_handle),
406 tx_id: header.tx_id,
407 },
408 })
409 }
410 _ => Err(fidl::Error::UnknownOrdinal {
411 ordinal: header.ordinal,
412 protocol_name:
413 <OptionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
414 }),
415 }))
416 },
417 )
418 }
419}
420
421#[derive(Debug)]
423pub enum OptionWatcherRequest {
424 Probe { responder: OptionWatcherProbeResponder },
432 WatchOptions { responder: OptionWatcherWatchOptionsResponder },
445}
446
447impl OptionWatcherRequest {
448 #[allow(irrefutable_let_patterns)]
449 pub fn into_probe(self) -> Option<(OptionWatcherProbeResponder)> {
450 if let OptionWatcherRequest::Probe { responder } = self {
451 Some((responder))
452 } else {
453 None
454 }
455 }
456
457 #[allow(irrefutable_let_patterns)]
458 pub fn into_watch_options(self) -> Option<(OptionWatcherWatchOptionsResponder)> {
459 if let OptionWatcherRequest::WatchOptions { responder } = self {
460 Some((responder))
461 } else {
462 None
463 }
464 }
465
466 pub fn method_name(&self) -> &'static str {
468 match *self {
469 OptionWatcherRequest::Probe { .. } => "probe",
470 OptionWatcherRequest::WatchOptions { .. } => "watch_options",
471 }
472 }
473}
474
475#[derive(Debug, Clone)]
476pub struct OptionWatcherControlHandle {
477 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
478}
479
480impl fidl::endpoints::ControlHandle for OptionWatcherControlHandle {
481 fn shutdown(&self) {
482 self.inner.shutdown()
483 }
484 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
485 self.inner.shutdown_with_epitaph(status)
486 }
487
488 fn is_closed(&self) -> bool {
489 self.inner.channel().is_closed()
490 }
491 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
492 self.inner.channel().on_closed()
493 }
494
495 #[cfg(target_os = "fuchsia")]
496 fn signal_peer(
497 &self,
498 clear_mask: zx::Signals,
499 set_mask: zx::Signals,
500 ) -> Result<(), zx_status::Status> {
501 use fidl::Peered;
502 self.inner.channel().signal_peer(clear_mask, set_mask)
503 }
504}
505
506impl OptionWatcherControlHandle {}
507
508#[must_use = "FIDL methods require a response to be sent"]
509#[derive(Debug)]
510pub struct OptionWatcherProbeResponder {
511 control_handle: std::mem::ManuallyDrop<OptionWatcherControlHandle>,
512 tx_id: u32,
513}
514
515impl std::ops::Drop for OptionWatcherProbeResponder {
519 fn drop(&mut self) {
520 self.control_handle.shutdown();
521 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
523 }
524}
525
526impl fidl::endpoints::Responder for OptionWatcherProbeResponder {
527 type ControlHandle = OptionWatcherControlHandle;
528
529 fn control_handle(&self) -> &OptionWatcherControlHandle {
530 &self.control_handle
531 }
532
533 fn drop_without_shutdown(mut self) {
534 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
536 std::mem::forget(self);
538 }
539}
540
541impl OptionWatcherProbeResponder {
542 pub fn send(self) -> Result<(), fidl::Error> {
546 let _result = self.send_raw();
547 if _result.is_err() {
548 self.control_handle.shutdown();
549 }
550 self.drop_without_shutdown();
551 _result
552 }
553
554 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
556 let _result = self.send_raw();
557 self.drop_without_shutdown();
558 _result
559 }
560
561 fn send_raw(&self) -> Result<(), fidl::Error> {
562 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
563 (),
564 self.tx_id,
565 0x11ef2cfafa567e8d,
566 fidl::encoding::DynamicFlags::empty(),
567 )
568 }
569}
570
571#[must_use = "FIDL methods require a response to be sent"]
572#[derive(Debug)]
573pub struct OptionWatcherWatchOptionsResponder {
574 control_handle: std::mem::ManuallyDrop<OptionWatcherControlHandle>,
575 tx_id: u32,
576}
577
578impl std::ops::Drop for OptionWatcherWatchOptionsResponder {
582 fn drop(&mut self) {
583 self.control_handle.shutdown();
584 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
586 }
587}
588
589impl fidl::endpoints::Responder for OptionWatcherWatchOptionsResponder {
590 type ControlHandle = OptionWatcherControlHandle;
591
592 fn control_handle(&self) -> &OptionWatcherControlHandle {
593 &self.control_handle
594 }
595
596 fn drop_without_shutdown(mut self) {
597 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
599 std::mem::forget(self);
601 }
602}
603
604impl OptionWatcherWatchOptionsResponder {
605 pub fn send(
609 self,
610 mut options: &[OptionWatchEntry],
611 mut dropped: u32,
612 ) -> Result<(), fidl::Error> {
613 let _result = self.send_raw(options, dropped);
614 if _result.is_err() {
615 self.control_handle.shutdown();
616 }
617 self.drop_without_shutdown();
618 _result
619 }
620
621 pub fn send_no_shutdown_on_err(
623 self,
624 mut options: &[OptionWatchEntry],
625 mut dropped: u32,
626 ) -> Result<(), fidl::Error> {
627 let _result = self.send_raw(options, dropped);
628 self.drop_without_shutdown();
629 _result
630 }
631
632 fn send_raw(
633 &self,
634 mut options: &[OptionWatchEntry],
635 mut dropped: u32,
636 ) -> Result<(), fidl::Error> {
637 self.control_handle.inner.send::<OptionWatcherWatchOptionsResponse>(
638 (options, dropped),
639 self.tx_id,
640 0x6d7b8e3d3f84faf5,
641 fidl::encoding::DynamicFlags::empty(),
642 )
643 }
644}
645
646#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
647pub struct RouterAdvertisementOptionWatcherProviderMarker;
648
649impl fidl::endpoints::ProtocolMarker for RouterAdvertisementOptionWatcherProviderMarker {
650 type Proxy = RouterAdvertisementOptionWatcherProviderProxy;
651 type RequestStream = RouterAdvertisementOptionWatcherProviderRequestStream;
652 #[cfg(target_os = "fuchsia")]
653 type SynchronousProxy = RouterAdvertisementOptionWatcherProviderSynchronousProxy;
654
655 const DEBUG_NAME: &'static str = "fuchsia.net.ndp.RouterAdvertisementOptionWatcherProvider";
656}
657impl fidl::endpoints::DiscoverableProtocolMarker
658 for RouterAdvertisementOptionWatcherProviderMarker
659{
660}
661
662pub trait RouterAdvertisementOptionWatcherProviderProxyInterface: Send + Sync {
663 fn r#new_router_advertisement_option_watcher(
664 &self,
665 option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
666 params: &RouterAdvertisementOptionWatcherParams,
667 ) -> Result<(), fidl::Error>;
668}
669#[derive(Debug)]
670#[cfg(target_os = "fuchsia")]
671pub struct RouterAdvertisementOptionWatcherProviderSynchronousProxy {
672 client: fidl::client::sync::Client,
673}
674
675#[cfg(target_os = "fuchsia")]
676impl fidl::endpoints::SynchronousProxy
677 for RouterAdvertisementOptionWatcherProviderSynchronousProxy
678{
679 type Proxy = RouterAdvertisementOptionWatcherProviderProxy;
680 type Protocol = RouterAdvertisementOptionWatcherProviderMarker;
681
682 fn from_channel(inner: fidl::Channel) -> Self {
683 Self::new(inner)
684 }
685
686 fn into_channel(self) -> fidl::Channel {
687 self.client.into_channel()
688 }
689
690 fn as_channel(&self) -> &fidl::Channel {
691 self.client.as_channel()
692 }
693}
694
695#[cfg(target_os = "fuchsia")]
696impl RouterAdvertisementOptionWatcherProviderSynchronousProxy {
697 pub fn new(channel: fidl::Channel) -> Self {
698 let protocol_name = <RouterAdvertisementOptionWatcherProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
699 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
700 }
701
702 pub fn into_channel(self) -> fidl::Channel {
703 self.client.into_channel()
704 }
705
706 pub fn wait_for_event(
709 &self,
710 deadline: zx::MonotonicInstant,
711 ) -> Result<RouterAdvertisementOptionWatcherProviderEvent, fidl::Error> {
712 RouterAdvertisementOptionWatcherProviderEvent::decode(self.client.wait_for_event(deadline)?)
713 }
714
715 pub fn r#new_router_advertisement_option_watcher(
719 &self,
720 mut option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
721 mut params: &RouterAdvertisementOptionWatcherParams,
722 ) -> Result<(), fidl::Error> {
723 self.client.send::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(
724 (option_watcher, params,),
725 0x2a90a8bd5fd2bbf4,
726 fidl::encoding::DynamicFlags::empty(),
727 )
728 }
729}
730
731#[derive(Debug, Clone)]
732pub struct RouterAdvertisementOptionWatcherProviderProxy {
733 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
734}
735
736impl fidl::endpoints::Proxy for RouterAdvertisementOptionWatcherProviderProxy {
737 type Protocol = RouterAdvertisementOptionWatcherProviderMarker;
738
739 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
740 Self::new(inner)
741 }
742
743 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
744 self.client.into_channel().map_err(|client| Self { client })
745 }
746
747 fn as_channel(&self) -> &::fidl::AsyncChannel {
748 self.client.as_channel()
749 }
750}
751
752impl RouterAdvertisementOptionWatcherProviderProxy {
753 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
755 let protocol_name = <RouterAdvertisementOptionWatcherProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
756 Self { client: fidl::client::Client::new(channel, protocol_name) }
757 }
758
759 pub fn take_event_stream(&self) -> RouterAdvertisementOptionWatcherProviderEventStream {
765 RouterAdvertisementOptionWatcherProviderEventStream {
766 event_receiver: self.client.take_event_receiver(),
767 }
768 }
769
770 pub fn r#new_router_advertisement_option_watcher(
774 &self,
775 mut option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
776 mut params: &RouterAdvertisementOptionWatcherParams,
777 ) -> Result<(), fidl::Error> {
778 RouterAdvertisementOptionWatcherProviderProxyInterface::r#new_router_advertisement_option_watcher(self,
779 option_watcher,
780 params,
781 )
782 }
783}
784
785impl RouterAdvertisementOptionWatcherProviderProxyInterface
786 for RouterAdvertisementOptionWatcherProviderProxy
787{
788 fn r#new_router_advertisement_option_watcher(
789 &self,
790 mut option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
791 mut params: &RouterAdvertisementOptionWatcherParams,
792 ) -> Result<(), fidl::Error> {
793 self.client.send::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(
794 (option_watcher, params,),
795 0x2a90a8bd5fd2bbf4,
796 fidl::encoding::DynamicFlags::empty(),
797 )
798 }
799}
800
801pub struct RouterAdvertisementOptionWatcherProviderEventStream {
802 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
803}
804
805impl std::marker::Unpin for RouterAdvertisementOptionWatcherProviderEventStream {}
806
807impl futures::stream::FusedStream for RouterAdvertisementOptionWatcherProviderEventStream {
808 fn is_terminated(&self) -> bool {
809 self.event_receiver.is_terminated()
810 }
811}
812
813impl futures::Stream for RouterAdvertisementOptionWatcherProviderEventStream {
814 type Item = Result<RouterAdvertisementOptionWatcherProviderEvent, fidl::Error>;
815
816 fn poll_next(
817 mut self: std::pin::Pin<&mut Self>,
818 cx: &mut std::task::Context<'_>,
819 ) -> std::task::Poll<Option<Self::Item>> {
820 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
821 &mut self.event_receiver,
822 cx
823 )?) {
824 Some(buf) => std::task::Poll::Ready(Some(
825 RouterAdvertisementOptionWatcherProviderEvent::decode(buf),
826 )),
827 None => std::task::Poll::Ready(None),
828 }
829 }
830}
831
832#[derive(Debug)]
833pub enum RouterAdvertisementOptionWatcherProviderEvent {}
834
835impl RouterAdvertisementOptionWatcherProviderEvent {
836 fn decode(
838 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
839 ) -> Result<RouterAdvertisementOptionWatcherProviderEvent, fidl::Error> {
840 let (bytes, _handles) = buf.split_mut();
841 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
842 debug_assert_eq!(tx_header.tx_id, 0);
843 match tx_header.ordinal {
844 _ => Err(fidl::Error::UnknownOrdinal {
845 ordinal: tx_header.ordinal,
846 protocol_name: <RouterAdvertisementOptionWatcherProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
847 })
848 }
849 }
850}
851
852pub struct RouterAdvertisementOptionWatcherProviderRequestStream {
854 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
855 is_terminated: bool,
856}
857
858impl std::marker::Unpin for RouterAdvertisementOptionWatcherProviderRequestStream {}
859
860impl futures::stream::FusedStream for RouterAdvertisementOptionWatcherProviderRequestStream {
861 fn is_terminated(&self) -> bool {
862 self.is_terminated
863 }
864}
865
866impl fidl::endpoints::RequestStream for RouterAdvertisementOptionWatcherProviderRequestStream {
867 type Protocol = RouterAdvertisementOptionWatcherProviderMarker;
868 type ControlHandle = RouterAdvertisementOptionWatcherProviderControlHandle;
869
870 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
871 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
872 }
873
874 fn control_handle(&self) -> Self::ControlHandle {
875 RouterAdvertisementOptionWatcherProviderControlHandle { inner: self.inner.clone() }
876 }
877
878 fn into_inner(
879 self,
880 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
881 {
882 (self.inner, self.is_terminated)
883 }
884
885 fn from_inner(
886 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
887 is_terminated: bool,
888 ) -> Self {
889 Self { inner, is_terminated }
890 }
891}
892
893impl futures::Stream for RouterAdvertisementOptionWatcherProviderRequestStream {
894 type Item = Result<RouterAdvertisementOptionWatcherProviderRequest, fidl::Error>;
895
896 fn poll_next(
897 mut self: std::pin::Pin<&mut Self>,
898 cx: &mut std::task::Context<'_>,
899 ) -> std::task::Poll<Option<Self::Item>> {
900 let this = &mut *self;
901 if this.inner.check_shutdown(cx) {
902 this.is_terminated = true;
903 return std::task::Poll::Ready(None);
904 }
905 if this.is_terminated {
906 panic!("polled RouterAdvertisementOptionWatcherProviderRequestStream after completion");
907 }
908 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
909 |bytes, handles| {
910 match this.inner.channel().read_etc(cx, bytes, handles) {
911 std::task::Poll::Ready(Ok(())) => {}
912 std::task::Poll::Pending => return std::task::Poll::Pending,
913 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
914 this.is_terminated = true;
915 return std::task::Poll::Ready(None);
916 }
917 std::task::Poll::Ready(Err(e)) => {
918 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
919 e.into(),
920 ))))
921 }
922 }
923
924 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
926
927 std::task::Poll::Ready(Some(match header.ordinal {
928 0x2a90a8bd5fd2bbf4 => {
929 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
930 let mut req = fidl::new_empty!(RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
931 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
932 let control_handle = RouterAdvertisementOptionWatcherProviderControlHandle {
933 inner: this.inner.clone(),
934 };
935 Ok(RouterAdvertisementOptionWatcherProviderRequest::NewRouterAdvertisementOptionWatcher {option_watcher: req.option_watcher,
936params: req.params,
937
938 control_handle,
939 })
940 }
941 _ => Err(fidl::Error::UnknownOrdinal {
942 ordinal: header.ordinal,
943 protocol_name: <RouterAdvertisementOptionWatcherProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
944 }),
945 }))
946 },
947 )
948 }
949}
950
951#[derive(Debug)]
960pub enum RouterAdvertisementOptionWatcherProviderRequest {
961 NewRouterAdvertisementOptionWatcher {
965 option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
966 params: RouterAdvertisementOptionWatcherParams,
967 control_handle: RouterAdvertisementOptionWatcherProviderControlHandle,
968 },
969}
970
971impl RouterAdvertisementOptionWatcherProviderRequest {
972 #[allow(irrefutable_let_patterns)]
973 pub fn into_new_router_advertisement_option_watcher(
974 self,
975 ) -> Option<(
976 fidl::endpoints::ServerEnd<OptionWatcherMarker>,
977 RouterAdvertisementOptionWatcherParams,
978 RouterAdvertisementOptionWatcherProviderControlHandle,
979 )> {
980 if let RouterAdvertisementOptionWatcherProviderRequest::NewRouterAdvertisementOptionWatcher {
981 option_watcher,
982 params,
983 control_handle,
984 } = self {
985 Some((option_watcher,params,
986 control_handle))
987 } else {
988 None
989 }
990 }
991
992 pub fn method_name(&self) -> &'static str {
994 match *self {
995 RouterAdvertisementOptionWatcherProviderRequest::NewRouterAdvertisementOptionWatcher{..} => "new_router_advertisement_option_watcher",
996 }
997 }
998}
999
1000#[derive(Debug, Clone)]
1001pub struct RouterAdvertisementOptionWatcherProviderControlHandle {
1002 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1003}
1004
1005impl fidl::endpoints::ControlHandle for RouterAdvertisementOptionWatcherProviderControlHandle {
1006 fn shutdown(&self) {
1007 self.inner.shutdown()
1008 }
1009 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1010 self.inner.shutdown_with_epitaph(status)
1011 }
1012
1013 fn is_closed(&self) -> bool {
1014 self.inner.channel().is_closed()
1015 }
1016 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1017 self.inner.channel().on_closed()
1018 }
1019
1020 #[cfg(target_os = "fuchsia")]
1021 fn signal_peer(
1022 &self,
1023 clear_mask: zx::Signals,
1024 set_mask: zx::Signals,
1025 ) -> Result<(), zx_status::Status> {
1026 use fidl::Peered;
1027 self.inner.channel().signal_peer(clear_mask, set_mask)
1028 }
1029}
1030
1031impl RouterAdvertisementOptionWatcherProviderControlHandle {}
1032
1033mod internal {
1034 use super::*;
1035
1036 impl fidl::encoding::ResourceTypeMarker
1037 for RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
1038 {
1039 type Borrowed<'a> = &'a mut Self;
1040 fn take_or_borrow<'a>(
1041 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1042 ) -> Self::Borrowed<'a> {
1043 value
1044 }
1045 }
1046
1047 unsafe impl fidl::encoding::TypeMarker
1048 for RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
1049 {
1050 type Owned = Self;
1051
1052 #[inline(always)]
1053 fn inline_align(_context: fidl::encoding::Context) -> usize {
1054 8
1055 }
1056
1057 #[inline(always)]
1058 fn inline_size(_context: fidl::encoding::Context) -> usize {
1059 24
1060 }
1061 }
1062
1063 unsafe impl
1064 fidl::encoding::Encode<
1065 RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest,
1066 fidl::encoding::DefaultFuchsiaResourceDialect,
1067 >
1068 for &mut RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
1069 {
1070 #[inline]
1071 unsafe fn encode(
1072 self,
1073 encoder: &mut fidl::encoding::Encoder<
1074 '_,
1075 fidl::encoding::DefaultFuchsiaResourceDialect,
1076 >,
1077 offset: usize,
1078 _depth: fidl::encoding::Depth,
1079 ) -> fidl::Result<()> {
1080 encoder.debug_check_bounds::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(offset);
1081 fidl::encoding::Encode::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1083 (
1084 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<OptionWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.option_watcher),
1085 <RouterAdvertisementOptionWatcherParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
1086 ),
1087 encoder, offset, _depth
1088 )
1089 }
1090 }
1091 unsafe impl<
1092 T0: fidl::encoding::Encode<
1093 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<OptionWatcherMarker>>,
1094 fidl::encoding::DefaultFuchsiaResourceDialect,
1095 >,
1096 T1: fidl::encoding::Encode<
1097 RouterAdvertisementOptionWatcherParams,
1098 fidl::encoding::DefaultFuchsiaResourceDialect,
1099 >,
1100 >
1101 fidl::encoding::Encode<
1102 RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest,
1103 fidl::encoding::DefaultFuchsiaResourceDialect,
1104 > for (T0, T1)
1105 {
1106 #[inline]
1107 unsafe fn encode(
1108 self,
1109 encoder: &mut fidl::encoding::Encoder<
1110 '_,
1111 fidl::encoding::DefaultFuchsiaResourceDialect,
1112 >,
1113 offset: usize,
1114 depth: fidl::encoding::Depth,
1115 ) -> fidl::Result<()> {
1116 encoder.debug_check_bounds::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(offset);
1117 unsafe {
1120 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1121 (ptr as *mut u64).write_unaligned(0);
1122 }
1123 self.0.encode(encoder, offset + 0, depth)?;
1125 self.1.encode(encoder, offset + 8, depth)?;
1126 Ok(())
1127 }
1128 }
1129
1130 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1131 for RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
1132 {
1133 #[inline(always)]
1134 fn new_empty() -> Self {
1135 Self {
1136 option_watcher: fidl::new_empty!(
1137 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<OptionWatcherMarker>>,
1138 fidl::encoding::DefaultFuchsiaResourceDialect
1139 ),
1140 params: fidl::new_empty!(
1141 RouterAdvertisementOptionWatcherParams,
1142 fidl::encoding::DefaultFuchsiaResourceDialect
1143 ),
1144 }
1145 }
1146
1147 #[inline]
1148 unsafe fn decode(
1149 &mut self,
1150 decoder: &mut fidl::encoding::Decoder<
1151 '_,
1152 fidl::encoding::DefaultFuchsiaResourceDialect,
1153 >,
1154 offset: usize,
1155 _depth: fidl::encoding::Depth,
1156 ) -> fidl::Result<()> {
1157 decoder.debug_check_bounds::<Self>(offset);
1158 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1160 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1161 let mask = 0xffffffff00000000u64;
1162 let maskedval = padval & mask;
1163 if maskedval != 0 {
1164 return Err(fidl::Error::NonZeroPadding {
1165 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1166 });
1167 }
1168 fidl::decode!(
1169 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<OptionWatcherMarker>>,
1170 fidl::encoding::DefaultFuchsiaResourceDialect,
1171 &mut self.option_watcher,
1172 decoder,
1173 offset + 0,
1174 _depth
1175 )?;
1176 fidl::decode!(
1177 RouterAdvertisementOptionWatcherParams,
1178 fidl::encoding::DefaultFuchsiaResourceDialect,
1179 &mut self.params,
1180 decoder,
1181 offset + 8,
1182 _depth
1183 )?;
1184 Ok(())
1185 }
1186 }
1187}