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