fidl_fuchsia_device/
fidl_fuchsia_device.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_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ControllerConnectToControllerRequest {
16    pub server: fidl::endpoints::ServerEnd<ControllerMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for ControllerConnectToControllerRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct ControllerConnectToDeviceFidlRequest {
26    pub server: fidl::Channel,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for ControllerConnectToDeviceFidlRequest
31{
32}
33
34#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
35pub struct ControllerMarker;
36
37impl fidl::endpoints::ProtocolMarker for ControllerMarker {
38    type Proxy = ControllerProxy;
39    type RequestStream = ControllerRequestStream;
40    #[cfg(target_os = "fuchsia")]
41    type SynchronousProxy = ControllerSynchronousProxy;
42
43    const DEBUG_NAME: &'static str = "(anonymous) Controller";
44}
45pub type ControllerBindResult = Result<(), i32>;
46pub type ControllerRebindResult = Result<(), i32>;
47pub type ControllerUnbindChildrenResult = Result<(), i32>;
48pub type ControllerScheduleUnbindResult = Result<(), i32>;
49pub type ControllerGetTopologicalPathResult = Result<String, i32>;
50
51pub trait ControllerProxyInterface: Send + Sync {
52    fn r#connect_to_device_fidl(&self, server: fidl::Channel) -> Result<(), fidl::Error>;
53    fn r#connect_to_controller(
54        &self,
55        server: fidl::endpoints::ServerEnd<ControllerMarker>,
56    ) -> Result<(), fidl::Error>;
57    type BindResponseFut: std::future::Future<Output = Result<ControllerBindResult, fidl::Error>>
58        + Send;
59    fn r#bind(&self, driver: &str) -> Self::BindResponseFut;
60    type RebindResponseFut: std::future::Future<Output = Result<ControllerRebindResult, fidl::Error>>
61        + Send;
62    fn r#rebind(&self, driver: &str) -> Self::RebindResponseFut;
63    type UnbindChildrenResponseFut: std::future::Future<Output = Result<ControllerUnbindChildrenResult, fidl::Error>>
64        + Send;
65    fn r#unbind_children(&self) -> Self::UnbindChildrenResponseFut;
66    type ScheduleUnbindResponseFut: std::future::Future<Output = Result<ControllerScheduleUnbindResult, fidl::Error>>
67        + Send;
68    fn r#schedule_unbind(&self) -> Self::ScheduleUnbindResponseFut;
69    type GetTopologicalPathResponseFut: std::future::Future<Output = Result<ControllerGetTopologicalPathResult, fidl::Error>>
70        + Send;
71    fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut;
72}
73#[derive(Debug)]
74#[cfg(target_os = "fuchsia")]
75pub struct ControllerSynchronousProxy {
76    client: fidl::client::sync::Client,
77}
78
79#[cfg(target_os = "fuchsia")]
80impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
81    type Proxy = ControllerProxy;
82    type Protocol = ControllerMarker;
83
84    fn from_channel(inner: fidl::Channel) -> Self {
85        Self::new(inner)
86    }
87
88    fn into_channel(self) -> fidl::Channel {
89        self.client.into_channel()
90    }
91
92    fn as_channel(&self) -> &fidl::Channel {
93        self.client.as_channel()
94    }
95}
96
97#[cfg(target_os = "fuchsia")]
98impl ControllerSynchronousProxy {
99    pub fn new(channel: fidl::Channel) -> Self {
100        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
101        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
102    }
103
104    pub fn into_channel(self) -> fidl::Channel {
105        self.client.into_channel()
106    }
107
108    /// Waits until an event arrives and returns it. It is safe for other
109    /// threads to make concurrent requests while waiting for an event.
110    pub fn wait_for_event(
111        &self,
112        deadline: zx::MonotonicInstant,
113    ) -> Result<ControllerEvent, fidl::Error> {
114        ControllerEvent::decode(self.client.wait_for_event(deadline)?)
115    }
116
117    /// Connect to the underlying device's FIDL protocol.
118    /// This connection will not be multiplexed with fuchsia.device.Controller
119    /// or fuchsia.io.Node.
120    pub fn r#connect_to_device_fidl(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
121        self.client.send::<ControllerConnectToDeviceFidlRequest>(
122            (server,),
123            0x793c584be7211f0d,
124            fidl::encoding::DynamicFlags::empty(),
125        )
126    }
127
128    /// Connect to the same Controller FIDL protocol.
129    pub fn r#connect_to_controller(
130        &self,
131        mut server: fidl::endpoints::ServerEnd<ControllerMarker>,
132    ) -> Result<(), fidl::Error> {
133        self.client.send::<ControllerConnectToControllerRequest>(
134            (server,),
135            0x66774decb0c7a0d0,
136            fidl::encoding::DynamicFlags::empty(),
137        )
138    }
139
140    /// Attempt to bind a driver to this device.
141    /// + request `driver` This represents the suffix of a driver URL (e.g: "fvm.cm").
142    ///            If this is non-empty, then the only drivers that will try to bind
143    ///            are ones that match this url suffix.
144    pub fn r#bind(
145        &self,
146        mut driver: &str,
147        ___deadline: zx::MonotonicInstant,
148    ) -> Result<ControllerBindResult, fidl::Error> {
149        let _response = self.client.send_query::<
150            ControllerBindRequest,
151            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
152        >(
153            (driver,),
154            0x3388f12801462769,
155            fidl::encoding::DynamicFlags::empty(),
156            ___deadline,
157        )?;
158        Ok(_response.map(|x| x))
159    }
160
161    /// Unbind all the children of this device, and then attempt to bind a driver to the device.
162    /// This will not return until the bind completes.
163    /// + request `driver` This represents the suffix of a driver URL (e.g: "fvm.cm").
164    ///            If this is non-empty, then the only drivers that will try to bind
165    ///            are ones that match this url suffix.
166    pub fn r#rebind(
167        &self,
168        mut driver: &str,
169        ___deadline: zx::MonotonicInstant,
170    ) -> Result<ControllerRebindResult, fidl::Error> {
171        let _response = self.client.send_query::<
172            ControllerRebindRequest,
173            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
174        >(
175            (driver,),
176            0x384fb80cbc2782e2,
177            fidl::encoding::DynamicFlags::empty(),
178            ___deadline,
179        )?;
180        Ok(_response.map(|x| x))
181    }
182
183    /// This api will unbind all the children of this device synchronously.
184    /// This will avoid watching for device removal by the clients.
185    pub fn r#unbind_children(
186        &self,
187        ___deadline: zx::MonotonicInstant,
188    ) -> Result<ControllerUnbindChildrenResult, fidl::Error> {
189        let _response = self.client.send_query::<
190            fidl::encoding::EmptyPayload,
191            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
192        >(
193            (),
194            0x31fae8d74db7a426,
195            fidl::encoding::DynamicFlags::empty(),
196            ___deadline,
197        )?;
198        Ok(_response.map(|x| x))
199    }
200
201    /// Disconnect this device and allow its parent to be bound again.
202    /// This may not complete before it returns.
203    pub fn r#schedule_unbind(
204        &self,
205        ___deadline: zx::MonotonicInstant,
206    ) -> Result<ControllerScheduleUnbindResult, fidl::Error> {
207        let _response = self.client.send_query::<
208            fidl::encoding::EmptyPayload,
209            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
210        >(
211            (),
212            0x6128ba9d76aff9c,
213            fidl::encoding::DynamicFlags::empty(),
214            ___deadline,
215        )?;
216        Ok(_response.map(|x| x))
217    }
218
219    /// Return the topological path for this device
220    pub fn r#get_topological_path(
221        &self,
222        ___deadline: zx::MonotonicInstant,
223    ) -> Result<ControllerGetTopologicalPathResult, fidl::Error> {
224        let _response = self.client.send_query::<
225            fidl::encoding::EmptyPayload,
226            fidl::encoding::ResultType<ControllerGetTopologicalPathResponse, i32>,
227        >(
228            (),
229            0x2689b37663e00788,
230            fidl::encoding::DynamicFlags::empty(),
231            ___deadline,
232        )?;
233        Ok(_response.map(|x| x.path))
234    }
235}
236
237#[derive(Debug, Clone)]
238pub struct ControllerProxy {
239    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
240}
241
242impl fidl::endpoints::Proxy for ControllerProxy {
243    type Protocol = ControllerMarker;
244
245    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
246        Self::new(inner)
247    }
248
249    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
250        self.client.into_channel().map_err(|client| Self { client })
251    }
252
253    fn as_channel(&self) -> &::fidl::AsyncChannel {
254        self.client.as_channel()
255    }
256}
257
258impl ControllerProxy {
259    /// Create a new Proxy for fuchsia.device/Controller.
260    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
261        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
262        Self { client: fidl::client::Client::new(channel, protocol_name) }
263    }
264
265    /// Get a Stream of events from the remote end of the protocol.
266    ///
267    /// # Panics
268    ///
269    /// Panics if the event stream was already taken.
270    pub fn take_event_stream(&self) -> ControllerEventStream {
271        ControllerEventStream { event_receiver: self.client.take_event_receiver() }
272    }
273
274    /// Connect to the underlying device's FIDL protocol.
275    /// This connection will not be multiplexed with fuchsia.device.Controller
276    /// or fuchsia.io.Node.
277    pub fn r#connect_to_device_fidl(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
278        ControllerProxyInterface::r#connect_to_device_fidl(self, server)
279    }
280
281    /// Connect to the same Controller FIDL protocol.
282    pub fn r#connect_to_controller(
283        &self,
284        mut server: fidl::endpoints::ServerEnd<ControllerMarker>,
285    ) -> Result<(), fidl::Error> {
286        ControllerProxyInterface::r#connect_to_controller(self, server)
287    }
288
289    /// Attempt to bind a driver to this device.
290    /// + request `driver` This represents the suffix of a driver URL (e.g: "fvm.cm").
291    ///            If this is non-empty, then the only drivers that will try to bind
292    ///            are ones that match this url suffix.
293    pub fn r#bind(
294        &self,
295        mut driver: &str,
296    ) -> fidl::client::QueryResponseFut<
297        ControllerBindResult,
298        fidl::encoding::DefaultFuchsiaResourceDialect,
299    > {
300        ControllerProxyInterface::r#bind(self, driver)
301    }
302
303    /// Unbind all the children of this device, and then attempt to bind a driver to the device.
304    /// This will not return until the bind completes.
305    /// + request `driver` This represents the suffix of a driver URL (e.g: "fvm.cm").
306    ///            If this is non-empty, then the only drivers that will try to bind
307    ///            are ones that match this url suffix.
308    pub fn r#rebind(
309        &self,
310        mut driver: &str,
311    ) -> fidl::client::QueryResponseFut<
312        ControllerRebindResult,
313        fidl::encoding::DefaultFuchsiaResourceDialect,
314    > {
315        ControllerProxyInterface::r#rebind(self, driver)
316    }
317
318    /// This api will unbind all the children of this device synchronously.
319    /// This will avoid watching for device removal by the clients.
320    pub fn r#unbind_children(
321        &self,
322    ) -> fidl::client::QueryResponseFut<
323        ControllerUnbindChildrenResult,
324        fidl::encoding::DefaultFuchsiaResourceDialect,
325    > {
326        ControllerProxyInterface::r#unbind_children(self)
327    }
328
329    /// Disconnect this device and allow its parent to be bound again.
330    /// This may not complete before it returns.
331    pub fn r#schedule_unbind(
332        &self,
333    ) -> fidl::client::QueryResponseFut<
334        ControllerScheduleUnbindResult,
335        fidl::encoding::DefaultFuchsiaResourceDialect,
336    > {
337        ControllerProxyInterface::r#schedule_unbind(self)
338    }
339
340    /// Return the topological path for this device
341    pub fn r#get_topological_path(
342        &self,
343    ) -> fidl::client::QueryResponseFut<
344        ControllerGetTopologicalPathResult,
345        fidl::encoding::DefaultFuchsiaResourceDialect,
346    > {
347        ControllerProxyInterface::r#get_topological_path(self)
348    }
349}
350
351impl ControllerProxyInterface for ControllerProxy {
352    fn r#connect_to_device_fidl(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
353        self.client.send::<ControllerConnectToDeviceFidlRequest>(
354            (server,),
355            0x793c584be7211f0d,
356            fidl::encoding::DynamicFlags::empty(),
357        )
358    }
359
360    fn r#connect_to_controller(
361        &self,
362        mut server: fidl::endpoints::ServerEnd<ControllerMarker>,
363    ) -> Result<(), fidl::Error> {
364        self.client.send::<ControllerConnectToControllerRequest>(
365            (server,),
366            0x66774decb0c7a0d0,
367            fidl::encoding::DynamicFlags::empty(),
368        )
369    }
370
371    type BindResponseFut = fidl::client::QueryResponseFut<
372        ControllerBindResult,
373        fidl::encoding::DefaultFuchsiaResourceDialect,
374    >;
375    fn r#bind(&self, mut driver: &str) -> Self::BindResponseFut {
376        fn _decode(
377            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
378        ) -> Result<ControllerBindResult, fidl::Error> {
379            let _response = fidl::client::decode_transaction_body::<
380                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
381                fidl::encoding::DefaultFuchsiaResourceDialect,
382                0x3388f12801462769,
383            >(_buf?)?;
384            Ok(_response.map(|x| x))
385        }
386        self.client.send_query_and_decode::<ControllerBindRequest, ControllerBindResult>(
387            (driver,),
388            0x3388f12801462769,
389            fidl::encoding::DynamicFlags::empty(),
390            _decode,
391        )
392    }
393
394    type RebindResponseFut = fidl::client::QueryResponseFut<
395        ControllerRebindResult,
396        fidl::encoding::DefaultFuchsiaResourceDialect,
397    >;
398    fn r#rebind(&self, mut driver: &str) -> Self::RebindResponseFut {
399        fn _decode(
400            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
401        ) -> Result<ControllerRebindResult, fidl::Error> {
402            let _response = fidl::client::decode_transaction_body::<
403                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
404                fidl::encoding::DefaultFuchsiaResourceDialect,
405                0x384fb80cbc2782e2,
406            >(_buf?)?;
407            Ok(_response.map(|x| x))
408        }
409        self.client.send_query_and_decode::<ControllerRebindRequest, ControllerRebindResult>(
410            (driver,),
411            0x384fb80cbc2782e2,
412            fidl::encoding::DynamicFlags::empty(),
413            _decode,
414        )
415    }
416
417    type UnbindChildrenResponseFut = fidl::client::QueryResponseFut<
418        ControllerUnbindChildrenResult,
419        fidl::encoding::DefaultFuchsiaResourceDialect,
420    >;
421    fn r#unbind_children(&self) -> Self::UnbindChildrenResponseFut {
422        fn _decode(
423            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
424        ) -> Result<ControllerUnbindChildrenResult, fidl::Error> {
425            let _response = fidl::client::decode_transaction_body::<
426                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
427                fidl::encoding::DefaultFuchsiaResourceDialect,
428                0x31fae8d74db7a426,
429            >(_buf?)?;
430            Ok(_response.map(|x| x))
431        }
432        self.client
433            .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerUnbindChildrenResult>(
434                (),
435                0x31fae8d74db7a426,
436                fidl::encoding::DynamicFlags::empty(),
437                _decode,
438            )
439    }
440
441    type ScheduleUnbindResponseFut = fidl::client::QueryResponseFut<
442        ControllerScheduleUnbindResult,
443        fidl::encoding::DefaultFuchsiaResourceDialect,
444    >;
445    fn r#schedule_unbind(&self) -> Self::ScheduleUnbindResponseFut {
446        fn _decode(
447            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
448        ) -> Result<ControllerScheduleUnbindResult, fidl::Error> {
449            let _response = fidl::client::decode_transaction_body::<
450                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
451                fidl::encoding::DefaultFuchsiaResourceDialect,
452                0x6128ba9d76aff9c,
453            >(_buf?)?;
454            Ok(_response.map(|x| x))
455        }
456        self.client
457            .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerScheduleUnbindResult>(
458                (),
459                0x6128ba9d76aff9c,
460                fidl::encoding::DynamicFlags::empty(),
461                _decode,
462            )
463    }
464
465    type GetTopologicalPathResponseFut = fidl::client::QueryResponseFut<
466        ControllerGetTopologicalPathResult,
467        fidl::encoding::DefaultFuchsiaResourceDialect,
468    >;
469    fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut {
470        fn _decode(
471            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
472        ) -> Result<ControllerGetTopologicalPathResult, fidl::Error> {
473            let _response = fidl::client::decode_transaction_body::<
474                fidl::encoding::ResultType<ControllerGetTopologicalPathResponse, i32>,
475                fidl::encoding::DefaultFuchsiaResourceDialect,
476                0x2689b37663e00788,
477            >(_buf?)?;
478            Ok(_response.map(|x| x.path))
479        }
480        self.client.send_query_and_decode::<
481            fidl::encoding::EmptyPayload,
482            ControllerGetTopologicalPathResult,
483        >(
484            (),
485            0x2689b37663e00788,
486            fidl::encoding::DynamicFlags::empty(),
487            _decode,
488        )
489    }
490}
491
492pub struct ControllerEventStream {
493    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
494}
495
496impl std::marker::Unpin for ControllerEventStream {}
497
498impl futures::stream::FusedStream for ControllerEventStream {
499    fn is_terminated(&self) -> bool {
500        self.event_receiver.is_terminated()
501    }
502}
503
504impl futures::Stream for ControllerEventStream {
505    type Item = Result<ControllerEvent, fidl::Error>;
506
507    fn poll_next(
508        mut self: std::pin::Pin<&mut Self>,
509        cx: &mut std::task::Context<'_>,
510    ) -> std::task::Poll<Option<Self::Item>> {
511        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
512            &mut self.event_receiver,
513            cx
514        )?) {
515            Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
516            None => std::task::Poll::Ready(None),
517        }
518    }
519}
520
521#[derive(Debug)]
522pub enum ControllerEvent {}
523
524impl ControllerEvent {
525    /// Decodes a message buffer as a [`ControllerEvent`].
526    fn decode(
527        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
528    ) -> Result<ControllerEvent, fidl::Error> {
529        let (bytes, _handles) = buf.split_mut();
530        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
531        debug_assert_eq!(tx_header.tx_id, 0);
532        match tx_header.ordinal {
533            _ => Err(fidl::Error::UnknownOrdinal {
534                ordinal: tx_header.ordinal,
535                protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
536            }),
537        }
538    }
539}
540
541/// A Stream of incoming requests for fuchsia.device/Controller.
542pub struct ControllerRequestStream {
543    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
544    is_terminated: bool,
545}
546
547impl std::marker::Unpin for ControllerRequestStream {}
548
549impl futures::stream::FusedStream for ControllerRequestStream {
550    fn is_terminated(&self) -> bool {
551        self.is_terminated
552    }
553}
554
555impl fidl::endpoints::RequestStream for ControllerRequestStream {
556    type Protocol = ControllerMarker;
557    type ControlHandle = ControllerControlHandle;
558
559    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
560        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
561    }
562
563    fn control_handle(&self) -> Self::ControlHandle {
564        ControllerControlHandle { inner: self.inner.clone() }
565    }
566
567    fn into_inner(
568        self,
569    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
570    {
571        (self.inner, self.is_terminated)
572    }
573
574    fn from_inner(
575        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
576        is_terminated: bool,
577    ) -> Self {
578        Self { inner, is_terminated }
579    }
580}
581
582impl futures::Stream for ControllerRequestStream {
583    type Item = Result<ControllerRequest, fidl::Error>;
584
585    fn poll_next(
586        mut self: std::pin::Pin<&mut Self>,
587        cx: &mut std::task::Context<'_>,
588    ) -> std::task::Poll<Option<Self::Item>> {
589        let this = &mut *self;
590        if this.inner.check_shutdown(cx) {
591            this.is_terminated = true;
592            return std::task::Poll::Ready(None);
593        }
594        if this.is_terminated {
595            panic!("polled ControllerRequestStream after completion");
596        }
597        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
598            |bytes, handles| {
599                match this.inner.channel().read_etc(cx, bytes, handles) {
600                    std::task::Poll::Ready(Ok(())) => {}
601                    std::task::Poll::Pending => return std::task::Poll::Pending,
602                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
603                        this.is_terminated = true;
604                        return std::task::Poll::Ready(None);
605                    }
606                    std::task::Poll::Ready(Err(e)) => {
607                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
608                            e.into(),
609                        ))))
610                    }
611                }
612
613                // A message has been received from the channel
614                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
615
616                std::task::Poll::Ready(Some(match header.ordinal {
617                    0x793c584be7211f0d => {
618                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
619                        let mut req = fidl::new_empty!(
620                            ControllerConnectToDeviceFidlRequest,
621                            fidl::encoding::DefaultFuchsiaResourceDialect
622                        );
623                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerConnectToDeviceFidlRequest>(&header, _body_bytes, handles, &mut req)?;
624                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
625                        Ok(ControllerRequest::ConnectToDeviceFidl {
626                            server: req.server,
627
628                            control_handle,
629                        })
630                    }
631                    0x66774decb0c7a0d0 => {
632                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
633                        let mut req = fidl::new_empty!(
634                            ControllerConnectToControllerRequest,
635                            fidl::encoding::DefaultFuchsiaResourceDialect
636                        );
637                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerConnectToControllerRequest>(&header, _body_bytes, handles, &mut req)?;
638                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
639                        Ok(ControllerRequest::ConnectToController {
640                            server: req.server,
641
642                            control_handle,
643                        })
644                    }
645                    0x3388f12801462769 => {
646                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
647                        let mut req = fidl::new_empty!(
648                            ControllerBindRequest,
649                            fidl::encoding::DefaultFuchsiaResourceDialect
650                        );
651                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerBindRequest>(&header, _body_bytes, handles, &mut req)?;
652                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
653                        Ok(ControllerRequest::Bind {
654                            driver: req.driver,
655
656                            responder: ControllerBindResponder {
657                                control_handle: std::mem::ManuallyDrop::new(control_handle),
658                                tx_id: header.tx_id,
659                            },
660                        })
661                    }
662                    0x384fb80cbc2782e2 => {
663                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
664                        let mut req = fidl::new_empty!(
665                            ControllerRebindRequest,
666                            fidl::encoding::DefaultFuchsiaResourceDialect
667                        );
668                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerRebindRequest>(&header, _body_bytes, handles, &mut req)?;
669                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
670                        Ok(ControllerRequest::Rebind {
671                            driver: req.driver,
672
673                            responder: ControllerRebindResponder {
674                                control_handle: std::mem::ManuallyDrop::new(control_handle),
675                                tx_id: header.tx_id,
676                            },
677                        })
678                    }
679                    0x31fae8d74db7a426 => {
680                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
681                        let mut req = fidl::new_empty!(
682                            fidl::encoding::EmptyPayload,
683                            fidl::encoding::DefaultFuchsiaResourceDialect
684                        );
685                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
686                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
687                        Ok(ControllerRequest::UnbindChildren {
688                            responder: ControllerUnbindChildrenResponder {
689                                control_handle: std::mem::ManuallyDrop::new(control_handle),
690                                tx_id: header.tx_id,
691                            },
692                        })
693                    }
694                    0x6128ba9d76aff9c => {
695                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
696                        let mut req = fidl::new_empty!(
697                            fidl::encoding::EmptyPayload,
698                            fidl::encoding::DefaultFuchsiaResourceDialect
699                        );
700                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
701                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
702                        Ok(ControllerRequest::ScheduleUnbind {
703                            responder: ControllerScheduleUnbindResponder {
704                                control_handle: std::mem::ManuallyDrop::new(control_handle),
705                                tx_id: header.tx_id,
706                            },
707                        })
708                    }
709                    0x2689b37663e00788 => {
710                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
711                        let mut req = fidl::new_empty!(
712                            fidl::encoding::EmptyPayload,
713                            fidl::encoding::DefaultFuchsiaResourceDialect
714                        );
715                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
716                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
717                        Ok(ControllerRequest::GetTopologicalPath {
718                            responder: ControllerGetTopologicalPathResponder {
719                                control_handle: std::mem::ManuallyDrop::new(control_handle),
720                                tx_id: header.tx_id,
721                            },
722                        })
723                    }
724                    _ => Err(fidl::Error::UnknownOrdinal {
725                        ordinal: header.ordinal,
726                        protocol_name:
727                            <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
728                    }),
729                }))
730            },
731        )
732    }
733}
734
735/// Interface for manipulating a device in a devhost
736///
737/// # Deprecation
738///
739/// This interface is moving to fuchsia.device.fs.
740/// Tracking bug: https://fxbug.dev/340316138
741/// Please use that version of this protocol.
742/// Also, see //sdk/fidl/fuchsia.device.fs/README.md
743/// for future plans for DevFS.
744#[derive(Debug)]
745pub enum ControllerRequest {
746    /// Connect to the underlying device's FIDL protocol.
747    /// This connection will not be multiplexed with fuchsia.device.Controller
748    /// or fuchsia.io.Node.
749    ConnectToDeviceFidl { server: fidl::Channel, control_handle: ControllerControlHandle },
750    /// Connect to the same Controller FIDL protocol.
751    ConnectToController {
752        server: fidl::endpoints::ServerEnd<ControllerMarker>,
753        control_handle: ControllerControlHandle,
754    },
755    /// Attempt to bind a driver to this device.
756    /// + request `driver` This represents the suffix of a driver URL (e.g: "fvm.cm").
757    ///            If this is non-empty, then the only drivers that will try to bind
758    ///            are ones that match this url suffix.
759    Bind { driver: String, responder: ControllerBindResponder },
760    /// Unbind all the children of this device, and then attempt to bind a driver to the device.
761    /// This will not return until the bind completes.
762    /// + request `driver` This represents the suffix of a driver URL (e.g: "fvm.cm").
763    ///            If this is non-empty, then the only drivers that will try to bind
764    ///            are ones that match this url suffix.
765    Rebind { driver: String, responder: ControllerRebindResponder },
766    /// This api will unbind all the children of this device synchronously.
767    /// This will avoid watching for device removal by the clients.
768    UnbindChildren { responder: ControllerUnbindChildrenResponder },
769    /// Disconnect this device and allow its parent to be bound again.
770    /// This may not complete before it returns.
771    ScheduleUnbind { responder: ControllerScheduleUnbindResponder },
772    /// Return the topological path for this device
773    GetTopologicalPath { responder: ControllerGetTopologicalPathResponder },
774}
775
776impl ControllerRequest {
777    #[allow(irrefutable_let_patterns)]
778    pub fn into_connect_to_device_fidl(self) -> Option<(fidl::Channel, ControllerControlHandle)> {
779        if let ControllerRequest::ConnectToDeviceFidl { server, control_handle } = self {
780            Some((server, control_handle))
781        } else {
782            None
783        }
784    }
785
786    #[allow(irrefutable_let_patterns)]
787    pub fn into_connect_to_controller(
788        self,
789    ) -> Option<(fidl::endpoints::ServerEnd<ControllerMarker>, ControllerControlHandle)> {
790        if let ControllerRequest::ConnectToController { server, control_handle } = self {
791            Some((server, control_handle))
792        } else {
793            None
794        }
795    }
796
797    #[allow(irrefutable_let_patterns)]
798    pub fn into_bind(self) -> Option<(String, ControllerBindResponder)> {
799        if let ControllerRequest::Bind { driver, responder } = self {
800            Some((driver, responder))
801        } else {
802            None
803        }
804    }
805
806    #[allow(irrefutable_let_patterns)]
807    pub fn into_rebind(self) -> Option<(String, ControllerRebindResponder)> {
808        if let ControllerRequest::Rebind { driver, responder } = self {
809            Some((driver, responder))
810        } else {
811            None
812        }
813    }
814
815    #[allow(irrefutable_let_patterns)]
816    pub fn into_unbind_children(self) -> Option<(ControllerUnbindChildrenResponder)> {
817        if let ControllerRequest::UnbindChildren { responder } = self {
818            Some((responder))
819        } else {
820            None
821        }
822    }
823
824    #[allow(irrefutable_let_patterns)]
825    pub fn into_schedule_unbind(self) -> Option<(ControllerScheduleUnbindResponder)> {
826        if let ControllerRequest::ScheduleUnbind { responder } = self {
827            Some((responder))
828        } else {
829            None
830        }
831    }
832
833    #[allow(irrefutable_let_patterns)]
834    pub fn into_get_topological_path(self) -> Option<(ControllerGetTopologicalPathResponder)> {
835        if let ControllerRequest::GetTopologicalPath { responder } = self {
836            Some((responder))
837        } else {
838            None
839        }
840    }
841
842    /// Name of the method defined in FIDL
843    pub fn method_name(&self) -> &'static str {
844        match *self {
845            ControllerRequest::ConnectToDeviceFidl { .. } => "connect_to_device_fidl",
846            ControllerRequest::ConnectToController { .. } => "connect_to_controller",
847            ControllerRequest::Bind { .. } => "bind",
848            ControllerRequest::Rebind { .. } => "rebind",
849            ControllerRequest::UnbindChildren { .. } => "unbind_children",
850            ControllerRequest::ScheduleUnbind { .. } => "schedule_unbind",
851            ControllerRequest::GetTopologicalPath { .. } => "get_topological_path",
852        }
853    }
854}
855
856#[derive(Debug, Clone)]
857pub struct ControllerControlHandle {
858    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
859}
860
861impl fidl::endpoints::ControlHandle for ControllerControlHandle {
862    fn shutdown(&self) {
863        self.inner.shutdown()
864    }
865    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
866        self.inner.shutdown_with_epitaph(status)
867    }
868
869    fn is_closed(&self) -> bool {
870        self.inner.channel().is_closed()
871    }
872    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
873        self.inner.channel().on_closed()
874    }
875
876    #[cfg(target_os = "fuchsia")]
877    fn signal_peer(
878        &self,
879        clear_mask: zx::Signals,
880        set_mask: zx::Signals,
881    ) -> Result<(), zx_status::Status> {
882        use fidl::Peered;
883        self.inner.channel().signal_peer(clear_mask, set_mask)
884    }
885}
886
887impl ControllerControlHandle {}
888
889#[must_use = "FIDL methods require a response to be sent"]
890#[derive(Debug)]
891pub struct ControllerBindResponder {
892    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
893    tx_id: u32,
894}
895
896/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
897/// if the responder is dropped without sending a response, so that the client
898/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
899impl std::ops::Drop for ControllerBindResponder {
900    fn drop(&mut self) {
901        self.control_handle.shutdown();
902        // Safety: drops once, never accessed again
903        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
904    }
905}
906
907impl fidl::endpoints::Responder for ControllerBindResponder {
908    type ControlHandle = ControllerControlHandle;
909
910    fn control_handle(&self) -> &ControllerControlHandle {
911        &self.control_handle
912    }
913
914    fn drop_without_shutdown(mut self) {
915        // Safety: drops once, never accessed again due to mem::forget
916        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
917        // Prevent Drop from running (which would shut down the channel)
918        std::mem::forget(self);
919    }
920}
921
922impl ControllerBindResponder {
923    /// Sends a response to the FIDL transaction.
924    ///
925    /// Sets the channel to shutdown if an error occurs.
926    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
927        let _result = self.send_raw(result);
928        if _result.is_err() {
929            self.control_handle.shutdown();
930        }
931        self.drop_without_shutdown();
932        _result
933    }
934
935    /// Similar to "send" but does not shutdown the channel if an error occurs.
936    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
937        let _result = self.send_raw(result);
938        self.drop_without_shutdown();
939        _result
940    }
941
942    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
943        self.control_handle
944            .inner
945            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
946                result,
947                self.tx_id,
948                0x3388f12801462769,
949                fidl::encoding::DynamicFlags::empty(),
950            )
951    }
952}
953
954#[must_use = "FIDL methods require a response to be sent"]
955#[derive(Debug)]
956pub struct ControllerRebindResponder {
957    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
958    tx_id: u32,
959}
960
961/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
962/// if the responder is dropped without sending a response, so that the client
963/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
964impl std::ops::Drop for ControllerRebindResponder {
965    fn drop(&mut self) {
966        self.control_handle.shutdown();
967        // Safety: drops once, never accessed again
968        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
969    }
970}
971
972impl fidl::endpoints::Responder for ControllerRebindResponder {
973    type ControlHandle = ControllerControlHandle;
974
975    fn control_handle(&self) -> &ControllerControlHandle {
976        &self.control_handle
977    }
978
979    fn drop_without_shutdown(mut self) {
980        // Safety: drops once, never accessed again due to mem::forget
981        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
982        // Prevent Drop from running (which would shut down the channel)
983        std::mem::forget(self);
984    }
985}
986
987impl ControllerRebindResponder {
988    /// Sends a response to the FIDL transaction.
989    ///
990    /// Sets the channel to shutdown if an error occurs.
991    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
992        let _result = self.send_raw(result);
993        if _result.is_err() {
994            self.control_handle.shutdown();
995        }
996        self.drop_without_shutdown();
997        _result
998    }
999
1000    /// Similar to "send" but does not shutdown the channel if an error occurs.
1001    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1002        let _result = self.send_raw(result);
1003        self.drop_without_shutdown();
1004        _result
1005    }
1006
1007    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1008        self.control_handle
1009            .inner
1010            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1011                result,
1012                self.tx_id,
1013                0x384fb80cbc2782e2,
1014                fidl::encoding::DynamicFlags::empty(),
1015            )
1016    }
1017}
1018
1019#[must_use = "FIDL methods require a response to be sent"]
1020#[derive(Debug)]
1021pub struct ControllerUnbindChildrenResponder {
1022    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1023    tx_id: u32,
1024}
1025
1026/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
1027/// if the responder is dropped without sending a response, so that the client
1028/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1029impl std::ops::Drop for ControllerUnbindChildrenResponder {
1030    fn drop(&mut self) {
1031        self.control_handle.shutdown();
1032        // Safety: drops once, never accessed again
1033        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1034    }
1035}
1036
1037impl fidl::endpoints::Responder for ControllerUnbindChildrenResponder {
1038    type ControlHandle = ControllerControlHandle;
1039
1040    fn control_handle(&self) -> &ControllerControlHandle {
1041        &self.control_handle
1042    }
1043
1044    fn drop_without_shutdown(mut self) {
1045        // Safety: drops once, never accessed again due to mem::forget
1046        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1047        // Prevent Drop from running (which would shut down the channel)
1048        std::mem::forget(self);
1049    }
1050}
1051
1052impl ControllerUnbindChildrenResponder {
1053    /// Sends a response to the FIDL transaction.
1054    ///
1055    /// Sets the channel to shutdown if an error occurs.
1056    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1057        let _result = self.send_raw(result);
1058        if _result.is_err() {
1059            self.control_handle.shutdown();
1060        }
1061        self.drop_without_shutdown();
1062        _result
1063    }
1064
1065    /// Similar to "send" but does not shutdown the channel if an error occurs.
1066    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1067        let _result = self.send_raw(result);
1068        self.drop_without_shutdown();
1069        _result
1070    }
1071
1072    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1073        self.control_handle
1074            .inner
1075            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1076                result,
1077                self.tx_id,
1078                0x31fae8d74db7a426,
1079                fidl::encoding::DynamicFlags::empty(),
1080            )
1081    }
1082}
1083
1084#[must_use = "FIDL methods require a response to be sent"]
1085#[derive(Debug)]
1086pub struct ControllerScheduleUnbindResponder {
1087    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1088    tx_id: u32,
1089}
1090
1091/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
1092/// if the responder is dropped without sending a response, so that the client
1093/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1094impl std::ops::Drop for ControllerScheduleUnbindResponder {
1095    fn drop(&mut self) {
1096        self.control_handle.shutdown();
1097        // Safety: drops once, never accessed again
1098        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1099    }
1100}
1101
1102impl fidl::endpoints::Responder for ControllerScheduleUnbindResponder {
1103    type ControlHandle = ControllerControlHandle;
1104
1105    fn control_handle(&self) -> &ControllerControlHandle {
1106        &self.control_handle
1107    }
1108
1109    fn drop_without_shutdown(mut self) {
1110        // Safety: drops once, never accessed again due to mem::forget
1111        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1112        // Prevent Drop from running (which would shut down the channel)
1113        std::mem::forget(self);
1114    }
1115}
1116
1117impl ControllerScheduleUnbindResponder {
1118    /// Sends a response to the FIDL transaction.
1119    ///
1120    /// Sets the channel to shutdown if an error occurs.
1121    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1122        let _result = self.send_raw(result);
1123        if _result.is_err() {
1124            self.control_handle.shutdown();
1125        }
1126        self.drop_without_shutdown();
1127        _result
1128    }
1129
1130    /// Similar to "send" but does not shutdown the channel if an error occurs.
1131    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1132        let _result = self.send_raw(result);
1133        self.drop_without_shutdown();
1134        _result
1135    }
1136
1137    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1138        self.control_handle
1139            .inner
1140            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1141                result,
1142                self.tx_id,
1143                0x6128ba9d76aff9c,
1144                fidl::encoding::DynamicFlags::empty(),
1145            )
1146    }
1147}
1148
1149#[must_use = "FIDL methods require a response to be sent"]
1150#[derive(Debug)]
1151pub struct ControllerGetTopologicalPathResponder {
1152    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1153    tx_id: u32,
1154}
1155
1156/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
1157/// if the responder is dropped without sending a response, so that the client
1158/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1159impl std::ops::Drop for ControllerGetTopologicalPathResponder {
1160    fn drop(&mut self) {
1161        self.control_handle.shutdown();
1162        // Safety: drops once, never accessed again
1163        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1164    }
1165}
1166
1167impl fidl::endpoints::Responder for ControllerGetTopologicalPathResponder {
1168    type ControlHandle = ControllerControlHandle;
1169
1170    fn control_handle(&self) -> &ControllerControlHandle {
1171        &self.control_handle
1172    }
1173
1174    fn drop_without_shutdown(mut self) {
1175        // Safety: drops once, never accessed again due to mem::forget
1176        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1177        // Prevent Drop from running (which would shut down the channel)
1178        std::mem::forget(self);
1179    }
1180}
1181
1182impl ControllerGetTopologicalPathResponder {
1183    /// Sends a response to the FIDL transaction.
1184    ///
1185    /// Sets the channel to shutdown if an error occurs.
1186    pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1187        let _result = self.send_raw(result);
1188        if _result.is_err() {
1189            self.control_handle.shutdown();
1190        }
1191        self.drop_without_shutdown();
1192        _result
1193    }
1194
1195    /// Similar to "send" but does not shutdown the channel if an error occurs.
1196    pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1197        let _result = self.send_raw(result);
1198        self.drop_without_shutdown();
1199        _result
1200    }
1201
1202    fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1203        self.control_handle.inner.send::<fidl::encoding::ResultType<
1204            ControllerGetTopologicalPathResponse,
1205            i32,
1206        >>(
1207            result.map(|path| (path,)),
1208            self.tx_id,
1209            0x2689b37663e00788,
1210            fidl::encoding::DynamicFlags::empty(),
1211        )
1212    }
1213}
1214
1215#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1216pub struct NameProviderMarker;
1217
1218impl fidl::endpoints::ProtocolMarker for NameProviderMarker {
1219    type Proxy = NameProviderProxy;
1220    type RequestStream = NameProviderRequestStream;
1221    #[cfg(target_os = "fuchsia")]
1222    type SynchronousProxy = NameProviderSynchronousProxy;
1223
1224    const DEBUG_NAME: &'static str = "fuchsia.device.NameProvider";
1225}
1226impl fidl::endpoints::DiscoverableProtocolMarker for NameProviderMarker {}
1227pub type NameProviderGetDeviceNameResult = Result<String, i32>;
1228
1229pub trait NameProviderProxyInterface: Send + Sync {
1230    type GetDeviceNameResponseFut: std::future::Future<Output = Result<NameProviderGetDeviceNameResult, fidl::Error>>
1231        + Send;
1232    fn r#get_device_name(&self) -> Self::GetDeviceNameResponseFut;
1233}
1234#[derive(Debug)]
1235#[cfg(target_os = "fuchsia")]
1236pub struct NameProviderSynchronousProxy {
1237    client: fidl::client::sync::Client,
1238}
1239
1240#[cfg(target_os = "fuchsia")]
1241impl fidl::endpoints::SynchronousProxy for NameProviderSynchronousProxy {
1242    type Proxy = NameProviderProxy;
1243    type Protocol = NameProviderMarker;
1244
1245    fn from_channel(inner: fidl::Channel) -> Self {
1246        Self::new(inner)
1247    }
1248
1249    fn into_channel(self) -> fidl::Channel {
1250        self.client.into_channel()
1251    }
1252
1253    fn as_channel(&self) -> &fidl::Channel {
1254        self.client.as_channel()
1255    }
1256}
1257
1258#[cfg(target_os = "fuchsia")]
1259impl NameProviderSynchronousProxy {
1260    pub fn new(channel: fidl::Channel) -> Self {
1261        let protocol_name = <NameProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1262        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1263    }
1264
1265    pub fn into_channel(self) -> fidl::Channel {
1266        self.client.into_channel()
1267    }
1268
1269    /// Waits until an event arrives and returns it. It is safe for other
1270    /// threads to make concurrent requests while waiting for an event.
1271    pub fn wait_for_event(
1272        &self,
1273        deadline: zx::MonotonicInstant,
1274    ) -> Result<NameProviderEvent, fidl::Error> {
1275        NameProviderEvent::decode(self.client.wait_for_event(deadline)?)
1276    }
1277
1278    /// Return the name of this Fuchsia device.
1279    pub fn r#get_device_name(
1280        &self,
1281        ___deadline: zx::MonotonicInstant,
1282    ) -> Result<NameProviderGetDeviceNameResult, fidl::Error> {
1283        let _response = self.client.send_query::<
1284            fidl::encoding::EmptyPayload,
1285            fidl::encoding::ResultType<NameProviderGetDeviceNameResponse, i32>,
1286        >(
1287            (),
1288            0x6030de8d2052b2ce,
1289            fidl::encoding::DynamicFlags::empty(),
1290            ___deadline,
1291        )?;
1292        Ok(_response.map(|x| x.name))
1293    }
1294}
1295
1296#[derive(Debug, Clone)]
1297pub struct NameProviderProxy {
1298    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1299}
1300
1301impl fidl::endpoints::Proxy for NameProviderProxy {
1302    type Protocol = NameProviderMarker;
1303
1304    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1305        Self::new(inner)
1306    }
1307
1308    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1309        self.client.into_channel().map_err(|client| Self { client })
1310    }
1311
1312    fn as_channel(&self) -> &::fidl::AsyncChannel {
1313        self.client.as_channel()
1314    }
1315}
1316
1317impl NameProviderProxy {
1318    /// Create a new Proxy for fuchsia.device/NameProvider.
1319    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1320        let protocol_name = <NameProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1321        Self { client: fidl::client::Client::new(channel, protocol_name) }
1322    }
1323
1324    /// Get a Stream of events from the remote end of the protocol.
1325    ///
1326    /// # Panics
1327    ///
1328    /// Panics if the event stream was already taken.
1329    pub fn take_event_stream(&self) -> NameProviderEventStream {
1330        NameProviderEventStream { event_receiver: self.client.take_event_receiver() }
1331    }
1332
1333    /// Return the name of this Fuchsia device.
1334    pub fn r#get_device_name(
1335        &self,
1336    ) -> fidl::client::QueryResponseFut<
1337        NameProviderGetDeviceNameResult,
1338        fidl::encoding::DefaultFuchsiaResourceDialect,
1339    > {
1340        NameProviderProxyInterface::r#get_device_name(self)
1341    }
1342}
1343
1344impl NameProviderProxyInterface for NameProviderProxy {
1345    type GetDeviceNameResponseFut = fidl::client::QueryResponseFut<
1346        NameProviderGetDeviceNameResult,
1347        fidl::encoding::DefaultFuchsiaResourceDialect,
1348    >;
1349    fn r#get_device_name(&self) -> Self::GetDeviceNameResponseFut {
1350        fn _decode(
1351            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1352        ) -> Result<NameProviderGetDeviceNameResult, fidl::Error> {
1353            let _response = fidl::client::decode_transaction_body::<
1354                fidl::encoding::ResultType<NameProviderGetDeviceNameResponse, i32>,
1355                fidl::encoding::DefaultFuchsiaResourceDialect,
1356                0x6030de8d2052b2ce,
1357            >(_buf?)?;
1358            Ok(_response.map(|x| x.name))
1359        }
1360        self.client
1361            .send_query_and_decode::<fidl::encoding::EmptyPayload, NameProviderGetDeviceNameResult>(
1362                (),
1363                0x6030de8d2052b2ce,
1364                fidl::encoding::DynamicFlags::empty(),
1365                _decode,
1366            )
1367    }
1368}
1369
1370pub struct NameProviderEventStream {
1371    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1372}
1373
1374impl std::marker::Unpin for NameProviderEventStream {}
1375
1376impl futures::stream::FusedStream for NameProviderEventStream {
1377    fn is_terminated(&self) -> bool {
1378        self.event_receiver.is_terminated()
1379    }
1380}
1381
1382impl futures::Stream for NameProviderEventStream {
1383    type Item = Result<NameProviderEvent, fidl::Error>;
1384
1385    fn poll_next(
1386        mut self: std::pin::Pin<&mut Self>,
1387        cx: &mut std::task::Context<'_>,
1388    ) -> std::task::Poll<Option<Self::Item>> {
1389        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1390            &mut self.event_receiver,
1391            cx
1392        )?) {
1393            Some(buf) => std::task::Poll::Ready(Some(NameProviderEvent::decode(buf))),
1394            None => std::task::Poll::Ready(None),
1395        }
1396    }
1397}
1398
1399#[derive(Debug)]
1400pub enum NameProviderEvent {}
1401
1402impl NameProviderEvent {
1403    /// Decodes a message buffer as a [`NameProviderEvent`].
1404    fn decode(
1405        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1406    ) -> Result<NameProviderEvent, fidl::Error> {
1407        let (bytes, _handles) = buf.split_mut();
1408        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1409        debug_assert_eq!(tx_header.tx_id, 0);
1410        match tx_header.ordinal {
1411            _ => Err(fidl::Error::UnknownOrdinal {
1412                ordinal: tx_header.ordinal,
1413                protocol_name: <NameProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1414            }),
1415        }
1416    }
1417}
1418
1419/// A Stream of incoming requests for fuchsia.device/NameProvider.
1420pub struct NameProviderRequestStream {
1421    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1422    is_terminated: bool,
1423}
1424
1425impl std::marker::Unpin for NameProviderRequestStream {}
1426
1427impl futures::stream::FusedStream for NameProviderRequestStream {
1428    fn is_terminated(&self) -> bool {
1429        self.is_terminated
1430    }
1431}
1432
1433impl fidl::endpoints::RequestStream for NameProviderRequestStream {
1434    type Protocol = NameProviderMarker;
1435    type ControlHandle = NameProviderControlHandle;
1436
1437    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1438        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1439    }
1440
1441    fn control_handle(&self) -> Self::ControlHandle {
1442        NameProviderControlHandle { inner: self.inner.clone() }
1443    }
1444
1445    fn into_inner(
1446        self,
1447    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1448    {
1449        (self.inner, self.is_terminated)
1450    }
1451
1452    fn from_inner(
1453        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1454        is_terminated: bool,
1455    ) -> Self {
1456        Self { inner, is_terminated }
1457    }
1458}
1459
1460impl futures::Stream for NameProviderRequestStream {
1461    type Item = Result<NameProviderRequest, fidl::Error>;
1462
1463    fn poll_next(
1464        mut self: std::pin::Pin<&mut Self>,
1465        cx: &mut std::task::Context<'_>,
1466    ) -> std::task::Poll<Option<Self::Item>> {
1467        let this = &mut *self;
1468        if this.inner.check_shutdown(cx) {
1469            this.is_terminated = true;
1470            return std::task::Poll::Ready(None);
1471        }
1472        if this.is_terminated {
1473            panic!("polled NameProviderRequestStream after completion");
1474        }
1475        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1476            |bytes, handles| {
1477                match this.inner.channel().read_etc(cx, bytes, handles) {
1478                    std::task::Poll::Ready(Ok(())) => {}
1479                    std::task::Poll::Pending => return std::task::Poll::Pending,
1480                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1481                        this.is_terminated = true;
1482                        return std::task::Poll::Ready(None);
1483                    }
1484                    std::task::Poll::Ready(Err(e)) => {
1485                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1486                            e.into(),
1487                        ))))
1488                    }
1489                }
1490
1491                // A message has been received from the channel
1492                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1493
1494                std::task::Poll::Ready(Some(match header.ordinal {
1495                    0x6030de8d2052b2ce => {
1496                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1497                        let mut req = fidl::new_empty!(
1498                            fidl::encoding::EmptyPayload,
1499                            fidl::encoding::DefaultFuchsiaResourceDialect
1500                        );
1501                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1502                        let control_handle =
1503                            NameProviderControlHandle { inner: this.inner.clone() };
1504                        Ok(NameProviderRequest::GetDeviceName {
1505                            responder: NameProviderGetDeviceNameResponder {
1506                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1507                                tx_id: header.tx_id,
1508                            },
1509                        })
1510                    }
1511                    _ => Err(fidl::Error::UnknownOrdinal {
1512                        ordinal: header.ordinal,
1513                        protocol_name:
1514                            <NameProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1515                    }),
1516                }))
1517            },
1518        )
1519    }
1520}
1521
1522/// Interface for getting device names.
1523#[derive(Debug)]
1524pub enum NameProviderRequest {
1525    /// Return the name of this Fuchsia device.
1526    GetDeviceName { responder: NameProviderGetDeviceNameResponder },
1527}
1528
1529impl NameProviderRequest {
1530    #[allow(irrefutable_let_patterns)]
1531    pub fn into_get_device_name(self) -> Option<(NameProviderGetDeviceNameResponder)> {
1532        if let NameProviderRequest::GetDeviceName { responder } = self {
1533            Some((responder))
1534        } else {
1535            None
1536        }
1537    }
1538
1539    /// Name of the method defined in FIDL
1540    pub fn method_name(&self) -> &'static str {
1541        match *self {
1542            NameProviderRequest::GetDeviceName { .. } => "get_device_name",
1543        }
1544    }
1545}
1546
1547#[derive(Debug, Clone)]
1548pub struct NameProviderControlHandle {
1549    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1550}
1551
1552impl fidl::endpoints::ControlHandle for NameProviderControlHandle {
1553    fn shutdown(&self) {
1554        self.inner.shutdown()
1555    }
1556    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1557        self.inner.shutdown_with_epitaph(status)
1558    }
1559
1560    fn is_closed(&self) -> bool {
1561        self.inner.channel().is_closed()
1562    }
1563    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1564        self.inner.channel().on_closed()
1565    }
1566
1567    #[cfg(target_os = "fuchsia")]
1568    fn signal_peer(
1569        &self,
1570        clear_mask: zx::Signals,
1571        set_mask: zx::Signals,
1572    ) -> Result<(), zx_status::Status> {
1573        use fidl::Peered;
1574        self.inner.channel().signal_peer(clear_mask, set_mask)
1575    }
1576}
1577
1578impl NameProviderControlHandle {}
1579
1580#[must_use = "FIDL methods require a response to be sent"]
1581#[derive(Debug)]
1582pub struct NameProviderGetDeviceNameResponder {
1583    control_handle: std::mem::ManuallyDrop<NameProviderControlHandle>,
1584    tx_id: u32,
1585}
1586
1587/// Set the the channel to be shutdown (see [`NameProviderControlHandle::shutdown`])
1588/// if the responder is dropped without sending a response, so that the client
1589/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1590impl std::ops::Drop for NameProviderGetDeviceNameResponder {
1591    fn drop(&mut self) {
1592        self.control_handle.shutdown();
1593        // Safety: drops once, never accessed again
1594        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1595    }
1596}
1597
1598impl fidl::endpoints::Responder for NameProviderGetDeviceNameResponder {
1599    type ControlHandle = NameProviderControlHandle;
1600
1601    fn control_handle(&self) -> &NameProviderControlHandle {
1602        &self.control_handle
1603    }
1604
1605    fn drop_without_shutdown(mut self) {
1606        // Safety: drops once, never accessed again due to mem::forget
1607        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1608        // Prevent Drop from running (which would shut down the channel)
1609        std::mem::forget(self);
1610    }
1611}
1612
1613impl NameProviderGetDeviceNameResponder {
1614    /// Sends a response to the FIDL transaction.
1615    ///
1616    /// Sets the channel to shutdown if an error occurs.
1617    pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1618        let _result = self.send_raw(result);
1619        if _result.is_err() {
1620            self.control_handle.shutdown();
1621        }
1622        self.drop_without_shutdown();
1623        _result
1624    }
1625
1626    /// Similar to "send" but does not shutdown the channel if an error occurs.
1627    pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1628        let _result = self.send_raw(result);
1629        self.drop_without_shutdown();
1630        _result
1631    }
1632
1633    fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1634        self.control_handle
1635            .inner
1636            .send::<fidl::encoding::ResultType<NameProviderGetDeviceNameResponse, i32>>(
1637                result.map(|name| (name,)),
1638                self.tx_id,
1639                0x6030de8d2052b2ce,
1640                fidl::encoding::DynamicFlags::empty(),
1641            )
1642    }
1643}
1644
1645mod internal {
1646    use super::*;
1647
1648    impl fidl::encoding::ResourceTypeMarker for ControllerConnectToControllerRequest {
1649        type Borrowed<'a> = &'a mut Self;
1650        fn take_or_borrow<'a>(
1651            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1652        ) -> Self::Borrowed<'a> {
1653            value
1654        }
1655    }
1656
1657    unsafe impl fidl::encoding::TypeMarker for ControllerConnectToControllerRequest {
1658        type Owned = Self;
1659
1660        #[inline(always)]
1661        fn inline_align(_context: fidl::encoding::Context) -> usize {
1662            4
1663        }
1664
1665        #[inline(always)]
1666        fn inline_size(_context: fidl::encoding::Context) -> usize {
1667            4
1668        }
1669    }
1670
1671    unsafe impl
1672        fidl::encoding::Encode<
1673            ControllerConnectToControllerRequest,
1674            fidl::encoding::DefaultFuchsiaResourceDialect,
1675        > for &mut ControllerConnectToControllerRequest
1676    {
1677        #[inline]
1678        unsafe fn encode(
1679            self,
1680            encoder: &mut fidl::encoding::Encoder<
1681                '_,
1682                fidl::encoding::DefaultFuchsiaResourceDialect,
1683            >,
1684            offset: usize,
1685            _depth: fidl::encoding::Depth,
1686        ) -> fidl::Result<()> {
1687            encoder.debug_check_bounds::<ControllerConnectToControllerRequest>(offset);
1688            // Delegate to tuple encoding.
1689            fidl::encoding::Encode::<ControllerConnectToControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1690                (
1691                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server),
1692                ),
1693                encoder, offset, _depth
1694            )
1695        }
1696    }
1697    unsafe impl<
1698            T0: fidl::encoding::Encode<
1699                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
1700                fidl::encoding::DefaultFuchsiaResourceDialect,
1701            >,
1702        >
1703        fidl::encoding::Encode<
1704            ControllerConnectToControllerRequest,
1705            fidl::encoding::DefaultFuchsiaResourceDialect,
1706        > for (T0,)
1707    {
1708        #[inline]
1709        unsafe fn encode(
1710            self,
1711            encoder: &mut fidl::encoding::Encoder<
1712                '_,
1713                fidl::encoding::DefaultFuchsiaResourceDialect,
1714            >,
1715            offset: usize,
1716            depth: fidl::encoding::Depth,
1717        ) -> fidl::Result<()> {
1718            encoder.debug_check_bounds::<ControllerConnectToControllerRequest>(offset);
1719            // Zero out padding regions. There's no need to apply masks
1720            // because the unmasked parts will be overwritten by fields.
1721            // Write the fields.
1722            self.0.encode(encoder, offset + 0, depth)?;
1723            Ok(())
1724        }
1725    }
1726
1727    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1728        for ControllerConnectToControllerRequest
1729    {
1730        #[inline(always)]
1731        fn new_empty() -> Self {
1732            Self {
1733                server: fidl::new_empty!(
1734                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
1735                    fidl::encoding::DefaultFuchsiaResourceDialect
1736                ),
1737            }
1738        }
1739
1740        #[inline]
1741        unsafe fn decode(
1742            &mut self,
1743            decoder: &mut fidl::encoding::Decoder<
1744                '_,
1745                fidl::encoding::DefaultFuchsiaResourceDialect,
1746            >,
1747            offset: usize,
1748            _depth: fidl::encoding::Depth,
1749        ) -> fidl::Result<()> {
1750            decoder.debug_check_bounds::<Self>(offset);
1751            // Verify that padding bytes are zero.
1752            fidl::decode!(
1753                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
1754                fidl::encoding::DefaultFuchsiaResourceDialect,
1755                &mut self.server,
1756                decoder,
1757                offset + 0,
1758                _depth
1759            )?;
1760            Ok(())
1761        }
1762    }
1763
1764    impl fidl::encoding::ResourceTypeMarker for ControllerConnectToDeviceFidlRequest {
1765        type Borrowed<'a> = &'a mut Self;
1766        fn take_or_borrow<'a>(
1767            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1768        ) -> Self::Borrowed<'a> {
1769            value
1770        }
1771    }
1772
1773    unsafe impl fidl::encoding::TypeMarker for ControllerConnectToDeviceFidlRequest {
1774        type Owned = Self;
1775
1776        #[inline(always)]
1777        fn inline_align(_context: fidl::encoding::Context) -> usize {
1778            4
1779        }
1780
1781        #[inline(always)]
1782        fn inline_size(_context: fidl::encoding::Context) -> usize {
1783            4
1784        }
1785    }
1786
1787    unsafe impl
1788        fidl::encoding::Encode<
1789            ControllerConnectToDeviceFidlRequest,
1790            fidl::encoding::DefaultFuchsiaResourceDialect,
1791        > for &mut ControllerConnectToDeviceFidlRequest
1792    {
1793        #[inline]
1794        unsafe fn encode(
1795            self,
1796            encoder: &mut fidl::encoding::Encoder<
1797                '_,
1798                fidl::encoding::DefaultFuchsiaResourceDialect,
1799            >,
1800            offset: usize,
1801            _depth: fidl::encoding::Depth,
1802        ) -> fidl::Result<()> {
1803            encoder.debug_check_bounds::<ControllerConnectToDeviceFidlRequest>(offset);
1804            // Delegate to tuple encoding.
1805            fidl::encoding::Encode::<
1806                ControllerConnectToDeviceFidlRequest,
1807                fidl::encoding::DefaultFuchsiaResourceDialect,
1808            >::encode(
1809                (<fidl::encoding::HandleType<
1810                    fidl::Channel,
1811                    { fidl::ObjectType::CHANNEL.into_raw() },
1812                    2147483648,
1813                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1814                    &mut self.server
1815                ),),
1816                encoder,
1817                offset,
1818                _depth,
1819            )
1820        }
1821    }
1822    unsafe impl<
1823            T0: fidl::encoding::Encode<
1824                fidl::encoding::HandleType<
1825                    fidl::Channel,
1826                    { fidl::ObjectType::CHANNEL.into_raw() },
1827                    2147483648,
1828                >,
1829                fidl::encoding::DefaultFuchsiaResourceDialect,
1830            >,
1831        >
1832        fidl::encoding::Encode<
1833            ControllerConnectToDeviceFidlRequest,
1834            fidl::encoding::DefaultFuchsiaResourceDialect,
1835        > for (T0,)
1836    {
1837        #[inline]
1838        unsafe fn encode(
1839            self,
1840            encoder: &mut fidl::encoding::Encoder<
1841                '_,
1842                fidl::encoding::DefaultFuchsiaResourceDialect,
1843            >,
1844            offset: usize,
1845            depth: fidl::encoding::Depth,
1846        ) -> fidl::Result<()> {
1847            encoder.debug_check_bounds::<ControllerConnectToDeviceFidlRequest>(offset);
1848            // Zero out padding regions. There's no need to apply masks
1849            // because the unmasked parts will be overwritten by fields.
1850            // Write the fields.
1851            self.0.encode(encoder, offset + 0, depth)?;
1852            Ok(())
1853        }
1854    }
1855
1856    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1857        for ControllerConnectToDeviceFidlRequest
1858    {
1859        #[inline(always)]
1860        fn new_empty() -> Self {
1861            Self {
1862                server: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1863            }
1864        }
1865
1866        #[inline]
1867        unsafe fn decode(
1868            &mut self,
1869            decoder: &mut fidl::encoding::Decoder<
1870                '_,
1871                fidl::encoding::DefaultFuchsiaResourceDialect,
1872            >,
1873            offset: usize,
1874            _depth: fidl::encoding::Depth,
1875        ) -> fidl::Result<()> {
1876            decoder.debug_check_bounds::<Self>(offset);
1877            // Verify that padding bytes are zero.
1878            fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server, decoder, offset + 0, _depth)?;
1879            Ok(())
1880        }
1881    }
1882}