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