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