fidl_fuchsia_device_fs/
fidl_fuchsia_device_fs.rs

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