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