fidl_fuchsia_device_fs/
fidl_fuchsia_device_fs.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_device_fs__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ConnectorConnectRequest {
16    pub server: fidl::Channel,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ConnectorConnectRequest {}
20
21#[derive(Debug, Default, PartialEq)]
22pub struct DevfsAddArgs {
23    /// This is the connector to be installed in devfs.
24    /// `Connect()` will be called when a client connects to this node in the filesystem.
25    /// Optional: If this is not provided then an empty node will appear in devfs.
26    pub connector: Option<fidl::endpoints::ClientEnd<ConnectorMarker>>,
27    /// This is the class name for installing this node in devfs.
28    /// The node will be placed within /dev/class/{class_name}.
29    /// If `class_name` does not exist under /dev/class/ it will be created.
30    /// Optional: If this is not provided then the node will only be added via topological path.
31    pub class_name: Option<String>,
32    /// This is a vmo of inspect data that will be installed in devfs.
33    /// Optional: If this is not provided then the devfs's inspect data will be empty.
34    pub inspect: Option<fidl::Vmo>,
35    /// The connection types that are supported by the |connector| given.
36    /// The driver framework should handle connection types that are not supported by the
37    /// connector.
38    /// If not provided, only the device type is assumed as supported by the connector.
39    pub connector_supports: Option<ConnectionType>,
40    /// This is the controller connector to be installed in devfs.
41    /// `Connect()` will be called when a client connects to the device_controller connection
42    /// for this node in the filesystem.
43    /// Optional: If this is not provided then the Node will handle the connection natively.
44    /// This option should only be used by the compat shim or in tests
45    pub controller_connector: Option<fidl::endpoints::ClientEnd<ConnectorMarker>>,
46    #[doc(hidden)]
47    pub __source_breaking: fidl::marker::SourceBreaking,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DevfsAddArgs {}
51
52#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
53pub struct ConnectorMarker;
54
55impl fidl::endpoints::ProtocolMarker for ConnectorMarker {
56    type Proxy = ConnectorProxy;
57    type RequestStream = ConnectorRequestStream;
58    #[cfg(target_os = "fuchsia")]
59    type SynchronousProxy = ConnectorSynchronousProxy;
60
61    const DEBUG_NAME: &'static str = "(anonymous) Connector";
62}
63
64pub trait ConnectorProxyInterface: Send + Sync {
65    fn r#connect(&self, server: fidl::Channel) -> Result<(), fidl::Error>;
66}
67#[derive(Debug)]
68#[cfg(target_os = "fuchsia")]
69pub struct ConnectorSynchronousProxy {
70    client: fidl::client::sync::Client,
71}
72
73#[cfg(target_os = "fuchsia")]
74impl fidl::endpoints::SynchronousProxy for ConnectorSynchronousProxy {
75    type Proxy = ConnectorProxy;
76    type Protocol = ConnectorMarker;
77
78    fn from_channel(inner: fidl::Channel) -> Self {
79        Self::new(inner)
80    }
81
82    fn into_channel(self) -> fidl::Channel {
83        self.client.into_channel()
84    }
85
86    fn as_channel(&self) -> &fidl::Channel {
87        self.client.as_channel()
88    }
89}
90
91#[cfg(target_os = "fuchsia")]
92impl ConnectorSynchronousProxy {
93    pub fn new(channel: fidl::Channel) -> Self {
94        let protocol_name = <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
95        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
96    }
97
98    pub fn into_channel(self) -> fidl::Channel {
99        self.client.into_channel()
100    }
101
102    /// Waits until an event arrives and returns it. It is safe for other
103    /// threads to make concurrent requests while waiting for an event.
104    pub fn wait_for_event(
105        &self,
106        deadline: zx::MonotonicInstant,
107    ) -> Result<ConnectorEvent, fidl::Error> {
108        ConnectorEvent::decode(self.client.wait_for_event(deadline)?)
109    }
110
111    /// Forward a server end of a protocol so that it can be connected.
112    /// + request `server` the server end of the protocol to be served. The FIDL protocol that
113    ///     this speaks is determined out-of-band.
114    /// - response This function has no response. The function is one-way to match the pipelining
115    ///     behaviors of other virtual filesystems.
116    pub fn r#connect(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
117        self.client.send::<ConnectorConnectRequest>(
118            (server,),
119            0x2bfd50a6209194f9,
120            fidl::encoding::DynamicFlags::empty(),
121        )
122    }
123}
124
125#[cfg(target_os = "fuchsia")]
126impl From<ConnectorSynchronousProxy> for zx::Handle {
127    fn from(value: ConnectorSynchronousProxy) -> Self {
128        value.into_channel().into()
129    }
130}
131
132#[cfg(target_os = "fuchsia")]
133impl From<fidl::Channel> for ConnectorSynchronousProxy {
134    fn from(value: fidl::Channel) -> Self {
135        Self::new(value)
136    }
137}
138
139#[cfg(target_os = "fuchsia")]
140impl fidl::endpoints::FromClient for ConnectorSynchronousProxy {
141    type Protocol = ConnectorMarker;
142
143    fn from_client(value: fidl::endpoints::ClientEnd<ConnectorMarker>) -> Self {
144        Self::new(value.into_channel())
145    }
146}
147
148#[derive(Debug, Clone)]
149pub struct ConnectorProxy {
150    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
151}
152
153impl fidl::endpoints::Proxy for ConnectorProxy {
154    type Protocol = ConnectorMarker;
155
156    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
157        Self::new(inner)
158    }
159
160    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
161        self.client.into_channel().map_err(|client| Self { client })
162    }
163
164    fn as_channel(&self) -> &::fidl::AsyncChannel {
165        self.client.as_channel()
166    }
167}
168
169impl ConnectorProxy {
170    /// Create a new Proxy for fuchsia.device.fs/Connector.
171    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
172        let protocol_name = <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
173        Self { client: fidl::client::Client::new(channel, protocol_name) }
174    }
175
176    /// Get a Stream of events from the remote end of the protocol.
177    ///
178    /// # Panics
179    ///
180    /// Panics if the event stream was already taken.
181    pub fn take_event_stream(&self) -> ConnectorEventStream {
182        ConnectorEventStream { event_receiver: self.client.take_event_receiver() }
183    }
184
185    /// Forward a server end of a protocol so that it can be connected.
186    /// + request `server` the server end of the protocol to be served. The FIDL protocol that
187    ///     this speaks is determined out-of-band.
188    /// - response This function has no response. The function is one-way to match the pipelining
189    ///     behaviors of other virtual filesystems.
190    pub fn r#connect(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
191        ConnectorProxyInterface::r#connect(self, server)
192    }
193}
194
195impl ConnectorProxyInterface for ConnectorProxy {
196    fn r#connect(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
197        self.client.send::<ConnectorConnectRequest>(
198            (server,),
199            0x2bfd50a6209194f9,
200            fidl::encoding::DynamicFlags::empty(),
201        )
202    }
203}
204
205pub struct ConnectorEventStream {
206    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
207}
208
209impl std::marker::Unpin for ConnectorEventStream {}
210
211impl futures::stream::FusedStream for ConnectorEventStream {
212    fn is_terminated(&self) -> bool {
213        self.event_receiver.is_terminated()
214    }
215}
216
217impl futures::Stream for ConnectorEventStream {
218    type Item = Result<ConnectorEvent, fidl::Error>;
219
220    fn poll_next(
221        mut self: std::pin::Pin<&mut Self>,
222        cx: &mut std::task::Context<'_>,
223    ) -> std::task::Poll<Option<Self::Item>> {
224        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
225            &mut self.event_receiver,
226            cx
227        )?) {
228            Some(buf) => std::task::Poll::Ready(Some(ConnectorEvent::decode(buf))),
229            None => std::task::Poll::Ready(None),
230        }
231    }
232}
233
234#[derive(Debug)]
235pub enum ConnectorEvent {}
236
237impl ConnectorEvent {
238    /// Decodes a message buffer as a [`ConnectorEvent`].
239    fn decode(
240        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
241    ) -> Result<ConnectorEvent, fidl::Error> {
242        let (bytes, _handles) = buf.split_mut();
243        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
244        debug_assert_eq!(tx_header.tx_id, 0);
245        match tx_header.ordinal {
246            _ => Err(fidl::Error::UnknownOrdinal {
247                ordinal: tx_header.ordinal,
248                protocol_name: <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
249            }),
250        }
251    }
252}
253
254/// A Stream of incoming requests for fuchsia.device.fs/Connector.
255pub struct ConnectorRequestStream {
256    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
257    is_terminated: bool,
258}
259
260impl std::marker::Unpin for ConnectorRequestStream {}
261
262impl futures::stream::FusedStream for ConnectorRequestStream {
263    fn is_terminated(&self) -> bool {
264        self.is_terminated
265    }
266}
267
268impl fidl::endpoints::RequestStream for ConnectorRequestStream {
269    type Protocol = ConnectorMarker;
270    type ControlHandle = ConnectorControlHandle;
271
272    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
273        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
274    }
275
276    fn control_handle(&self) -> Self::ControlHandle {
277        ConnectorControlHandle { inner: self.inner.clone() }
278    }
279
280    fn into_inner(
281        self,
282    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
283    {
284        (self.inner, self.is_terminated)
285    }
286
287    fn from_inner(
288        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
289        is_terminated: bool,
290    ) -> Self {
291        Self { inner, is_terminated }
292    }
293}
294
295impl futures::Stream for ConnectorRequestStream {
296    type Item = Result<ConnectorRequest, fidl::Error>;
297
298    fn poll_next(
299        mut self: std::pin::Pin<&mut Self>,
300        cx: &mut std::task::Context<'_>,
301    ) -> std::task::Poll<Option<Self::Item>> {
302        let this = &mut *self;
303        if this.inner.check_shutdown(cx) {
304            this.is_terminated = true;
305            return std::task::Poll::Ready(None);
306        }
307        if this.is_terminated {
308            panic!("polled ConnectorRequestStream after completion");
309        }
310        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
311            |bytes, handles| {
312                match this.inner.channel().read_etc(cx, bytes, handles) {
313                    std::task::Poll::Ready(Ok(())) => {}
314                    std::task::Poll::Pending => return std::task::Poll::Pending,
315                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
316                        this.is_terminated = true;
317                        return std::task::Poll::Ready(None);
318                    }
319                    std::task::Poll::Ready(Err(e)) => {
320                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
321                            e.into(),
322                        ))))
323                    }
324                }
325
326                // A message has been received from the channel
327                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
328
329                std::task::Poll::Ready(Some(match header.ordinal {
330                    0x2bfd50a6209194f9 => {
331                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
332                        let mut req = fidl::new_empty!(
333                            ConnectorConnectRequest,
334                            fidl::encoding::DefaultFuchsiaResourceDialect
335                        );
336                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
337                        let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
338                        Ok(ConnectorRequest::Connect { server: req.server, control_handle })
339                    }
340                    _ => Err(fidl::Error::UnknownOrdinal {
341                        ordinal: header.ordinal,
342                        protocol_name:
343                            <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
344                    }),
345                }))
346            },
347        )
348    }
349}
350
351/// A connector lets a client forward the server end of a protocol.
352#[derive(Debug)]
353pub enum ConnectorRequest {
354    /// Forward a server end of a protocol so that it can be connected.
355    /// + request `server` the server end of the protocol to be served. The FIDL protocol that
356    ///     this speaks is determined out-of-band.
357    /// - response This function has no response. The function is one-way to match the pipelining
358    ///     behaviors of other virtual filesystems.
359    Connect { server: fidl::Channel, control_handle: ConnectorControlHandle },
360}
361
362impl ConnectorRequest {
363    #[allow(irrefutable_let_patterns)]
364    pub fn into_connect(self) -> Option<(fidl::Channel, ConnectorControlHandle)> {
365        if let ConnectorRequest::Connect { server, control_handle } = self {
366            Some((server, control_handle))
367        } else {
368            None
369        }
370    }
371
372    /// Name of the method defined in FIDL
373    pub fn method_name(&self) -> &'static str {
374        match *self {
375            ConnectorRequest::Connect { .. } => "connect",
376        }
377    }
378}
379
380#[derive(Debug, Clone)]
381pub struct ConnectorControlHandle {
382    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
383}
384
385impl fidl::endpoints::ControlHandle for ConnectorControlHandle {
386    fn shutdown(&self) {
387        self.inner.shutdown()
388    }
389    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
390        self.inner.shutdown_with_epitaph(status)
391    }
392
393    fn is_closed(&self) -> bool {
394        self.inner.channel().is_closed()
395    }
396    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
397        self.inner.channel().on_closed()
398    }
399
400    #[cfg(target_os = "fuchsia")]
401    fn signal_peer(
402        &self,
403        clear_mask: zx::Signals,
404        set_mask: zx::Signals,
405    ) -> Result<(), zx_status::Status> {
406        use fidl::Peered;
407        self.inner.channel().signal_peer(clear_mask, set_mask)
408    }
409}
410
411impl ConnectorControlHandle {}
412
413#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
414pub struct TopologicalPathMarker;
415
416impl fidl::endpoints::ProtocolMarker for TopologicalPathMarker {
417    type Proxy = TopologicalPathProxy;
418    type RequestStream = TopologicalPathRequestStream;
419    #[cfg(target_os = "fuchsia")]
420    type SynchronousProxy = TopologicalPathSynchronousProxy;
421
422    const DEBUG_NAME: &'static str = "(anonymous) TopologicalPath";
423}
424pub type TopologicalPathGetTopologicalPathResult = Result<String, i32>;
425
426pub trait TopologicalPathProxyInterface: Send + Sync {
427    type GetTopologicalPathResponseFut: std::future::Future<Output = Result<TopologicalPathGetTopologicalPathResult, fidl::Error>>
428        + Send;
429    fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut;
430}
431#[derive(Debug)]
432#[cfg(target_os = "fuchsia")]
433pub struct TopologicalPathSynchronousProxy {
434    client: fidl::client::sync::Client,
435}
436
437#[cfg(target_os = "fuchsia")]
438impl fidl::endpoints::SynchronousProxy for TopologicalPathSynchronousProxy {
439    type Proxy = TopologicalPathProxy;
440    type Protocol = TopologicalPathMarker;
441
442    fn from_channel(inner: fidl::Channel) -> Self {
443        Self::new(inner)
444    }
445
446    fn into_channel(self) -> fidl::Channel {
447        self.client.into_channel()
448    }
449
450    fn as_channel(&self) -> &fidl::Channel {
451        self.client.as_channel()
452    }
453}
454
455#[cfg(target_os = "fuchsia")]
456impl TopologicalPathSynchronousProxy {
457    pub fn new(channel: fidl::Channel) -> Self {
458        let protocol_name = <TopologicalPathMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
459        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
460    }
461
462    pub fn into_channel(self) -> fidl::Channel {
463        self.client.into_channel()
464    }
465
466    /// Waits until an event arrives and returns it. It is safe for other
467    /// threads to make concurrent requests while waiting for an event.
468    pub fn wait_for_event(
469        &self,
470        deadline: zx::MonotonicInstant,
471    ) -> Result<TopologicalPathEvent, fidl::Error> {
472        TopologicalPathEvent::decode(self.client.wait_for_event(deadline)?)
473    }
474
475    /// Return the topological path for this device
476    pub fn r#get_topological_path(
477        &self,
478        ___deadline: zx::MonotonicInstant,
479    ) -> Result<TopologicalPathGetTopologicalPathResult, fidl::Error> {
480        let _response =
481            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
482                TopologicalPathGetTopologicalPathResponse,
483                i32,
484            >>(
485                (),
486                0x56f6105571a973d8,
487                fidl::encoding::DynamicFlags::empty(),
488                ___deadline,
489            )?;
490        Ok(_response.map(|x| x.path))
491    }
492}
493
494#[cfg(target_os = "fuchsia")]
495impl From<TopologicalPathSynchronousProxy> for zx::Handle {
496    fn from(value: TopologicalPathSynchronousProxy) -> Self {
497        value.into_channel().into()
498    }
499}
500
501#[cfg(target_os = "fuchsia")]
502impl From<fidl::Channel> for TopologicalPathSynchronousProxy {
503    fn from(value: fidl::Channel) -> Self {
504        Self::new(value)
505    }
506}
507
508#[cfg(target_os = "fuchsia")]
509impl fidl::endpoints::FromClient for TopologicalPathSynchronousProxy {
510    type Protocol = TopologicalPathMarker;
511
512    fn from_client(value: fidl::endpoints::ClientEnd<TopologicalPathMarker>) -> Self {
513        Self::new(value.into_channel())
514    }
515}
516
517#[derive(Debug, Clone)]
518pub struct TopologicalPathProxy {
519    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
520}
521
522impl fidl::endpoints::Proxy for TopologicalPathProxy {
523    type Protocol = TopologicalPathMarker;
524
525    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
526        Self::new(inner)
527    }
528
529    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
530        self.client.into_channel().map_err(|client| Self { client })
531    }
532
533    fn as_channel(&self) -> &::fidl::AsyncChannel {
534        self.client.as_channel()
535    }
536}
537
538impl TopologicalPathProxy {
539    /// Create a new Proxy for fuchsia.device.fs/TopologicalPath.
540    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
541        let protocol_name = <TopologicalPathMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
542        Self { client: fidl::client::Client::new(channel, protocol_name) }
543    }
544
545    /// Get a Stream of events from the remote end of the protocol.
546    ///
547    /// # Panics
548    ///
549    /// Panics if the event stream was already taken.
550    pub fn take_event_stream(&self) -> TopologicalPathEventStream {
551        TopologicalPathEventStream { event_receiver: self.client.take_event_receiver() }
552    }
553
554    /// Return the topological path for this device
555    pub fn r#get_topological_path(
556        &self,
557    ) -> fidl::client::QueryResponseFut<
558        TopologicalPathGetTopologicalPathResult,
559        fidl::encoding::DefaultFuchsiaResourceDialect,
560    > {
561        TopologicalPathProxyInterface::r#get_topological_path(self)
562    }
563}
564
565impl TopologicalPathProxyInterface for TopologicalPathProxy {
566    type GetTopologicalPathResponseFut = fidl::client::QueryResponseFut<
567        TopologicalPathGetTopologicalPathResult,
568        fidl::encoding::DefaultFuchsiaResourceDialect,
569    >;
570    fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut {
571        fn _decode(
572            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
573        ) -> Result<TopologicalPathGetTopologicalPathResult, fidl::Error> {
574            let _response = fidl::client::decode_transaction_body::<
575                fidl::encoding::ResultType<TopologicalPathGetTopologicalPathResponse, i32>,
576                fidl::encoding::DefaultFuchsiaResourceDialect,
577                0x56f6105571a973d8,
578            >(_buf?)?;
579            Ok(_response.map(|x| x.path))
580        }
581        self.client.send_query_and_decode::<
582            fidl::encoding::EmptyPayload,
583            TopologicalPathGetTopologicalPathResult,
584        >(
585            (),
586            0x56f6105571a973d8,
587            fidl::encoding::DynamicFlags::empty(),
588            _decode,
589        )
590    }
591}
592
593pub struct TopologicalPathEventStream {
594    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
595}
596
597impl std::marker::Unpin for TopologicalPathEventStream {}
598
599impl futures::stream::FusedStream for TopologicalPathEventStream {
600    fn is_terminated(&self) -> bool {
601        self.event_receiver.is_terminated()
602    }
603}
604
605impl futures::Stream for TopologicalPathEventStream {
606    type Item = Result<TopologicalPathEvent, fidl::Error>;
607
608    fn poll_next(
609        mut self: std::pin::Pin<&mut Self>,
610        cx: &mut std::task::Context<'_>,
611    ) -> std::task::Poll<Option<Self::Item>> {
612        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
613            &mut self.event_receiver,
614            cx
615        )?) {
616            Some(buf) => std::task::Poll::Ready(Some(TopologicalPathEvent::decode(buf))),
617            None => std::task::Poll::Ready(None),
618        }
619    }
620}
621
622#[derive(Debug)]
623pub enum TopologicalPathEvent {}
624
625impl TopologicalPathEvent {
626    /// Decodes a message buffer as a [`TopologicalPathEvent`].
627    fn decode(
628        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
629    ) -> Result<TopologicalPathEvent, fidl::Error> {
630        let (bytes, _handles) = buf.split_mut();
631        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
632        debug_assert_eq!(tx_header.tx_id, 0);
633        match tx_header.ordinal {
634            _ => Err(fidl::Error::UnknownOrdinal {
635                ordinal: tx_header.ordinal,
636                protocol_name:
637                    <TopologicalPathMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
638            }),
639        }
640    }
641}
642
643/// A Stream of incoming requests for fuchsia.device.fs/TopologicalPath.
644pub struct TopologicalPathRequestStream {
645    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
646    is_terminated: bool,
647}
648
649impl std::marker::Unpin for TopologicalPathRequestStream {}
650
651impl futures::stream::FusedStream for TopologicalPathRequestStream {
652    fn is_terminated(&self) -> bool {
653        self.is_terminated
654    }
655}
656
657impl fidl::endpoints::RequestStream for TopologicalPathRequestStream {
658    type Protocol = TopologicalPathMarker;
659    type ControlHandle = TopologicalPathControlHandle;
660
661    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
662        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
663    }
664
665    fn control_handle(&self) -> Self::ControlHandle {
666        TopologicalPathControlHandle { inner: self.inner.clone() }
667    }
668
669    fn into_inner(
670        self,
671    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
672    {
673        (self.inner, self.is_terminated)
674    }
675
676    fn from_inner(
677        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
678        is_terminated: bool,
679    ) -> Self {
680        Self { inner, is_terminated }
681    }
682}
683
684impl futures::Stream for TopologicalPathRequestStream {
685    type Item = Result<TopologicalPathRequest, fidl::Error>;
686
687    fn poll_next(
688        mut self: std::pin::Pin<&mut Self>,
689        cx: &mut std::task::Context<'_>,
690    ) -> std::task::Poll<Option<Self::Item>> {
691        let this = &mut *self;
692        if this.inner.check_shutdown(cx) {
693            this.is_terminated = true;
694            return std::task::Poll::Ready(None);
695        }
696        if this.is_terminated {
697            panic!("polled TopologicalPathRequestStream after completion");
698        }
699        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
700            |bytes, handles| {
701                match this.inner.channel().read_etc(cx, bytes, handles) {
702                    std::task::Poll::Ready(Ok(())) => {}
703                    std::task::Poll::Pending => return std::task::Poll::Pending,
704                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
705                        this.is_terminated = true;
706                        return std::task::Poll::Ready(None);
707                    }
708                    std::task::Poll::Ready(Err(e)) => {
709                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
710                            e.into(),
711                        ))))
712                    }
713                }
714
715                // A message has been received from the channel
716                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
717
718                std::task::Poll::Ready(Some(match header.ordinal {
719                    0x56f6105571a973d8 => {
720                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
721                        let mut req = fidl::new_empty!(
722                            fidl::encoding::EmptyPayload,
723                            fidl::encoding::DefaultFuchsiaResourceDialect
724                        );
725                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
726                        let control_handle =
727                            TopologicalPathControlHandle { inner: this.inner.clone() };
728                        Ok(TopologicalPathRequest::GetTopologicalPath {
729                            responder: TopologicalPathGetTopologicalPathResponder {
730                                control_handle: std::mem::ManuallyDrop::new(control_handle),
731                                tx_id: header.tx_id,
732                            },
733                        })
734                    }
735                    _ => Err(fidl::Error::UnknownOrdinal {
736                        ordinal: header.ordinal,
737                        protocol_name:
738                            <TopologicalPathMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
739                    }),
740                }))
741            },
742        )
743    }
744}
745
746#[derive(Debug)]
747pub enum TopologicalPathRequest {
748    /// Return the topological path for this device
749    GetTopologicalPath { responder: TopologicalPathGetTopologicalPathResponder },
750}
751
752impl TopologicalPathRequest {
753    #[allow(irrefutable_let_patterns)]
754    pub fn into_get_topological_path(self) -> Option<(TopologicalPathGetTopologicalPathResponder)> {
755        if let TopologicalPathRequest::GetTopologicalPath { responder } = self {
756            Some((responder))
757        } else {
758            None
759        }
760    }
761
762    /// Name of the method defined in FIDL
763    pub fn method_name(&self) -> &'static str {
764        match *self {
765            TopologicalPathRequest::GetTopologicalPath { .. } => "get_topological_path",
766        }
767    }
768}
769
770#[derive(Debug, Clone)]
771pub struct TopologicalPathControlHandle {
772    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
773}
774
775impl fidl::endpoints::ControlHandle for TopologicalPathControlHandle {
776    fn shutdown(&self) {
777        self.inner.shutdown()
778    }
779    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
780        self.inner.shutdown_with_epitaph(status)
781    }
782
783    fn is_closed(&self) -> bool {
784        self.inner.channel().is_closed()
785    }
786    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
787        self.inner.channel().on_closed()
788    }
789
790    #[cfg(target_os = "fuchsia")]
791    fn signal_peer(
792        &self,
793        clear_mask: zx::Signals,
794        set_mask: zx::Signals,
795    ) -> Result<(), zx_status::Status> {
796        use fidl::Peered;
797        self.inner.channel().signal_peer(clear_mask, set_mask)
798    }
799}
800
801impl TopologicalPathControlHandle {}
802
803#[must_use = "FIDL methods require a response to be sent"]
804#[derive(Debug)]
805pub struct TopologicalPathGetTopologicalPathResponder {
806    control_handle: std::mem::ManuallyDrop<TopologicalPathControlHandle>,
807    tx_id: u32,
808}
809
810/// Set the the channel to be shutdown (see [`TopologicalPathControlHandle::shutdown`])
811/// if the responder is dropped without sending a response, so that the client
812/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
813impl std::ops::Drop for TopologicalPathGetTopologicalPathResponder {
814    fn drop(&mut self) {
815        self.control_handle.shutdown();
816        // Safety: drops once, never accessed again
817        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
818    }
819}
820
821impl fidl::endpoints::Responder for TopologicalPathGetTopologicalPathResponder {
822    type ControlHandle = TopologicalPathControlHandle;
823
824    fn control_handle(&self) -> &TopologicalPathControlHandle {
825        &self.control_handle
826    }
827
828    fn drop_without_shutdown(mut self) {
829        // Safety: drops once, never accessed again due to mem::forget
830        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
831        // Prevent Drop from running (which would shut down the channel)
832        std::mem::forget(self);
833    }
834}
835
836impl TopologicalPathGetTopologicalPathResponder {
837    /// Sends a response to the FIDL transaction.
838    ///
839    /// Sets the channel to shutdown if an error occurs.
840    pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
841        let _result = self.send_raw(result);
842        if _result.is_err() {
843            self.control_handle.shutdown();
844        }
845        self.drop_without_shutdown();
846        _result
847    }
848
849    /// Similar to "send" but does not shutdown the channel if an error occurs.
850    pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
851        let _result = self.send_raw(result);
852        self.drop_without_shutdown();
853        _result
854    }
855
856    fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
857        self.control_handle.inner.send::<fidl::encoding::ResultType<
858            TopologicalPathGetTopologicalPathResponse,
859            i32,
860        >>(
861            result.map(|path| (path,)),
862            self.tx_id,
863            0x56f6105571a973d8,
864            fidl::encoding::DynamicFlags::empty(),
865        )
866    }
867}
868
869mod internal {
870    use super::*;
871
872    impl fidl::encoding::ResourceTypeMarker for ConnectorConnectRequest {
873        type Borrowed<'a> = &'a mut Self;
874        fn take_or_borrow<'a>(
875            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
876        ) -> Self::Borrowed<'a> {
877            value
878        }
879    }
880
881    unsafe impl fidl::encoding::TypeMarker for ConnectorConnectRequest {
882        type Owned = Self;
883
884        #[inline(always)]
885        fn inline_align(_context: fidl::encoding::Context) -> usize {
886            4
887        }
888
889        #[inline(always)]
890        fn inline_size(_context: fidl::encoding::Context) -> usize {
891            4
892        }
893    }
894
895    unsafe impl
896        fidl::encoding::Encode<
897            ConnectorConnectRequest,
898            fidl::encoding::DefaultFuchsiaResourceDialect,
899        > for &mut ConnectorConnectRequest
900    {
901        #[inline]
902        unsafe fn encode(
903            self,
904            encoder: &mut fidl::encoding::Encoder<
905                '_,
906                fidl::encoding::DefaultFuchsiaResourceDialect,
907            >,
908            offset: usize,
909            _depth: fidl::encoding::Depth,
910        ) -> fidl::Result<()> {
911            encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
912            // Delegate to tuple encoding.
913            fidl::encoding::Encode::<
914                ConnectorConnectRequest,
915                fidl::encoding::DefaultFuchsiaResourceDialect,
916            >::encode(
917                (<fidl::encoding::HandleType<
918                    fidl::Channel,
919                    { fidl::ObjectType::CHANNEL.into_raw() },
920                    2147483648,
921                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
922                    &mut self.server
923                ),),
924                encoder,
925                offset,
926                _depth,
927            )
928        }
929    }
930    unsafe impl<
931            T0: fidl::encoding::Encode<
932                fidl::encoding::HandleType<
933                    fidl::Channel,
934                    { fidl::ObjectType::CHANNEL.into_raw() },
935                    2147483648,
936                >,
937                fidl::encoding::DefaultFuchsiaResourceDialect,
938            >,
939        >
940        fidl::encoding::Encode<
941            ConnectorConnectRequest,
942            fidl::encoding::DefaultFuchsiaResourceDialect,
943        > for (T0,)
944    {
945        #[inline]
946        unsafe fn encode(
947            self,
948            encoder: &mut fidl::encoding::Encoder<
949                '_,
950                fidl::encoding::DefaultFuchsiaResourceDialect,
951            >,
952            offset: usize,
953            depth: fidl::encoding::Depth,
954        ) -> fidl::Result<()> {
955            encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
956            // Zero out padding regions. There's no need to apply masks
957            // because the unmasked parts will be overwritten by fields.
958            // Write the fields.
959            self.0.encode(encoder, offset + 0, depth)?;
960            Ok(())
961        }
962    }
963
964    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
965        for ConnectorConnectRequest
966    {
967        #[inline(always)]
968        fn new_empty() -> Self {
969            Self {
970                server: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
971            }
972        }
973
974        #[inline]
975        unsafe fn decode(
976            &mut self,
977            decoder: &mut fidl::encoding::Decoder<
978                '_,
979                fidl::encoding::DefaultFuchsiaResourceDialect,
980            >,
981            offset: usize,
982            _depth: fidl::encoding::Depth,
983        ) -> fidl::Result<()> {
984            decoder.debug_check_bounds::<Self>(offset);
985            // Verify that padding bytes are zero.
986            fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server, decoder, offset + 0, _depth)?;
987            Ok(())
988        }
989    }
990
991    impl DevfsAddArgs {
992        #[inline(always)]
993        fn max_ordinal_present(&self) -> u64 {
994            if let Some(_) = self.controller_connector {
995                return 5;
996            }
997            if let Some(_) = self.connector_supports {
998                return 4;
999            }
1000            if let Some(_) = self.inspect {
1001                return 3;
1002            }
1003            if let Some(_) = self.class_name {
1004                return 2;
1005            }
1006            if let Some(_) = self.connector {
1007                return 1;
1008            }
1009            0
1010        }
1011    }
1012
1013    impl fidl::encoding::ResourceTypeMarker for DevfsAddArgs {
1014        type Borrowed<'a> = &'a mut Self;
1015        fn take_or_borrow<'a>(
1016            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1017        ) -> Self::Borrowed<'a> {
1018            value
1019        }
1020    }
1021
1022    unsafe impl fidl::encoding::TypeMarker for DevfsAddArgs {
1023        type Owned = Self;
1024
1025        #[inline(always)]
1026        fn inline_align(_context: fidl::encoding::Context) -> usize {
1027            8
1028        }
1029
1030        #[inline(always)]
1031        fn inline_size(_context: fidl::encoding::Context) -> usize {
1032            16
1033        }
1034    }
1035
1036    unsafe impl fidl::encoding::Encode<DevfsAddArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
1037        for &mut DevfsAddArgs
1038    {
1039        unsafe fn encode(
1040            self,
1041            encoder: &mut fidl::encoding::Encoder<
1042                '_,
1043                fidl::encoding::DefaultFuchsiaResourceDialect,
1044            >,
1045            offset: usize,
1046            mut depth: fidl::encoding::Depth,
1047        ) -> fidl::Result<()> {
1048            encoder.debug_check_bounds::<DevfsAddArgs>(offset);
1049            // Vector header
1050            let max_ordinal: u64 = self.max_ordinal_present();
1051            encoder.write_num(max_ordinal, offset);
1052            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1053            // Calling encoder.out_of_line_offset(0) is not allowed.
1054            if max_ordinal == 0 {
1055                return Ok(());
1056            }
1057            depth.increment()?;
1058            let envelope_size = 8;
1059            let bytes_len = max_ordinal as usize * envelope_size;
1060            #[allow(unused_variables)]
1061            let offset = encoder.out_of_line_offset(bytes_len);
1062            let mut _prev_end_offset: usize = 0;
1063            if 1 > max_ordinal {
1064                return Ok(());
1065            }
1066
1067            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1068            // are envelope_size bytes.
1069            let cur_offset: usize = (1 - 1) * envelope_size;
1070
1071            // Zero reserved fields.
1072            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1073
1074            // Safety:
1075            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1076            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1077            //   envelope_size bytes, there is always sufficient room.
1078            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1079            self.connector.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1080            encoder, offset + cur_offset, depth
1081        )?;
1082
1083            _prev_end_offset = cur_offset + envelope_size;
1084            if 2 > max_ordinal {
1085                return Ok(());
1086            }
1087
1088            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1089            // are envelope_size bytes.
1090            let cur_offset: usize = (2 - 1) * envelope_size;
1091
1092            // Zero reserved fields.
1093            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1094
1095            // Safety:
1096            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1097            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1098            //   envelope_size bytes, there is always sufficient room.
1099            fidl::encoding::encode_in_envelope_optional::<
1100                fidl::encoding::BoundedString<255>,
1101                fidl::encoding::DefaultFuchsiaResourceDialect,
1102            >(
1103                self.class_name.as_ref().map(
1104                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
1105                ),
1106                encoder,
1107                offset + cur_offset,
1108                depth,
1109            )?;
1110
1111            _prev_end_offset = cur_offset + envelope_size;
1112            if 3 > max_ordinal {
1113                return Ok(());
1114            }
1115
1116            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1117            // are envelope_size bytes.
1118            let cur_offset: usize = (3 - 1) * envelope_size;
1119
1120            // Zero reserved fields.
1121            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1122
1123            // Safety:
1124            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1125            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1126            //   envelope_size bytes, there is always sufficient room.
1127            fidl::encoding::encode_in_envelope_optional::<
1128                fidl::encoding::HandleType<
1129                    fidl::Vmo,
1130                    { fidl::ObjectType::VMO.into_raw() },
1131                    2147483648,
1132                >,
1133                fidl::encoding::DefaultFuchsiaResourceDialect,
1134            >(
1135                self.inspect.as_mut().map(
1136                    <fidl::encoding::HandleType<
1137                        fidl::Vmo,
1138                        { fidl::ObjectType::VMO.into_raw() },
1139                        2147483648,
1140                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1141                ),
1142                encoder,
1143                offset + cur_offset,
1144                depth,
1145            )?;
1146
1147            _prev_end_offset = cur_offset + envelope_size;
1148            if 4 > max_ordinal {
1149                return Ok(());
1150            }
1151
1152            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1153            // are envelope_size bytes.
1154            let cur_offset: usize = (4 - 1) * envelope_size;
1155
1156            // Zero reserved fields.
1157            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1158
1159            // Safety:
1160            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1161            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1162            //   envelope_size bytes, there is always sufficient room.
1163            fidl::encoding::encode_in_envelope_optional::<
1164                ConnectionType,
1165                fidl::encoding::DefaultFuchsiaResourceDialect,
1166            >(
1167                self.connector_supports
1168                    .as_ref()
1169                    .map(<ConnectionType as fidl::encoding::ValueTypeMarker>::borrow),
1170                encoder,
1171                offset + cur_offset,
1172                depth,
1173            )?;
1174
1175            _prev_end_offset = cur_offset + envelope_size;
1176            if 5 > max_ordinal {
1177                return Ok(());
1178            }
1179
1180            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1181            // are envelope_size bytes.
1182            let cur_offset: usize = (5 - 1) * envelope_size;
1183
1184            // Zero reserved fields.
1185            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1186
1187            // Safety:
1188            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1189            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1190            //   envelope_size bytes, there is always sufficient room.
1191            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1192            self.controller_connector.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1193            encoder, offset + cur_offset, depth
1194        )?;
1195
1196            _prev_end_offset = cur_offset + envelope_size;
1197
1198            Ok(())
1199        }
1200    }
1201
1202    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DevfsAddArgs {
1203        #[inline(always)]
1204        fn new_empty() -> Self {
1205            Self::default()
1206        }
1207
1208        unsafe fn decode(
1209            &mut self,
1210            decoder: &mut fidl::encoding::Decoder<
1211                '_,
1212                fidl::encoding::DefaultFuchsiaResourceDialect,
1213            >,
1214            offset: usize,
1215            mut depth: fidl::encoding::Depth,
1216        ) -> fidl::Result<()> {
1217            decoder.debug_check_bounds::<Self>(offset);
1218            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1219                None => return Err(fidl::Error::NotNullable),
1220                Some(len) => len,
1221            };
1222            // Calling decoder.out_of_line_offset(0) is not allowed.
1223            if len == 0 {
1224                return Ok(());
1225            };
1226            depth.increment()?;
1227            let envelope_size = 8;
1228            let bytes_len = len * envelope_size;
1229            let offset = decoder.out_of_line_offset(bytes_len)?;
1230            // Decode the envelope for each type.
1231            let mut _next_ordinal_to_read = 0;
1232            let mut next_offset = offset;
1233            let end_offset = offset + bytes_len;
1234            _next_ordinal_to_read += 1;
1235            if next_offset >= end_offset {
1236                return Ok(());
1237            }
1238
1239            // Decode unknown envelopes for gaps in ordinals.
1240            while _next_ordinal_to_read < 1 {
1241                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1242                _next_ordinal_to_read += 1;
1243                next_offset += envelope_size;
1244            }
1245
1246            let next_out_of_line = decoder.next_out_of_line();
1247            let handles_before = decoder.remaining_handles();
1248            if let Some((inlined, num_bytes, num_handles)) =
1249                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1250            {
1251                let member_inline_size = <fidl::encoding::Endpoint<
1252                    fidl::endpoints::ClientEnd<ConnectorMarker>,
1253                > as fidl::encoding::TypeMarker>::inline_size(
1254                    decoder.context
1255                );
1256                if inlined != (member_inline_size <= 4) {
1257                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1258                }
1259                let inner_offset;
1260                let mut inner_depth = depth.clone();
1261                if inlined {
1262                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1263                    inner_offset = next_offset;
1264                } else {
1265                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1266                    inner_depth.increment()?;
1267                }
1268                let val_ref = self.connector.get_or_insert_with(|| {
1269                    fidl::new_empty!(
1270                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>>,
1271                        fidl::encoding::DefaultFuchsiaResourceDialect
1272                    )
1273                });
1274                fidl::decode!(
1275                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>>,
1276                    fidl::encoding::DefaultFuchsiaResourceDialect,
1277                    val_ref,
1278                    decoder,
1279                    inner_offset,
1280                    inner_depth
1281                )?;
1282                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1283                {
1284                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1285                }
1286                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1287                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1288                }
1289            }
1290
1291            next_offset += envelope_size;
1292            _next_ordinal_to_read += 1;
1293            if next_offset >= end_offset {
1294                return Ok(());
1295            }
1296
1297            // Decode unknown envelopes for gaps in ordinals.
1298            while _next_ordinal_to_read < 2 {
1299                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1300                _next_ordinal_to_read += 1;
1301                next_offset += envelope_size;
1302            }
1303
1304            let next_out_of_line = decoder.next_out_of_line();
1305            let handles_before = decoder.remaining_handles();
1306            if let Some((inlined, num_bytes, num_handles)) =
1307                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1308            {
1309                let member_inline_size =
1310                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
1311                        decoder.context,
1312                    );
1313                if inlined != (member_inline_size <= 4) {
1314                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1315                }
1316                let inner_offset;
1317                let mut inner_depth = depth.clone();
1318                if inlined {
1319                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1320                    inner_offset = next_offset;
1321                } else {
1322                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1323                    inner_depth.increment()?;
1324                }
1325                let val_ref = self.class_name.get_or_insert_with(|| {
1326                    fidl::new_empty!(
1327                        fidl::encoding::BoundedString<255>,
1328                        fidl::encoding::DefaultFuchsiaResourceDialect
1329                    )
1330                });
1331                fidl::decode!(
1332                    fidl::encoding::BoundedString<255>,
1333                    fidl::encoding::DefaultFuchsiaResourceDialect,
1334                    val_ref,
1335                    decoder,
1336                    inner_offset,
1337                    inner_depth
1338                )?;
1339                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1340                {
1341                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1342                }
1343                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1344                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1345                }
1346            }
1347
1348            next_offset += envelope_size;
1349            _next_ordinal_to_read += 1;
1350            if next_offset >= end_offset {
1351                return Ok(());
1352            }
1353
1354            // Decode unknown envelopes for gaps in ordinals.
1355            while _next_ordinal_to_read < 3 {
1356                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1357                _next_ordinal_to_read += 1;
1358                next_offset += envelope_size;
1359            }
1360
1361            let next_out_of_line = decoder.next_out_of_line();
1362            let handles_before = decoder.remaining_handles();
1363            if let Some((inlined, num_bytes, num_handles)) =
1364                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1365            {
1366                let member_inline_size = <fidl::encoding::HandleType<
1367                    fidl::Vmo,
1368                    { fidl::ObjectType::VMO.into_raw() },
1369                    2147483648,
1370                > as fidl::encoding::TypeMarker>::inline_size(
1371                    decoder.context
1372                );
1373                if inlined != (member_inline_size <= 4) {
1374                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1375                }
1376                let inner_offset;
1377                let mut inner_depth = depth.clone();
1378                if inlined {
1379                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1380                    inner_offset = next_offset;
1381                } else {
1382                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1383                    inner_depth.increment()?;
1384                }
1385                let val_ref =
1386                self.inspect.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1387                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1388                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1389                {
1390                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1391                }
1392                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1393                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1394                }
1395            }
1396
1397            next_offset += envelope_size;
1398            _next_ordinal_to_read += 1;
1399            if next_offset >= end_offset {
1400                return Ok(());
1401            }
1402
1403            // Decode unknown envelopes for gaps in ordinals.
1404            while _next_ordinal_to_read < 4 {
1405                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1406                _next_ordinal_to_read += 1;
1407                next_offset += envelope_size;
1408            }
1409
1410            let next_out_of_line = decoder.next_out_of_line();
1411            let handles_before = decoder.remaining_handles();
1412            if let Some((inlined, num_bytes, num_handles)) =
1413                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1414            {
1415                let member_inline_size =
1416                    <ConnectionType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1417                if inlined != (member_inline_size <= 4) {
1418                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1419                }
1420                let inner_offset;
1421                let mut inner_depth = depth.clone();
1422                if inlined {
1423                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1424                    inner_offset = next_offset;
1425                } else {
1426                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1427                    inner_depth.increment()?;
1428                }
1429                let val_ref = self.connector_supports.get_or_insert_with(|| {
1430                    fidl::new_empty!(ConnectionType, fidl::encoding::DefaultFuchsiaResourceDialect)
1431                });
1432                fidl::decode!(
1433                    ConnectionType,
1434                    fidl::encoding::DefaultFuchsiaResourceDialect,
1435                    val_ref,
1436                    decoder,
1437                    inner_offset,
1438                    inner_depth
1439                )?;
1440                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1441                {
1442                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1443                }
1444                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1445                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1446                }
1447            }
1448
1449            next_offset += envelope_size;
1450            _next_ordinal_to_read += 1;
1451            if next_offset >= end_offset {
1452                return Ok(());
1453            }
1454
1455            // Decode unknown envelopes for gaps in ordinals.
1456            while _next_ordinal_to_read < 5 {
1457                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1458                _next_ordinal_to_read += 1;
1459                next_offset += envelope_size;
1460            }
1461
1462            let next_out_of_line = decoder.next_out_of_line();
1463            let handles_before = decoder.remaining_handles();
1464            if let Some((inlined, num_bytes, num_handles)) =
1465                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1466            {
1467                let member_inline_size = <fidl::encoding::Endpoint<
1468                    fidl::endpoints::ClientEnd<ConnectorMarker>,
1469                > as fidl::encoding::TypeMarker>::inline_size(
1470                    decoder.context
1471                );
1472                if inlined != (member_inline_size <= 4) {
1473                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1474                }
1475                let inner_offset;
1476                let mut inner_depth = depth.clone();
1477                if inlined {
1478                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1479                    inner_offset = next_offset;
1480                } else {
1481                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1482                    inner_depth.increment()?;
1483                }
1484                let val_ref = self.controller_connector.get_or_insert_with(|| {
1485                    fidl::new_empty!(
1486                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>>,
1487                        fidl::encoding::DefaultFuchsiaResourceDialect
1488                    )
1489                });
1490                fidl::decode!(
1491                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>>,
1492                    fidl::encoding::DefaultFuchsiaResourceDialect,
1493                    val_ref,
1494                    decoder,
1495                    inner_offset,
1496                    inner_depth
1497                )?;
1498                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1499                {
1500                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1501                }
1502                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1503                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1504                }
1505            }
1506
1507            next_offset += envelope_size;
1508
1509            // Decode the remaining unknown envelopes.
1510            while next_offset < end_offset {
1511                _next_ordinal_to_read += 1;
1512                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1513                next_offset += envelope_size;
1514            }
1515
1516            Ok(())
1517        }
1518    }
1519}