Skip to main content

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