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