fidl_fuchsia_device_fs/
fidl_fuchsia_device_fs.rs

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