Skip to main content

fidl_fuchsia_net_routes_admin/
fidl_fuchsia_net_routes_admin.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_routes_admin_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct BaseRouteTableGetAuthorizationForRouteTableResponse {
16    pub credential: GrantForRouteTableAuthorization,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for BaseRouteTableGetAuthorizationForRouteTableResponse
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct GrantForRouteTableAuthorization {
26    /// The ID of the table this credential is authenticating.
27    pub table_id: u32,
28    /// The `EVENT` providing authentication over this route table.
29    pub token: fidl::Event,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33    for GrantForRouteTableAuthorization
34{
35}
36
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct ProofOfRouteTableAuthorization {
39    pub table: u32,
40    pub token: fidl::Event,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
44    for ProofOfRouteTableAuthorization
45{
46}
47
48#[derive(Debug, PartialEq)]
49pub struct RouteSetV4AddRouteRequest {
50    pub route: fidl_fuchsia_net_routes::RouteV4,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RouteSetV4AddRouteRequest {}
54
55#[derive(Debug, PartialEq)]
56pub struct RouteSetV4AuthenticateForInterfaceRequest {
57    pub credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
61    for RouteSetV4AuthenticateForInterfaceRequest
62{
63}
64
65#[derive(Debug, PartialEq)]
66pub struct RouteSetV4RemoveRouteRequest {
67    pub route: fidl_fuchsia_net_routes::RouteV4,
68}
69
70impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
71    for RouteSetV4RemoveRouteRequest
72{
73}
74
75#[derive(Debug, PartialEq)]
76pub struct RouteSetV6AddRouteRequest {
77    pub route: fidl_fuchsia_net_routes::RouteV6,
78}
79
80impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RouteSetV6AddRouteRequest {}
81
82#[derive(Debug, PartialEq)]
83pub struct RouteSetV6AuthenticateForInterfaceRequest {
84    pub credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
85}
86
87impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
88    for RouteSetV6AuthenticateForInterfaceRequest
89{
90}
91
92#[derive(Debug, PartialEq)]
93pub struct RouteSetV6RemoveRouteRequest {
94    pub route: fidl_fuchsia_net_routes::RouteV6,
95}
96
97impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
98    for RouteSetV6RemoveRouteRequest
99{
100}
101
102#[derive(Debug, PartialEq)]
103pub struct RouteTableProviderV4GetInterfaceLocalTableRequest {
104    pub credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
105}
106
107impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
108    for RouteTableProviderV4GetInterfaceLocalTableRequest
109{
110}
111
112#[derive(Debug, PartialEq)]
113pub struct RouteTableProviderV4NewRouteTableRequest {
114    pub provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
115    pub options: RouteTableOptionsV4,
116}
117
118impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
119    for RouteTableProviderV4NewRouteTableRequest
120{
121}
122
123#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
124pub struct RouteTableProviderV4GetInterfaceLocalTableResponse {
125    pub route_table: fidl::endpoints::ClientEnd<RouteTableV4Marker>,
126}
127
128impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
129    for RouteTableProviderV4GetInterfaceLocalTableResponse
130{
131}
132
133#[derive(Debug, PartialEq)]
134pub struct RouteTableProviderV6GetInterfaceLocalTableRequest {
135    pub credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
136}
137
138impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
139    for RouteTableProviderV6GetInterfaceLocalTableRequest
140{
141}
142
143#[derive(Debug, PartialEq)]
144pub struct RouteTableProviderV6NewRouteTableRequest {
145    pub provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
146    pub options: RouteTableOptionsV6,
147}
148
149impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
150    for RouteTableProviderV6NewRouteTableRequest
151{
152}
153
154#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
155pub struct RouteTableProviderV6GetInterfaceLocalTableResponse {
156    pub route_table: fidl::endpoints::ClientEnd<RouteTableV6Marker>,
157}
158
159impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
160    for RouteTableProviderV6GetInterfaceLocalTableResponse
161{
162}
163
164#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
165pub struct RouteTableV4NewRouteSetRequest {
166    pub route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
167}
168
169impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
170    for RouteTableV4NewRouteSetRequest
171{
172}
173
174#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
175pub struct RouteTableV6NewRouteSetRequest {
176    pub route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
177}
178
179impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
180    for RouteTableV6NewRouteSetRequest
181{
182}
183
184#[derive(Debug, PartialEq)]
185pub struct RuleSetV4AddRuleRequest {
186    pub index: u32,
187    pub matcher: fidl_fuchsia_net_routes::RuleMatcherV4,
188    pub action: fidl_fuchsia_net_routes::RuleAction,
189}
190
191impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RuleSetV4AddRuleRequest {}
192
193#[derive(Debug, PartialEq)]
194pub struct RuleSetV6AddRuleRequest {
195    pub index: u32,
196    pub matcher: fidl_fuchsia_net_routes::RuleMatcherV6,
197    pub action: fidl_fuchsia_net_routes::RuleAction,
198}
199
200impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RuleSetV6AddRuleRequest {}
201
202#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
203pub struct RuleTableV4NewRuleSetRequest {
204    pub priority: u32,
205    pub rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
206}
207
208impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
209    for RuleTableV4NewRuleSetRequest
210{
211}
212
213#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
214pub struct RuleTableV6NewRuleSetRequest {
215    pub priority: u32,
216    pub rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
217}
218
219impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
220    for RuleTableV6NewRuleSetRequest
221{
222}
223
224#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
225pub struct BaseRouteTableMarker;
226
227impl fidl::endpoints::ProtocolMarker for BaseRouteTableMarker {
228    type Proxy = BaseRouteTableProxy;
229    type RequestStream = BaseRouteTableRequestStream;
230    #[cfg(target_os = "fuchsia")]
231    type SynchronousProxy = BaseRouteTableSynchronousProxy;
232
233    const DEBUG_NAME: &'static str = "(anonymous) BaseRouteTable";
234}
235pub type BaseRouteTableRemoveResult = Result<(), BaseRouteTableRemoveError>;
236
237pub trait BaseRouteTableProxyInterface: Send + Sync {
238    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
239    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
240    fn r#detach(&self) -> Result<(), fidl::Error>;
241    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
242        + Send;
243    fn r#remove(&self) -> Self::RemoveResponseFut;
244    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
245        + Send;
246    fn r#get_authorization_for_route_table(&self)
247    -> Self::GetAuthorizationForRouteTableResponseFut;
248}
249#[derive(Debug)]
250#[cfg(target_os = "fuchsia")]
251pub struct BaseRouteTableSynchronousProxy {
252    client: fidl::client::sync::Client,
253}
254
255#[cfg(target_os = "fuchsia")]
256impl fidl::endpoints::SynchronousProxy for BaseRouteTableSynchronousProxy {
257    type Proxy = BaseRouteTableProxy;
258    type Protocol = BaseRouteTableMarker;
259
260    fn from_channel(inner: fidl::Channel) -> Self {
261        Self::new(inner)
262    }
263
264    fn into_channel(self) -> fidl::Channel {
265        self.client.into_channel()
266    }
267
268    fn as_channel(&self) -> &fidl::Channel {
269        self.client.as_channel()
270    }
271}
272
273#[cfg(target_os = "fuchsia")]
274impl BaseRouteTableSynchronousProxy {
275    pub fn new(channel: fidl::Channel) -> Self {
276        Self { client: fidl::client::sync::Client::new(channel) }
277    }
278
279    pub fn into_channel(self) -> fidl::Channel {
280        self.client.into_channel()
281    }
282
283    /// Waits until an event arrives and returns it. It is safe for other
284    /// threads to make concurrent requests while waiting for an event.
285    pub fn wait_for_event(
286        &self,
287        deadline: zx::MonotonicInstant,
288    ) -> Result<BaseRouteTableEvent, fidl::Error> {
289        BaseRouteTableEvent::decode(self.client.wait_for_event::<BaseRouteTableMarker>(deadline)?)
290    }
291
292    /// Gets the table ID for this table.
293    pub fn r#get_table_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
294        let _response = self.client.send_query::<
295            fidl::encoding::EmptyPayload,
296            BaseRouteTableGetTableIdResponse,
297            BaseRouteTableMarker,
298        >(
299            (),
300            0x7eab30c55edbfc15,
301            fidl::encoding::DynamicFlags::empty(),
302            ___deadline,
303        )?;
304        Ok(_response.table_id)
305    }
306
307    /// Detaches the lifetime of the route table from the lifetime of the
308    /// client end of the channel.
309    ///
310    /// After this method is called, the route table will not be removed
311    /// if the client end is closed. It's a no-op if called on the main table.
312    pub fn r#detach(&self) -> Result<(), fidl::Error> {
313        self.client.send::<fidl::encoding::EmptyPayload>(
314            (),
315            0x2853ab157285b384,
316            fidl::encoding::DynamicFlags::empty(),
317        )
318    }
319
320    /// Removes the route table explicitly.
321    ///
322    /// This method cannot be called on the main table or an interface-local
323    /// table, an error will be returned if called. The server will close the
324    /// channel after this method successfully returns.
325    pub fn r#remove(
326        &self,
327        ___deadline: zx::MonotonicInstant,
328    ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
329        let _response =
330            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
331                fidl::encoding::EmptyStruct,
332                BaseRouteTableRemoveError,
333            >, BaseRouteTableMarker>(
334                (),
335                0xc42e58a5fc79426,
336                fidl::encoding::DynamicFlags::empty(),
337                ___deadline,
338            )?;
339        Ok(_response.map(|x| x))
340    }
341
342    /// Gets an authentication credential for this table.
343    ///
344    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
345    /// held by the server. This credential can be passed into
346    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
347    /// table. The `EVENT` is stable throughout the lifetime of the route table.
348    /// Clients may duplicate this `EVENT` to make multiple API calls, or
349    /// transfer the `EVENT` to other clients.
350    ///
351    /// - response `credential` the authorization credential for this table.
352    pub fn r#get_authorization_for_route_table(
353        &self,
354        ___deadline: zx::MonotonicInstant,
355    ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
356        let _response = self.client.send_query::<
357            fidl::encoding::EmptyPayload,
358            BaseRouteTableGetAuthorizationForRouteTableResponse,
359            BaseRouteTableMarker,
360        >(
361            (),
362            0x56a48c921ff3b6eb,
363            fidl::encoding::DynamicFlags::empty(),
364            ___deadline,
365        )?;
366        Ok(_response.credential)
367    }
368}
369
370#[cfg(target_os = "fuchsia")]
371impl From<BaseRouteTableSynchronousProxy> for zx::NullableHandle {
372    fn from(value: BaseRouteTableSynchronousProxy) -> Self {
373        value.into_channel().into()
374    }
375}
376
377#[cfg(target_os = "fuchsia")]
378impl From<fidl::Channel> for BaseRouteTableSynchronousProxy {
379    fn from(value: fidl::Channel) -> Self {
380        Self::new(value)
381    }
382}
383
384#[cfg(target_os = "fuchsia")]
385impl fidl::endpoints::FromClient for BaseRouteTableSynchronousProxy {
386    type Protocol = BaseRouteTableMarker;
387
388    fn from_client(value: fidl::endpoints::ClientEnd<BaseRouteTableMarker>) -> Self {
389        Self::new(value.into_channel())
390    }
391}
392
393#[derive(Debug, Clone)]
394pub struct BaseRouteTableProxy {
395    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
396}
397
398impl fidl::endpoints::Proxy for BaseRouteTableProxy {
399    type Protocol = BaseRouteTableMarker;
400
401    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
402        Self::new(inner)
403    }
404
405    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
406        self.client.into_channel().map_err(|client| Self { client })
407    }
408
409    fn as_channel(&self) -> &::fidl::AsyncChannel {
410        self.client.as_channel()
411    }
412}
413
414impl BaseRouteTableProxy {
415    /// Create a new Proxy for fuchsia.net.routes.admin/BaseRouteTable.
416    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
417        let protocol_name = <BaseRouteTableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
418        Self { client: fidl::client::Client::new(channel, protocol_name) }
419    }
420
421    /// Get a Stream of events from the remote end of the protocol.
422    ///
423    /// # Panics
424    ///
425    /// Panics if the event stream was already taken.
426    pub fn take_event_stream(&self) -> BaseRouteTableEventStream {
427        BaseRouteTableEventStream { event_receiver: self.client.take_event_receiver() }
428    }
429
430    /// Gets the table ID for this table.
431    pub fn r#get_table_id(
432        &self,
433    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
434        BaseRouteTableProxyInterface::r#get_table_id(self)
435    }
436
437    /// Detaches the lifetime of the route table from the lifetime of the
438    /// client end of the channel.
439    ///
440    /// After this method is called, the route table will not be removed
441    /// if the client end is closed. It's a no-op if called on the main table.
442    pub fn r#detach(&self) -> Result<(), fidl::Error> {
443        BaseRouteTableProxyInterface::r#detach(self)
444    }
445
446    /// Removes the route table explicitly.
447    ///
448    /// This method cannot be called on the main table or an interface-local
449    /// table, an error will be returned if called. The server will close the
450    /// channel after this method successfully returns.
451    pub fn r#remove(
452        &self,
453    ) -> fidl::client::QueryResponseFut<
454        BaseRouteTableRemoveResult,
455        fidl::encoding::DefaultFuchsiaResourceDialect,
456    > {
457        BaseRouteTableProxyInterface::r#remove(self)
458    }
459
460    /// Gets an authentication credential for this table.
461    ///
462    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
463    /// held by the server. This credential can be passed into
464    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
465    /// table. The `EVENT` is stable throughout the lifetime of the route table.
466    /// Clients may duplicate this `EVENT` to make multiple API calls, or
467    /// transfer the `EVENT` to other clients.
468    ///
469    /// - response `credential` the authorization credential for this table.
470    pub fn r#get_authorization_for_route_table(
471        &self,
472    ) -> fidl::client::QueryResponseFut<
473        GrantForRouteTableAuthorization,
474        fidl::encoding::DefaultFuchsiaResourceDialect,
475    > {
476        BaseRouteTableProxyInterface::r#get_authorization_for_route_table(self)
477    }
478}
479
480impl BaseRouteTableProxyInterface for BaseRouteTableProxy {
481    type GetTableIdResponseFut =
482        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
483    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
484        fn _decode(
485            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
486        ) -> Result<u32, fidl::Error> {
487            let _response = fidl::client::decode_transaction_body::<
488                BaseRouteTableGetTableIdResponse,
489                fidl::encoding::DefaultFuchsiaResourceDialect,
490                0x7eab30c55edbfc15,
491            >(_buf?)?;
492            Ok(_response.table_id)
493        }
494        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
495            (),
496            0x7eab30c55edbfc15,
497            fidl::encoding::DynamicFlags::empty(),
498            _decode,
499        )
500    }
501
502    fn r#detach(&self) -> Result<(), fidl::Error> {
503        self.client.send::<fidl::encoding::EmptyPayload>(
504            (),
505            0x2853ab157285b384,
506            fidl::encoding::DynamicFlags::empty(),
507        )
508    }
509
510    type RemoveResponseFut = fidl::client::QueryResponseFut<
511        BaseRouteTableRemoveResult,
512        fidl::encoding::DefaultFuchsiaResourceDialect,
513    >;
514    fn r#remove(&self) -> Self::RemoveResponseFut {
515        fn _decode(
516            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
517        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
518            let _response = fidl::client::decode_transaction_body::<
519                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
520                fidl::encoding::DefaultFuchsiaResourceDialect,
521                0xc42e58a5fc79426,
522            >(_buf?)?;
523            Ok(_response.map(|x| x))
524        }
525        self.client
526            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
527                (),
528                0xc42e58a5fc79426,
529                fidl::encoding::DynamicFlags::empty(),
530                _decode,
531            )
532    }
533
534    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
535        GrantForRouteTableAuthorization,
536        fidl::encoding::DefaultFuchsiaResourceDialect,
537    >;
538    fn r#get_authorization_for_route_table(
539        &self,
540    ) -> Self::GetAuthorizationForRouteTableResponseFut {
541        fn _decode(
542            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
543        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
544            let _response = fidl::client::decode_transaction_body::<
545                BaseRouteTableGetAuthorizationForRouteTableResponse,
546                fidl::encoding::DefaultFuchsiaResourceDialect,
547                0x56a48c921ff3b6eb,
548            >(_buf?)?;
549            Ok(_response.credential)
550        }
551        self.client
552            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
553                (),
554                0x56a48c921ff3b6eb,
555                fidl::encoding::DynamicFlags::empty(),
556                _decode,
557            )
558    }
559}
560
561pub struct BaseRouteTableEventStream {
562    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
563}
564
565impl std::marker::Unpin for BaseRouteTableEventStream {}
566
567impl futures::stream::FusedStream for BaseRouteTableEventStream {
568    fn is_terminated(&self) -> bool {
569        self.event_receiver.is_terminated()
570    }
571}
572
573impl futures::Stream for BaseRouteTableEventStream {
574    type Item = Result<BaseRouteTableEvent, fidl::Error>;
575
576    fn poll_next(
577        mut self: std::pin::Pin<&mut Self>,
578        cx: &mut std::task::Context<'_>,
579    ) -> std::task::Poll<Option<Self::Item>> {
580        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
581            &mut self.event_receiver,
582            cx
583        )?) {
584            Some(buf) => std::task::Poll::Ready(Some(BaseRouteTableEvent::decode(buf))),
585            None => std::task::Poll::Ready(None),
586        }
587    }
588}
589
590#[derive(Debug)]
591pub enum BaseRouteTableEvent {}
592
593impl BaseRouteTableEvent {
594    /// Decodes a message buffer as a [`BaseRouteTableEvent`].
595    fn decode(
596        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
597    ) -> Result<BaseRouteTableEvent, fidl::Error> {
598        let (bytes, _handles) = buf.split_mut();
599        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
600        debug_assert_eq!(tx_header.tx_id, 0);
601        match tx_header.ordinal {
602            _ => Err(fidl::Error::UnknownOrdinal {
603                ordinal: tx_header.ordinal,
604                protocol_name:
605                    <BaseRouteTableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
606            }),
607        }
608    }
609}
610
611/// A Stream of incoming requests for fuchsia.net.routes.admin/BaseRouteTable.
612pub struct BaseRouteTableRequestStream {
613    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
614    is_terminated: bool,
615}
616
617impl std::marker::Unpin for BaseRouteTableRequestStream {}
618
619impl futures::stream::FusedStream for BaseRouteTableRequestStream {
620    fn is_terminated(&self) -> bool {
621        self.is_terminated
622    }
623}
624
625impl fidl::endpoints::RequestStream for BaseRouteTableRequestStream {
626    type Protocol = BaseRouteTableMarker;
627    type ControlHandle = BaseRouteTableControlHandle;
628
629    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
630        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
631    }
632
633    fn control_handle(&self) -> Self::ControlHandle {
634        BaseRouteTableControlHandle { inner: self.inner.clone() }
635    }
636
637    fn into_inner(
638        self,
639    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
640    {
641        (self.inner, self.is_terminated)
642    }
643
644    fn from_inner(
645        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
646        is_terminated: bool,
647    ) -> Self {
648        Self { inner, is_terminated }
649    }
650}
651
652impl futures::Stream for BaseRouteTableRequestStream {
653    type Item = Result<BaseRouteTableRequest, fidl::Error>;
654
655    fn poll_next(
656        mut self: std::pin::Pin<&mut Self>,
657        cx: &mut std::task::Context<'_>,
658    ) -> std::task::Poll<Option<Self::Item>> {
659        let this = &mut *self;
660        if this.inner.check_shutdown(cx) {
661            this.is_terminated = true;
662            return std::task::Poll::Ready(None);
663        }
664        if this.is_terminated {
665            panic!("polled BaseRouteTableRequestStream after completion");
666        }
667        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
668            |bytes, handles| {
669                match this.inner.channel().read_etc(cx, bytes, handles) {
670                    std::task::Poll::Ready(Ok(())) => {}
671                    std::task::Poll::Pending => return std::task::Poll::Pending,
672                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
673                        this.is_terminated = true;
674                        return std::task::Poll::Ready(None);
675                    }
676                    std::task::Poll::Ready(Err(e)) => {
677                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
678                            e.into(),
679                        ))));
680                    }
681                }
682
683                // A message has been received from the channel
684                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
685
686                std::task::Poll::Ready(Some(match header.ordinal {
687                    0x7eab30c55edbfc15 => {
688                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
689                        let mut req = fidl::new_empty!(
690                            fidl::encoding::EmptyPayload,
691                            fidl::encoding::DefaultFuchsiaResourceDialect
692                        );
693                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
694                        let control_handle =
695                            BaseRouteTableControlHandle { inner: this.inner.clone() };
696                        Ok(BaseRouteTableRequest::GetTableId {
697                            responder: BaseRouteTableGetTableIdResponder {
698                                control_handle: std::mem::ManuallyDrop::new(control_handle),
699                                tx_id: header.tx_id,
700                            },
701                        })
702                    }
703                    0x2853ab157285b384 => {
704                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
705                        let mut req = fidl::new_empty!(
706                            fidl::encoding::EmptyPayload,
707                            fidl::encoding::DefaultFuchsiaResourceDialect
708                        );
709                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
710                        let control_handle =
711                            BaseRouteTableControlHandle { inner: this.inner.clone() };
712                        Ok(BaseRouteTableRequest::Detach { control_handle })
713                    }
714                    0xc42e58a5fc79426 => {
715                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
716                        let mut req = fidl::new_empty!(
717                            fidl::encoding::EmptyPayload,
718                            fidl::encoding::DefaultFuchsiaResourceDialect
719                        );
720                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
721                        let control_handle =
722                            BaseRouteTableControlHandle { inner: this.inner.clone() };
723                        Ok(BaseRouteTableRequest::Remove {
724                            responder: BaseRouteTableRemoveResponder {
725                                control_handle: std::mem::ManuallyDrop::new(control_handle),
726                                tx_id: header.tx_id,
727                            },
728                        })
729                    }
730                    0x56a48c921ff3b6eb => {
731                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
732                        let mut req = fidl::new_empty!(
733                            fidl::encoding::EmptyPayload,
734                            fidl::encoding::DefaultFuchsiaResourceDialect
735                        );
736                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
737                        let control_handle =
738                            BaseRouteTableControlHandle { inner: this.inner.clone() };
739                        Ok(BaseRouteTableRequest::GetAuthorizationForRouteTable {
740                            responder: BaseRouteTableGetAuthorizationForRouteTableResponder {
741                                control_handle: std::mem::ManuallyDrop::new(control_handle),
742                                tx_id: header.tx_id,
743                            },
744                        })
745                    }
746                    _ => Err(fidl::Error::UnknownOrdinal {
747                        ordinal: header.ordinal,
748                        protocol_name:
749                            <BaseRouteTableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
750                    }),
751                }))
752            },
753        )
754    }
755}
756
757/// Common base for `RouteTable` protocol that is IP version agnostic. This
758/// helps reduce FIDL duplication.
759#[derive(Debug)]
760pub enum BaseRouteTableRequest {
761    /// Gets the table ID for this table.
762    GetTableId { responder: BaseRouteTableGetTableIdResponder },
763    /// Detaches the lifetime of the route table from the lifetime of the
764    /// client end of the channel.
765    ///
766    /// After this method is called, the route table will not be removed
767    /// if the client end is closed. It's a no-op if called on the main table.
768    Detach { control_handle: BaseRouteTableControlHandle },
769    /// Removes the route table explicitly.
770    ///
771    /// This method cannot be called on the main table or an interface-local
772    /// table, an error will be returned if called. The server will close the
773    /// channel after this method successfully returns.
774    Remove { responder: BaseRouteTableRemoveResponder },
775    /// Gets an authentication credential for this table.
776    ///
777    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
778    /// held by the server. This credential can be passed into
779    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
780    /// table. The `EVENT` is stable throughout the lifetime of the route table.
781    /// Clients may duplicate this `EVENT` to make multiple API calls, or
782    /// transfer the `EVENT` to other clients.
783    ///
784    /// - response `credential` the authorization credential for this table.
785    GetAuthorizationForRouteTable {
786        responder: BaseRouteTableGetAuthorizationForRouteTableResponder,
787    },
788}
789
790impl BaseRouteTableRequest {
791    #[allow(irrefutable_let_patterns)]
792    pub fn into_get_table_id(self) -> Option<(BaseRouteTableGetTableIdResponder)> {
793        if let BaseRouteTableRequest::GetTableId { responder } = self {
794            Some((responder))
795        } else {
796            None
797        }
798    }
799
800    #[allow(irrefutable_let_patterns)]
801    pub fn into_detach(self) -> Option<(BaseRouteTableControlHandle)> {
802        if let BaseRouteTableRequest::Detach { control_handle } = self {
803            Some((control_handle))
804        } else {
805            None
806        }
807    }
808
809    #[allow(irrefutable_let_patterns)]
810    pub fn into_remove(self) -> Option<(BaseRouteTableRemoveResponder)> {
811        if let BaseRouteTableRequest::Remove { responder } = self {
812            Some((responder))
813        } else {
814            None
815        }
816    }
817
818    #[allow(irrefutable_let_patterns)]
819    pub fn into_get_authorization_for_route_table(
820        self,
821    ) -> Option<(BaseRouteTableGetAuthorizationForRouteTableResponder)> {
822        if let BaseRouteTableRequest::GetAuthorizationForRouteTable { responder } = self {
823            Some((responder))
824        } else {
825            None
826        }
827    }
828
829    /// Name of the method defined in FIDL
830    pub fn method_name(&self) -> &'static str {
831        match *self {
832            BaseRouteTableRequest::GetTableId { .. } => "get_table_id",
833            BaseRouteTableRequest::Detach { .. } => "detach",
834            BaseRouteTableRequest::Remove { .. } => "remove",
835            BaseRouteTableRequest::GetAuthorizationForRouteTable { .. } => {
836                "get_authorization_for_route_table"
837            }
838        }
839    }
840}
841
842#[derive(Debug, Clone)]
843pub struct BaseRouteTableControlHandle {
844    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
845}
846
847impl BaseRouteTableControlHandle {
848    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
849        self.inner.shutdown_with_epitaph(status.into())
850    }
851}
852
853impl fidl::endpoints::ControlHandle for BaseRouteTableControlHandle {
854    fn shutdown(&self) {
855        self.inner.shutdown()
856    }
857
858    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
859        self.inner.shutdown_with_epitaph(status)
860    }
861
862    fn is_closed(&self) -> bool {
863        self.inner.channel().is_closed()
864    }
865    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
866        self.inner.channel().on_closed()
867    }
868
869    #[cfg(target_os = "fuchsia")]
870    fn signal_peer(
871        &self,
872        clear_mask: zx::Signals,
873        set_mask: zx::Signals,
874    ) -> Result<(), zx_status::Status> {
875        use fidl::Peered;
876        self.inner.channel().signal_peer(clear_mask, set_mask)
877    }
878}
879
880impl BaseRouteTableControlHandle {}
881
882#[must_use = "FIDL methods require a response to be sent"]
883#[derive(Debug)]
884pub struct BaseRouteTableGetTableIdResponder {
885    control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
886    tx_id: u32,
887}
888
889/// Set the the channel to be shutdown (see [`BaseRouteTableControlHandle::shutdown`])
890/// if the responder is dropped without sending a response, so that the client
891/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
892impl std::ops::Drop for BaseRouteTableGetTableIdResponder {
893    fn drop(&mut self) {
894        self.control_handle.shutdown();
895        // Safety: drops once, never accessed again
896        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
897    }
898}
899
900impl fidl::endpoints::Responder for BaseRouteTableGetTableIdResponder {
901    type ControlHandle = BaseRouteTableControlHandle;
902
903    fn control_handle(&self) -> &BaseRouteTableControlHandle {
904        &self.control_handle
905    }
906
907    fn drop_without_shutdown(mut self) {
908        // Safety: drops once, never accessed again due to mem::forget
909        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
910        // Prevent Drop from running (which would shut down the channel)
911        std::mem::forget(self);
912    }
913}
914
915impl BaseRouteTableGetTableIdResponder {
916    /// Sends a response to the FIDL transaction.
917    ///
918    /// Sets the channel to shutdown if an error occurs.
919    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
920        let _result = self.send_raw(table_id);
921        if _result.is_err() {
922            self.control_handle.shutdown();
923        }
924        self.drop_without_shutdown();
925        _result
926    }
927
928    /// Similar to "send" but does not shutdown the channel if an error occurs.
929    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
930        let _result = self.send_raw(table_id);
931        self.drop_without_shutdown();
932        _result
933    }
934
935    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
936        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
937            (table_id,),
938            self.tx_id,
939            0x7eab30c55edbfc15,
940            fidl::encoding::DynamicFlags::empty(),
941        )
942    }
943}
944
945#[must_use = "FIDL methods require a response to be sent"]
946#[derive(Debug)]
947pub struct BaseRouteTableRemoveResponder {
948    control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
949    tx_id: u32,
950}
951
952/// Set the the channel to be shutdown (see [`BaseRouteTableControlHandle::shutdown`])
953/// if the responder is dropped without sending a response, so that the client
954/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
955impl std::ops::Drop for BaseRouteTableRemoveResponder {
956    fn drop(&mut self) {
957        self.control_handle.shutdown();
958        // Safety: drops once, never accessed again
959        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
960    }
961}
962
963impl fidl::endpoints::Responder for BaseRouteTableRemoveResponder {
964    type ControlHandle = BaseRouteTableControlHandle;
965
966    fn control_handle(&self) -> &BaseRouteTableControlHandle {
967        &self.control_handle
968    }
969
970    fn drop_without_shutdown(mut self) {
971        // Safety: drops once, never accessed again due to mem::forget
972        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
973        // Prevent Drop from running (which would shut down the channel)
974        std::mem::forget(self);
975    }
976}
977
978impl BaseRouteTableRemoveResponder {
979    /// Sends a response to the FIDL transaction.
980    ///
981    /// Sets the channel to shutdown if an error occurs.
982    pub fn send(
983        self,
984        mut result: Result<(), BaseRouteTableRemoveError>,
985    ) -> Result<(), fidl::Error> {
986        let _result = self.send_raw(result);
987        if _result.is_err() {
988            self.control_handle.shutdown();
989        }
990        self.drop_without_shutdown();
991        _result
992    }
993
994    /// Similar to "send" but does not shutdown the channel if an error occurs.
995    pub fn send_no_shutdown_on_err(
996        self,
997        mut result: Result<(), BaseRouteTableRemoveError>,
998    ) -> Result<(), fidl::Error> {
999        let _result = self.send_raw(result);
1000        self.drop_without_shutdown();
1001        _result
1002    }
1003
1004    fn send_raw(
1005        &self,
1006        mut result: Result<(), BaseRouteTableRemoveError>,
1007    ) -> Result<(), fidl::Error> {
1008        self.control_handle.inner.send::<fidl::encoding::ResultType<
1009            fidl::encoding::EmptyStruct,
1010            BaseRouteTableRemoveError,
1011        >>(
1012            result,
1013            self.tx_id,
1014            0xc42e58a5fc79426,
1015            fidl::encoding::DynamicFlags::empty(),
1016        )
1017    }
1018}
1019
1020#[must_use = "FIDL methods require a response to be sent"]
1021#[derive(Debug)]
1022pub struct BaseRouteTableGetAuthorizationForRouteTableResponder {
1023    control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
1024    tx_id: u32,
1025}
1026
1027/// Set the the channel to be shutdown (see [`BaseRouteTableControlHandle::shutdown`])
1028/// if the responder is dropped without sending a response, so that the client
1029/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1030impl std::ops::Drop for BaseRouteTableGetAuthorizationForRouteTableResponder {
1031    fn drop(&mut self) {
1032        self.control_handle.shutdown();
1033        // Safety: drops once, never accessed again
1034        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1035    }
1036}
1037
1038impl fidl::endpoints::Responder for BaseRouteTableGetAuthorizationForRouteTableResponder {
1039    type ControlHandle = BaseRouteTableControlHandle;
1040
1041    fn control_handle(&self) -> &BaseRouteTableControlHandle {
1042        &self.control_handle
1043    }
1044
1045    fn drop_without_shutdown(mut self) {
1046        // Safety: drops once, never accessed again due to mem::forget
1047        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1048        // Prevent Drop from running (which would shut down the channel)
1049        std::mem::forget(self);
1050    }
1051}
1052
1053impl BaseRouteTableGetAuthorizationForRouteTableResponder {
1054    /// Sends a response to the FIDL transaction.
1055    ///
1056    /// Sets the channel to shutdown if an error occurs.
1057    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
1058        let _result = self.send_raw(credential);
1059        if _result.is_err() {
1060            self.control_handle.shutdown();
1061        }
1062        self.drop_without_shutdown();
1063        _result
1064    }
1065
1066    /// Similar to "send" but does not shutdown the channel if an error occurs.
1067    pub fn send_no_shutdown_on_err(
1068        self,
1069        mut credential: GrantForRouteTableAuthorization,
1070    ) -> Result<(), fidl::Error> {
1071        let _result = self.send_raw(credential);
1072        self.drop_without_shutdown();
1073        _result
1074    }
1075
1076    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
1077        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
1078            (&mut credential,),
1079            self.tx_id,
1080            0x56a48c921ff3b6eb,
1081            fidl::encoding::DynamicFlags::empty(),
1082        )
1083    }
1084}
1085
1086#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1087pub struct BaseRuleSetMarker;
1088
1089impl fidl::endpoints::ProtocolMarker for BaseRuleSetMarker {
1090    type Proxy = BaseRuleSetProxy;
1091    type RequestStream = BaseRuleSetRequestStream;
1092    #[cfg(target_os = "fuchsia")]
1093    type SynchronousProxy = BaseRuleSetSynchronousProxy;
1094
1095    const DEBUG_NAME: &'static str = "(anonymous) BaseRuleSet";
1096}
1097pub type BaseRuleSetAuthenticateForRouteTableResult = Result<(), AuthenticateForRouteTableError>;
1098pub type BaseRuleSetRemoveRuleResult = Result<(), RuleSetError>;
1099
1100pub trait BaseRuleSetProxyInterface: Send + Sync {
1101    type AuthenticateForRouteTableResponseFut: std::future::Future<
1102            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
1103        > + Send;
1104    fn r#authenticate_for_route_table(
1105        &self,
1106        table: u32,
1107        token: fidl::Event,
1108    ) -> Self::AuthenticateForRouteTableResponseFut;
1109    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
1110        + Send;
1111    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
1112    fn r#close(&self) -> Result<(), fidl::Error>;
1113}
1114#[derive(Debug)]
1115#[cfg(target_os = "fuchsia")]
1116pub struct BaseRuleSetSynchronousProxy {
1117    client: fidl::client::sync::Client,
1118}
1119
1120#[cfg(target_os = "fuchsia")]
1121impl fidl::endpoints::SynchronousProxy for BaseRuleSetSynchronousProxy {
1122    type Proxy = BaseRuleSetProxy;
1123    type Protocol = BaseRuleSetMarker;
1124
1125    fn from_channel(inner: fidl::Channel) -> Self {
1126        Self::new(inner)
1127    }
1128
1129    fn into_channel(self) -> fidl::Channel {
1130        self.client.into_channel()
1131    }
1132
1133    fn as_channel(&self) -> &fidl::Channel {
1134        self.client.as_channel()
1135    }
1136}
1137
1138#[cfg(target_os = "fuchsia")]
1139impl BaseRuleSetSynchronousProxy {
1140    pub fn new(channel: fidl::Channel) -> Self {
1141        Self { client: fidl::client::sync::Client::new(channel) }
1142    }
1143
1144    pub fn into_channel(self) -> fidl::Channel {
1145        self.client.into_channel()
1146    }
1147
1148    /// Waits until an event arrives and returns it. It is safe for other
1149    /// threads to make concurrent requests while waiting for an event.
1150    pub fn wait_for_event(
1151        &self,
1152        deadline: zx::MonotonicInstant,
1153    ) -> Result<BaseRuleSetEvent, fidl::Error> {
1154        BaseRuleSetEvent::decode(self.client.wait_for_event::<BaseRuleSetMarker>(deadline)?)
1155    }
1156
1157    /// Authenticates for a route table that will be used in an action.
1158    pub fn r#authenticate_for_route_table(
1159        &self,
1160        mut table: u32,
1161        mut token: fidl::Event,
1162        ___deadline: zx::MonotonicInstant,
1163    ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
1164        let _response =
1165            self.client.send_query::<ProofOfRouteTableAuthorization, fidl::encoding::ResultType<
1166                fidl::encoding::EmptyStruct,
1167                AuthenticateForRouteTableError,
1168            >, BaseRuleSetMarker>(
1169                (table, token),
1170                0x6fd845360ed9bc8f,
1171                fidl::encoding::DynamicFlags::empty(),
1172                ___deadline,
1173            )?;
1174        Ok(_response.map(|x| x))
1175    }
1176
1177    /// Removes a rule from this rule set.
1178    ///
1179    /// If the client tries to remove from an index that does not have a rule,
1180    /// the error `RULE_DOES_NOT_EXIST` will be returned.
1181    ///
1182    /// + request `index` the index of the rule.
1183    pub fn r#remove_rule(
1184        &self,
1185        mut index: u32,
1186        ___deadline: zx::MonotonicInstant,
1187    ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
1188        let _response = self.client.send_query::<
1189            BaseRuleSetRemoveRuleRequest,
1190            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
1191            BaseRuleSetMarker,
1192        >(
1193            (index,),
1194            0x2ae3d7e817cbff90,
1195            fidl::encoding::DynamicFlags::empty(),
1196            ___deadline,
1197        )?;
1198        Ok(_response.map(|x| x))
1199    }
1200
1201    /// Removes all rules in the rule set and the underlying channel will be
1202    /// closed after the rules are removed.
1203    ///
1204    /// This method provides a way for synchronous closure.
1205    pub fn r#close(&self) -> Result<(), fidl::Error> {
1206        self.client.send::<fidl::encoding::EmptyPayload>(
1207            (),
1208            0x457e1753672d4073,
1209            fidl::encoding::DynamicFlags::empty(),
1210        )
1211    }
1212}
1213
1214#[cfg(target_os = "fuchsia")]
1215impl From<BaseRuleSetSynchronousProxy> for zx::NullableHandle {
1216    fn from(value: BaseRuleSetSynchronousProxy) -> Self {
1217        value.into_channel().into()
1218    }
1219}
1220
1221#[cfg(target_os = "fuchsia")]
1222impl From<fidl::Channel> for BaseRuleSetSynchronousProxy {
1223    fn from(value: fidl::Channel) -> Self {
1224        Self::new(value)
1225    }
1226}
1227
1228#[cfg(target_os = "fuchsia")]
1229impl fidl::endpoints::FromClient for BaseRuleSetSynchronousProxy {
1230    type Protocol = BaseRuleSetMarker;
1231
1232    fn from_client(value: fidl::endpoints::ClientEnd<BaseRuleSetMarker>) -> Self {
1233        Self::new(value.into_channel())
1234    }
1235}
1236
1237#[derive(Debug, Clone)]
1238pub struct BaseRuleSetProxy {
1239    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1240}
1241
1242impl fidl::endpoints::Proxy for BaseRuleSetProxy {
1243    type Protocol = BaseRuleSetMarker;
1244
1245    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1246        Self::new(inner)
1247    }
1248
1249    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1250        self.client.into_channel().map_err(|client| Self { client })
1251    }
1252
1253    fn as_channel(&self) -> &::fidl::AsyncChannel {
1254        self.client.as_channel()
1255    }
1256}
1257
1258impl BaseRuleSetProxy {
1259    /// Create a new Proxy for fuchsia.net.routes.admin/BaseRuleSet.
1260    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1261        let protocol_name = <BaseRuleSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1262        Self { client: fidl::client::Client::new(channel, protocol_name) }
1263    }
1264
1265    /// Get a Stream of events from the remote end of the protocol.
1266    ///
1267    /// # Panics
1268    ///
1269    /// Panics if the event stream was already taken.
1270    pub fn take_event_stream(&self) -> BaseRuleSetEventStream {
1271        BaseRuleSetEventStream { event_receiver: self.client.take_event_receiver() }
1272    }
1273
1274    /// Authenticates for a route table that will be used in an action.
1275    pub fn r#authenticate_for_route_table(
1276        &self,
1277        mut table: u32,
1278        mut token: fidl::Event,
1279    ) -> fidl::client::QueryResponseFut<
1280        BaseRuleSetAuthenticateForRouteTableResult,
1281        fidl::encoding::DefaultFuchsiaResourceDialect,
1282    > {
1283        BaseRuleSetProxyInterface::r#authenticate_for_route_table(self, table, token)
1284    }
1285
1286    /// Removes a rule from this rule set.
1287    ///
1288    /// If the client tries to remove from an index that does not have a rule,
1289    /// the error `RULE_DOES_NOT_EXIST` will be returned.
1290    ///
1291    /// + request `index` the index of the rule.
1292    pub fn r#remove_rule(
1293        &self,
1294        mut index: u32,
1295    ) -> fidl::client::QueryResponseFut<
1296        BaseRuleSetRemoveRuleResult,
1297        fidl::encoding::DefaultFuchsiaResourceDialect,
1298    > {
1299        BaseRuleSetProxyInterface::r#remove_rule(self, index)
1300    }
1301
1302    /// Removes all rules in the rule set and the underlying channel will be
1303    /// closed after the rules are removed.
1304    ///
1305    /// This method provides a way for synchronous closure.
1306    pub fn r#close(&self) -> Result<(), fidl::Error> {
1307        BaseRuleSetProxyInterface::r#close(self)
1308    }
1309}
1310
1311impl BaseRuleSetProxyInterface for BaseRuleSetProxy {
1312    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
1313        BaseRuleSetAuthenticateForRouteTableResult,
1314        fidl::encoding::DefaultFuchsiaResourceDialect,
1315    >;
1316    fn r#authenticate_for_route_table(
1317        &self,
1318        mut table: u32,
1319        mut token: fidl::Event,
1320    ) -> Self::AuthenticateForRouteTableResponseFut {
1321        fn _decode(
1322            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1323        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
1324            let _response = fidl::client::decode_transaction_body::<
1325                fidl::encoding::ResultType<
1326                    fidl::encoding::EmptyStruct,
1327                    AuthenticateForRouteTableError,
1328                >,
1329                fidl::encoding::DefaultFuchsiaResourceDialect,
1330                0x6fd845360ed9bc8f,
1331            >(_buf?)?;
1332            Ok(_response.map(|x| x))
1333        }
1334        self.client.send_query_and_decode::<
1335            ProofOfRouteTableAuthorization,
1336            BaseRuleSetAuthenticateForRouteTableResult,
1337        >(
1338            (table, token,),
1339            0x6fd845360ed9bc8f,
1340            fidl::encoding::DynamicFlags::empty(),
1341            _decode,
1342        )
1343    }
1344
1345    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
1346        BaseRuleSetRemoveRuleResult,
1347        fidl::encoding::DefaultFuchsiaResourceDialect,
1348    >;
1349    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
1350        fn _decode(
1351            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1352        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
1353            let _response = fidl::client::decode_transaction_body::<
1354                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
1355                fidl::encoding::DefaultFuchsiaResourceDialect,
1356                0x2ae3d7e817cbff90,
1357            >(_buf?)?;
1358            Ok(_response.map(|x| x))
1359        }
1360        self.client
1361            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
1362                (index,),
1363                0x2ae3d7e817cbff90,
1364                fidl::encoding::DynamicFlags::empty(),
1365                _decode,
1366            )
1367    }
1368
1369    fn r#close(&self) -> Result<(), fidl::Error> {
1370        self.client.send::<fidl::encoding::EmptyPayload>(
1371            (),
1372            0x457e1753672d4073,
1373            fidl::encoding::DynamicFlags::empty(),
1374        )
1375    }
1376}
1377
1378pub struct BaseRuleSetEventStream {
1379    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1380}
1381
1382impl std::marker::Unpin for BaseRuleSetEventStream {}
1383
1384impl futures::stream::FusedStream for BaseRuleSetEventStream {
1385    fn is_terminated(&self) -> bool {
1386        self.event_receiver.is_terminated()
1387    }
1388}
1389
1390impl futures::Stream for BaseRuleSetEventStream {
1391    type Item = Result<BaseRuleSetEvent, fidl::Error>;
1392
1393    fn poll_next(
1394        mut self: std::pin::Pin<&mut Self>,
1395        cx: &mut std::task::Context<'_>,
1396    ) -> std::task::Poll<Option<Self::Item>> {
1397        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1398            &mut self.event_receiver,
1399            cx
1400        )?) {
1401            Some(buf) => std::task::Poll::Ready(Some(BaseRuleSetEvent::decode(buf))),
1402            None => std::task::Poll::Ready(None),
1403        }
1404    }
1405}
1406
1407#[derive(Debug)]
1408pub enum BaseRuleSetEvent {}
1409
1410impl BaseRuleSetEvent {
1411    /// Decodes a message buffer as a [`BaseRuleSetEvent`].
1412    fn decode(
1413        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1414    ) -> Result<BaseRuleSetEvent, fidl::Error> {
1415        let (bytes, _handles) = buf.split_mut();
1416        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1417        debug_assert_eq!(tx_header.tx_id, 0);
1418        match tx_header.ordinal {
1419            _ => Err(fidl::Error::UnknownOrdinal {
1420                ordinal: tx_header.ordinal,
1421                protocol_name: <BaseRuleSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1422            }),
1423        }
1424    }
1425}
1426
1427/// A Stream of incoming requests for fuchsia.net.routes.admin/BaseRuleSet.
1428pub struct BaseRuleSetRequestStream {
1429    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1430    is_terminated: bool,
1431}
1432
1433impl std::marker::Unpin for BaseRuleSetRequestStream {}
1434
1435impl futures::stream::FusedStream for BaseRuleSetRequestStream {
1436    fn is_terminated(&self) -> bool {
1437        self.is_terminated
1438    }
1439}
1440
1441impl fidl::endpoints::RequestStream for BaseRuleSetRequestStream {
1442    type Protocol = BaseRuleSetMarker;
1443    type ControlHandle = BaseRuleSetControlHandle;
1444
1445    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1446        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1447    }
1448
1449    fn control_handle(&self) -> Self::ControlHandle {
1450        BaseRuleSetControlHandle { inner: self.inner.clone() }
1451    }
1452
1453    fn into_inner(
1454        self,
1455    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1456    {
1457        (self.inner, self.is_terminated)
1458    }
1459
1460    fn from_inner(
1461        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1462        is_terminated: bool,
1463    ) -> Self {
1464        Self { inner, is_terminated }
1465    }
1466}
1467
1468impl futures::Stream for BaseRuleSetRequestStream {
1469    type Item = Result<BaseRuleSetRequest, fidl::Error>;
1470
1471    fn poll_next(
1472        mut self: std::pin::Pin<&mut Self>,
1473        cx: &mut std::task::Context<'_>,
1474    ) -> std::task::Poll<Option<Self::Item>> {
1475        let this = &mut *self;
1476        if this.inner.check_shutdown(cx) {
1477            this.is_terminated = true;
1478            return std::task::Poll::Ready(None);
1479        }
1480        if this.is_terminated {
1481            panic!("polled BaseRuleSetRequestStream after completion");
1482        }
1483        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1484            |bytes, handles| {
1485                match this.inner.channel().read_etc(cx, bytes, handles) {
1486                    std::task::Poll::Ready(Ok(())) => {}
1487                    std::task::Poll::Pending => return std::task::Poll::Pending,
1488                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1489                        this.is_terminated = true;
1490                        return std::task::Poll::Ready(None);
1491                    }
1492                    std::task::Poll::Ready(Err(e)) => {
1493                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1494                            e.into(),
1495                        ))));
1496                    }
1497                }
1498
1499                // A message has been received from the channel
1500                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1501
1502                std::task::Poll::Ready(Some(match header.ordinal {
1503                    0x6fd845360ed9bc8f => {
1504                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1505                        let mut req = fidl::new_empty!(
1506                            ProofOfRouteTableAuthorization,
1507                            fidl::encoding::DefaultFuchsiaResourceDialect
1508                        );
1509                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
1510                        let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
1511                        Ok(BaseRuleSetRequest::AuthenticateForRouteTable {
1512                            table: req.table,
1513                            token: req.token,
1514
1515                            responder: BaseRuleSetAuthenticateForRouteTableResponder {
1516                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1517                                tx_id: header.tx_id,
1518                            },
1519                        })
1520                    }
1521                    0x2ae3d7e817cbff90 => {
1522                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1523                        let mut req = fidl::new_empty!(
1524                            BaseRuleSetRemoveRuleRequest,
1525                            fidl::encoding::DefaultFuchsiaResourceDialect
1526                        );
1527                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
1528                        let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
1529                        Ok(BaseRuleSetRequest::RemoveRule {
1530                            index: req.index,
1531
1532                            responder: BaseRuleSetRemoveRuleResponder {
1533                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1534                                tx_id: header.tx_id,
1535                            },
1536                        })
1537                    }
1538                    0x457e1753672d4073 => {
1539                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1540                        let mut req = fidl::new_empty!(
1541                            fidl::encoding::EmptyPayload,
1542                            fidl::encoding::DefaultFuchsiaResourceDialect
1543                        );
1544                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1545                        let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
1546                        Ok(BaseRuleSetRequest::Close { control_handle })
1547                    }
1548                    _ => Err(fidl::Error::UnknownOrdinal {
1549                        ordinal: header.ordinal,
1550                        protocol_name:
1551                            <BaseRuleSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1552                    }),
1553                }))
1554            },
1555        )
1556    }
1557}
1558
1559/// Common base for `RuleSet` protocol that is IP version agnostic. This
1560/// helps reduce FIDL duplication.
1561#[derive(Debug)]
1562pub enum BaseRuleSetRequest {
1563    /// Authenticates for a route table that will be used in an action.
1564    AuthenticateForRouteTable {
1565        table: u32,
1566        token: fidl::Event,
1567        responder: BaseRuleSetAuthenticateForRouteTableResponder,
1568    },
1569    /// Removes a rule from this rule set.
1570    ///
1571    /// If the client tries to remove from an index that does not have a rule,
1572    /// the error `RULE_DOES_NOT_EXIST` will be returned.
1573    ///
1574    /// + request `index` the index of the rule.
1575    RemoveRule { index: u32, responder: BaseRuleSetRemoveRuleResponder },
1576    /// Removes all rules in the rule set and the underlying channel will be
1577    /// closed after the rules are removed.
1578    ///
1579    /// This method provides a way for synchronous closure.
1580    Close { control_handle: BaseRuleSetControlHandle },
1581}
1582
1583impl BaseRuleSetRequest {
1584    #[allow(irrefutable_let_patterns)]
1585    pub fn into_authenticate_for_route_table(
1586        self,
1587    ) -> Option<(u32, fidl::Event, BaseRuleSetAuthenticateForRouteTableResponder)> {
1588        if let BaseRuleSetRequest::AuthenticateForRouteTable { table, token, responder } = self {
1589            Some((table, token, responder))
1590        } else {
1591            None
1592        }
1593    }
1594
1595    #[allow(irrefutable_let_patterns)]
1596    pub fn into_remove_rule(self) -> Option<(u32, BaseRuleSetRemoveRuleResponder)> {
1597        if let BaseRuleSetRequest::RemoveRule { index, responder } = self {
1598            Some((index, responder))
1599        } else {
1600            None
1601        }
1602    }
1603
1604    #[allow(irrefutable_let_patterns)]
1605    pub fn into_close(self) -> Option<(BaseRuleSetControlHandle)> {
1606        if let BaseRuleSetRequest::Close { control_handle } = self {
1607            Some((control_handle))
1608        } else {
1609            None
1610        }
1611    }
1612
1613    /// Name of the method defined in FIDL
1614    pub fn method_name(&self) -> &'static str {
1615        match *self {
1616            BaseRuleSetRequest::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
1617            BaseRuleSetRequest::RemoveRule { .. } => "remove_rule",
1618            BaseRuleSetRequest::Close { .. } => "close",
1619        }
1620    }
1621}
1622
1623#[derive(Debug, Clone)]
1624pub struct BaseRuleSetControlHandle {
1625    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1626}
1627
1628impl BaseRuleSetControlHandle {
1629    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1630        self.inner.shutdown_with_epitaph(status.into())
1631    }
1632}
1633
1634impl fidl::endpoints::ControlHandle for BaseRuleSetControlHandle {
1635    fn shutdown(&self) {
1636        self.inner.shutdown()
1637    }
1638
1639    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1640        self.inner.shutdown_with_epitaph(status)
1641    }
1642
1643    fn is_closed(&self) -> bool {
1644        self.inner.channel().is_closed()
1645    }
1646    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1647        self.inner.channel().on_closed()
1648    }
1649
1650    #[cfg(target_os = "fuchsia")]
1651    fn signal_peer(
1652        &self,
1653        clear_mask: zx::Signals,
1654        set_mask: zx::Signals,
1655    ) -> Result<(), zx_status::Status> {
1656        use fidl::Peered;
1657        self.inner.channel().signal_peer(clear_mask, set_mask)
1658    }
1659}
1660
1661impl BaseRuleSetControlHandle {}
1662
1663#[must_use = "FIDL methods require a response to be sent"]
1664#[derive(Debug)]
1665pub struct BaseRuleSetAuthenticateForRouteTableResponder {
1666    control_handle: std::mem::ManuallyDrop<BaseRuleSetControlHandle>,
1667    tx_id: u32,
1668}
1669
1670/// Set the the channel to be shutdown (see [`BaseRuleSetControlHandle::shutdown`])
1671/// if the responder is dropped without sending a response, so that the client
1672/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1673impl std::ops::Drop for BaseRuleSetAuthenticateForRouteTableResponder {
1674    fn drop(&mut self) {
1675        self.control_handle.shutdown();
1676        // Safety: drops once, never accessed again
1677        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1678    }
1679}
1680
1681impl fidl::endpoints::Responder for BaseRuleSetAuthenticateForRouteTableResponder {
1682    type ControlHandle = BaseRuleSetControlHandle;
1683
1684    fn control_handle(&self) -> &BaseRuleSetControlHandle {
1685        &self.control_handle
1686    }
1687
1688    fn drop_without_shutdown(mut self) {
1689        // Safety: drops once, never accessed again due to mem::forget
1690        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1691        // Prevent Drop from running (which would shut down the channel)
1692        std::mem::forget(self);
1693    }
1694}
1695
1696impl BaseRuleSetAuthenticateForRouteTableResponder {
1697    /// Sends a response to the FIDL transaction.
1698    ///
1699    /// Sets the channel to shutdown if an error occurs.
1700    pub fn send(
1701        self,
1702        mut result: Result<(), AuthenticateForRouteTableError>,
1703    ) -> Result<(), fidl::Error> {
1704        let _result = self.send_raw(result);
1705        if _result.is_err() {
1706            self.control_handle.shutdown();
1707        }
1708        self.drop_without_shutdown();
1709        _result
1710    }
1711
1712    /// Similar to "send" but does not shutdown the channel if an error occurs.
1713    pub fn send_no_shutdown_on_err(
1714        self,
1715        mut result: Result<(), AuthenticateForRouteTableError>,
1716    ) -> Result<(), fidl::Error> {
1717        let _result = self.send_raw(result);
1718        self.drop_without_shutdown();
1719        _result
1720    }
1721
1722    fn send_raw(
1723        &self,
1724        mut result: Result<(), AuthenticateForRouteTableError>,
1725    ) -> Result<(), fidl::Error> {
1726        self.control_handle.inner.send::<fidl::encoding::ResultType<
1727            fidl::encoding::EmptyStruct,
1728            AuthenticateForRouteTableError,
1729        >>(
1730            result,
1731            self.tx_id,
1732            0x6fd845360ed9bc8f,
1733            fidl::encoding::DynamicFlags::empty(),
1734        )
1735    }
1736}
1737
1738#[must_use = "FIDL methods require a response to be sent"]
1739#[derive(Debug)]
1740pub struct BaseRuleSetRemoveRuleResponder {
1741    control_handle: std::mem::ManuallyDrop<BaseRuleSetControlHandle>,
1742    tx_id: u32,
1743}
1744
1745/// Set the the channel to be shutdown (see [`BaseRuleSetControlHandle::shutdown`])
1746/// if the responder is dropped without sending a response, so that the client
1747/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1748impl std::ops::Drop for BaseRuleSetRemoveRuleResponder {
1749    fn drop(&mut self) {
1750        self.control_handle.shutdown();
1751        // Safety: drops once, never accessed again
1752        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1753    }
1754}
1755
1756impl fidl::endpoints::Responder for BaseRuleSetRemoveRuleResponder {
1757    type ControlHandle = BaseRuleSetControlHandle;
1758
1759    fn control_handle(&self) -> &BaseRuleSetControlHandle {
1760        &self.control_handle
1761    }
1762
1763    fn drop_without_shutdown(mut self) {
1764        // Safety: drops once, never accessed again due to mem::forget
1765        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1766        // Prevent Drop from running (which would shut down the channel)
1767        std::mem::forget(self);
1768    }
1769}
1770
1771impl BaseRuleSetRemoveRuleResponder {
1772    /// Sends a response to the FIDL transaction.
1773    ///
1774    /// Sets the channel to shutdown if an error occurs.
1775    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
1776        let _result = self.send_raw(result);
1777        if _result.is_err() {
1778            self.control_handle.shutdown();
1779        }
1780        self.drop_without_shutdown();
1781        _result
1782    }
1783
1784    /// Similar to "send" but does not shutdown the channel if an error occurs.
1785    pub fn send_no_shutdown_on_err(
1786        self,
1787        mut result: Result<(), RuleSetError>,
1788    ) -> Result<(), fidl::Error> {
1789        let _result = self.send_raw(result);
1790        self.drop_without_shutdown();
1791        _result
1792    }
1793
1794    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
1795        self.control_handle.inner.send::<fidl::encoding::ResultType<
1796            fidl::encoding::EmptyStruct,
1797            RuleSetError,
1798        >>(
1799            result,
1800            self.tx_id,
1801            0x2ae3d7e817cbff90,
1802            fidl::encoding::DynamicFlags::empty(),
1803        )
1804    }
1805}
1806
1807#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1808pub struct RouteSetV4Marker;
1809
1810impl fidl::endpoints::ProtocolMarker for RouteSetV4Marker {
1811    type Proxy = RouteSetV4Proxy;
1812    type RequestStream = RouteSetV4RequestStream;
1813    #[cfg(target_os = "fuchsia")]
1814    type SynchronousProxy = RouteSetV4SynchronousProxy;
1815
1816    const DEBUG_NAME: &'static str = "(anonymous) RouteSetV4";
1817}
1818pub type RouteSetV4AuthenticateForInterfaceResult = Result<(), AuthenticateForInterfaceError>;
1819pub type RouteSetV4AddRouteResult = Result<bool, RouteSetError>;
1820pub type RouteSetV4RemoveRouteResult = Result<bool, RouteSetError>;
1821
1822pub trait RouteSetV4ProxyInterface: Send + Sync {
1823    type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error>>
1824        + Send;
1825    fn r#authenticate_for_interface(
1826        &self,
1827        credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
1828    ) -> Self::AuthenticateForInterfaceResponseFut;
1829    type AddRouteResponseFut: std::future::Future<Output = Result<RouteSetV4AddRouteResult, fidl::Error>>
1830        + Send;
1831    fn r#add_route(&self, route: &fidl_fuchsia_net_routes::RouteV4) -> Self::AddRouteResponseFut;
1832    type RemoveRouteResponseFut: std::future::Future<Output = Result<RouteSetV4RemoveRouteResult, fidl::Error>>
1833        + Send;
1834    fn r#remove_route(
1835        &self,
1836        route: &fidl_fuchsia_net_routes::RouteV4,
1837    ) -> Self::RemoveRouteResponseFut;
1838}
1839#[derive(Debug)]
1840#[cfg(target_os = "fuchsia")]
1841pub struct RouteSetV4SynchronousProxy {
1842    client: fidl::client::sync::Client,
1843}
1844
1845#[cfg(target_os = "fuchsia")]
1846impl fidl::endpoints::SynchronousProxy for RouteSetV4SynchronousProxy {
1847    type Proxy = RouteSetV4Proxy;
1848    type Protocol = RouteSetV4Marker;
1849
1850    fn from_channel(inner: fidl::Channel) -> Self {
1851        Self::new(inner)
1852    }
1853
1854    fn into_channel(self) -> fidl::Channel {
1855        self.client.into_channel()
1856    }
1857
1858    fn as_channel(&self) -> &fidl::Channel {
1859        self.client.as_channel()
1860    }
1861}
1862
1863#[cfg(target_os = "fuchsia")]
1864impl RouteSetV4SynchronousProxy {
1865    pub fn new(channel: fidl::Channel) -> Self {
1866        Self { client: fidl::client::sync::Client::new(channel) }
1867    }
1868
1869    pub fn into_channel(self) -> fidl::Channel {
1870        self.client.into_channel()
1871    }
1872
1873    /// Waits until an event arrives and returns it. It is safe for other
1874    /// threads to make concurrent requests while waiting for an event.
1875    pub fn wait_for_event(
1876        &self,
1877        deadline: zx::MonotonicInstant,
1878    ) -> Result<RouteSetV4Event, fidl::Error> {
1879        RouteSetV4Event::decode(self.client.wait_for_event::<RouteSetV4Marker>(deadline)?)
1880    }
1881
1882    /// Authenticate this route set to manage routes on the provided interface.
1883    /// Authentication is valid for the lifetime of the route set.
1884    ///
1885    /// + request `interface` the authentication credential for an interface.
1886    pub fn r#authenticate_for_interface(
1887        &self,
1888        mut credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
1889        ___deadline: zx::MonotonicInstant,
1890    ) -> Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error> {
1891        let _response = self
1892            .client
1893            .send_query::<RouteSetV4AuthenticateForInterfaceRequest, fidl::encoding::ResultType<
1894                fidl::encoding::EmptyStruct,
1895                AuthenticateForInterfaceError,
1896            >, RouteSetV4Marker>(
1897                (&mut credential,),
1898                0x74841ceef127518e,
1899                fidl::encoding::DynamicFlags::empty(),
1900                ___deadline,
1901            )?;
1902        Ok(_response.map(|x| x))
1903    }
1904
1905    /// Adds a route to this route set.
1906    ///
1907    /// + request `route` the route to add.
1908    /// - response `did_add` true iff the route was added to this `RouteSet`
1909    ///            as a result of this call.
1910    pub fn r#add_route(
1911        &self,
1912        mut route: &fidl_fuchsia_net_routes::RouteV4,
1913        ___deadline: zx::MonotonicInstant,
1914    ) -> Result<RouteSetV4AddRouteResult, fidl::Error> {
1915        let _response = self.client.send_query::<
1916            RouteSetV4AddRouteRequest,
1917            fidl::encoding::ResultType<RouteSetV4AddRouteResponse, RouteSetError>,
1918            RouteSetV4Marker,
1919        >(
1920            (route,),
1921            0x4bd69e45539e8ec0,
1922            fidl::encoding::DynamicFlags::empty(),
1923            ___deadline,
1924        )?;
1925        Ok(_response.map(|x| x.did_add))
1926    }
1927
1928    /// Removes a route from this route set.
1929    ///
1930    /// Note that if this route also exists other route sets, it will not be
1931    /// removed from the global routing table.
1932    ///
1933    /// + request `route` the route to remove.
1934    /// - response `did_remove` true iff the route was removed from this
1935    ///            `RouteSet` as a result of this call.
1936    pub fn r#remove_route(
1937        &self,
1938        mut route: &fidl_fuchsia_net_routes::RouteV4,
1939        ___deadline: zx::MonotonicInstant,
1940    ) -> Result<RouteSetV4RemoveRouteResult, fidl::Error> {
1941        let _response = self.client.send_query::<
1942            RouteSetV4RemoveRouteRequest,
1943            fidl::encoding::ResultType<RouteSetV4RemoveRouteResponse, RouteSetError>,
1944            RouteSetV4Marker,
1945        >(
1946            (route,),
1947            0x514f6880232f1665,
1948            fidl::encoding::DynamicFlags::empty(),
1949            ___deadline,
1950        )?;
1951        Ok(_response.map(|x| x.did_remove))
1952    }
1953}
1954
1955#[cfg(target_os = "fuchsia")]
1956impl From<RouteSetV4SynchronousProxy> for zx::NullableHandle {
1957    fn from(value: RouteSetV4SynchronousProxy) -> Self {
1958        value.into_channel().into()
1959    }
1960}
1961
1962#[cfg(target_os = "fuchsia")]
1963impl From<fidl::Channel> for RouteSetV4SynchronousProxy {
1964    fn from(value: fidl::Channel) -> Self {
1965        Self::new(value)
1966    }
1967}
1968
1969#[cfg(target_os = "fuchsia")]
1970impl fidl::endpoints::FromClient for RouteSetV4SynchronousProxy {
1971    type Protocol = RouteSetV4Marker;
1972
1973    fn from_client(value: fidl::endpoints::ClientEnd<RouteSetV4Marker>) -> Self {
1974        Self::new(value.into_channel())
1975    }
1976}
1977
1978#[derive(Debug, Clone)]
1979pub struct RouteSetV4Proxy {
1980    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1981}
1982
1983impl fidl::endpoints::Proxy for RouteSetV4Proxy {
1984    type Protocol = RouteSetV4Marker;
1985
1986    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1987        Self::new(inner)
1988    }
1989
1990    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1991        self.client.into_channel().map_err(|client| Self { client })
1992    }
1993
1994    fn as_channel(&self) -> &::fidl::AsyncChannel {
1995        self.client.as_channel()
1996    }
1997}
1998
1999impl RouteSetV4Proxy {
2000    /// Create a new Proxy for fuchsia.net.routes.admin/RouteSetV4.
2001    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2002        let protocol_name = <RouteSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2003        Self { client: fidl::client::Client::new(channel, protocol_name) }
2004    }
2005
2006    /// Get a Stream of events from the remote end of the protocol.
2007    ///
2008    /// # Panics
2009    ///
2010    /// Panics if the event stream was already taken.
2011    pub fn take_event_stream(&self) -> RouteSetV4EventStream {
2012        RouteSetV4EventStream { event_receiver: self.client.take_event_receiver() }
2013    }
2014
2015    /// Authenticate this route set to manage routes on the provided interface.
2016    /// Authentication is valid for the lifetime of the route set.
2017    ///
2018    /// + request `interface` the authentication credential for an interface.
2019    pub fn r#authenticate_for_interface(
2020        &self,
2021        mut credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2022    ) -> fidl::client::QueryResponseFut<
2023        RouteSetV4AuthenticateForInterfaceResult,
2024        fidl::encoding::DefaultFuchsiaResourceDialect,
2025    > {
2026        RouteSetV4ProxyInterface::r#authenticate_for_interface(self, credential)
2027    }
2028
2029    /// Adds a route to this route set.
2030    ///
2031    /// + request `route` the route to add.
2032    /// - response `did_add` true iff the route was added to this `RouteSet`
2033    ///            as a result of this call.
2034    pub fn r#add_route(
2035        &self,
2036        mut route: &fidl_fuchsia_net_routes::RouteV4,
2037    ) -> fidl::client::QueryResponseFut<
2038        RouteSetV4AddRouteResult,
2039        fidl::encoding::DefaultFuchsiaResourceDialect,
2040    > {
2041        RouteSetV4ProxyInterface::r#add_route(self, route)
2042    }
2043
2044    /// Removes a route from this route set.
2045    ///
2046    /// Note that if this route also exists other route sets, it will not be
2047    /// removed from the global routing table.
2048    ///
2049    /// + request `route` the route to remove.
2050    /// - response `did_remove` true iff the route was removed from this
2051    ///            `RouteSet` as a result of this call.
2052    pub fn r#remove_route(
2053        &self,
2054        mut route: &fidl_fuchsia_net_routes::RouteV4,
2055    ) -> fidl::client::QueryResponseFut<
2056        RouteSetV4RemoveRouteResult,
2057        fidl::encoding::DefaultFuchsiaResourceDialect,
2058    > {
2059        RouteSetV4ProxyInterface::r#remove_route(self, route)
2060    }
2061}
2062
2063impl RouteSetV4ProxyInterface for RouteSetV4Proxy {
2064    type AuthenticateForInterfaceResponseFut = fidl::client::QueryResponseFut<
2065        RouteSetV4AuthenticateForInterfaceResult,
2066        fidl::encoding::DefaultFuchsiaResourceDialect,
2067    >;
2068    fn r#authenticate_for_interface(
2069        &self,
2070        mut credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2071    ) -> Self::AuthenticateForInterfaceResponseFut {
2072        fn _decode(
2073            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2074        ) -> Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error> {
2075            let _response = fidl::client::decode_transaction_body::<
2076                fidl::encoding::ResultType<
2077                    fidl::encoding::EmptyStruct,
2078                    AuthenticateForInterfaceError,
2079                >,
2080                fidl::encoding::DefaultFuchsiaResourceDialect,
2081                0x74841ceef127518e,
2082            >(_buf?)?;
2083            Ok(_response.map(|x| x))
2084        }
2085        self.client.send_query_and_decode::<
2086            RouteSetV4AuthenticateForInterfaceRequest,
2087            RouteSetV4AuthenticateForInterfaceResult,
2088        >(
2089            (&mut credential,),
2090            0x74841ceef127518e,
2091            fidl::encoding::DynamicFlags::empty(),
2092            _decode,
2093        )
2094    }
2095
2096    type AddRouteResponseFut = fidl::client::QueryResponseFut<
2097        RouteSetV4AddRouteResult,
2098        fidl::encoding::DefaultFuchsiaResourceDialect,
2099    >;
2100    fn r#add_route(
2101        &self,
2102        mut route: &fidl_fuchsia_net_routes::RouteV4,
2103    ) -> Self::AddRouteResponseFut {
2104        fn _decode(
2105            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2106        ) -> Result<RouteSetV4AddRouteResult, fidl::Error> {
2107            let _response = fidl::client::decode_transaction_body::<
2108                fidl::encoding::ResultType<RouteSetV4AddRouteResponse, RouteSetError>,
2109                fidl::encoding::DefaultFuchsiaResourceDialect,
2110                0x4bd69e45539e8ec0,
2111            >(_buf?)?;
2112            Ok(_response.map(|x| x.did_add))
2113        }
2114        self.client.send_query_and_decode::<RouteSetV4AddRouteRequest, RouteSetV4AddRouteResult>(
2115            (route,),
2116            0x4bd69e45539e8ec0,
2117            fidl::encoding::DynamicFlags::empty(),
2118            _decode,
2119        )
2120    }
2121
2122    type RemoveRouteResponseFut = fidl::client::QueryResponseFut<
2123        RouteSetV4RemoveRouteResult,
2124        fidl::encoding::DefaultFuchsiaResourceDialect,
2125    >;
2126    fn r#remove_route(
2127        &self,
2128        mut route: &fidl_fuchsia_net_routes::RouteV4,
2129    ) -> Self::RemoveRouteResponseFut {
2130        fn _decode(
2131            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2132        ) -> Result<RouteSetV4RemoveRouteResult, fidl::Error> {
2133            let _response = fidl::client::decode_transaction_body::<
2134                fidl::encoding::ResultType<RouteSetV4RemoveRouteResponse, RouteSetError>,
2135                fidl::encoding::DefaultFuchsiaResourceDialect,
2136                0x514f6880232f1665,
2137            >(_buf?)?;
2138            Ok(_response.map(|x| x.did_remove))
2139        }
2140        self.client
2141            .send_query_and_decode::<RouteSetV4RemoveRouteRequest, RouteSetV4RemoveRouteResult>(
2142                (route,),
2143                0x514f6880232f1665,
2144                fidl::encoding::DynamicFlags::empty(),
2145                _decode,
2146            )
2147    }
2148}
2149
2150pub struct RouteSetV4EventStream {
2151    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2152}
2153
2154impl std::marker::Unpin for RouteSetV4EventStream {}
2155
2156impl futures::stream::FusedStream for RouteSetV4EventStream {
2157    fn is_terminated(&self) -> bool {
2158        self.event_receiver.is_terminated()
2159    }
2160}
2161
2162impl futures::Stream for RouteSetV4EventStream {
2163    type Item = Result<RouteSetV4Event, fidl::Error>;
2164
2165    fn poll_next(
2166        mut self: std::pin::Pin<&mut Self>,
2167        cx: &mut std::task::Context<'_>,
2168    ) -> std::task::Poll<Option<Self::Item>> {
2169        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2170            &mut self.event_receiver,
2171            cx
2172        )?) {
2173            Some(buf) => std::task::Poll::Ready(Some(RouteSetV4Event::decode(buf))),
2174            None => std::task::Poll::Ready(None),
2175        }
2176    }
2177}
2178
2179#[derive(Debug)]
2180pub enum RouteSetV4Event {}
2181
2182impl RouteSetV4Event {
2183    /// Decodes a message buffer as a [`RouteSetV4Event`].
2184    fn decode(
2185        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2186    ) -> Result<RouteSetV4Event, fidl::Error> {
2187        let (bytes, _handles) = buf.split_mut();
2188        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2189        debug_assert_eq!(tx_header.tx_id, 0);
2190        match tx_header.ordinal {
2191            _ => Err(fidl::Error::UnknownOrdinal {
2192                ordinal: tx_header.ordinal,
2193                protocol_name: <RouteSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2194            }),
2195        }
2196    }
2197}
2198
2199/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteSetV4.
2200pub struct RouteSetV4RequestStream {
2201    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2202    is_terminated: bool,
2203}
2204
2205impl std::marker::Unpin for RouteSetV4RequestStream {}
2206
2207impl futures::stream::FusedStream for RouteSetV4RequestStream {
2208    fn is_terminated(&self) -> bool {
2209        self.is_terminated
2210    }
2211}
2212
2213impl fidl::endpoints::RequestStream for RouteSetV4RequestStream {
2214    type Protocol = RouteSetV4Marker;
2215    type ControlHandle = RouteSetV4ControlHandle;
2216
2217    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2218        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2219    }
2220
2221    fn control_handle(&self) -> Self::ControlHandle {
2222        RouteSetV4ControlHandle { inner: self.inner.clone() }
2223    }
2224
2225    fn into_inner(
2226        self,
2227    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2228    {
2229        (self.inner, self.is_terminated)
2230    }
2231
2232    fn from_inner(
2233        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2234        is_terminated: bool,
2235    ) -> Self {
2236        Self { inner, is_terminated }
2237    }
2238}
2239
2240impl futures::Stream for RouteSetV4RequestStream {
2241    type Item = Result<RouteSetV4Request, fidl::Error>;
2242
2243    fn poll_next(
2244        mut self: std::pin::Pin<&mut Self>,
2245        cx: &mut std::task::Context<'_>,
2246    ) -> std::task::Poll<Option<Self::Item>> {
2247        let this = &mut *self;
2248        if this.inner.check_shutdown(cx) {
2249            this.is_terminated = true;
2250            return std::task::Poll::Ready(None);
2251        }
2252        if this.is_terminated {
2253            panic!("polled RouteSetV4RequestStream after completion");
2254        }
2255        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2256            |bytes, handles| {
2257                match this.inner.channel().read_etc(cx, bytes, handles) {
2258                    std::task::Poll::Ready(Ok(())) => {}
2259                    std::task::Poll::Pending => return std::task::Poll::Pending,
2260                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2261                        this.is_terminated = true;
2262                        return std::task::Poll::Ready(None);
2263                    }
2264                    std::task::Poll::Ready(Err(e)) => {
2265                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2266                            e.into(),
2267                        ))));
2268                    }
2269                }
2270
2271                // A message has been received from the channel
2272                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2273
2274                std::task::Poll::Ready(Some(match header.ordinal {
2275                    0x74841ceef127518e => {
2276                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2277                        let mut req = fidl::new_empty!(
2278                            RouteSetV4AuthenticateForInterfaceRequest,
2279                            fidl::encoding::DefaultFuchsiaResourceDialect
2280                        );
2281                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteSetV4AuthenticateForInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
2282                        let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
2283                        Ok(RouteSetV4Request::AuthenticateForInterface {
2284                            credential: req.credential,
2285
2286                            responder: RouteSetV4AuthenticateForInterfaceResponder {
2287                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2288                                tx_id: header.tx_id,
2289                            },
2290                        })
2291                    }
2292                    0x4bd69e45539e8ec0 => {
2293                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2294                        let mut req = fidl::new_empty!(
2295                            RouteSetV4AddRouteRequest,
2296                            fidl::encoding::DefaultFuchsiaResourceDialect
2297                        );
2298                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteSetV4AddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
2299                        let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
2300                        Ok(RouteSetV4Request::AddRoute {
2301                            route: req.route,
2302
2303                            responder: RouteSetV4AddRouteResponder {
2304                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2305                                tx_id: header.tx_id,
2306                            },
2307                        })
2308                    }
2309                    0x514f6880232f1665 => {
2310                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2311                        let mut req = fidl::new_empty!(
2312                            RouteSetV4RemoveRouteRequest,
2313                            fidl::encoding::DefaultFuchsiaResourceDialect
2314                        );
2315                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteSetV4RemoveRouteRequest>(&header, _body_bytes, handles, &mut req)?;
2316                        let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
2317                        Ok(RouteSetV4Request::RemoveRoute {
2318                            route: req.route,
2319
2320                            responder: RouteSetV4RemoveRouteResponder {
2321                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2322                                tx_id: header.tx_id,
2323                            },
2324                        })
2325                    }
2326                    _ => Err(fidl::Error::UnknownOrdinal {
2327                        ordinal: header.ordinal,
2328                        protocol_name:
2329                            <RouteSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2330                    }),
2331                }))
2332            },
2333        )
2334    }
2335}
2336
2337/// Provides mutable access over a set of system's IPv4 routes.
2338///
2339/// The system maintains a single global routing table. A route set offers an
2340/// isolated window into a subset of the global routing table: clients are free
2341/// to manage the routes within their own route set, but not the route set of
2342/// others. Thus the global routing table represents the union of all existing
2343/// route sets. A route must be removed from all route sets to which it belongs
2344/// before it will be removed from the global table.
2345///
2346/// This protocol encodes the lifetime of the route set. Closing the client end
2347/// removes the route set, and will also remove any routes that were
2348/// solely-owned by this route set.
2349///
2350/// Note that the system reserves the right to remove routes out from underneath
2351/// this route set. This will always manifest as a `removed` event on the
2352/// [`fuchsia.net.routes/WatcherV4`] protocol.
2353///
2354/// If the route table backing this route set is removed, then this protocol
2355/// will be closed with a `ZX_ERR_UNAVAILABLE` epitaph.
2356#[derive(Debug)]
2357pub enum RouteSetV4Request {
2358    /// Authenticate this route set to manage routes on the provided interface.
2359    /// Authentication is valid for the lifetime of the route set.
2360    ///
2361    /// + request `interface` the authentication credential for an interface.
2362    AuthenticateForInterface {
2363        credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2364        responder: RouteSetV4AuthenticateForInterfaceResponder,
2365    },
2366    /// Adds a route to this route set.
2367    ///
2368    /// + request `route` the route to add.
2369    /// - response `did_add` true iff the route was added to this `RouteSet`
2370    ///            as a result of this call.
2371    AddRoute { route: fidl_fuchsia_net_routes::RouteV4, responder: RouteSetV4AddRouteResponder },
2372    /// Removes a route from this route set.
2373    ///
2374    /// Note that if this route also exists other route sets, it will not be
2375    /// removed from the global routing table.
2376    ///
2377    /// + request `route` the route to remove.
2378    /// - response `did_remove` true iff the route was removed from this
2379    ///            `RouteSet` as a result of this call.
2380    RemoveRoute {
2381        route: fidl_fuchsia_net_routes::RouteV4,
2382        responder: RouteSetV4RemoveRouteResponder,
2383    },
2384}
2385
2386impl RouteSetV4Request {
2387    #[allow(irrefutable_let_patterns)]
2388    pub fn into_authenticate_for_interface(
2389        self,
2390    ) -> Option<(
2391        fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2392        RouteSetV4AuthenticateForInterfaceResponder,
2393    )> {
2394        if let RouteSetV4Request::AuthenticateForInterface { credential, responder } = self {
2395            Some((credential, responder))
2396        } else {
2397            None
2398        }
2399    }
2400
2401    #[allow(irrefutable_let_patterns)]
2402    pub fn into_add_route(
2403        self,
2404    ) -> Option<(fidl_fuchsia_net_routes::RouteV4, RouteSetV4AddRouteResponder)> {
2405        if let RouteSetV4Request::AddRoute { route, responder } = self {
2406            Some((route, responder))
2407        } else {
2408            None
2409        }
2410    }
2411
2412    #[allow(irrefutable_let_patterns)]
2413    pub fn into_remove_route(
2414        self,
2415    ) -> Option<(fidl_fuchsia_net_routes::RouteV4, RouteSetV4RemoveRouteResponder)> {
2416        if let RouteSetV4Request::RemoveRoute { route, responder } = self {
2417            Some((route, responder))
2418        } else {
2419            None
2420        }
2421    }
2422
2423    /// Name of the method defined in FIDL
2424    pub fn method_name(&self) -> &'static str {
2425        match *self {
2426            RouteSetV4Request::AuthenticateForInterface { .. } => "authenticate_for_interface",
2427            RouteSetV4Request::AddRoute { .. } => "add_route",
2428            RouteSetV4Request::RemoveRoute { .. } => "remove_route",
2429        }
2430    }
2431}
2432
2433#[derive(Debug, Clone)]
2434pub struct RouteSetV4ControlHandle {
2435    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2436}
2437
2438impl RouteSetV4ControlHandle {
2439    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2440        self.inner.shutdown_with_epitaph(status.into())
2441    }
2442}
2443
2444impl fidl::endpoints::ControlHandle for RouteSetV4ControlHandle {
2445    fn shutdown(&self) {
2446        self.inner.shutdown()
2447    }
2448
2449    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2450        self.inner.shutdown_with_epitaph(status)
2451    }
2452
2453    fn is_closed(&self) -> bool {
2454        self.inner.channel().is_closed()
2455    }
2456    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2457        self.inner.channel().on_closed()
2458    }
2459
2460    #[cfg(target_os = "fuchsia")]
2461    fn signal_peer(
2462        &self,
2463        clear_mask: zx::Signals,
2464        set_mask: zx::Signals,
2465    ) -> Result<(), zx_status::Status> {
2466        use fidl::Peered;
2467        self.inner.channel().signal_peer(clear_mask, set_mask)
2468    }
2469}
2470
2471impl RouteSetV4ControlHandle {}
2472
2473#[must_use = "FIDL methods require a response to be sent"]
2474#[derive(Debug)]
2475pub struct RouteSetV4AuthenticateForInterfaceResponder {
2476    control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
2477    tx_id: u32,
2478}
2479
2480/// Set the the channel to be shutdown (see [`RouteSetV4ControlHandle::shutdown`])
2481/// if the responder is dropped without sending a response, so that the client
2482/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2483impl std::ops::Drop for RouteSetV4AuthenticateForInterfaceResponder {
2484    fn drop(&mut self) {
2485        self.control_handle.shutdown();
2486        // Safety: drops once, never accessed again
2487        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2488    }
2489}
2490
2491impl fidl::endpoints::Responder for RouteSetV4AuthenticateForInterfaceResponder {
2492    type ControlHandle = RouteSetV4ControlHandle;
2493
2494    fn control_handle(&self) -> &RouteSetV4ControlHandle {
2495        &self.control_handle
2496    }
2497
2498    fn drop_without_shutdown(mut self) {
2499        // Safety: drops once, never accessed again due to mem::forget
2500        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2501        // Prevent Drop from running (which would shut down the channel)
2502        std::mem::forget(self);
2503    }
2504}
2505
2506impl RouteSetV4AuthenticateForInterfaceResponder {
2507    /// Sends a response to the FIDL transaction.
2508    ///
2509    /// Sets the channel to shutdown if an error occurs.
2510    pub fn send(
2511        self,
2512        mut result: Result<(), AuthenticateForInterfaceError>,
2513    ) -> Result<(), fidl::Error> {
2514        let _result = self.send_raw(result);
2515        if _result.is_err() {
2516            self.control_handle.shutdown();
2517        }
2518        self.drop_without_shutdown();
2519        _result
2520    }
2521
2522    /// Similar to "send" but does not shutdown the channel if an error occurs.
2523    pub fn send_no_shutdown_on_err(
2524        self,
2525        mut result: Result<(), AuthenticateForInterfaceError>,
2526    ) -> Result<(), fidl::Error> {
2527        let _result = self.send_raw(result);
2528        self.drop_without_shutdown();
2529        _result
2530    }
2531
2532    fn send_raw(
2533        &self,
2534        mut result: Result<(), AuthenticateForInterfaceError>,
2535    ) -> Result<(), fidl::Error> {
2536        self.control_handle.inner.send::<fidl::encoding::ResultType<
2537            fidl::encoding::EmptyStruct,
2538            AuthenticateForInterfaceError,
2539        >>(
2540            result,
2541            self.tx_id,
2542            0x74841ceef127518e,
2543            fidl::encoding::DynamicFlags::empty(),
2544        )
2545    }
2546}
2547
2548#[must_use = "FIDL methods require a response to be sent"]
2549#[derive(Debug)]
2550pub struct RouteSetV4AddRouteResponder {
2551    control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
2552    tx_id: u32,
2553}
2554
2555/// Set the the channel to be shutdown (see [`RouteSetV4ControlHandle::shutdown`])
2556/// if the responder is dropped without sending a response, so that the client
2557/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2558impl std::ops::Drop for RouteSetV4AddRouteResponder {
2559    fn drop(&mut self) {
2560        self.control_handle.shutdown();
2561        // Safety: drops once, never accessed again
2562        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2563    }
2564}
2565
2566impl fidl::endpoints::Responder for RouteSetV4AddRouteResponder {
2567    type ControlHandle = RouteSetV4ControlHandle;
2568
2569    fn control_handle(&self) -> &RouteSetV4ControlHandle {
2570        &self.control_handle
2571    }
2572
2573    fn drop_without_shutdown(mut self) {
2574        // Safety: drops once, never accessed again due to mem::forget
2575        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2576        // Prevent Drop from running (which would shut down the channel)
2577        std::mem::forget(self);
2578    }
2579}
2580
2581impl RouteSetV4AddRouteResponder {
2582    /// Sends a response to the FIDL transaction.
2583    ///
2584    /// Sets the channel to shutdown if an error occurs.
2585    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2586        let _result = self.send_raw(result);
2587        if _result.is_err() {
2588            self.control_handle.shutdown();
2589        }
2590        self.drop_without_shutdown();
2591        _result
2592    }
2593
2594    /// Similar to "send" but does not shutdown the channel if an error occurs.
2595    pub fn send_no_shutdown_on_err(
2596        self,
2597        mut result: Result<bool, RouteSetError>,
2598    ) -> Result<(), fidl::Error> {
2599        let _result = self.send_raw(result);
2600        self.drop_without_shutdown();
2601        _result
2602    }
2603
2604    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2605        self.control_handle.inner.send::<fidl::encoding::ResultType<
2606            RouteSetV4AddRouteResponse,
2607            RouteSetError,
2608        >>(
2609            result.map(|did_add| (did_add,)),
2610            self.tx_id,
2611            0x4bd69e45539e8ec0,
2612            fidl::encoding::DynamicFlags::empty(),
2613        )
2614    }
2615}
2616
2617#[must_use = "FIDL methods require a response to be sent"]
2618#[derive(Debug)]
2619pub struct RouteSetV4RemoveRouteResponder {
2620    control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
2621    tx_id: u32,
2622}
2623
2624/// Set the the channel to be shutdown (see [`RouteSetV4ControlHandle::shutdown`])
2625/// if the responder is dropped without sending a response, so that the client
2626/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2627impl std::ops::Drop for RouteSetV4RemoveRouteResponder {
2628    fn drop(&mut self) {
2629        self.control_handle.shutdown();
2630        // Safety: drops once, never accessed again
2631        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2632    }
2633}
2634
2635impl fidl::endpoints::Responder for RouteSetV4RemoveRouteResponder {
2636    type ControlHandle = RouteSetV4ControlHandle;
2637
2638    fn control_handle(&self) -> &RouteSetV4ControlHandle {
2639        &self.control_handle
2640    }
2641
2642    fn drop_without_shutdown(mut self) {
2643        // Safety: drops once, never accessed again due to mem::forget
2644        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2645        // Prevent Drop from running (which would shut down the channel)
2646        std::mem::forget(self);
2647    }
2648}
2649
2650impl RouteSetV4RemoveRouteResponder {
2651    /// Sends a response to the FIDL transaction.
2652    ///
2653    /// Sets the channel to shutdown if an error occurs.
2654    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2655        let _result = self.send_raw(result);
2656        if _result.is_err() {
2657            self.control_handle.shutdown();
2658        }
2659        self.drop_without_shutdown();
2660        _result
2661    }
2662
2663    /// Similar to "send" but does not shutdown the channel if an error occurs.
2664    pub fn send_no_shutdown_on_err(
2665        self,
2666        mut result: Result<bool, RouteSetError>,
2667    ) -> Result<(), fidl::Error> {
2668        let _result = self.send_raw(result);
2669        self.drop_without_shutdown();
2670        _result
2671    }
2672
2673    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2674        self.control_handle.inner.send::<fidl::encoding::ResultType<
2675            RouteSetV4RemoveRouteResponse,
2676            RouteSetError,
2677        >>(
2678            result.map(|did_remove| (did_remove,)),
2679            self.tx_id,
2680            0x514f6880232f1665,
2681            fidl::encoding::DynamicFlags::empty(),
2682        )
2683    }
2684}
2685
2686#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2687pub struct RouteSetV6Marker;
2688
2689impl fidl::endpoints::ProtocolMarker for RouteSetV6Marker {
2690    type Proxy = RouteSetV6Proxy;
2691    type RequestStream = RouteSetV6RequestStream;
2692    #[cfg(target_os = "fuchsia")]
2693    type SynchronousProxy = RouteSetV6SynchronousProxy;
2694
2695    const DEBUG_NAME: &'static str = "(anonymous) RouteSetV6";
2696}
2697pub type RouteSetV6AuthenticateForInterfaceResult = Result<(), AuthenticateForInterfaceError>;
2698pub type RouteSetV6AddRouteResult = Result<bool, RouteSetError>;
2699pub type RouteSetV6RemoveRouteResult = Result<bool, RouteSetError>;
2700
2701pub trait RouteSetV6ProxyInterface: Send + Sync {
2702    type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error>>
2703        + Send;
2704    fn r#authenticate_for_interface(
2705        &self,
2706        credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2707    ) -> Self::AuthenticateForInterfaceResponseFut;
2708    type AddRouteResponseFut: std::future::Future<Output = Result<RouteSetV6AddRouteResult, fidl::Error>>
2709        + Send;
2710    fn r#add_route(&self, route: &fidl_fuchsia_net_routes::RouteV6) -> Self::AddRouteResponseFut;
2711    type RemoveRouteResponseFut: std::future::Future<Output = Result<RouteSetV6RemoveRouteResult, fidl::Error>>
2712        + Send;
2713    fn r#remove_route(
2714        &self,
2715        route: &fidl_fuchsia_net_routes::RouteV6,
2716    ) -> Self::RemoveRouteResponseFut;
2717}
2718#[derive(Debug)]
2719#[cfg(target_os = "fuchsia")]
2720pub struct RouteSetV6SynchronousProxy {
2721    client: fidl::client::sync::Client,
2722}
2723
2724#[cfg(target_os = "fuchsia")]
2725impl fidl::endpoints::SynchronousProxy for RouteSetV6SynchronousProxy {
2726    type Proxy = RouteSetV6Proxy;
2727    type Protocol = RouteSetV6Marker;
2728
2729    fn from_channel(inner: fidl::Channel) -> Self {
2730        Self::new(inner)
2731    }
2732
2733    fn into_channel(self) -> fidl::Channel {
2734        self.client.into_channel()
2735    }
2736
2737    fn as_channel(&self) -> &fidl::Channel {
2738        self.client.as_channel()
2739    }
2740}
2741
2742#[cfg(target_os = "fuchsia")]
2743impl RouteSetV6SynchronousProxy {
2744    pub fn new(channel: fidl::Channel) -> Self {
2745        Self { client: fidl::client::sync::Client::new(channel) }
2746    }
2747
2748    pub fn into_channel(self) -> fidl::Channel {
2749        self.client.into_channel()
2750    }
2751
2752    /// Waits until an event arrives and returns it. It is safe for other
2753    /// threads to make concurrent requests while waiting for an event.
2754    pub fn wait_for_event(
2755        &self,
2756        deadline: zx::MonotonicInstant,
2757    ) -> Result<RouteSetV6Event, fidl::Error> {
2758        RouteSetV6Event::decode(self.client.wait_for_event::<RouteSetV6Marker>(deadline)?)
2759    }
2760
2761    /// Authenticate this route set to manage routes on the provided interface.
2762    /// Authentication is valid for the lifetime of the route set.
2763    ///
2764    /// + request `interface` the authentication credential for an interface.
2765    pub fn r#authenticate_for_interface(
2766        &self,
2767        mut credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2768        ___deadline: zx::MonotonicInstant,
2769    ) -> Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error> {
2770        let _response = self
2771            .client
2772            .send_query::<RouteSetV6AuthenticateForInterfaceRequest, fidl::encoding::ResultType<
2773                fidl::encoding::EmptyStruct,
2774                AuthenticateForInterfaceError,
2775            >, RouteSetV6Marker>(
2776                (&mut credential,),
2777                0x7d63a6a7aed6f640,
2778                fidl::encoding::DynamicFlags::empty(),
2779                ___deadline,
2780            )?;
2781        Ok(_response.map(|x| x))
2782    }
2783
2784    /// Adds a route to this route set.
2785    ///
2786    /// + request `route` the route to add.
2787    /// - response `did_add` true iff the route was added to this `RouteSet`
2788    ///            as a result of this call.
2789    pub fn r#add_route(
2790        &self,
2791        mut route: &fidl_fuchsia_net_routes::RouteV6,
2792        ___deadline: zx::MonotonicInstant,
2793    ) -> Result<RouteSetV6AddRouteResult, fidl::Error> {
2794        let _response = self.client.send_query::<
2795            RouteSetV6AddRouteRequest,
2796            fidl::encoding::ResultType<RouteSetV6AddRouteResponse, RouteSetError>,
2797            RouteSetV6Marker,
2798        >(
2799            (route,),
2800            0x67a2bd2ee34ace2e,
2801            fidl::encoding::DynamicFlags::empty(),
2802            ___deadline,
2803        )?;
2804        Ok(_response.map(|x| x.did_add))
2805    }
2806
2807    /// Removes a route from this route set.
2808    ///
2809    /// Note that if this route also exists other route sets, it will not be
2810    /// removed from the global routing table.
2811    ///
2812    /// + request `route` the route to remove.
2813    /// - response `did_remove` true iff the route was removed from this
2814    ///            `RouteSet` as a result of this call.
2815    pub fn r#remove_route(
2816        &self,
2817        mut route: &fidl_fuchsia_net_routes::RouteV6,
2818        ___deadline: zx::MonotonicInstant,
2819    ) -> Result<RouteSetV6RemoveRouteResult, fidl::Error> {
2820        let _response = self.client.send_query::<
2821            RouteSetV6RemoveRouteRequest,
2822            fidl::encoding::ResultType<RouteSetV6RemoveRouteResponse, RouteSetError>,
2823            RouteSetV6Marker,
2824        >(
2825            (route,),
2826            0x4e5b7d4b1112cd82,
2827            fidl::encoding::DynamicFlags::empty(),
2828            ___deadline,
2829        )?;
2830        Ok(_response.map(|x| x.did_remove))
2831    }
2832}
2833
2834#[cfg(target_os = "fuchsia")]
2835impl From<RouteSetV6SynchronousProxy> for zx::NullableHandle {
2836    fn from(value: RouteSetV6SynchronousProxy) -> Self {
2837        value.into_channel().into()
2838    }
2839}
2840
2841#[cfg(target_os = "fuchsia")]
2842impl From<fidl::Channel> for RouteSetV6SynchronousProxy {
2843    fn from(value: fidl::Channel) -> Self {
2844        Self::new(value)
2845    }
2846}
2847
2848#[cfg(target_os = "fuchsia")]
2849impl fidl::endpoints::FromClient for RouteSetV6SynchronousProxy {
2850    type Protocol = RouteSetV6Marker;
2851
2852    fn from_client(value: fidl::endpoints::ClientEnd<RouteSetV6Marker>) -> Self {
2853        Self::new(value.into_channel())
2854    }
2855}
2856
2857#[derive(Debug, Clone)]
2858pub struct RouteSetV6Proxy {
2859    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2860}
2861
2862impl fidl::endpoints::Proxy for RouteSetV6Proxy {
2863    type Protocol = RouteSetV6Marker;
2864
2865    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2866        Self::new(inner)
2867    }
2868
2869    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2870        self.client.into_channel().map_err(|client| Self { client })
2871    }
2872
2873    fn as_channel(&self) -> &::fidl::AsyncChannel {
2874        self.client.as_channel()
2875    }
2876}
2877
2878impl RouteSetV6Proxy {
2879    /// Create a new Proxy for fuchsia.net.routes.admin/RouteSetV6.
2880    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2881        let protocol_name = <RouteSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2882        Self { client: fidl::client::Client::new(channel, protocol_name) }
2883    }
2884
2885    /// Get a Stream of events from the remote end of the protocol.
2886    ///
2887    /// # Panics
2888    ///
2889    /// Panics if the event stream was already taken.
2890    pub fn take_event_stream(&self) -> RouteSetV6EventStream {
2891        RouteSetV6EventStream { event_receiver: self.client.take_event_receiver() }
2892    }
2893
2894    /// Authenticate this route set to manage routes on the provided interface.
2895    /// Authentication is valid for the lifetime of the route set.
2896    ///
2897    /// + request `interface` the authentication credential for an interface.
2898    pub fn r#authenticate_for_interface(
2899        &self,
2900        mut credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2901    ) -> fidl::client::QueryResponseFut<
2902        RouteSetV6AuthenticateForInterfaceResult,
2903        fidl::encoding::DefaultFuchsiaResourceDialect,
2904    > {
2905        RouteSetV6ProxyInterface::r#authenticate_for_interface(self, credential)
2906    }
2907
2908    /// Adds a route to this route set.
2909    ///
2910    /// + request `route` the route to add.
2911    /// - response `did_add` true iff the route was added to this `RouteSet`
2912    ///            as a result of this call.
2913    pub fn r#add_route(
2914        &self,
2915        mut route: &fidl_fuchsia_net_routes::RouteV6,
2916    ) -> fidl::client::QueryResponseFut<
2917        RouteSetV6AddRouteResult,
2918        fidl::encoding::DefaultFuchsiaResourceDialect,
2919    > {
2920        RouteSetV6ProxyInterface::r#add_route(self, route)
2921    }
2922
2923    /// Removes a route from this route set.
2924    ///
2925    /// Note that if this route also exists other route sets, it will not be
2926    /// removed from the global routing table.
2927    ///
2928    /// + request `route` the route to remove.
2929    /// - response `did_remove` true iff the route was removed from this
2930    ///            `RouteSet` as a result of this call.
2931    pub fn r#remove_route(
2932        &self,
2933        mut route: &fidl_fuchsia_net_routes::RouteV6,
2934    ) -> fidl::client::QueryResponseFut<
2935        RouteSetV6RemoveRouteResult,
2936        fidl::encoding::DefaultFuchsiaResourceDialect,
2937    > {
2938        RouteSetV6ProxyInterface::r#remove_route(self, route)
2939    }
2940}
2941
2942impl RouteSetV6ProxyInterface for RouteSetV6Proxy {
2943    type AuthenticateForInterfaceResponseFut = fidl::client::QueryResponseFut<
2944        RouteSetV6AuthenticateForInterfaceResult,
2945        fidl::encoding::DefaultFuchsiaResourceDialect,
2946    >;
2947    fn r#authenticate_for_interface(
2948        &self,
2949        mut credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2950    ) -> Self::AuthenticateForInterfaceResponseFut {
2951        fn _decode(
2952            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2953        ) -> Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error> {
2954            let _response = fidl::client::decode_transaction_body::<
2955                fidl::encoding::ResultType<
2956                    fidl::encoding::EmptyStruct,
2957                    AuthenticateForInterfaceError,
2958                >,
2959                fidl::encoding::DefaultFuchsiaResourceDialect,
2960                0x7d63a6a7aed6f640,
2961            >(_buf?)?;
2962            Ok(_response.map(|x| x))
2963        }
2964        self.client.send_query_and_decode::<
2965            RouteSetV6AuthenticateForInterfaceRequest,
2966            RouteSetV6AuthenticateForInterfaceResult,
2967        >(
2968            (&mut credential,),
2969            0x7d63a6a7aed6f640,
2970            fidl::encoding::DynamicFlags::empty(),
2971            _decode,
2972        )
2973    }
2974
2975    type AddRouteResponseFut = fidl::client::QueryResponseFut<
2976        RouteSetV6AddRouteResult,
2977        fidl::encoding::DefaultFuchsiaResourceDialect,
2978    >;
2979    fn r#add_route(
2980        &self,
2981        mut route: &fidl_fuchsia_net_routes::RouteV6,
2982    ) -> Self::AddRouteResponseFut {
2983        fn _decode(
2984            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2985        ) -> Result<RouteSetV6AddRouteResult, fidl::Error> {
2986            let _response = fidl::client::decode_transaction_body::<
2987                fidl::encoding::ResultType<RouteSetV6AddRouteResponse, RouteSetError>,
2988                fidl::encoding::DefaultFuchsiaResourceDialect,
2989                0x67a2bd2ee34ace2e,
2990            >(_buf?)?;
2991            Ok(_response.map(|x| x.did_add))
2992        }
2993        self.client.send_query_and_decode::<RouteSetV6AddRouteRequest, RouteSetV6AddRouteResult>(
2994            (route,),
2995            0x67a2bd2ee34ace2e,
2996            fidl::encoding::DynamicFlags::empty(),
2997            _decode,
2998        )
2999    }
3000
3001    type RemoveRouteResponseFut = fidl::client::QueryResponseFut<
3002        RouteSetV6RemoveRouteResult,
3003        fidl::encoding::DefaultFuchsiaResourceDialect,
3004    >;
3005    fn r#remove_route(
3006        &self,
3007        mut route: &fidl_fuchsia_net_routes::RouteV6,
3008    ) -> Self::RemoveRouteResponseFut {
3009        fn _decode(
3010            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3011        ) -> Result<RouteSetV6RemoveRouteResult, fidl::Error> {
3012            let _response = fidl::client::decode_transaction_body::<
3013                fidl::encoding::ResultType<RouteSetV6RemoveRouteResponse, RouteSetError>,
3014                fidl::encoding::DefaultFuchsiaResourceDialect,
3015                0x4e5b7d4b1112cd82,
3016            >(_buf?)?;
3017            Ok(_response.map(|x| x.did_remove))
3018        }
3019        self.client
3020            .send_query_and_decode::<RouteSetV6RemoveRouteRequest, RouteSetV6RemoveRouteResult>(
3021                (route,),
3022                0x4e5b7d4b1112cd82,
3023                fidl::encoding::DynamicFlags::empty(),
3024                _decode,
3025            )
3026    }
3027}
3028
3029pub struct RouteSetV6EventStream {
3030    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3031}
3032
3033impl std::marker::Unpin for RouteSetV6EventStream {}
3034
3035impl futures::stream::FusedStream for RouteSetV6EventStream {
3036    fn is_terminated(&self) -> bool {
3037        self.event_receiver.is_terminated()
3038    }
3039}
3040
3041impl futures::Stream for RouteSetV6EventStream {
3042    type Item = Result<RouteSetV6Event, fidl::Error>;
3043
3044    fn poll_next(
3045        mut self: std::pin::Pin<&mut Self>,
3046        cx: &mut std::task::Context<'_>,
3047    ) -> std::task::Poll<Option<Self::Item>> {
3048        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3049            &mut self.event_receiver,
3050            cx
3051        )?) {
3052            Some(buf) => std::task::Poll::Ready(Some(RouteSetV6Event::decode(buf))),
3053            None => std::task::Poll::Ready(None),
3054        }
3055    }
3056}
3057
3058#[derive(Debug)]
3059pub enum RouteSetV6Event {}
3060
3061impl RouteSetV6Event {
3062    /// Decodes a message buffer as a [`RouteSetV6Event`].
3063    fn decode(
3064        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3065    ) -> Result<RouteSetV6Event, fidl::Error> {
3066        let (bytes, _handles) = buf.split_mut();
3067        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3068        debug_assert_eq!(tx_header.tx_id, 0);
3069        match tx_header.ordinal {
3070            _ => Err(fidl::Error::UnknownOrdinal {
3071                ordinal: tx_header.ordinal,
3072                protocol_name: <RouteSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3073            }),
3074        }
3075    }
3076}
3077
3078/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteSetV6.
3079pub struct RouteSetV6RequestStream {
3080    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3081    is_terminated: bool,
3082}
3083
3084impl std::marker::Unpin for RouteSetV6RequestStream {}
3085
3086impl futures::stream::FusedStream for RouteSetV6RequestStream {
3087    fn is_terminated(&self) -> bool {
3088        self.is_terminated
3089    }
3090}
3091
3092impl fidl::endpoints::RequestStream for RouteSetV6RequestStream {
3093    type Protocol = RouteSetV6Marker;
3094    type ControlHandle = RouteSetV6ControlHandle;
3095
3096    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3097        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3098    }
3099
3100    fn control_handle(&self) -> Self::ControlHandle {
3101        RouteSetV6ControlHandle { inner: self.inner.clone() }
3102    }
3103
3104    fn into_inner(
3105        self,
3106    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3107    {
3108        (self.inner, self.is_terminated)
3109    }
3110
3111    fn from_inner(
3112        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3113        is_terminated: bool,
3114    ) -> Self {
3115        Self { inner, is_terminated }
3116    }
3117}
3118
3119impl futures::Stream for RouteSetV6RequestStream {
3120    type Item = Result<RouteSetV6Request, fidl::Error>;
3121
3122    fn poll_next(
3123        mut self: std::pin::Pin<&mut Self>,
3124        cx: &mut std::task::Context<'_>,
3125    ) -> std::task::Poll<Option<Self::Item>> {
3126        let this = &mut *self;
3127        if this.inner.check_shutdown(cx) {
3128            this.is_terminated = true;
3129            return std::task::Poll::Ready(None);
3130        }
3131        if this.is_terminated {
3132            panic!("polled RouteSetV6RequestStream after completion");
3133        }
3134        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3135            |bytes, handles| {
3136                match this.inner.channel().read_etc(cx, bytes, handles) {
3137                    std::task::Poll::Ready(Ok(())) => {}
3138                    std::task::Poll::Pending => return std::task::Poll::Pending,
3139                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3140                        this.is_terminated = true;
3141                        return std::task::Poll::Ready(None);
3142                    }
3143                    std::task::Poll::Ready(Err(e)) => {
3144                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3145                            e.into(),
3146                        ))));
3147                    }
3148                }
3149
3150                // A message has been received from the channel
3151                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3152
3153                std::task::Poll::Ready(Some(match header.ordinal {
3154                    0x7d63a6a7aed6f640 => {
3155                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3156                        let mut req = fidl::new_empty!(
3157                            RouteSetV6AuthenticateForInterfaceRequest,
3158                            fidl::encoding::DefaultFuchsiaResourceDialect
3159                        );
3160                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteSetV6AuthenticateForInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
3161                        let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
3162                        Ok(RouteSetV6Request::AuthenticateForInterface {
3163                            credential: req.credential,
3164
3165                            responder: RouteSetV6AuthenticateForInterfaceResponder {
3166                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3167                                tx_id: header.tx_id,
3168                            },
3169                        })
3170                    }
3171                    0x67a2bd2ee34ace2e => {
3172                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3173                        let mut req = fidl::new_empty!(
3174                            RouteSetV6AddRouteRequest,
3175                            fidl::encoding::DefaultFuchsiaResourceDialect
3176                        );
3177                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteSetV6AddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
3178                        let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
3179                        Ok(RouteSetV6Request::AddRoute {
3180                            route: req.route,
3181
3182                            responder: RouteSetV6AddRouteResponder {
3183                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3184                                tx_id: header.tx_id,
3185                            },
3186                        })
3187                    }
3188                    0x4e5b7d4b1112cd82 => {
3189                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3190                        let mut req = fidl::new_empty!(
3191                            RouteSetV6RemoveRouteRequest,
3192                            fidl::encoding::DefaultFuchsiaResourceDialect
3193                        );
3194                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteSetV6RemoveRouteRequest>(&header, _body_bytes, handles, &mut req)?;
3195                        let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
3196                        Ok(RouteSetV6Request::RemoveRoute {
3197                            route: req.route,
3198
3199                            responder: RouteSetV6RemoveRouteResponder {
3200                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3201                                tx_id: header.tx_id,
3202                            },
3203                        })
3204                    }
3205                    _ => Err(fidl::Error::UnknownOrdinal {
3206                        ordinal: header.ordinal,
3207                        protocol_name:
3208                            <RouteSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3209                    }),
3210                }))
3211            },
3212        )
3213    }
3214}
3215
3216/// Provides mutable access over a set of system's IPv6 routes.
3217///
3218/// The system maintains a single global routing table. A route set offers an
3219/// isolated window into a subset of the global routing table: clients are free
3220/// to manage the routes within their own route set, but not the route set of
3221/// others. Thus the global routing table represents the union of all existing
3222/// route sets. A route must be removed from all route sets to which it belongs
3223/// before it will be removed from the global table.
3224///
3225/// This protocol encodes the lifetime of the route set. Closing the client end
3226/// removes the route set, and will also remove any routes that were
3227/// solely-owned by this route set.
3228///
3229/// Note that the system reserves the right to remove routes out from underneath
3230/// this route set. This will always manifest as a `removed` event on the
3231/// [`fuchsia.net.routes/WatcherV6`] protocol.
3232///
3233/// If the route table backing this route set is removed, then this protocol
3234/// will be closed with a `ZX_ERR_UNAVAILABLE` epitaph.
3235#[derive(Debug)]
3236pub enum RouteSetV6Request {
3237    /// Authenticate this route set to manage routes on the provided interface.
3238    /// Authentication is valid for the lifetime of the route set.
3239    ///
3240    /// + request `interface` the authentication credential for an interface.
3241    AuthenticateForInterface {
3242        credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3243        responder: RouteSetV6AuthenticateForInterfaceResponder,
3244    },
3245    /// Adds a route to this route set.
3246    ///
3247    /// + request `route` the route to add.
3248    /// - response `did_add` true iff the route was added to this `RouteSet`
3249    ///            as a result of this call.
3250    AddRoute { route: fidl_fuchsia_net_routes::RouteV6, responder: RouteSetV6AddRouteResponder },
3251    /// Removes a route from this route set.
3252    ///
3253    /// Note that if this route also exists other route sets, it will not be
3254    /// removed from the global routing table.
3255    ///
3256    /// + request `route` the route to remove.
3257    /// - response `did_remove` true iff the route was removed from this
3258    ///            `RouteSet` as a result of this call.
3259    RemoveRoute {
3260        route: fidl_fuchsia_net_routes::RouteV6,
3261        responder: RouteSetV6RemoveRouteResponder,
3262    },
3263}
3264
3265impl RouteSetV6Request {
3266    #[allow(irrefutable_let_patterns)]
3267    pub fn into_authenticate_for_interface(
3268        self,
3269    ) -> Option<(
3270        fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3271        RouteSetV6AuthenticateForInterfaceResponder,
3272    )> {
3273        if let RouteSetV6Request::AuthenticateForInterface { credential, responder } = self {
3274            Some((credential, responder))
3275        } else {
3276            None
3277        }
3278    }
3279
3280    #[allow(irrefutable_let_patterns)]
3281    pub fn into_add_route(
3282        self,
3283    ) -> Option<(fidl_fuchsia_net_routes::RouteV6, RouteSetV6AddRouteResponder)> {
3284        if let RouteSetV6Request::AddRoute { route, responder } = self {
3285            Some((route, responder))
3286        } else {
3287            None
3288        }
3289    }
3290
3291    #[allow(irrefutable_let_patterns)]
3292    pub fn into_remove_route(
3293        self,
3294    ) -> Option<(fidl_fuchsia_net_routes::RouteV6, RouteSetV6RemoveRouteResponder)> {
3295        if let RouteSetV6Request::RemoveRoute { route, responder } = self {
3296            Some((route, responder))
3297        } else {
3298            None
3299        }
3300    }
3301
3302    /// Name of the method defined in FIDL
3303    pub fn method_name(&self) -> &'static str {
3304        match *self {
3305            RouteSetV6Request::AuthenticateForInterface { .. } => "authenticate_for_interface",
3306            RouteSetV6Request::AddRoute { .. } => "add_route",
3307            RouteSetV6Request::RemoveRoute { .. } => "remove_route",
3308        }
3309    }
3310}
3311
3312#[derive(Debug, Clone)]
3313pub struct RouteSetV6ControlHandle {
3314    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3315}
3316
3317impl RouteSetV6ControlHandle {
3318    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3319        self.inner.shutdown_with_epitaph(status.into())
3320    }
3321}
3322
3323impl fidl::endpoints::ControlHandle for RouteSetV6ControlHandle {
3324    fn shutdown(&self) {
3325        self.inner.shutdown()
3326    }
3327
3328    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3329        self.inner.shutdown_with_epitaph(status)
3330    }
3331
3332    fn is_closed(&self) -> bool {
3333        self.inner.channel().is_closed()
3334    }
3335    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3336        self.inner.channel().on_closed()
3337    }
3338
3339    #[cfg(target_os = "fuchsia")]
3340    fn signal_peer(
3341        &self,
3342        clear_mask: zx::Signals,
3343        set_mask: zx::Signals,
3344    ) -> Result<(), zx_status::Status> {
3345        use fidl::Peered;
3346        self.inner.channel().signal_peer(clear_mask, set_mask)
3347    }
3348}
3349
3350impl RouteSetV6ControlHandle {}
3351
3352#[must_use = "FIDL methods require a response to be sent"]
3353#[derive(Debug)]
3354pub struct RouteSetV6AuthenticateForInterfaceResponder {
3355    control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
3356    tx_id: u32,
3357}
3358
3359/// Set the the channel to be shutdown (see [`RouteSetV6ControlHandle::shutdown`])
3360/// if the responder is dropped without sending a response, so that the client
3361/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3362impl std::ops::Drop for RouteSetV6AuthenticateForInterfaceResponder {
3363    fn drop(&mut self) {
3364        self.control_handle.shutdown();
3365        // Safety: drops once, never accessed again
3366        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3367    }
3368}
3369
3370impl fidl::endpoints::Responder for RouteSetV6AuthenticateForInterfaceResponder {
3371    type ControlHandle = RouteSetV6ControlHandle;
3372
3373    fn control_handle(&self) -> &RouteSetV6ControlHandle {
3374        &self.control_handle
3375    }
3376
3377    fn drop_without_shutdown(mut self) {
3378        // Safety: drops once, never accessed again due to mem::forget
3379        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3380        // Prevent Drop from running (which would shut down the channel)
3381        std::mem::forget(self);
3382    }
3383}
3384
3385impl RouteSetV6AuthenticateForInterfaceResponder {
3386    /// Sends a response to the FIDL transaction.
3387    ///
3388    /// Sets the channel to shutdown if an error occurs.
3389    pub fn send(
3390        self,
3391        mut result: Result<(), AuthenticateForInterfaceError>,
3392    ) -> Result<(), fidl::Error> {
3393        let _result = self.send_raw(result);
3394        if _result.is_err() {
3395            self.control_handle.shutdown();
3396        }
3397        self.drop_without_shutdown();
3398        _result
3399    }
3400
3401    /// Similar to "send" but does not shutdown the channel if an error occurs.
3402    pub fn send_no_shutdown_on_err(
3403        self,
3404        mut result: Result<(), AuthenticateForInterfaceError>,
3405    ) -> Result<(), fidl::Error> {
3406        let _result = self.send_raw(result);
3407        self.drop_without_shutdown();
3408        _result
3409    }
3410
3411    fn send_raw(
3412        &self,
3413        mut result: Result<(), AuthenticateForInterfaceError>,
3414    ) -> Result<(), fidl::Error> {
3415        self.control_handle.inner.send::<fidl::encoding::ResultType<
3416            fidl::encoding::EmptyStruct,
3417            AuthenticateForInterfaceError,
3418        >>(
3419            result,
3420            self.tx_id,
3421            0x7d63a6a7aed6f640,
3422            fidl::encoding::DynamicFlags::empty(),
3423        )
3424    }
3425}
3426
3427#[must_use = "FIDL methods require a response to be sent"]
3428#[derive(Debug)]
3429pub struct RouteSetV6AddRouteResponder {
3430    control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
3431    tx_id: u32,
3432}
3433
3434/// Set the the channel to be shutdown (see [`RouteSetV6ControlHandle::shutdown`])
3435/// if the responder is dropped without sending a response, so that the client
3436/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3437impl std::ops::Drop for RouteSetV6AddRouteResponder {
3438    fn drop(&mut self) {
3439        self.control_handle.shutdown();
3440        // Safety: drops once, never accessed again
3441        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3442    }
3443}
3444
3445impl fidl::endpoints::Responder for RouteSetV6AddRouteResponder {
3446    type ControlHandle = RouteSetV6ControlHandle;
3447
3448    fn control_handle(&self) -> &RouteSetV6ControlHandle {
3449        &self.control_handle
3450    }
3451
3452    fn drop_without_shutdown(mut self) {
3453        // Safety: drops once, never accessed again due to mem::forget
3454        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3455        // Prevent Drop from running (which would shut down the channel)
3456        std::mem::forget(self);
3457    }
3458}
3459
3460impl RouteSetV6AddRouteResponder {
3461    /// Sends a response to the FIDL transaction.
3462    ///
3463    /// Sets the channel to shutdown if an error occurs.
3464    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
3465        let _result = self.send_raw(result);
3466        if _result.is_err() {
3467            self.control_handle.shutdown();
3468        }
3469        self.drop_without_shutdown();
3470        _result
3471    }
3472
3473    /// Similar to "send" but does not shutdown the channel if an error occurs.
3474    pub fn send_no_shutdown_on_err(
3475        self,
3476        mut result: Result<bool, RouteSetError>,
3477    ) -> Result<(), fidl::Error> {
3478        let _result = self.send_raw(result);
3479        self.drop_without_shutdown();
3480        _result
3481    }
3482
3483    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
3484        self.control_handle.inner.send::<fidl::encoding::ResultType<
3485            RouteSetV6AddRouteResponse,
3486            RouteSetError,
3487        >>(
3488            result.map(|did_add| (did_add,)),
3489            self.tx_id,
3490            0x67a2bd2ee34ace2e,
3491            fidl::encoding::DynamicFlags::empty(),
3492        )
3493    }
3494}
3495
3496#[must_use = "FIDL methods require a response to be sent"]
3497#[derive(Debug)]
3498pub struct RouteSetV6RemoveRouteResponder {
3499    control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
3500    tx_id: u32,
3501}
3502
3503/// Set the the channel to be shutdown (see [`RouteSetV6ControlHandle::shutdown`])
3504/// if the responder is dropped without sending a response, so that the client
3505/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3506impl std::ops::Drop for RouteSetV6RemoveRouteResponder {
3507    fn drop(&mut self) {
3508        self.control_handle.shutdown();
3509        // Safety: drops once, never accessed again
3510        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3511    }
3512}
3513
3514impl fidl::endpoints::Responder for RouteSetV6RemoveRouteResponder {
3515    type ControlHandle = RouteSetV6ControlHandle;
3516
3517    fn control_handle(&self) -> &RouteSetV6ControlHandle {
3518        &self.control_handle
3519    }
3520
3521    fn drop_without_shutdown(mut self) {
3522        // Safety: drops once, never accessed again due to mem::forget
3523        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3524        // Prevent Drop from running (which would shut down the channel)
3525        std::mem::forget(self);
3526    }
3527}
3528
3529impl RouteSetV6RemoveRouteResponder {
3530    /// Sends a response to the FIDL transaction.
3531    ///
3532    /// Sets the channel to shutdown if an error occurs.
3533    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
3534        let _result = self.send_raw(result);
3535        if _result.is_err() {
3536            self.control_handle.shutdown();
3537        }
3538        self.drop_without_shutdown();
3539        _result
3540    }
3541
3542    /// Similar to "send" but does not shutdown the channel if an error occurs.
3543    pub fn send_no_shutdown_on_err(
3544        self,
3545        mut result: Result<bool, RouteSetError>,
3546    ) -> Result<(), fidl::Error> {
3547        let _result = self.send_raw(result);
3548        self.drop_without_shutdown();
3549        _result
3550    }
3551
3552    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
3553        self.control_handle.inner.send::<fidl::encoding::ResultType<
3554            RouteSetV6RemoveRouteResponse,
3555            RouteSetError,
3556        >>(
3557            result.map(|did_remove| (did_remove,)),
3558            self.tx_id,
3559            0x4e5b7d4b1112cd82,
3560            fidl::encoding::DynamicFlags::empty(),
3561        )
3562    }
3563}
3564
3565#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3566pub struct RouteTableProviderV4Marker;
3567
3568impl fidl::endpoints::ProtocolMarker for RouteTableProviderV4Marker {
3569    type Proxy = RouteTableProviderV4Proxy;
3570    type RequestStream = RouteTableProviderV4RequestStream;
3571    #[cfg(target_os = "fuchsia")]
3572    type SynchronousProxy = RouteTableProviderV4SynchronousProxy;
3573
3574    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableProviderV4";
3575}
3576impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableProviderV4Marker {}
3577pub type RouteTableProviderV4GetInterfaceLocalTableResult =
3578    Result<fidl::endpoints::ClientEnd<RouteTableV4Marker>, GetInterfaceLocalTableError>;
3579
3580pub trait RouteTableProviderV4ProxyInterface: Send + Sync {
3581    fn r#new_route_table(
3582        &self,
3583        provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
3584        options: &RouteTableOptionsV4,
3585    ) -> Result<(), fidl::Error>;
3586    type GetInterfaceLocalTableResponseFut: std::future::Future<
3587            Output = Result<RouteTableProviderV4GetInterfaceLocalTableResult, fidl::Error>,
3588        > + Send;
3589    fn r#get_interface_local_table(
3590        &self,
3591        credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3592    ) -> Self::GetInterfaceLocalTableResponseFut;
3593}
3594#[derive(Debug)]
3595#[cfg(target_os = "fuchsia")]
3596pub struct RouteTableProviderV4SynchronousProxy {
3597    client: fidl::client::sync::Client,
3598}
3599
3600#[cfg(target_os = "fuchsia")]
3601impl fidl::endpoints::SynchronousProxy for RouteTableProviderV4SynchronousProxy {
3602    type Proxy = RouteTableProviderV4Proxy;
3603    type Protocol = RouteTableProviderV4Marker;
3604
3605    fn from_channel(inner: fidl::Channel) -> Self {
3606        Self::new(inner)
3607    }
3608
3609    fn into_channel(self) -> fidl::Channel {
3610        self.client.into_channel()
3611    }
3612
3613    fn as_channel(&self) -> &fidl::Channel {
3614        self.client.as_channel()
3615    }
3616}
3617
3618#[cfg(target_os = "fuchsia")]
3619impl RouteTableProviderV4SynchronousProxy {
3620    pub fn new(channel: fidl::Channel) -> Self {
3621        Self { client: fidl::client::sync::Client::new(channel) }
3622    }
3623
3624    pub fn into_channel(self) -> fidl::Channel {
3625        self.client.into_channel()
3626    }
3627
3628    /// Waits until an event arrives and returns it. It is safe for other
3629    /// threads to make concurrent requests while waiting for an event.
3630    pub fn wait_for_event(
3631        &self,
3632        deadline: zx::MonotonicInstant,
3633    ) -> Result<RouteTableProviderV4Event, fidl::Error> {
3634        RouteTableProviderV4Event::decode(
3635            self.client.wait_for_event::<RouteTableProviderV4Marker>(deadline)?,
3636        )
3637    }
3638
3639    /// Creates a new route table. If the client end of the `provider` is
3640    /// closed, the route table is removed (unless detached).
3641    pub fn r#new_route_table(
3642        &self,
3643        mut provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
3644        mut options: &RouteTableOptionsV4,
3645    ) -> Result<(), fidl::Error> {
3646        self.client.send::<RouteTableProviderV4NewRouteTableRequest>(
3647            (provider, options),
3648            0x703bc0eaf98f07cf,
3649            fidl::encoding::DynamicFlags::empty(),
3650        )
3651    }
3652
3653    /// Gets the interface-local route table for this interface.
3654    ///
3655    /// + request credential of the interface to get local route table.
3656    /// - response client end of the `RouteTableV4` protocol if successfully.
3657    ///
3658    /// This table is only removed after the interface is removed AND all
3659    /// outstanding `RouteTableV4` channels are closed.
3660    ///
3661    /// Calling detach on the route table is a no-op.
3662    pub fn r#get_interface_local_table(
3663        &self,
3664        mut credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3665        ___deadline: zx::MonotonicInstant,
3666    ) -> Result<RouteTableProviderV4GetInterfaceLocalTableResult, fidl::Error> {
3667        let _response = self.client.send_query::<
3668            RouteTableProviderV4GetInterfaceLocalTableRequest,
3669            fidl::encoding::ResultType<RouteTableProviderV4GetInterfaceLocalTableResponse, GetInterfaceLocalTableError>,
3670            RouteTableProviderV4Marker,
3671        >(
3672            (&mut credential,),
3673            0x2596721a63bbacbd,
3674            fidl::encoding::DynamicFlags::empty(),
3675            ___deadline,
3676        )?;
3677        Ok(_response.map(|x| x.route_table))
3678    }
3679}
3680
3681#[cfg(target_os = "fuchsia")]
3682impl From<RouteTableProviderV4SynchronousProxy> for zx::NullableHandle {
3683    fn from(value: RouteTableProviderV4SynchronousProxy) -> Self {
3684        value.into_channel().into()
3685    }
3686}
3687
3688#[cfg(target_os = "fuchsia")]
3689impl From<fidl::Channel> for RouteTableProviderV4SynchronousProxy {
3690    fn from(value: fidl::Channel) -> Self {
3691        Self::new(value)
3692    }
3693}
3694
3695#[cfg(target_os = "fuchsia")]
3696impl fidl::endpoints::FromClient for RouteTableProviderV4SynchronousProxy {
3697    type Protocol = RouteTableProviderV4Marker;
3698
3699    fn from_client(value: fidl::endpoints::ClientEnd<RouteTableProviderV4Marker>) -> Self {
3700        Self::new(value.into_channel())
3701    }
3702}
3703
3704#[derive(Debug, Clone)]
3705pub struct RouteTableProviderV4Proxy {
3706    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3707}
3708
3709impl fidl::endpoints::Proxy for RouteTableProviderV4Proxy {
3710    type Protocol = RouteTableProviderV4Marker;
3711
3712    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3713        Self::new(inner)
3714    }
3715
3716    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3717        self.client.into_channel().map_err(|client| Self { client })
3718    }
3719
3720    fn as_channel(&self) -> &::fidl::AsyncChannel {
3721        self.client.as_channel()
3722    }
3723}
3724
3725impl RouteTableProviderV4Proxy {
3726    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableProviderV4.
3727    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3728        let protocol_name =
3729            <RouteTableProviderV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3730        Self { client: fidl::client::Client::new(channel, protocol_name) }
3731    }
3732
3733    /// Get a Stream of events from the remote end of the protocol.
3734    ///
3735    /// # Panics
3736    ///
3737    /// Panics if the event stream was already taken.
3738    pub fn take_event_stream(&self) -> RouteTableProviderV4EventStream {
3739        RouteTableProviderV4EventStream { event_receiver: self.client.take_event_receiver() }
3740    }
3741
3742    /// Creates a new route table. If the client end of the `provider` is
3743    /// closed, the route table is removed (unless detached).
3744    pub fn r#new_route_table(
3745        &self,
3746        mut provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
3747        mut options: &RouteTableOptionsV4,
3748    ) -> Result<(), fidl::Error> {
3749        RouteTableProviderV4ProxyInterface::r#new_route_table(self, provider, options)
3750    }
3751
3752    /// Gets the interface-local route table for this interface.
3753    ///
3754    /// + request credential of the interface to get local route table.
3755    /// - response client end of the `RouteTableV4` protocol if successfully.
3756    ///
3757    /// This table is only removed after the interface is removed AND all
3758    /// outstanding `RouteTableV4` channels are closed.
3759    ///
3760    /// Calling detach on the route table is a no-op.
3761    pub fn r#get_interface_local_table(
3762        &self,
3763        mut credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3764    ) -> fidl::client::QueryResponseFut<
3765        RouteTableProviderV4GetInterfaceLocalTableResult,
3766        fidl::encoding::DefaultFuchsiaResourceDialect,
3767    > {
3768        RouteTableProviderV4ProxyInterface::r#get_interface_local_table(self, credential)
3769    }
3770}
3771
3772impl RouteTableProviderV4ProxyInterface for RouteTableProviderV4Proxy {
3773    fn r#new_route_table(
3774        &self,
3775        mut provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
3776        mut options: &RouteTableOptionsV4,
3777    ) -> Result<(), fidl::Error> {
3778        self.client.send::<RouteTableProviderV4NewRouteTableRequest>(
3779            (provider, options),
3780            0x703bc0eaf98f07cf,
3781            fidl::encoding::DynamicFlags::empty(),
3782        )
3783    }
3784
3785    type GetInterfaceLocalTableResponseFut = fidl::client::QueryResponseFut<
3786        RouteTableProviderV4GetInterfaceLocalTableResult,
3787        fidl::encoding::DefaultFuchsiaResourceDialect,
3788    >;
3789    fn r#get_interface_local_table(
3790        &self,
3791        mut credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3792    ) -> Self::GetInterfaceLocalTableResponseFut {
3793        fn _decode(
3794            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3795        ) -> Result<RouteTableProviderV4GetInterfaceLocalTableResult, fidl::Error> {
3796            let _response = fidl::client::decode_transaction_body::<
3797                fidl::encoding::ResultType<
3798                    RouteTableProviderV4GetInterfaceLocalTableResponse,
3799                    GetInterfaceLocalTableError,
3800                >,
3801                fidl::encoding::DefaultFuchsiaResourceDialect,
3802                0x2596721a63bbacbd,
3803            >(_buf?)?;
3804            Ok(_response.map(|x| x.route_table))
3805        }
3806        self.client.send_query_and_decode::<
3807            RouteTableProviderV4GetInterfaceLocalTableRequest,
3808            RouteTableProviderV4GetInterfaceLocalTableResult,
3809        >(
3810            (&mut credential,),
3811            0x2596721a63bbacbd,
3812            fidl::encoding::DynamicFlags::empty(),
3813            _decode,
3814        )
3815    }
3816}
3817
3818pub struct RouteTableProviderV4EventStream {
3819    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3820}
3821
3822impl std::marker::Unpin for RouteTableProviderV4EventStream {}
3823
3824impl futures::stream::FusedStream for RouteTableProviderV4EventStream {
3825    fn is_terminated(&self) -> bool {
3826        self.event_receiver.is_terminated()
3827    }
3828}
3829
3830impl futures::Stream for RouteTableProviderV4EventStream {
3831    type Item = Result<RouteTableProviderV4Event, fidl::Error>;
3832
3833    fn poll_next(
3834        mut self: std::pin::Pin<&mut Self>,
3835        cx: &mut std::task::Context<'_>,
3836    ) -> std::task::Poll<Option<Self::Item>> {
3837        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3838            &mut self.event_receiver,
3839            cx
3840        )?) {
3841            Some(buf) => std::task::Poll::Ready(Some(RouteTableProviderV4Event::decode(buf))),
3842            None => std::task::Poll::Ready(None),
3843        }
3844    }
3845}
3846
3847#[derive(Debug)]
3848pub enum RouteTableProviderV4Event {}
3849
3850impl RouteTableProviderV4Event {
3851    /// Decodes a message buffer as a [`RouteTableProviderV4Event`].
3852    fn decode(
3853        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3854    ) -> Result<RouteTableProviderV4Event, fidl::Error> {
3855        let (bytes, _handles) = buf.split_mut();
3856        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3857        debug_assert_eq!(tx_header.tx_id, 0);
3858        match tx_header.ordinal {
3859            _ => Err(fidl::Error::UnknownOrdinal {
3860                ordinal: tx_header.ordinal,
3861                protocol_name:
3862                    <RouteTableProviderV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3863            }),
3864        }
3865    }
3866}
3867
3868/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableProviderV4.
3869pub struct RouteTableProviderV4RequestStream {
3870    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3871    is_terminated: bool,
3872}
3873
3874impl std::marker::Unpin for RouteTableProviderV4RequestStream {}
3875
3876impl futures::stream::FusedStream for RouteTableProviderV4RequestStream {
3877    fn is_terminated(&self) -> bool {
3878        self.is_terminated
3879    }
3880}
3881
3882impl fidl::endpoints::RequestStream for RouteTableProviderV4RequestStream {
3883    type Protocol = RouteTableProviderV4Marker;
3884    type ControlHandle = RouteTableProviderV4ControlHandle;
3885
3886    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3887        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3888    }
3889
3890    fn control_handle(&self) -> Self::ControlHandle {
3891        RouteTableProviderV4ControlHandle { inner: self.inner.clone() }
3892    }
3893
3894    fn into_inner(
3895        self,
3896    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3897    {
3898        (self.inner, self.is_terminated)
3899    }
3900
3901    fn from_inner(
3902        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3903        is_terminated: bool,
3904    ) -> Self {
3905        Self { inner, is_terminated }
3906    }
3907}
3908
3909impl futures::Stream for RouteTableProviderV4RequestStream {
3910    type Item = Result<RouteTableProviderV4Request, fidl::Error>;
3911
3912    fn poll_next(
3913        mut self: std::pin::Pin<&mut Self>,
3914        cx: &mut std::task::Context<'_>,
3915    ) -> std::task::Poll<Option<Self::Item>> {
3916        let this = &mut *self;
3917        if this.inner.check_shutdown(cx) {
3918            this.is_terminated = true;
3919            return std::task::Poll::Ready(None);
3920        }
3921        if this.is_terminated {
3922            panic!("polled RouteTableProviderV4RequestStream after completion");
3923        }
3924        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3925            |bytes, handles| {
3926                match this.inner.channel().read_etc(cx, bytes, handles) {
3927                    std::task::Poll::Ready(Ok(())) => {}
3928                    std::task::Poll::Pending => return std::task::Poll::Pending,
3929                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3930                        this.is_terminated = true;
3931                        return std::task::Poll::Ready(None);
3932                    }
3933                    std::task::Poll::Ready(Err(e)) => {
3934                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3935                            e.into(),
3936                        ))));
3937                    }
3938                }
3939
3940                // A message has been received from the channel
3941                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3942
3943                std::task::Poll::Ready(Some(match header.ordinal {
3944                0x703bc0eaf98f07cf => {
3945                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3946                    let mut req = fidl::new_empty!(RouteTableProviderV4NewRouteTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3947                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteTableProviderV4NewRouteTableRequest>(&header, _body_bytes, handles, &mut req)?;
3948                    let control_handle = RouteTableProviderV4ControlHandle {
3949                        inner: this.inner.clone(),
3950                    };
3951                    Ok(RouteTableProviderV4Request::NewRouteTable {provider: req.provider,
3952options: req.options,
3953
3954                        control_handle,
3955                    })
3956                }
3957                0x2596721a63bbacbd => {
3958                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3959                    let mut req = fidl::new_empty!(RouteTableProviderV4GetInterfaceLocalTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3960                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteTableProviderV4GetInterfaceLocalTableRequest>(&header, _body_bytes, handles, &mut req)?;
3961                    let control_handle = RouteTableProviderV4ControlHandle {
3962                        inner: this.inner.clone(),
3963                    };
3964                    Ok(RouteTableProviderV4Request::GetInterfaceLocalTable {credential: req.credential,
3965
3966                        responder: RouteTableProviderV4GetInterfaceLocalTableResponder {
3967                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3968                            tx_id: header.tx_id,
3969                        },
3970                    })
3971                }
3972                _ => Err(fidl::Error::UnknownOrdinal {
3973                    ordinal: header.ordinal,
3974                    protocol_name: <RouteTableProviderV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3975                }),
3976            }))
3977            },
3978        )
3979    }
3980}
3981
3982/// This protocol allows the client to create route tables.
3983#[derive(Debug)]
3984pub enum RouteTableProviderV4Request {
3985    /// Creates a new route table. If the client end of the `provider` is
3986    /// closed, the route table is removed (unless detached).
3987    NewRouteTable {
3988        provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
3989        options: RouteTableOptionsV4,
3990        control_handle: RouteTableProviderV4ControlHandle,
3991    },
3992    /// Gets the interface-local route table for this interface.
3993    ///
3994    /// + request credential of the interface to get local route table.
3995    /// - response client end of the `RouteTableV4` protocol if successfully.
3996    ///
3997    /// This table is only removed after the interface is removed AND all
3998    /// outstanding `RouteTableV4` channels are closed.
3999    ///
4000    /// Calling detach on the route table is a no-op.
4001    GetInterfaceLocalTable {
4002        credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
4003        responder: RouteTableProviderV4GetInterfaceLocalTableResponder,
4004    },
4005}
4006
4007impl RouteTableProviderV4Request {
4008    #[allow(irrefutable_let_patterns)]
4009    pub fn into_new_route_table(
4010        self,
4011    ) -> Option<(
4012        fidl::endpoints::ServerEnd<RouteTableV4Marker>,
4013        RouteTableOptionsV4,
4014        RouteTableProviderV4ControlHandle,
4015    )> {
4016        if let RouteTableProviderV4Request::NewRouteTable { provider, options, control_handle } =
4017            self
4018        {
4019            Some((provider, options, control_handle))
4020        } else {
4021            None
4022        }
4023    }
4024
4025    #[allow(irrefutable_let_patterns)]
4026    pub fn into_get_interface_local_table(
4027        self,
4028    ) -> Option<(
4029        fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
4030        RouteTableProviderV4GetInterfaceLocalTableResponder,
4031    )> {
4032        if let RouteTableProviderV4Request::GetInterfaceLocalTable { credential, responder } = self
4033        {
4034            Some((credential, responder))
4035        } else {
4036            None
4037        }
4038    }
4039
4040    /// Name of the method defined in FIDL
4041    pub fn method_name(&self) -> &'static str {
4042        match *self {
4043            RouteTableProviderV4Request::NewRouteTable { .. } => "new_route_table",
4044            RouteTableProviderV4Request::GetInterfaceLocalTable { .. } => {
4045                "get_interface_local_table"
4046            }
4047        }
4048    }
4049}
4050
4051#[derive(Debug, Clone)]
4052pub struct RouteTableProviderV4ControlHandle {
4053    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4054}
4055
4056impl RouteTableProviderV4ControlHandle {
4057    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4058        self.inner.shutdown_with_epitaph(status.into())
4059    }
4060}
4061
4062impl fidl::endpoints::ControlHandle for RouteTableProviderV4ControlHandle {
4063    fn shutdown(&self) {
4064        self.inner.shutdown()
4065    }
4066
4067    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4068        self.inner.shutdown_with_epitaph(status)
4069    }
4070
4071    fn is_closed(&self) -> bool {
4072        self.inner.channel().is_closed()
4073    }
4074    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4075        self.inner.channel().on_closed()
4076    }
4077
4078    #[cfg(target_os = "fuchsia")]
4079    fn signal_peer(
4080        &self,
4081        clear_mask: zx::Signals,
4082        set_mask: zx::Signals,
4083    ) -> Result<(), zx_status::Status> {
4084        use fidl::Peered;
4085        self.inner.channel().signal_peer(clear_mask, set_mask)
4086    }
4087}
4088
4089impl RouteTableProviderV4ControlHandle {}
4090
4091#[must_use = "FIDL methods require a response to be sent"]
4092#[derive(Debug)]
4093pub struct RouteTableProviderV4GetInterfaceLocalTableResponder {
4094    control_handle: std::mem::ManuallyDrop<RouteTableProviderV4ControlHandle>,
4095    tx_id: u32,
4096}
4097
4098/// Set the the channel to be shutdown (see [`RouteTableProviderV4ControlHandle::shutdown`])
4099/// if the responder is dropped without sending a response, so that the client
4100/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4101impl std::ops::Drop for RouteTableProviderV4GetInterfaceLocalTableResponder {
4102    fn drop(&mut self) {
4103        self.control_handle.shutdown();
4104        // Safety: drops once, never accessed again
4105        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4106    }
4107}
4108
4109impl fidl::endpoints::Responder for RouteTableProviderV4GetInterfaceLocalTableResponder {
4110    type ControlHandle = RouteTableProviderV4ControlHandle;
4111
4112    fn control_handle(&self) -> &RouteTableProviderV4ControlHandle {
4113        &self.control_handle
4114    }
4115
4116    fn drop_without_shutdown(mut self) {
4117        // Safety: drops once, never accessed again due to mem::forget
4118        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4119        // Prevent Drop from running (which would shut down the channel)
4120        std::mem::forget(self);
4121    }
4122}
4123
4124impl RouteTableProviderV4GetInterfaceLocalTableResponder {
4125    /// Sends a response to the FIDL transaction.
4126    ///
4127    /// Sets the channel to shutdown if an error occurs.
4128    pub fn send(
4129        self,
4130        mut result: Result<
4131            fidl::endpoints::ClientEnd<RouteTableV4Marker>,
4132            GetInterfaceLocalTableError,
4133        >,
4134    ) -> Result<(), fidl::Error> {
4135        let _result = self.send_raw(result);
4136        if _result.is_err() {
4137            self.control_handle.shutdown();
4138        }
4139        self.drop_without_shutdown();
4140        _result
4141    }
4142
4143    /// Similar to "send" but does not shutdown the channel if an error occurs.
4144    pub fn send_no_shutdown_on_err(
4145        self,
4146        mut result: Result<
4147            fidl::endpoints::ClientEnd<RouteTableV4Marker>,
4148            GetInterfaceLocalTableError,
4149        >,
4150    ) -> Result<(), fidl::Error> {
4151        let _result = self.send_raw(result);
4152        self.drop_without_shutdown();
4153        _result
4154    }
4155
4156    fn send_raw(
4157        &self,
4158        mut result: Result<
4159            fidl::endpoints::ClientEnd<RouteTableV4Marker>,
4160            GetInterfaceLocalTableError,
4161        >,
4162    ) -> Result<(), fidl::Error> {
4163        self.control_handle.inner.send::<fidl::encoding::ResultType<
4164            RouteTableProviderV4GetInterfaceLocalTableResponse,
4165            GetInterfaceLocalTableError,
4166        >>(
4167            result.map(|route_table| (route_table,)),
4168            self.tx_id,
4169            0x2596721a63bbacbd,
4170            fidl::encoding::DynamicFlags::empty(),
4171        )
4172    }
4173}
4174
4175#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4176pub struct RouteTableProviderV6Marker;
4177
4178impl fidl::endpoints::ProtocolMarker for RouteTableProviderV6Marker {
4179    type Proxy = RouteTableProviderV6Proxy;
4180    type RequestStream = RouteTableProviderV6RequestStream;
4181    #[cfg(target_os = "fuchsia")]
4182    type SynchronousProxy = RouteTableProviderV6SynchronousProxy;
4183
4184    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableProviderV6";
4185}
4186impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableProviderV6Marker {}
4187pub type RouteTableProviderV6GetInterfaceLocalTableResult =
4188    Result<fidl::endpoints::ClientEnd<RouteTableV6Marker>, GetInterfaceLocalTableError>;
4189
4190pub trait RouteTableProviderV6ProxyInterface: Send + Sync {
4191    fn r#new_route_table(
4192        &self,
4193        provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
4194        options: &RouteTableOptionsV6,
4195    ) -> Result<(), fidl::Error>;
4196    type GetInterfaceLocalTableResponseFut: std::future::Future<
4197            Output = Result<RouteTableProviderV6GetInterfaceLocalTableResult, fidl::Error>,
4198        > + Send;
4199    fn r#get_interface_local_table(
4200        &self,
4201        credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
4202    ) -> Self::GetInterfaceLocalTableResponseFut;
4203}
4204#[derive(Debug)]
4205#[cfg(target_os = "fuchsia")]
4206pub struct RouteTableProviderV6SynchronousProxy {
4207    client: fidl::client::sync::Client,
4208}
4209
4210#[cfg(target_os = "fuchsia")]
4211impl fidl::endpoints::SynchronousProxy for RouteTableProviderV6SynchronousProxy {
4212    type Proxy = RouteTableProviderV6Proxy;
4213    type Protocol = RouteTableProviderV6Marker;
4214
4215    fn from_channel(inner: fidl::Channel) -> Self {
4216        Self::new(inner)
4217    }
4218
4219    fn into_channel(self) -> fidl::Channel {
4220        self.client.into_channel()
4221    }
4222
4223    fn as_channel(&self) -> &fidl::Channel {
4224        self.client.as_channel()
4225    }
4226}
4227
4228#[cfg(target_os = "fuchsia")]
4229impl RouteTableProviderV6SynchronousProxy {
4230    pub fn new(channel: fidl::Channel) -> Self {
4231        Self { client: fidl::client::sync::Client::new(channel) }
4232    }
4233
4234    pub fn into_channel(self) -> fidl::Channel {
4235        self.client.into_channel()
4236    }
4237
4238    /// Waits until an event arrives and returns it. It is safe for other
4239    /// threads to make concurrent requests while waiting for an event.
4240    pub fn wait_for_event(
4241        &self,
4242        deadline: zx::MonotonicInstant,
4243    ) -> Result<RouteTableProviderV6Event, fidl::Error> {
4244        RouteTableProviderV6Event::decode(
4245            self.client.wait_for_event::<RouteTableProviderV6Marker>(deadline)?,
4246        )
4247    }
4248
4249    /// Creates a new route table. If the client end of the `provider` is
4250    /// closed, the route table is removed (unless detached).
4251    pub fn r#new_route_table(
4252        &self,
4253        mut provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
4254        mut options: &RouteTableOptionsV6,
4255    ) -> Result<(), fidl::Error> {
4256        self.client.send::<RouteTableProviderV6NewRouteTableRequest>(
4257            (provider, options),
4258            0x152b67b397a31ca,
4259            fidl::encoding::DynamicFlags::empty(),
4260        )
4261    }
4262
4263    /// Gets the interface-local route table for this interface.
4264    ///
4265    /// + request credential of the interface to get local route table.
4266    /// - response client end of the `RouteTableV6` protocol if successfully.
4267    ///
4268    /// This table is only removed after the interface is removed AND all
4269    /// outstanding `RouteTableV6` channels are closed.
4270    ///
4271    /// Calling detach on the route table is a no-op.
4272    pub fn r#get_interface_local_table(
4273        &self,
4274        mut credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
4275        ___deadline: zx::MonotonicInstant,
4276    ) -> Result<RouteTableProviderV6GetInterfaceLocalTableResult, fidl::Error> {
4277        let _response = self.client.send_query::<
4278            RouteTableProviderV6GetInterfaceLocalTableRequest,
4279            fidl::encoding::ResultType<RouteTableProviderV6GetInterfaceLocalTableResponse, GetInterfaceLocalTableError>,
4280            RouteTableProviderV6Marker,
4281        >(
4282            (&mut credential,),
4283            0x6f82c1d63c3081f5,
4284            fidl::encoding::DynamicFlags::empty(),
4285            ___deadline,
4286        )?;
4287        Ok(_response.map(|x| x.route_table))
4288    }
4289}
4290
4291#[cfg(target_os = "fuchsia")]
4292impl From<RouteTableProviderV6SynchronousProxy> for zx::NullableHandle {
4293    fn from(value: RouteTableProviderV6SynchronousProxy) -> Self {
4294        value.into_channel().into()
4295    }
4296}
4297
4298#[cfg(target_os = "fuchsia")]
4299impl From<fidl::Channel> for RouteTableProviderV6SynchronousProxy {
4300    fn from(value: fidl::Channel) -> Self {
4301        Self::new(value)
4302    }
4303}
4304
4305#[cfg(target_os = "fuchsia")]
4306impl fidl::endpoints::FromClient for RouteTableProviderV6SynchronousProxy {
4307    type Protocol = RouteTableProviderV6Marker;
4308
4309    fn from_client(value: fidl::endpoints::ClientEnd<RouteTableProviderV6Marker>) -> Self {
4310        Self::new(value.into_channel())
4311    }
4312}
4313
4314#[derive(Debug, Clone)]
4315pub struct RouteTableProviderV6Proxy {
4316    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4317}
4318
4319impl fidl::endpoints::Proxy for RouteTableProviderV6Proxy {
4320    type Protocol = RouteTableProviderV6Marker;
4321
4322    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4323        Self::new(inner)
4324    }
4325
4326    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4327        self.client.into_channel().map_err(|client| Self { client })
4328    }
4329
4330    fn as_channel(&self) -> &::fidl::AsyncChannel {
4331        self.client.as_channel()
4332    }
4333}
4334
4335impl RouteTableProviderV6Proxy {
4336    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableProviderV6.
4337    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4338        let protocol_name =
4339            <RouteTableProviderV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4340        Self { client: fidl::client::Client::new(channel, protocol_name) }
4341    }
4342
4343    /// Get a Stream of events from the remote end of the protocol.
4344    ///
4345    /// # Panics
4346    ///
4347    /// Panics if the event stream was already taken.
4348    pub fn take_event_stream(&self) -> RouteTableProviderV6EventStream {
4349        RouteTableProviderV6EventStream { event_receiver: self.client.take_event_receiver() }
4350    }
4351
4352    /// Creates a new route table. If the client end of the `provider` is
4353    /// closed, the route table is removed (unless detached).
4354    pub fn r#new_route_table(
4355        &self,
4356        mut provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
4357        mut options: &RouteTableOptionsV6,
4358    ) -> Result<(), fidl::Error> {
4359        RouteTableProviderV6ProxyInterface::r#new_route_table(self, provider, options)
4360    }
4361
4362    /// Gets the interface-local route table for this interface.
4363    ///
4364    /// + request credential of the interface to get local route table.
4365    /// - response client end of the `RouteTableV6` protocol if successfully.
4366    ///
4367    /// This table is only removed after the interface is removed AND all
4368    /// outstanding `RouteTableV6` channels are closed.
4369    ///
4370    /// Calling detach on the route table is a no-op.
4371    pub fn r#get_interface_local_table(
4372        &self,
4373        mut credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
4374    ) -> fidl::client::QueryResponseFut<
4375        RouteTableProviderV6GetInterfaceLocalTableResult,
4376        fidl::encoding::DefaultFuchsiaResourceDialect,
4377    > {
4378        RouteTableProviderV6ProxyInterface::r#get_interface_local_table(self, credential)
4379    }
4380}
4381
4382impl RouteTableProviderV6ProxyInterface for RouteTableProviderV6Proxy {
4383    fn r#new_route_table(
4384        &self,
4385        mut provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
4386        mut options: &RouteTableOptionsV6,
4387    ) -> Result<(), fidl::Error> {
4388        self.client.send::<RouteTableProviderV6NewRouteTableRequest>(
4389            (provider, options),
4390            0x152b67b397a31ca,
4391            fidl::encoding::DynamicFlags::empty(),
4392        )
4393    }
4394
4395    type GetInterfaceLocalTableResponseFut = fidl::client::QueryResponseFut<
4396        RouteTableProviderV6GetInterfaceLocalTableResult,
4397        fidl::encoding::DefaultFuchsiaResourceDialect,
4398    >;
4399    fn r#get_interface_local_table(
4400        &self,
4401        mut credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
4402    ) -> Self::GetInterfaceLocalTableResponseFut {
4403        fn _decode(
4404            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4405        ) -> Result<RouteTableProviderV6GetInterfaceLocalTableResult, fidl::Error> {
4406            let _response = fidl::client::decode_transaction_body::<
4407                fidl::encoding::ResultType<
4408                    RouteTableProviderV6GetInterfaceLocalTableResponse,
4409                    GetInterfaceLocalTableError,
4410                >,
4411                fidl::encoding::DefaultFuchsiaResourceDialect,
4412                0x6f82c1d63c3081f5,
4413            >(_buf?)?;
4414            Ok(_response.map(|x| x.route_table))
4415        }
4416        self.client.send_query_and_decode::<
4417            RouteTableProviderV6GetInterfaceLocalTableRequest,
4418            RouteTableProviderV6GetInterfaceLocalTableResult,
4419        >(
4420            (&mut credential,),
4421            0x6f82c1d63c3081f5,
4422            fidl::encoding::DynamicFlags::empty(),
4423            _decode,
4424        )
4425    }
4426}
4427
4428pub struct RouteTableProviderV6EventStream {
4429    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4430}
4431
4432impl std::marker::Unpin for RouteTableProviderV6EventStream {}
4433
4434impl futures::stream::FusedStream for RouteTableProviderV6EventStream {
4435    fn is_terminated(&self) -> bool {
4436        self.event_receiver.is_terminated()
4437    }
4438}
4439
4440impl futures::Stream for RouteTableProviderV6EventStream {
4441    type Item = Result<RouteTableProviderV6Event, fidl::Error>;
4442
4443    fn poll_next(
4444        mut self: std::pin::Pin<&mut Self>,
4445        cx: &mut std::task::Context<'_>,
4446    ) -> std::task::Poll<Option<Self::Item>> {
4447        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4448            &mut self.event_receiver,
4449            cx
4450        )?) {
4451            Some(buf) => std::task::Poll::Ready(Some(RouteTableProviderV6Event::decode(buf))),
4452            None => std::task::Poll::Ready(None),
4453        }
4454    }
4455}
4456
4457#[derive(Debug)]
4458pub enum RouteTableProviderV6Event {}
4459
4460impl RouteTableProviderV6Event {
4461    /// Decodes a message buffer as a [`RouteTableProviderV6Event`].
4462    fn decode(
4463        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4464    ) -> Result<RouteTableProviderV6Event, fidl::Error> {
4465        let (bytes, _handles) = buf.split_mut();
4466        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4467        debug_assert_eq!(tx_header.tx_id, 0);
4468        match tx_header.ordinal {
4469            _ => Err(fidl::Error::UnknownOrdinal {
4470                ordinal: tx_header.ordinal,
4471                protocol_name:
4472                    <RouteTableProviderV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4473            }),
4474        }
4475    }
4476}
4477
4478/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableProviderV6.
4479pub struct RouteTableProviderV6RequestStream {
4480    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4481    is_terminated: bool,
4482}
4483
4484impl std::marker::Unpin for RouteTableProviderV6RequestStream {}
4485
4486impl futures::stream::FusedStream for RouteTableProviderV6RequestStream {
4487    fn is_terminated(&self) -> bool {
4488        self.is_terminated
4489    }
4490}
4491
4492impl fidl::endpoints::RequestStream for RouteTableProviderV6RequestStream {
4493    type Protocol = RouteTableProviderV6Marker;
4494    type ControlHandle = RouteTableProviderV6ControlHandle;
4495
4496    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4497        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4498    }
4499
4500    fn control_handle(&self) -> Self::ControlHandle {
4501        RouteTableProviderV6ControlHandle { inner: self.inner.clone() }
4502    }
4503
4504    fn into_inner(
4505        self,
4506    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4507    {
4508        (self.inner, self.is_terminated)
4509    }
4510
4511    fn from_inner(
4512        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4513        is_terminated: bool,
4514    ) -> Self {
4515        Self { inner, is_terminated }
4516    }
4517}
4518
4519impl futures::Stream for RouteTableProviderV6RequestStream {
4520    type Item = Result<RouteTableProviderV6Request, fidl::Error>;
4521
4522    fn poll_next(
4523        mut self: std::pin::Pin<&mut Self>,
4524        cx: &mut std::task::Context<'_>,
4525    ) -> std::task::Poll<Option<Self::Item>> {
4526        let this = &mut *self;
4527        if this.inner.check_shutdown(cx) {
4528            this.is_terminated = true;
4529            return std::task::Poll::Ready(None);
4530        }
4531        if this.is_terminated {
4532            panic!("polled RouteTableProviderV6RequestStream after completion");
4533        }
4534        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4535            |bytes, handles| {
4536                match this.inner.channel().read_etc(cx, bytes, handles) {
4537                    std::task::Poll::Ready(Ok(())) => {}
4538                    std::task::Poll::Pending => return std::task::Poll::Pending,
4539                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4540                        this.is_terminated = true;
4541                        return std::task::Poll::Ready(None);
4542                    }
4543                    std::task::Poll::Ready(Err(e)) => {
4544                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4545                            e.into(),
4546                        ))));
4547                    }
4548                }
4549
4550                // A message has been received from the channel
4551                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4552
4553                std::task::Poll::Ready(Some(match header.ordinal {
4554                0x152b67b397a31ca => {
4555                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4556                    let mut req = fidl::new_empty!(RouteTableProviderV6NewRouteTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4557                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteTableProviderV6NewRouteTableRequest>(&header, _body_bytes, handles, &mut req)?;
4558                    let control_handle = RouteTableProviderV6ControlHandle {
4559                        inner: this.inner.clone(),
4560                    };
4561                    Ok(RouteTableProviderV6Request::NewRouteTable {provider: req.provider,
4562options: req.options,
4563
4564                        control_handle,
4565                    })
4566                }
4567                0x6f82c1d63c3081f5 => {
4568                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4569                    let mut req = fidl::new_empty!(RouteTableProviderV6GetInterfaceLocalTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4570                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteTableProviderV6GetInterfaceLocalTableRequest>(&header, _body_bytes, handles, &mut req)?;
4571                    let control_handle = RouteTableProviderV6ControlHandle {
4572                        inner: this.inner.clone(),
4573                    };
4574                    Ok(RouteTableProviderV6Request::GetInterfaceLocalTable {credential: req.credential,
4575
4576                        responder: RouteTableProviderV6GetInterfaceLocalTableResponder {
4577                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4578                            tx_id: header.tx_id,
4579                        },
4580                    })
4581                }
4582                _ => Err(fidl::Error::UnknownOrdinal {
4583                    ordinal: header.ordinal,
4584                    protocol_name: <RouteTableProviderV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4585                }),
4586            }))
4587            },
4588        )
4589    }
4590}
4591
4592/// This protocol allows the client to create route tables.
4593#[derive(Debug)]
4594pub enum RouteTableProviderV6Request {
4595    /// Creates a new route table. If the client end of the `provider` is
4596    /// closed, the route table is removed (unless detached).
4597    NewRouteTable {
4598        provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
4599        options: RouteTableOptionsV6,
4600        control_handle: RouteTableProviderV6ControlHandle,
4601    },
4602    /// Gets the interface-local route table for this interface.
4603    ///
4604    /// + request credential of the interface to get local route table.
4605    /// - response client end of the `RouteTableV6` protocol if successfully.
4606    ///
4607    /// This table is only removed after the interface is removed AND all
4608    /// outstanding `RouteTableV6` channels are closed.
4609    ///
4610    /// Calling detach on the route table is a no-op.
4611    GetInterfaceLocalTable {
4612        credential: fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
4613        responder: RouteTableProviderV6GetInterfaceLocalTableResponder,
4614    },
4615}
4616
4617impl RouteTableProviderV6Request {
4618    #[allow(irrefutable_let_patterns)]
4619    pub fn into_new_route_table(
4620        self,
4621    ) -> Option<(
4622        fidl::endpoints::ServerEnd<RouteTableV6Marker>,
4623        RouteTableOptionsV6,
4624        RouteTableProviderV6ControlHandle,
4625    )> {
4626        if let RouteTableProviderV6Request::NewRouteTable { provider, options, control_handle } =
4627            self
4628        {
4629            Some((provider, options, control_handle))
4630        } else {
4631            None
4632        }
4633    }
4634
4635    #[allow(irrefutable_let_patterns)]
4636    pub fn into_get_interface_local_table(
4637        self,
4638    ) -> Option<(
4639        fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
4640        RouteTableProviderV6GetInterfaceLocalTableResponder,
4641    )> {
4642        if let RouteTableProviderV6Request::GetInterfaceLocalTable { credential, responder } = self
4643        {
4644            Some((credential, responder))
4645        } else {
4646            None
4647        }
4648    }
4649
4650    /// Name of the method defined in FIDL
4651    pub fn method_name(&self) -> &'static str {
4652        match *self {
4653            RouteTableProviderV6Request::NewRouteTable { .. } => "new_route_table",
4654            RouteTableProviderV6Request::GetInterfaceLocalTable { .. } => {
4655                "get_interface_local_table"
4656            }
4657        }
4658    }
4659}
4660
4661#[derive(Debug, Clone)]
4662pub struct RouteTableProviderV6ControlHandle {
4663    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4664}
4665
4666impl RouteTableProviderV6ControlHandle {
4667    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4668        self.inner.shutdown_with_epitaph(status.into())
4669    }
4670}
4671
4672impl fidl::endpoints::ControlHandle for RouteTableProviderV6ControlHandle {
4673    fn shutdown(&self) {
4674        self.inner.shutdown()
4675    }
4676
4677    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4678        self.inner.shutdown_with_epitaph(status)
4679    }
4680
4681    fn is_closed(&self) -> bool {
4682        self.inner.channel().is_closed()
4683    }
4684    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4685        self.inner.channel().on_closed()
4686    }
4687
4688    #[cfg(target_os = "fuchsia")]
4689    fn signal_peer(
4690        &self,
4691        clear_mask: zx::Signals,
4692        set_mask: zx::Signals,
4693    ) -> Result<(), zx_status::Status> {
4694        use fidl::Peered;
4695        self.inner.channel().signal_peer(clear_mask, set_mask)
4696    }
4697}
4698
4699impl RouteTableProviderV6ControlHandle {}
4700
4701#[must_use = "FIDL methods require a response to be sent"]
4702#[derive(Debug)]
4703pub struct RouteTableProviderV6GetInterfaceLocalTableResponder {
4704    control_handle: std::mem::ManuallyDrop<RouteTableProviderV6ControlHandle>,
4705    tx_id: u32,
4706}
4707
4708/// Set the the channel to be shutdown (see [`RouteTableProviderV6ControlHandle::shutdown`])
4709/// if the responder is dropped without sending a response, so that the client
4710/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4711impl std::ops::Drop for RouteTableProviderV6GetInterfaceLocalTableResponder {
4712    fn drop(&mut self) {
4713        self.control_handle.shutdown();
4714        // Safety: drops once, never accessed again
4715        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4716    }
4717}
4718
4719impl fidl::endpoints::Responder for RouteTableProviderV6GetInterfaceLocalTableResponder {
4720    type ControlHandle = RouteTableProviderV6ControlHandle;
4721
4722    fn control_handle(&self) -> &RouteTableProviderV6ControlHandle {
4723        &self.control_handle
4724    }
4725
4726    fn drop_without_shutdown(mut self) {
4727        // Safety: drops once, never accessed again due to mem::forget
4728        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4729        // Prevent Drop from running (which would shut down the channel)
4730        std::mem::forget(self);
4731    }
4732}
4733
4734impl RouteTableProviderV6GetInterfaceLocalTableResponder {
4735    /// Sends a response to the FIDL transaction.
4736    ///
4737    /// Sets the channel to shutdown if an error occurs.
4738    pub fn send(
4739        self,
4740        mut result: Result<
4741            fidl::endpoints::ClientEnd<RouteTableV6Marker>,
4742            GetInterfaceLocalTableError,
4743        >,
4744    ) -> Result<(), fidl::Error> {
4745        let _result = self.send_raw(result);
4746        if _result.is_err() {
4747            self.control_handle.shutdown();
4748        }
4749        self.drop_without_shutdown();
4750        _result
4751    }
4752
4753    /// Similar to "send" but does not shutdown the channel if an error occurs.
4754    pub fn send_no_shutdown_on_err(
4755        self,
4756        mut result: Result<
4757            fidl::endpoints::ClientEnd<RouteTableV6Marker>,
4758            GetInterfaceLocalTableError,
4759        >,
4760    ) -> Result<(), fidl::Error> {
4761        let _result = self.send_raw(result);
4762        self.drop_without_shutdown();
4763        _result
4764    }
4765
4766    fn send_raw(
4767        &self,
4768        mut result: Result<
4769            fidl::endpoints::ClientEnd<RouteTableV6Marker>,
4770            GetInterfaceLocalTableError,
4771        >,
4772    ) -> Result<(), fidl::Error> {
4773        self.control_handle.inner.send::<fidl::encoding::ResultType<
4774            RouteTableProviderV6GetInterfaceLocalTableResponse,
4775            GetInterfaceLocalTableError,
4776        >>(
4777            result.map(|route_table| (route_table,)),
4778            self.tx_id,
4779            0x6f82c1d63c3081f5,
4780            fidl::encoding::DynamicFlags::empty(),
4781        )
4782    }
4783}
4784
4785#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4786pub struct RouteTableV4Marker;
4787
4788impl fidl::endpoints::ProtocolMarker for RouteTableV4Marker {
4789    type Proxy = RouteTableV4Proxy;
4790    type RequestStream = RouteTableV4RequestStream;
4791    #[cfg(target_os = "fuchsia")]
4792    type SynchronousProxy = RouteTableV4SynchronousProxy;
4793
4794    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableV4";
4795}
4796impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableV4Marker {}
4797
4798pub trait RouteTableV4ProxyInterface: Send + Sync {
4799    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
4800    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
4801    fn r#detach(&self) -> Result<(), fidl::Error>;
4802    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
4803        + Send;
4804    fn r#remove(&self) -> Self::RemoveResponseFut;
4805    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
4806        + Send;
4807    fn r#get_authorization_for_route_table(&self)
4808    -> Self::GetAuthorizationForRouteTableResponseFut;
4809    fn r#new_route_set(
4810        &self,
4811        route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
4812    ) -> Result<(), fidl::Error>;
4813}
4814#[derive(Debug)]
4815#[cfg(target_os = "fuchsia")]
4816pub struct RouteTableV4SynchronousProxy {
4817    client: fidl::client::sync::Client,
4818}
4819
4820#[cfg(target_os = "fuchsia")]
4821impl fidl::endpoints::SynchronousProxy for RouteTableV4SynchronousProxy {
4822    type Proxy = RouteTableV4Proxy;
4823    type Protocol = RouteTableV4Marker;
4824
4825    fn from_channel(inner: fidl::Channel) -> Self {
4826        Self::new(inner)
4827    }
4828
4829    fn into_channel(self) -> fidl::Channel {
4830        self.client.into_channel()
4831    }
4832
4833    fn as_channel(&self) -> &fidl::Channel {
4834        self.client.as_channel()
4835    }
4836}
4837
4838#[cfg(target_os = "fuchsia")]
4839impl RouteTableV4SynchronousProxy {
4840    pub fn new(channel: fidl::Channel) -> Self {
4841        Self { client: fidl::client::sync::Client::new(channel) }
4842    }
4843
4844    pub fn into_channel(self) -> fidl::Channel {
4845        self.client.into_channel()
4846    }
4847
4848    /// Waits until an event arrives and returns it. It is safe for other
4849    /// threads to make concurrent requests while waiting for an event.
4850    pub fn wait_for_event(
4851        &self,
4852        deadline: zx::MonotonicInstant,
4853    ) -> Result<RouteTableV4Event, fidl::Error> {
4854        RouteTableV4Event::decode(self.client.wait_for_event::<RouteTableV4Marker>(deadline)?)
4855    }
4856
4857    /// Gets the table ID for this table.
4858    pub fn r#get_table_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
4859        let _response = self.client.send_query::<
4860            fidl::encoding::EmptyPayload,
4861            BaseRouteTableGetTableIdResponse,
4862            RouteTableV4Marker,
4863        >(
4864            (),
4865            0x7eab30c55edbfc15,
4866            fidl::encoding::DynamicFlags::empty(),
4867            ___deadline,
4868        )?;
4869        Ok(_response.table_id)
4870    }
4871
4872    /// Detaches the lifetime of the route table from the lifetime of the
4873    /// client end of the channel.
4874    ///
4875    /// After this method is called, the route table will not be removed
4876    /// if the client end is closed. It's a no-op if called on the main table.
4877    pub fn r#detach(&self) -> Result<(), fidl::Error> {
4878        self.client.send::<fidl::encoding::EmptyPayload>(
4879            (),
4880            0x2853ab157285b384,
4881            fidl::encoding::DynamicFlags::empty(),
4882        )
4883    }
4884
4885    /// Removes the route table explicitly.
4886    ///
4887    /// This method cannot be called on the main table or an interface-local
4888    /// table, an error will be returned if called. The server will close the
4889    /// channel after this method successfully returns.
4890    pub fn r#remove(
4891        &self,
4892        ___deadline: zx::MonotonicInstant,
4893    ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
4894        let _response =
4895            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
4896                fidl::encoding::EmptyStruct,
4897                BaseRouteTableRemoveError,
4898            >, RouteTableV4Marker>(
4899                (),
4900                0xc42e58a5fc79426,
4901                fidl::encoding::DynamicFlags::empty(),
4902                ___deadline,
4903            )?;
4904        Ok(_response.map(|x| x))
4905    }
4906
4907    /// Gets an authentication credential for this table.
4908    ///
4909    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
4910    /// held by the server. This credential can be passed into
4911    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
4912    /// table. The `EVENT` is stable throughout the lifetime of the route table.
4913    /// Clients may duplicate this `EVENT` to make multiple API calls, or
4914    /// transfer the `EVENT` to other clients.
4915    ///
4916    /// - response `credential` the authorization credential for this table.
4917    pub fn r#get_authorization_for_route_table(
4918        &self,
4919        ___deadline: zx::MonotonicInstant,
4920    ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
4921        let _response = self.client.send_query::<
4922            fidl::encoding::EmptyPayload,
4923            BaseRouteTableGetAuthorizationForRouteTableResponse,
4924            RouteTableV4Marker,
4925        >(
4926            (),
4927            0x56a48c921ff3b6eb,
4928            fidl::encoding::DynamicFlags::empty(),
4929            ___deadline,
4930        )?;
4931        Ok(_response.credential)
4932    }
4933
4934    /// Creates an empty route set.
4935    ///
4936    /// + request `route_set` grants access to the [`RouteSetV4`] protocol.
4937    pub fn r#new_route_set(
4938        &self,
4939        mut route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
4940    ) -> Result<(), fidl::Error> {
4941        self.client.send::<RouteTableV4NewRouteSetRequest>(
4942            (route_set,),
4943            0x6aeb6d05698abedb,
4944            fidl::encoding::DynamicFlags::empty(),
4945        )
4946    }
4947}
4948
4949#[cfg(target_os = "fuchsia")]
4950impl From<RouteTableV4SynchronousProxy> for zx::NullableHandle {
4951    fn from(value: RouteTableV4SynchronousProxy) -> Self {
4952        value.into_channel().into()
4953    }
4954}
4955
4956#[cfg(target_os = "fuchsia")]
4957impl From<fidl::Channel> for RouteTableV4SynchronousProxy {
4958    fn from(value: fidl::Channel) -> Self {
4959        Self::new(value)
4960    }
4961}
4962
4963#[cfg(target_os = "fuchsia")]
4964impl fidl::endpoints::FromClient for RouteTableV4SynchronousProxy {
4965    type Protocol = RouteTableV4Marker;
4966
4967    fn from_client(value: fidl::endpoints::ClientEnd<RouteTableV4Marker>) -> Self {
4968        Self::new(value.into_channel())
4969    }
4970}
4971
4972#[derive(Debug, Clone)]
4973pub struct RouteTableV4Proxy {
4974    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4975}
4976
4977impl fidl::endpoints::Proxy for RouteTableV4Proxy {
4978    type Protocol = RouteTableV4Marker;
4979
4980    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4981        Self::new(inner)
4982    }
4983
4984    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4985        self.client.into_channel().map_err(|client| Self { client })
4986    }
4987
4988    fn as_channel(&self) -> &::fidl::AsyncChannel {
4989        self.client.as_channel()
4990    }
4991}
4992
4993impl RouteTableV4Proxy {
4994    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableV4.
4995    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4996        let protocol_name = <RouteTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4997        Self { client: fidl::client::Client::new(channel, protocol_name) }
4998    }
4999
5000    /// Get a Stream of events from the remote end of the protocol.
5001    ///
5002    /// # Panics
5003    ///
5004    /// Panics if the event stream was already taken.
5005    pub fn take_event_stream(&self) -> RouteTableV4EventStream {
5006        RouteTableV4EventStream { event_receiver: self.client.take_event_receiver() }
5007    }
5008
5009    /// Gets the table ID for this table.
5010    pub fn r#get_table_id(
5011        &self,
5012    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
5013        RouteTableV4ProxyInterface::r#get_table_id(self)
5014    }
5015
5016    /// Detaches the lifetime of the route table from the lifetime of the
5017    /// client end of the channel.
5018    ///
5019    /// After this method is called, the route table will not be removed
5020    /// if the client end is closed. It's a no-op if called on the main table.
5021    pub fn r#detach(&self) -> Result<(), fidl::Error> {
5022        RouteTableV4ProxyInterface::r#detach(self)
5023    }
5024
5025    /// Removes the route table explicitly.
5026    ///
5027    /// This method cannot be called on the main table or an interface-local
5028    /// table, an error will be returned if called. The server will close the
5029    /// channel after this method successfully returns.
5030    pub fn r#remove(
5031        &self,
5032    ) -> fidl::client::QueryResponseFut<
5033        BaseRouteTableRemoveResult,
5034        fidl::encoding::DefaultFuchsiaResourceDialect,
5035    > {
5036        RouteTableV4ProxyInterface::r#remove(self)
5037    }
5038
5039    /// Gets an authentication credential for this table.
5040    ///
5041    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
5042    /// held by the server. This credential can be passed into
5043    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
5044    /// table. The `EVENT` is stable throughout the lifetime of the route table.
5045    /// Clients may duplicate this `EVENT` to make multiple API calls, or
5046    /// transfer the `EVENT` to other clients.
5047    ///
5048    /// - response `credential` the authorization credential for this table.
5049    pub fn r#get_authorization_for_route_table(
5050        &self,
5051    ) -> fidl::client::QueryResponseFut<
5052        GrantForRouteTableAuthorization,
5053        fidl::encoding::DefaultFuchsiaResourceDialect,
5054    > {
5055        RouteTableV4ProxyInterface::r#get_authorization_for_route_table(self)
5056    }
5057
5058    /// Creates an empty route set.
5059    ///
5060    /// + request `route_set` grants access to the [`RouteSetV4`] protocol.
5061    pub fn r#new_route_set(
5062        &self,
5063        mut route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
5064    ) -> Result<(), fidl::Error> {
5065        RouteTableV4ProxyInterface::r#new_route_set(self, route_set)
5066    }
5067}
5068
5069impl RouteTableV4ProxyInterface for RouteTableV4Proxy {
5070    type GetTableIdResponseFut =
5071        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
5072    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
5073        fn _decode(
5074            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5075        ) -> Result<u32, fidl::Error> {
5076            let _response = fidl::client::decode_transaction_body::<
5077                BaseRouteTableGetTableIdResponse,
5078                fidl::encoding::DefaultFuchsiaResourceDialect,
5079                0x7eab30c55edbfc15,
5080            >(_buf?)?;
5081            Ok(_response.table_id)
5082        }
5083        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
5084            (),
5085            0x7eab30c55edbfc15,
5086            fidl::encoding::DynamicFlags::empty(),
5087            _decode,
5088        )
5089    }
5090
5091    fn r#detach(&self) -> Result<(), fidl::Error> {
5092        self.client.send::<fidl::encoding::EmptyPayload>(
5093            (),
5094            0x2853ab157285b384,
5095            fidl::encoding::DynamicFlags::empty(),
5096        )
5097    }
5098
5099    type RemoveResponseFut = fidl::client::QueryResponseFut<
5100        BaseRouteTableRemoveResult,
5101        fidl::encoding::DefaultFuchsiaResourceDialect,
5102    >;
5103    fn r#remove(&self) -> Self::RemoveResponseFut {
5104        fn _decode(
5105            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5106        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
5107            let _response = fidl::client::decode_transaction_body::<
5108                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
5109                fidl::encoding::DefaultFuchsiaResourceDialect,
5110                0xc42e58a5fc79426,
5111            >(_buf?)?;
5112            Ok(_response.map(|x| x))
5113        }
5114        self.client
5115            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
5116                (),
5117                0xc42e58a5fc79426,
5118                fidl::encoding::DynamicFlags::empty(),
5119                _decode,
5120            )
5121    }
5122
5123    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
5124        GrantForRouteTableAuthorization,
5125        fidl::encoding::DefaultFuchsiaResourceDialect,
5126    >;
5127    fn r#get_authorization_for_route_table(
5128        &self,
5129    ) -> Self::GetAuthorizationForRouteTableResponseFut {
5130        fn _decode(
5131            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5132        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
5133            let _response = fidl::client::decode_transaction_body::<
5134                BaseRouteTableGetAuthorizationForRouteTableResponse,
5135                fidl::encoding::DefaultFuchsiaResourceDialect,
5136                0x56a48c921ff3b6eb,
5137            >(_buf?)?;
5138            Ok(_response.credential)
5139        }
5140        self.client
5141            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
5142                (),
5143                0x56a48c921ff3b6eb,
5144                fidl::encoding::DynamicFlags::empty(),
5145                _decode,
5146            )
5147    }
5148
5149    fn r#new_route_set(
5150        &self,
5151        mut route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
5152    ) -> Result<(), fidl::Error> {
5153        self.client.send::<RouteTableV4NewRouteSetRequest>(
5154            (route_set,),
5155            0x6aeb6d05698abedb,
5156            fidl::encoding::DynamicFlags::empty(),
5157        )
5158    }
5159}
5160
5161pub struct RouteTableV4EventStream {
5162    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5163}
5164
5165impl std::marker::Unpin for RouteTableV4EventStream {}
5166
5167impl futures::stream::FusedStream for RouteTableV4EventStream {
5168    fn is_terminated(&self) -> bool {
5169        self.event_receiver.is_terminated()
5170    }
5171}
5172
5173impl futures::Stream for RouteTableV4EventStream {
5174    type Item = Result<RouteTableV4Event, fidl::Error>;
5175
5176    fn poll_next(
5177        mut self: std::pin::Pin<&mut Self>,
5178        cx: &mut std::task::Context<'_>,
5179    ) -> std::task::Poll<Option<Self::Item>> {
5180        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5181            &mut self.event_receiver,
5182            cx
5183        )?) {
5184            Some(buf) => std::task::Poll::Ready(Some(RouteTableV4Event::decode(buf))),
5185            None => std::task::Poll::Ready(None),
5186        }
5187    }
5188}
5189
5190#[derive(Debug)]
5191pub enum RouteTableV4Event {}
5192
5193impl RouteTableV4Event {
5194    /// Decodes a message buffer as a [`RouteTableV4Event`].
5195    fn decode(
5196        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5197    ) -> Result<RouteTableV4Event, fidl::Error> {
5198        let (bytes, _handles) = buf.split_mut();
5199        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5200        debug_assert_eq!(tx_header.tx_id, 0);
5201        match tx_header.ordinal {
5202            _ => Err(fidl::Error::UnknownOrdinal {
5203                ordinal: tx_header.ordinal,
5204                protocol_name: <RouteTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5205            }),
5206        }
5207    }
5208}
5209
5210/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableV4.
5211pub struct RouteTableV4RequestStream {
5212    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5213    is_terminated: bool,
5214}
5215
5216impl std::marker::Unpin for RouteTableV4RequestStream {}
5217
5218impl futures::stream::FusedStream for RouteTableV4RequestStream {
5219    fn is_terminated(&self) -> bool {
5220        self.is_terminated
5221    }
5222}
5223
5224impl fidl::endpoints::RequestStream for RouteTableV4RequestStream {
5225    type Protocol = RouteTableV4Marker;
5226    type ControlHandle = RouteTableV4ControlHandle;
5227
5228    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5229        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5230    }
5231
5232    fn control_handle(&self) -> Self::ControlHandle {
5233        RouteTableV4ControlHandle { inner: self.inner.clone() }
5234    }
5235
5236    fn into_inner(
5237        self,
5238    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5239    {
5240        (self.inner, self.is_terminated)
5241    }
5242
5243    fn from_inner(
5244        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5245        is_terminated: bool,
5246    ) -> Self {
5247        Self { inner, is_terminated }
5248    }
5249}
5250
5251impl futures::Stream for RouteTableV4RequestStream {
5252    type Item = Result<RouteTableV4Request, fidl::Error>;
5253
5254    fn poll_next(
5255        mut self: std::pin::Pin<&mut Self>,
5256        cx: &mut std::task::Context<'_>,
5257    ) -> std::task::Poll<Option<Self::Item>> {
5258        let this = &mut *self;
5259        if this.inner.check_shutdown(cx) {
5260            this.is_terminated = true;
5261            return std::task::Poll::Ready(None);
5262        }
5263        if this.is_terminated {
5264            panic!("polled RouteTableV4RequestStream after completion");
5265        }
5266        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5267            |bytes, handles| {
5268                match this.inner.channel().read_etc(cx, bytes, handles) {
5269                    std::task::Poll::Ready(Ok(())) => {}
5270                    std::task::Poll::Pending => return std::task::Poll::Pending,
5271                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5272                        this.is_terminated = true;
5273                        return std::task::Poll::Ready(None);
5274                    }
5275                    std::task::Poll::Ready(Err(e)) => {
5276                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5277                            e.into(),
5278                        ))));
5279                    }
5280                }
5281
5282                // A message has been received from the channel
5283                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5284
5285                std::task::Poll::Ready(Some(match header.ordinal {
5286                    0x7eab30c55edbfc15 => {
5287                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5288                        let mut req = fidl::new_empty!(
5289                            fidl::encoding::EmptyPayload,
5290                            fidl::encoding::DefaultFuchsiaResourceDialect
5291                        );
5292                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5293                        let control_handle =
5294                            RouteTableV4ControlHandle { inner: this.inner.clone() };
5295                        Ok(RouteTableV4Request::GetTableId {
5296                            responder: RouteTableV4GetTableIdResponder {
5297                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5298                                tx_id: header.tx_id,
5299                            },
5300                        })
5301                    }
5302                    0x2853ab157285b384 => {
5303                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5304                        let mut req = fidl::new_empty!(
5305                            fidl::encoding::EmptyPayload,
5306                            fidl::encoding::DefaultFuchsiaResourceDialect
5307                        );
5308                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5309                        let control_handle =
5310                            RouteTableV4ControlHandle { inner: this.inner.clone() };
5311                        Ok(RouteTableV4Request::Detach { control_handle })
5312                    }
5313                    0xc42e58a5fc79426 => {
5314                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5315                        let mut req = fidl::new_empty!(
5316                            fidl::encoding::EmptyPayload,
5317                            fidl::encoding::DefaultFuchsiaResourceDialect
5318                        );
5319                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5320                        let control_handle =
5321                            RouteTableV4ControlHandle { inner: this.inner.clone() };
5322                        Ok(RouteTableV4Request::Remove {
5323                            responder: RouteTableV4RemoveResponder {
5324                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5325                                tx_id: header.tx_id,
5326                            },
5327                        })
5328                    }
5329                    0x56a48c921ff3b6eb => {
5330                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5331                        let mut req = fidl::new_empty!(
5332                            fidl::encoding::EmptyPayload,
5333                            fidl::encoding::DefaultFuchsiaResourceDialect
5334                        );
5335                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5336                        let control_handle =
5337                            RouteTableV4ControlHandle { inner: this.inner.clone() };
5338                        Ok(RouteTableV4Request::GetAuthorizationForRouteTable {
5339                            responder: RouteTableV4GetAuthorizationForRouteTableResponder {
5340                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5341                                tx_id: header.tx_id,
5342                            },
5343                        })
5344                    }
5345                    0x6aeb6d05698abedb => {
5346                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5347                        let mut req = fidl::new_empty!(
5348                            RouteTableV4NewRouteSetRequest,
5349                            fidl::encoding::DefaultFuchsiaResourceDialect
5350                        );
5351                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteTableV4NewRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
5352                        let control_handle =
5353                            RouteTableV4ControlHandle { inner: this.inner.clone() };
5354                        Ok(RouteTableV4Request::NewRouteSet {
5355                            route_set: req.route_set,
5356
5357                            control_handle,
5358                        })
5359                    }
5360                    _ => Err(fidl::Error::UnknownOrdinal {
5361                        ordinal: header.ordinal,
5362                        protocol_name:
5363                            <RouteTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5364                    }),
5365                }))
5366            },
5367        )
5368    }
5369}
5370
5371/// Vends isolated administrative access to the system's IPv4 routing table.
5372///
5373/// A main route table is accessible through the discoverable [`RouteTableV4`]
5374/// protocol. Other tables can be installed using the `NewRouteTable` method
5375/// on [`RouteTableProviderV4`]. The [`RouteTableV4`] also encodes the lifetime
5376/// of the underlying route table, dropping the client end of the protocol
5377/// causes the underlying route table to be removed unless it is detached. The
5378/// main table is detached by default.
5379#[derive(Debug)]
5380pub enum RouteTableV4Request {
5381    /// Gets the table ID for this table.
5382    GetTableId { responder: RouteTableV4GetTableIdResponder },
5383    /// Detaches the lifetime of the route table from the lifetime of the
5384    /// client end of the channel.
5385    ///
5386    /// After this method is called, the route table will not be removed
5387    /// if the client end is closed. It's a no-op if called on the main table.
5388    Detach { control_handle: RouteTableV4ControlHandle },
5389    /// Removes the route table explicitly.
5390    ///
5391    /// This method cannot be called on the main table or an interface-local
5392    /// table, an error will be returned if called. The server will close the
5393    /// channel after this method successfully returns.
5394    Remove { responder: RouteTableV4RemoveResponder },
5395    /// Gets an authentication credential for this table.
5396    ///
5397    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
5398    /// held by the server. This credential can be passed into
5399    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
5400    /// table. The `EVENT` is stable throughout the lifetime of the route table.
5401    /// Clients may duplicate this `EVENT` to make multiple API calls, or
5402    /// transfer the `EVENT` to other clients.
5403    ///
5404    /// - response `credential` the authorization credential for this table.
5405    GetAuthorizationForRouteTable { responder: RouteTableV4GetAuthorizationForRouteTableResponder },
5406    /// Creates an empty route set.
5407    ///
5408    /// + request `route_set` grants access to the [`RouteSetV4`] protocol.
5409    NewRouteSet {
5410        route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
5411        control_handle: RouteTableV4ControlHandle,
5412    },
5413}
5414
5415impl RouteTableV4Request {
5416    #[allow(irrefutable_let_patterns)]
5417    pub fn into_get_table_id(self) -> Option<(RouteTableV4GetTableIdResponder)> {
5418        if let RouteTableV4Request::GetTableId { responder } = self {
5419            Some((responder))
5420        } else {
5421            None
5422        }
5423    }
5424
5425    #[allow(irrefutable_let_patterns)]
5426    pub fn into_detach(self) -> Option<(RouteTableV4ControlHandle)> {
5427        if let RouteTableV4Request::Detach { control_handle } = self {
5428            Some((control_handle))
5429        } else {
5430            None
5431        }
5432    }
5433
5434    #[allow(irrefutable_let_patterns)]
5435    pub fn into_remove(self) -> Option<(RouteTableV4RemoveResponder)> {
5436        if let RouteTableV4Request::Remove { responder } = self { Some((responder)) } else { None }
5437    }
5438
5439    #[allow(irrefutable_let_patterns)]
5440    pub fn into_get_authorization_for_route_table(
5441        self,
5442    ) -> Option<(RouteTableV4GetAuthorizationForRouteTableResponder)> {
5443        if let RouteTableV4Request::GetAuthorizationForRouteTable { responder } = self {
5444            Some((responder))
5445        } else {
5446            None
5447        }
5448    }
5449
5450    #[allow(irrefutable_let_patterns)]
5451    pub fn into_new_route_set(
5452        self,
5453    ) -> Option<(fidl::endpoints::ServerEnd<RouteSetV4Marker>, RouteTableV4ControlHandle)> {
5454        if let RouteTableV4Request::NewRouteSet { route_set, control_handle } = self {
5455            Some((route_set, control_handle))
5456        } else {
5457            None
5458        }
5459    }
5460
5461    /// Name of the method defined in FIDL
5462    pub fn method_name(&self) -> &'static str {
5463        match *self {
5464            RouteTableV4Request::GetTableId { .. } => "get_table_id",
5465            RouteTableV4Request::Detach { .. } => "detach",
5466            RouteTableV4Request::Remove { .. } => "remove",
5467            RouteTableV4Request::GetAuthorizationForRouteTable { .. } => {
5468                "get_authorization_for_route_table"
5469            }
5470            RouteTableV4Request::NewRouteSet { .. } => "new_route_set",
5471        }
5472    }
5473}
5474
5475#[derive(Debug, Clone)]
5476pub struct RouteTableV4ControlHandle {
5477    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5478}
5479
5480impl RouteTableV4ControlHandle {
5481    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5482        self.inner.shutdown_with_epitaph(status.into())
5483    }
5484}
5485
5486impl fidl::endpoints::ControlHandle for RouteTableV4ControlHandle {
5487    fn shutdown(&self) {
5488        self.inner.shutdown()
5489    }
5490
5491    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5492        self.inner.shutdown_with_epitaph(status)
5493    }
5494
5495    fn is_closed(&self) -> bool {
5496        self.inner.channel().is_closed()
5497    }
5498    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5499        self.inner.channel().on_closed()
5500    }
5501
5502    #[cfg(target_os = "fuchsia")]
5503    fn signal_peer(
5504        &self,
5505        clear_mask: zx::Signals,
5506        set_mask: zx::Signals,
5507    ) -> Result<(), zx_status::Status> {
5508        use fidl::Peered;
5509        self.inner.channel().signal_peer(clear_mask, set_mask)
5510    }
5511}
5512
5513impl RouteTableV4ControlHandle {}
5514
5515#[must_use = "FIDL methods require a response to be sent"]
5516#[derive(Debug)]
5517pub struct RouteTableV4GetTableIdResponder {
5518    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
5519    tx_id: u32,
5520}
5521
5522/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
5523/// if the responder is dropped without sending a response, so that the client
5524/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5525impl std::ops::Drop for RouteTableV4GetTableIdResponder {
5526    fn drop(&mut self) {
5527        self.control_handle.shutdown();
5528        // Safety: drops once, never accessed again
5529        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5530    }
5531}
5532
5533impl fidl::endpoints::Responder for RouteTableV4GetTableIdResponder {
5534    type ControlHandle = RouteTableV4ControlHandle;
5535
5536    fn control_handle(&self) -> &RouteTableV4ControlHandle {
5537        &self.control_handle
5538    }
5539
5540    fn drop_without_shutdown(mut self) {
5541        // Safety: drops once, never accessed again due to mem::forget
5542        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5543        // Prevent Drop from running (which would shut down the channel)
5544        std::mem::forget(self);
5545    }
5546}
5547
5548impl RouteTableV4GetTableIdResponder {
5549    /// Sends a response to the FIDL transaction.
5550    ///
5551    /// Sets the channel to shutdown if an error occurs.
5552    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
5553        let _result = self.send_raw(table_id);
5554        if _result.is_err() {
5555            self.control_handle.shutdown();
5556        }
5557        self.drop_without_shutdown();
5558        _result
5559    }
5560
5561    /// Similar to "send" but does not shutdown the channel if an error occurs.
5562    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
5563        let _result = self.send_raw(table_id);
5564        self.drop_without_shutdown();
5565        _result
5566    }
5567
5568    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
5569        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
5570            (table_id,),
5571            self.tx_id,
5572            0x7eab30c55edbfc15,
5573            fidl::encoding::DynamicFlags::empty(),
5574        )
5575    }
5576}
5577
5578#[must_use = "FIDL methods require a response to be sent"]
5579#[derive(Debug)]
5580pub struct RouteTableV4RemoveResponder {
5581    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
5582    tx_id: u32,
5583}
5584
5585/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
5586/// if the responder is dropped without sending a response, so that the client
5587/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5588impl std::ops::Drop for RouteTableV4RemoveResponder {
5589    fn drop(&mut self) {
5590        self.control_handle.shutdown();
5591        // Safety: drops once, never accessed again
5592        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5593    }
5594}
5595
5596impl fidl::endpoints::Responder for RouteTableV4RemoveResponder {
5597    type ControlHandle = RouteTableV4ControlHandle;
5598
5599    fn control_handle(&self) -> &RouteTableV4ControlHandle {
5600        &self.control_handle
5601    }
5602
5603    fn drop_without_shutdown(mut self) {
5604        // Safety: drops once, never accessed again due to mem::forget
5605        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5606        // Prevent Drop from running (which would shut down the channel)
5607        std::mem::forget(self);
5608    }
5609}
5610
5611impl RouteTableV4RemoveResponder {
5612    /// Sends a response to the FIDL transaction.
5613    ///
5614    /// Sets the channel to shutdown if an error occurs.
5615    pub fn send(
5616        self,
5617        mut result: Result<(), BaseRouteTableRemoveError>,
5618    ) -> Result<(), fidl::Error> {
5619        let _result = self.send_raw(result);
5620        if _result.is_err() {
5621            self.control_handle.shutdown();
5622        }
5623        self.drop_without_shutdown();
5624        _result
5625    }
5626
5627    /// Similar to "send" but does not shutdown the channel if an error occurs.
5628    pub fn send_no_shutdown_on_err(
5629        self,
5630        mut result: Result<(), BaseRouteTableRemoveError>,
5631    ) -> Result<(), fidl::Error> {
5632        let _result = self.send_raw(result);
5633        self.drop_without_shutdown();
5634        _result
5635    }
5636
5637    fn send_raw(
5638        &self,
5639        mut result: Result<(), BaseRouteTableRemoveError>,
5640    ) -> Result<(), fidl::Error> {
5641        self.control_handle.inner.send::<fidl::encoding::ResultType<
5642            fidl::encoding::EmptyStruct,
5643            BaseRouteTableRemoveError,
5644        >>(
5645            result,
5646            self.tx_id,
5647            0xc42e58a5fc79426,
5648            fidl::encoding::DynamicFlags::empty(),
5649        )
5650    }
5651}
5652
5653#[must_use = "FIDL methods require a response to be sent"]
5654#[derive(Debug)]
5655pub struct RouteTableV4GetAuthorizationForRouteTableResponder {
5656    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
5657    tx_id: u32,
5658}
5659
5660/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
5661/// if the responder is dropped without sending a response, so that the client
5662/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5663impl std::ops::Drop for RouteTableV4GetAuthorizationForRouteTableResponder {
5664    fn drop(&mut self) {
5665        self.control_handle.shutdown();
5666        // Safety: drops once, never accessed again
5667        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5668    }
5669}
5670
5671impl fidl::endpoints::Responder for RouteTableV4GetAuthorizationForRouteTableResponder {
5672    type ControlHandle = RouteTableV4ControlHandle;
5673
5674    fn control_handle(&self) -> &RouteTableV4ControlHandle {
5675        &self.control_handle
5676    }
5677
5678    fn drop_without_shutdown(mut self) {
5679        // Safety: drops once, never accessed again due to mem::forget
5680        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5681        // Prevent Drop from running (which would shut down the channel)
5682        std::mem::forget(self);
5683    }
5684}
5685
5686impl RouteTableV4GetAuthorizationForRouteTableResponder {
5687    /// Sends a response to the FIDL transaction.
5688    ///
5689    /// Sets the channel to shutdown if an error occurs.
5690    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
5691        let _result = self.send_raw(credential);
5692        if _result.is_err() {
5693            self.control_handle.shutdown();
5694        }
5695        self.drop_without_shutdown();
5696        _result
5697    }
5698
5699    /// Similar to "send" but does not shutdown the channel if an error occurs.
5700    pub fn send_no_shutdown_on_err(
5701        self,
5702        mut credential: GrantForRouteTableAuthorization,
5703    ) -> Result<(), fidl::Error> {
5704        let _result = self.send_raw(credential);
5705        self.drop_without_shutdown();
5706        _result
5707    }
5708
5709    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
5710        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
5711            (&mut credential,),
5712            self.tx_id,
5713            0x56a48c921ff3b6eb,
5714            fidl::encoding::DynamicFlags::empty(),
5715        )
5716    }
5717}
5718
5719#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5720pub struct RouteTableV6Marker;
5721
5722impl fidl::endpoints::ProtocolMarker for RouteTableV6Marker {
5723    type Proxy = RouteTableV6Proxy;
5724    type RequestStream = RouteTableV6RequestStream;
5725    #[cfg(target_os = "fuchsia")]
5726    type SynchronousProxy = RouteTableV6SynchronousProxy;
5727
5728    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableV6";
5729}
5730impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableV6Marker {}
5731
5732pub trait RouteTableV6ProxyInterface: Send + Sync {
5733    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
5734    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
5735    fn r#detach(&self) -> Result<(), fidl::Error>;
5736    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
5737        + Send;
5738    fn r#remove(&self) -> Self::RemoveResponseFut;
5739    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
5740        + Send;
5741    fn r#get_authorization_for_route_table(&self)
5742    -> Self::GetAuthorizationForRouteTableResponseFut;
5743    fn r#new_route_set(
5744        &self,
5745        route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
5746    ) -> Result<(), fidl::Error>;
5747}
5748#[derive(Debug)]
5749#[cfg(target_os = "fuchsia")]
5750pub struct RouteTableV6SynchronousProxy {
5751    client: fidl::client::sync::Client,
5752}
5753
5754#[cfg(target_os = "fuchsia")]
5755impl fidl::endpoints::SynchronousProxy for RouteTableV6SynchronousProxy {
5756    type Proxy = RouteTableV6Proxy;
5757    type Protocol = RouteTableV6Marker;
5758
5759    fn from_channel(inner: fidl::Channel) -> Self {
5760        Self::new(inner)
5761    }
5762
5763    fn into_channel(self) -> fidl::Channel {
5764        self.client.into_channel()
5765    }
5766
5767    fn as_channel(&self) -> &fidl::Channel {
5768        self.client.as_channel()
5769    }
5770}
5771
5772#[cfg(target_os = "fuchsia")]
5773impl RouteTableV6SynchronousProxy {
5774    pub fn new(channel: fidl::Channel) -> Self {
5775        Self { client: fidl::client::sync::Client::new(channel) }
5776    }
5777
5778    pub fn into_channel(self) -> fidl::Channel {
5779        self.client.into_channel()
5780    }
5781
5782    /// Waits until an event arrives and returns it. It is safe for other
5783    /// threads to make concurrent requests while waiting for an event.
5784    pub fn wait_for_event(
5785        &self,
5786        deadline: zx::MonotonicInstant,
5787    ) -> Result<RouteTableV6Event, fidl::Error> {
5788        RouteTableV6Event::decode(self.client.wait_for_event::<RouteTableV6Marker>(deadline)?)
5789    }
5790
5791    /// Gets the table ID for this table.
5792    pub fn r#get_table_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
5793        let _response = self.client.send_query::<
5794            fidl::encoding::EmptyPayload,
5795            BaseRouteTableGetTableIdResponse,
5796            RouteTableV6Marker,
5797        >(
5798            (),
5799            0x7eab30c55edbfc15,
5800            fidl::encoding::DynamicFlags::empty(),
5801            ___deadline,
5802        )?;
5803        Ok(_response.table_id)
5804    }
5805
5806    /// Detaches the lifetime of the route table from the lifetime of the
5807    /// client end of the channel.
5808    ///
5809    /// After this method is called, the route table will not be removed
5810    /// if the client end is closed. It's a no-op if called on the main table.
5811    pub fn r#detach(&self) -> Result<(), fidl::Error> {
5812        self.client.send::<fidl::encoding::EmptyPayload>(
5813            (),
5814            0x2853ab157285b384,
5815            fidl::encoding::DynamicFlags::empty(),
5816        )
5817    }
5818
5819    /// Removes the route table explicitly.
5820    ///
5821    /// This method cannot be called on the main table or an interface-local
5822    /// table, an error will be returned if called. The server will close the
5823    /// channel after this method successfully returns.
5824    pub fn r#remove(
5825        &self,
5826        ___deadline: zx::MonotonicInstant,
5827    ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
5828        let _response =
5829            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
5830                fidl::encoding::EmptyStruct,
5831                BaseRouteTableRemoveError,
5832            >, RouteTableV6Marker>(
5833                (),
5834                0xc42e58a5fc79426,
5835                fidl::encoding::DynamicFlags::empty(),
5836                ___deadline,
5837            )?;
5838        Ok(_response.map(|x| x))
5839    }
5840
5841    /// Gets an authentication credential for this table.
5842    ///
5843    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
5844    /// held by the server. This credential can be passed into
5845    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
5846    /// table. The `EVENT` is stable throughout the lifetime of the route table.
5847    /// Clients may duplicate this `EVENT` to make multiple API calls, or
5848    /// transfer the `EVENT` to other clients.
5849    ///
5850    /// - response `credential` the authorization credential for this table.
5851    pub fn r#get_authorization_for_route_table(
5852        &self,
5853        ___deadline: zx::MonotonicInstant,
5854    ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
5855        let _response = self.client.send_query::<
5856            fidl::encoding::EmptyPayload,
5857            BaseRouteTableGetAuthorizationForRouteTableResponse,
5858            RouteTableV6Marker,
5859        >(
5860            (),
5861            0x56a48c921ff3b6eb,
5862            fidl::encoding::DynamicFlags::empty(),
5863            ___deadline,
5864        )?;
5865        Ok(_response.credential)
5866    }
5867
5868    /// Creates an empty route set.
5869    ///
5870    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
5871    pub fn r#new_route_set(
5872        &self,
5873        mut route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
5874    ) -> Result<(), fidl::Error> {
5875        self.client.send::<RouteTableV6NewRouteSetRequest>(
5876            (route_set,),
5877            0x479aeaf9ad470141,
5878            fidl::encoding::DynamicFlags::empty(),
5879        )
5880    }
5881}
5882
5883#[cfg(target_os = "fuchsia")]
5884impl From<RouteTableV6SynchronousProxy> for zx::NullableHandle {
5885    fn from(value: RouteTableV6SynchronousProxy) -> Self {
5886        value.into_channel().into()
5887    }
5888}
5889
5890#[cfg(target_os = "fuchsia")]
5891impl From<fidl::Channel> for RouteTableV6SynchronousProxy {
5892    fn from(value: fidl::Channel) -> Self {
5893        Self::new(value)
5894    }
5895}
5896
5897#[cfg(target_os = "fuchsia")]
5898impl fidl::endpoints::FromClient for RouteTableV6SynchronousProxy {
5899    type Protocol = RouteTableV6Marker;
5900
5901    fn from_client(value: fidl::endpoints::ClientEnd<RouteTableV6Marker>) -> Self {
5902        Self::new(value.into_channel())
5903    }
5904}
5905
5906#[derive(Debug, Clone)]
5907pub struct RouteTableV6Proxy {
5908    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5909}
5910
5911impl fidl::endpoints::Proxy for RouteTableV6Proxy {
5912    type Protocol = RouteTableV6Marker;
5913
5914    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5915        Self::new(inner)
5916    }
5917
5918    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5919        self.client.into_channel().map_err(|client| Self { client })
5920    }
5921
5922    fn as_channel(&self) -> &::fidl::AsyncChannel {
5923        self.client.as_channel()
5924    }
5925}
5926
5927impl RouteTableV6Proxy {
5928    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableV6.
5929    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5930        let protocol_name = <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5931        Self { client: fidl::client::Client::new(channel, protocol_name) }
5932    }
5933
5934    /// Get a Stream of events from the remote end of the protocol.
5935    ///
5936    /// # Panics
5937    ///
5938    /// Panics if the event stream was already taken.
5939    pub fn take_event_stream(&self) -> RouteTableV6EventStream {
5940        RouteTableV6EventStream { event_receiver: self.client.take_event_receiver() }
5941    }
5942
5943    /// Gets the table ID for this table.
5944    pub fn r#get_table_id(
5945        &self,
5946    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
5947        RouteTableV6ProxyInterface::r#get_table_id(self)
5948    }
5949
5950    /// Detaches the lifetime of the route table from the lifetime of the
5951    /// client end of the channel.
5952    ///
5953    /// After this method is called, the route table will not be removed
5954    /// if the client end is closed. It's a no-op if called on the main table.
5955    pub fn r#detach(&self) -> Result<(), fidl::Error> {
5956        RouteTableV6ProxyInterface::r#detach(self)
5957    }
5958
5959    /// Removes the route table explicitly.
5960    ///
5961    /// This method cannot be called on the main table or an interface-local
5962    /// table, an error will be returned if called. The server will close the
5963    /// channel after this method successfully returns.
5964    pub fn r#remove(
5965        &self,
5966    ) -> fidl::client::QueryResponseFut<
5967        BaseRouteTableRemoveResult,
5968        fidl::encoding::DefaultFuchsiaResourceDialect,
5969    > {
5970        RouteTableV6ProxyInterface::r#remove(self)
5971    }
5972
5973    /// Gets an authentication credential for this table.
5974    ///
5975    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
5976    /// held by the server. This credential can be passed into
5977    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
5978    /// table. The `EVENT` is stable throughout the lifetime of the route table.
5979    /// Clients may duplicate this `EVENT` to make multiple API calls, or
5980    /// transfer the `EVENT` to other clients.
5981    ///
5982    /// - response `credential` the authorization credential for this table.
5983    pub fn r#get_authorization_for_route_table(
5984        &self,
5985    ) -> fidl::client::QueryResponseFut<
5986        GrantForRouteTableAuthorization,
5987        fidl::encoding::DefaultFuchsiaResourceDialect,
5988    > {
5989        RouteTableV6ProxyInterface::r#get_authorization_for_route_table(self)
5990    }
5991
5992    /// Creates an empty route set.
5993    ///
5994    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
5995    pub fn r#new_route_set(
5996        &self,
5997        mut route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
5998    ) -> Result<(), fidl::Error> {
5999        RouteTableV6ProxyInterface::r#new_route_set(self, route_set)
6000    }
6001}
6002
6003impl RouteTableV6ProxyInterface for RouteTableV6Proxy {
6004    type GetTableIdResponseFut =
6005        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
6006    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
6007        fn _decode(
6008            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6009        ) -> Result<u32, fidl::Error> {
6010            let _response = fidl::client::decode_transaction_body::<
6011                BaseRouteTableGetTableIdResponse,
6012                fidl::encoding::DefaultFuchsiaResourceDialect,
6013                0x7eab30c55edbfc15,
6014            >(_buf?)?;
6015            Ok(_response.table_id)
6016        }
6017        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
6018            (),
6019            0x7eab30c55edbfc15,
6020            fidl::encoding::DynamicFlags::empty(),
6021            _decode,
6022        )
6023    }
6024
6025    fn r#detach(&self) -> Result<(), fidl::Error> {
6026        self.client.send::<fidl::encoding::EmptyPayload>(
6027            (),
6028            0x2853ab157285b384,
6029            fidl::encoding::DynamicFlags::empty(),
6030        )
6031    }
6032
6033    type RemoveResponseFut = fidl::client::QueryResponseFut<
6034        BaseRouteTableRemoveResult,
6035        fidl::encoding::DefaultFuchsiaResourceDialect,
6036    >;
6037    fn r#remove(&self) -> Self::RemoveResponseFut {
6038        fn _decode(
6039            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6040        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
6041            let _response = fidl::client::decode_transaction_body::<
6042                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
6043                fidl::encoding::DefaultFuchsiaResourceDialect,
6044                0xc42e58a5fc79426,
6045            >(_buf?)?;
6046            Ok(_response.map(|x| x))
6047        }
6048        self.client
6049            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
6050                (),
6051                0xc42e58a5fc79426,
6052                fidl::encoding::DynamicFlags::empty(),
6053                _decode,
6054            )
6055    }
6056
6057    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
6058        GrantForRouteTableAuthorization,
6059        fidl::encoding::DefaultFuchsiaResourceDialect,
6060    >;
6061    fn r#get_authorization_for_route_table(
6062        &self,
6063    ) -> Self::GetAuthorizationForRouteTableResponseFut {
6064        fn _decode(
6065            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6066        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
6067            let _response = fidl::client::decode_transaction_body::<
6068                BaseRouteTableGetAuthorizationForRouteTableResponse,
6069                fidl::encoding::DefaultFuchsiaResourceDialect,
6070                0x56a48c921ff3b6eb,
6071            >(_buf?)?;
6072            Ok(_response.credential)
6073        }
6074        self.client
6075            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
6076                (),
6077                0x56a48c921ff3b6eb,
6078                fidl::encoding::DynamicFlags::empty(),
6079                _decode,
6080            )
6081    }
6082
6083    fn r#new_route_set(
6084        &self,
6085        mut route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
6086    ) -> Result<(), fidl::Error> {
6087        self.client.send::<RouteTableV6NewRouteSetRequest>(
6088            (route_set,),
6089            0x479aeaf9ad470141,
6090            fidl::encoding::DynamicFlags::empty(),
6091        )
6092    }
6093}
6094
6095pub struct RouteTableV6EventStream {
6096    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6097}
6098
6099impl std::marker::Unpin for RouteTableV6EventStream {}
6100
6101impl futures::stream::FusedStream for RouteTableV6EventStream {
6102    fn is_terminated(&self) -> bool {
6103        self.event_receiver.is_terminated()
6104    }
6105}
6106
6107impl futures::Stream for RouteTableV6EventStream {
6108    type Item = Result<RouteTableV6Event, fidl::Error>;
6109
6110    fn poll_next(
6111        mut self: std::pin::Pin<&mut Self>,
6112        cx: &mut std::task::Context<'_>,
6113    ) -> std::task::Poll<Option<Self::Item>> {
6114        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6115            &mut self.event_receiver,
6116            cx
6117        )?) {
6118            Some(buf) => std::task::Poll::Ready(Some(RouteTableV6Event::decode(buf))),
6119            None => std::task::Poll::Ready(None),
6120        }
6121    }
6122}
6123
6124#[derive(Debug)]
6125pub enum RouteTableV6Event {}
6126
6127impl RouteTableV6Event {
6128    /// Decodes a message buffer as a [`RouteTableV6Event`].
6129    fn decode(
6130        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6131    ) -> Result<RouteTableV6Event, fidl::Error> {
6132        let (bytes, _handles) = buf.split_mut();
6133        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6134        debug_assert_eq!(tx_header.tx_id, 0);
6135        match tx_header.ordinal {
6136            _ => Err(fidl::Error::UnknownOrdinal {
6137                ordinal: tx_header.ordinal,
6138                protocol_name: <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6139            }),
6140        }
6141    }
6142}
6143
6144/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableV6.
6145pub struct RouteTableV6RequestStream {
6146    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6147    is_terminated: bool,
6148}
6149
6150impl std::marker::Unpin for RouteTableV6RequestStream {}
6151
6152impl futures::stream::FusedStream for RouteTableV6RequestStream {
6153    fn is_terminated(&self) -> bool {
6154        self.is_terminated
6155    }
6156}
6157
6158impl fidl::endpoints::RequestStream for RouteTableV6RequestStream {
6159    type Protocol = RouteTableV6Marker;
6160    type ControlHandle = RouteTableV6ControlHandle;
6161
6162    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6163        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6164    }
6165
6166    fn control_handle(&self) -> Self::ControlHandle {
6167        RouteTableV6ControlHandle { inner: self.inner.clone() }
6168    }
6169
6170    fn into_inner(
6171        self,
6172    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6173    {
6174        (self.inner, self.is_terminated)
6175    }
6176
6177    fn from_inner(
6178        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6179        is_terminated: bool,
6180    ) -> Self {
6181        Self { inner, is_terminated }
6182    }
6183}
6184
6185impl futures::Stream for RouteTableV6RequestStream {
6186    type Item = Result<RouteTableV6Request, fidl::Error>;
6187
6188    fn poll_next(
6189        mut self: std::pin::Pin<&mut Self>,
6190        cx: &mut std::task::Context<'_>,
6191    ) -> std::task::Poll<Option<Self::Item>> {
6192        let this = &mut *self;
6193        if this.inner.check_shutdown(cx) {
6194            this.is_terminated = true;
6195            return std::task::Poll::Ready(None);
6196        }
6197        if this.is_terminated {
6198            panic!("polled RouteTableV6RequestStream after completion");
6199        }
6200        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6201            |bytes, handles| {
6202                match this.inner.channel().read_etc(cx, bytes, handles) {
6203                    std::task::Poll::Ready(Ok(())) => {}
6204                    std::task::Poll::Pending => return std::task::Poll::Pending,
6205                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6206                        this.is_terminated = true;
6207                        return std::task::Poll::Ready(None);
6208                    }
6209                    std::task::Poll::Ready(Err(e)) => {
6210                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6211                            e.into(),
6212                        ))));
6213                    }
6214                }
6215
6216                // A message has been received from the channel
6217                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6218
6219                std::task::Poll::Ready(Some(match header.ordinal {
6220                    0x7eab30c55edbfc15 => {
6221                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6222                        let mut req = fidl::new_empty!(
6223                            fidl::encoding::EmptyPayload,
6224                            fidl::encoding::DefaultFuchsiaResourceDialect
6225                        );
6226                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6227                        let control_handle =
6228                            RouteTableV6ControlHandle { inner: this.inner.clone() };
6229                        Ok(RouteTableV6Request::GetTableId {
6230                            responder: RouteTableV6GetTableIdResponder {
6231                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6232                                tx_id: header.tx_id,
6233                            },
6234                        })
6235                    }
6236                    0x2853ab157285b384 => {
6237                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6238                        let mut req = fidl::new_empty!(
6239                            fidl::encoding::EmptyPayload,
6240                            fidl::encoding::DefaultFuchsiaResourceDialect
6241                        );
6242                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6243                        let control_handle =
6244                            RouteTableV6ControlHandle { inner: this.inner.clone() };
6245                        Ok(RouteTableV6Request::Detach { control_handle })
6246                    }
6247                    0xc42e58a5fc79426 => {
6248                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6249                        let mut req = fidl::new_empty!(
6250                            fidl::encoding::EmptyPayload,
6251                            fidl::encoding::DefaultFuchsiaResourceDialect
6252                        );
6253                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6254                        let control_handle =
6255                            RouteTableV6ControlHandle { inner: this.inner.clone() };
6256                        Ok(RouteTableV6Request::Remove {
6257                            responder: RouteTableV6RemoveResponder {
6258                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6259                                tx_id: header.tx_id,
6260                            },
6261                        })
6262                    }
6263                    0x56a48c921ff3b6eb => {
6264                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6265                        let mut req = fidl::new_empty!(
6266                            fidl::encoding::EmptyPayload,
6267                            fidl::encoding::DefaultFuchsiaResourceDialect
6268                        );
6269                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6270                        let control_handle =
6271                            RouteTableV6ControlHandle { inner: this.inner.clone() };
6272                        Ok(RouteTableV6Request::GetAuthorizationForRouteTable {
6273                            responder: RouteTableV6GetAuthorizationForRouteTableResponder {
6274                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6275                                tx_id: header.tx_id,
6276                            },
6277                        })
6278                    }
6279                    0x479aeaf9ad470141 => {
6280                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6281                        let mut req = fidl::new_empty!(
6282                            RouteTableV6NewRouteSetRequest,
6283                            fidl::encoding::DefaultFuchsiaResourceDialect
6284                        );
6285                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteTableV6NewRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
6286                        let control_handle =
6287                            RouteTableV6ControlHandle { inner: this.inner.clone() };
6288                        Ok(RouteTableV6Request::NewRouteSet {
6289                            route_set: req.route_set,
6290
6291                            control_handle,
6292                        })
6293                    }
6294                    _ => Err(fidl::Error::UnknownOrdinal {
6295                        ordinal: header.ordinal,
6296                        protocol_name:
6297                            <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6298                    }),
6299                }))
6300            },
6301        )
6302    }
6303}
6304
6305/// Vends isolated administrative access to the system's IPv6 routing table.
6306///
6307/// A main route table is accessible through the discoverable [`RouteTableV6`]
6308/// protocol. Other tables can be installed using the `NewRouteTable` method
6309/// on [`RouteTableProviderV6`]. The [`RouteTableV6`] also encodes the lifetime
6310/// of the underlying route table, dropping the client end of the protocol
6311/// causes the underlying route table to be removed unless it is detached. The
6312/// main table is detached by default.
6313#[derive(Debug)]
6314pub enum RouteTableV6Request {
6315    /// Gets the table ID for this table.
6316    GetTableId { responder: RouteTableV6GetTableIdResponder },
6317    /// Detaches the lifetime of the route table from the lifetime of the
6318    /// client end of the channel.
6319    ///
6320    /// After this method is called, the route table will not be removed
6321    /// if the client end is closed. It's a no-op if called on the main table.
6322    Detach { control_handle: RouteTableV6ControlHandle },
6323    /// Removes the route table explicitly.
6324    ///
6325    /// This method cannot be called on the main table or an interface-local
6326    /// table, an error will be returned if called. The server will close the
6327    /// channel after this method successfully returns.
6328    Remove { responder: RouteTableV6RemoveResponder },
6329    /// Gets an authentication credential for this table.
6330    ///
6331    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
6332    /// held by the server. This credential can be passed into
6333    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
6334    /// table. The `EVENT` is stable throughout the lifetime of the route table.
6335    /// Clients may duplicate this `EVENT` to make multiple API calls, or
6336    /// transfer the `EVENT` to other clients.
6337    ///
6338    /// - response `credential` the authorization credential for this table.
6339    GetAuthorizationForRouteTable { responder: RouteTableV6GetAuthorizationForRouteTableResponder },
6340    /// Creates an empty route set.
6341    ///
6342    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
6343    NewRouteSet {
6344        route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
6345        control_handle: RouteTableV6ControlHandle,
6346    },
6347}
6348
6349impl RouteTableV6Request {
6350    #[allow(irrefutable_let_patterns)]
6351    pub fn into_get_table_id(self) -> Option<(RouteTableV6GetTableIdResponder)> {
6352        if let RouteTableV6Request::GetTableId { responder } = self {
6353            Some((responder))
6354        } else {
6355            None
6356        }
6357    }
6358
6359    #[allow(irrefutable_let_patterns)]
6360    pub fn into_detach(self) -> Option<(RouteTableV6ControlHandle)> {
6361        if let RouteTableV6Request::Detach { control_handle } = self {
6362            Some((control_handle))
6363        } else {
6364            None
6365        }
6366    }
6367
6368    #[allow(irrefutable_let_patterns)]
6369    pub fn into_remove(self) -> Option<(RouteTableV6RemoveResponder)> {
6370        if let RouteTableV6Request::Remove { responder } = self { Some((responder)) } else { None }
6371    }
6372
6373    #[allow(irrefutable_let_patterns)]
6374    pub fn into_get_authorization_for_route_table(
6375        self,
6376    ) -> Option<(RouteTableV6GetAuthorizationForRouteTableResponder)> {
6377        if let RouteTableV6Request::GetAuthorizationForRouteTable { responder } = self {
6378            Some((responder))
6379        } else {
6380            None
6381        }
6382    }
6383
6384    #[allow(irrefutable_let_patterns)]
6385    pub fn into_new_route_set(
6386        self,
6387    ) -> Option<(fidl::endpoints::ServerEnd<RouteSetV6Marker>, RouteTableV6ControlHandle)> {
6388        if let RouteTableV6Request::NewRouteSet { route_set, control_handle } = self {
6389            Some((route_set, control_handle))
6390        } else {
6391            None
6392        }
6393    }
6394
6395    /// Name of the method defined in FIDL
6396    pub fn method_name(&self) -> &'static str {
6397        match *self {
6398            RouteTableV6Request::GetTableId { .. } => "get_table_id",
6399            RouteTableV6Request::Detach { .. } => "detach",
6400            RouteTableV6Request::Remove { .. } => "remove",
6401            RouteTableV6Request::GetAuthorizationForRouteTable { .. } => {
6402                "get_authorization_for_route_table"
6403            }
6404            RouteTableV6Request::NewRouteSet { .. } => "new_route_set",
6405        }
6406    }
6407}
6408
6409#[derive(Debug, Clone)]
6410pub struct RouteTableV6ControlHandle {
6411    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6412}
6413
6414impl RouteTableV6ControlHandle {
6415    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6416        self.inner.shutdown_with_epitaph(status.into())
6417    }
6418}
6419
6420impl fidl::endpoints::ControlHandle for RouteTableV6ControlHandle {
6421    fn shutdown(&self) {
6422        self.inner.shutdown()
6423    }
6424
6425    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6426        self.inner.shutdown_with_epitaph(status)
6427    }
6428
6429    fn is_closed(&self) -> bool {
6430        self.inner.channel().is_closed()
6431    }
6432    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6433        self.inner.channel().on_closed()
6434    }
6435
6436    #[cfg(target_os = "fuchsia")]
6437    fn signal_peer(
6438        &self,
6439        clear_mask: zx::Signals,
6440        set_mask: zx::Signals,
6441    ) -> Result<(), zx_status::Status> {
6442        use fidl::Peered;
6443        self.inner.channel().signal_peer(clear_mask, set_mask)
6444    }
6445}
6446
6447impl RouteTableV6ControlHandle {}
6448
6449#[must_use = "FIDL methods require a response to be sent"]
6450#[derive(Debug)]
6451pub struct RouteTableV6GetTableIdResponder {
6452    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
6453    tx_id: u32,
6454}
6455
6456/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
6457/// if the responder is dropped without sending a response, so that the client
6458/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6459impl std::ops::Drop for RouteTableV6GetTableIdResponder {
6460    fn drop(&mut self) {
6461        self.control_handle.shutdown();
6462        // Safety: drops once, never accessed again
6463        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6464    }
6465}
6466
6467impl fidl::endpoints::Responder for RouteTableV6GetTableIdResponder {
6468    type ControlHandle = RouteTableV6ControlHandle;
6469
6470    fn control_handle(&self) -> &RouteTableV6ControlHandle {
6471        &self.control_handle
6472    }
6473
6474    fn drop_without_shutdown(mut self) {
6475        // Safety: drops once, never accessed again due to mem::forget
6476        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6477        // Prevent Drop from running (which would shut down the channel)
6478        std::mem::forget(self);
6479    }
6480}
6481
6482impl RouteTableV6GetTableIdResponder {
6483    /// Sends a response to the FIDL transaction.
6484    ///
6485    /// Sets the channel to shutdown if an error occurs.
6486    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
6487        let _result = self.send_raw(table_id);
6488        if _result.is_err() {
6489            self.control_handle.shutdown();
6490        }
6491        self.drop_without_shutdown();
6492        _result
6493    }
6494
6495    /// Similar to "send" but does not shutdown the channel if an error occurs.
6496    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
6497        let _result = self.send_raw(table_id);
6498        self.drop_without_shutdown();
6499        _result
6500    }
6501
6502    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
6503        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
6504            (table_id,),
6505            self.tx_id,
6506            0x7eab30c55edbfc15,
6507            fidl::encoding::DynamicFlags::empty(),
6508        )
6509    }
6510}
6511
6512#[must_use = "FIDL methods require a response to be sent"]
6513#[derive(Debug)]
6514pub struct RouteTableV6RemoveResponder {
6515    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
6516    tx_id: u32,
6517}
6518
6519/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
6520/// if the responder is dropped without sending a response, so that the client
6521/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6522impl std::ops::Drop for RouteTableV6RemoveResponder {
6523    fn drop(&mut self) {
6524        self.control_handle.shutdown();
6525        // Safety: drops once, never accessed again
6526        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6527    }
6528}
6529
6530impl fidl::endpoints::Responder for RouteTableV6RemoveResponder {
6531    type ControlHandle = RouteTableV6ControlHandle;
6532
6533    fn control_handle(&self) -> &RouteTableV6ControlHandle {
6534        &self.control_handle
6535    }
6536
6537    fn drop_without_shutdown(mut self) {
6538        // Safety: drops once, never accessed again due to mem::forget
6539        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6540        // Prevent Drop from running (which would shut down the channel)
6541        std::mem::forget(self);
6542    }
6543}
6544
6545impl RouteTableV6RemoveResponder {
6546    /// Sends a response to the FIDL transaction.
6547    ///
6548    /// Sets the channel to shutdown if an error occurs.
6549    pub fn send(
6550        self,
6551        mut result: Result<(), BaseRouteTableRemoveError>,
6552    ) -> Result<(), fidl::Error> {
6553        let _result = self.send_raw(result);
6554        if _result.is_err() {
6555            self.control_handle.shutdown();
6556        }
6557        self.drop_without_shutdown();
6558        _result
6559    }
6560
6561    /// Similar to "send" but does not shutdown the channel if an error occurs.
6562    pub fn send_no_shutdown_on_err(
6563        self,
6564        mut result: Result<(), BaseRouteTableRemoveError>,
6565    ) -> Result<(), fidl::Error> {
6566        let _result = self.send_raw(result);
6567        self.drop_without_shutdown();
6568        _result
6569    }
6570
6571    fn send_raw(
6572        &self,
6573        mut result: Result<(), BaseRouteTableRemoveError>,
6574    ) -> Result<(), fidl::Error> {
6575        self.control_handle.inner.send::<fidl::encoding::ResultType<
6576            fidl::encoding::EmptyStruct,
6577            BaseRouteTableRemoveError,
6578        >>(
6579            result,
6580            self.tx_id,
6581            0xc42e58a5fc79426,
6582            fidl::encoding::DynamicFlags::empty(),
6583        )
6584    }
6585}
6586
6587#[must_use = "FIDL methods require a response to be sent"]
6588#[derive(Debug)]
6589pub struct RouteTableV6GetAuthorizationForRouteTableResponder {
6590    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
6591    tx_id: u32,
6592}
6593
6594/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
6595/// if the responder is dropped without sending a response, so that the client
6596/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6597impl std::ops::Drop for RouteTableV6GetAuthorizationForRouteTableResponder {
6598    fn drop(&mut self) {
6599        self.control_handle.shutdown();
6600        // Safety: drops once, never accessed again
6601        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6602    }
6603}
6604
6605impl fidl::endpoints::Responder for RouteTableV6GetAuthorizationForRouteTableResponder {
6606    type ControlHandle = RouteTableV6ControlHandle;
6607
6608    fn control_handle(&self) -> &RouteTableV6ControlHandle {
6609        &self.control_handle
6610    }
6611
6612    fn drop_without_shutdown(mut self) {
6613        // Safety: drops once, never accessed again due to mem::forget
6614        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6615        // Prevent Drop from running (which would shut down the channel)
6616        std::mem::forget(self);
6617    }
6618}
6619
6620impl RouteTableV6GetAuthorizationForRouteTableResponder {
6621    /// Sends a response to the FIDL transaction.
6622    ///
6623    /// Sets the channel to shutdown if an error occurs.
6624    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
6625        let _result = self.send_raw(credential);
6626        if _result.is_err() {
6627            self.control_handle.shutdown();
6628        }
6629        self.drop_without_shutdown();
6630        _result
6631    }
6632
6633    /// Similar to "send" but does not shutdown the channel if an error occurs.
6634    pub fn send_no_shutdown_on_err(
6635        self,
6636        mut credential: GrantForRouteTableAuthorization,
6637    ) -> Result<(), fidl::Error> {
6638        let _result = self.send_raw(credential);
6639        self.drop_without_shutdown();
6640        _result
6641    }
6642
6643    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
6644        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
6645            (&mut credential,),
6646            self.tx_id,
6647            0x56a48c921ff3b6eb,
6648            fidl::encoding::DynamicFlags::empty(),
6649        )
6650    }
6651}
6652
6653#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6654pub struct RuleSetV4Marker;
6655
6656impl fidl::endpoints::ProtocolMarker for RuleSetV4Marker {
6657    type Proxy = RuleSetV4Proxy;
6658    type RequestStream = RuleSetV4RequestStream;
6659    #[cfg(target_os = "fuchsia")]
6660    type SynchronousProxy = RuleSetV4SynchronousProxy;
6661
6662    const DEBUG_NAME: &'static str = "(anonymous) RuleSetV4";
6663}
6664pub type RuleSetV4AddRuleResult = Result<(), RuleSetError>;
6665
6666pub trait RuleSetV4ProxyInterface: Send + Sync {
6667    type AuthenticateForRouteTableResponseFut: std::future::Future<
6668            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
6669        > + Send;
6670    fn r#authenticate_for_route_table(
6671        &self,
6672        table: u32,
6673        token: fidl::Event,
6674    ) -> Self::AuthenticateForRouteTableResponseFut;
6675    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
6676        + Send;
6677    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
6678    fn r#close(&self) -> Result<(), fidl::Error>;
6679    type AddRuleResponseFut: std::future::Future<Output = Result<RuleSetV4AddRuleResult, fidl::Error>>
6680        + Send;
6681    fn r#add_rule(
6682        &self,
6683        index: u32,
6684        matcher: &fidl_fuchsia_net_routes::RuleMatcherV4,
6685        action: &fidl_fuchsia_net_routes::RuleAction,
6686    ) -> Self::AddRuleResponseFut;
6687}
6688#[derive(Debug)]
6689#[cfg(target_os = "fuchsia")]
6690pub struct RuleSetV4SynchronousProxy {
6691    client: fidl::client::sync::Client,
6692}
6693
6694#[cfg(target_os = "fuchsia")]
6695impl fidl::endpoints::SynchronousProxy for RuleSetV4SynchronousProxy {
6696    type Proxy = RuleSetV4Proxy;
6697    type Protocol = RuleSetV4Marker;
6698
6699    fn from_channel(inner: fidl::Channel) -> Self {
6700        Self::new(inner)
6701    }
6702
6703    fn into_channel(self) -> fidl::Channel {
6704        self.client.into_channel()
6705    }
6706
6707    fn as_channel(&self) -> &fidl::Channel {
6708        self.client.as_channel()
6709    }
6710}
6711
6712#[cfg(target_os = "fuchsia")]
6713impl RuleSetV4SynchronousProxy {
6714    pub fn new(channel: fidl::Channel) -> Self {
6715        Self { client: fidl::client::sync::Client::new(channel) }
6716    }
6717
6718    pub fn into_channel(self) -> fidl::Channel {
6719        self.client.into_channel()
6720    }
6721
6722    /// Waits until an event arrives and returns it. It is safe for other
6723    /// threads to make concurrent requests while waiting for an event.
6724    pub fn wait_for_event(
6725        &self,
6726        deadline: zx::MonotonicInstant,
6727    ) -> Result<RuleSetV4Event, fidl::Error> {
6728        RuleSetV4Event::decode(self.client.wait_for_event::<RuleSetV4Marker>(deadline)?)
6729    }
6730
6731    /// Authenticates for a route table that will be used in an action.
6732    pub fn r#authenticate_for_route_table(
6733        &self,
6734        mut table: u32,
6735        mut token: fidl::Event,
6736        ___deadline: zx::MonotonicInstant,
6737    ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
6738        let _response =
6739            self.client.send_query::<ProofOfRouteTableAuthorization, fidl::encoding::ResultType<
6740                fidl::encoding::EmptyStruct,
6741                AuthenticateForRouteTableError,
6742            >, RuleSetV4Marker>(
6743                (table, token),
6744                0x6fd845360ed9bc8f,
6745                fidl::encoding::DynamicFlags::empty(),
6746                ___deadline,
6747            )?;
6748        Ok(_response.map(|x| x))
6749    }
6750
6751    /// Removes a rule from this rule set.
6752    ///
6753    /// If the client tries to remove from an index that does not have a rule,
6754    /// the error `RULE_DOES_NOT_EXIST` will be returned.
6755    ///
6756    /// + request `index` the index of the rule.
6757    pub fn r#remove_rule(
6758        &self,
6759        mut index: u32,
6760        ___deadline: zx::MonotonicInstant,
6761    ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
6762        let _response = self.client.send_query::<
6763            BaseRuleSetRemoveRuleRequest,
6764            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6765            RuleSetV4Marker,
6766        >(
6767            (index,),
6768            0x2ae3d7e817cbff90,
6769            fidl::encoding::DynamicFlags::empty(),
6770            ___deadline,
6771        )?;
6772        Ok(_response.map(|x| x))
6773    }
6774
6775    /// Removes all rules in the rule set and the underlying channel will be
6776    /// closed after the rules are removed.
6777    ///
6778    /// This method provides a way for synchronous closure.
6779    pub fn r#close(&self) -> Result<(), fidl::Error> {
6780        self.client.send::<fidl::encoding::EmptyPayload>(
6781            (),
6782            0x457e1753672d4073,
6783            fidl::encoding::DynamicFlags::empty(),
6784        )
6785    }
6786
6787    /// Adds a rule to this rule set.
6788    ///
6789    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
6790    /// is returned.
6791    ///
6792    /// + request `index` where to insert the rule.
6793    /// + request `matcher` the matcher of the rule.
6794    /// + request `action` action of the rule.
6795    pub fn r#add_rule(
6796        &self,
6797        mut index: u32,
6798        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV4,
6799        mut action: &fidl_fuchsia_net_routes::RuleAction,
6800        ___deadline: zx::MonotonicInstant,
6801    ) -> Result<RuleSetV4AddRuleResult, fidl::Error> {
6802        let _response = self.client.send_query::<
6803            RuleSetV4AddRuleRequest,
6804            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6805            RuleSetV4Marker,
6806        >(
6807            (index, matcher, action,),
6808            0x7f68325de94e80,
6809            fidl::encoding::DynamicFlags::empty(),
6810            ___deadline,
6811        )?;
6812        Ok(_response.map(|x| x))
6813    }
6814}
6815
6816#[cfg(target_os = "fuchsia")]
6817impl From<RuleSetV4SynchronousProxy> for zx::NullableHandle {
6818    fn from(value: RuleSetV4SynchronousProxy) -> Self {
6819        value.into_channel().into()
6820    }
6821}
6822
6823#[cfg(target_os = "fuchsia")]
6824impl From<fidl::Channel> for RuleSetV4SynchronousProxy {
6825    fn from(value: fidl::Channel) -> Self {
6826        Self::new(value)
6827    }
6828}
6829
6830#[cfg(target_os = "fuchsia")]
6831impl fidl::endpoints::FromClient for RuleSetV4SynchronousProxy {
6832    type Protocol = RuleSetV4Marker;
6833
6834    fn from_client(value: fidl::endpoints::ClientEnd<RuleSetV4Marker>) -> Self {
6835        Self::new(value.into_channel())
6836    }
6837}
6838
6839#[derive(Debug, Clone)]
6840pub struct RuleSetV4Proxy {
6841    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6842}
6843
6844impl fidl::endpoints::Proxy for RuleSetV4Proxy {
6845    type Protocol = RuleSetV4Marker;
6846
6847    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6848        Self::new(inner)
6849    }
6850
6851    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6852        self.client.into_channel().map_err(|client| Self { client })
6853    }
6854
6855    fn as_channel(&self) -> &::fidl::AsyncChannel {
6856        self.client.as_channel()
6857    }
6858}
6859
6860impl RuleSetV4Proxy {
6861    /// Create a new Proxy for fuchsia.net.routes.admin/RuleSetV4.
6862    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6863        let protocol_name = <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6864        Self { client: fidl::client::Client::new(channel, protocol_name) }
6865    }
6866
6867    /// Get a Stream of events from the remote end of the protocol.
6868    ///
6869    /// # Panics
6870    ///
6871    /// Panics if the event stream was already taken.
6872    pub fn take_event_stream(&self) -> RuleSetV4EventStream {
6873        RuleSetV4EventStream { event_receiver: self.client.take_event_receiver() }
6874    }
6875
6876    /// Authenticates for a route table that will be used in an action.
6877    pub fn r#authenticate_for_route_table(
6878        &self,
6879        mut table: u32,
6880        mut token: fidl::Event,
6881    ) -> fidl::client::QueryResponseFut<
6882        BaseRuleSetAuthenticateForRouteTableResult,
6883        fidl::encoding::DefaultFuchsiaResourceDialect,
6884    > {
6885        RuleSetV4ProxyInterface::r#authenticate_for_route_table(self, table, token)
6886    }
6887
6888    /// Removes a rule from this rule set.
6889    ///
6890    /// If the client tries to remove from an index that does not have a rule,
6891    /// the error `RULE_DOES_NOT_EXIST` will be returned.
6892    ///
6893    /// + request `index` the index of the rule.
6894    pub fn r#remove_rule(
6895        &self,
6896        mut index: u32,
6897    ) -> fidl::client::QueryResponseFut<
6898        BaseRuleSetRemoveRuleResult,
6899        fidl::encoding::DefaultFuchsiaResourceDialect,
6900    > {
6901        RuleSetV4ProxyInterface::r#remove_rule(self, index)
6902    }
6903
6904    /// Removes all rules in the rule set and the underlying channel will be
6905    /// closed after the rules are removed.
6906    ///
6907    /// This method provides a way for synchronous closure.
6908    pub fn r#close(&self) -> Result<(), fidl::Error> {
6909        RuleSetV4ProxyInterface::r#close(self)
6910    }
6911
6912    /// Adds a rule to this rule set.
6913    ///
6914    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
6915    /// is returned.
6916    ///
6917    /// + request `index` where to insert the rule.
6918    /// + request `matcher` the matcher of the rule.
6919    /// + request `action` action of the rule.
6920    pub fn r#add_rule(
6921        &self,
6922        mut index: u32,
6923        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV4,
6924        mut action: &fidl_fuchsia_net_routes::RuleAction,
6925    ) -> fidl::client::QueryResponseFut<
6926        RuleSetV4AddRuleResult,
6927        fidl::encoding::DefaultFuchsiaResourceDialect,
6928    > {
6929        RuleSetV4ProxyInterface::r#add_rule(self, index, matcher, action)
6930    }
6931}
6932
6933impl RuleSetV4ProxyInterface for RuleSetV4Proxy {
6934    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
6935        BaseRuleSetAuthenticateForRouteTableResult,
6936        fidl::encoding::DefaultFuchsiaResourceDialect,
6937    >;
6938    fn r#authenticate_for_route_table(
6939        &self,
6940        mut table: u32,
6941        mut token: fidl::Event,
6942    ) -> Self::AuthenticateForRouteTableResponseFut {
6943        fn _decode(
6944            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6945        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
6946            let _response = fidl::client::decode_transaction_body::<
6947                fidl::encoding::ResultType<
6948                    fidl::encoding::EmptyStruct,
6949                    AuthenticateForRouteTableError,
6950                >,
6951                fidl::encoding::DefaultFuchsiaResourceDialect,
6952                0x6fd845360ed9bc8f,
6953            >(_buf?)?;
6954            Ok(_response.map(|x| x))
6955        }
6956        self.client.send_query_and_decode::<
6957            ProofOfRouteTableAuthorization,
6958            BaseRuleSetAuthenticateForRouteTableResult,
6959        >(
6960            (table, token,),
6961            0x6fd845360ed9bc8f,
6962            fidl::encoding::DynamicFlags::empty(),
6963            _decode,
6964        )
6965    }
6966
6967    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
6968        BaseRuleSetRemoveRuleResult,
6969        fidl::encoding::DefaultFuchsiaResourceDialect,
6970    >;
6971    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
6972        fn _decode(
6973            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6974        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
6975            let _response = fidl::client::decode_transaction_body::<
6976                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6977                fidl::encoding::DefaultFuchsiaResourceDialect,
6978                0x2ae3d7e817cbff90,
6979            >(_buf?)?;
6980            Ok(_response.map(|x| x))
6981        }
6982        self.client
6983            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
6984                (index,),
6985                0x2ae3d7e817cbff90,
6986                fidl::encoding::DynamicFlags::empty(),
6987                _decode,
6988            )
6989    }
6990
6991    fn r#close(&self) -> Result<(), fidl::Error> {
6992        self.client.send::<fidl::encoding::EmptyPayload>(
6993            (),
6994            0x457e1753672d4073,
6995            fidl::encoding::DynamicFlags::empty(),
6996        )
6997    }
6998
6999    type AddRuleResponseFut = fidl::client::QueryResponseFut<
7000        RuleSetV4AddRuleResult,
7001        fidl::encoding::DefaultFuchsiaResourceDialect,
7002    >;
7003    fn r#add_rule(
7004        &self,
7005        mut index: u32,
7006        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV4,
7007        mut action: &fidl_fuchsia_net_routes::RuleAction,
7008    ) -> Self::AddRuleResponseFut {
7009        fn _decode(
7010            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7011        ) -> Result<RuleSetV4AddRuleResult, fidl::Error> {
7012            let _response = fidl::client::decode_transaction_body::<
7013                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7014                fidl::encoding::DefaultFuchsiaResourceDialect,
7015                0x7f68325de94e80,
7016            >(_buf?)?;
7017            Ok(_response.map(|x| x))
7018        }
7019        self.client.send_query_and_decode::<RuleSetV4AddRuleRequest, RuleSetV4AddRuleResult>(
7020            (index, matcher, action),
7021            0x7f68325de94e80,
7022            fidl::encoding::DynamicFlags::empty(),
7023            _decode,
7024        )
7025    }
7026}
7027
7028pub struct RuleSetV4EventStream {
7029    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7030}
7031
7032impl std::marker::Unpin for RuleSetV4EventStream {}
7033
7034impl futures::stream::FusedStream for RuleSetV4EventStream {
7035    fn is_terminated(&self) -> bool {
7036        self.event_receiver.is_terminated()
7037    }
7038}
7039
7040impl futures::Stream for RuleSetV4EventStream {
7041    type Item = Result<RuleSetV4Event, fidl::Error>;
7042
7043    fn poll_next(
7044        mut self: std::pin::Pin<&mut Self>,
7045        cx: &mut std::task::Context<'_>,
7046    ) -> std::task::Poll<Option<Self::Item>> {
7047        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7048            &mut self.event_receiver,
7049            cx
7050        )?) {
7051            Some(buf) => std::task::Poll::Ready(Some(RuleSetV4Event::decode(buf))),
7052            None => std::task::Poll::Ready(None),
7053        }
7054    }
7055}
7056
7057#[derive(Debug)]
7058pub enum RuleSetV4Event {}
7059
7060impl RuleSetV4Event {
7061    /// Decodes a message buffer as a [`RuleSetV4Event`].
7062    fn decode(
7063        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7064    ) -> Result<RuleSetV4Event, fidl::Error> {
7065        let (bytes, _handles) = buf.split_mut();
7066        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7067        debug_assert_eq!(tx_header.tx_id, 0);
7068        match tx_header.ordinal {
7069            _ => Err(fidl::Error::UnknownOrdinal {
7070                ordinal: tx_header.ordinal,
7071                protocol_name: <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7072            }),
7073        }
7074    }
7075}
7076
7077/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleSetV4.
7078pub struct RuleSetV4RequestStream {
7079    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7080    is_terminated: bool,
7081}
7082
7083impl std::marker::Unpin for RuleSetV4RequestStream {}
7084
7085impl futures::stream::FusedStream for RuleSetV4RequestStream {
7086    fn is_terminated(&self) -> bool {
7087        self.is_terminated
7088    }
7089}
7090
7091impl fidl::endpoints::RequestStream for RuleSetV4RequestStream {
7092    type Protocol = RuleSetV4Marker;
7093    type ControlHandle = RuleSetV4ControlHandle;
7094
7095    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7096        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7097    }
7098
7099    fn control_handle(&self) -> Self::ControlHandle {
7100        RuleSetV4ControlHandle { inner: self.inner.clone() }
7101    }
7102
7103    fn into_inner(
7104        self,
7105    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7106    {
7107        (self.inner, self.is_terminated)
7108    }
7109
7110    fn from_inner(
7111        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7112        is_terminated: bool,
7113    ) -> Self {
7114        Self { inner, is_terminated }
7115    }
7116}
7117
7118impl futures::Stream for RuleSetV4RequestStream {
7119    type Item = Result<RuleSetV4Request, fidl::Error>;
7120
7121    fn poll_next(
7122        mut self: std::pin::Pin<&mut Self>,
7123        cx: &mut std::task::Context<'_>,
7124    ) -> std::task::Poll<Option<Self::Item>> {
7125        let this = &mut *self;
7126        if this.inner.check_shutdown(cx) {
7127            this.is_terminated = true;
7128            return std::task::Poll::Ready(None);
7129        }
7130        if this.is_terminated {
7131            panic!("polled RuleSetV4RequestStream after completion");
7132        }
7133        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7134            |bytes, handles| {
7135                match this.inner.channel().read_etc(cx, bytes, handles) {
7136                    std::task::Poll::Ready(Ok(())) => {}
7137                    std::task::Poll::Pending => return std::task::Poll::Pending,
7138                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7139                        this.is_terminated = true;
7140                        return std::task::Poll::Ready(None);
7141                    }
7142                    std::task::Poll::Ready(Err(e)) => {
7143                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7144                            e.into(),
7145                        ))));
7146                    }
7147                }
7148
7149                // A message has been received from the channel
7150                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7151
7152                std::task::Poll::Ready(Some(match header.ordinal {
7153                    0x6fd845360ed9bc8f => {
7154                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7155                        let mut req = fidl::new_empty!(
7156                            ProofOfRouteTableAuthorization,
7157                            fidl::encoding::DefaultFuchsiaResourceDialect
7158                        );
7159                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
7160                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
7161                        Ok(RuleSetV4Request::AuthenticateForRouteTable {
7162                            table: req.table,
7163                            token: req.token,
7164
7165                            responder: RuleSetV4AuthenticateForRouteTableResponder {
7166                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7167                                tx_id: header.tx_id,
7168                            },
7169                        })
7170                    }
7171                    0x2ae3d7e817cbff90 => {
7172                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7173                        let mut req = fidl::new_empty!(
7174                            BaseRuleSetRemoveRuleRequest,
7175                            fidl::encoding::DefaultFuchsiaResourceDialect
7176                        );
7177                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
7178                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
7179                        Ok(RuleSetV4Request::RemoveRule {
7180                            index: req.index,
7181
7182                            responder: RuleSetV4RemoveRuleResponder {
7183                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7184                                tx_id: header.tx_id,
7185                            },
7186                        })
7187                    }
7188                    0x457e1753672d4073 => {
7189                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7190                        let mut req = fidl::new_empty!(
7191                            fidl::encoding::EmptyPayload,
7192                            fidl::encoding::DefaultFuchsiaResourceDialect
7193                        );
7194                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7195                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
7196                        Ok(RuleSetV4Request::Close { control_handle })
7197                    }
7198                    0x7f68325de94e80 => {
7199                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7200                        let mut req = fidl::new_empty!(
7201                            RuleSetV4AddRuleRequest,
7202                            fidl::encoding::DefaultFuchsiaResourceDialect
7203                        );
7204                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RuleSetV4AddRuleRequest>(&header, _body_bytes, handles, &mut req)?;
7205                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
7206                        Ok(RuleSetV4Request::AddRule {
7207                            index: req.index,
7208                            matcher: req.matcher,
7209                            action: req.action,
7210
7211                            responder: RuleSetV4AddRuleResponder {
7212                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7213                                tx_id: header.tx_id,
7214                            },
7215                        })
7216                    }
7217                    _ => Err(fidl::Error::UnknownOrdinal {
7218                        ordinal: header.ordinal,
7219                        protocol_name:
7220                            <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7221                    }),
7222                }))
7223            },
7224        )
7225    }
7226}
7227
7228/// Provides mutable access over a set of the system's IPv4 route rules.
7229///
7230/// A `RuleSet` has a priority and a rule has an index. A global order among the
7231/// rules is determined first by the priority of the `RuleSet` the rule belongs
7232/// to, and then the index of the rule inside the `RuleSet`.
7233///
7234/// This protocol encodes the lifetime of the rule set. Closing the client end
7235/// removes the rule set, and all the rules that are owned by the rule set.
7236#[derive(Debug)]
7237pub enum RuleSetV4Request {
7238    /// Authenticates for a route table that will be used in an action.
7239    AuthenticateForRouteTable {
7240        table: u32,
7241        token: fidl::Event,
7242        responder: RuleSetV4AuthenticateForRouteTableResponder,
7243    },
7244    /// Removes a rule from this rule set.
7245    ///
7246    /// If the client tries to remove from an index that does not have a rule,
7247    /// the error `RULE_DOES_NOT_EXIST` will be returned.
7248    ///
7249    /// + request `index` the index of the rule.
7250    RemoveRule { index: u32, responder: RuleSetV4RemoveRuleResponder },
7251    /// Removes all rules in the rule set and the underlying channel will be
7252    /// closed after the rules are removed.
7253    ///
7254    /// This method provides a way for synchronous closure.
7255    Close { control_handle: RuleSetV4ControlHandle },
7256    /// Adds a rule to this rule set.
7257    ///
7258    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
7259    /// is returned.
7260    ///
7261    /// + request `index` where to insert the rule.
7262    /// + request `matcher` the matcher of the rule.
7263    /// + request `action` action of the rule.
7264    AddRule {
7265        index: u32,
7266        matcher: fidl_fuchsia_net_routes::RuleMatcherV4,
7267        action: fidl_fuchsia_net_routes::RuleAction,
7268        responder: RuleSetV4AddRuleResponder,
7269    },
7270}
7271
7272impl RuleSetV4Request {
7273    #[allow(irrefutable_let_patterns)]
7274    pub fn into_authenticate_for_route_table(
7275        self,
7276    ) -> Option<(u32, fidl::Event, RuleSetV4AuthenticateForRouteTableResponder)> {
7277        if let RuleSetV4Request::AuthenticateForRouteTable { table, token, responder } = self {
7278            Some((table, token, responder))
7279        } else {
7280            None
7281        }
7282    }
7283
7284    #[allow(irrefutable_let_patterns)]
7285    pub fn into_remove_rule(self) -> Option<(u32, RuleSetV4RemoveRuleResponder)> {
7286        if let RuleSetV4Request::RemoveRule { index, responder } = self {
7287            Some((index, responder))
7288        } else {
7289            None
7290        }
7291    }
7292
7293    #[allow(irrefutable_let_patterns)]
7294    pub fn into_close(self) -> Option<(RuleSetV4ControlHandle)> {
7295        if let RuleSetV4Request::Close { control_handle } = self {
7296            Some((control_handle))
7297        } else {
7298            None
7299        }
7300    }
7301
7302    #[allow(irrefutable_let_patterns)]
7303    pub fn into_add_rule(
7304        self,
7305    ) -> Option<(
7306        u32,
7307        fidl_fuchsia_net_routes::RuleMatcherV4,
7308        fidl_fuchsia_net_routes::RuleAction,
7309        RuleSetV4AddRuleResponder,
7310    )> {
7311        if let RuleSetV4Request::AddRule { index, matcher, action, responder } = self {
7312            Some((index, matcher, action, responder))
7313        } else {
7314            None
7315        }
7316    }
7317
7318    /// Name of the method defined in FIDL
7319    pub fn method_name(&self) -> &'static str {
7320        match *self {
7321            RuleSetV4Request::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
7322            RuleSetV4Request::RemoveRule { .. } => "remove_rule",
7323            RuleSetV4Request::Close { .. } => "close",
7324            RuleSetV4Request::AddRule { .. } => "add_rule",
7325        }
7326    }
7327}
7328
7329#[derive(Debug, Clone)]
7330pub struct RuleSetV4ControlHandle {
7331    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7332}
7333
7334impl RuleSetV4ControlHandle {
7335    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
7336        self.inner.shutdown_with_epitaph(status.into())
7337    }
7338}
7339
7340impl fidl::endpoints::ControlHandle for RuleSetV4ControlHandle {
7341    fn shutdown(&self) {
7342        self.inner.shutdown()
7343    }
7344
7345    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
7346        self.inner.shutdown_with_epitaph(status)
7347    }
7348
7349    fn is_closed(&self) -> bool {
7350        self.inner.channel().is_closed()
7351    }
7352    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7353        self.inner.channel().on_closed()
7354    }
7355
7356    #[cfg(target_os = "fuchsia")]
7357    fn signal_peer(
7358        &self,
7359        clear_mask: zx::Signals,
7360        set_mask: zx::Signals,
7361    ) -> Result<(), zx_status::Status> {
7362        use fidl::Peered;
7363        self.inner.channel().signal_peer(clear_mask, set_mask)
7364    }
7365}
7366
7367impl RuleSetV4ControlHandle {}
7368
7369#[must_use = "FIDL methods require a response to be sent"]
7370#[derive(Debug)]
7371pub struct RuleSetV4AuthenticateForRouteTableResponder {
7372    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
7373    tx_id: u32,
7374}
7375
7376/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
7377/// if the responder is dropped without sending a response, so that the client
7378/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7379impl std::ops::Drop for RuleSetV4AuthenticateForRouteTableResponder {
7380    fn drop(&mut self) {
7381        self.control_handle.shutdown();
7382        // Safety: drops once, never accessed again
7383        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7384    }
7385}
7386
7387impl fidl::endpoints::Responder for RuleSetV4AuthenticateForRouteTableResponder {
7388    type ControlHandle = RuleSetV4ControlHandle;
7389
7390    fn control_handle(&self) -> &RuleSetV4ControlHandle {
7391        &self.control_handle
7392    }
7393
7394    fn drop_without_shutdown(mut self) {
7395        // Safety: drops once, never accessed again due to mem::forget
7396        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7397        // Prevent Drop from running (which would shut down the channel)
7398        std::mem::forget(self);
7399    }
7400}
7401
7402impl RuleSetV4AuthenticateForRouteTableResponder {
7403    /// Sends a response to the FIDL transaction.
7404    ///
7405    /// Sets the channel to shutdown if an error occurs.
7406    pub fn send(
7407        self,
7408        mut result: Result<(), AuthenticateForRouteTableError>,
7409    ) -> Result<(), fidl::Error> {
7410        let _result = self.send_raw(result);
7411        if _result.is_err() {
7412            self.control_handle.shutdown();
7413        }
7414        self.drop_without_shutdown();
7415        _result
7416    }
7417
7418    /// Similar to "send" but does not shutdown the channel if an error occurs.
7419    pub fn send_no_shutdown_on_err(
7420        self,
7421        mut result: Result<(), AuthenticateForRouteTableError>,
7422    ) -> Result<(), fidl::Error> {
7423        let _result = self.send_raw(result);
7424        self.drop_without_shutdown();
7425        _result
7426    }
7427
7428    fn send_raw(
7429        &self,
7430        mut result: Result<(), AuthenticateForRouteTableError>,
7431    ) -> Result<(), fidl::Error> {
7432        self.control_handle.inner.send::<fidl::encoding::ResultType<
7433            fidl::encoding::EmptyStruct,
7434            AuthenticateForRouteTableError,
7435        >>(
7436            result,
7437            self.tx_id,
7438            0x6fd845360ed9bc8f,
7439            fidl::encoding::DynamicFlags::empty(),
7440        )
7441    }
7442}
7443
7444#[must_use = "FIDL methods require a response to be sent"]
7445#[derive(Debug)]
7446pub struct RuleSetV4RemoveRuleResponder {
7447    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
7448    tx_id: u32,
7449}
7450
7451/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
7452/// if the responder is dropped without sending a response, so that the client
7453/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7454impl std::ops::Drop for RuleSetV4RemoveRuleResponder {
7455    fn drop(&mut self) {
7456        self.control_handle.shutdown();
7457        // Safety: drops once, never accessed again
7458        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7459    }
7460}
7461
7462impl fidl::endpoints::Responder for RuleSetV4RemoveRuleResponder {
7463    type ControlHandle = RuleSetV4ControlHandle;
7464
7465    fn control_handle(&self) -> &RuleSetV4ControlHandle {
7466        &self.control_handle
7467    }
7468
7469    fn drop_without_shutdown(mut self) {
7470        // Safety: drops once, never accessed again due to mem::forget
7471        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7472        // Prevent Drop from running (which would shut down the channel)
7473        std::mem::forget(self);
7474    }
7475}
7476
7477impl RuleSetV4RemoveRuleResponder {
7478    /// Sends a response to the FIDL transaction.
7479    ///
7480    /// Sets the channel to shutdown if an error occurs.
7481    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7482        let _result = self.send_raw(result);
7483        if _result.is_err() {
7484            self.control_handle.shutdown();
7485        }
7486        self.drop_without_shutdown();
7487        _result
7488    }
7489
7490    /// Similar to "send" but does not shutdown the channel if an error occurs.
7491    pub fn send_no_shutdown_on_err(
7492        self,
7493        mut result: Result<(), RuleSetError>,
7494    ) -> Result<(), fidl::Error> {
7495        let _result = self.send_raw(result);
7496        self.drop_without_shutdown();
7497        _result
7498    }
7499
7500    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7501        self.control_handle.inner.send::<fidl::encoding::ResultType<
7502            fidl::encoding::EmptyStruct,
7503            RuleSetError,
7504        >>(
7505            result,
7506            self.tx_id,
7507            0x2ae3d7e817cbff90,
7508            fidl::encoding::DynamicFlags::empty(),
7509        )
7510    }
7511}
7512
7513#[must_use = "FIDL methods require a response to be sent"]
7514#[derive(Debug)]
7515pub struct RuleSetV4AddRuleResponder {
7516    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
7517    tx_id: u32,
7518}
7519
7520/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
7521/// if the responder is dropped without sending a response, so that the client
7522/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7523impl std::ops::Drop for RuleSetV4AddRuleResponder {
7524    fn drop(&mut self) {
7525        self.control_handle.shutdown();
7526        // Safety: drops once, never accessed again
7527        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7528    }
7529}
7530
7531impl fidl::endpoints::Responder for RuleSetV4AddRuleResponder {
7532    type ControlHandle = RuleSetV4ControlHandle;
7533
7534    fn control_handle(&self) -> &RuleSetV4ControlHandle {
7535        &self.control_handle
7536    }
7537
7538    fn drop_without_shutdown(mut self) {
7539        // Safety: drops once, never accessed again due to mem::forget
7540        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7541        // Prevent Drop from running (which would shut down the channel)
7542        std::mem::forget(self);
7543    }
7544}
7545
7546impl RuleSetV4AddRuleResponder {
7547    /// Sends a response to the FIDL transaction.
7548    ///
7549    /// Sets the channel to shutdown if an error occurs.
7550    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7551        let _result = self.send_raw(result);
7552        if _result.is_err() {
7553            self.control_handle.shutdown();
7554        }
7555        self.drop_without_shutdown();
7556        _result
7557    }
7558
7559    /// Similar to "send" but does not shutdown the channel if an error occurs.
7560    pub fn send_no_shutdown_on_err(
7561        self,
7562        mut result: Result<(), RuleSetError>,
7563    ) -> Result<(), fidl::Error> {
7564        let _result = self.send_raw(result);
7565        self.drop_without_shutdown();
7566        _result
7567    }
7568
7569    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7570        self.control_handle.inner.send::<fidl::encoding::ResultType<
7571            fidl::encoding::EmptyStruct,
7572            RuleSetError,
7573        >>(
7574            result,
7575            self.tx_id,
7576            0x7f68325de94e80,
7577            fidl::encoding::DynamicFlags::empty(),
7578        )
7579    }
7580}
7581
7582#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7583pub struct RuleSetV6Marker;
7584
7585impl fidl::endpoints::ProtocolMarker for RuleSetV6Marker {
7586    type Proxy = RuleSetV6Proxy;
7587    type RequestStream = RuleSetV6RequestStream;
7588    #[cfg(target_os = "fuchsia")]
7589    type SynchronousProxy = RuleSetV6SynchronousProxy;
7590
7591    const DEBUG_NAME: &'static str = "(anonymous) RuleSetV6";
7592}
7593pub type RuleSetV6AddRuleResult = Result<(), RuleSetError>;
7594
7595pub trait RuleSetV6ProxyInterface: Send + Sync {
7596    type AuthenticateForRouteTableResponseFut: std::future::Future<
7597            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
7598        > + Send;
7599    fn r#authenticate_for_route_table(
7600        &self,
7601        table: u32,
7602        token: fidl::Event,
7603    ) -> Self::AuthenticateForRouteTableResponseFut;
7604    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
7605        + Send;
7606    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
7607    fn r#close(&self) -> Result<(), fidl::Error>;
7608    type AddRuleResponseFut: std::future::Future<Output = Result<RuleSetV6AddRuleResult, fidl::Error>>
7609        + Send;
7610    fn r#add_rule(
7611        &self,
7612        index: u32,
7613        matcher: &fidl_fuchsia_net_routes::RuleMatcherV6,
7614        action: &fidl_fuchsia_net_routes::RuleAction,
7615    ) -> Self::AddRuleResponseFut;
7616}
7617#[derive(Debug)]
7618#[cfg(target_os = "fuchsia")]
7619pub struct RuleSetV6SynchronousProxy {
7620    client: fidl::client::sync::Client,
7621}
7622
7623#[cfg(target_os = "fuchsia")]
7624impl fidl::endpoints::SynchronousProxy for RuleSetV6SynchronousProxy {
7625    type Proxy = RuleSetV6Proxy;
7626    type Protocol = RuleSetV6Marker;
7627
7628    fn from_channel(inner: fidl::Channel) -> Self {
7629        Self::new(inner)
7630    }
7631
7632    fn into_channel(self) -> fidl::Channel {
7633        self.client.into_channel()
7634    }
7635
7636    fn as_channel(&self) -> &fidl::Channel {
7637        self.client.as_channel()
7638    }
7639}
7640
7641#[cfg(target_os = "fuchsia")]
7642impl RuleSetV6SynchronousProxy {
7643    pub fn new(channel: fidl::Channel) -> Self {
7644        Self { client: fidl::client::sync::Client::new(channel) }
7645    }
7646
7647    pub fn into_channel(self) -> fidl::Channel {
7648        self.client.into_channel()
7649    }
7650
7651    /// Waits until an event arrives and returns it. It is safe for other
7652    /// threads to make concurrent requests while waiting for an event.
7653    pub fn wait_for_event(
7654        &self,
7655        deadline: zx::MonotonicInstant,
7656    ) -> Result<RuleSetV6Event, fidl::Error> {
7657        RuleSetV6Event::decode(self.client.wait_for_event::<RuleSetV6Marker>(deadline)?)
7658    }
7659
7660    /// Authenticates for a route table that will be used in an action.
7661    pub fn r#authenticate_for_route_table(
7662        &self,
7663        mut table: u32,
7664        mut token: fidl::Event,
7665        ___deadline: zx::MonotonicInstant,
7666    ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
7667        let _response =
7668            self.client.send_query::<ProofOfRouteTableAuthorization, fidl::encoding::ResultType<
7669                fidl::encoding::EmptyStruct,
7670                AuthenticateForRouteTableError,
7671            >, RuleSetV6Marker>(
7672                (table, token),
7673                0x6fd845360ed9bc8f,
7674                fidl::encoding::DynamicFlags::empty(),
7675                ___deadline,
7676            )?;
7677        Ok(_response.map(|x| x))
7678    }
7679
7680    /// Removes a rule from this rule set.
7681    ///
7682    /// If the client tries to remove from an index that does not have a rule,
7683    /// the error `RULE_DOES_NOT_EXIST` will be returned.
7684    ///
7685    /// + request `index` the index of the rule.
7686    pub fn r#remove_rule(
7687        &self,
7688        mut index: u32,
7689        ___deadline: zx::MonotonicInstant,
7690    ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
7691        let _response = self.client.send_query::<
7692            BaseRuleSetRemoveRuleRequest,
7693            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7694            RuleSetV6Marker,
7695        >(
7696            (index,),
7697            0x2ae3d7e817cbff90,
7698            fidl::encoding::DynamicFlags::empty(),
7699            ___deadline,
7700        )?;
7701        Ok(_response.map(|x| x))
7702    }
7703
7704    /// Removes all rules in the rule set and the underlying channel will be
7705    /// closed after the rules are removed.
7706    ///
7707    /// This method provides a way for synchronous closure.
7708    pub fn r#close(&self) -> Result<(), fidl::Error> {
7709        self.client.send::<fidl::encoding::EmptyPayload>(
7710            (),
7711            0x457e1753672d4073,
7712            fidl::encoding::DynamicFlags::empty(),
7713        )
7714    }
7715
7716    /// Adds a rule to this rule set.
7717    ///
7718    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
7719    /// is returned.
7720    ///
7721    /// + request `index` where to insert the rule.
7722    /// + request `matcher` the matcher of the rule.
7723    /// + request `action` action of the rule.
7724    pub fn r#add_rule(
7725        &self,
7726        mut index: u32,
7727        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV6,
7728        mut action: &fidl_fuchsia_net_routes::RuleAction,
7729        ___deadline: zx::MonotonicInstant,
7730    ) -> Result<RuleSetV6AddRuleResult, fidl::Error> {
7731        let _response = self.client.send_query::<
7732            RuleSetV6AddRuleRequest,
7733            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7734            RuleSetV6Marker,
7735        >(
7736            (index, matcher, action,),
7737            0x946cad8f8a726b3,
7738            fidl::encoding::DynamicFlags::empty(),
7739            ___deadline,
7740        )?;
7741        Ok(_response.map(|x| x))
7742    }
7743}
7744
7745#[cfg(target_os = "fuchsia")]
7746impl From<RuleSetV6SynchronousProxy> for zx::NullableHandle {
7747    fn from(value: RuleSetV6SynchronousProxy) -> Self {
7748        value.into_channel().into()
7749    }
7750}
7751
7752#[cfg(target_os = "fuchsia")]
7753impl From<fidl::Channel> for RuleSetV6SynchronousProxy {
7754    fn from(value: fidl::Channel) -> Self {
7755        Self::new(value)
7756    }
7757}
7758
7759#[cfg(target_os = "fuchsia")]
7760impl fidl::endpoints::FromClient for RuleSetV6SynchronousProxy {
7761    type Protocol = RuleSetV6Marker;
7762
7763    fn from_client(value: fidl::endpoints::ClientEnd<RuleSetV6Marker>) -> Self {
7764        Self::new(value.into_channel())
7765    }
7766}
7767
7768#[derive(Debug, Clone)]
7769pub struct RuleSetV6Proxy {
7770    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7771}
7772
7773impl fidl::endpoints::Proxy for RuleSetV6Proxy {
7774    type Protocol = RuleSetV6Marker;
7775
7776    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7777        Self::new(inner)
7778    }
7779
7780    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7781        self.client.into_channel().map_err(|client| Self { client })
7782    }
7783
7784    fn as_channel(&self) -> &::fidl::AsyncChannel {
7785        self.client.as_channel()
7786    }
7787}
7788
7789impl RuleSetV6Proxy {
7790    /// Create a new Proxy for fuchsia.net.routes.admin/RuleSetV6.
7791    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7792        let protocol_name = <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7793        Self { client: fidl::client::Client::new(channel, protocol_name) }
7794    }
7795
7796    /// Get a Stream of events from the remote end of the protocol.
7797    ///
7798    /// # Panics
7799    ///
7800    /// Panics if the event stream was already taken.
7801    pub fn take_event_stream(&self) -> RuleSetV6EventStream {
7802        RuleSetV6EventStream { event_receiver: self.client.take_event_receiver() }
7803    }
7804
7805    /// Authenticates for a route table that will be used in an action.
7806    pub fn r#authenticate_for_route_table(
7807        &self,
7808        mut table: u32,
7809        mut token: fidl::Event,
7810    ) -> fidl::client::QueryResponseFut<
7811        BaseRuleSetAuthenticateForRouteTableResult,
7812        fidl::encoding::DefaultFuchsiaResourceDialect,
7813    > {
7814        RuleSetV6ProxyInterface::r#authenticate_for_route_table(self, table, token)
7815    }
7816
7817    /// Removes a rule from this rule set.
7818    ///
7819    /// If the client tries to remove from an index that does not have a rule,
7820    /// the error `RULE_DOES_NOT_EXIST` will be returned.
7821    ///
7822    /// + request `index` the index of the rule.
7823    pub fn r#remove_rule(
7824        &self,
7825        mut index: u32,
7826    ) -> fidl::client::QueryResponseFut<
7827        BaseRuleSetRemoveRuleResult,
7828        fidl::encoding::DefaultFuchsiaResourceDialect,
7829    > {
7830        RuleSetV6ProxyInterface::r#remove_rule(self, index)
7831    }
7832
7833    /// Removes all rules in the rule set and the underlying channel will be
7834    /// closed after the rules are removed.
7835    ///
7836    /// This method provides a way for synchronous closure.
7837    pub fn r#close(&self) -> Result<(), fidl::Error> {
7838        RuleSetV6ProxyInterface::r#close(self)
7839    }
7840
7841    /// Adds a rule to this rule set.
7842    ///
7843    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
7844    /// is returned.
7845    ///
7846    /// + request `index` where to insert the rule.
7847    /// + request `matcher` the matcher of the rule.
7848    /// + request `action` action of the rule.
7849    pub fn r#add_rule(
7850        &self,
7851        mut index: u32,
7852        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV6,
7853        mut action: &fidl_fuchsia_net_routes::RuleAction,
7854    ) -> fidl::client::QueryResponseFut<
7855        RuleSetV6AddRuleResult,
7856        fidl::encoding::DefaultFuchsiaResourceDialect,
7857    > {
7858        RuleSetV6ProxyInterface::r#add_rule(self, index, matcher, action)
7859    }
7860}
7861
7862impl RuleSetV6ProxyInterface for RuleSetV6Proxy {
7863    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
7864        BaseRuleSetAuthenticateForRouteTableResult,
7865        fidl::encoding::DefaultFuchsiaResourceDialect,
7866    >;
7867    fn r#authenticate_for_route_table(
7868        &self,
7869        mut table: u32,
7870        mut token: fidl::Event,
7871    ) -> Self::AuthenticateForRouteTableResponseFut {
7872        fn _decode(
7873            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7874        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
7875            let _response = fidl::client::decode_transaction_body::<
7876                fidl::encoding::ResultType<
7877                    fidl::encoding::EmptyStruct,
7878                    AuthenticateForRouteTableError,
7879                >,
7880                fidl::encoding::DefaultFuchsiaResourceDialect,
7881                0x6fd845360ed9bc8f,
7882            >(_buf?)?;
7883            Ok(_response.map(|x| x))
7884        }
7885        self.client.send_query_and_decode::<
7886            ProofOfRouteTableAuthorization,
7887            BaseRuleSetAuthenticateForRouteTableResult,
7888        >(
7889            (table, token,),
7890            0x6fd845360ed9bc8f,
7891            fidl::encoding::DynamicFlags::empty(),
7892            _decode,
7893        )
7894    }
7895
7896    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
7897        BaseRuleSetRemoveRuleResult,
7898        fidl::encoding::DefaultFuchsiaResourceDialect,
7899    >;
7900    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
7901        fn _decode(
7902            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7903        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
7904            let _response = fidl::client::decode_transaction_body::<
7905                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7906                fidl::encoding::DefaultFuchsiaResourceDialect,
7907                0x2ae3d7e817cbff90,
7908            >(_buf?)?;
7909            Ok(_response.map(|x| x))
7910        }
7911        self.client
7912            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
7913                (index,),
7914                0x2ae3d7e817cbff90,
7915                fidl::encoding::DynamicFlags::empty(),
7916                _decode,
7917            )
7918    }
7919
7920    fn r#close(&self) -> Result<(), fidl::Error> {
7921        self.client.send::<fidl::encoding::EmptyPayload>(
7922            (),
7923            0x457e1753672d4073,
7924            fidl::encoding::DynamicFlags::empty(),
7925        )
7926    }
7927
7928    type AddRuleResponseFut = fidl::client::QueryResponseFut<
7929        RuleSetV6AddRuleResult,
7930        fidl::encoding::DefaultFuchsiaResourceDialect,
7931    >;
7932    fn r#add_rule(
7933        &self,
7934        mut index: u32,
7935        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV6,
7936        mut action: &fidl_fuchsia_net_routes::RuleAction,
7937    ) -> Self::AddRuleResponseFut {
7938        fn _decode(
7939            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7940        ) -> Result<RuleSetV6AddRuleResult, fidl::Error> {
7941            let _response = fidl::client::decode_transaction_body::<
7942                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7943                fidl::encoding::DefaultFuchsiaResourceDialect,
7944                0x946cad8f8a726b3,
7945            >(_buf?)?;
7946            Ok(_response.map(|x| x))
7947        }
7948        self.client.send_query_and_decode::<RuleSetV6AddRuleRequest, RuleSetV6AddRuleResult>(
7949            (index, matcher, action),
7950            0x946cad8f8a726b3,
7951            fidl::encoding::DynamicFlags::empty(),
7952            _decode,
7953        )
7954    }
7955}
7956
7957pub struct RuleSetV6EventStream {
7958    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7959}
7960
7961impl std::marker::Unpin for RuleSetV6EventStream {}
7962
7963impl futures::stream::FusedStream for RuleSetV6EventStream {
7964    fn is_terminated(&self) -> bool {
7965        self.event_receiver.is_terminated()
7966    }
7967}
7968
7969impl futures::Stream for RuleSetV6EventStream {
7970    type Item = Result<RuleSetV6Event, fidl::Error>;
7971
7972    fn poll_next(
7973        mut self: std::pin::Pin<&mut Self>,
7974        cx: &mut std::task::Context<'_>,
7975    ) -> std::task::Poll<Option<Self::Item>> {
7976        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7977            &mut self.event_receiver,
7978            cx
7979        )?) {
7980            Some(buf) => std::task::Poll::Ready(Some(RuleSetV6Event::decode(buf))),
7981            None => std::task::Poll::Ready(None),
7982        }
7983    }
7984}
7985
7986#[derive(Debug)]
7987pub enum RuleSetV6Event {}
7988
7989impl RuleSetV6Event {
7990    /// Decodes a message buffer as a [`RuleSetV6Event`].
7991    fn decode(
7992        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7993    ) -> Result<RuleSetV6Event, fidl::Error> {
7994        let (bytes, _handles) = buf.split_mut();
7995        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7996        debug_assert_eq!(tx_header.tx_id, 0);
7997        match tx_header.ordinal {
7998            _ => Err(fidl::Error::UnknownOrdinal {
7999                ordinal: tx_header.ordinal,
8000                protocol_name: <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8001            }),
8002        }
8003    }
8004}
8005
8006/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleSetV6.
8007pub struct RuleSetV6RequestStream {
8008    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8009    is_terminated: bool,
8010}
8011
8012impl std::marker::Unpin for RuleSetV6RequestStream {}
8013
8014impl futures::stream::FusedStream for RuleSetV6RequestStream {
8015    fn is_terminated(&self) -> bool {
8016        self.is_terminated
8017    }
8018}
8019
8020impl fidl::endpoints::RequestStream for RuleSetV6RequestStream {
8021    type Protocol = RuleSetV6Marker;
8022    type ControlHandle = RuleSetV6ControlHandle;
8023
8024    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8025        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8026    }
8027
8028    fn control_handle(&self) -> Self::ControlHandle {
8029        RuleSetV6ControlHandle { inner: self.inner.clone() }
8030    }
8031
8032    fn into_inner(
8033        self,
8034    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8035    {
8036        (self.inner, self.is_terminated)
8037    }
8038
8039    fn from_inner(
8040        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8041        is_terminated: bool,
8042    ) -> Self {
8043        Self { inner, is_terminated }
8044    }
8045}
8046
8047impl futures::Stream for RuleSetV6RequestStream {
8048    type Item = Result<RuleSetV6Request, fidl::Error>;
8049
8050    fn poll_next(
8051        mut self: std::pin::Pin<&mut Self>,
8052        cx: &mut std::task::Context<'_>,
8053    ) -> std::task::Poll<Option<Self::Item>> {
8054        let this = &mut *self;
8055        if this.inner.check_shutdown(cx) {
8056            this.is_terminated = true;
8057            return std::task::Poll::Ready(None);
8058        }
8059        if this.is_terminated {
8060            panic!("polled RuleSetV6RequestStream after completion");
8061        }
8062        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8063            |bytes, handles| {
8064                match this.inner.channel().read_etc(cx, bytes, handles) {
8065                    std::task::Poll::Ready(Ok(())) => {}
8066                    std::task::Poll::Pending => return std::task::Poll::Pending,
8067                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8068                        this.is_terminated = true;
8069                        return std::task::Poll::Ready(None);
8070                    }
8071                    std::task::Poll::Ready(Err(e)) => {
8072                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8073                            e.into(),
8074                        ))));
8075                    }
8076                }
8077
8078                // A message has been received from the channel
8079                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8080
8081                std::task::Poll::Ready(Some(match header.ordinal {
8082                    0x6fd845360ed9bc8f => {
8083                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8084                        let mut req = fidl::new_empty!(
8085                            ProofOfRouteTableAuthorization,
8086                            fidl::encoding::DefaultFuchsiaResourceDialect
8087                        );
8088                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
8089                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
8090                        Ok(RuleSetV6Request::AuthenticateForRouteTable {
8091                            table: req.table,
8092                            token: req.token,
8093
8094                            responder: RuleSetV6AuthenticateForRouteTableResponder {
8095                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8096                                tx_id: header.tx_id,
8097                            },
8098                        })
8099                    }
8100                    0x2ae3d7e817cbff90 => {
8101                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8102                        let mut req = fidl::new_empty!(
8103                            BaseRuleSetRemoveRuleRequest,
8104                            fidl::encoding::DefaultFuchsiaResourceDialect
8105                        );
8106                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
8107                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
8108                        Ok(RuleSetV6Request::RemoveRule {
8109                            index: req.index,
8110
8111                            responder: RuleSetV6RemoveRuleResponder {
8112                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8113                                tx_id: header.tx_id,
8114                            },
8115                        })
8116                    }
8117                    0x457e1753672d4073 => {
8118                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8119                        let mut req = fidl::new_empty!(
8120                            fidl::encoding::EmptyPayload,
8121                            fidl::encoding::DefaultFuchsiaResourceDialect
8122                        );
8123                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8124                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
8125                        Ok(RuleSetV6Request::Close { control_handle })
8126                    }
8127                    0x946cad8f8a726b3 => {
8128                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8129                        let mut req = fidl::new_empty!(
8130                            RuleSetV6AddRuleRequest,
8131                            fidl::encoding::DefaultFuchsiaResourceDialect
8132                        );
8133                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RuleSetV6AddRuleRequest>(&header, _body_bytes, handles, &mut req)?;
8134                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
8135                        Ok(RuleSetV6Request::AddRule {
8136                            index: req.index,
8137                            matcher: req.matcher,
8138                            action: req.action,
8139
8140                            responder: RuleSetV6AddRuleResponder {
8141                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8142                                tx_id: header.tx_id,
8143                            },
8144                        })
8145                    }
8146                    _ => Err(fidl::Error::UnknownOrdinal {
8147                        ordinal: header.ordinal,
8148                        protocol_name:
8149                            <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8150                    }),
8151                }))
8152            },
8153        )
8154    }
8155}
8156
8157/// Provides mutable access over a set of the system's IPv6 route rules.
8158///
8159/// A `RuleSet` has a priority and a rule has an index. A global order among the
8160/// rules is determined first by the priority of the `RuleSet` the rule belongs
8161/// to, and then the index of the rule inside the `RuleSet`.
8162///
8163/// This protocol encodes the lifetime of the rule set. Closing the client end
8164/// removes the rule set, and all the rules that are owned by the rule set.
8165#[derive(Debug)]
8166pub enum RuleSetV6Request {
8167    /// Authenticates for a route table that will be used in an action.
8168    AuthenticateForRouteTable {
8169        table: u32,
8170        token: fidl::Event,
8171        responder: RuleSetV6AuthenticateForRouteTableResponder,
8172    },
8173    /// Removes a rule from this rule set.
8174    ///
8175    /// If the client tries to remove from an index that does not have a rule,
8176    /// the error `RULE_DOES_NOT_EXIST` will be returned.
8177    ///
8178    /// + request `index` the index of the rule.
8179    RemoveRule { index: u32, responder: RuleSetV6RemoveRuleResponder },
8180    /// Removes all rules in the rule set and the underlying channel will be
8181    /// closed after the rules are removed.
8182    ///
8183    /// This method provides a way for synchronous closure.
8184    Close { control_handle: RuleSetV6ControlHandle },
8185    /// Adds a rule to this rule set.
8186    ///
8187    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
8188    /// is returned.
8189    ///
8190    /// + request `index` where to insert the rule.
8191    /// + request `matcher` the matcher of the rule.
8192    /// + request `action` action of the rule.
8193    AddRule {
8194        index: u32,
8195        matcher: fidl_fuchsia_net_routes::RuleMatcherV6,
8196        action: fidl_fuchsia_net_routes::RuleAction,
8197        responder: RuleSetV6AddRuleResponder,
8198    },
8199}
8200
8201impl RuleSetV6Request {
8202    #[allow(irrefutable_let_patterns)]
8203    pub fn into_authenticate_for_route_table(
8204        self,
8205    ) -> Option<(u32, fidl::Event, RuleSetV6AuthenticateForRouteTableResponder)> {
8206        if let RuleSetV6Request::AuthenticateForRouteTable { table, token, responder } = self {
8207            Some((table, token, responder))
8208        } else {
8209            None
8210        }
8211    }
8212
8213    #[allow(irrefutable_let_patterns)]
8214    pub fn into_remove_rule(self) -> Option<(u32, RuleSetV6RemoveRuleResponder)> {
8215        if let RuleSetV6Request::RemoveRule { index, responder } = self {
8216            Some((index, responder))
8217        } else {
8218            None
8219        }
8220    }
8221
8222    #[allow(irrefutable_let_patterns)]
8223    pub fn into_close(self) -> Option<(RuleSetV6ControlHandle)> {
8224        if let RuleSetV6Request::Close { control_handle } = self {
8225            Some((control_handle))
8226        } else {
8227            None
8228        }
8229    }
8230
8231    #[allow(irrefutable_let_patterns)]
8232    pub fn into_add_rule(
8233        self,
8234    ) -> Option<(
8235        u32,
8236        fidl_fuchsia_net_routes::RuleMatcherV6,
8237        fidl_fuchsia_net_routes::RuleAction,
8238        RuleSetV6AddRuleResponder,
8239    )> {
8240        if let RuleSetV6Request::AddRule { index, matcher, action, responder } = self {
8241            Some((index, matcher, action, responder))
8242        } else {
8243            None
8244        }
8245    }
8246
8247    /// Name of the method defined in FIDL
8248    pub fn method_name(&self) -> &'static str {
8249        match *self {
8250            RuleSetV6Request::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
8251            RuleSetV6Request::RemoveRule { .. } => "remove_rule",
8252            RuleSetV6Request::Close { .. } => "close",
8253            RuleSetV6Request::AddRule { .. } => "add_rule",
8254        }
8255    }
8256}
8257
8258#[derive(Debug, Clone)]
8259pub struct RuleSetV6ControlHandle {
8260    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8261}
8262
8263impl RuleSetV6ControlHandle {
8264    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8265        self.inner.shutdown_with_epitaph(status.into())
8266    }
8267}
8268
8269impl fidl::endpoints::ControlHandle for RuleSetV6ControlHandle {
8270    fn shutdown(&self) {
8271        self.inner.shutdown()
8272    }
8273
8274    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8275        self.inner.shutdown_with_epitaph(status)
8276    }
8277
8278    fn is_closed(&self) -> bool {
8279        self.inner.channel().is_closed()
8280    }
8281    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8282        self.inner.channel().on_closed()
8283    }
8284
8285    #[cfg(target_os = "fuchsia")]
8286    fn signal_peer(
8287        &self,
8288        clear_mask: zx::Signals,
8289        set_mask: zx::Signals,
8290    ) -> Result<(), zx_status::Status> {
8291        use fidl::Peered;
8292        self.inner.channel().signal_peer(clear_mask, set_mask)
8293    }
8294}
8295
8296impl RuleSetV6ControlHandle {}
8297
8298#[must_use = "FIDL methods require a response to be sent"]
8299#[derive(Debug)]
8300pub struct RuleSetV6AuthenticateForRouteTableResponder {
8301    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
8302    tx_id: u32,
8303}
8304
8305/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
8306/// if the responder is dropped without sending a response, so that the client
8307/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8308impl std::ops::Drop for RuleSetV6AuthenticateForRouteTableResponder {
8309    fn drop(&mut self) {
8310        self.control_handle.shutdown();
8311        // Safety: drops once, never accessed again
8312        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8313    }
8314}
8315
8316impl fidl::endpoints::Responder for RuleSetV6AuthenticateForRouteTableResponder {
8317    type ControlHandle = RuleSetV6ControlHandle;
8318
8319    fn control_handle(&self) -> &RuleSetV6ControlHandle {
8320        &self.control_handle
8321    }
8322
8323    fn drop_without_shutdown(mut self) {
8324        // Safety: drops once, never accessed again due to mem::forget
8325        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8326        // Prevent Drop from running (which would shut down the channel)
8327        std::mem::forget(self);
8328    }
8329}
8330
8331impl RuleSetV6AuthenticateForRouteTableResponder {
8332    /// Sends a response to the FIDL transaction.
8333    ///
8334    /// Sets the channel to shutdown if an error occurs.
8335    pub fn send(
8336        self,
8337        mut result: Result<(), AuthenticateForRouteTableError>,
8338    ) -> Result<(), fidl::Error> {
8339        let _result = self.send_raw(result);
8340        if _result.is_err() {
8341            self.control_handle.shutdown();
8342        }
8343        self.drop_without_shutdown();
8344        _result
8345    }
8346
8347    /// Similar to "send" but does not shutdown the channel if an error occurs.
8348    pub fn send_no_shutdown_on_err(
8349        self,
8350        mut result: Result<(), AuthenticateForRouteTableError>,
8351    ) -> Result<(), fidl::Error> {
8352        let _result = self.send_raw(result);
8353        self.drop_without_shutdown();
8354        _result
8355    }
8356
8357    fn send_raw(
8358        &self,
8359        mut result: Result<(), AuthenticateForRouteTableError>,
8360    ) -> Result<(), fidl::Error> {
8361        self.control_handle.inner.send::<fidl::encoding::ResultType<
8362            fidl::encoding::EmptyStruct,
8363            AuthenticateForRouteTableError,
8364        >>(
8365            result,
8366            self.tx_id,
8367            0x6fd845360ed9bc8f,
8368            fidl::encoding::DynamicFlags::empty(),
8369        )
8370    }
8371}
8372
8373#[must_use = "FIDL methods require a response to be sent"]
8374#[derive(Debug)]
8375pub struct RuleSetV6RemoveRuleResponder {
8376    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
8377    tx_id: u32,
8378}
8379
8380/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
8381/// if the responder is dropped without sending a response, so that the client
8382/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8383impl std::ops::Drop for RuleSetV6RemoveRuleResponder {
8384    fn drop(&mut self) {
8385        self.control_handle.shutdown();
8386        // Safety: drops once, never accessed again
8387        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8388    }
8389}
8390
8391impl fidl::endpoints::Responder for RuleSetV6RemoveRuleResponder {
8392    type ControlHandle = RuleSetV6ControlHandle;
8393
8394    fn control_handle(&self) -> &RuleSetV6ControlHandle {
8395        &self.control_handle
8396    }
8397
8398    fn drop_without_shutdown(mut self) {
8399        // Safety: drops once, never accessed again due to mem::forget
8400        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8401        // Prevent Drop from running (which would shut down the channel)
8402        std::mem::forget(self);
8403    }
8404}
8405
8406impl RuleSetV6RemoveRuleResponder {
8407    /// Sends a response to the FIDL transaction.
8408    ///
8409    /// Sets the channel to shutdown if an error occurs.
8410    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
8411        let _result = self.send_raw(result);
8412        if _result.is_err() {
8413            self.control_handle.shutdown();
8414        }
8415        self.drop_without_shutdown();
8416        _result
8417    }
8418
8419    /// Similar to "send" but does not shutdown the channel if an error occurs.
8420    pub fn send_no_shutdown_on_err(
8421        self,
8422        mut result: Result<(), RuleSetError>,
8423    ) -> Result<(), fidl::Error> {
8424        let _result = self.send_raw(result);
8425        self.drop_without_shutdown();
8426        _result
8427    }
8428
8429    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
8430        self.control_handle.inner.send::<fidl::encoding::ResultType<
8431            fidl::encoding::EmptyStruct,
8432            RuleSetError,
8433        >>(
8434            result,
8435            self.tx_id,
8436            0x2ae3d7e817cbff90,
8437            fidl::encoding::DynamicFlags::empty(),
8438        )
8439    }
8440}
8441
8442#[must_use = "FIDL methods require a response to be sent"]
8443#[derive(Debug)]
8444pub struct RuleSetV6AddRuleResponder {
8445    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
8446    tx_id: u32,
8447}
8448
8449/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
8450/// if the responder is dropped without sending a response, so that the client
8451/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8452impl std::ops::Drop for RuleSetV6AddRuleResponder {
8453    fn drop(&mut self) {
8454        self.control_handle.shutdown();
8455        // Safety: drops once, never accessed again
8456        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8457    }
8458}
8459
8460impl fidl::endpoints::Responder for RuleSetV6AddRuleResponder {
8461    type ControlHandle = RuleSetV6ControlHandle;
8462
8463    fn control_handle(&self) -> &RuleSetV6ControlHandle {
8464        &self.control_handle
8465    }
8466
8467    fn drop_without_shutdown(mut self) {
8468        // Safety: drops once, never accessed again due to mem::forget
8469        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8470        // Prevent Drop from running (which would shut down the channel)
8471        std::mem::forget(self);
8472    }
8473}
8474
8475impl RuleSetV6AddRuleResponder {
8476    /// Sends a response to the FIDL transaction.
8477    ///
8478    /// Sets the channel to shutdown if an error occurs.
8479    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
8480        let _result = self.send_raw(result);
8481        if _result.is_err() {
8482            self.control_handle.shutdown();
8483        }
8484        self.drop_without_shutdown();
8485        _result
8486    }
8487
8488    /// Similar to "send" but does not shutdown the channel if an error occurs.
8489    pub fn send_no_shutdown_on_err(
8490        self,
8491        mut result: Result<(), RuleSetError>,
8492    ) -> Result<(), fidl::Error> {
8493        let _result = self.send_raw(result);
8494        self.drop_without_shutdown();
8495        _result
8496    }
8497
8498    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
8499        self.control_handle.inner.send::<fidl::encoding::ResultType<
8500            fidl::encoding::EmptyStruct,
8501            RuleSetError,
8502        >>(
8503            result,
8504            self.tx_id,
8505            0x946cad8f8a726b3,
8506            fidl::encoding::DynamicFlags::empty(),
8507        )
8508    }
8509}
8510
8511#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8512pub struct RuleTableV4Marker;
8513
8514impl fidl::endpoints::ProtocolMarker for RuleTableV4Marker {
8515    type Proxy = RuleTableV4Proxy;
8516    type RequestStream = RuleTableV4RequestStream;
8517    #[cfg(target_os = "fuchsia")]
8518    type SynchronousProxy = RuleTableV4SynchronousProxy;
8519
8520    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RuleTableV4";
8521}
8522impl fidl::endpoints::DiscoverableProtocolMarker for RuleTableV4Marker {}
8523
8524pub trait RuleTableV4ProxyInterface: Send + Sync {
8525    fn r#new_rule_set(
8526        &self,
8527        priority: u32,
8528        rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8529    ) -> Result<(), fidl::Error>;
8530}
8531#[derive(Debug)]
8532#[cfg(target_os = "fuchsia")]
8533pub struct RuleTableV4SynchronousProxy {
8534    client: fidl::client::sync::Client,
8535}
8536
8537#[cfg(target_os = "fuchsia")]
8538impl fidl::endpoints::SynchronousProxy for RuleTableV4SynchronousProxy {
8539    type Proxy = RuleTableV4Proxy;
8540    type Protocol = RuleTableV4Marker;
8541
8542    fn from_channel(inner: fidl::Channel) -> Self {
8543        Self::new(inner)
8544    }
8545
8546    fn into_channel(self) -> fidl::Channel {
8547        self.client.into_channel()
8548    }
8549
8550    fn as_channel(&self) -> &fidl::Channel {
8551        self.client.as_channel()
8552    }
8553}
8554
8555#[cfg(target_os = "fuchsia")]
8556impl RuleTableV4SynchronousProxy {
8557    pub fn new(channel: fidl::Channel) -> Self {
8558        Self { client: fidl::client::sync::Client::new(channel) }
8559    }
8560
8561    pub fn into_channel(self) -> fidl::Channel {
8562        self.client.into_channel()
8563    }
8564
8565    /// Waits until an event arrives and returns it. It is safe for other
8566    /// threads to make concurrent requests while waiting for an event.
8567    pub fn wait_for_event(
8568        &self,
8569        deadline: zx::MonotonicInstant,
8570    ) -> Result<RuleTableV4Event, fidl::Error> {
8571        RuleTableV4Event::decode(self.client.wait_for_event::<RuleTableV4Marker>(deadline)?)
8572    }
8573
8574    /// Returns an empty rule set at requested priority.
8575    ///
8576    /// Clients are free to manage the rules within their own rule set, but not
8577    /// the rule set of others. Only one rule set is allowed at each `priority`
8578    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8579    /// a rule set at the given `priority`.
8580    ///
8581    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
8582    ///   globally ordered according to this number.
8583    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
8584    pub fn r#new_rule_set(
8585        &self,
8586        mut priority: u32,
8587        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8588    ) -> Result<(), fidl::Error> {
8589        self.client.send::<RuleTableV4NewRuleSetRequest>(
8590            (priority, rule_set),
8591            0xa32a9097da46f3a,
8592            fidl::encoding::DynamicFlags::empty(),
8593        )
8594    }
8595}
8596
8597#[cfg(target_os = "fuchsia")]
8598impl From<RuleTableV4SynchronousProxy> for zx::NullableHandle {
8599    fn from(value: RuleTableV4SynchronousProxy) -> Self {
8600        value.into_channel().into()
8601    }
8602}
8603
8604#[cfg(target_os = "fuchsia")]
8605impl From<fidl::Channel> for RuleTableV4SynchronousProxy {
8606    fn from(value: fidl::Channel) -> Self {
8607        Self::new(value)
8608    }
8609}
8610
8611#[cfg(target_os = "fuchsia")]
8612impl fidl::endpoints::FromClient for RuleTableV4SynchronousProxy {
8613    type Protocol = RuleTableV4Marker;
8614
8615    fn from_client(value: fidl::endpoints::ClientEnd<RuleTableV4Marker>) -> Self {
8616        Self::new(value.into_channel())
8617    }
8618}
8619
8620#[derive(Debug, Clone)]
8621pub struct RuleTableV4Proxy {
8622    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8623}
8624
8625impl fidl::endpoints::Proxy for RuleTableV4Proxy {
8626    type Protocol = RuleTableV4Marker;
8627
8628    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8629        Self::new(inner)
8630    }
8631
8632    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8633        self.client.into_channel().map_err(|client| Self { client })
8634    }
8635
8636    fn as_channel(&self) -> &::fidl::AsyncChannel {
8637        self.client.as_channel()
8638    }
8639}
8640
8641impl RuleTableV4Proxy {
8642    /// Create a new Proxy for fuchsia.net.routes.admin/RuleTableV4.
8643    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8644        let protocol_name = <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8645        Self { client: fidl::client::Client::new(channel, protocol_name) }
8646    }
8647
8648    /// Get a Stream of events from the remote end of the protocol.
8649    ///
8650    /// # Panics
8651    ///
8652    /// Panics if the event stream was already taken.
8653    pub fn take_event_stream(&self) -> RuleTableV4EventStream {
8654        RuleTableV4EventStream { event_receiver: self.client.take_event_receiver() }
8655    }
8656
8657    /// Returns an empty rule set at requested priority.
8658    ///
8659    /// Clients are free to manage the rules within their own rule set, but not
8660    /// the rule set of others. Only one rule set is allowed at each `priority`
8661    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8662    /// a rule set at the given `priority`.
8663    ///
8664    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
8665    ///   globally ordered according to this number.
8666    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
8667    pub fn r#new_rule_set(
8668        &self,
8669        mut priority: u32,
8670        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8671    ) -> Result<(), fidl::Error> {
8672        RuleTableV4ProxyInterface::r#new_rule_set(self, priority, rule_set)
8673    }
8674}
8675
8676impl RuleTableV4ProxyInterface for RuleTableV4Proxy {
8677    fn r#new_rule_set(
8678        &self,
8679        mut priority: u32,
8680        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8681    ) -> Result<(), fidl::Error> {
8682        self.client.send::<RuleTableV4NewRuleSetRequest>(
8683            (priority, rule_set),
8684            0xa32a9097da46f3a,
8685            fidl::encoding::DynamicFlags::empty(),
8686        )
8687    }
8688}
8689
8690pub struct RuleTableV4EventStream {
8691    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8692}
8693
8694impl std::marker::Unpin for RuleTableV4EventStream {}
8695
8696impl futures::stream::FusedStream for RuleTableV4EventStream {
8697    fn is_terminated(&self) -> bool {
8698        self.event_receiver.is_terminated()
8699    }
8700}
8701
8702impl futures::Stream for RuleTableV4EventStream {
8703    type Item = Result<RuleTableV4Event, fidl::Error>;
8704
8705    fn poll_next(
8706        mut self: std::pin::Pin<&mut Self>,
8707        cx: &mut std::task::Context<'_>,
8708    ) -> std::task::Poll<Option<Self::Item>> {
8709        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8710            &mut self.event_receiver,
8711            cx
8712        )?) {
8713            Some(buf) => std::task::Poll::Ready(Some(RuleTableV4Event::decode(buf))),
8714            None => std::task::Poll::Ready(None),
8715        }
8716    }
8717}
8718
8719#[derive(Debug)]
8720pub enum RuleTableV4Event {}
8721
8722impl RuleTableV4Event {
8723    /// Decodes a message buffer as a [`RuleTableV4Event`].
8724    fn decode(
8725        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8726    ) -> Result<RuleTableV4Event, fidl::Error> {
8727        let (bytes, _handles) = buf.split_mut();
8728        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8729        debug_assert_eq!(tx_header.tx_id, 0);
8730        match tx_header.ordinal {
8731            _ => Err(fidl::Error::UnknownOrdinal {
8732                ordinal: tx_header.ordinal,
8733                protocol_name: <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8734            }),
8735        }
8736    }
8737}
8738
8739/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleTableV4.
8740pub struct RuleTableV4RequestStream {
8741    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8742    is_terminated: bool,
8743}
8744
8745impl std::marker::Unpin for RuleTableV4RequestStream {}
8746
8747impl futures::stream::FusedStream for RuleTableV4RequestStream {
8748    fn is_terminated(&self) -> bool {
8749        self.is_terminated
8750    }
8751}
8752
8753impl fidl::endpoints::RequestStream for RuleTableV4RequestStream {
8754    type Protocol = RuleTableV4Marker;
8755    type ControlHandle = RuleTableV4ControlHandle;
8756
8757    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8758        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8759    }
8760
8761    fn control_handle(&self) -> Self::ControlHandle {
8762        RuleTableV4ControlHandle { inner: self.inner.clone() }
8763    }
8764
8765    fn into_inner(
8766        self,
8767    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8768    {
8769        (self.inner, self.is_terminated)
8770    }
8771
8772    fn from_inner(
8773        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8774        is_terminated: bool,
8775    ) -> Self {
8776        Self { inner, is_terminated }
8777    }
8778}
8779
8780impl futures::Stream for RuleTableV4RequestStream {
8781    type Item = Result<RuleTableV4Request, fidl::Error>;
8782
8783    fn poll_next(
8784        mut self: std::pin::Pin<&mut Self>,
8785        cx: &mut std::task::Context<'_>,
8786    ) -> std::task::Poll<Option<Self::Item>> {
8787        let this = &mut *self;
8788        if this.inner.check_shutdown(cx) {
8789            this.is_terminated = true;
8790            return std::task::Poll::Ready(None);
8791        }
8792        if this.is_terminated {
8793            panic!("polled RuleTableV4RequestStream after completion");
8794        }
8795        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8796            |bytes, handles| {
8797                match this.inner.channel().read_etc(cx, bytes, handles) {
8798                    std::task::Poll::Ready(Ok(())) => {}
8799                    std::task::Poll::Pending => return std::task::Poll::Pending,
8800                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8801                        this.is_terminated = true;
8802                        return std::task::Poll::Ready(None);
8803                    }
8804                    std::task::Poll::Ready(Err(e)) => {
8805                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8806                            e.into(),
8807                        ))));
8808                    }
8809                }
8810
8811                // A message has been received from the channel
8812                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8813
8814                std::task::Poll::Ready(Some(match header.ordinal {
8815                    0xa32a9097da46f3a => {
8816                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8817                        let mut req = fidl::new_empty!(
8818                            RuleTableV4NewRuleSetRequest,
8819                            fidl::encoding::DefaultFuchsiaResourceDialect
8820                        );
8821                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RuleTableV4NewRuleSetRequest>(&header, _body_bytes, handles, &mut req)?;
8822                        let control_handle = RuleTableV4ControlHandle { inner: this.inner.clone() };
8823                        Ok(RuleTableV4Request::NewRuleSet {
8824                            priority: req.priority,
8825                            rule_set: req.rule_set,
8826
8827                            control_handle,
8828                        })
8829                    }
8830                    _ => Err(fidl::Error::UnknownOrdinal {
8831                        ordinal: header.ordinal,
8832                        protocol_name:
8833                            <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8834                    }),
8835                }))
8836            },
8837        )
8838    }
8839}
8840
8841/// Gives isolated access to the system's policy routing rules.
8842#[derive(Debug)]
8843pub enum RuleTableV4Request {
8844    /// Returns an empty rule set at requested priority.
8845    ///
8846    /// Clients are free to manage the rules within their own rule set, but not
8847    /// the rule set of others. Only one rule set is allowed at each `priority`
8848    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8849    /// a rule set at the given `priority`.
8850    ///
8851    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
8852    ///   globally ordered according to this number.
8853    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
8854    NewRuleSet {
8855        priority: u32,
8856        rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8857        control_handle: RuleTableV4ControlHandle,
8858    },
8859}
8860
8861impl RuleTableV4Request {
8862    #[allow(irrefutable_let_patterns)]
8863    pub fn into_new_rule_set(
8864        self,
8865    ) -> Option<(u32, fidl::endpoints::ServerEnd<RuleSetV4Marker>, RuleTableV4ControlHandle)> {
8866        if let RuleTableV4Request::NewRuleSet { priority, rule_set, control_handle } = self {
8867            Some((priority, rule_set, control_handle))
8868        } else {
8869            None
8870        }
8871    }
8872
8873    /// Name of the method defined in FIDL
8874    pub fn method_name(&self) -> &'static str {
8875        match *self {
8876            RuleTableV4Request::NewRuleSet { .. } => "new_rule_set",
8877        }
8878    }
8879}
8880
8881#[derive(Debug, Clone)]
8882pub struct RuleTableV4ControlHandle {
8883    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8884}
8885
8886impl RuleTableV4ControlHandle {
8887    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8888        self.inner.shutdown_with_epitaph(status.into())
8889    }
8890}
8891
8892impl fidl::endpoints::ControlHandle for RuleTableV4ControlHandle {
8893    fn shutdown(&self) {
8894        self.inner.shutdown()
8895    }
8896
8897    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8898        self.inner.shutdown_with_epitaph(status)
8899    }
8900
8901    fn is_closed(&self) -> bool {
8902        self.inner.channel().is_closed()
8903    }
8904    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8905        self.inner.channel().on_closed()
8906    }
8907
8908    #[cfg(target_os = "fuchsia")]
8909    fn signal_peer(
8910        &self,
8911        clear_mask: zx::Signals,
8912        set_mask: zx::Signals,
8913    ) -> Result<(), zx_status::Status> {
8914        use fidl::Peered;
8915        self.inner.channel().signal_peer(clear_mask, set_mask)
8916    }
8917}
8918
8919impl RuleTableV4ControlHandle {}
8920
8921#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8922pub struct RuleTableV6Marker;
8923
8924impl fidl::endpoints::ProtocolMarker for RuleTableV6Marker {
8925    type Proxy = RuleTableV6Proxy;
8926    type RequestStream = RuleTableV6RequestStream;
8927    #[cfg(target_os = "fuchsia")]
8928    type SynchronousProxy = RuleTableV6SynchronousProxy;
8929
8930    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RuleTableV6";
8931}
8932impl fidl::endpoints::DiscoverableProtocolMarker for RuleTableV6Marker {}
8933
8934pub trait RuleTableV6ProxyInterface: Send + Sync {
8935    fn r#new_rule_set(
8936        &self,
8937        priority: u32,
8938        rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
8939    ) -> Result<(), fidl::Error>;
8940}
8941#[derive(Debug)]
8942#[cfg(target_os = "fuchsia")]
8943pub struct RuleTableV6SynchronousProxy {
8944    client: fidl::client::sync::Client,
8945}
8946
8947#[cfg(target_os = "fuchsia")]
8948impl fidl::endpoints::SynchronousProxy for RuleTableV6SynchronousProxy {
8949    type Proxy = RuleTableV6Proxy;
8950    type Protocol = RuleTableV6Marker;
8951
8952    fn from_channel(inner: fidl::Channel) -> Self {
8953        Self::new(inner)
8954    }
8955
8956    fn into_channel(self) -> fidl::Channel {
8957        self.client.into_channel()
8958    }
8959
8960    fn as_channel(&self) -> &fidl::Channel {
8961        self.client.as_channel()
8962    }
8963}
8964
8965#[cfg(target_os = "fuchsia")]
8966impl RuleTableV6SynchronousProxy {
8967    pub fn new(channel: fidl::Channel) -> Self {
8968        Self { client: fidl::client::sync::Client::new(channel) }
8969    }
8970
8971    pub fn into_channel(self) -> fidl::Channel {
8972        self.client.into_channel()
8973    }
8974
8975    /// Waits until an event arrives and returns it. It is safe for other
8976    /// threads to make concurrent requests while waiting for an event.
8977    pub fn wait_for_event(
8978        &self,
8979        deadline: zx::MonotonicInstant,
8980    ) -> Result<RuleTableV6Event, fidl::Error> {
8981        RuleTableV6Event::decode(self.client.wait_for_event::<RuleTableV6Marker>(deadline)?)
8982    }
8983
8984    /// Returns an empty rule set at requested priority.
8985    ///
8986    /// Clients are free to manage the rules within their own rule set, but not
8987    /// the rule set of others. Only one rule set is allowed at each `priority`
8988    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8989    /// a rule set at the given `priority`.
8990    ///
8991    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
8992    ///   globally ordered according to this number.
8993    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
8994    pub fn r#new_rule_set(
8995        &self,
8996        mut priority: u32,
8997        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
8998    ) -> Result<(), fidl::Error> {
8999        self.client.send::<RuleTableV6NewRuleSetRequest>(
9000            (priority, rule_set),
9001            0x2261cc6eee9726a0,
9002            fidl::encoding::DynamicFlags::empty(),
9003        )
9004    }
9005}
9006
9007#[cfg(target_os = "fuchsia")]
9008impl From<RuleTableV6SynchronousProxy> for zx::NullableHandle {
9009    fn from(value: RuleTableV6SynchronousProxy) -> Self {
9010        value.into_channel().into()
9011    }
9012}
9013
9014#[cfg(target_os = "fuchsia")]
9015impl From<fidl::Channel> for RuleTableV6SynchronousProxy {
9016    fn from(value: fidl::Channel) -> Self {
9017        Self::new(value)
9018    }
9019}
9020
9021#[cfg(target_os = "fuchsia")]
9022impl fidl::endpoints::FromClient for RuleTableV6SynchronousProxy {
9023    type Protocol = RuleTableV6Marker;
9024
9025    fn from_client(value: fidl::endpoints::ClientEnd<RuleTableV6Marker>) -> Self {
9026        Self::new(value.into_channel())
9027    }
9028}
9029
9030#[derive(Debug, Clone)]
9031pub struct RuleTableV6Proxy {
9032    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9033}
9034
9035impl fidl::endpoints::Proxy for RuleTableV6Proxy {
9036    type Protocol = RuleTableV6Marker;
9037
9038    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9039        Self::new(inner)
9040    }
9041
9042    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9043        self.client.into_channel().map_err(|client| Self { client })
9044    }
9045
9046    fn as_channel(&self) -> &::fidl::AsyncChannel {
9047        self.client.as_channel()
9048    }
9049}
9050
9051impl RuleTableV6Proxy {
9052    /// Create a new Proxy for fuchsia.net.routes.admin/RuleTableV6.
9053    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9054        let protocol_name = <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9055        Self { client: fidl::client::Client::new(channel, protocol_name) }
9056    }
9057
9058    /// Get a Stream of events from the remote end of the protocol.
9059    ///
9060    /// # Panics
9061    ///
9062    /// Panics if the event stream was already taken.
9063    pub fn take_event_stream(&self) -> RuleTableV6EventStream {
9064        RuleTableV6EventStream { event_receiver: self.client.take_event_receiver() }
9065    }
9066
9067    /// Returns an empty rule set at requested priority.
9068    ///
9069    /// Clients are free to manage the rules within their own rule set, but not
9070    /// the rule set of others. Only one rule set is allowed at each `priority`
9071    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
9072    /// a rule set at the given `priority`.
9073    ///
9074    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
9075    ///   globally ordered according to this number.
9076    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
9077    pub fn r#new_rule_set(
9078        &self,
9079        mut priority: u32,
9080        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
9081    ) -> Result<(), fidl::Error> {
9082        RuleTableV6ProxyInterface::r#new_rule_set(self, priority, rule_set)
9083    }
9084}
9085
9086impl RuleTableV6ProxyInterface for RuleTableV6Proxy {
9087    fn r#new_rule_set(
9088        &self,
9089        mut priority: u32,
9090        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
9091    ) -> Result<(), fidl::Error> {
9092        self.client.send::<RuleTableV6NewRuleSetRequest>(
9093            (priority, rule_set),
9094            0x2261cc6eee9726a0,
9095            fidl::encoding::DynamicFlags::empty(),
9096        )
9097    }
9098}
9099
9100pub struct RuleTableV6EventStream {
9101    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9102}
9103
9104impl std::marker::Unpin for RuleTableV6EventStream {}
9105
9106impl futures::stream::FusedStream for RuleTableV6EventStream {
9107    fn is_terminated(&self) -> bool {
9108        self.event_receiver.is_terminated()
9109    }
9110}
9111
9112impl futures::Stream for RuleTableV6EventStream {
9113    type Item = Result<RuleTableV6Event, fidl::Error>;
9114
9115    fn poll_next(
9116        mut self: std::pin::Pin<&mut Self>,
9117        cx: &mut std::task::Context<'_>,
9118    ) -> std::task::Poll<Option<Self::Item>> {
9119        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9120            &mut self.event_receiver,
9121            cx
9122        )?) {
9123            Some(buf) => std::task::Poll::Ready(Some(RuleTableV6Event::decode(buf))),
9124            None => std::task::Poll::Ready(None),
9125        }
9126    }
9127}
9128
9129#[derive(Debug)]
9130pub enum RuleTableV6Event {}
9131
9132impl RuleTableV6Event {
9133    /// Decodes a message buffer as a [`RuleTableV6Event`].
9134    fn decode(
9135        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9136    ) -> Result<RuleTableV6Event, fidl::Error> {
9137        let (bytes, _handles) = buf.split_mut();
9138        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9139        debug_assert_eq!(tx_header.tx_id, 0);
9140        match tx_header.ordinal {
9141            _ => Err(fidl::Error::UnknownOrdinal {
9142                ordinal: tx_header.ordinal,
9143                protocol_name: <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9144            }),
9145        }
9146    }
9147}
9148
9149/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleTableV6.
9150pub struct RuleTableV6RequestStream {
9151    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9152    is_terminated: bool,
9153}
9154
9155impl std::marker::Unpin for RuleTableV6RequestStream {}
9156
9157impl futures::stream::FusedStream for RuleTableV6RequestStream {
9158    fn is_terminated(&self) -> bool {
9159        self.is_terminated
9160    }
9161}
9162
9163impl fidl::endpoints::RequestStream for RuleTableV6RequestStream {
9164    type Protocol = RuleTableV6Marker;
9165    type ControlHandle = RuleTableV6ControlHandle;
9166
9167    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9168        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9169    }
9170
9171    fn control_handle(&self) -> Self::ControlHandle {
9172        RuleTableV6ControlHandle { inner: self.inner.clone() }
9173    }
9174
9175    fn into_inner(
9176        self,
9177    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9178    {
9179        (self.inner, self.is_terminated)
9180    }
9181
9182    fn from_inner(
9183        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9184        is_terminated: bool,
9185    ) -> Self {
9186        Self { inner, is_terminated }
9187    }
9188}
9189
9190impl futures::Stream for RuleTableV6RequestStream {
9191    type Item = Result<RuleTableV6Request, fidl::Error>;
9192
9193    fn poll_next(
9194        mut self: std::pin::Pin<&mut Self>,
9195        cx: &mut std::task::Context<'_>,
9196    ) -> std::task::Poll<Option<Self::Item>> {
9197        let this = &mut *self;
9198        if this.inner.check_shutdown(cx) {
9199            this.is_terminated = true;
9200            return std::task::Poll::Ready(None);
9201        }
9202        if this.is_terminated {
9203            panic!("polled RuleTableV6RequestStream after completion");
9204        }
9205        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9206            |bytes, handles| {
9207                match this.inner.channel().read_etc(cx, bytes, handles) {
9208                    std::task::Poll::Ready(Ok(())) => {}
9209                    std::task::Poll::Pending => return std::task::Poll::Pending,
9210                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9211                        this.is_terminated = true;
9212                        return std::task::Poll::Ready(None);
9213                    }
9214                    std::task::Poll::Ready(Err(e)) => {
9215                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9216                            e.into(),
9217                        ))));
9218                    }
9219                }
9220
9221                // A message has been received from the channel
9222                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9223
9224                std::task::Poll::Ready(Some(match header.ordinal {
9225                    0x2261cc6eee9726a0 => {
9226                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9227                        let mut req = fidl::new_empty!(
9228                            RuleTableV6NewRuleSetRequest,
9229                            fidl::encoding::DefaultFuchsiaResourceDialect
9230                        );
9231                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RuleTableV6NewRuleSetRequest>(&header, _body_bytes, handles, &mut req)?;
9232                        let control_handle = RuleTableV6ControlHandle { inner: this.inner.clone() };
9233                        Ok(RuleTableV6Request::NewRuleSet {
9234                            priority: req.priority,
9235                            rule_set: req.rule_set,
9236
9237                            control_handle,
9238                        })
9239                    }
9240                    _ => Err(fidl::Error::UnknownOrdinal {
9241                        ordinal: header.ordinal,
9242                        protocol_name:
9243                            <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9244                    }),
9245                }))
9246            },
9247        )
9248    }
9249}
9250
9251/// Gives isolated access to the system's policy routing rules.
9252#[derive(Debug)]
9253pub enum RuleTableV6Request {
9254    /// Returns an empty rule set at requested priority.
9255    ///
9256    /// Clients are free to manage the rules within their own rule set, but not
9257    /// the rule set of others. Only one rule set is allowed at each `priority`
9258    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
9259    /// a rule set at the given `priority`.
9260    ///
9261    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
9262    ///   globally ordered according to this number.
9263    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
9264    NewRuleSet {
9265        priority: u32,
9266        rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
9267        control_handle: RuleTableV6ControlHandle,
9268    },
9269}
9270
9271impl RuleTableV6Request {
9272    #[allow(irrefutable_let_patterns)]
9273    pub fn into_new_rule_set(
9274        self,
9275    ) -> Option<(u32, fidl::endpoints::ServerEnd<RuleSetV6Marker>, RuleTableV6ControlHandle)> {
9276        if let RuleTableV6Request::NewRuleSet { priority, rule_set, control_handle } = self {
9277            Some((priority, rule_set, control_handle))
9278        } else {
9279            None
9280        }
9281    }
9282
9283    /// Name of the method defined in FIDL
9284    pub fn method_name(&self) -> &'static str {
9285        match *self {
9286            RuleTableV6Request::NewRuleSet { .. } => "new_rule_set",
9287        }
9288    }
9289}
9290
9291#[derive(Debug, Clone)]
9292pub struct RuleTableV6ControlHandle {
9293    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9294}
9295
9296impl RuleTableV6ControlHandle {
9297    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9298        self.inner.shutdown_with_epitaph(status.into())
9299    }
9300}
9301
9302impl fidl::endpoints::ControlHandle for RuleTableV6ControlHandle {
9303    fn shutdown(&self) {
9304        self.inner.shutdown()
9305    }
9306
9307    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9308        self.inner.shutdown_with_epitaph(status)
9309    }
9310
9311    fn is_closed(&self) -> bool {
9312        self.inner.channel().is_closed()
9313    }
9314    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9315        self.inner.channel().on_closed()
9316    }
9317
9318    #[cfg(target_os = "fuchsia")]
9319    fn signal_peer(
9320        &self,
9321        clear_mask: zx::Signals,
9322        set_mask: zx::Signals,
9323    ) -> Result<(), zx_status::Status> {
9324        use fidl::Peered;
9325        self.inner.channel().signal_peer(clear_mask, set_mask)
9326    }
9327}
9328
9329impl RuleTableV6ControlHandle {}
9330
9331mod internal {
9332    use super::*;
9333
9334    impl fidl::encoding::ResourceTypeMarker for BaseRouteTableGetAuthorizationForRouteTableResponse {
9335        type Borrowed<'a> = &'a mut Self;
9336        fn take_or_borrow<'a>(
9337            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9338        ) -> Self::Borrowed<'a> {
9339            value
9340        }
9341    }
9342
9343    unsafe impl fidl::encoding::TypeMarker for BaseRouteTableGetAuthorizationForRouteTableResponse {
9344        type Owned = Self;
9345
9346        #[inline(always)]
9347        fn inline_align(_context: fidl::encoding::Context) -> usize {
9348            4
9349        }
9350
9351        #[inline(always)]
9352        fn inline_size(_context: fidl::encoding::Context) -> usize {
9353            8
9354        }
9355    }
9356
9357    unsafe impl
9358        fidl::encoding::Encode<
9359            BaseRouteTableGetAuthorizationForRouteTableResponse,
9360            fidl::encoding::DefaultFuchsiaResourceDialect,
9361        > for &mut BaseRouteTableGetAuthorizationForRouteTableResponse
9362    {
9363        #[inline]
9364        unsafe fn encode(
9365            self,
9366            encoder: &mut fidl::encoding::Encoder<
9367                '_,
9368                fidl::encoding::DefaultFuchsiaResourceDialect,
9369            >,
9370            offset: usize,
9371            _depth: fidl::encoding::Depth,
9372        ) -> fidl::Result<()> {
9373            encoder
9374                .debug_check_bounds::<BaseRouteTableGetAuthorizationForRouteTableResponse>(offset);
9375            // Delegate to tuple encoding.
9376            fidl::encoding::Encode::<BaseRouteTableGetAuthorizationForRouteTableResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9377                (
9378                    <GrantForRouteTableAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
9379                ),
9380                encoder, offset, _depth
9381            )
9382        }
9383    }
9384    unsafe impl<
9385        T0: fidl::encoding::Encode<
9386                GrantForRouteTableAuthorization,
9387                fidl::encoding::DefaultFuchsiaResourceDialect,
9388            >,
9389    >
9390        fidl::encoding::Encode<
9391            BaseRouteTableGetAuthorizationForRouteTableResponse,
9392            fidl::encoding::DefaultFuchsiaResourceDialect,
9393        > for (T0,)
9394    {
9395        #[inline]
9396        unsafe fn encode(
9397            self,
9398            encoder: &mut fidl::encoding::Encoder<
9399                '_,
9400                fidl::encoding::DefaultFuchsiaResourceDialect,
9401            >,
9402            offset: usize,
9403            depth: fidl::encoding::Depth,
9404        ) -> fidl::Result<()> {
9405            encoder
9406                .debug_check_bounds::<BaseRouteTableGetAuthorizationForRouteTableResponse>(offset);
9407            // Zero out padding regions. There's no need to apply masks
9408            // because the unmasked parts will be overwritten by fields.
9409            // Write the fields.
9410            self.0.encode(encoder, offset + 0, depth)?;
9411            Ok(())
9412        }
9413    }
9414
9415    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9416        for BaseRouteTableGetAuthorizationForRouteTableResponse
9417    {
9418        #[inline(always)]
9419        fn new_empty() -> Self {
9420            Self {
9421                credential: fidl::new_empty!(
9422                    GrantForRouteTableAuthorization,
9423                    fidl::encoding::DefaultFuchsiaResourceDialect
9424                ),
9425            }
9426        }
9427
9428        #[inline]
9429        unsafe fn decode(
9430            &mut self,
9431            decoder: &mut fidl::encoding::Decoder<
9432                '_,
9433                fidl::encoding::DefaultFuchsiaResourceDialect,
9434            >,
9435            offset: usize,
9436            _depth: fidl::encoding::Depth,
9437        ) -> fidl::Result<()> {
9438            decoder.debug_check_bounds::<Self>(offset);
9439            // Verify that padding bytes are zero.
9440            fidl::decode!(
9441                GrantForRouteTableAuthorization,
9442                fidl::encoding::DefaultFuchsiaResourceDialect,
9443                &mut self.credential,
9444                decoder,
9445                offset + 0,
9446                _depth
9447            )?;
9448            Ok(())
9449        }
9450    }
9451
9452    impl fidl::encoding::ResourceTypeMarker for GrantForRouteTableAuthorization {
9453        type Borrowed<'a> = &'a mut Self;
9454        fn take_or_borrow<'a>(
9455            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9456        ) -> Self::Borrowed<'a> {
9457            value
9458        }
9459    }
9460
9461    unsafe impl fidl::encoding::TypeMarker for GrantForRouteTableAuthorization {
9462        type Owned = Self;
9463
9464        #[inline(always)]
9465        fn inline_align(_context: fidl::encoding::Context) -> usize {
9466            4
9467        }
9468
9469        #[inline(always)]
9470        fn inline_size(_context: fidl::encoding::Context) -> usize {
9471            8
9472        }
9473    }
9474
9475    unsafe impl
9476        fidl::encoding::Encode<
9477            GrantForRouteTableAuthorization,
9478            fidl::encoding::DefaultFuchsiaResourceDialect,
9479        > for &mut GrantForRouteTableAuthorization
9480    {
9481        #[inline]
9482        unsafe fn encode(
9483            self,
9484            encoder: &mut fidl::encoding::Encoder<
9485                '_,
9486                fidl::encoding::DefaultFuchsiaResourceDialect,
9487            >,
9488            offset: usize,
9489            _depth: fidl::encoding::Depth,
9490        ) -> fidl::Result<()> {
9491            encoder.debug_check_bounds::<GrantForRouteTableAuthorization>(offset);
9492            // Delegate to tuple encoding.
9493            fidl::encoding::Encode::<
9494                GrantForRouteTableAuthorization,
9495                fidl::encoding::DefaultFuchsiaResourceDialect,
9496            >::encode(
9497                (
9498                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.table_id),
9499                    <fidl::encoding::HandleType<
9500                        fidl::Event,
9501                        { fidl::ObjectType::EVENT.into_raw() },
9502                        3,
9503                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9504                        &mut self.token
9505                    ),
9506                ),
9507                encoder,
9508                offset,
9509                _depth,
9510            )
9511        }
9512    }
9513    unsafe impl<
9514        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9515        T1: fidl::encoding::Encode<
9516                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>,
9517                fidl::encoding::DefaultFuchsiaResourceDialect,
9518            >,
9519    >
9520        fidl::encoding::Encode<
9521            GrantForRouteTableAuthorization,
9522            fidl::encoding::DefaultFuchsiaResourceDialect,
9523        > for (T0, T1)
9524    {
9525        #[inline]
9526        unsafe fn encode(
9527            self,
9528            encoder: &mut fidl::encoding::Encoder<
9529                '_,
9530                fidl::encoding::DefaultFuchsiaResourceDialect,
9531            >,
9532            offset: usize,
9533            depth: fidl::encoding::Depth,
9534        ) -> fidl::Result<()> {
9535            encoder.debug_check_bounds::<GrantForRouteTableAuthorization>(offset);
9536            // Zero out padding regions. There's no need to apply masks
9537            // because the unmasked parts will be overwritten by fields.
9538            // Write the fields.
9539            self.0.encode(encoder, offset + 0, depth)?;
9540            self.1.encode(encoder, offset + 4, depth)?;
9541            Ok(())
9542        }
9543    }
9544
9545    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9546        for GrantForRouteTableAuthorization
9547    {
9548        #[inline(always)]
9549        fn new_empty() -> Self {
9550            Self {
9551                table_id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9552                token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect),
9553            }
9554        }
9555
9556        #[inline]
9557        unsafe fn decode(
9558            &mut self,
9559            decoder: &mut fidl::encoding::Decoder<
9560                '_,
9561                fidl::encoding::DefaultFuchsiaResourceDialect,
9562            >,
9563            offset: usize,
9564            _depth: fidl::encoding::Depth,
9565        ) -> fidl::Result<()> {
9566            decoder.debug_check_bounds::<Self>(offset);
9567            // Verify that padding bytes are zero.
9568            fidl::decode!(
9569                u32,
9570                fidl::encoding::DefaultFuchsiaResourceDialect,
9571                &mut self.table_id,
9572                decoder,
9573                offset + 0,
9574                _depth
9575            )?;
9576            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 4, _depth)?;
9577            Ok(())
9578        }
9579    }
9580
9581    impl fidl::encoding::ResourceTypeMarker for ProofOfRouteTableAuthorization {
9582        type Borrowed<'a> = &'a mut Self;
9583        fn take_or_borrow<'a>(
9584            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9585        ) -> Self::Borrowed<'a> {
9586            value
9587        }
9588    }
9589
9590    unsafe impl fidl::encoding::TypeMarker for ProofOfRouteTableAuthorization {
9591        type Owned = Self;
9592
9593        #[inline(always)]
9594        fn inline_align(_context: fidl::encoding::Context) -> usize {
9595            4
9596        }
9597
9598        #[inline(always)]
9599        fn inline_size(_context: fidl::encoding::Context) -> usize {
9600            8
9601        }
9602    }
9603
9604    unsafe impl
9605        fidl::encoding::Encode<
9606            ProofOfRouteTableAuthorization,
9607            fidl::encoding::DefaultFuchsiaResourceDialect,
9608        > for &mut ProofOfRouteTableAuthorization
9609    {
9610        #[inline]
9611        unsafe fn encode(
9612            self,
9613            encoder: &mut fidl::encoding::Encoder<
9614                '_,
9615                fidl::encoding::DefaultFuchsiaResourceDialect,
9616            >,
9617            offset: usize,
9618            _depth: fidl::encoding::Depth,
9619        ) -> fidl::Result<()> {
9620            encoder.debug_check_bounds::<ProofOfRouteTableAuthorization>(offset);
9621            // Delegate to tuple encoding.
9622            fidl::encoding::Encode::<
9623                ProofOfRouteTableAuthorization,
9624                fidl::encoding::DefaultFuchsiaResourceDialect,
9625            >::encode(
9626                (
9627                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.table),
9628                    <fidl::encoding::HandleType<
9629                        fidl::Event,
9630                        { fidl::ObjectType::EVENT.into_raw() },
9631                        0,
9632                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9633                        &mut self.token
9634                    ),
9635                ),
9636                encoder,
9637                offset,
9638                _depth,
9639            )
9640        }
9641    }
9642    unsafe impl<
9643        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9644        T1: fidl::encoding::Encode<
9645                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>,
9646                fidl::encoding::DefaultFuchsiaResourceDialect,
9647            >,
9648    >
9649        fidl::encoding::Encode<
9650            ProofOfRouteTableAuthorization,
9651            fidl::encoding::DefaultFuchsiaResourceDialect,
9652        > for (T0, T1)
9653    {
9654        #[inline]
9655        unsafe fn encode(
9656            self,
9657            encoder: &mut fidl::encoding::Encoder<
9658                '_,
9659                fidl::encoding::DefaultFuchsiaResourceDialect,
9660            >,
9661            offset: usize,
9662            depth: fidl::encoding::Depth,
9663        ) -> fidl::Result<()> {
9664            encoder.debug_check_bounds::<ProofOfRouteTableAuthorization>(offset);
9665            // Zero out padding regions. There's no need to apply masks
9666            // because the unmasked parts will be overwritten by fields.
9667            // Write the fields.
9668            self.0.encode(encoder, offset + 0, depth)?;
9669            self.1.encode(encoder, offset + 4, depth)?;
9670            Ok(())
9671        }
9672    }
9673
9674    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9675        for ProofOfRouteTableAuthorization
9676    {
9677        #[inline(always)]
9678        fn new_empty() -> Self {
9679            Self {
9680                table: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9681                token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>, fidl::encoding::DefaultFuchsiaResourceDialect),
9682            }
9683        }
9684
9685        #[inline]
9686        unsafe fn decode(
9687            &mut self,
9688            decoder: &mut fidl::encoding::Decoder<
9689                '_,
9690                fidl::encoding::DefaultFuchsiaResourceDialect,
9691            >,
9692            offset: usize,
9693            _depth: fidl::encoding::Depth,
9694        ) -> fidl::Result<()> {
9695            decoder.debug_check_bounds::<Self>(offset);
9696            // Verify that padding bytes are zero.
9697            fidl::decode!(
9698                u32,
9699                fidl::encoding::DefaultFuchsiaResourceDialect,
9700                &mut self.table,
9701                decoder,
9702                offset + 0,
9703                _depth
9704            )?;
9705            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 4, _depth)?;
9706            Ok(())
9707        }
9708    }
9709
9710    impl fidl::encoding::ResourceTypeMarker for RouteSetV4AddRouteRequest {
9711        type Borrowed<'a> = &'a mut Self;
9712        fn take_or_borrow<'a>(
9713            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9714        ) -> Self::Borrowed<'a> {
9715            value
9716        }
9717    }
9718
9719    unsafe impl fidl::encoding::TypeMarker for RouteSetV4AddRouteRequest {
9720        type Owned = Self;
9721
9722        #[inline(always)]
9723        fn inline_align(_context: fidl::encoding::Context) -> usize {
9724            8
9725        }
9726
9727        #[inline(always)]
9728        fn inline_size(_context: fidl::encoding::Context) -> usize {
9729            40
9730        }
9731    }
9732
9733    unsafe impl
9734        fidl::encoding::Encode<
9735            RouteSetV4AddRouteRequest,
9736            fidl::encoding::DefaultFuchsiaResourceDialect,
9737        > for &mut RouteSetV4AddRouteRequest
9738    {
9739        #[inline]
9740        unsafe fn encode(
9741            self,
9742            encoder: &mut fidl::encoding::Encoder<
9743                '_,
9744                fidl::encoding::DefaultFuchsiaResourceDialect,
9745            >,
9746            offset: usize,
9747            _depth: fidl::encoding::Depth,
9748        ) -> fidl::Result<()> {
9749            encoder.debug_check_bounds::<RouteSetV4AddRouteRequest>(offset);
9750            // Delegate to tuple encoding.
9751            fidl::encoding::Encode::<
9752                RouteSetV4AddRouteRequest,
9753                fidl::encoding::DefaultFuchsiaResourceDialect,
9754            >::encode(
9755                (<fidl_fuchsia_net_routes::RouteV4 as fidl::encoding::ValueTypeMarker>::borrow(
9756                    &self.route,
9757                ),),
9758                encoder,
9759                offset,
9760                _depth,
9761            )
9762        }
9763    }
9764    unsafe impl<
9765        T0: fidl::encoding::Encode<
9766                fidl_fuchsia_net_routes::RouteV4,
9767                fidl::encoding::DefaultFuchsiaResourceDialect,
9768            >,
9769    >
9770        fidl::encoding::Encode<
9771            RouteSetV4AddRouteRequest,
9772            fidl::encoding::DefaultFuchsiaResourceDialect,
9773        > for (T0,)
9774    {
9775        #[inline]
9776        unsafe fn encode(
9777            self,
9778            encoder: &mut fidl::encoding::Encoder<
9779                '_,
9780                fidl::encoding::DefaultFuchsiaResourceDialect,
9781            >,
9782            offset: usize,
9783            depth: fidl::encoding::Depth,
9784        ) -> fidl::Result<()> {
9785            encoder.debug_check_bounds::<RouteSetV4AddRouteRequest>(offset);
9786            // Zero out padding regions. There's no need to apply masks
9787            // because the unmasked parts will be overwritten by fields.
9788            // Write the fields.
9789            self.0.encode(encoder, offset + 0, depth)?;
9790            Ok(())
9791        }
9792    }
9793
9794    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9795        for RouteSetV4AddRouteRequest
9796    {
9797        #[inline(always)]
9798        fn new_empty() -> Self {
9799            Self {
9800                route: fidl::new_empty!(
9801                    fidl_fuchsia_net_routes::RouteV4,
9802                    fidl::encoding::DefaultFuchsiaResourceDialect
9803                ),
9804            }
9805        }
9806
9807        #[inline]
9808        unsafe fn decode(
9809            &mut self,
9810            decoder: &mut fidl::encoding::Decoder<
9811                '_,
9812                fidl::encoding::DefaultFuchsiaResourceDialect,
9813            >,
9814            offset: usize,
9815            _depth: fidl::encoding::Depth,
9816        ) -> fidl::Result<()> {
9817            decoder.debug_check_bounds::<Self>(offset);
9818            // Verify that padding bytes are zero.
9819            fidl::decode!(
9820                fidl_fuchsia_net_routes::RouteV4,
9821                fidl::encoding::DefaultFuchsiaResourceDialect,
9822                &mut self.route,
9823                decoder,
9824                offset + 0,
9825                _depth
9826            )?;
9827            Ok(())
9828        }
9829    }
9830
9831    impl fidl::encoding::ResourceTypeMarker for RouteSetV4AuthenticateForInterfaceRequest {
9832        type Borrowed<'a> = &'a mut Self;
9833        fn take_or_borrow<'a>(
9834            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9835        ) -> Self::Borrowed<'a> {
9836            value
9837        }
9838    }
9839
9840    unsafe impl fidl::encoding::TypeMarker for RouteSetV4AuthenticateForInterfaceRequest {
9841        type Owned = Self;
9842
9843        #[inline(always)]
9844        fn inline_align(_context: fidl::encoding::Context) -> usize {
9845            8
9846        }
9847
9848        #[inline(always)]
9849        fn inline_size(_context: fidl::encoding::Context) -> usize {
9850            16
9851        }
9852    }
9853
9854    unsafe impl
9855        fidl::encoding::Encode<
9856            RouteSetV4AuthenticateForInterfaceRequest,
9857            fidl::encoding::DefaultFuchsiaResourceDialect,
9858        > for &mut RouteSetV4AuthenticateForInterfaceRequest
9859    {
9860        #[inline]
9861        unsafe fn encode(
9862            self,
9863            encoder: &mut fidl::encoding::Encoder<
9864                '_,
9865                fidl::encoding::DefaultFuchsiaResourceDialect,
9866            >,
9867            offset: usize,
9868            _depth: fidl::encoding::Depth,
9869        ) -> fidl::Result<()> {
9870            encoder.debug_check_bounds::<RouteSetV4AuthenticateForInterfaceRequest>(offset);
9871            // Delegate to tuple encoding.
9872            fidl::encoding::Encode::<RouteSetV4AuthenticateForInterfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9873                (
9874                    <fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
9875                ),
9876                encoder, offset, _depth
9877            )
9878        }
9879    }
9880    unsafe impl<
9881        T0: fidl::encoding::Encode<
9882                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
9883                fidl::encoding::DefaultFuchsiaResourceDialect,
9884            >,
9885    >
9886        fidl::encoding::Encode<
9887            RouteSetV4AuthenticateForInterfaceRequest,
9888            fidl::encoding::DefaultFuchsiaResourceDialect,
9889        > for (T0,)
9890    {
9891        #[inline]
9892        unsafe fn encode(
9893            self,
9894            encoder: &mut fidl::encoding::Encoder<
9895                '_,
9896                fidl::encoding::DefaultFuchsiaResourceDialect,
9897            >,
9898            offset: usize,
9899            depth: fidl::encoding::Depth,
9900        ) -> fidl::Result<()> {
9901            encoder.debug_check_bounds::<RouteSetV4AuthenticateForInterfaceRequest>(offset);
9902            // Zero out padding regions. There's no need to apply masks
9903            // because the unmasked parts will be overwritten by fields.
9904            // Write the fields.
9905            self.0.encode(encoder, offset + 0, depth)?;
9906            Ok(())
9907        }
9908    }
9909
9910    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9911        for RouteSetV4AuthenticateForInterfaceRequest
9912    {
9913        #[inline(always)]
9914        fn new_empty() -> Self {
9915            Self {
9916                credential: fidl::new_empty!(
9917                    fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
9918                    fidl::encoding::DefaultFuchsiaResourceDialect
9919                ),
9920            }
9921        }
9922
9923        #[inline]
9924        unsafe fn decode(
9925            &mut self,
9926            decoder: &mut fidl::encoding::Decoder<
9927                '_,
9928                fidl::encoding::DefaultFuchsiaResourceDialect,
9929            >,
9930            offset: usize,
9931            _depth: fidl::encoding::Depth,
9932        ) -> fidl::Result<()> {
9933            decoder.debug_check_bounds::<Self>(offset);
9934            // Verify that padding bytes are zero.
9935            fidl::decode!(
9936                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
9937                fidl::encoding::DefaultFuchsiaResourceDialect,
9938                &mut self.credential,
9939                decoder,
9940                offset + 0,
9941                _depth
9942            )?;
9943            Ok(())
9944        }
9945    }
9946
9947    impl fidl::encoding::ResourceTypeMarker for RouteSetV4RemoveRouteRequest {
9948        type Borrowed<'a> = &'a mut Self;
9949        fn take_or_borrow<'a>(
9950            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9951        ) -> Self::Borrowed<'a> {
9952            value
9953        }
9954    }
9955
9956    unsafe impl fidl::encoding::TypeMarker for RouteSetV4RemoveRouteRequest {
9957        type Owned = Self;
9958
9959        #[inline(always)]
9960        fn inline_align(_context: fidl::encoding::Context) -> usize {
9961            8
9962        }
9963
9964        #[inline(always)]
9965        fn inline_size(_context: fidl::encoding::Context) -> usize {
9966            40
9967        }
9968    }
9969
9970    unsafe impl
9971        fidl::encoding::Encode<
9972            RouteSetV4RemoveRouteRequest,
9973            fidl::encoding::DefaultFuchsiaResourceDialect,
9974        > for &mut RouteSetV4RemoveRouteRequest
9975    {
9976        #[inline]
9977        unsafe fn encode(
9978            self,
9979            encoder: &mut fidl::encoding::Encoder<
9980                '_,
9981                fidl::encoding::DefaultFuchsiaResourceDialect,
9982            >,
9983            offset: usize,
9984            _depth: fidl::encoding::Depth,
9985        ) -> fidl::Result<()> {
9986            encoder.debug_check_bounds::<RouteSetV4RemoveRouteRequest>(offset);
9987            // Delegate to tuple encoding.
9988            fidl::encoding::Encode::<
9989                RouteSetV4RemoveRouteRequest,
9990                fidl::encoding::DefaultFuchsiaResourceDialect,
9991            >::encode(
9992                (<fidl_fuchsia_net_routes::RouteV4 as fidl::encoding::ValueTypeMarker>::borrow(
9993                    &self.route,
9994                ),),
9995                encoder,
9996                offset,
9997                _depth,
9998            )
9999        }
10000    }
10001    unsafe impl<
10002        T0: fidl::encoding::Encode<
10003                fidl_fuchsia_net_routes::RouteV4,
10004                fidl::encoding::DefaultFuchsiaResourceDialect,
10005            >,
10006    >
10007        fidl::encoding::Encode<
10008            RouteSetV4RemoveRouteRequest,
10009            fidl::encoding::DefaultFuchsiaResourceDialect,
10010        > for (T0,)
10011    {
10012        #[inline]
10013        unsafe fn encode(
10014            self,
10015            encoder: &mut fidl::encoding::Encoder<
10016                '_,
10017                fidl::encoding::DefaultFuchsiaResourceDialect,
10018            >,
10019            offset: usize,
10020            depth: fidl::encoding::Depth,
10021        ) -> fidl::Result<()> {
10022            encoder.debug_check_bounds::<RouteSetV4RemoveRouteRequest>(offset);
10023            // Zero out padding regions. There's no need to apply masks
10024            // because the unmasked parts will be overwritten by fields.
10025            // Write the fields.
10026            self.0.encode(encoder, offset + 0, depth)?;
10027            Ok(())
10028        }
10029    }
10030
10031    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10032        for RouteSetV4RemoveRouteRequest
10033    {
10034        #[inline(always)]
10035        fn new_empty() -> Self {
10036            Self {
10037                route: fidl::new_empty!(
10038                    fidl_fuchsia_net_routes::RouteV4,
10039                    fidl::encoding::DefaultFuchsiaResourceDialect
10040                ),
10041            }
10042        }
10043
10044        #[inline]
10045        unsafe fn decode(
10046            &mut self,
10047            decoder: &mut fidl::encoding::Decoder<
10048                '_,
10049                fidl::encoding::DefaultFuchsiaResourceDialect,
10050            >,
10051            offset: usize,
10052            _depth: fidl::encoding::Depth,
10053        ) -> fidl::Result<()> {
10054            decoder.debug_check_bounds::<Self>(offset);
10055            // Verify that padding bytes are zero.
10056            fidl::decode!(
10057                fidl_fuchsia_net_routes::RouteV4,
10058                fidl::encoding::DefaultFuchsiaResourceDialect,
10059                &mut self.route,
10060                decoder,
10061                offset + 0,
10062                _depth
10063            )?;
10064            Ok(())
10065        }
10066    }
10067
10068    impl fidl::encoding::ResourceTypeMarker for RouteSetV6AddRouteRequest {
10069        type Borrowed<'a> = &'a mut Self;
10070        fn take_or_borrow<'a>(
10071            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10072        ) -> Self::Borrowed<'a> {
10073            value
10074        }
10075    }
10076
10077    unsafe impl fidl::encoding::TypeMarker for RouteSetV6AddRouteRequest {
10078        type Owned = Self;
10079
10080        #[inline(always)]
10081        fn inline_align(_context: fidl::encoding::Context) -> usize {
10082            8
10083        }
10084
10085        #[inline(always)]
10086        fn inline_size(_context: fidl::encoding::Context) -> usize {
10087            56
10088        }
10089    }
10090
10091    unsafe impl
10092        fidl::encoding::Encode<
10093            RouteSetV6AddRouteRequest,
10094            fidl::encoding::DefaultFuchsiaResourceDialect,
10095        > for &mut RouteSetV6AddRouteRequest
10096    {
10097        #[inline]
10098        unsafe fn encode(
10099            self,
10100            encoder: &mut fidl::encoding::Encoder<
10101                '_,
10102                fidl::encoding::DefaultFuchsiaResourceDialect,
10103            >,
10104            offset: usize,
10105            _depth: fidl::encoding::Depth,
10106        ) -> fidl::Result<()> {
10107            encoder.debug_check_bounds::<RouteSetV6AddRouteRequest>(offset);
10108            // Delegate to tuple encoding.
10109            fidl::encoding::Encode::<
10110                RouteSetV6AddRouteRequest,
10111                fidl::encoding::DefaultFuchsiaResourceDialect,
10112            >::encode(
10113                (<fidl_fuchsia_net_routes::RouteV6 as fidl::encoding::ValueTypeMarker>::borrow(
10114                    &self.route,
10115                ),),
10116                encoder,
10117                offset,
10118                _depth,
10119            )
10120        }
10121    }
10122    unsafe impl<
10123        T0: fidl::encoding::Encode<
10124                fidl_fuchsia_net_routes::RouteV6,
10125                fidl::encoding::DefaultFuchsiaResourceDialect,
10126            >,
10127    >
10128        fidl::encoding::Encode<
10129            RouteSetV6AddRouteRequest,
10130            fidl::encoding::DefaultFuchsiaResourceDialect,
10131        > for (T0,)
10132    {
10133        #[inline]
10134        unsafe fn encode(
10135            self,
10136            encoder: &mut fidl::encoding::Encoder<
10137                '_,
10138                fidl::encoding::DefaultFuchsiaResourceDialect,
10139            >,
10140            offset: usize,
10141            depth: fidl::encoding::Depth,
10142        ) -> fidl::Result<()> {
10143            encoder.debug_check_bounds::<RouteSetV6AddRouteRequest>(offset);
10144            // Zero out padding regions. There's no need to apply masks
10145            // because the unmasked parts will be overwritten by fields.
10146            // Write the fields.
10147            self.0.encode(encoder, offset + 0, depth)?;
10148            Ok(())
10149        }
10150    }
10151
10152    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10153        for RouteSetV6AddRouteRequest
10154    {
10155        #[inline(always)]
10156        fn new_empty() -> Self {
10157            Self {
10158                route: fidl::new_empty!(
10159                    fidl_fuchsia_net_routes::RouteV6,
10160                    fidl::encoding::DefaultFuchsiaResourceDialect
10161                ),
10162            }
10163        }
10164
10165        #[inline]
10166        unsafe fn decode(
10167            &mut self,
10168            decoder: &mut fidl::encoding::Decoder<
10169                '_,
10170                fidl::encoding::DefaultFuchsiaResourceDialect,
10171            >,
10172            offset: usize,
10173            _depth: fidl::encoding::Depth,
10174        ) -> fidl::Result<()> {
10175            decoder.debug_check_bounds::<Self>(offset);
10176            // Verify that padding bytes are zero.
10177            fidl::decode!(
10178                fidl_fuchsia_net_routes::RouteV6,
10179                fidl::encoding::DefaultFuchsiaResourceDialect,
10180                &mut self.route,
10181                decoder,
10182                offset + 0,
10183                _depth
10184            )?;
10185            Ok(())
10186        }
10187    }
10188
10189    impl fidl::encoding::ResourceTypeMarker for RouteSetV6AuthenticateForInterfaceRequest {
10190        type Borrowed<'a> = &'a mut Self;
10191        fn take_or_borrow<'a>(
10192            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10193        ) -> Self::Borrowed<'a> {
10194            value
10195        }
10196    }
10197
10198    unsafe impl fidl::encoding::TypeMarker for RouteSetV6AuthenticateForInterfaceRequest {
10199        type Owned = Self;
10200
10201        #[inline(always)]
10202        fn inline_align(_context: fidl::encoding::Context) -> usize {
10203            8
10204        }
10205
10206        #[inline(always)]
10207        fn inline_size(_context: fidl::encoding::Context) -> usize {
10208            16
10209        }
10210    }
10211
10212    unsafe impl
10213        fidl::encoding::Encode<
10214            RouteSetV6AuthenticateForInterfaceRequest,
10215            fidl::encoding::DefaultFuchsiaResourceDialect,
10216        > for &mut RouteSetV6AuthenticateForInterfaceRequest
10217    {
10218        #[inline]
10219        unsafe fn encode(
10220            self,
10221            encoder: &mut fidl::encoding::Encoder<
10222                '_,
10223                fidl::encoding::DefaultFuchsiaResourceDialect,
10224            >,
10225            offset: usize,
10226            _depth: fidl::encoding::Depth,
10227        ) -> fidl::Result<()> {
10228            encoder.debug_check_bounds::<RouteSetV6AuthenticateForInterfaceRequest>(offset);
10229            // Delegate to tuple encoding.
10230            fidl::encoding::Encode::<RouteSetV6AuthenticateForInterfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10231                (
10232                    <fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
10233                ),
10234                encoder, offset, _depth
10235            )
10236        }
10237    }
10238    unsafe impl<
10239        T0: fidl::encoding::Encode<
10240                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10241                fidl::encoding::DefaultFuchsiaResourceDialect,
10242            >,
10243    >
10244        fidl::encoding::Encode<
10245            RouteSetV6AuthenticateForInterfaceRequest,
10246            fidl::encoding::DefaultFuchsiaResourceDialect,
10247        > for (T0,)
10248    {
10249        #[inline]
10250        unsafe fn encode(
10251            self,
10252            encoder: &mut fidl::encoding::Encoder<
10253                '_,
10254                fidl::encoding::DefaultFuchsiaResourceDialect,
10255            >,
10256            offset: usize,
10257            depth: fidl::encoding::Depth,
10258        ) -> fidl::Result<()> {
10259            encoder.debug_check_bounds::<RouteSetV6AuthenticateForInterfaceRequest>(offset);
10260            // Zero out padding regions. There's no need to apply masks
10261            // because the unmasked parts will be overwritten by fields.
10262            // Write the fields.
10263            self.0.encode(encoder, offset + 0, depth)?;
10264            Ok(())
10265        }
10266    }
10267
10268    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10269        for RouteSetV6AuthenticateForInterfaceRequest
10270    {
10271        #[inline(always)]
10272        fn new_empty() -> Self {
10273            Self {
10274                credential: fidl::new_empty!(
10275                    fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10276                    fidl::encoding::DefaultFuchsiaResourceDialect
10277                ),
10278            }
10279        }
10280
10281        #[inline]
10282        unsafe fn decode(
10283            &mut self,
10284            decoder: &mut fidl::encoding::Decoder<
10285                '_,
10286                fidl::encoding::DefaultFuchsiaResourceDialect,
10287            >,
10288            offset: usize,
10289            _depth: fidl::encoding::Depth,
10290        ) -> fidl::Result<()> {
10291            decoder.debug_check_bounds::<Self>(offset);
10292            // Verify that padding bytes are zero.
10293            fidl::decode!(
10294                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10295                fidl::encoding::DefaultFuchsiaResourceDialect,
10296                &mut self.credential,
10297                decoder,
10298                offset + 0,
10299                _depth
10300            )?;
10301            Ok(())
10302        }
10303    }
10304
10305    impl fidl::encoding::ResourceTypeMarker for RouteSetV6RemoveRouteRequest {
10306        type Borrowed<'a> = &'a mut Self;
10307        fn take_or_borrow<'a>(
10308            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10309        ) -> Self::Borrowed<'a> {
10310            value
10311        }
10312    }
10313
10314    unsafe impl fidl::encoding::TypeMarker for RouteSetV6RemoveRouteRequest {
10315        type Owned = Self;
10316
10317        #[inline(always)]
10318        fn inline_align(_context: fidl::encoding::Context) -> usize {
10319            8
10320        }
10321
10322        #[inline(always)]
10323        fn inline_size(_context: fidl::encoding::Context) -> usize {
10324            56
10325        }
10326    }
10327
10328    unsafe impl
10329        fidl::encoding::Encode<
10330            RouteSetV6RemoveRouteRequest,
10331            fidl::encoding::DefaultFuchsiaResourceDialect,
10332        > for &mut RouteSetV6RemoveRouteRequest
10333    {
10334        #[inline]
10335        unsafe fn encode(
10336            self,
10337            encoder: &mut fidl::encoding::Encoder<
10338                '_,
10339                fidl::encoding::DefaultFuchsiaResourceDialect,
10340            >,
10341            offset: usize,
10342            _depth: fidl::encoding::Depth,
10343        ) -> fidl::Result<()> {
10344            encoder.debug_check_bounds::<RouteSetV6RemoveRouteRequest>(offset);
10345            // Delegate to tuple encoding.
10346            fidl::encoding::Encode::<
10347                RouteSetV6RemoveRouteRequest,
10348                fidl::encoding::DefaultFuchsiaResourceDialect,
10349            >::encode(
10350                (<fidl_fuchsia_net_routes::RouteV6 as fidl::encoding::ValueTypeMarker>::borrow(
10351                    &self.route,
10352                ),),
10353                encoder,
10354                offset,
10355                _depth,
10356            )
10357        }
10358    }
10359    unsafe impl<
10360        T0: fidl::encoding::Encode<
10361                fidl_fuchsia_net_routes::RouteV6,
10362                fidl::encoding::DefaultFuchsiaResourceDialect,
10363            >,
10364    >
10365        fidl::encoding::Encode<
10366            RouteSetV6RemoveRouteRequest,
10367            fidl::encoding::DefaultFuchsiaResourceDialect,
10368        > for (T0,)
10369    {
10370        #[inline]
10371        unsafe fn encode(
10372            self,
10373            encoder: &mut fidl::encoding::Encoder<
10374                '_,
10375                fidl::encoding::DefaultFuchsiaResourceDialect,
10376            >,
10377            offset: usize,
10378            depth: fidl::encoding::Depth,
10379        ) -> fidl::Result<()> {
10380            encoder.debug_check_bounds::<RouteSetV6RemoveRouteRequest>(offset);
10381            // Zero out padding regions. There's no need to apply masks
10382            // because the unmasked parts will be overwritten by fields.
10383            // Write the fields.
10384            self.0.encode(encoder, offset + 0, depth)?;
10385            Ok(())
10386        }
10387    }
10388
10389    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10390        for RouteSetV6RemoveRouteRequest
10391    {
10392        #[inline(always)]
10393        fn new_empty() -> Self {
10394            Self {
10395                route: fidl::new_empty!(
10396                    fidl_fuchsia_net_routes::RouteV6,
10397                    fidl::encoding::DefaultFuchsiaResourceDialect
10398                ),
10399            }
10400        }
10401
10402        #[inline]
10403        unsafe fn decode(
10404            &mut self,
10405            decoder: &mut fidl::encoding::Decoder<
10406                '_,
10407                fidl::encoding::DefaultFuchsiaResourceDialect,
10408            >,
10409            offset: usize,
10410            _depth: fidl::encoding::Depth,
10411        ) -> fidl::Result<()> {
10412            decoder.debug_check_bounds::<Self>(offset);
10413            // Verify that padding bytes are zero.
10414            fidl::decode!(
10415                fidl_fuchsia_net_routes::RouteV6,
10416                fidl::encoding::DefaultFuchsiaResourceDialect,
10417                &mut self.route,
10418                decoder,
10419                offset + 0,
10420                _depth
10421            )?;
10422            Ok(())
10423        }
10424    }
10425
10426    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4GetInterfaceLocalTableRequest {
10427        type Borrowed<'a> = &'a mut Self;
10428        fn take_or_borrow<'a>(
10429            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10430        ) -> Self::Borrowed<'a> {
10431            value
10432        }
10433    }
10434
10435    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4GetInterfaceLocalTableRequest {
10436        type Owned = Self;
10437
10438        #[inline(always)]
10439        fn inline_align(_context: fidl::encoding::Context) -> usize {
10440            8
10441        }
10442
10443        #[inline(always)]
10444        fn inline_size(_context: fidl::encoding::Context) -> usize {
10445            16
10446        }
10447    }
10448
10449    unsafe impl
10450        fidl::encoding::Encode<
10451            RouteTableProviderV4GetInterfaceLocalTableRequest,
10452            fidl::encoding::DefaultFuchsiaResourceDialect,
10453        > for &mut RouteTableProviderV4GetInterfaceLocalTableRequest
10454    {
10455        #[inline]
10456        unsafe fn encode(
10457            self,
10458            encoder: &mut fidl::encoding::Encoder<
10459                '_,
10460                fidl::encoding::DefaultFuchsiaResourceDialect,
10461            >,
10462            offset: usize,
10463            _depth: fidl::encoding::Depth,
10464        ) -> fidl::Result<()> {
10465            encoder.debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableRequest>(offset);
10466            // Delegate to tuple encoding.
10467            fidl::encoding::Encode::<RouteTableProviderV4GetInterfaceLocalTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10468                (
10469                    <fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
10470                ),
10471                encoder, offset, _depth
10472            )
10473        }
10474    }
10475    unsafe impl<
10476        T0: fidl::encoding::Encode<
10477                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10478                fidl::encoding::DefaultFuchsiaResourceDialect,
10479            >,
10480    >
10481        fidl::encoding::Encode<
10482            RouteTableProviderV4GetInterfaceLocalTableRequest,
10483            fidl::encoding::DefaultFuchsiaResourceDialect,
10484        > for (T0,)
10485    {
10486        #[inline]
10487        unsafe fn encode(
10488            self,
10489            encoder: &mut fidl::encoding::Encoder<
10490                '_,
10491                fidl::encoding::DefaultFuchsiaResourceDialect,
10492            >,
10493            offset: usize,
10494            depth: fidl::encoding::Depth,
10495        ) -> fidl::Result<()> {
10496            encoder.debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableRequest>(offset);
10497            // Zero out padding regions. There's no need to apply masks
10498            // because the unmasked parts will be overwritten by fields.
10499            // Write the fields.
10500            self.0.encode(encoder, offset + 0, depth)?;
10501            Ok(())
10502        }
10503    }
10504
10505    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10506        for RouteTableProviderV4GetInterfaceLocalTableRequest
10507    {
10508        #[inline(always)]
10509        fn new_empty() -> Self {
10510            Self {
10511                credential: fidl::new_empty!(
10512                    fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10513                    fidl::encoding::DefaultFuchsiaResourceDialect
10514                ),
10515            }
10516        }
10517
10518        #[inline]
10519        unsafe fn decode(
10520            &mut self,
10521            decoder: &mut fidl::encoding::Decoder<
10522                '_,
10523                fidl::encoding::DefaultFuchsiaResourceDialect,
10524            >,
10525            offset: usize,
10526            _depth: fidl::encoding::Depth,
10527        ) -> fidl::Result<()> {
10528            decoder.debug_check_bounds::<Self>(offset);
10529            // Verify that padding bytes are zero.
10530            fidl::decode!(
10531                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10532                fidl::encoding::DefaultFuchsiaResourceDialect,
10533                &mut self.credential,
10534                decoder,
10535                offset + 0,
10536                _depth
10537            )?;
10538            Ok(())
10539        }
10540    }
10541
10542    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4NewRouteTableRequest {
10543        type Borrowed<'a> = &'a mut Self;
10544        fn take_or_borrow<'a>(
10545            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10546        ) -> Self::Borrowed<'a> {
10547            value
10548        }
10549    }
10550
10551    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4NewRouteTableRequest {
10552        type Owned = Self;
10553
10554        #[inline(always)]
10555        fn inline_align(_context: fidl::encoding::Context) -> usize {
10556            8
10557        }
10558
10559        #[inline(always)]
10560        fn inline_size(_context: fidl::encoding::Context) -> usize {
10561            24
10562        }
10563    }
10564
10565    unsafe impl
10566        fidl::encoding::Encode<
10567            RouteTableProviderV4NewRouteTableRequest,
10568            fidl::encoding::DefaultFuchsiaResourceDialect,
10569        > for &mut RouteTableProviderV4NewRouteTableRequest
10570    {
10571        #[inline]
10572        unsafe fn encode(
10573            self,
10574            encoder: &mut fidl::encoding::Encoder<
10575                '_,
10576                fidl::encoding::DefaultFuchsiaResourceDialect,
10577            >,
10578            offset: usize,
10579            _depth: fidl::encoding::Depth,
10580        ) -> fidl::Result<()> {
10581            encoder.debug_check_bounds::<RouteTableProviderV4NewRouteTableRequest>(offset);
10582            // Delegate to tuple encoding.
10583            fidl::encoding::Encode::<RouteTableProviderV4NewRouteTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10584                (
10585                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
10586                    <RouteTableOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
10587                ),
10588                encoder, offset, _depth
10589            )
10590        }
10591    }
10592    unsafe impl<
10593        T0: fidl::encoding::Encode<
10594                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>>,
10595                fidl::encoding::DefaultFuchsiaResourceDialect,
10596            >,
10597        T1: fidl::encoding::Encode<RouteTableOptionsV4, fidl::encoding::DefaultFuchsiaResourceDialect>,
10598    >
10599        fidl::encoding::Encode<
10600            RouteTableProviderV4NewRouteTableRequest,
10601            fidl::encoding::DefaultFuchsiaResourceDialect,
10602        > for (T0, T1)
10603    {
10604        #[inline]
10605        unsafe fn encode(
10606            self,
10607            encoder: &mut fidl::encoding::Encoder<
10608                '_,
10609                fidl::encoding::DefaultFuchsiaResourceDialect,
10610            >,
10611            offset: usize,
10612            depth: fidl::encoding::Depth,
10613        ) -> fidl::Result<()> {
10614            encoder.debug_check_bounds::<RouteTableProviderV4NewRouteTableRequest>(offset);
10615            // Zero out padding regions. There's no need to apply masks
10616            // because the unmasked parts will be overwritten by fields.
10617            unsafe {
10618                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10619                (ptr as *mut u64).write_unaligned(0);
10620            }
10621            // Write the fields.
10622            self.0.encode(encoder, offset + 0, depth)?;
10623            self.1.encode(encoder, offset + 8, depth)?;
10624            Ok(())
10625        }
10626    }
10627
10628    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10629        for RouteTableProviderV4NewRouteTableRequest
10630    {
10631        #[inline(always)]
10632        fn new_empty() -> Self {
10633            Self {
10634                provider: fidl::new_empty!(
10635                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>>,
10636                    fidl::encoding::DefaultFuchsiaResourceDialect
10637                ),
10638                options: fidl::new_empty!(
10639                    RouteTableOptionsV4,
10640                    fidl::encoding::DefaultFuchsiaResourceDialect
10641                ),
10642            }
10643        }
10644
10645        #[inline]
10646        unsafe fn decode(
10647            &mut self,
10648            decoder: &mut fidl::encoding::Decoder<
10649                '_,
10650                fidl::encoding::DefaultFuchsiaResourceDialect,
10651            >,
10652            offset: usize,
10653            _depth: fidl::encoding::Depth,
10654        ) -> fidl::Result<()> {
10655            decoder.debug_check_bounds::<Self>(offset);
10656            // Verify that padding bytes are zero.
10657            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
10658            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10659            let mask = 0xffffffff00000000u64;
10660            let maskedval = padval & mask;
10661            if maskedval != 0 {
10662                return Err(fidl::Error::NonZeroPadding {
10663                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
10664                });
10665            }
10666            fidl::decode!(
10667                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>>,
10668                fidl::encoding::DefaultFuchsiaResourceDialect,
10669                &mut self.provider,
10670                decoder,
10671                offset + 0,
10672                _depth
10673            )?;
10674            fidl::decode!(
10675                RouteTableOptionsV4,
10676                fidl::encoding::DefaultFuchsiaResourceDialect,
10677                &mut self.options,
10678                decoder,
10679                offset + 8,
10680                _depth
10681            )?;
10682            Ok(())
10683        }
10684    }
10685
10686    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4GetInterfaceLocalTableResponse {
10687        type Borrowed<'a> = &'a mut Self;
10688        fn take_or_borrow<'a>(
10689            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10690        ) -> Self::Borrowed<'a> {
10691            value
10692        }
10693    }
10694
10695    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4GetInterfaceLocalTableResponse {
10696        type Owned = Self;
10697
10698        #[inline(always)]
10699        fn inline_align(_context: fidl::encoding::Context) -> usize {
10700            4
10701        }
10702
10703        #[inline(always)]
10704        fn inline_size(_context: fidl::encoding::Context) -> usize {
10705            4
10706        }
10707    }
10708
10709    unsafe impl
10710        fidl::encoding::Encode<
10711            RouteTableProviderV4GetInterfaceLocalTableResponse,
10712            fidl::encoding::DefaultFuchsiaResourceDialect,
10713        > for &mut RouteTableProviderV4GetInterfaceLocalTableResponse
10714    {
10715        #[inline]
10716        unsafe fn encode(
10717            self,
10718            encoder: &mut fidl::encoding::Encoder<
10719                '_,
10720                fidl::encoding::DefaultFuchsiaResourceDialect,
10721            >,
10722            offset: usize,
10723            _depth: fidl::encoding::Depth,
10724        ) -> fidl::Result<()> {
10725            encoder
10726                .debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableResponse>(offset);
10727            // Delegate to tuple encoding.
10728            fidl::encoding::Encode::<RouteTableProviderV4GetInterfaceLocalTableResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10729                (
10730                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_table),
10731                ),
10732                encoder, offset, _depth
10733            )
10734        }
10735    }
10736    unsafe impl<
10737        T0: fidl::encoding::Encode<
10738                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV4Marker>>,
10739                fidl::encoding::DefaultFuchsiaResourceDialect,
10740            >,
10741    >
10742        fidl::encoding::Encode<
10743            RouteTableProviderV4GetInterfaceLocalTableResponse,
10744            fidl::encoding::DefaultFuchsiaResourceDialect,
10745        > for (T0,)
10746    {
10747        #[inline]
10748        unsafe fn encode(
10749            self,
10750            encoder: &mut fidl::encoding::Encoder<
10751                '_,
10752                fidl::encoding::DefaultFuchsiaResourceDialect,
10753            >,
10754            offset: usize,
10755            depth: fidl::encoding::Depth,
10756        ) -> fidl::Result<()> {
10757            encoder
10758                .debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableResponse>(offset);
10759            // Zero out padding regions. There's no need to apply masks
10760            // because the unmasked parts will be overwritten by fields.
10761            // Write the fields.
10762            self.0.encode(encoder, offset + 0, depth)?;
10763            Ok(())
10764        }
10765    }
10766
10767    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10768        for RouteTableProviderV4GetInterfaceLocalTableResponse
10769    {
10770        #[inline(always)]
10771        fn new_empty() -> Self {
10772            Self {
10773                route_table: fidl::new_empty!(
10774                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV4Marker>>,
10775                    fidl::encoding::DefaultFuchsiaResourceDialect
10776                ),
10777            }
10778        }
10779
10780        #[inline]
10781        unsafe fn decode(
10782            &mut self,
10783            decoder: &mut fidl::encoding::Decoder<
10784                '_,
10785                fidl::encoding::DefaultFuchsiaResourceDialect,
10786            >,
10787            offset: usize,
10788            _depth: fidl::encoding::Depth,
10789        ) -> fidl::Result<()> {
10790            decoder.debug_check_bounds::<Self>(offset);
10791            // Verify that padding bytes are zero.
10792            fidl::decode!(
10793                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV4Marker>>,
10794                fidl::encoding::DefaultFuchsiaResourceDialect,
10795                &mut self.route_table,
10796                decoder,
10797                offset + 0,
10798                _depth
10799            )?;
10800            Ok(())
10801        }
10802    }
10803
10804    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6GetInterfaceLocalTableRequest {
10805        type Borrowed<'a> = &'a mut Self;
10806        fn take_or_borrow<'a>(
10807            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10808        ) -> Self::Borrowed<'a> {
10809            value
10810        }
10811    }
10812
10813    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6GetInterfaceLocalTableRequest {
10814        type Owned = Self;
10815
10816        #[inline(always)]
10817        fn inline_align(_context: fidl::encoding::Context) -> usize {
10818            8
10819        }
10820
10821        #[inline(always)]
10822        fn inline_size(_context: fidl::encoding::Context) -> usize {
10823            16
10824        }
10825    }
10826
10827    unsafe impl
10828        fidl::encoding::Encode<
10829            RouteTableProviderV6GetInterfaceLocalTableRequest,
10830            fidl::encoding::DefaultFuchsiaResourceDialect,
10831        > for &mut RouteTableProviderV6GetInterfaceLocalTableRequest
10832    {
10833        #[inline]
10834        unsafe fn encode(
10835            self,
10836            encoder: &mut fidl::encoding::Encoder<
10837                '_,
10838                fidl::encoding::DefaultFuchsiaResourceDialect,
10839            >,
10840            offset: usize,
10841            _depth: fidl::encoding::Depth,
10842        ) -> fidl::Result<()> {
10843            encoder.debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableRequest>(offset);
10844            // Delegate to tuple encoding.
10845            fidl::encoding::Encode::<RouteTableProviderV6GetInterfaceLocalTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10846                (
10847                    <fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
10848                ),
10849                encoder, offset, _depth
10850            )
10851        }
10852    }
10853    unsafe impl<
10854        T0: fidl::encoding::Encode<
10855                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10856                fidl::encoding::DefaultFuchsiaResourceDialect,
10857            >,
10858    >
10859        fidl::encoding::Encode<
10860            RouteTableProviderV6GetInterfaceLocalTableRequest,
10861            fidl::encoding::DefaultFuchsiaResourceDialect,
10862        > for (T0,)
10863    {
10864        #[inline]
10865        unsafe fn encode(
10866            self,
10867            encoder: &mut fidl::encoding::Encoder<
10868                '_,
10869                fidl::encoding::DefaultFuchsiaResourceDialect,
10870            >,
10871            offset: usize,
10872            depth: fidl::encoding::Depth,
10873        ) -> fidl::Result<()> {
10874            encoder.debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableRequest>(offset);
10875            // Zero out padding regions. There's no need to apply masks
10876            // because the unmasked parts will be overwritten by fields.
10877            // Write the fields.
10878            self.0.encode(encoder, offset + 0, depth)?;
10879            Ok(())
10880        }
10881    }
10882
10883    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10884        for RouteTableProviderV6GetInterfaceLocalTableRequest
10885    {
10886        #[inline(always)]
10887        fn new_empty() -> Self {
10888            Self {
10889                credential: fidl::new_empty!(
10890                    fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10891                    fidl::encoding::DefaultFuchsiaResourceDialect
10892                ),
10893            }
10894        }
10895
10896        #[inline]
10897        unsafe fn decode(
10898            &mut self,
10899            decoder: &mut fidl::encoding::Decoder<
10900                '_,
10901                fidl::encoding::DefaultFuchsiaResourceDialect,
10902            >,
10903            offset: usize,
10904            _depth: fidl::encoding::Depth,
10905        ) -> fidl::Result<()> {
10906            decoder.debug_check_bounds::<Self>(offset);
10907            // Verify that padding bytes are zero.
10908            fidl::decode!(
10909                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10910                fidl::encoding::DefaultFuchsiaResourceDialect,
10911                &mut self.credential,
10912                decoder,
10913                offset + 0,
10914                _depth
10915            )?;
10916            Ok(())
10917        }
10918    }
10919
10920    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6NewRouteTableRequest {
10921        type Borrowed<'a> = &'a mut Self;
10922        fn take_or_borrow<'a>(
10923            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10924        ) -> Self::Borrowed<'a> {
10925            value
10926        }
10927    }
10928
10929    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6NewRouteTableRequest {
10930        type Owned = Self;
10931
10932        #[inline(always)]
10933        fn inline_align(_context: fidl::encoding::Context) -> usize {
10934            8
10935        }
10936
10937        #[inline(always)]
10938        fn inline_size(_context: fidl::encoding::Context) -> usize {
10939            24
10940        }
10941    }
10942
10943    unsafe impl
10944        fidl::encoding::Encode<
10945            RouteTableProviderV6NewRouteTableRequest,
10946            fidl::encoding::DefaultFuchsiaResourceDialect,
10947        > for &mut RouteTableProviderV6NewRouteTableRequest
10948    {
10949        #[inline]
10950        unsafe fn encode(
10951            self,
10952            encoder: &mut fidl::encoding::Encoder<
10953                '_,
10954                fidl::encoding::DefaultFuchsiaResourceDialect,
10955            >,
10956            offset: usize,
10957            _depth: fidl::encoding::Depth,
10958        ) -> fidl::Result<()> {
10959            encoder.debug_check_bounds::<RouteTableProviderV6NewRouteTableRequest>(offset);
10960            // Delegate to tuple encoding.
10961            fidl::encoding::Encode::<RouteTableProviderV6NewRouteTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10962                (
10963                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
10964                    <RouteTableOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
10965                ),
10966                encoder, offset, _depth
10967            )
10968        }
10969    }
10970    unsafe impl<
10971        T0: fidl::encoding::Encode<
10972                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>>,
10973                fidl::encoding::DefaultFuchsiaResourceDialect,
10974            >,
10975        T1: fidl::encoding::Encode<RouteTableOptionsV6, fidl::encoding::DefaultFuchsiaResourceDialect>,
10976    >
10977        fidl::encoding::Encode<
10978            RouteTableProviderV6NewRouteTableRequest,
10979            fidl::encoding::DefaultFuchsiaResourceDialect,
10980        > for (T0, T1)
10981    {
10982        #[inline]
10983        unsafe fn encode(
10984            self,
10985            encoder: &mut fidl::encoding::Encoder<
10986                '_,
10987                fidl::encoding::DefaultFuchsiaResourceDialect,
10988            >,
10989            offset: usize,
10990            depth: fidl::encoding::Depth,
10991        ) -> fidl::Result<()> {
10992            encoder.debug_check_bounds::<RouteTableProviderV6NewRouteTableRequest>(offset);
10993            // Zero out padding regions. There's no need to apply masks
10994            // because the unmasked parts will be overwritten by fields.
10995            unsafe {
10996                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10997                (ptr as *mut u64).write_unaligned(0);
10998            }
10999            // Write the fields.
11000            self.0.encode(encoder, offset + 0, depth)?;
11001            self.1.encode(encoder, offset + 8, depth)?;
11002            Ok(())
11003        }
11004    }
11005
11006    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11007        for RouteTableProviderV6NewRouteTableRequest
11008    {
11009        #[inline(always)]
11010        fn new_empty() -> Self {
11011            Self {
11012                provider: fidl::new_empty!(
11013                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>>,
11014                    fidl::encoding::DefaultFuchsiaResourceDialect
11015                ),
11016                options: fidl::new_empty!(
11017                    RouteTableOptionsV6,
11018                    fidl::encoding::DefaultFuchsiaResourceDialect
11019                ),
11020            }
11021        }
11022
11023        #[inline]
11024        unsafe fn decode(
11025            &mut self,
11026            decoder: &mut fidl::encoding::Decoder<
11027                '_,
11028                fidl::encoding::DefaultFuchsiaResourceDialect,
11029            >,
11030            offset: usize,
11031            _depth: fidl::encoding::Depth,
11032        ) -> fidl::Result<()> {
11033            decoder.debug_check_bounds::<Self>(offset);
11034            // Verify that padding bytes are zero.
11035            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11036            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11037            let mask = 0xffffffff00000000u64;
11038            let maskedval = padval & mask;
11039            if maskedval != 0 {
11040                return Err(fidl::Error::NonZeroPadding {
11041                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11042                });
11043            }
11044            fidl::decode!(
11045                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>>,
11046                fidl::encoding::DefaultFuchsiaResourceDialect,
11047                &mut self.provider,
11048                decoder,
11049                offset + 0,
11050                _depth
11051            )?;
11052            fidl::decode!(
11053                RouteTableOptionsV6,
11054                fidl::encoding::DefaultFuchsiaResourceDialect,
11055                &mut self.options,
11056                decoder,
11057                offset + 8,
11058                _depth
11059            )?;
11060            Ok(())
11061        }
11062    }
11063
11064    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6GetInterfaceLocalTableResponse {
11065        type Borrowed<'a> = &'a mut Self;
11066        fn take_or_borrow<'a>(
11067            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11068        ) -> Self::Borrowed<'a> {
11069            value
11070        }
11071    }
11072
11073    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6GetInterfaceLocalTableResponse {
11074        type Owned = Self;
11075
11076        #[inline(always)]
11077        fn inline_align(_context: fidl::encoding::Context) -> usize {
11078            4
11079        }
11080
11081        #[inline(always)]
11082        fn inline_size(_context: fidl::encoding::Context) -> usize {
11083            4
11084        }
11085    }
11086
11087    unsafe impl
11088        fidl::encoding::Encode<
11089            RouteTableProviderV6GetInterfaceLocalTableResponse,
11090            fidl::encoding::DefaultFuchsiaResourceDialect,
11091        > for &mut RouteTableProviderV6GetInterfaceLocalTableResponse
11092    {
11093        #[inline]
11094        unsafe fn encode(
11095            self,
11096            encoder: &mut fidl::encoding::Encoder<
11097                '_,
11098                fidl::encoding::DefaultFuchsiaResourceDialect,
11099            >,
11100            offset: usize,
11101            _depth: fidl::encoding::Depth,
11102        ) -> fidl::Result<()> {
11103            encoder
11104                .debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableResponse>(offset);
11105            // Delegate to tuple encoding.
11106            fidl::encoding::Encode::<RouteTableProviderV6GetInterfaceLocalTableResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11107                (
11108                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_table),
11109                ),
11110                encoder, offset, _depth
11111            )
11112        }
11113    }
11114    unsafe impl<
11115        T0: fidl::encoding::Encode<
11116                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV6Marker>>,
11117                fidl::encoding::DefaultFuchsiaResourceDialect,
11118            >,
11119    >
11120        fidl::encoding::Encode<
11121            RouteTableProviderV6GetInterfaceLocalTableResponse,
11122            fidl::encoding::DefaultFuchsiaResourceDialect,
11123        > for (T0,)
11124    {
11125        #[inline]
11126        unsafe fn encode(
11127            self,
11128            encoder: &mut fidl::encoding::Encoder<
11129                '_,
11130                fidl::encoding::DefaultFuchsiaResourceDialect,
11131            >,
11132            offset: usize,
11133            depth: fidl::encoding::Depth,
11134        ) -> fidl::Result<()> {
11135            encoder
11136                .debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableResponse>(offset);
11137            // Zero out padding regions. There's no need to apply masks
11138            // because the unmasked parts will be overwritten by fields.
11139            // Write the fields.
11140            self.0.encode(encoder, offset + 0, depth)?;
11141            Ok(())
11142        }
11143    }
11144
11145    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11146        for RouteTableProviderV6GetInterfaceLocalTableResponse
11147    {
11148        #[inline(always)]
11149        fn new_empty() -> Self {
11150            Self {
11151                route_table: fidl::new_empty!(
11152                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV6Marker>>,
11153                    fidl::encoding::DefaultFuchsiaResourceDialect
11154                ),
11155            }
11156        }
11157
11158        #[inline]
11159        unsafe fn decode(
11160            &mut self,
11161            decoder: &mut fidl::encoding::Decoder<
11162                '_,
11163                fidl::encoding::DefaultFuchsiaResourceDialect,
11164            >,
11165            offset: usize,
11166            _depth: fidl::encoding::Depth,
11167        ) -> fidl::Result<()> {
11168            decoder.debug_check_bounds::<Self>(offset);
11169            // Verify that padding bytes are zero.
11170            fidl::decode!(
11171                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV6Marker>>,
11172                fidl::encoding::DefaultFuchsiaResourceDialect,
11173                &mut self.route_table,
11174                decoder,
11175                offset + 0,
11176                _depth
11177            )?;
11178            Ok(())
11179        }
11180    }
11181
11182    impl fidl::encoding::ResourceTypeMarker for RouteTableV4NewRouteSetRequest {
11183        type Borrowed<'a> = &'a mut Self;
11184        fn take_or_borrow<'a>(
11185            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11186        ) -> Self::Borrowed<'a> {
11187            value
11188        }
11189    }
11190
11191    unsafe impl fidl::encoding::TypeMarker for RouteTableV4NewRouteSetRequest {
11192        type Owned = Self;
11193
11194        #[inline(always)]
11195        fn inline_align(_context: fidl::encoding::Context) -> usize {
11196            4
11197        }
11198
11199        #[inline(always)]
11200        fn inline_size(_context: fidl::encoding::Context) -> usize {
11201            4
11202        }
11203    }
11204
11205    unsafe impl
11206        fidl::encoding::Encode<
11207            RouteTableV4NewRouteSetRequest,
11208            fidl::encoding::DefaultFuchsiaResourceDialect,
11209        > for &mut RouteTableV4NewRouteSetRequest
11210    {
11211        #[inline]
11212        unsafe fn encode(
11213            self,
11214            encoder: &mut fidl::encoding::Encoder<
11215                '_,
11216                fidl::encoding::DefaultFuchsiaResourceDialect,
11217            >,
11218            offset: usize,
11219            _depth: fidl::encoding::Depth,
11220        ) -> fidl::Result<()> {
11221            encoder.debug_check_bounds::<RouteTableV4NewRouteSetRequest>(offset);
11222            // Delegate to tuple encoding.
11223            fidl::encoding::Encode::<RouteTableV4NewRouteSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11224                (
11225                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_set),
11226                ),
11227                encoder, offset, _depth
11228            )
11229        }
11230    }
11231    unsafe impl<
11232        T0: fidl::encoding::Encode<
11233                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>>,
11234                fidl::encoding::DefaultFuchsiaResourceDialect,
11235            >,
11236    >
11237        fidl::encoding::Encode<
11238            RouteTableV4NewRouteSetRequest,
11239            fidl::encoding::DefaultFuchsiaResourceDialect,
11240        > for (T0,)
11241    {
11242        #[inline]
11243        unsafe fn encode(
11244            self,
11245            encoder: &mut fidl::encoding::Encoder<
11246                '_,
11247                fidl::encoding::DefaultFuchsiaResourceDialect,
11248            >,
11249            offset: usize,
11250            depth: fidl::encoding::Depth,
11251        ) -> fidl::Result<()> {
11252            encoder.debug_check_bounds::<RouteTableV4NewRouteSetRequest>(offset);
11253            // Zero out padding regions. There's no need to apply masks
11254            // because the unmasked parts will be overwritten by fields.
11255            // Write the fields.
11256            self.0.encode(encoder, offset + 0, depth)?;
11257            Ok(())
11258        }
11259    }
11260
11261    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11262        for RouteTableV4NewRouteSetRequest
11263    {
11264        #[inline(always)]
11265        fn new_empty() -> Self {
11266            Self {
11267                route_set: fidl::new_empty!(
11268                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>>,
11269                    fidl::encoding::DefaultFuchsiaResourceDialect
11270                ),
11271            }
11272        }
11273
11274        #[inline]
11275        unsafe fn decode(
11276            &mut self,
11277            decoder: &mut fidl::encoding::Decoder<
11278                '_,
11279                fidl::encoding::DefaultFuchsiaResourceDialect,
11280            >,
11281            offset: usize,
11282            _depth: fidl::encoding::Depth,
11283        ) -> fidl::Result<()> {
11284            decoder.debug_check_bounds::<Self>(offset);
11285            // Verify that padding bytes are zero.
11286            fidl::decode!(
11287                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>>,
11288                fidl::encoding::DefaultFuchsiaResourceDialect,
11289                &mut self.route_set,
11290                decoder,
11291                offset + 0,
11292                _depth
11293            )?;
11294            Ok(())
11295        }
11296    }
11297
11298    impl fidl::encoding::ResourceTypeMarker for RouteTableV6NewRouteSetRequest {
11299        type Borrowed<'a> = &'a mut Self;
11300        fn take_or_borrow<'a>(
11301            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11302        ) -> Self::Borrowed<'a> {
11303            value
11304        }
11305    }
11306
11307    unsafe impl fidl::encoding::TypeMarker for RouteTableV6NewRouteSetRequest {
11308        type Owned = Self;
11309
11310        #[inline(always)]
11311        fn inline_align(_context: fidl::encoding::Context) -> usize {
11312            4
11313        }
11314
11315        #[inline(always)]
11316        fn inline_size(_context: fidl::encoding::Context) -> usize {
11317            4
11318        }
11319    }
11320
11321    unsafe impl
11322        fidl::encoding::Encode<
11323            RouteTableV6NewRouteSetRequest,
11324            fidl::encoding::DefaultFuchsiaResourceDialect,
11325        > for &mut RouteTableV6NewRouteSetRequest
11326    {
11327        #[inline]
11328        unsafe fn encode(
11329            self,
11330            encoder: &mut fidl::encoding::Encoder<
11331                '_,
11332                fidl::encoding::DefaultFuchsiaResourceDialect,
11333            >,
11334            offset: usize,
11335            _depth: fidl::encoding::Depth,
11336        ) -> fidl::Result<()> {
11337            encoder.debug_check_bounds::<RouteTableV6NewRouteSetRequest>(offset);
11338            // Delegate to tuple encoding.
11339            fidl::encoding::Encode::<RouteTableV6NewRouteSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11340                (
11341                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_set),
11342                ),
11343                encoder, offset, _depth
11344            )
11345        }
11346    }
11347    unsafe impl<
11348        T0: fidl::encoding::Encode<
11349                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>>,
11350                fidl::encoding::DefaultFuchsiaResourceDialect,
11351            >,
11352    >
11353        fidl::encoding::Encode<
11354            RouteTableV6NewRouteSetRequest,
11355            fidl::encoding::DefaultFuchsiaResourceDialect,
11356        > for (T0,)
11357    {
11358        #[inline]
11359        unsafe fn encode(
11360            self,
11361            encoder: &mut fidl::encoding::Encoder<
11362                '_,
11363                fidl::encoding::DefaultFuchsiaResourceDialect,
11364            >,
11365            offset: usize,
11366            depth: fidl::encoding::Depth,
11367        ) -> fidl::Result<()> {
11368            encoder.debug_check_bounds::<RouteTableV6NewRouteSetRequest>(offset);
11369            // Zero out padding regions. There's no need to apply masks
11370            // because the unmasked parts will be overwritten by fields.
11371            // Write the fields.
11372            self.0.encode(encoder, offset + 0, depth)?;
11373            Ok(())
11374        }
11375    }
11376
11377    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11378        for RouteTableV6NewRouteSetRequest
11379    {
11380        #[inline(always)]
11381        fn new_empty() -> Self {
11382            Self {
11383                route_set: fidl::new_empty!(
11384                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>>,
11385                    fidl::encoding::DefaultFuchsiaResourceDialect
11386                ),
11387            }
11388        }
11389
11390        #[inline]
11391        unsafe fn decode(
11392            &mut self,
11393            decoder: &mut fidl::encoding::Decoder<
11394                '_,
11395                fidl::encoding::DefaultFuchsiaResourceDialect,
11396            >,
11397            offset: usize,
11398            _depth: fidl::encoding::Depth,
11399        ) -> fidl::Result<()> {
11400            decoder.debug_check_bounds::<Self>(offset);
11401            // Verify that padding bytes are zero.
11402            fidl::decode!(
11403                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>>,
11404                fidl::encoding::DefaultFuchsiaResourceDialect,
11405                &mut self.route_set,
11406                decoder,
11407                offset + 0,
11408                _depth
11409            )?;
11410            Ok(())
11411        }
11412    }
11413
11414    impl fidl::encoding::ResourceTypeMarker for RuleSetV4AddRuleRequest {
11415        type Borrowed<'a> = &'a mut Self;
11416        fn take_or_borrow<'a>(
11417            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11418        ) -> Self::Borrowed<'a> {
11419            value
11420        }
11421    }
11422
11423    unsafe impl fidl::encoding::TypeMarker for RuleSetV4AddRuleRequest {
11424        type Owned = Self;
11425
11426        #[inline(always)]
11427        fn inline_align(_context: fidl::encoding::Context) -> usize {
11428            8
11429        }
11430
11431        #[inline(always)]
11432        fn inline_size(_context: fidl::encoding::Context) -> usize {
11433            40
11434        }
11435    }
11436
11437    unsafe impl
11438        fidl::encoding::Encode<
11439            RuleSetV4AddRuleRequest,
11440            fidl::encoding::DefaultFuchsiaResourceDialect,
11441        > for &mut RuleSetV4AddRuleRequest
11442    {
11443        #[inline]
11444        unsafe fn encode(
11445            self,
11446            encoder: &mut fidl::encoding::Encoder<
11447                '_,
11448                fidl::encoding::DefaultFuchsiaResourceDialect,
11449            >,
11450            offset: usize,
11451            _depth: fidl::encoding::Depth,
11452        ) -> fidl::Result<()> {
11453            encoder.debug_check_bounds::<RuleSetV4AddRuleRequest>(offset);
11454            // Delegate to tuple encoding.
11455            fidl::encoding::Encode::<RuleSetV4AddRuleRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11456                (
11457                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
11458                    <fidl_fuchsia_net_routes::RuleMatcherV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.matcher),
11459                    <fidl_fuchsia_net_routes::RuleAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
11460                ),
11461                encoder, offset, _depth
11462            )
11463        }
11464    }
11465    unsafe impl<
11466        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11467        T1: fidl::encoding::Encode<
11468                fidl_fuchsia_net_routes::RuleMatcherV4,
11469                fidl::encoding::DefaultFuchsiaResourceDialect,
11470            >,
11471        T2: fidl::encoding::Encode<
11472                fidl_fuchsia_net_routes::RuleAction,
11473                fidl::encoding::DefaultFuchsiaResourceDialect,
11474            >,
11475    >
11476        fidl::encoding::Encode<
11477            RuleSetV4AddRuleRequest,
11478            fidl::encoding::DefaultFuchsiaResourceDialect,
11479        > for (T0, T1, T2)
11480    {
11481        #[inline]
11482        unsafe fn encode(
11483            self,
11484            encoder: &mut fidl::encoding::Encoder<
11485                '_,
11486                fidl::encoding::DefaultFuchsiaResourceDialect,
11487            >,
11488            offset: usize,
11489            depth: fidl::encoding::Depth,
11490        ) -> fidl::Result<()> {
11491            encoder.debug_check_bounds::<RuleSetV4AddRuleRequest>(offset);
11492            // Zero out padding regions. There's no need to apply masks
11493            // because the unmasked parts will be overwritten by fields.
11494            unsafe {
11495                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11496                (ptr as *mut u64).write_unaligned(0);
11497            }
11498            // Write the fields.
11499            self.0.encode(encoder, offset + 0, depth)?;
11500            self.1.encode(encoder, offset + 8, depth)?;
11501            self.2.encode(encoder, offset + 24, depth)?;
11502            Ok(())
11503        }
11504    }
11505
11506    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11507        for RuleSetV4AddRuleRequest
11508    {
11509        #[inline(always)]
11510        fn new_empty() -> Self {
11511            Self {
11512                index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11513                matcher: fidl::new_empty!(
11514                    fidl_fuchsia_net_routes::RuleMatcherV4,
11515                    fidl::encoding::DefaultFuchsiaResourceDialect
11516                ),
11517                action: fidl::new_empty!(
11518                    fidl_fuchsia_net_routes::RuleAction,
11519                    fidl::encoding::DefaultFuchsiaResourceDialect
11520                ),
11521            }
11522        }
11523
11524        #[inline]
11525        unsafe fn decode(
11526            &mut self,
11527            decoder: &mut fidl::encoding::Decoder<
11528                '_,
11529                fidl::encoding::DefaultFuchsiaResourceDialect,
11530            >,
11531            offset: usize,
11532            _depth: fidl::encoding::Depth,
11533        ) -> fidl::Result<()> {
11534            decoder.debug_check_bounds::<Self>(offset);
11535            // Verify that padding bytes are zero.
11536            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11537            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11538            let mask = 0xffffffff00000000u64;
11539            let maskedval = padval & mask;
11540            if maskedval != 0 {
11541                return Err(fidl::Error::NonZeroPadding {
11542                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11543                });
11544            }
11545            fidl::decode!(
11546                u32,
11547                fidl::encoding::DefaultFuchsiaResourceDialect,
11548                &mut self.index,
11549                decoder,
11550                offset + 0,
11551                _depth
11552            )?;
11553            fidl::decode!(
11554                fidl_fuchsia_net_routes::RuleMatcherV4,
11555                fidl::encoding::DefaultFuchsiaResourceDialect,
11556                &mut self.matcher,
11557                decoder,
11558                offset + 8,
11559                _depth
11560            )?;
11561            fidl::decode!(
11562                fidl_fuchsia_net_routes::RuleAction,
11563                fidl::encoding::DefaultFuchsiaResourceDialect,
11564                &mut self.action,
11565                decoder,
11566                offset + 24,
11567                _depth
11568            )?;
11569            Ok(())
11570        }
11571    }
11572
11573    impl fidl::encoding::ResourceTypeMarker for RuleSetV6AddRuleRequest {
11574        type Borrowed<'a> = &'a mut Self;
11575        fn take_or_borrow<'a>(
11576            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11577        ) -> Self::Borrowed<'a> {
11578            value
11579        }
11580    }
11581
11582    unsafe impl fidl::encoding::TypeMarker for RuleSetV6AddRuleRequest {
11583        type Owned = Self;
11584
11585        #[inline(always)]
11586        fn inline_align(_context: fidl::encoding::Context) -> usize {
11587            8
11588        }
11589
11590        #[inline(always)]
11591        fn inline_size(_context: fidl::encoding::Context) -> usize {
11592            40
11593        }
11594    }
11595
11596    unsafe impl
11597        fidl::encoding::Encode<
11598            RuleSetV6AddRuleRequest,
11599            fidl::encoding::DefaultFuchsiaResourceDialect,
11600        > for &mut RuleSetV6AddRuleRequest
11601    {
11602        #[inline]
11603        unsafe fn encode(
11604            self,
11605            encoder: &mut fidl::encoding::Encoder<
11606                '_,
11607                fidl::encoding::DefaultFuchsiaResourceDialect,
11608            >,
11609            offset: usize,
11610            _depth: fidl::encoding::Depth,
11611        ) -> fidl::Result<()> {
11612            encoder.debug_check_bounds::<RuleSetV6AddRuleRequest>(offset);
11613            // Delegate to tuple encoding.
11614            fidl::encoding::Encode::<RuleSetV6AddRuleRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11615                (
11616                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
11617                    <fidl_fuchsia_net_routes::RuleMatcherV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.matcher),
11618                    <fidl_fuchsia_net_routes::RuleAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
11619                ),
11620                encoder, offset, _depth
11621            )
11622        }
11623    }
11624    unsafe impl<
11625        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11626        T1: fidl::encoding::Encode<
11627                fidl_fuchsia_net_routes::RuleMatcherV6,
11628                fidl::encoding::DefaultFuchsiaResourceDialect,
11629            >,
11630        T2: fidl::encoding::Encode<
11631                fidl_fuchsia_net_routes::RuleAction,
11632                fidl::encoding::DefaultFuchsiaResourceDialect,
11633            >,
11634    >
11635        fidl::encoding::Encode<
11636            RuleSetV6AddRuleRequest,
11637            fidl::encoding::DefaultFuchsiaResourceDialect,
11638        > for (T0, T1, T2)
11639    {
11640        #[inline]
11641        unsafe fn encode(
11642            self,
11643            encoder: &mut fidl::encoding::Encoder<
11644                '_,
11645                fidl::encoding::DefaultFuchsiaResourceDialect,
11646            >,
11647            offset: usize,
11648            depth: fidl::encoding::Depth,
11649        ) -> fidl::Result<()> {
11650            encoder.debug_check_bounds::<RuleSetV6AddRuleRequest>(offset);
11651            // Zero out padding regions. There's no need to apply masks
11652            // because the unmasked parts will be overwritten by fields.
11653            unsafe {
11654                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11655                (ptr as *mut u64).write_unaligned(0);
11656            }
11657            // Write the fields.
11658            self.0.encode(encoder, offset + 0, depth)?;
11659            self.1.encode(encoder, offset + 8, depth)?;
11660            self.2.encode(encoder, offset + 24, depth)?;
11661            Ok(())
11662        }
11663    }
11664
11665    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11666        for RuleSetV6AddRuleRequest
11667    {
11668        #[inline(always)]
11669        fn new_empty() -> Self {
11670            Self {
11671                index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11672                matcher: fidl::new_empty!(
11673                    fidl_fuchsia_net_routes::RuleMatcherV6,
11674                    fidl::encoding::DefaultFuchsiaResourceDialect
11675                ),
11676                action: fidl::new_empty!(
11677                    fidl_fuchsia_net_routes::RuleAction,
11678                    fidl::encoding::DefaultFuchsiaResourceDialect
11679                ),
11680            }
11681        }
11682
11683        #[inline]
11684        unsafe fn decode(
11685            &mut self,
11686            decoder: &mut fidl::encoding::Decoder<
11687                '_,
11688                fidl::encoding::DefaultFuchsiaResourceDialect,
11689            >,
11690            offset: usize,
11691            _depth: fidl::encoding::Depth,
11692        ) -> fidl::Result<()> {
11693            decoder.debug_check_bounds::<Self>(offset);
11694            // Verify that padding bytes are zero.
11695            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11696            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11697            let mask = 0xffffffff00000000u64;
11698            let maskedval = padval & mask;
11699            if maskedval != 0 {
11700                return Err(fidl::Error::NonZeroPadding {
11701                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11702                });
11703            }
11704            fidl::decode!(
11705                u32,
11706                fidl::encoding::DefaultFuchsiaResourceDialect,
11707                &mut self.index,
11708                decoder,
11709                offset + 0,
11710                _depth
11711            )?;
11712            fidl::decode!(
11713                fidl_fuchsia_net_routes::RuleMatcherV6,
11714                fidl::encoding::DefaultFuchsiaResourceDialect,
11715                &mut self.matcher,
11716                decoder,
11717                offset + 8,
11718                _depth
11719            )?;
11720            fidl::decode!(
11721                fidl_fuchsia_net_routes::RuleAction,
11722                fidl::encoding::DefaultFuchsiaResourceDialect,
11723                &mut self.action,
11724                decoder,
11725                offset + 24,
11726                _depth
11727            )?;
11728            Ok(())
11729        }
11730    }
11731
11732    impl fidl::encoding::ResourceTypeMarker for RuleTableV4NewRuleSetRequest {
11733        type Borrowed<'a> = &'a mut Self;
11734        fn take_or_borrow<'a>(
11735            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11736        ) -> Self::Borrowed<'a> {
11737            value
11738        }
11739    }
11740
11741    unsafe impl fidl::encoding::TypeMarker for RuleTableV4NewRuleSetRequest {
11742        type Owned = Self;
11743
11744        #[inline(always)]
11745        fn inline_align(_context: fidl::encoding::Context) -> usize {
11746            4
11747        }
11748
11749        #[inline(always)]
11750        fn inline_size(_context: fidl::encoding::Context) -> usize {
11751            8
11752        }
11753    }
11754
11755    unsafe impl
11756        fidl::encoding::Encode<
11757            RuleTableV4NewRuleSetRequest,
11758            fidl::encoding::DefaultFuchsiaResourceDialect,
11759        > for &mut RuleTableV4NewRuleSetRequest
11760    {
11761        #[inline]
11762        unsafe fn encode(
11763            self,
11764            encoder: &mut fidl::encoding::Encoder<
11765                '_,
11766                fidl::encoding::DefaultFuchsiaResourceDialect,
11767            >,
11768            offset: usize,
11769            _depth: fidl::encoding::Depth,
11770        ) -> fidl::Result<()> {
11771            encoder.debug_check_bounds::<RuleTableV4NewRuleSetRequest>(offset);
11772            // Delegate to tuple encoding.
11773            fidl::encoding::Encode::<RuleTableV4NewRuleSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11774                (
11775                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
11776                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.rule_set),
11777                ),
11778                encoder, offset, _depth
11779            )
11780        }
11781    }
11782    unsafe impl<
11783        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11784        T1: fidl::encoding::Encode<
11785                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>>,
11786                fidl::encoding::DefaultFuchsiaResourceDialect,
11787            >,
11788    >
11789        fidl::encoding::Encode<
11790            RuleTableV4NewRuleSetRequest,
11791            fidl::encoding::DefaultFuchsiaResourceDialect,
11792        > for (T0, T1)
11793    {
11794        #[inline]
11795        unsafe fn encode(
11796            self,
11797            encoder: &mut fidl::encoding::Encoder<
11798                '_,
11799                fidl::encoding::DefaultFuchsiaResourceDialect,
11800            >,
11801            offset: usize,
11802            depth: fidl::encoding::Depth,
11803        ) -> fidl::Result<()> {
11804            encoder.debug_check_bounds::<RuleTableV4NewRuleSetRequest>(offset);
11805            // Zero out padding regions. There's no need to apply masks
11806            // because the unmasked parts will be overwritten by fields.
11807            // Write the fields.
11808            self.0.encode(encoder, offset + 0, depth)?;
11809            self.1.encode(encoder, offset + 4, depth)?;
11810            Ok(())
11811        }
11812    }
11813
11814    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11815        for RuleTableV4NewRuleSetRequest
11816    {
11817        #[inline(always)]
11818        fn new_empty() -> Self {
11819            Self {
11820                priority: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11821                rule_set: fidl::new_empty!(
11822                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>>,
11823                    fidl::encoding::DefaultFuchsiaResourceDialect
11824                ),
11825            }
11826        }
11827
11828        #[inline]
11829        unsafe fn decode(
11830            &mut self,
11831            decoder: &mut fidl::encoding::Decoder<
11832                '_,
11833                fidl::encoding::DefaultFuchsiaResourceDialect,
11834            >,
11835            offset: usize,
11836            _depth: fidl::encoding::Depth,
11837        ) -> fidl::Result<()> {
11838            decoder.debug_check_bounds::<Self>(offset);
11839            // Verify that padding bytes are zero.
11840            fidl::decode!(
11841                u32,
11842                fidl::encoding::DefaultFuchsiaResourceDialect,
11843                &mut self.priority,
11844                decoder,
11845                offset + 0,
11846                _depth
11847            )?;
11848            fidl::decode!(
11849                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>>,
11850                fidl::encoding::DefaultFuchsiaResourceDialect,
11851                &mut self.rule_set,
11852                decoder,
11853                offset + 4,
11854                _depth
11855            )?;
11856            Ok(())
11857        }
11858    }
11859
11860    impl fidl::encoding::ResourceTypeMarker for RuleTableV6NewRuleSetRequest {
11861        type Borrowed<'a> = &'a mut Self;
11862        fn take_or_borrow<'a>(
11863            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11864        ) -> Self::Borrowed<'a> {
11865            value
11866        }
11867    }
11868
11869    unsafe impl fidl::encoding::TypeMarker for RuleTableV6NewRuleSetRequest {
11870        type Owned = Self;
11871
11872        #[inline(always)]
11873        fn inline_align(_context: fidl::encoding::Context) -> usize {
11874            4
11875        }
11876
11877        #[inline(always)]
11878        fn inline_size(_context: fidl::encoding::Context) -> usize {
11879            8
11880        }
11881    }
11882
11883    unsafe impl
11884        fidl::encoding::Encode<
11885            RuleTableV6NewRuleSetRequest,
11886            fidl::encoding::DefaultFuchsiaResourceDialect,
11887        > for &mut RuleTableV6NewRuleSetRequest
11888    {
11889        #[inline]
11890        unsafe fn encode(
11891            self,
11892            encoder: &mut fidl::encoding::Encoder<
11893                '_,
11894                fidl::encoding::DefaultFuchsiaResourceDialect,
11895            >,
11896            offset: usize,
11897            _depth: fidl::encoding::Depth,
11898        ) -> fidl::Result<()> {
11899            encoder.debug_check_bounds::<RuleTableV6NewRuleSetRequest>(offset);
11900            // Delegate to tuple encoding.
11901            fidl::encoding::Encode::<RuleTableV6NewRuleSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11902                (
11903                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
11904                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.rule_set),
11905                ),
11906                encoder, offset, _depth
11907            )
11908        }
11909    }
11910    unsafe impl<
11911        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11912        T1: fidl::encoding::Encode<
11913                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>>,
11914                fidl::encoding::DefaultFuchsiaResourceDialect,
11915            >,
11916    >
11917        fidl::encoding::Encode<
11918            RuleTableV6NewRuleSetRequest,
11919            fidl::encoding::DefaultFuchsiaResourceDialect,
11920        > for (T0, T1)
11921    {
11922        #[inline]
11923        unsafe fn encode(
11924            self,
11925            encoder: &mut fidl::encoding::Encoder<
11926                '_,
11927                fidl::encoding::DefaultFuchsiaResourceDialect,
11928            >,
11929            offset: usize,
11930            depth: fidl::encoding::Depth,
11931        ) -> fidl::Result<()> {
11932            encoder.debug_check_bounds::<RuleTableV6NewRuleSetRequest>(offset);
11933            // Zero out padding regions. There's no need to apply masks
11934            // because the unmasked parts will be overwritten by fields.
11935            // Write the fields.
11936            self.0.encode(encoder, offset + 0, depth)?;
11937            self.1.encode(encoder, offset + 4, depth)?;
11938            Ok(())
11939        }
11940    }
11941
11942    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11943        for RuleTableV6NewRuleSetRequest
11944    {
11945        #[inline(always)]
11946        fn new_empty() -> Self {
11947            Self {
11948                priority: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11949                rule_set: fidl::new_empty!(
11950                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>>,
11951                    fidl::encoding::DefaultFuchsiaResourceDialect
11952                ),
11953            }
11954        }
11955
11956        #[inline]
11957        unsafe fn decode(
11958            &mut self,
11959            decoder: &mut fidl::encoding::Decoder<
11960                '_,
11961                fidl::encoding::DefaultFuchsiaResourceDialect,
11962            >,
11963            offset: usize,
11964            _depth: fidl::encoding::Depth,
11965        ) -> fidl::Result<()> {
11966            decoder.debug_check_bounds::<Self>(offset);
11967            // Verify that padding bytes are zero.
11968            fidl::decode!(
11969                u32,
11970                fidl::encoding::DefaultFuchsiaResourceDialect,
11971                &mut self.priority,
11972                decoder,
11973                offset + 0,
11974                _depth
11975            )?;
11976            fidl::decode!(
11977                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>>,
11978                fidl::encoding::DefaultFuchsiaResourceDialect,
11979                &mut self.rule_set,
11980                decoder,
11981                offset + 4,
11982                _depth
11983            )?;
11984            Ok(())
11985        }
11986    }
11987}