fidl_fuchsia_net_dhcpv6/
fidl_fuchsia_net_dhcpv6.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_dhcpv6_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ClientProviderNewClientRequest {
16    pub params: NewClientParams,
17    pub request: fidl::endpoints::ServerEnd<ClientMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for ClientProviderNewClientRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct ClientWatchAddressResponse {
27    pub address: fidl_fuchsia_net::Subnet,
28    pub address_parameters: fidl_fuchsia_net_interfaces_admin::AddressParameters,
29    pub address_state_provider:
30        fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker>,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
34    for ClientWatchAddressResponse
35{
36}
37
38#[derive(Debug, PartialEq)]
39pub struct PrefixProviderAcquirePrefixRequest {
40    pub config: AcquirePrefixConfig,
41    pub prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45    for PrefixProviderAcquirePrefixRequest
46{
47}
48
49#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
50pub struct ClientMarker;
51
52impl fidl::endpoints::ProtocolMarker for ClientMarker {
53    type Proxy = ClientProxy;
54    type RequestStream = ClientRequestStream;
55    #[cfg(target_os = "fuchsia")]
56    type SynchronousProxy = ClientSynchronousProxy;
57
58    const DEBUG_NAME: &'static str = "(anonymous) Client";
59}
60pub type ClientShutdownResult = Result<(), i32>;
61
62pub trait ClientProxyInterface: Send + Sync {
63    type WatchServersResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_net_name::DnsServer_>, fidl::Error>>
64        + Send;
65    fn r#watch_servers(&self) -> Self::WatchServersResponseFut;
66    type WatchAddressResponseFut: std::future::Future<
67            Output = Result<
68                (
69                    fidl_fuchsia_net::Subnet,
70                    fidl_fuchsia_net_interfaces_admin::AddressParameters,
71                    fidl::endpoints::ServerEnd<
72                        fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
73                    >,
74                ),
75                fidl::Error,
76            >,
77        > + Send;
78    fn r#watch_address(&self) -> Self::WatchAddressResponseFut;
79    type WatchPrefixesResponseFut: std::future::Future<Output = Result<Vec<Prefix>, fidl::Error>>
80        + Send;
81    fn r#watch_prefixes(&self) -> Self::WatchPrefixesResponseFut;
82    type ShutdownResponseFut: std::future::Future<Output = Result<ClientShutdownResult, fidl::Error>>
83        + Send;
84    fn r#shutdown(&self) -> Self::ShutdownResponseFut;
85}
86#[derive(Debug)]
87#[cfg(target_os = "fuchsia")]
88pub struct ClientSynchronousProxy {
89    client: fidl::client::sync::Client,
90}
91
92#[cfg(target_os = "fuchsia")]
93impl fidl::endpoints::SynchronousProxy for ClientSynchronousProxy {
94    type Proxy = ClientProxy;
95    type Protocol = ClientMarker;
96
97    fn from_channel(inner: fidl::Channel) -> Self {
98        Self::new(inner)
99    }
100
101    fn into_channel(self) -> fidl::Channel {
102        self.client.into_channel()
103    }
104
105    fn as_channel(&self) -> &fidl::Channel {
106        self.client.as_channel()
107    }
108}
109
110#[cfg(target_os = "fuchsia")]
111impl ClientSynchronousProxy {
112    pub fn new(channel: fidl::Channel) -> Self {
113        let protocol_name = <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
114        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
115    }
116
117    pub fn into_channel(self) -> fidl::Channel {
118        self.client.into_channel()
119    }
120
121    /// Waits until an event arrives and returns it. It is safe for other
122    /// threads to make concurrent requests while waiting for an event.
123    pub fn wait_for_event(
124        &self,
125        deadline: zx::MonotonicInstant,
126    ) -> Result<ClientEvent, fidl::Error> {
127        ClientEvent::decode(self.client.wait_for_event(deadline)?)
128    }
129
130    /// Returns a list of DNS servers.
131    ///
132    /// First call always returns a snapshot of the current list of servers or blocks if an empty
133    /// list would be returned. Subsequent calls will block until the list of servers changes.
134    ///
135    /// The list of servers changes over time by configuration or network topology changes,
136    /// expiration, etc. Callers must repeatedly call `WatchServers` and replace any previously
137    /// returned `servers` with new ones to avoid using stale or expired entries.
138    ///
139    /// It is invalid to call this method while a previous call is pending. Doing so will cause the
140    /// server end of the protocol to be closed.
141    ///
142    /// - response `servers` The list of servers to use for DNS resolution, in priority order.
143    pub fn r#watch_servers(
144        &self,
145        ___deadline: zx::MonotonicInstant,
146    ) -> Result<Vec<fidl_fuchsia_net_name::DnsServer_>, fidl::Error> {
147        let _response = self.client.send_query::<
148            fidl::encoding::EmptyPayload,
149            fidl_fuchsia_net_name::DnsServerWatcherWatchServersResponse,
150        >(
151            (),
152            0x5748907e7f11b632,
153            fidl::encoding::DynamicFlags::empty(),
154            ___deadline,
155        )?;
156        Ok(_response.servers)
157    }
158
159    /// Returns an address and its parameters.
160    ///
161    /// Yields a value for every address acquired by the client.
162    ///
163    /// It is invalid to call this method while a previous call is pending.
164    /// Doing so will cause the server end of the protocol to be closed.
165    ///
166    /// - response `address` the assigned address.
167    /// - response `address_parameters` the parameters of the address.
168    /// - response `address_state_provider` provides address assignment state
169    ///     and enables updating address properties; client end is closed if
170    ///     the address becomes invalid (its valid lifetime expires and Renew
171    ///     and Rebind fail).
172    pub fn r#watch_address(
173        &self,
174        ___deadline: zx::MonotonicInstant,
175    ) -> Result<
176        (
177            fidl_fuchsia_net::Subnet,
178            fidl_fuchsia_net_interfaces_admin::AddressParameters,
179            fidl::endpoints::ServerEnd<
180                fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
181            >,
182        ),
183        fidl::Error,
184    > {
185        let _response =
186            self.client.send_query::<fidl::encoding::EmptyPayload, ClientWatchAddressResponse>(
187                (),
188                0x942e6f66f63721c,
189                fidl::encoding::DynamicFlags::empty(),
190                ___deadline,
191            )?;
192        Ok((_response.address, _response.address_parameters, _response.address_state_provider))
193    }
194
195    /// Hanging get for prefix leases.
196    ///
197    /// The first call to this method will return when there is at least
198    /// one lease to report (the first call is guaranteed to return with a
199    /// non-empty vector). Subsequent calls will return immediately if there
200    /// is a change to report, or block until a change occurs.
201    ///
202    /// It is invalid to call this method while a previous call is pending.
203    /// Doing so will cause the server end of the protocol to be closed.
204    ///
205    /// - response `prefixes` the assigned prefixes and their lifetimes.
206    pub fn r#watch_prefixes(
207        &self,
208        ___deadline: zx::MonotonicInstant,
209    ) -> Result<Vec<Prefix>, fidl::Error> {
210        let _response =
211            self.client.send_query::<fidl::encoding::EmptyPayload, ClientWatchPrefixesResponse>(
212                (),
213                0x3b7908cc71ae2a5e,
214                fidl::encoding::DynamicFlags::empty(),
215                ___deadline,
216            )?;
217        Ok(_response.prefixes)
218    }
219
220    /// Gracefully tears down the underlying object.
221    ///
222    /// Blocks until any held addresses are gracefully released, as described in
223    /// [RFC 8415, Section 18.2.7](https://tools.ietf.org/html/rfc8415#section-18.2.7).
224    ///
225    /// The server end of the protocol is closed after this method returns.
226    ///
227    /// * error a `zx.Status` if any of the addresses were not gracefully
228    ///     released, e.g. the client times out waiting for Reply to Release,
229    ///     or the interface is down and sending Release fails.
230    pub fn r#shutdown(
231        &self,
232        ___deadline: zx::MonotonicInstant,
233    ) -> Result<ClientShutdownResult, fidl::Error> {
234        let _response = self.client.send_query::<
235            fidl::encoding::EmptyPayload,
236            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
237        >(
238            (),
239            0x6da95f1bcd43fa11,
240            fidl::encoding::DynamicFlags::empty(),
241            ___deadline,
242        )?;
243        Ok(_response.map(|x| x))
244    }
245}
246
247#[cfg(target_os = "fuchsia")]
248impl From<ClientSynchronousProxy> for zx::Handle {
249    fn from(value: ClientSynchronousProxy) -> Self {
250        value.into_channel().into()
251    }
252}
253
254#[cfg(target_os = "fuchsia")]
255impl From<fidl::Channel> for ClientSynchronousProxy {
256    fn from(value: fidl::Channel) -> Self {
257        Self::new(value)
258    }
259}
260
261#[derive(Debug, Clone)]
262pub struct ClientProxy {
263    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
264}
265
266impl fidl::endpoints::Proxy for ClientProxy {
267    type Protocol = ClientMarker;
268
269    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
270        Self::new(inner)
271    }
272
273    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
274        self.client.into_channel().map_err(|client| Self { client })
275    }
276
277    fn as_channel(&self) -> &::fidl::AsyncChannel {
278        self.client.as_channel()
279    }
280}
281
282impl ClientProxy {
283    /// Create a new Proxy for fuchsia.net.dhcpv6/Client.
284    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
285        let protocol_name = <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
286        Self { client: fidl::client::Client::new(channel, protocol_name) }
287    }
288
289    /// Get a Stream of events from the remote end of the protocol.
290    ///
291    /// # Panics
292    ///
293    /// Panics if the event stream was already taken.
294    pub fn take_event_stream(&self) -> ClientEventStream {
295        ClientEventStream { event_receiver: self.client.take_event_receiver() }
296    }
297
298    /// Returns a list of DNS servers.
299    ///
300    /// First call always returns a snapshot of the current list of servers or blocks if an empty
301    /// list would be returned. Subsequent calls will block until the list of servers changes.
302    ///
303    /// The list of servers changes over time by configuration or network topology changes,
304    /// expiration, etc. Callers must repeatedly call `WatchServers` and replace any previously
305    /// returned `servers` with new ones to avoid using stale or expired entries.
306    ///
307    /// It is invalid to call this method while a previous call is pending. Doing so will cause the
308    /// server end of the protocol to be closed.
309    ///
310    /// - response `servers` The list of servers to use for DNS resolution, in priority order.
311    pub fn r#watch_servers(
312        &self,
313    ) -> fidl::client::QueryResponseFut<
314        Vec<fidl_fuchsia_net_name::DnsServer_>,
315        fidl::encoding::DefaultFuchsiaResourceDialect,
316    > {
317        ClientProxyInterface::r#watch_servers(self)
318    }
319
320    /// Returns an address and its parameters.
321    ///
322    /// Yields a value for every address acquired by the client.
323    ///
324    /// It is invalid to call this method while a previous call is pending.
325    /// Doing so will cause the server end of the protocol to be closed.
326    ///
327    /// - response `address` the assigned address.
328    /// - response `address_parameters` the parameters of the address.
329    /// - response `address_state_provider` provides address assignment state
330    ///     and enables updating address properties; client end is closed if
331    ///     the address becomes invalid (its valid lifetime expires and Renew
332    ///     and Rebind fail).
333    pub fn r#watch_address(
334        &self,
335    ) -> fidl::client::QueryResponseFut<
336        (
337            fidl_fuchsia_net::Subnet,
338            fidl_fuchsia_net_interfaces_admin::AddressParameters,
339            fidl::endpoints::ServerEnd<
340                fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
341            >,
342        ),
343        fidl::encoding::DefaultFuchsiaResourceDialect,
344    > {
345        ClientProxyInterface::r#watch_address(self)
346    }
347
348    /// Hanging get for prefix leases.
349    ///
350    /// The first call to this method will return when there is at least
351    /// one lease to report (the first call is guaranteed to return with a
352    /// non-empty vector). Subsequent calls will return immediately if there
353    /// is a change to report, or block until a change occurs.
354    ///
355    /// It is invalid to call this method while a previous call is pending.
356    /// Doing so will cause the server end of the protocol to be closed.
357    ///
358    /// - response `prefixes` the assigned prefixes and their lifetimes.
359    pub fn r#watch_prefixes(
360        &self,
361    ) -> fidl::client::QueryResponseFut<Vec<Prefix>, fidl::encoding::DefaultFuchsiaResourceDialect>
362    {
363        ClientProxyInterface::r#watch_prefixes(self)
364    }
365
366    /// Gracefully tears down the underlying object.
367    ///
368    /// Blocks until any held addresses are gracefully released, as described in
369    /// [RFC 8415, Section 18.2.7](https://tools.ietf.org/html/rfc8415#section-18.2.7).
370    ///
371    /// The server end of the protocol is closed after this method returns.
372    ///
373    /// * error a `zx.Status` if any of the addresses were not gracefully
374    ///     released, e.g. the client times out waiting for Reply to Release,
375    ///     or the interface is down and sending Release fails.
376    pub fn r#shutdown(
377        &self,
378    ) -> fidl::client::QueryResponseFut<
379        ClientShutdownResult,
380        fidl::encoding::DefaultFuchsiaResourceDialect,
381    > {
382        ClientProxyInterface::r#shutdown(self)
383    }
384}
385
386impl ClientProxyInterface for ClientProxy {
387    type WatchServersResponseFut = fidl::client::QueryResponseFut<
388        Vec<fidl_fuchsia_net_name::DnsServer_>,
389        fidl::encoding::DefaultFuchsiaResourceDialect,
390    >;
391    fn r#watch_servers(&self) -> Self::WatchServersResponseFut {
392        fn _decode(
393            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
394        ) -> Result<Vec<fidl_fuchsia_net_name::DnsServer_>, fidl::Error> {
395            let _response = fidl::client::decode_transaction_body::<
396                fidl_fuchsia_net_name::DnsServerWatcherWatchServersResponse,
397                fidl::encoding::DefaultFuchsiaResourceDialect,
398                0x5748907e7f11b632,
399            >(_buf?)?;
400            Ok(_response.servers)
401        }
402        self.client.send_query_and_decode::<
403            fidl::encoding::EmptyPayload,
404            Vec<fidl_fuchsia_net_name::DnsServer_>,
405        >(
406            (),
407            0x5748907e7f11b632,
408            fidl::encoding::DynamicFlags::empty(),
409            _decode,
410        )
411    }
412
413    type WatchAddressResponseFut = fidl::client::QueryResponseFut<
414        (
415            fidl_fuchsia_net::Subnet,
416            fidl_fuchsia_net_interfaces_admin::AddressParameters,
417            fidl::endpoints::ServerEnd<
418                fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
419            >,
420        ),
421        fidl::encoding::DefaultFuchsiaResourceDialect,
422    >;
423    fn r#watch_address(&self) -> Self::WatchAddressResponseFut {
424        fn _decode(
425            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
426        ) -> Result<
427            (
428                fidl_fuchsia_net::Subnet,
429                fidl_fuchsia_net_interfaces_admin::AddressParameters,
430                fidl::endpoints::ServerEnd<
431                    fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
432                >,
433            ),
434            fidl::Error,
435        > {
436            let _response = fidl::client::decode_transaction_body::<
437                ClientWatchAddressResponse,
438                fidl::encoding::DefaultFuchsiaResourceDialect,
439                0x942e6f66f63721c,
440            >(_buf?)?;
441            Ok((_response.address, _response.address_parameters, _response.address_state_provider))
442        }
443        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (
444            fidl_fuchsia_net::Subnet,
445            fidl_fuchsia_net_interfaces_admin::AddressParameters,
446            fidl::endpoints::ServerEnd<
447                fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
448            >,
449        )>((), 0x942e6f66f63721c, fidl::encoding::DynamicFlags::empty(), _decode)
450    }
451
452    type WatchPrefixesResponseFut =
453        fidl::client::QueryResponseFut<Vec<Prefix>, fidl::encoding::DefaultFuchsiaResourceDialect>;
454    fn r#watch_prefixes(&self) -> Self::WatchPrefixesResponseFut {
455        fn _decode(
456            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
457        ) -> Result<Vec<Prefix>, fidl::Error> {
458            let _response = fidl::client::decode_transaction_body::<
459                ClientWatchPrefixesResponse,
460                fidl::encoding::DefaultFuchsiaResourceDialect,
461                0x3b7908cc71ae2a5e,
462            >(_buf?)?;
463            Ok(_response.prefixes)
464        }
465        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Prefix>>(
466            (),
467            0x3b7908cc71ae2a5e,
468            fidl::encoding::DynamicFlags::empty(),
469            _decode,
470        )
471    }
472
473    type ShutdownResponseFut = fidl::client::QueryResponseFut<
474        ClientShutdownResult,
475        fidl::encoding::DefaultFuchsiaResourceDialect,
476    >;
477    fn r#shutdown(&self) -> Self::ShutdownResponseFut {
478        fn _decode(
479            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
480        ) -> Result<ClientShutdownResult, fidl::Error> {
481            let _response = fidl::client::decode_transaction_body::<
482                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
483                fidl::encoding::DefaultFuchsiaResourceDialect,
484                0x6da95f1bcd43fa11,
485            >(_buf?)?;
486            Ok(_response.map(|x| x))
487        }
488        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ClientShutdownResult>(
489            (),
490            0x6da95f1bcd43fa11,
491            fidl::encoding::DynamicFlags::empty(),
492            _decode,
493        )
494    }
495}
496
497pub struct ClientEventStream {
498    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
499}
500
501impl std::marker::Unpin for ClientEventStream {}
502
503impl futures::stream::FusedStream for ClientEventStream {
504    fn is_terminated(&self) -> bool {
505        self.event_receiver.is_terminated()
506    }
507}
508
509impl futures::Stream for ClientEventStream {
510    type Item = Result<ClientEvent, fidl::Error>;
511
512    fn poll_next(
513        mut self: std::pin::Pin<&mut Self>,
514        cx: &mut std::task::Context<'_>,
515    ) -> std::task::Poll<Option<Self::Item>> {
516        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
517            &mut self.event_receiver,
518            cx
519        )?) {
520            Some(buf) => std::task::Poll::Ready(Some(ClientEvent::decode(buf))),
521            None => std::task::Poll::Ready(None),
522        }
523    }
524}
525
526#[derive(Debug)]
527pub enum ClientEvent {}
528
529impl ClientEvent {
530    /// Decodes a message buffer as a [`ClientEvent`].
531    fn decode(
532        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
533    ) -> Result<ClientEvent, fidl::Error> {
534        let (bytes, _handles) = buf.split_mut();
535        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
536        debug_assert_eq!(tx_header.tx_id, 0);
537        match tx_header.ordinal {
538            _ => Err(fidl::Error::UnknownOrdinal {
539                ordinal: tx_header.ordinal,
540                protocol_name: <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
541            }),
542        }
543    }
544}
545
546/// A Stream of incoming requests for fuchsia.net.dhcpv6/Client.
547pub struct ClientRequestStream {
548    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
549    is_terminated: bool,
550}
551
552impl std::marker::Unpin for ClientRequestStream {}
553
554impl futures::stream::FusedStream for ClientRequestStream {
555    fn is_terminated(&self) -> bool {
556        self.is_terminated
557    }
558}
559
560impl fidl::endpoints::RequestStream for ClientRequestStream {
561    type Protocol = ClientMarker;
562    type ControlHandle = ClientControlHandle;
563
564    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
565        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
566    }
567
568    fn control_handle(&self) -> Self::ControlHandle {
569        ClientControlHandle { inner: self.inner.clone() }
570    }
571
572    fn into_inner(
573        self,
574    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
575    {
576        (self.inner, self.is_terminated)
577    }
578
579    fn from_inner(
580        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
581        is_terminated: bool,
582    ) -> Self {
583        Self { inner, is_terminated }
584    }
585}
586
587impl futures::Stream for ClientRequestStream {
588    type Item = Result<ClientRequest, fidl::Error>;
589
590    fn poll_next(
591        mut self: std::pin::Pin<&mut Self>,
592        cx: &mut std::task::Context<'_>,
593    ) -> std::task::Poll<Option<Self::Item>> {
594        let this = &mut *self;
595        if this.inner.check_shutdown(cx) {
596            this.is_terminated = true;
597            return std::task::Poll::Ready(None);
598        }
599        if this.is_terminated {
600            panic!("polled ClientRequestStream after completion");
601        }
602        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
603            |bytes, handles| {
604                match this.inner.channel().read_etc(cx, bytes, handles) {
605                    std::task::Poll::Ready(Ok(())) => {}
606                    std::task::Poll::Pending => return std::task::Poll::Pending,
607                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
608                        this.is_terminated = true;
609                        return std::task::Poll::Ready(None);
610                    }
611                    std::task::Poll::Ready(Err(e)) => {
612                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
613                            e.into(),
614                        ))))
615                    }
616                }
617
618                // A message has been received from the channel
619                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
620
621                std::task::Poll::Ready(Some(match header.ordinal {
622                    0x5748907e7f11b632 => {
623                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
624                        let mut req = fidl::new_empty!(
625                            fidl::encoding::EmptyPayload,
626                            fidl::encoding::DefaultFuchsiaResourceDialect
627                        );
628                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
629                        let control_handle = ClientControlHandle { inner: this.inner.clone() };
630                        Ok(ClientRequest::WatchServers {
631                            responder: ClientWatchServersResponder {
632                                control_handle: std::mem::ManuallyDrop::new(control_handle),
633                                tx_id: header.tx_id,
634                            },
635                        })
636                    }
637                    0x942e6f66f63721c => {
638                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
639                        let mut req = fidl::new_empty!(
640                            fidl::encoding::EmptyPayload,
641                            fidl::encoding::DefaultFuchsiaResourceDialect
642                        );
643                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
644                        let control_handle = ClientControlHandle { inner: this.inner.clone() };
645                        Ok(ClientRequest::WatchAddress {
646                            responder: ClientWatchAddressResponder {
647                                control_handle: std::mem::ManuallyDrop::new(control_handle),
648                                tx_id: header.tx_id,
649                            },
650                        })
651                    }
652                    0x3b7908cc71ae2a5e => {
653                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
654                        let mut req = fidl::new_empty!(
655                            fidl::encoding::EmptyPayload,
656                            fidl::encoding::DefaultFuchsiaResourceDialect
657                        );
658                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
659                        let control_handle = ClientControlHandle { inner: this.inner.clone() };
660                        Ok(ClientRequest::WatchPrefixes {
661                            responder: ClientWatchPrefixesResponder {
662                                control_handle: std::mem::ManuallyDrop::new(control_handle),
663                                tx_id: header.tx_id,
664                            },
665                        })
666                    }
667                    0x6da95f1bcd43fa11 => {
668                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
669                        let mut req = fidl::new_empty!(
670                            fidl::encoding::EmptyPayload,
671                            fidl::encoding::DefaultFuchsiaResourceDialect
672                        );
673                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
674                        let control_handle = ClientControlHandle { inner: this.inner.clone() };
675                        Ok(ClientRequest::Shutdown {
676                            responder: ClientShutdownResponder {
677                                control_handle: std::mem::ManuallyDrop::new(control_handle),
678                                tx_id: header.tx_id,
679                            },
680                        })
681                    }
682                    _ => Err(fidl::Error::UnknownOrdinal {
683                        ordinal: header.ordinal,
684                        protocol_name:
685                            <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
686                    }),
687                }))
688            },
689        )
690    }
691}
692
693/// Provides methods to watch for discovered network configurations.
694///
695/// This protocol encodes the underlying object's lifetime in both directions;
696/// the underlying object is alive iff both ends of the protocol are open. That
697/// is:
698///
699/// - Closing the client end causes the object to be destroyed.
700/// - Observing a closure of the server end indicates the object no longer
701///   exists.
702#[derive(Debug)]
703pub enum ClientRequest {
704    /// Returns a list of DNS servers.
705    ///
706    /// First call always returns a snapshot of the current list of servers or blocks if an empty
707    /// list would be returned. Subsequent calls will block until the list of servers changes.
708    ///
709    /// The list of servers changes over time by configuration or network topology changes,
710    /// expiration, etc. Callers must repeatedly call `WatchServers` and replace any previously
711    /// returned `servers` with new ones to avoid using stale or expired entries.
712    ///
713    /// It is invalid to call this method while a previous call is pending. Doing so will cause the
714    /// server end of the protocol to be closed.
715    ///
716    /// - response `servers` The list of servers to use for DNS resolution, in priority order.
717    WatchServers { responder: ClientWatchServersResponder },
718    /// Returns an address and its parameters.
719    ///
720    /// Yields a value for every address acquired by the client.
721    ///
722    /// It is invalid to call this method while a previous call is pending.
723    /// Doing so will cause the server end of the protocol to be closed.
724    ///
725    /// - response `address` the assigned address.
726    /// - response `address_parameters` the parameters of the address.
727    /// - response `address_state_provider` provides address assignment state
728    ///     and enables updating address properties; client end is closed if
729    ///     the address becomes invalid (its valid lifetime expires and Renew
730    ///     and Rebind fail).
731    WatchAddress { responder: ClientWatchAddressResponder },
732    /// Hanging get for prefix leases.
733    ///
734    /// The first call to this method will return when there is at least
735    /// one lease to report (the first call is guaranteed to return with a
736    /// non-empty vector). Subsequent calls will return immediately if there
737    /// is a change to report, or block until a change occurs.
738    ///
739    /// It is invalid to call this method while a previous call is pending.
740    /// Doing so will cause the server end of the protocol to be closed.
741    ///
742    /// - response `prefixes` the assigned prefixes and their lifetimes.
743    WatchPrefixes { responder: ClientWatchPrefixesResponder },
744    /// Gracefully tears down the underlying object.
745    ///
746    /// Blocks until any held addresses are gracefully released, as described in
747    /// [RFC 8415, Section 18.2.7](https://tools.ietf.org/html/rfc8415#section-18.2.7).
748    ///
749    /// The server end of the protocol is closed after this method returns.
750    ///
751    /// * error a `zx.Status` if any of the addresses were not gracefully
752    ///     released, e.g. the client times out waiting for Reply to Release,
753    ///     or the interface is down and sending Release fails.
754    Shutdown { responder: ClientShutdownResponder },
755}
756
757impl ClientRequest {
758    #[allow(irrefutable_let_patterns)]
759    pub fn into_watch_servers(self) -> Option<(ClientWatchServersResponder)> {
760        if let ClientRequest::WatchServers { responder } = self {
761            Some((responder))
762        } else {
763            None
764        }
765    }
766
767    #[allow(irrefutable_let_patterns)]
768    pub fn into_watch_address(self) -> Option<(ClientWatchAddressResponder)> {
769        if let ClientRequest::WatchAddress { responder } = self {
770            Some((responder))
771        } else {
772            None
773        }
774    }
775
776    #[allow(irrefutable_let_patterns)]
777    pub fn into_watch_prefixes(self) -> Option<(ClientWatchPrefixesResponder)> {
778        if let ClientRequest::WatchPrefixes { responder } = self {
779            Some((responder))
780        } else {
781            None
782        }
783    }
784
785    #[allow(irrefutable_let_patterns)]
786    pub fn into_shutdown(self) -> Option<(ClientShutdownResponder)> {
787        if let ClientRequest::Shutdown { responder } = self {
788            Some((responder))
789        } else {
790            None
791        }
792    }
793
794    /// Name of the method defined in FIDL
795    pub fn method_name(&self) -> &'static str {
796        match *self {
797            ClientRequest::WatchServers { .. } => "watch_servers",
798            ClientRequest::WatchAddress { .. } => "watch_address",
799            ClientRequest::WatchPrefixes { .. } => "watch_prefixes",
800            ClientRequest::Shutdown { .. } => "shutdown",
801        }
802    }
803}
804
805#[derive(Debug, Clone)]
806pub struct ClientControlHandle {
807    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
808}
809
810impl fidl::endpoints::ControlHandle for ClientControlHandle {
811    fn shutdown(&self) {
812        self.inner.shutdown()
813    }
814    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
815        self.inner.shutdown_with_epitaph(status)
816    }
817
818    fn is_closed(&self) -> bool {
819        self.inner.channel().is_closed()
820    }
821    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
822        self.inner.channel().on_closed()
823    }
824
825    #[cfg(target_os = "fuchsia")]
826    fn signal_peer(
827        &self,
828        clear_mask: zx::Signals,
829        set_mask: zx::Signals,
830    ) -> Result<(), zx_status::Status> {
831        use fidl::Peered;
832        self.inner.channel().signal_peer(clear_mask, set_mask)
833    }
834}
835
836impl ClientControlHandle {}
837
838#[must_use = "FIDL methods require a response to be sent"]
839#[derive(Debug)]
840pub struct ClientWatchServersResponder {
841    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
842    tx_id: u32,
843}
844
845/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
846/// if the responder is dropped without sending a response, so that the client
847/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
848impl std::ops::Drop for ClientWatchServersResponder {
849    fn drop(&mut self) {
850        self.control_handle.shutdown();
851        // Safety: drops once, never accessed again
852        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
853    }
854}
855
856impl fidl::endpoints::Responder for ClientWatchServersResponder {
857    type ControlHandle = ClientControlHandle;
858
859    fn control_handle(&self) -> &ClientControlHandle {
860        &self.control_handle
861    }
862
863    fn drop_without_shutdown(mut self) {
864        // Safety: drops once, never accessed again due to mem::forget
865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
866        // Prevent Drop from running (which would shut down the channel)
867        std::mem::forget(self);
868    }
869}
870
871impl ClientWatchServersResponder {
872    /// Sends a response to the FIDL transaction.
873    ///
874    /// Sets the channel to shutdown if an error occurs.
875    pub fn send(
876        self,
877        mut servers: &[fidl_fuchsia_net_name::DnsServer_],
878    ) -> Result<(), fidl::Error> {
879        let _result = self.send_raw(servers);
880        if _result.is_err() {
881            self.control_handle.shutdown();
882        }
883        self.drop_without_shutdown();
884        _result
885    }
886
887    /// Similar to "send" but does not shutdown the channel if an error occurs.
888    pub fn send_no_shutdown_on_err(
889        self,
890        mut servers: &[fidl_fuchsia_net_name::DnsServer_],
891    ) -> Result<(), fidl::Error> {
892        let _result = self.send_raw(servers);
893        self.drop_without_shutdown();
894        _result
895    }
896
897    fn send_raw(
898        &self,
899        mut servers: &[fidl_fuchsia_net_name::DnsServer_],
900    ) -> Result<(), fidl::Error> {
901        self.control_handle
902            .inner
903            .send::<fidl_fuchsia_net_name::DnsServerWatcherWatchServersResponse>(
904                (servers,),
905                self.tx_id,
906                0x5748907e7f11b632,
907                fidl::encoding::DynamicFlags::empty(),
908            )
909    }
910}
911
912#[must_use = "FIDL methods require a response to be sent"]
913#[derive(Debug)]
914pub struct ClientWatchAddressResponder {
915    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
916    tx_id: u32,
917}
918
919/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
920/// if the responder is dropped without sending a response, so that the client
921/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
922impl std::ops::Drop for ClientWatchAddressResponder {
923    fn drop(&mut self) {
924        self.control_handle.shutdown();
925        // Safety: drops once, never accessed again
926        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
927    }
928}
929
930impl fidl::endpoints::Responder for ClientWatchAddressResponder {
931    type ControlHandle = ClientControlHandle;
932
933    fn control_handle(&self) -> &ClientControlHandle {
934        &self.control_handle
935    }
936
937    fn drop_without_shutdown(mut self) {
938        // Safety: drops once, never accessed again due to mem::forget
939        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
940        // Prevent Drop from running (which would shut down the channel)
941        std::mem::forget(self);
942    }
943}
944
945impl ClientWatchAddressResponder {
946    /// Sends a response to the FIDL transaction.
947    ///
948    /// Sets the channel to shutdown if an error occurs.
949    pub fn send(
950        self,
951        mut address: &fidl_fuchsia_net::Subnet,
952        mut address_parameters: &fidl_fuchsia_net_interfaces_admin::AddressParameters,
953        mut address_state_provider: fidl::endpoints::ServerEnd<
954            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
955        >,
956    ) -> Result<(), fidl::Error> {
957        let _result = self.send_raw(address, address_parameters, address_state_provider);
958        if _result.is_err() {
959            self.control_handle.shutdown();
960        }
961        self.drop_without_shutdown();
962        _result
963    }
964
965    /// Similar to "send" but does not shutdown the channel if an error occurs.
966    pub fn send_no_shutdown_on_err(
967        self,
968        mut address: &fidl_fuchsia_net::Subnet,
969        mut address_parameters: &fidl_fuchsia_net_interfaces_admin::AddressParameters,
970        mut address_state_provider: fidl::endpoints::ServerEnd<
971            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
972        >,
973    ) -> Result<(), fidl::Error> {
974        let _result = self.send_raw(address, address_parameters, address_state_provider);
975        self.drop_without_shutdown();
976        _result
977    }
978
979    fn send_raw(
980        &self,
981        mut address: &fidl_fuchsia_net::Subnet,
982        mut address_parameters: &fidl_fuchsia_net_interfaces_admin::AddressParameters,
983        mut address_state_provider: fidl::endpoints::ServerEnd<
984            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
985        >,
986    ) -> Result<(), fidl::Error> {
987        self.control_handle.inner.send::<ClientWatchAddressResponse>(
988            (address, address_parameters, address_state_provider),
989            self.tx_id,
990            0x942e6f66f63721c,
991            fidl::encoding::DynamicFlags::empty(),
992        )
993    }
994}
995
996#[must_use = "FIDL methods require a response to be sent"]
997#[derive(Debug)]
998pub struct ClientWatchPrefixesResponder {
999    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
1000    tx_id: u32,
1001}
1002
1003/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
1004/// if the responder is dropped without sending a response, so that the client
1005/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1006impl std::ops::Drop for ClientWatchPrefixesResponder {
1007    fn drop(&mut self) {
1008        self.control_handle.shutdown();
1009        // Safety: drops once, never accessed again
1010        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1011    }
1012}
1013
1014impl fidl::endpoints::Responder for ClientWatchPrefixesResponder {
1015    type ControlHandle = ClientControlHandle;
1016
1017    fn control_handle(&self) -> &ClientControlHandle {
1018        &self.control_handle
1019    }
1020
1021    fn drop_without_shutdown(mut self) {
1022        // Safety: drops once, never accessed again due to mem::forget
1023        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1024        // Prevent Drop from running (which would shut down the channel)
1025        std::mem::forget(self);
1026    }
1027}
1028
1029impl ClientWatchPrefixesResponder {
1030    /// Sends a response to the FIDL transaction.
1031    ///
1032    /// Sets the channel to shutdown if an error occurs.
1033    pub fn send(self, mut prefixes: &[Prefix]) -> Result<(), fidl::Error> {
1034        let _result = self.send_raw(prefixes);
1035        if _result.is_err() {
1036            self.control_handle.shutdown();
1037        }
1038        self.drop_without_shutdown();
1039        _result
1040    }
1041
1042    /// Similar to "send" but does not shutdown the channel if an error occurs.
1043    pub fn send_no_shutdown_on_err(self, mut prefixes: &[Prefix]) -> Result<(), fidl::Error> {
1044        let _result = self.send_raw(prefixes);
1045        self.drop_without_shutdown();
1046        _result
1047    }
1048
1049    fn send_raw(&self, mut prefixes: &[Prefix]) -> Result<(), fidl::Error> {
1050        self.control_handle.inner.send::<ClientWatchPrefixesResponse>(
1051            (prefixes,),
1052            self.tx_id,
1053            0x3b7908cc71ae2a5e,
1054            fidl::encoding::DynamicFlags::empty(),
1055        )
1056    }
1057}
1058
1059#[must_use = "FIDL methods require a response to be sent"]
1060#[derive(Debug)]
1061pub struct ClientShutdownResponder {
1062    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
1063    tx_id: u32,
1064}
1065
1066/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
1067/// if the responder is dropped without sending a response, so that the client
1068/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1069impl std::ops::Drop for ClientShutdownResponder {
1070    fn drop(&mut self) {
1071        self.control_handle.shutdown();
1072        // Safety: drops once, never accessed again
1073        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1074    }
1075}
1076
1077impl fidl::endpoints::Responder for ClientShutdownResponder {
1078    type ControlHandle = ClientControlHandle;
1079
1080    fn control_handle(&self) -> &ClientControlHandle {
1081        &self.control_handle
1082    }
1083
1084    fn drop_without_shutdown(mut self) {
1085        // Safety: drops once, never accessed again due to mem::forget
1086        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1087        // Prevent Drop from running (which would shut down the channel)
1088        std::mem::forget(self);
1089    }
1090}
1091
1092impl ClientShutdownResponder {
1093    /// Sends a response to the FIDL transaction.
1094    ///
1095    /// Sets the channel to shutdown if an error occurs.
1096    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1097        let _result = self.send_raw(result);
1098        if _result.is_err() {
1099            self.control_handle.shutdown();
1100        }
1101        self.drop_without_shutdown();
1102        _result
1103    }
1104
1105    /// Similar to "send" but does not shutdown the channel if an error occurs.
1106    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1107        let _result = self.send_raw(result);
1108        self.drop_without_shutdown();
1109        _result
1110    }
1111
1112    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1113        self.control_handle
1114            .inner
1115            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1116                result,
1117                self.tx_id,
1118                0x6da95f1bcd43fa11,
1119                fidl::encoding::DynamicFlags::empty(),
1120            )
1121    }
1122}
1123
1124#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1125pub struct ClientProviderMarker;
1126
1127impl fidl::endpoints::ProtocolMarker for ClientProviderMarker {
1128    type Proxy = ClientProviderProxy;
1129    type RequestStream = ClientProviderRequestStream;
1130    #[cfg(target_os = "fuchsia")]
1131    type SynchronousProxy = ClientProviderSynchronousProxy;
1132
1133    const DEBUG_NAME: &'static str = "fuchsia.net.dhcpv6.ClientProvider";
1134}
1135impl fidl::endpoints::DiscoverableProtocolMarker for ClientProviderMarker {}
1136
1137pub trait ClientProviderProxyInterface: Send + Sync {
1138    fn r#new_client(
1139        &self,
1140        params: &NewClientParams,
1141        request: fidl::endpoints::ServerEnd<ClientMarker>,
1142    ) -> Result<(), fidl::Error>;
1143}
1144#[derive(Debug)]
1145#[cfg(target_os = "fuchsia")]
1146pub struct ClientProviderSynchronousProxy {
1147    client: fidl::client::sync::Client,
1148}
1149
1150#[cfg(target_os = "fuchsia")]
1151impl fidl::endpoints::SynchronousProxy for ClientProviderSynchronousProxy {
1152    type Proxy = ClientProviderProxy;
1153    type Protocol = ClientProviderMarker;
1154
1155    fn from_channel(inner: fidl::Channel) -> Self {
1156        Self::new(inner)
1157    }
1158
1159    fn into_channel(self) -> fidl::Channel {
1160        self.client.into_channel()
1161    }
1162
1163    fn as_channel(&self) -> &fidl::Channel {
1164        self.client.as_channel()
1165    }
1166}
1167
1168#[cfg(target_os = "fuchsia")]
1169impl ClientProviderSynchronousProxy {
1170    pub fn new(channel: fidl::Channel) -> Self {
1171        let protocol_name = <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1172        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1173    }
1174
1175    pub fn into_channel(self) -> fidl::Channel {
1176        self.client.into_channel()
1177    }
1178
1179    /// Waits until an event arrives and returns it. It is safe for other
1180    /// threads to make concurrent requests while waiting for an event.
1181    pub fn wait_for_event(
1182        &self,
1183        deadline: zx::MonotonicInstant,
1184    ) -> Result<ClientProviderEvent, fidl::Error> {
1185        ClientProviderEvent::decode(self.client.wait_for_event(deadline)?)
1186    }
1187
1188    /// Provides a DHCPv6 client.
1189    ///
1190    /// + request `params` the parameters to create the client with.
1191    /// + request `request` grants control over the client. Closed with an
1192    ///     epitaph if the client cannot be created.
1193    pub fn r#new_client(
1194        &self,
1195        mut params: &NewClientParams,
1196        mut request: fidl::endpoints::ServerEnd<ClientMarker>,
1197    ) -> Result<(), fidl::Error> {
1198        self.client.send::<ClientProviderNewClientRequest>(
1199            (params, request),
1200            0x269268c97d062419,
1201            fidl::encoding::DynamicFlags::empty(),
1202        )
1203    }
1204}
1205
1206#[cfg(target_os = "fuchsia")]
1207impl From<ClientProviderSynchronousProxy> for zx::Handle {
1208    fn from(value: ClientProviderSynchronousProxy) -> Self {
1209        value.into_channel().into()
1210    }
1211}
1212
1213#[cfg(target_os = "fuchsia")]
1214impl From<fidl::Channel> for ClientProviderSynchronousProxy {
1215    fn from(value: fidl::Channel) -> Self {
1216        Self::new(value)
1217    }
1218}
1219
1220#[derive(Debug, Clone)]
1221pub struct ClientProviderProxy {
1222    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1223}
1224
1225impl fidl::endpoints::Proxy for ClientProviderProxy {
1226    type Protocol = ClientProviderMarker;
1227
1228    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1229        Self::new(inner)
1230    }
1231
1232    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1233        self.client.into_channel().map_err(|client| Self { client })
1234    }
1235
1236    fn as_channel(&self) -> &::fidl::AsyncChannel {
1237        self.client.as_channel()
1238    }
1239}
1240
1241impl ClientProviderProxy {
1242    /// Create a new Proxy for fuchsia.net.dhcpv6/ClientProvider.
1243    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1244        let protocol_name = <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1245        Self { client: fidl::client::Client::new(channel, protocol_name) }
1246    }
1247
1248    /// Get a Stream of events from the remote end of the protocol.
1249    ///
1250    /// # Panics
1251    ///
1252    /// Panics if the event stream was already taken.
1253    pub fn take_event_stream(&self) -> ClientProviderEventStream {
1254        ClientProviderEventStream { event_receiver: self.client.take_event_receiver() }
1255    }
1256
1257    /// Provides a DHCPv6 client.
1258    ///
1259    /// + request `params` the parameters to create the client with.
1260    /// + request `request` grants control over the client. Closed with an
1261    ///     epitaph if the client cannot be created.
1262    pub fn r#new_client(
1263        &self,
1264        mut params: &NewClientParams,
1265        mut request: fidl::endpoints::ServerEnd<ClientMarker>,
1266    ) -> Result<(), fidl::Error> {
1267        ClientProviderProxyInterface::r#new_client(self, params, request)
1268    }
1269}
1270
1271impl ClientProviderProxyInterface for ClientProviderProxy {
1272    fn r#new_client(
1273        &self,
1274        mut params: &NewClientParams,
1275        mut request: fidl::endpoints::ServerEnd<ClientMarker>,
1276    ) -> Result<(), fidl::Error> {
1277        self.client.send::<ClientProviderNewClientRequest>(
1278            (params, request),
1279            0x269268c97d062419,
1280            fidl::encoding::DynamicFlags::empty(),
1281        )
1282    }
1283}
1284
1285pub struct ClientProviderEventStream {
1286    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1287}
1288
1289impl std::marker::Unpin for ClientProviderEventStream {}
1290
1291impl futures::stream::FusedStream for ClientProviderEventStream {
1292    fn is_terminated(&self) -> bool {
1293        self.event_receiver.is_terminated()
1294    }
1295}
1296
1297impl futures::Stream for ClientProviderEventStream {
1298    type Item = Result<ClientProviderEvent, fidl::Error>;
1299
1300    fn poll_next(
1301        mut self: std::pin::Pin<&mut Self>,
1302        cx: &mut std::task::Context<'_>,
1303    ) -> std::task::Poll<Option<Self::Item>> {
1304        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1305            &mut self.event_receiver,
1306            cx
1307        )?) {
1308            Some(buf) => std::task::Poll::Ready(Some(ClientProviderEvent::decode(buf))),
1309            None => std::task::Poll::Ready(None),
1310        }
1311    }
1312}
1313
1314#[derive(Debug)]
1315pub enum ClientProviderEvent {}
1316
1317impl ClientProviderEvent {
1318    /// Decodes a message buffer as a [`ClientProviderEvent`].
1319    fn decode(
1320        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1321    ) -> Result<ClientProviderEvent, fidl::Error> {
1322        let (bytes, _handles) = buf.split_mut();
1323        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1324        debug_assert_eq!(tx_header.tx_id, 0);
1325        match tx_header.ordinal {
1326            _ => Err(fidl::Error::UnknownOrdinal {
1327                ordinal: tx_header.ordinal,
1328                protocol_name:
1329                    <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1330            }),
1331        }
1332    }
1333}
1334
1335/// A Stream of incoming requests for fuchsia.net.dhcpv6/ClientProvider.
1336pub struct ClientProviderRequestStream {
1337    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1338    is_terminated: bool,
1339}
1340
1341impl std::marker::Unpin for ClientProviderRequestStream {}
1342
1343impl futures::stream::FusedStream for ClientProviderRequestStream {
1344    fn is_terminated(&self) -> bool {
1345        self.is_terminated
1346    }
1347}
1348
1349impl fidl::endpoints::RequestStream for ClientProviderRequestStream {
1350    type Protocol = ClientProviderMarker;
1351    type ControlHandle = ClientProviderControlHandle;
1352
1353    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1354        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1355    }
1356
1357    fn control_handle(&self) -> Self::ControlHandle {
1358        ClientProviderControlHandle { inner: self.inner.clone() }
1359    }
1360
1361    fn into_inner(
1362        self,
1363    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1364    {
1365        (self.inner, self.is_terminated)
1366    }
1367
1368    fn from_inner(
1369        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1370        is_terminated: bool,
1371    ) -> Self {
1372        Self { inner, is_terminated }
1373    }
1374}
1375
1376impl futures::Stream for ClientProviderRequestStream {
1377    type Item = Result<ClientProviderRequest, fidl::Error>;
1378
1379    fn poll_next(
1380        mut self: std::pin::Pin<&mut Self>,
1381        cx: &mut std::task::Context<'_>,
1382    ) -> std::task::Poll<Option<Self::Item>> {
1383        let this = &mut *self;
1384        if this.inner.check_shutdown(cx) {
1385            this.is_terminated = true;
1386            return std::task::Poll::Ready(None);
1387        }
1388        if this.is_terminated {
1389            panic!("polled ClientProviderRequestStream after completion");
1390        }
1391        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1392            |bytes, handles| {
1393                match this.inner.channel().read_etc(cx, bytes, handles) {
1394                    std::task::Poll::Ready(Ok(())) => {}
1395                    std::task::Poll::Pending => return std::task::Poll::Pending,
1396                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1397                        this.is_terminated = true;
1398                        return std::task::Poll::Ready(None);
1399                    }
1400                    std::task::Poll::Ready(Err(e)) => {
1401                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1402                            e.into(),
1403                        ))))
1404                    }
1405                }
1406
1407                // A message has been received from the channel
1408                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1409
1410                std::task::Poll::Ready(Some(match header.ordinal {
1411                    0x269268c97d062419 => {
1412                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1413                        let mut req = fidl::new_empty!(
1414                            ClientProviderNewClientRequest,
1415                            fidl::encoding::DefaultFuchsiaResourceDialect
1416                        );
1417                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientProviderNewClientRequest>(&header, _body_bytes, handles, &mut req)?;
1418                        let control_handle =
1419                            ClientProviderControlHandle { inner: this.inner.clone() };
1420                        Ok(ClientProviderRequest::NewClient {
1421                            params: req.params,
1422                            request: req.request,
1423
1424                            control_handle,
1425                        })
1426                    }
1427                    _ => Err(fidl::Error::UnknownOrdinal {
1428                        ordinal: header.ordinal,
1429                        protocol_name:
1430                            <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1431                    }),
1432                }))
1433            },
1434        )
1435    }
1436}
1437
1438/// Provides a method to create new clients.
1439#[derive(Debug)]
1440pub enum ClientProviderRequest {
1441    /// Provides a DHCPv6 client.
1442    ///
1443    /// + request `params` the parameters to create the client with.
1444    /// + request `request` grants control over the client. Closed with an
1445    ///     epitaph if the client cannot be created.
1446    NewClient {
1447        params: NewClientParams,
1448        request: fidl::endpoints::ServerEnd<ClientMarker>,
1449        control_handle: ClientProviderControlHandle,
1450    },
1451}
1452
1453impl ClientProviderRequest {
1454    #[allow(irrefutable_let_patterns)]
1455    pub fn into_new_client(
1456        self,
1457    ) -> Option<(
1458        NewClientParams,
1459        fidl::endpoints::ServerEnd<ClientMarker>,
1460        ClientProviderControlHandle,
1461    )> {
1462        if let ClientProviderRequest::NewClient { params, request, control_handle } = self {
1463            Some((params, request, control_handle))
1464        } else {
1465            None
1466        }
1467    }
1468
1469    /// Name of the method defined in FIDL
1470    pub fn method_name(&self) -> &'static str {
1471        match *self {
1472            ClientProviderRequest::NewClient { .. } => "new_client",
1473        }
1474    }
1475}
1476
1477#[derive(Debug, Clone)]
1478pub struct ClientProviderControlHandle {
1479    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1480}
1481
1482impl fidl::endpoints::ControlHandle for ClientProviderControlHandle {
1483    fn shutdown(&self) {
1484        self.inner.shutdown()
1485    }
1486    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1487        self.inner.shutdown_with_epitaph(status)
1488    }
1489
1490    fn is_closed(&self) -> bool {
1491        self.inner.channel().is_closed()
1492    }
1493    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1494        self.inner.channel().on_closed()
1495    }
1496
1497    #[cfg(target_os = "fuchsia")]
1498    fn signal_peer(
1499        &self,
1500        clear_mask: zx::Signals,
1501        set_mask: zx::Signals,
1502    ) -> Result<(), zx_status::Status> {
1503        use fidl::Peered;
1504        self.inner.channel().signal_peer(clear_mask, set_mask)
1505    }
1506}
1507
1508impl ClientProviderControlHandle {}
1509
1510#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1511pub struct PrefixControlMarker;
1512
1513impl fidl::endpoints::ProtocolMarker for PrefixControlMarker {
1514    type Proxy = PrefixControlProxy;
1515    type RequestStream = PrefixControlRequestStream;
1516    #[cfg(target_os = "fuchsia")]
1517    type SynchronousProxy = PrefixControlSynchronousProxy;
1518
1519    const DEBUG_NAME: &'static str = "(anonymous) PrefixControl";
1520}
1521
1522pub trait PrefixControlProxyInterface: Send + Sync {
1523    type WatchPrefixResponseFut: std::future::Future<Output = Result<PrefixEvent, fidl::Error>>
1524        + Send;
1525    fn r#watch_prefix(&self) -> Self::WatchPrefixResponseFut;
1526}
1527#[derive(Debug)]
1528#[cfg(target_os = "fuchsia")]
1529pub struct PrefixControlSynchronousProxy {
1530    client: fidl::client::sync::Client,
1531}
1532
1533#[cfg(target_os = "fuchsia")]
1534impl fidl::endpoints::SynchronousProxy for PrefixControlSynchronousProxy {
1535    type Proxy = PrefixControlProxy;
1536    type Protocol = PrefixControlMarker;
1537
1538    fn from_channel(inner: fidl::Channel) -> Self {
1539        Self::new(inner)
1540    }
1541
1542    fn into_channel(self) -> fidl::Channel {
1543        self.client.into_channel()
1544    }
1545
1546    fn as_channel(&self) -> &fidl::Channel {
1547        self.client.as_channel()
1548    }
1549}
1550
1551#[cfg(target_os = "fuchsia")]
1552impl PrefixControlSynchronousProxy {
1553    pub fn new(channel: fidl::Channel) -> Self {
1554        let protocol_name = <PrefixControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1555        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1556    }
1557
1558    pub fn into_channel(self) -> fidl::Channel {
1559        self.client.into_channel()
1560    }
1561
1562    /// Waits until an event arrives and returns it. It is safe for other
1563    /// threads to make concurrent requests while waiting for an event.
1564    pub fn wait_for_event(
1565        &self,
1566        deadline: zx::MonotonicInstant,
1567    ) -> Result<PrefixControlEvent, fidl::Error> {
1568        PrefixControlEvent::decode(self.client.wait_for_event(deadline)?)
1569    }
1570
1571    /// Hanging get for the prefix and its lifetimes.
1572    ///
1573    /// The first call to this method is guaranteed to return
1574    /// [`PrefixEvent.assigned`], and will occur when there is a prefix
1575    /// to report. Subsequent calls will return immediately if there is a
1576    /// change to report, or block until a change occurs.
1577    ///
1578    /// It is invalid to call this method while a previous call is pending.
1579    /// Doing so will cause the server end of the protocol to be closed with
1580    /// the terminal event [`PrefixControlExitReason.DOUBLE_WATCH`].
1581    ///
1582    /// - response `event` an optional prefix.
1583    pub fn r#watch_prefix(
1584        &self,
1585        ___deadline: zx::MonotonicInstant,
1586    ) -> Result<PrefixEvent, fidl::Error> {
1587        let _response = self
1588            .client
1589            .send_query::<fidl::encoding::EmptyPayload, PrefixControlWatchPrefixResponse>(
1590                (),
1591                0x1f5c40d4d1e84d84,
1592                fidl::encoding::DynamicFlags::empty(),
1593                ___deadline,
1594            )?;
1595        Ok(_response.event)
1596    }
1597}
1598
1599#[cfg(target_os = "fuchsia")]
1600impl From<PrefixControlSynchronousProxy> for zx::Handle {
1601    fn from(value: PrefixControlSynchronousProxy) -> Self {
1602        value.into_channel().into()
1603    }
1604}
1605
1606#[cfg(target_os = "fuchsia")]
1607impl From<fidl::Channel> for PrefixControlSynchronousProxy {
1608    fn from(value: fidl::Channel) -> Self {
1609        Self::new(value)
1610    }
1611}
1612
1613#[derive(Debug, Clone)]
1614pub struct PrefixControlProxy {
1615    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1616}
1617
1618impl fidl::endpoints::Proxy for PrefixControlProxy {
1619    type Protocol = PrefixControlMarker;
1620
1621    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1622        Self::new(inner)
1623    }
1624
1625    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1626        self.client.into_channel().map_err(|client| Self { client })
1627    }
1628
1629    fn as_channel(&self) -> &::fidl::AsyncChannel {
1630        self.client.as_channel()
1631    }
1632}
1633
1634impl PrefixControlProxy {
1635    /// Create a new Proxy for fuchsia.net.dhcpv6/PrefixControl.
1636    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1637        let protocol_name = <PrefixControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1638        Self { client: fidl::client::Client::new(channel, protocol_name) }
1639    }
1640
1641    /// Get a Stream of events from the remote end of the protocol.
1642    ///
1643    /// # Panics
1644    ///
1645    /// Panics if the event stream was already taken.
1646    pub fn take_event_stream(&self) -> PrefixControlEventStream {
1647        PrefixControlEventStream { event_receiver: self.client.take_event_receiver() }
1648    }
1649
1650    /// Hanging get for the prefix and its lifetimes.
1651    ///
1652    /// The first call to this method is guaranteed to return
1653    /// [`PrefixEvent.assigned`], and will occur when there is a prefix
1654    /// to report. Subsequent calls will return immediately if there is a
1655    /// change to report, or block until a change occurs.
1656    ///
1657    /// It is invalid to call this method while a previous call is pending.
1658    /// Doing so will cause the server end of the protocol to be closed with
1659    /// the terminal event [`PrefixControlExitReason.DOUBLE_WATCH`].
1660    ///
1661    /// - response `event` an optional prefix.
1662    pub fn r#watch_prefix(
1663        &self,
1664    ) -> fidl::client::QueryResponseFut<PrefixEvent, fidl::encoding::DefaultFuchsiaResourceDialect>
1665    {
1666        PrefixControlProxyInterface::r#watch_prefix(self)
1667    }
1668}
1669
1670impl PrefixControlProxyInterface for PrefixControlProxy {
1671    type WatchPrefixResponseFut =
1672        fidl::client::QueryResponseFut<PrefixEvent, fidl::encoding::DefaultFuchsiaResourceDialect>;
1673    fn r#watch_prefix(&self) -> Self::WatchPrefixResponseFut {
1674        fn _decode(
1675            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1676        ) -> Result<PrefixEvent, fidl::Error> {
1677            let _response = fidl::client::decode_transaction_body::<
1678                PrefixControlWatchPrefixResponse,
1679                fidl::encoding::DefaultFuchsiaResourceDialect,
1680                0x1f5c40d4d1e84d84,
1681            >(_buf?)?;
1682            Ok(_response.event)
1683        }
1684        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PrefixEvent>(
1685            (),
1686            0x1f5c40d4d1e84d84,
1687            fidl::encoding::DynamicFlags::empty(),
1688            _decode,
1689        )
1690    }
1691}
1692
1693pub struct PrefixControlEventStream {
1694    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1695}
1696
1697impl std::marker::Unpin for PrefixControlEventStream {}
1698
1699impl futures::stream::FusedStream for PrefixControlEventStream {
1700    fn is_terminated(&self) -> bool {
1701        self.event_receiver.is_terminated()
1702    }
1703}
1704
1705impl futures::Stream for PrefixControlEventStream {
1706    type Item = Result<PrefixControlEvent, fidl::Error>;
1707
1708    fn poll_next(
1709        mut self: std::pin::Pin<&mut Self>,
1710        cx: &mut std::task::Context<'_>,
1711    ) -> std::task::Poll<Option<Self::Item>> {
1712        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1713            &mut self.event_receiver,
1714            cx
1715        )?) {
1716            Some(buf) => std::task::Poll::Ready(Some(PrefixControlEvent::decode(buf))),
1717            None => std::task::Poll::Ready(None),
1718        }
1719    }
1720}
1721
1722#[derive(Debug)]
1723pub enum PrefixControlEvent {
1724    OnExit { reason: PrefixControlExitReason },
1725}
1726
1727impl PrefixControlEvent {
1728    #[allow(irrefutable_let_patterns)]
1729    pub fn into_on_exit(self) -> Option<PrefixControlExitReason> {
1730        if let PrefixControlEvent::OnExit { reason } = self {
1731            Some((reason))
1732        } else {
1733            None
1734        }
1735    }
1736
1737    /// Decodes a message buffer as a [`PrefixControlEvent`].
1738    fn decode(
1739        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1740    ) -> Result<PrefixControlEvent, fidl::Error> {
1741        let (bytes, _handles) = buf.split_mut();
1742        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1743        debug_assert_eq!(tx_header.tx_id, 0);
1744        match tx_header.ordinal {
1745            0x353b8c435cbe08f9 => {
1746                let mut out = fidl::new_empty!(
1747                    PrefixControlOnExitRequest,
1748                    fidl::encoding::DefaultFuchsiaResourceDialect
1749                );
1750                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrefixControlOnExitRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1751                Ok((PrefixControlEvent::OnExit { reason: out.reason }))
1752            }
1753            _ => Err(fidl::Error::UnknownOrdinal {
1754                ordinal: tx_header.ordinal,
1755                protocol_name: <PrefixControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1756            }),
1757        }
1758    }
1759}
1760
1761/// A Stream of incoming requests for fuchsia.net.dhcpv6/PrefixControl.
1762pub struct PrefixControlRequestStream {
1763    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1764    is_terminated: bool,
1765}
1766
1767impl std::marker::Unpin for PrefixControlRequestStream {}
1768
1769impl futures::stream::FusedStream for PrefixControlRequestStream {
1770    fn is_terminated(&self) -> bool {
1771        self.is_terminated
1772    }
1773}
1774
1775impl fidl::endpoints::RequestStream for PrefixControlRequestStream {
1776    type Protocol = PrefixControlMarker;
1777    type ControlHandle = PrefixControlControlHandle;
1778
1779    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1780        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1781    }
1782
1783    fn control_handle(&self) -> Self::ControlHandle {
1784        PrefixControlControlHandle { inner: self.inner.clone() }
1785    }
1786
1787    fn into_inner(
1788        self,
1789    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1790    {
1791        (self.inner, self.is_terminated)
1792    }
1793
1794    fn from_inner(
1795        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1796        is_terminated: bool,
1797    ) -> Self {
1798        Self { inner, is_terminated }
1799    }
1800}
1801
1802impl futures::Stream for PrefixControlRequestStream {
1803    type Item = Result<PrefixControlRequest, fidl::Error>;
1804
1805    fn poll_next(
1806        mut self: std::pin::Pin<&mut Self>,
1807        cx: &mut std::task::Context<'_>,
1808    ) -> std::task::Poll<Option<Self::Item>> {
1809        let this = &mut *self;
1810        if this.inner.check_shutdown(cx) {
1811            this.is_terminated = true;
1812            return std::task::Poll::Ready(None);
1813        }
1814        if this.is_terminated {
1815            panic!("polled PrefixControlRequestStream after completion");
1816        }
1817        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1818            |bytes, handles| {
1819                match this.inner.channel().read_etc(cx, bytes, handles) {
1820                    std::task::Poll::Ready(Ok(())) => {}
1821                    std::task::Poll::Pending => return std::task::Poll::Pending,
1822                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1823                        this.is_terminated = true;
1824                        return std::task::Poll::Ready(None);
1825                    }
1826                    std::task::Poll::Ready(Err(e)) => {
1827                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1828                            e.into(),
1829                        ))))
1830                    }
1831                }
1832
1833                // A message has been received from the channel
1834                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1835
1836                std::task::Poll::Ready(Some(match header.ordinal {
1837                    0x1f5c40d4d1e84d84 => {
1838                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1839                        let mut req = fidl::new_empty!(
1840                            fidl::encoding::EmptyPayload,
1841                            fidl::encoding::DefaultFuchsiaResourceDialect
1842                        );
1843                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1844                        let control_handle =
1845                            PrefixControlControlHandle { inner: this.inner.clone() };
1846                        Ok(PrefixControlRequest::WatchPrefix {
1847                            responder: PrefixControlWatchPrefixResponder {
1848                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1849                                tx_id: header.tx_id,
1850                            },
1851                        })
1852                    }
1853                    _ => Err(fidl::Error::UnknownOrdinal {
1854                        ordinal: header.ordinal,
1855                        protocol_name:
1856                            <PrefixControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1857                    }),
1858                }))
1859            },
1860        )
1861    }
1862}
1863
1864/// Provides control over prefix acquisition.
1865///
1866/// If the client end is closed, prefix acquisition will stop. This means that
1867/// a best effort will be made to release leases back to the server, and no
1868/// further attempt will be made to acquire any of the prefixes this protocol
1869/// was configured to acquire.
1870#[derive(Debug)]
1871pub enum PrefixControlRequest {
1872    /// Hanging get for the prefix and its lifetimes.
1873    ///
1874    /// The first call to this method is guaranteed to return
1875    /// [`PrefixEvent.assigned`], and will occur when there is a prefix
1876    /// to report. Subsequent calls will return immediately if there is a
1877    /// change to report, or block until a change occurs.
1878    ///
1879    /// It is invalid to call this method while a previous call is pending.
1880    /// Doing so will cause the server end of the protocol to be closed with
1881    /// the terminal event [`PrefixControlExitReason.DOUBLE_WATCH`].
1882    ///
1883    /// - response `event` an optional prefix.
1884    WatchPrefix { responder: PrefixControlWatchPrefixResponder },
1885}
1886
1887impl PrefixControlRequest {
1888    #[allow(irrefutable_let_patterns)]
1889    pub fn into_watch_prefix(self) -> Option<(PrefixControlWatchPrefixResponder)> {
1890        if let PrefixControlRequest::WatchPrefix { responder } = self {
1891            Some((responder))
1892        } else {
1893            None
1894        }
1895    }
1896
1897    /// Name of the method defined in FIDL
1898    pub fn method_name(&self) -> &'static str {
1899        match *self {
1900            PrefixControlRequest::WatchPrefix { .. } => "watch_prefix",
1901        }
1902    }
1903}
1904
1905#[derive(Debug, Clone)]
1906pub struct PrefixControlControlHandle {
1907    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1908}
1909
1910impl fidl::endpoints::ControlHandle for PrefixControlControlHandle {
1911    fn shutdown(&self) {
1912        self.inner.shutdown()
1913    }
1914    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1915        self.inner.shutdown_with_epitaph(status)
1916    }
1917
1918    fn is_closed(&self) -> bool {
1919        self.inner.channel().is_closed()
1920    }
1921    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1922        self.inner.channel().on_closed()
1923    }
1924
1925    #[cfg(target_os = "fuchsia")]
1926    fn signal_peer(
1927        &self,
1928        clear_mask: zx::Signals,
1929        set_mask: zx::Signals,
1930    ) -> Result<(), zx_status::Status> {
1931        use fidl::Peered;
1932        self.inner.channel().signal_peer(clear_mask, set_mask)
1933    }
1934}
1935
1936impl PrefixControlControlHandle {
1937    pub fn send_on_exit(&self, mut reason: PrefixControlExitReason) -> Result<(), fidl::Error> {
1938        self.inner.send::<PrefixControlOnExitRequest>(
1939            (reason,),
1940            0,
1941            0x353b8c435cbe08f9,
1942            fidl::encoding::DynamicFlags::empty(),
1943        )
1944    }
1945}
1946
1947#[must_use = "FIDL methods require a response to be sent"]
1948#[derive(Debug)]
1949pub struct PrefixControlWatchPrefixResponder {
1950    control_handle: std::mem::ManuallyDrop<PrefixControlControlHandle>,
1951    tx_id: u32,
1952}
1953
1954/// Set the the channel to be shutdown (see [`PrefixControlControlHandle::shutdown`])
1955/// if the responder is dropped without sending a response, so that the client
1956/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1957impl std::ops::Drop for PrefixControlWatchPrefixResponder {
1958    fn drop(&mut self) {
1959        self.control_handle.shutdown();
1960        // Safety: drops once, never accessed again
1961        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1962    }
1963}
1964
1965impl fidl::endpoints::Responder for PrefixControlWatchPrefixResponder {
1966    type ControlHandle = PrefixControlControlHandle;
1967
1968    fn control_handle(&self) -> &PrefixControlControlHandle {
1969        &self.control_handle
1970    }
1971
1972    fn drop_without_shutdown(mut self) {
1973        // Safety: drops once, never accessed again due to mem::forget
1974        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1975        // Prevent Drop from running (which would shut down the channel)
1976        std::mem::forget(self);
1977    }
1978}
1979
1980impl PrefixControlWatchPrefixResponder {
1981    /// Sends a response to the FIDL transaction.
1982    ///
1983    /// Sets the channel to shutdown if an error occurs.
1984    pub fn send(self, mut event: &PrefixEvent) -> Result<(), fidl::Error> {
1985        let _result = self.send_raw(event);
1986        if _result.is_err() {
1987            self.control_handle.shutdown();
1988        }
1989        self.drop_without_shutdown();
1990        _result
1991    }
1992
1993    /// Similar to "send" but does not shutdown the channel if an error occurs.
1994    pub fn send_no_shutdown_on_err(self, mut event: &PrefixEvent) -> Result<(), fidl::Error> {
1995        let _result = self.send_raw(event);
1996        self.drop_without_shutdown();
1997        _result
1998    }
1999
2000    fn send_raw(&self, mut event: &PrefixEvent) -> Result<(), fidl::Error> {
2001        self.control_handle.inner.send::<PrefixControlWatchPrefixResponse>(
2002            (event,),
2003            self.tx_id,
2004            0x1f5c40d4d1e84d84,
2005            fidl::encoding::DynamicFlags::empty(),
2006        )
2007    }
2008}
2009
2010#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2011pub struct PrefixProviderMarker;
2012
2013impl fidl::endpoints::ProtocolMarker for PrefixProviderMarker {
2014    type Proxy = PrefixProviderProxy;
2015    type RequestStream = PrefixProviderRequestStream;
2016    #[cfg(target_os = "fuchsia")]
2017    type SynchronousProxy = PrefixProviderSynchronousProxy;
2018
2019    const DEBUG_NAME: &'static str = "fuchsia.net.dhcpv6.PrefixProvider";
2020}
2021impl fidl::endpoints::DiscoverableProtocolMarker for PrefixProviderMarker {}
2022
2023pub trait PrefixProviderProxyInterface: Send + Sync {
2024    fn r#acquire_prefix(
2025        &self,
2026        config: &AcquirePrefixConfig,
2027        prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2028    ) -> Result<(), fidl::Error>;
2029}
2030#[derive(Debug)]
2031#[cfg(target_os = "fuchsia")]
2032pub struct PrefixProviderSynchronousProxy {
2033    client: fidl::client::sync::Client,
2034}
2035
2036#[cfg(target_os = "fuchsia")]
2037impl fidl::endpoints::SynchronousProxy for PrefixProviderSynchronousProxy {
2038    type Proxy = PrefixProviderProxy;
2039    type Protocol = PrefixProviderMarker;
2040
2041    fn from_channel(inner: fidl::Channel) -> Self {
2042        Self::new(inner)
2043    }
2044
2045    fn into_channel(self) -> fidl::Channel {
2046        self.client.into_channel()
2047    }
2048
2049    fn as_channel(&self) -> &fidl::Channel {
2050        self.client.as_channel()
2051    }
2052}
2053
2054#[cfg(target_os = "fuchsia")]
2055impl PrefixProviderSynchronousProxy {
2056    pub fn new(channel: fidl::Channel) -> Self {
2057        let protocol_name = <PrefixProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2058        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2059    }
2060
2061    pub fn into_channel(self) -> fidl::Channel {
2062        self.client.into_channel()
2063    }
2064
2065    /// Waits until an event arrives and returns it. It is safe for other
2066    /// threads to make concurrent requests while waiting for an event.
2067    pub fn wait_for_event(
2068        &self,
2069        deadline: zx::MonotonicInstant,
2070    ) -> Result<PrefixProviderEvent, fidl::Error> {
2071        PrefixProviderEvent::decode(self.client.wait_for_event(deadline)?)
2072    }
2073
2074    /// Acquire an IPv6 prefix via Prefix Delegation.
2075    ///
2076    /// If this method is called with invalid parameters, a terminal event
2077    /// containing a reason detailing why will be sent via
2078    /// [`PrefixControl.OnExit`] and the server end of [`PrefixControl`]
2079    /// will be closed.
2080    ///
2081    /// + request `config` prefix acquisition configuration.
2082    /// + request `prefix` provides control over prefix acquisition.
2083    pub fn r#acquire_prefix(
2084        &self,
2085        mut config: &AcquirePrefixConfig,
2086        mut prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2087    ) -> Result<(), fidl::Error> {
2088        self.client.send::<PrefixProviderAcquirePrefixRequest>(
2089            (config, prefix),
2090            0x24eff9a5ce404cf8,
2091            fidl::encoding::DynamicFlags::empty(),
2092        )
2093    }
2094}
2095
2096#[cfg(target_os = "fuchsia")]
2097impl From<PrefixProviderSynchronousProxy> for zx::Handle {
2098    fn from(value: PrefixProviderSynchronousProxy) -> Self {
2099        value.into_channel().into()
2100    }
2101}
2102
2103#[cfg(target_os = "fuchsia")]
2104impl From<fidl::Channel> for PrefixProviderSynchronousProxy {
2105    fn from(value: fidl::Channel) -> Self {
2106        Self::new(value)
2107    }
2108}
2109
2110#[derive(Debug, Clone)]
2111pub struct PrefixProviderProxy {
2112    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2113}
2114
2115impl fidl::endpoints::Proxy for PrefixProviderProxy {
2116    type Protocol = PrefixProviderMarker;
2117
2118    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2119        Self::new(inner)
2120    }
2121
2122    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2123        self.client.into_channel().map_err(|client| Self { client })
2124    }
2125
2126    fn as_channel(&self) -> &::fidl::AsyncChannel {
2127        self.client.as_channel()
2128    }
2129}
2130
2131impl PrefixProviderProxy {
2132    /// Create a new Proxy for fuchsia.net.dhcpv6/PrefixProvider.
2133    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2134        let protocol_name = <PrefixProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2135        Self { client: fidl::client::Client::new(channel, protocol_name) }
2136    }
2137
2138    /// Get a Stream of events from the remote end of the protocol.
2139    ///
2140    /// # Panics
2141    ///
2142    /// Panics if the event stream was already taken.
2143    pub fn take_event_stream(&self) -> PrefixProviderEventStream {
2144        PrefixProviderEventStream { event_receiver: self.client.take_event_receiver() }
2145    }
2146
2147    /// Acquire an IPv6 prefix via Prefix Delegation.
2148    ///
2149    /// If this method is called with invalid parameters, a terminal event
2150    /// containing a reason detailing why will be sent via
2151    /// [`PrefixControl.OnExit`] and the server end of [`PrefixControl`]
2152    /// will be closed.
2153    ///
2154    /// + request `config` prefix acquisition configuration.
2155    /// + request `prefix` provides control over prefix acquisition.
2156    pub fn r#acquire_prefix(
2157        &self,
2158        mut config: &AcquirePrefixConfig,
2159        mut prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2160    ) -> Result<(), fidl::Error> {
2161        PrefixProviderProxyInterface::r#acquire_prefix(self, config, prefix)
2162    }
2163}
2164
2165impl PrefixProviderProxyInterface for PrefixProviderProxy {
2166    fn r#acquire_prefix(
2167        &self,
2168        mut config: &AcquirePrefixConfig,
2169        mut prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2170    ) -> Result<(), fidl::Error> {
2171        self.client.send::<PrefixProviderAcquirePrefixRequest>(
2172            (config, prefix),
2173            0x24eff9a5ce404cf8,
2174            fidl::encoding::DynamicFlags::empty(),
2175        )
2176    }
2177}
2178
2179pub struct PrefixProviderEventStream {
2180    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2181}
2182
2183impl std::marker::Unpin for PrefixProviderEventStream {}
2184
2185impl futures::stream::FusedStream for PrefixProviderEventStream {
2186    fn is_terminated(&self) -> bool {
2187        self.event_receiver.is_terminated()
2188    }
2189}
2190
2191impl futures::Stream for PrefixProviderEventStream {
2192    type Item = Result<PrefixProviderEvent, fidl::Error>;
2193
2194    fn poll_next(
2195        mut self: std::pin::Pin<&mut Self>,
2196        cx: &mut std::task::Context<'_>,
2197    ) -> std::task::Poll<Option<Self::Item>> {
2198        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2199            &mut self.event_receiver,
2200            cx
2201        )?) {
2202            Some(buf) => std::task::Poll::Ready(Some(PrefixProviderEvent::decode(buf))),
2203            None => std::task::Poll::Ready(None),
2204        }
2205    }
2206}
2207
2208#[derive(Debug)]
2209pub enum PrefixProviderEvent {}
2210
2211impl PrefixProviderEvent {
2212    /// Decodes a message buffer as a [`PrefixProviderEvent`].
2213    fn decode(
2214        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2215    ) -> Result<PrefixProviderEvent, fidl::Error> {
2216        let (bytes, _handles) = buf.split_mut();
2217        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2218        debug_assert_eq!(tx_header.tx_id, 0);
2219        match tx_header.ordinal {
2220            _ => Err(fidl::Error::UnknownOrdinal {
2221                ordinal: tx_header.ordinal,
2222                protocol_name:
2223                    <PrefixProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2224            }),
2225        }
2226    }
2227}
2228
2229/// A Stream of incoming requests for fuchsia.net.dhcpv6/PrefixProvider.
2230pub struct PrefixProviderRequestStream {
2231    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2232    is_terminated: bool,
2233}
2234
2235impl std::marker::Unpin for PrefixProviderRequestStream {}
2236
2237impl futures::stream::FusedStream for PrefixProviderRequestStream {
2238    fn is_terminated(&self) -> bool {
2239        self.is_terminated
2240    }
2241}
2242
2243impl fidl::endpoints::RequestStream for PrefixProviderRequestStream {
2244    type Protocol = PrefixProviderMarker;
2245    type ControlHandle = PrefixProviderControlHandle;
2246
2247    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2248        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2249    }
2250
2251    fn control_handle(&self) -> Self::ControlHandle {
2252        PrefixProviderControlHandle { inner: self.inner.clone() }
2253    }
2254
2255    fn into_inner(
2256        self,
2257    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2258    {
2259        (self.inner, self.is_terminated)
2260    }
2261
2262    fn from_inner(
2263        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2264        is_terminated: bool,
2265    ) -> Self {
2266        Self { inner, is_terminated }
2267    }
2268}
2269
2270impl futures::Stream for PrefixProviderRequestStream {
2271    type Item = Result<PrefixProviderRequest, fidl::Error>;
2272
2273    fn poll_next(
2274        mut self: std::pin::Pin<&mut Self>,
2275        cx: &mut std::task::Context<'_>,
2276    ) -> std::task::Poll<Option<Self::Item>> {
2277        let this = &mut *self;
2278        if this.inner.check_shutdown(cx) {
2279            this.is_terminated = true;
2280            return std::task::Poll::Ready(None);
2281        }
2282        if this.is_terminated {
2283            panic!("polled PrefixProviderRequestStream after completion");
2284        }
2285        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2286            |bytes, handles| {
2287                match this.inner.channel().read_etc(cx, bytes, handles) {
2288                    std::task::Poll::Ready(Ok(())) => {}
2289                    std::task::Poll::Pending => return std::task::Poll::Pending,
2290                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2291                        this.is_terminated = true;
2292                        return std::task::Poll::Ready(None);
2293                    }
2294                    std::task::Poll::Ready(Err(e)) => {
2295                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2296                            e.into(),
2297                        ))))
2298                    }
2299                }
2300
2301                // A message has been received from the channel
2302                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2303
2304                std::task::Poll::Ready(Some(match header.ordinal {
2305                    0x24eff9a5ce404cf8 => {
2306                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2307                        let mut req = fidl::new_empty!(
2308                            PrefixProviderAcquirePrefixRequest,
2309                            fidl::encoding::DefaultFuchsiaResourceDialect
2310                        );
2311                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrefixProviderAcquirePrefixRequest>(&header, _body_bytes, handles, &mut req)?;
2312                        let control_handle =
2313                            PrefixProviderControlHandle { inner: this.inner.clone() };
2314                        Ok(PrefixProviderRequest::AcquirePrefix {
2315                            config: req.config,
2316                            prefix: req.prefix,
2317
2318                            control_handle,
2319                        })
2320                    }
2321                    _ => Err(fidl::Error::UnknownOrdinal {
2322                        ordinal: header.ordinal,
2323                        protocol_name:
2324                            <PrefixProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2325                    }),
2326                }))
2327            },
2328        )
2329    }
2330}
2331
2332/// Provides IPv6 prefixes acquired via Prefix delegation.
2333#[derive(Debug)]
2334pub enum PrefixProviderRequest {
2335    /// Acquire an IPv6 prefix via Prefix Delegation.
2336    ///
2337    /// If this method is called with invalid parameters, a terminal event
2338    /// containing a reason detailing why will be sent via
2339    /// [`PrefixControl.OnExit`] and the server end of [`PrefixControl`]
2340    /// will be closed.
2341    ///
2342    /// + request `config` prefix acquisition configuration.
2343    /// + request `prefix` provides control over prefix acquisition.
2344    AcquirePrefix {
2345        config: AcquirePrefixConfig,
2346        prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2347        control_handle: PrefixProviderControlHandle,
2348    },
2349}
2350
2351impl PrefixProviderRequest {
2352    #[allow(irrefutable_let_patterns)]
2353    pub fn into_acquire_prefix(
2354        self,
2355    ) -> Option<(
2356        AcquirePrefixConfig,
2357        fidl::endpoints::ServerEnd<PrefixControlMarker>,
2358        PrefixProviderControlHandle,
2359    )> {
2360        if let PrefixProviderRequest::AcquirePrefix { config, prefix, control_handle } = self {
2361            Some((config, prefix, control_handle))
2362        } else {
2363            None
2364        }
2365    }
2366
2367    /// Name of the method defined in FIDL
2368    pub fn method_name(&self) -> &'static str {
2369        match *self {
2370            PrefixProviderRequest::AcquirePrefix { .. } => "acquire_prefix",
2371        }
2372    }
2373}
2374
2375#[derive(Debug, Clone)]
2376pub struct PrefixProviderControlHandle {
2377    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2378}
2379
2380impl fidl::endpoints::ControlHandle for PrefixProviderControlHandle {
2381    fn shutdown(&self) {
2382        self.inner.shutdown()
2383    }
2384    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2385        self.inner.shutdown_with_epitaph(status)
2386    }
2387
2388    fn is_closed(&self) -> bool {
2389        self.inner.channel().is_closed()
2390    }
2391    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2392        self.inner.channel().on_closed()
2393    }
2394
2395    #[cfg(target_os = "fuchsia")]
2396    fn signal_peer(
2397        &self,
2398        clear_mask: zx::Signals,
2399        set_mask: zx::Signals,
2400    ) -> Result<(), zx_status::Status> {
2401        use fidl::Peered;
2402        self.inner.channel().signal_peer(clear_mask, set_mask)
2403    }
2404}
2405
2406impl PrefixProviderControlHandle {}
2407
2408mod internal {
2409    use super::*;
2410
2411    impl fidl::encoding::ResourceTypeMarker for ClientProviderNewClientRequest {
2412        type Borrowed<'a> = &'a mut Self;
2413        fn take_or_borrow<'a>(
2414            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2415        ) -> Self::Borrowed<'a> {
2416            value
2417        }
2418    }
2419
2420    unsafe impl fidl::encoding::TypeMarker for ClientProviderNewClientRequest {
2421        type Owned = Self;
2422
2423        #[inline(always)]
2424        fn inline_align(_context: fidl::encoding::Context) -> usize {
2425            8
2426        }
2427
2428        #[inline(always)]
2429        fn inline_size(_context: fidl::encoding::Context) -> usize {
2430            24
2431        }
2432    }
2433
2434    unsafe impl
2435        fidl::encoding::Encode<
2436            ClientProviderNewClientRequest,
2437            fidl::encoding::DefaultFuchsiaResourceDialect,
2438        > for &mut ClientProviderNewClientRequest
2439    {
2440        #[inline]
2441        unsafe fn encode(
2442            self,
2443            encoder: &mut fidl::encoding::Encoder<
2444                '_,
2445                fidl::encoding::DefaultFuchsiaResourceDialect,
2446            >,
2447            offset: usize,
2448            _depth: fidl::encoding::Depth,
2449        ) -> fidl::Result<()> {
2450            encoder.debug_check_bounds::<ClientProviderNewClientRequest>(offset);
2451            // Delegate to tuple encoding.
2452            fidl::encoding::Encode::<ClientProviderNewClientRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2453                (
2454                    <NewClientParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
2455                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
2456                ),
2457                encoder, offset, _depth
2458            )
2459        }
2460    }
2461    unsafe impl<
2462            T0: fidl::encoding::Encode<NewClientParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
2463            T1: fidl::encoding::Encode<
2464                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>>,
2465                fidl::encoding::DefaultFuchsiaResourceDialect,
2466            >,
2467        >
2468        fidl::encoding::Encode<
2469            ClientProviderNewClientRequest,
2470            fidl::encoding::DefaultFuchsiaResourceDialect,
2471        > for (T0, T1)
2472    {
2473        #[inline]
2474        unsafe fn encode(
2475            self,
2476            encoder: &mut fidl::encoding::Encoder<
2477                '_,
2478                fidl::encoding::DefaultFuchsiaResourceDialect,
2479            >,
2480            offset: usize,
2481            depth: fidl::encoding::Depth,
2482        ) -> fidl::Result<()> {
2483            encoder.debug_check_bounds::<ClientProviderNewClientRequest>(offset);
2484            // Zero out padding regions. There's no need to apply masks
2485            // because the unmasked parts will be overwritten by fields.
2486            unsafe {
2487                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2488                (ptr as *mut u64).write_unaligned(0);
2489            }
2490            // Write the fields.
2491            self.0.encode(encoder, offset + 0, depth)?;
2492            self.1.encode(encoder, offset + 16, depth)?;
2493            Ok(())
2494        }
2495    }
2496
2497    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2498        for ClientProviderNewClientRequest
2499    {
2500        #[inline(always)]
2501        fn new_empty() -> Self {
2502            Self {
2503                params: fidl::new_empty!(
2504                    NewClientParams,
2505                    fidl::encoding::DefaultFuchsiaResourceDialect
2506                ),
2507                request: fidl::new_empty!(
2508                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>>,
2509                    fidl::encoding::DefaultFuchsiaResourceDialect
2510                ),
2511            }
2512        }
2513
2514        #[inline]
2515        unsafe fn decode(
2516            &mut self,
2517            decoder: &mut fidl::encoding::Decoder<
2518                '_,
2519                fidl::encoding::DefaultFuchsiaResourceDialect,
2520            >,
2521            offset: usize,
2522            _depth: fidl::encoding::Depth,
2523        ) -> fidl::Result<()> {
2524            decoder.debug_check_bounds::<Self>(offset);
2525            // Verify that padding bytes are zero.
2526            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2527            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2528            let mask = 0xffffffff00000000u64;
2529            let maskedval = padval & mask;
2530            if maskedval != 0 {
2531                return Err(fidl::Error::NonZeroPadding {
2532                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2533                });
2534            }
2535            fidl::decode!(
2536                NewClientParams,
2537                fidl::encoding::DefaultFuchsiaResourceDialect,
2538                &mut self.params,
2539                decoder,
2540                offset + 0,
2541                _depth
2542            )?;
2543            fidl::decode!(
2544                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>>,
2545                fidl::encoding::DefaultFuchsiaResourceDialect,
2546                &mut self.request,
2547                decoder,
2548                offset + 16,
2549                _depth
2550            )?;
2551            Ok(())
2552        }
2553    }
2554
2555    impl fidl::encoding::ResourceTypeMarker for ClientWatchAddressResponse {
2556        type Borrowed<'a> = &'a mut Self;
2557        fn take_or_borrow<'a>(
2558            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2559        ) -> Self::Borrowed<'a> {
2560            value
2561        }
2562    }
2563
2564    unsafe impl fidl::encoding::TypeMarker for ClientWatchAddressResponse {
2565        type Owned = Self;
2566
2567        #[inline(always)]
2568        fn inline_align(_context: fidl::encoding::Context) -> usize {
2569            8
2570        }
2571
2572        #[inline(always)]
2573        fn inline_size(_context: fidl::encoding::Context) -> usize {
2574            48
2575        }
2576    }
2577
2578    unsafe impl
2579        fidl::encoding::Encode<
2580            ClientWatchAddressResponse,
2581            fidl::encoding::DefaultFuchsiaResourceDialect,
2582        > for &mut ClientWatchAddressResponse
2583    {
2584        #[inline]
2585        unsafe fn encode(
2586            self,
2587            encoder: &mut fidl::encoding::Encoder<
2588                '_,
2589                fidl::encoding::DefaultFuchsiaResourceDialect,
2590            >,
2591            offset: usize,
2592            _depth: fidl::encoding::Depth,
2593        ) -> fidl::Result<()> {
2594            encoder.debug_check_bounds::<ClientWatchAddressResponse>(offset);
2595            // Delegate to tuple encoding.
2596            fidl::encoding::Encode::<ClientWatchAddressResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2597                (
2598                    <fidl_fuchsia_net::Subnet as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
2599                    <fidl_fuchsia_net_interfaces_admin::AddressParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.address_parameters),
2600                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.address_state_provider),
2601                ),
2602                encoder, offset, _depth
2603            )
2604        }
2605    }
2606    unsafe impl<
2607            T0: fidl::encoding::Encode<
2608                fidl_fuchsia_net::Subnet,
2609                fidl::encoding::DefaultFuchsiaResourceDialect,
2610            >,
2611            T1: fidl::encoding::Encode<
2612                fidl_fuchsia_net_interfaces_admin::AddressParameters,
2613                fidl::encoding::DefaultFuchsiaResourceDialect,
2614            >,
2615            T2: fidl::encoding::Encode<
2616                fidl::encoding::Endpoint<
2617                    fidl::endpoints::ServerEnd<
2618                        fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
2619                    >,
2620                >,
2621                fidl::encoding::DefaultFuchsiaResourceDialect,
2622            >,
2623        >
2624        fidl::encoding::Encode<
2625            ClientWatchAddressResponse,
2626            fidl::encoding::DefaultFuchsiaResourceDialect,
2627        > for (T0, T1, T2)
2628    {
2629        #[inline]
2630        unsafe fn encode(
2631            self,
2632            encoder: &mut fidl::encoding::Encoder<
2633                '_,
2634                fidl::encoding::DefaultFuchsiaResourceDialect,
2635            >,
2636            offset: usize,
2637            depth: fidl::encoding::Depth,
2638        ) -> fidl::Result<()> {
2639            encoder.debug_check_bounds::<ClientWatchAddressResponse>(offset);
2640            // Zero out padding regions. There's no need to apply masks
2641            // because the unmasked parts will be overwritten by fields.
2642            unsafe {
2643                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
2644                (ptr as *mut u64).write_unaligned(0);
2645            }
2646            // Write the fields.
2647            self.0.encode(encoder, offset + 0, depth)?;
2648            self.1.encode(encoder, offset + 24, depth)?;
2649            self.2.encode(encoder, offset + 40, depth)?;
2650            Ok(())
2651        }
2652    }
2653
2654    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2655        for ClientWatchAddressResponse
2656    {
2657        #[inline(always)]
2658        fn new_empty() -> Self {
2659            Self {
2660                address: fidl::new_empty!(
2661                    fidl_fuchsia_net::Subnet,
2662                    fidl::encoding::DefaultFuchsiaResourceDialect
2663                ),
2664                address_parameters: fidl::new_empty!(
2665                    fidl_fuchsia_net_interfaces_admin::AddressParameters,
2666                    fidl::encoding::DefaultFuchsiaResourceDialect
2667                ),
2668                address_state_provider: fidl::new_empty!(
2669                    fidl::encoding::Endpoint<
2670                        fidl::endpoints::ServerEnd<
2671                            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
2672                        >,
2673                    >,
2674                    fidl::encoding::DefaultFuchsiaResourceDialect
2675                ),
2676            }
2677        }
2678
2679        #[inline]
2680        unsafe fn decode(
2681            &mut self,
2682            decoder: &mut fidl::encoding::Decoder<
2683                '_,
2684                fidl::encoding::DefaultFuchsiaResourceDialect,
2685            >,
2686            offset: usize,
2687            _depth: fidl::encoding::Depth,
2688        ) -> fidl::Result<()> {
2689            decoder.debug_check_bounds::<Self>(offset);
2690            // Verify that padding bytes are zero.
2691            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
2692            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2693            let mask = 0xffffffff00000000u64;
2694            let maskedval = padval & mask;
2695            if maskedval != 0 {
2696                return Err(fidl::Error::NonZeroPadding {
2697                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
2698                });
2699            }
2700            fidl::decode!(
2701                fidl_fuchsia_net::Subnet,
2702                fidl::encoding::DefaultFuchsiaResourceDialect,
2703                &mut self.address,
2704                decoder,
2705                offset + 0,
2706                _depth
2707            )?;
2708            fidl::decode!(
2709                fidl_fuchsia_net_interfaces_admin::AddressParameters,
2710                fidl::encoding::DefaultFuchsiaResourceDialect,
2711                &mut self.address_parameters,
2712                decoder,
2713                offset + 24,
2714                _depth
2715            )?;
2716            fidl::decode!(
2717                fidl::encoding::Endpoint<
2718                    fidl::endpoints::ServerEnd<
2719                        fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
2720                    >,
2721                >,
2722                fidl::encoding::DefaultFuchsiaResourceDialect,
2723                &mut self.address_state_provider,
2724                decoder,
2725                offset + 40,
2726                _depth
2727            )?;
2728            Ok(())
2729        }
2730    }
2731
2732    impl fidl::encoding::ResourceTypeMarker for PrefixProviderAcquirePrefixRequest {
2733        type Borrowed<'a> = &'a mut Self;
2734        fn take_or_borrow<'a>(
2735            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2736        ) -> Self::Borrowed<'a> {
2737            value
2738        }
2739    }
2740
2741    unsafe impl fidl::encoding::TypeMarker for PrefixProviderAcquirePrefixRequest {
2742        type Owned = Self;
2743
2744        #[inline(always)]
2745        fn inline_align(_context: fidl::encoding::Context) -> usize {
2746            8
2747        }
2748
2749        #[inline(always)]
2750        fn inline_size(_context: fidl::encoding::Context) -> usize {
2751            24
2752        }
2753    }
2754
2755    unsafe impl
2756        fidl::encoding::Encode<
2757            PrefixProviderAcquirePrefixRequest,
2758            fidl::encoding::DefaultFuchsiaResourceDialect,
2759        > for &mut PrefixProviderAcquirePrefixRequest
2760    {
2761        #[inline]
2762        unsafe fn encode(
2763            self,
2764            encoder: &mut fidl::encoding::Encoder<
2765                '_,
2766                fidl::encoding::DefaultFuchsiaResourceDialect,
2767            >,
2768            offset: usize,
2769            _depth: fidl::encoding::Depth,
2770        ) -> fidl::Result<()> {
2771            encoder.debug_check_bounds::<PrefixProviderAcquirePrefixRequest>(offset);
2772            // Delegate to tuple encoding.
2773            fidl::encoding::Encode::<PrefixProviderAcquirePrefixRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2774                (
2775                    <AcquirePrefixConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
2776                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrefixControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.prefix),
2777                ),
2778                encoder, offset, _depth
2779            )
2780        }
2781    }
2782    unsafe impl<
2783            T0: fidl::encoding::Encode<
2784                AcquirePrefixConfig,
2785                fidl::encoding::DefaultFuchsiaResourceDialect,
2786            >,
2787            T1: fidl::encoding::Encode<
2788                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrefixControlMarker>>,
2789                fidl::encoding::DefaultFuchsiaResourceDialect,
2790            >,
2791        >
2792        fidl::encoding::Encode<
2793            PrefixProviderAcquirePrefixRequest,
2794            fidl::encoding::DefaultFuchsiaResourceDialect,
2795        > for (T0, T1)
2796    {
2797        #[inline]
2798        unsafe fn encode(
2799            self,
2800            encoder: &mut fidl::encoding::Encoder<
2801                '_,
2802                fidl::encoding::DefaultFuchsiaResourceDialect,
2803            >,
2804            offset: usize,
2805            depth: fidl::encoding::Depth,
2806        ) -> fidl::Result<()> {
2807            encoder.debug_check_bounds::<PrefixProviderAcquirePrefixRequest>(offset);
2808            // Zero out padding regions. There's no need to apply masks
2809            // because the unmasked parts will be overwritten by fields.
2810            unsafe {
2811                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2812                (ptr as *mut u64).write_unaligned(0);
2813            }
2814            // Write the fields.
2815            self.0.encode(encoder, offset + 0, depth)?;
2816            self.1.encode(encoder, offset + 16, depth)?;
2817            Ok(())
2818        }
2819    }
2820
2821    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2822        for PrefixProviderAcquirePrefixRequest
2823    {
2824        #[inline(always)]
2825        fn new_empty() -> Self {
2826            Self {
2827                config: fidl::new_empty!(
2828                    AcquirePrefixConfig,
2829                    fidl::encoding::DefaultFuchsiaResourceDialect
2830                ),
2831                prefix: fidl::new_empty!(
2832                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrefixControlMarker>>,
2833                    fidl::encoding::DefaultFuchsiaResourceDialect
2834                ),
2835            }
2836        }
2837
2838        #[inline]
2839        unsafe fn decode(
2840            &mut self,
2841            decoder: &mut fidl::encoding::Decoder<
2842                '_,
2843                fidl::encoding::DefaultFuchsiaResourceDialect,
2844            >,
2845            offset: usize,
2846            _depth: fidl::encoding::Depth,
2847        ) -> fidl::Result<()> {
2848            decoder.debug_check_bounds::<Self>(offset);
2849            // Verify that padding bytes are zero.
2850            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2851            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2852            let mask = 0xffffffff00000000u64;
2853            let maskedval = padval & mask;
2854            if maskedval != 0 {
2855                return Err(fidl::Error::NonZeroPadding {
2856                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2857                });
2858            }
2859            fidl::decode!(
2860                AcquirePrefixConfig,
2861                fidl::encoding::DefaultFuchsiaResourceDialect,
2862                &mut self.config,
2863                decoder,
2864                offset + 0,
2865                _depth
2866            )?;
2867            fidl::decode!(
2868                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrefixControlMarker>>,
2869                fidl::encoding::DefaultFuchsiaResourceDialect,
2870                &mut self.prefix,
2871                decoder,
2872                offset + 16,
2873                _depth
2874            )?;
2875            Ok(())
2876        }
2877    }
2878}