fidl_fuchsia_hardware_vsock/
fidl_fuchsia_hardware_vsock.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_hardware_vsock_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DeviceSendRequestRequest {
16    pub addr: Addr,
17    pub data: fidl::Socket,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceSendRequestRequest {}
21
22#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23pub struct DeviceSendResponseRequest {
24    pub addr: Addr,
25    pub data: fidl::Socket,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceSendResponseRequest {}
29
30#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31pub struct DeviceStartRequest {
32    pub cb: fidl::endpoints::ClientEnd<CallbacksMarker>,
33}
34
35impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceStartRequest {}
36
37#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
38pub struct CallbacksMarker;
39
40impl fidl::endpoints::ProtocolMarker for CallbacksMarker {
41    type Proxy = CallbacksProxy;
42    type RequestStream = CallbacksRequestStream;
43    #[cfg(target_os = "fuchsia")]
44    type SynchronousProxy = CallbacksSynchronousProxy;
45
46    const DEBUG_NAME: &'static str = "(anonymous) Callbacks";
47}
48
49pub trait CallbacksProxyInterface: Send + Sync {
50    fn r#request(&self, addr: &Addr) -> Result<(), fidl::Error>;
51    fn r#response(&self, addr: &Addr) -> Result<(), fidl::Error>;
52    fn r#rst(&self, addr: &Addr) -> Result<(), fidl::Error>;
53    fn r#shutdown(&self, addr: &Addr) -> Result<(), fidl::Error>;
54    type TransportResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
55    fn r#transport_reset(&self, new_cid: u32) -> Self::TransportResetResponseFut;
56}
57#[derive(Debug)]
58#[cfg(target_os = "fuchsia")]
59pub struct CallbacksSynchronousProxy {
60    client: fidl::client::sync::Client,
61}
62
63#[cfg(target_os = "fuchsia")]
64impl fidl::endpoints::SynchronousProxy for CallbacksSynchronousProxy {
65    type Proxy = CallbacksProxy;
66    type Protocol = CallbacksMarker;
67
68    fn from_channel(inner: fidl::Channel) -> Self {
69        Self::new(inner)
70    }
71
72    fn into_channel(self) -> fidl::Channel {
73        self.client.into_channel()
74    }
75
76    fn as_channel(&self) -> &fidl::Channel {
77        self.client.as_channel()
78    }
79}
80
81#[cfg(target_os = "fuchsia")]
82impl CallbacksSynchronousProxy {
83    pub fn new(channel: fidl::Channel) -> Self {
84        let protocol_name = <CallbacksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
85        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
86    }
87
88    pub fn into_channel(self) -> fidl::Channel {
89        self.client.into_channel()
90    }
91
92    /// Waits until an event arrives and returns it. It is safe for other
93    /// threads to make concurrent requests while waiting for an event.
94    pub fn wait_for_event(
95        &self,
96        deadline: zx::MonotonicInstant,
97    ) -> Result<CallbacksEvent, fidl::Error> {
98        CallbacksEvent::decode(self.client.wait_for_event(deadline)?)
99    }
100
101    pub fn r#request(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
102        self.client.send::<CallbacksRequestRequest>(
103            (addr,),
104            0x685918e57418eda8,
105            fidl::encoding::DynamicFlags::empty(),
106        )
107    }
108
109    pub fn r#response(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
110        self.client.send::<CallbacksResponseRequest>(
111            (addr,),
112            0x951dfbcb98699cc,
113            fidl::encoding::DynamicFlags::empty(),
114        )
115    }
116
117    pub fn r#rst(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
118        self.client.send::<CallbacksRstRequest>(
119            (addr,),
120            0x7d6b0a28c75d5568,
121            fidl::encoding::DynamicFlags::empty(),
122        )
123    }
124
125    pub fn r#shutdown(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
126        self.client.send::<CallbacksShutdownRequest>(
127            (addr,),
128            0x6021a72c49ab97cb,
129            fidl::encoding::DynamicFlags::empty(),
130        )
131    }
132
133    pub fn r#transport_reset(
134        &self,
135        mut new_cid: u32,
136        ___deadline: zx::MonotonicInstant,
137    ) -> Result<(), fidl::Error> {
138        let _response = self
139            .client
140            .send_query::<CallbacksTransportResetRequest, fidl::encoding::EmptyPayload>(
141                (new_cid,),
142                0x23ba142d8c6a537,
143                fidl::encoding::DynamicFlags::empty(),
144                ___deadline,
145            )?;
146        Ok(_response)
147    }
148}
149
150#[derive(Debug, Clone)]
151pub struct CallbacksProxy {
152    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
153}
154
155impl fidl::endpoints::Proxy for CallbacksProxy {
156    type Protocol = CallbacksMarker;
157
158    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
159        Self::new(inner)
160    }
161
162    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
163        self.client.into_channel().map_err(|client| Self { client })
164    }
165
166    fn as_channel(&self) -> &::fidl::AsyncChannel {
167        self.client.as_channel()
168    }
169}
170
171impl CallbacksProxy {
172    /// Create a new Proxy for fuchsia.hardware.vsock/Callbacks.
173    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
174        let protocol_name = <CallbacksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
175        Self { client: fidl::client::Client::new(channel, protocol_name) }
176    }
177
178    /// Get a Stream of events from the remote end of the protocol.
179    ///
180    /// # Panics
181    ///
182    /// Panics if the event stream was already taken.
183    pub fn take_event_stream(&self) -> CallbacksEventStream {
184        CallbacksEventStream { event_receiver: self.client.take_event_receiver() }
185    }
186
187    pub fn r#request(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
188        CallbacksProxyInterface::r#request(self, addr)
189    }
190
191    pub fn r#response(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
192        CallbacksProxyInterface::r#response(self, addr)
193    }
194
195    pub fn r#rst(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
196        CallbacksProxyInterface::r#rst(self, addr)
197    }
198
199    pub fn r#shutdown(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
200        CallbacksProxyInterface::r#shutdown(self, addr)
201    }
202
203    pub fn r#transport_reset(
204        &self,
205        mut new_cid: u32,
206    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
207        CallbacksProxyInterface::r#transport_reset(self, new_cid)
208    }
209}
210
211impl CallbacksProxyInterface for CallbacksProxy {
212    fn r#request(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
213        self.client.send::<CallbacksRequestRequest>(
214            (addr,),
215            0x685918e57418eda8,
216            fidl::encoding::DynamicFlags::empty(),
217        )
218    }
219
220    fn r#response(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
221        self.client.send::<CallbacksResponseRequest>(
222            (addr,),
223            0x951dfbcb98699cc,
224            fidl::encoding::DynamicFlags::empty(),
225        )
226    }
227
228    fn r#rst(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
229        self.client.send::<CallbacksRstRequest>(
230            (addr,),
231            0x7d6b0a28c75d5568,
232            fidl::encoding::DynamicFlags::empty(),
233        )
234    }
235
236    fn r#shutdown(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
237        self.client.send::<CallbacksShutdownRequest>(
238            (addr,),
239            0x6021a72c49ab97cb,
240            fidl::encoding::DynamicFlags::empty(),
241        )
242    }
243
244    type TransportResetResponseFut =
245        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
246    fn r#transport_reset(&self, mut new_cid: u32) -> Self::TransportResetResponseFut {
247        fn _decode(
248            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
249        ) -> Result<(), fidl::Error> {
250            let _response = fidl::client::decode_transaction_body::<
251                fidl::encoding::EmptyPayload,
252                fidl::encoding::DefaultFuchsiaResourceDialect,
253                0x23ba142d8c6a537,
254            >(_buf?)?;
255            Ok(_response)
256        }
257        self.client.send_query_and_decode::<CallbacksTransportResetRequest, ()>(
258            (new_cid,),
259            0x23ba142d8c6a537,
260            fidl::encoding::DynamicFlags::empty(),
261            _decode,
262        )
263    }
264}
265
266pub struct CallbacksEventStream {
267    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
268}
269
270impl std::marker::Unpin for CallbacksEventStream {}
271
272impl futures::stream::FusedStream for CallbacksEventStream {
273    fn is_terminated(&self) -> bool {
274        self.event_receiver.is_terminated()
275    }
276}
277
278impl futures::Stream for CallbacksEventStream {
279    type Item = Result<CallbacksEvent, fidl::Error>;
280
281    fn poll_next(
282        mut self: std::pin::Pin<&mut Self>,
283        cx: &mut std::task::Context<'_>,
284    ) -> std::task::Poll<Option<Self::Item>> {
285        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
286            &mut self.event_receiver,
287            cx
288        )?) {
289            Some(buf) => std::task::Poll::Ready(Some(CallbacksEvent::decode(buf))),
290            None => std::task::Poll::Ready(None),
291        }
292    }
293}
294
295#[derive(Debug)]
296pub enum CallbacksEvent {}
297
298impl CallbacksEvent {
299    /// Decodes a message buffer as a [`CallbacksEvent`].
300    fn decode(
301        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
302    ) -> Result<CallbacksEvent, fidl::Error> {
303        let (bytes, _handles) = buf.split_mut();
304        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
305        debug_assert_eq!(tx_header.tx_id, 0);
306        match tx_header.ordinal {
307            _ => Err(fidl::Error::UnknownOrdinal {
308                ordinal: tx_header.ordinal,
309                protocol_name: <CallbacksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
310            }),
311        }
312    }
313}
314
315/// A Stream of incoming requests for fuchsia.hardware.vsock/Callbacks.
316pub struct CallbacksRequestStream {
317    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
318    is_terminated: bool,
319}
320
321impl std::marker::Unpin for CallbacksRequestStream {}
322
323impl futures::stream::FusedStream for CallbacksRequestStream {
324    fn is_terminated(&self) -> bool {
325        self.is_terminated
326    }
327}
328
329impl fidl::endpoints::RequestStream for CallbacksRequestStream {
330    type Protocol = CallbacksMarker;
331    type ControlHandle = CallbacksControlHandle;
332
333    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
334        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
335    }
336
337    fn control_handle(&self) -> Self::ControlHandle {
338        CallbacksControlHandle { inner: self.inner.clone() }
339    }
340
341    fn into_inner(
342        self,
343    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
344    {
345        (self.inner, self.is_terminated)
346    }
347
348    fn from_inner(
349        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
350        is_terminated: bool,
351    ) -> Self {
352        Self { inner, is_terminated }
353    }
354}
355
356impl futures::Stream for CallbacksRequestStream {
357    type Item = Result<CallbacksRequest, fidl::Error>;
358
359    fn poll_next(
360        mut self: std::pin::Pin<&mut Self>,
361        cx: &mut std::task::Context<'_>,
362    ) -> std::task::Poll<Option<Self::Item>> {
363        let this = &mut *self;
364        if this.inner.check_shutdown(cx) {
365            this.is_terminated = true;
366            return std::task::Poll::Ready(None);
367        }
368        if this.is_terminated {
369            panic!("polled CallbacksRequestStream after completion");
370        }
371        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
372            |bytes, handles| {
373                match this.inner.channel().read_etc(cx, bytes, handles) {
374                    std::task::Poll::Ready(Ok(())) => {}
375                    std::task::Poll::Pending => return std::task::Poll::Pending,
376                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
377                        this.is_terminated = true;
378                        return std::task::Poll::Ready(None);
379                    }
380                    std::task::Poll::Ready(Err(e)) => {
381                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
382                            e.into(),
383                        ))))
384                    }
385                }
386
387                // A message has been received from the channel
388                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
389
390                std::task::Poll::Ready(Some(match header.ordinal {
391                    0x685918e57418eda8 => {
392                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
393                        let mut req = fidl::new_empty!(
394                            CallbacksRequestRequest,
395                            fidl::encoding::DefaultFuchsiaResourceDialect
396                        );
397                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallbacksRequestRequest>(&header, _body_bytes, handles, &mut req)?;
398                        let control_handle = CallbacksControlHandle { inner: this.inner.clone() };
399                        Ok(CallbacksRequest::Request { addr: req.addr, control_handle })
400                    }
401                    0x951dfbcb98699cc => {
402                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
403                        let mut req = fidl::new_empty!(
404                            CallbacksResponseRequest,
405                            fidl::encoding::DefaultFuchsiaResourceDialect
406                        );
407                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallbacksResponseRequest>(&header, _body_bytes, handles, &mut req)?;
408                        let control_handle = CallbacksControlHandle { inner: this.inner.clone() };
409                        Ok(CallbacksRequest::Response { addr: req.addr, control_handle })
410                    }
411                    0x7d6b0a28c75d5568 => {
412                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
413                        let mut req = fidl::new_empty!(
414                            CallbacksRstRequest,
415                            fidl::encoding::DefaultFuchsiaResourceDialect
416                        );
417                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallbacksRstRequest>(&header, _body_bytes, handles, &mut req)?;
418                        let control_handle = CallbacksControlHandle { inner: this.inner.clone() };
419                        Ok(CallbacksRequest::Rst { addr: req.addr, control_handle })
420                    }
421                    0x6021a72c49ab97cb => {
422                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
423                        let mut req = fidl::new_empty!(
424                            CallbacksShutdownRequest,
425                            fidl::encoding::DefaultFuchsiaResourceDialect
426                        );
427                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallbacksShutdownRequest>(&header, _body_bytes, handles, &mut req)?;
428                        let control_handle = CallbacksControlHandle { inner: this.inner.clone() };
429                        Ok(CallbacksRequest::Shutdown { addr: req.addr, control_handle })
430                    }
431                    0x23ba142d8c6a537 => {
432                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
433                        let mut req = fidl::new_empty!(
434                            CallbacksTransportResetRequest,
435                            fidl::encoding::DefaultFuchsiaResourceDialect
436                        );
437                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallbacksTransportResetRequest>(&header, _body_bytes, handles, &mut req)?;
438                        let control_handle = CallbacksControlHandle { inner: this.inner.clone() };
439                        Ok(CallbacksRequest::TransportReset {
440                            new_cid: req.new_cid,
441
442                            responder: CallbacksTransportResetResponder {
443                                control_handle: std::mem::ManuallyDrop::new(control_handle),
444                                tx_id: header.tx_id,
445                            },
446                        })
447                    }
448                    _ => Err(fidl::Error::UnknownOrdinal {
449                        ordinal: header.ordinal,
450                        protocol_name:
451                            <CallbacksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
452                    }),
453                }))
454            },
455        )
456    }
457}
458
459#[derive(Debug)]
460pub enum CallbacksRequest {
461    Request { addr: Addr, control_handle: CallbacksControlHandle },
462    Response { addr: Addr, control_handle: CallbacksControlHandle },
463    Rst { addr: Addr, control_handle: CallbacksControlHandle },
464    Shutdown { addr: Addr, control_handle: CallbacksControlHandle },
465    TransportReset { new_cid: u32, responder: CallbacksTransportResetResponder },
466}
467
468impl CallbacksRequest {
469    #[allow(irrefutable_let_patterns)]
470    pub fn into_request(self) -> Option<(Addr, CallbacksControlHandle)> {
471        if let CallbacksRequest::Request { addr, control_handle } = self {
472            Some((addr, control_handle))
473        } else {
474            None
475        }
476    }
477
478    #[allow(irrefutable_let_patterns)]
479    pub fn into_response(self) -> Option<(Addr, CallbacksControlHandle)> {
480        if let CallbacksRequest::Response { addr, control_handle } = self {
481            Some((addr, control_handle))
482        } else {
483            None
484        }
485    }
486
487    #[allow(irrefutable_let_patterns)]
488    pub fn into_rst(self) -> Option<(Addr, CallbacksControlHandle)> {
489        if let CallbacksRequest::Rst { addr, control_handle } = self {
490            Some((addr, control_handle))
491        } else {
492            None
493        }
494    }
495
496    #[allow(irrefutable_let_patterns)]
497    pub fn into_shutdown(self) -> Option<(Addr, CallbacksControlHandle)> {
498        if let CallbacksRequest::Shutdown { addr, control_handle } = self {
499            Some((addr, control_handle))
500        } else {
501            None
502        }
503    }
504
505    #[allow(irrefutable_let_patterns)]
506    pub fn into_transport_reset(self) -> Option<(u32, CallbacksTransportResetResponder)> {
507        if let CallbacksRequest::TransportReset { new_cid, responder } = self {
508            Some((new_cid, responder))
509        } else {
510            None
511        }
512    }
513
514    /// Name of the method defined in FIDL
515    pub fn method_name(&self) -> &'static str {
516        match *self {
517            CallbacksRequest::Request { .. } => "request",
518            CallbacksRequest::Response { .. } => "response",
519            CallbacksRequest::Rst { .. } => "rst",
520            CallbacksRequest::Shutdown { .. } => "shutdown",
521            CallbacksRequest::TransportReset { .. } => "transport_reset",
522        }
523    }
524}
525
526#[derive(Debug, Clone)]
527pub struct CallbacksControlHandle {
528    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
529}
530
531impl fidl::endpoints::ControlHandle for CallbacksControlHandle {
532    fn shutdown(&self) {
533        self.inner.shutdown()
534    }
535    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
536        self.inner.shutdown_with_epitaph(status)
537    }
538
539    fn is_closed(&self) -> bool {
540        self.inner.channel().is_closed()
541    }
542    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
543        self.inner.channel().on_closed()
544    }
545
546    #[cfg(target_os = "fuchsia")]
547    fn signal_peer(
548        &self,
549        clear_mask: zx::Signals,
550        set_mask: zx::Signals,
551    ) -> Result<(), zx_status::Status> {
552        use fidl::Peered;
553        self.inner.channel().signal_peer(clear_mask, set_mask)
554    }
555}
556
557impl CallbacksControlHandle {}
558
559#[must_use = "FIDL methods require a response to be sent"]
560#[derive(Debug)]
561pub struct CallbacksTransportResetResponder {
562    control_handle: std::mem::ManuallyDrop<CallbacksControlHandle>,
563    tx_id: u32,
564}
565
566/// Set the the channel to be shutdown (see [`CallbacksControlHandle::shutdown`])
567/// if the responder is dropped without sending a response, so that the client
568/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
569impl std::ops::Drop for CallbacksTransportResetResponder {
570    fn drop(&mut self) {
571        self.control_handle.shutdown();
572        // Safety: drops once, never accessed again
573        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
574    }
575}
576
577impl fidl::endpoints::Responder for CallbacksTransportResetResponder {
578    type ControlHandle = CallbacksControlHandle;
579
580    fn control_handle(&self) -> &CallbacksControlHandle {
581        &self.control_handle
582    }
583
584    fn drop_without_shutdown(mut self) {
585        // Safety: drops once, never accessed again due to mem::forget
586        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
587        // Prevent Drop from running (which would shut down the channel)
588        std::mem::forget(self);
589    }
590}
591
592impl CallbacksTransportResetResponder {
593    /// Sends a response to the FIDL transaction.
594    ///
595    /// Sets the channel to shutdown if an error occurs.
596    pub fn send(self) -> Result<(), fidl::Error> {
597        let _result = self.send_raw();
598        if _result.is_err() {
599            self.control_handle.shutdown();
600        }
601        self.drop_without_shutdown();
602        _result
603    }
604
605    /// Similar to "send" but does not shutdown the channel if an error occurs.
606    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
607        let _result = self.send_raw();
608        self.drop_without_shutdown();
609        _result
610    }
611
612    fn send_raw(&self) -> Result<(), fidl::Error> {
613        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
614            (),
615            self.tx_id,
616            0x23ba142d8c6a537,
617            fidl::encoding::DynamicFlags::empty(),
618        )
619    }
620}
621
622#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
623pub struct DeviceMarker;
624
625impl fidl::endpoints::ProtocolMarker for DeviceMarker {
626    type Proxy = DeviceProxy;
627    type RequestStream = DeviceRequestStream;
628    #[cfg(target_os = "fuchsia")]
629    type SynchronousProxy = DeviceSynchronousProxy;
630
631    const DEBUG_NAME: &'static str = "fuchsia.hardware.vsock.Device";
632}
633impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
634pub type DeviceStartResult = Result<(), i32>;
635pub type DeviceSendRequestResult = Result<(), i32>;
636pub type DeviceSendShutdownResult = Result<(), i32>;
637pub type DeviceSendRstResult = Result<(), i32>;
638pub type DeviceSendResponseResult = Result<(), i32>;
639
640pub trait DeviceProxyInterface: Send + Sync {
641    type StartResponseFut: std::future::Future<Output = Result<DeviceStartResult, fidl::Error>>
642        + Send;
643    fn r#start(&self, cb: fidl::endpoints::ClientEnd<CallbacksMarker>) -> Self::StartResponseFut;
644    type SendRequestResponseFut: std::future::Future<Output = Result<DeviceSendRequestResult, fidl::Error>>
645        + Send;
646    fn r#send_request(&self, addr: &Addr, data: fidl::Socket) -> Self::SendRequestResponseFut;
647    type SendShutdownResponseFut: std::future::Future<Output = Result<DeviceSendShutdownResult, fidl::Error>>
648        + Send;
649    fn r#send_shutdown(&self, addr: &Addr) -> Self::SendShutdownResponseFut;
650    type SendRstResponseFut: std::future::Future<Output = Result<DeviceSendRstResult, fidl::Error>>
651        + Send;
652    fn r#send_rst(&self, addr: &Addr) -> Self::SendRstResponseFut;
653    type SendResponseResponseFut: std::future::Future<Output = Result<DeviceSendResponseResult, fidl::Error>>
654        + Send;
655    fn r#send_response(&self, addr: &Addr, data: fidl::Socket) -> Self::SendResponseResponseFut;
656    type GetCidResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
657    fn r#get_cid(&self) -> Self::GetCidResponseFut;
658}
659#[derive(Debug)]
660#[cfg(target_os = "fuchsia")]
661pub struct DeviceSynchronousProxy {
662    client: fidl::client::sync::Client,
663}
664
665#[cfg(target_os = "fuchsia")]
666impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
667    type Proxy = DeviceProxy;
668    type Protocol = DeviceMarker;
669
670    fn from_channel(inner: fidl::Channel) -> Self {
671        Self::new(inner)
672    }
673
674    fn into_channel(self) -> fidl::Channel {
675        self.client.into_channel()
676    }
677
678    fn as_channel(&self) -> &fidl::Channel {
679        self.client.as_channel()
680    }
681}
682
683#[cfg(target_os = "fuchsia")]
684impl DeviceSynchronousProxy {
685    pub fn new(channel: fidl::Channel) -> Self {
686        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
687        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
688    }
689
690    pub fn into_channel(self) -> fidl::Channel {
691        self.client.into_channel()
692    }
693
694    /// Waits until an event arrives and returns it. It is safe for other
695    /// threads to make concurrent requests while waiting for an event.
696    pub fn wait_for_event(
697        &self,
698        deadline: zx::MonotonicInstant,
699    ) -> Result<DeviceEvent, fidl::Error> {
700        DeviceEvent::decode(self.client.wait_for_event(deadline)?)
701    }
702
703    pub fn r#start(
704        &self,
705        mut cb: fidl::endpoints::ClientEnd<CallbacksMarker>,
706        ___deadline: zx::MonotonicInstant,
707    ) -> Result<DeviceStartResult, fidl::Error> {
708        let _response = self.client.send_query::<
709            DeviceStartRequest,
710            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
711        >(
712            (cb,),
713            0x3bc3faaec6158f27,
714            fidl::encoding::DynamicFlags::empty(),
715            ___deadline,
716        )?;
717        Ok(_response.map(|x| x))
718    }
719
720    pub fn r#send_request(
721        &self,
722        mut addr: &Addr,
723        mut data: fidl::Socket,
724        ___deadline: zx::MonotonicInstant,
725    ) -> Result<DeviceSendRequestResult, fidl::Error> {
726        let _response = self.client.send_query::<
727            DeviceSendRequestRequest,
728            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
729        >(
730            (addr, data,),
731            0x2dc165540021f74d,
732            fidl::encoding::DynamicFlags::empty(),
733            ___deadline,
734        )?;
735        Ok(_response.map(|x| x))
736    }
737
738    pub fn r#send_shutdown(
739        &self,
740        mut addr: &Addr,
741        ___deadline: zx::MonotonicInstant,
742    ) -> Result<DeviceSendShutdownResult, fidl::Error> {
743        let _response = self.client.send_query::<
744            DeviceSendShutdownRequest,
745            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
746        >(
747            (addr,),
748            0x57cdc7b234933b44,
749            fidl::encoding::DynamicFlags::empty(),
750            ___deadline,
751        )?;
752        Ok(_response.map(|x| x))
753    }
754
755    pub fn r#send_rst(
756        &self,
757        mut addr: &Addr,
758        ___deadline: zx::MonotonicInstant,
759    ) -> Result<DeviceSendRstResult, fidl::Error> {
760        let _response = self.client.send_query::<
761            DeviceSendRstRequest,
762            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
763        >(
764            (addr,),
765            0x334e890ef7cd737c,
766            fidl::encoding::DynamicFlags::empty(),
767            ___deadline,
768        )?;
769        Ok(_response.map(|x| x))
770    }
771
772    pub fn r#send_response(
773        &self,
774        mut addr: &Addr,
775        mut data: fidl::Socket,
776        ___deadline: zx::MonotonicInstant,
777    ) -> Result<DeviceSendResponseResult, fidl::Error> {
778        let _response = self.client.send_query::<
779            DeviceSendResponseRequest,
780            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
781        >(
782            (addr, data,),
783            0x487a35133ffe0672,
784            fidl::encoding::DynamicFlags::empty(),
785            ___deadline,
786        )?;
787        Ok(_response.map(|x| x))
788    }
789
790    pub fn r#get_cid(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
791        let _response =
792            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetCidResponse>(
793                (),
794                0x7cf0847a452feafe,
795                fidl::encoding::DynamicFlags::empty(),
796                ___deadline,
797            )?;
798        Ok(_response.local_cid)
799    }
800}
801
802#[derive(Debug, Clone)]
803pub struct DeviceProxy {
804    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
805}
806
807impl fidl::endpoints::Proxy for DeviceProxy {
808    type Protocol = DeviceMarker;
809
810    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
811        Self::new(inner)
812    }
813
814    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
815        self.client.into_channel().map_err(|client| Self { client })
816    }
817
818    fn as_channel(&self) -> &::fidl::AsyncChannel {
819        self.client.as_channel()
820    }
821}
822
823impl DeviceProxy {
824    /// Create a new Proxy for fuchsia.hardware.vsock/Device.
825    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
826        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
827        Self { client: fidl::client::Client::new(channel, protocol_name) }
828    }
829
830    /// Get a Stream of events from the remote end of the protocol.
831    ///
832    /// # Panics
833    ///
834    /// Panics if the event stream was already taken.
835    pub fn take_event_stream(&self) -> DeviceEventStream {
836        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
837    }
838
839    pub fn r#start(
840        &self,
841        mut cb: fidl::endpoints::ClientEnd<CallbacksMarker>,
842    ) -> fidl::client::QueryResponseFut<
843        DeviceStartResult,
844        fidl::encoding::DefaultFuchsiaResourceDialect,
845    > {
846        DeviceProxyInterface::r#start(self, cb)
847    }
848
849    pub fn r#send_request(
850        &self,
851        mut addr: &Addr,
852        mut data: fidl::Socket,
853    ) -> fidl::client::QueryResponseFut<
854        DeviceSendRequestResult,
855        fidl::encoding::DefaultFuchsiaResourceDialect,
856    > {
857        DeviceProxyInterface::r#send_request(self, addr, data)
858    }
859
860    pub fn r#send_shutdown(
861        &self,
862        mut addr: &Addr,
863    ) -> fidl::client::QueryResponseFut<
864        DeviceSendShutdownResult,
865        fidl::encoding::DefaultFuchsiaResourceDialect,
866    > {
867        DeviceProxyInterface::r#send_shutdown(self, addr)
868    }
869
870    pub fn r#send_rst(
871        &self,
872        mut addr: &Addr,
873    ) -> fidl::client::QueryResponseFut<
874        DeviceSendRstResult,
875        fidl::encoding::DefaultFuchsiaResourceDialect,
876    > {
877        DeviceProxyInterface::r#send_rst(self, addr)
878    }
879
880    pub fn r#send_response(
881        &self,
882        mut addr: &Addr,
883        mut data: fidl::Socket,
884    ) -> fidl::client::QueryResponseFut<
885        DeviceSendResponseResult,
886        fidl::encoding::DefaultFuchsiaResourceDialect,
887    > {
888        DeviceProxyInterface::r#send_response(self, addr, data)
889    }
890
891    pub fn r#get_cid(
892        &self,
893    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
894        DeviceProxyInterface::r#get_cid(self)
895    }
896}
897
898impl DeviceProxyInterface for DeviceProxy {
899    type StartResponseFut = fidl::client::QueryResponseFut<
900        DeviceStartResult,
901        fidl::encoding::DefaultFuchsiaResourceDialect,
902    >;
903    fn r#start(
904        &self,
905        mut cb: fidl::endpoints::ClientEnd<CallbacksMarker>,
906    ) -> Self::StartResponseFut {
907        fn _decode(
908            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
909        ) -> Result<DeviceStartResult, fidl::Error> {
910            let _response = fidl::client::decode_transaction_body::<
911                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
912                fidl::encoding::DefaultFuchsiaResourceDialect,
913                0x3bc3faaec6158f27,
914            >(_buf?)?;
915            Ok(_response.map(|x| x))
916        }
917        self.client.send_query_and_decode::<DeviceStartRequest, DeviceStartResult>(
918            (cb,),
919            0x3bc3faaec6158f27,
920            fidl::encoding::DynamicFlags::empty(),
921            _decode,
922        )
923    }
924
925    type SendRequestResponseFut = fidl::client::QueryResponseFut<
926        DeviceSendRequestResult,
927        fidl::encoding::DefaultFuchsiaResourceDialect,
928    >;
929    fn r#send_request(
930        &self,
931        mut addr: &Addr,
932        mut data: fidl::Socket,
933    ) -> Self::SendRequestResponseFut {
934        fn _decode(
935            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
936        ) -> Result<DeviceSendRequestResult, fidl::Error> {
937            let _response = fidl::client::decode_transaction_body::<
938                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
939                fidl::encoding::DefaultFuchsiaResourceDialect,
940                0x2dc165540021f74d,
941            >(_buf?)?;
942            Ok(_response.map(|x| x))
943        }
944        self.client.send_query_and_decode::<DeviceSendRequestRequest, DeviceSendRequestResult>(
945            (addr, data),
946            0x2dc165540021f74d,
947            fidl::encoding::DynamicFlags::empty(),
948            _decode,
949        )
950    }
951
952    type SendShutdownResponseFut = fidl::client::QueryResponseFut<
953        DeviceSendShutdownResult,
954        fidl::encoding::DefaultFuchsiaResourceDialect,
955    >;
956    fn r#send_shutdown(&self, mut addr: &Addr) -> Self::SendShutdownResponseFut {
957        fn _decode(
958            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
959        ) -> Result<DeviceSendShutdownResult, fidl::Error> {
960            let _response = fidl::client::decode_transaction_body::<
961                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
962                fidl::encoding::DefaultFuchsiaResourceDialect,
963                0x57cdc7b234933b44,
964            >(_buf?)?;
965            Ok(_response.map(|x| x))
966        }
967        self.client.send_query_and_decode::<DeviceSendShutdownRequest, DeviceSendShutdownResult>(
968            (addr,),
969            0x57cdc7b234933b44,
970            fidl::encoding::DynamicFlags::empty(),
971            _decode,
972        )
973    }
974
975    type SendRstResponseFut = fidl::client::QueryResponseFut<
976        DeviceSendRstResult,
977        fidl::encoding::DefaultFuchsiaResourceDialect,
978    >;
979    fn r#send_rst(&self, mut addr: &Addr) -> Self::SendRstResponseFut {
980        fn _decode(
981            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
982        ) -> Result<DeviceSendRstResult, fidl::Error> {
983            let _response = fidl::client::decode_transaction_body::<
984                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
985                fidl::encoding::DefaultFuchsiaResourceDialect,
986                0x334e890ef7cd737c,
987            >(_buf?)?;
988            Ok(_response.map(|x| x))
989        }
990        self.client.send_query_and_decode::<DeviceSendRstRequest, DeviceSendRstResult>(
991            (addr,),
992            0x334e890ef7cd737c,
993            fidl::encoding::DynamicFlags::empty(),
994            _decode,
995        )
996    }
997
998    type SendResponseResponseFut = fidl::client::QueryResponseFut<
999        DeviceSendResponseResult,
1000        fidl::encoding::DefaultFuchsiaResourceDialect,
1001    >;
1002    fn r#send_response(
1003        &self,
1004        mut addr: &Addr,
1005        mut data: fidl::Socket,
1006    ) -> Self::SendResponseResponseFut {
1007        fn _decode(
1008            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1009        ) -> Result<DeviceSendResponseResult, fidl::Error> {
1010            let _response = fidl::client::decode_transaction_body::<
1011                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1012                fidl::encoding::DefaultFuchsiaResourceDialect,
1013                0x487a35133ffe0672,
1014            >(_buf?)?;
1015            Ok(_response.map(|x| x))
1016        }
1017        self.client.send_query_and_decode::<DeviceSendResponseRequest, DeviceSendResponseResult>(
1018            (addr, data),
1019            0x487a35133ffe0672,
1020            fidl::encoding::DynamicFlags::empty(),
1021            _decode,
1022        )
1023    }
1024
1025    type GetCidResponseFut =
1026        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1027    fn r#get_cid(&self) -> Self::GetCidResponseFut {
1028        fn _decode(
1029            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1030        ) -> Result<u32, fidl::Error> {
1031            let _response = fidl::client::decode_transaction_body::<
1032                DeviceGetCidResponse,
1033                fidl::encoding::DefaultFuchsiaResourceDialect,
1034                0x7cf0847a452feafe,
1035            >(_buf?)?;
1036            Ok(_response.local_cid)
1037        }
1038        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
1039            (),
1040            0x7cf0847a452feafe,
1041            fidl::encoding::DynamicFlags::empty(),
1042            _decode,
1043        )
1044    }
1045}
1046
1047pub struct DeviceEventStream {
1048    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1049}
1050
1051impl std::marker::Unpin for DeviceEventStream {}
1052
1053impl futures::stream::FusedStream for DeviceEventStream {
1054    fn is_terminated(&self) -> bool {
1055        self.event_receiver.is_terminated()
1056    }
1057}
1058
1059impl futures::Stream for DeviceEventStream {
1060    type Item = Result<DeviceEvent, fidl::Error>;
1061
1062    fn poll_next(
1063        mut self: std::pin::Pin<&mut Self>,
1064        cx: &mut std::task::Context<'_>,
1065    ) -> std::task::Poll<Option<Self::Item>> {
1066        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1067            &mut self.event_receiver,
1068            cx
1069        )?) {
1070            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
1071            None => std::task::Poll::Ready(None),
1072        }
1073    }
1074}
1075
1076#[derive(Debug)]
1077pub enum DeviceEvent {}
1078
1079impl DeviceEvent {
1080    /// Decodes a message buffer as a [`DeviceEvent`].
1081    fn decode(
1082        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1083    ) -> Result<DeviceEvent, fidl::Error> {
1084        let (bytes, _handles) = buf.split_mut();
1085        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1086        debug_assert_eq!(tx_header.tx_id, 0);
1087        match tx_header.ordinal {
1088            _ => Err(fidl::Error::UnknownOrdinal {
1089                ordinal: tx_header.ordinal,
1090                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1091            }),
1092        }
1093    }
1094}
1095
1096/// A Stream of incoming requests for fuchsia.hardware.vsock/Device.
1097pub struct DeviceRequestStream {
1098    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1099    is_terminated: bool,
1100}
1101
1102impl std::marker::Unpin for DeviceRequestStream {}
1103
1104impl futures::stream::FusedStream for DeviceRequestStream {
1105    fn is_terminated(&self) -> bool {
1106        self.is_terminated
1107    }
1108}
1109
1110impl fidl::endpoints::RequestStream for DeviceRequestStream {
1111    type Protocol = DeviceMarker;
1112    type ControlHandle = DeviceControlHandle;
1113
1114    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1115        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1116    }
1117
1118    fn control_handle(&self) -> Self::ControlHandle {
1119        DeviceControlHandle { inner: self.inner.clone() }
1120    }
1121
1122    fn into_inner(
1123        self,
1124    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1125    {
1126        (self.inner, self.is_terminated)
1127    }
1128
1129    fn from_inner(
1130        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1131        is_terminated: bool,
1132    ) -> Self {
1133        Self { inner, is_terminated }
1134    }
1135}
1136
1137impl futures::Stream for DeviceRequestStream {
1138    type Item = Result<DeviceRequest, fidl::Error>;
1139
1140    fn poll_next(
1141        mut self: std::pin::Pin<&mut Self>,
1142        cx: &mut std::task::Context<'_>,
1143    ) -> std::task::Poll<Option<Self::Item>> {
1144        let this = &mut *self;
1145        if this.inner.check_shutdown(cx) {
1146            this.is_terminated = true;
1147            return std::task::Poll::Ready(None);
1148        }
1149        if this.is_terminated {
1150            panic!("polled DeviceRequestStream after completion");
1151        }
1152        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1153            |bytes, handles| {
1154                match this.inner.channel().read_etc(cx, bytes, handles) {
1155                    std::task::Poll::Ready(Ok(())) => {}
1156                    std::task::Poll::Pending => return std::task::Poll::Pending,
1157                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1158                        this.is_terminated = true;
1159                        return std::task::Poll::Ready(None);
1160                    }
1161                    std::task::Poll::Ready(Err(e)) => {
1162                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1163                            e.into(),
1164                        ))))
1165                    }
1166                }
1167
1168                // A message has been received from the channel
1169                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1170
1171                std::task::Poll::Ready(Some(match header.ordinal {
1172                    0x3bc3faaec6158f27 => {
1173                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1174                        let mut req = fidl::new_empty!(
1175                            DeviceStartRequest,
1176                            fidl::encoding::DefaultFuchsiaResourceDialect
1177                        );
1178                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceStartRequest>(&header, _body_bytes, handles, &mut req)?;
1179                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1180                        Ok(DeviceRequest::Start {
1181                            cb: req.cb,
1182
1183                            responder: DeviceStartResponder {
1184                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1185                                tx_id: header.tx_id,
1186                            },
1187                        })
1188                    }
1189                    0x2dc165540021f74d => {
1190                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1191                        let mut req = fidl::new_empty!(
1192                            DeviceSendRequestRequest,
1193                            fidl::encoding::DefaultFuchsiaResourceDialect
1194                        );
1195                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSendRequestRequest>(&header, _body_bytes, handles, &mut req)?;
1196                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1197                        Ok(DeviceRequest::SendRequest {
1198                            addr: req.addr,
1199                            data: req.data,
1200
1201                            responder: DeviceSendRequestResponder {
1202                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1203                                tx_id: header.tx_id,
1204                            },
1205                        })
1206                    }
1207                    0x57cdc7b234933b44 => {
1208                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1209                        let mut req = fidl::new_empty!(
1210                            DeviceSendShutdownRequest,
1211                            fidl::encoding::DefaultFuchsiaResourceDialect
1212                        );
1213                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSendShutdownRequest>(&header, _body_bytes, handles, &mut req)?;
1214                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1215                        Ok(DeviceRequest::SendShutdown {
1216                            addr: req.addr,
1217
1218                            responder: DeviceSendShutdownResponder {
1219                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1220                                tx_id: header.tx_id,
1221                            },
1222                        })
1223                    }
1224                    0x334e890ef7cd737c => {
1225                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1226                        let mut req = fidl::new_empty!(
1227                            DeviceSendRstRequest,
1228                            fidl::encoding::DefaultFuchsiaResourceDialect
1229                        );
1230                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSendRstRequest>(&header, _body_bytes, handles, &mut req)?;
1231                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1232                        Ok(DeviceRequest::SendRst {
1233                            addr: req.addr,
1234
1235                            responder: DeviceSendRstResponder {
1236                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1237                                tx_id: header.tx_id,
1238                            },
1239                        })
1240                    }
1241                    0x487a35133ffe0672 => {
1242                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1243                        let mut req = fidl::new_empty!(
1244                            DeviceSendResponseRequest,
1245                            fidl::encoding::DefaultFuchsiaResourceDialect
1246                        );
1247                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSendResponseRequest>(&header, _body_bytes, handles, &mut req)?;
1248                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1249                        Ok(DeviceRequest::SendResponse {
1250                            addr: req.addr,
1251                            data: req.data,
1252
1253                            responder: DeviceSendResponseResponder {
1254                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1255                                tx_id: header.tx_id,
1256                            },
1257                        })
1258                    }
1259                    0x7cf0847a452feafe => {
1260                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1261                        let mut req = fidl::new_empty!(
1262                            fidl::encoding::EmptyPayload,
1263                            fidl::encoding::DefaultFuchsiaResourceDialect
1264                        );
1265                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1266                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1267                        Ok(DeviceRequest::GetCid {
1268                            responder: DeviceGetCidResponder {
1269                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1270                                tx_id: header.tx_id,
1271                            },
1272                        })
1273                    }
1274                    _ => Err(fidl::Error::UnknownOrdinal {
1275                        ordinal: header.ordinal,
1276                        protocol_name:
1277                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1278                    }),
1279                }))
1280            },
1281        )
1282    }
1283}
1284
1285#[derive(Debug)]
1286pub enum DeviceRequest {
1287    Start { cb: fidl::endpoints::ClientEnd<CallbacksMarker>, responder: DeviceStartResponder },
1288    SendRequest { addr: Addr, data: fidl::Socket, responder: DeviceSendRequestResponder },
1289    SendShutdown { addr: Addr, responder: DeviceSendShutdownResponder },
1290    SendRst { addr: Addr, responder: DeviceSendRstResponder },
1291    SendResponse { addr: Addr, data: fidl::Socket, responder: DeviceSendResponseResponder },
1292    GetCid { responder: DeviceGetCidResponder },
1293}
1294
1295impl DeviceRequest {
1296    #[allow(irrefutable_let_patterns)]
1297    pub fn into_start(
1298        self,
1299    ) -> Option<(fidl::endpoints::ClientEnd<CallbacksMarker>, DeviceStartResponder)> {
1300        if let DeviceRequest::Start { cb, responder } = self {
1301            Some((cb, responder))
1302        } else {
1303            None
1304        }
1305    }
1306
1307    #[allow(irrefutable_let_patterns)]
1308    pub fn into_send_request(self) -> Option<(Addr, fidl::Socket, DeviceSendRequestResponder)> {
1309        if let DeviceRequest::SendRequest { addr, data, responder } = self {
1310            Some((addr, data, responder))
1311        } else {
1312            None
1313        }
1314    }
1315
1316    #[allow(irrefutable_let_patterns)]
1317    pub fn into_send_shutdown(self) -> Option<(Addr, DeviceSendShutdownResponder)> {
1318        if let DeviceRequest::SendShutdown { addr, responder } = self {
1319            Some((addr, responder))
1320        } else {
1321            None
1322        }
1323    }
1324
1325    #[allow(irrefutable_let_patterns)]
1326    pub fn into_send_rst(self) -> Option<(Addr, DeviceSendRstResponder)> {
1327        if let DeviceRequest::SendRst { addr, responder } = self {
1328            Some((addr, responder))
1329        } else {
1330            None
1331        }
1332    }
1333
1334    #[allow(irrefutable_let_patterns)]
1335    pub fn into_send_response(self) -> Option<(Addr, fidl::Socket, DeviceSendResponseResponder)> {
1336        if let DeviceRequest::SendResponse { addr, data, responder } = self {
1337            Some((addr, data, responder))
1338        } else {
1339            None
1340        }
1341    }
1342
1343    #[allow(irrefutable_let_patterns)]
1344    pub fn into_get_cid(self) -> Option<(DeviceGetCidResponder)> {
1345        if let DeviceRequest::GetCid { responder } = self {
1346            Some((responder))
1347        } else {
1348            None
1349        }
1350    }
1351
1352    /// Name of the method defined in FIDL
1353    pub fn method_name(&self) -> &'static str {
1354        match *self {
1355            DeviceRequest::Start { .. } => "start",
1356            DeviceRequest::SendRequest { .. } => "send_request",
1357            DeviceRequest::SendShutdown { .. } => "send_shutdown",
1358            DeviceRequest::SendRst { .. } => "send_rst",
1359            DeviceRequest::SendResponse { .. } => "send_response",
1360            DeviceRequest::GetCid { .. } => "get_cid",
1361        }
1362    }
1363}
1364
1365#[derive(Debug, Clone)]
1366pub struct DeviceControlHandle {
1367    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1368}
1369
1370impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1371    fn shutdown(&self) {
1372        self.inner.shutdown()
1373    }
1374    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1375        self.inner.shutdown_with_epitaph(status)
1376    }
1377
1378    fn is_closed(&self) -> bool {
1379        self.inner.channel().is_closed()
1380    }
1381    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1382        self.inner.channel().on_closed()
1383    }
1384
1385    #[cfg(target_os = "fuchsia")]
1386    fn signal_peer(
1387        &self,
1388        clear_mask: zx::Signals,
1389        set_mask: zx::Signals,
1390    ) -> Result<(), zx_status::Status> {
1391        use fidl::Peered;
1392        self.inner.channel().signal_peer(clear_mask, set_mask)
1393    }
1394}
1395
1396impl DeviceControlHandle {}
1397
1398#[must_use = "FIDL methods require a response to be sent"]
1399#[derive(Debug)]
1400pub struct DeviceStartResponder {
1401    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1402    tx_id: u32,
1403}
1404
1405/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1406/// if the responder is dropped without sending a response, so that the client
1407/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1408impl std::ops::Drop for DeviceStartResponder {
1409    fn drop(&mut self) {
1410        self.control_handle.shutdown();
1411        // Safety: drops once, never accessed again
1412        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1413    }
1414}
1415
1416impl fidl::endpoints::Responder for DeviceStartResponder {
1417    type ControlHandle = DeviceControlHandle;
1418
1419    fn control_handle(&self) -> &DeviceControlHandle {
1420        &self.control_handle
1421    }
1422
1423    fn drop_without_shutdown(mut self) {
1424        // Safety: drops once, never accessed again due to mem::forget
1425        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1426        // Prevent Drop from running (which would shut down the channel)
1427        std::mem::forget(self);
1428    }
1429}
1430
1431impl DeviceStartResponder {
1432    /// Sends a response to the FIDL transaction.
1433    ///
1434    /// Sets the channel to shutdown if an error occurs.
1435    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1436        let _result = self.send_raw(result);
1437        if _result.is_err() {
1438            self.control_handle.shutdown();
1439        }
1440        self.drop_without_shutdown();
1441        _result
1442    }
1443
1444    /// Similar to "send" but does not shutdown the channel if an error occurs.
1445    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1446        let _result = self.send_raw(result);
1447        self.drop_without_shutdown();
1448        _result
1449    }
1450
1451    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1452        self.control_handle
1453            .inner
1454            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1455                result,
1456                self.tx_id,
1457                0x3bc3faaec6158f27,
1458                fidl::encoding::DynamicFlags::empty(),
1459            )
1460    }
1461}
1462
1463#[must_use = "FIDL methods require a response to be sent"]
1464#[derive(Debug)]
1465pub struct DeviceSendRequestResponder {
1466    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1467    tx_id: u32,
1468}
1469
1470/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1471/// if the responder is dropped without sending a response, so that the client
1472/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1473impl std::ops::Drop for DeviceSendRequestResponder {
1474    fn drop(&mut self) {
1475        self.control_handle.shutdown();
1476        // Safety: drops once, never accessed again
1477        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1478    }
1479}
1480
1481impl fidl::endpoints::Responder for DeviceSendRequestResponder {
1482    type ControlHandle = DeviceControlHandle;
1483
1484    fn control_handle(&self) -> &DeviceControlHandle {
1485        &self.control_handle
1486    }
1487
1488    fn drop_without_shutdown(mut self) {
1489        // Safety: drops once, never accessed again due to mem::forget
1490        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1491        // Prevent Drop from running (which would shut down the channel)
1492        std::mem::forget(self);
1493    }
1494}
1495
1496impl DeviceSendRequestResponder {
1497    /// Sends a response to the FIDL transaction.
1498    ///
1499    /// Sets the channel to shutdown if an error occurs.
1500    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1501        let _result = self.send_raw(result);
1502        if _result.is_err() {
1503            self.control_handle.shutdown();
1504        }
1505        self.drop_without_shutdown();
1506        _result
1507    }
1508
1509    /// Similar to "send" but does not shutdown the channel if an error occurs.
1510    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1511        let _result = self.send_raw(result);
1512        self.drop_without_shutdown();
1513        _result
1514    }
1515
1516    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1517        self.control_handle
1518            .inner
1519            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1520                result,
1521                self.tx_id,
1522                0x2dc165540021f74d,
1523                fidl::encoding::DynamicFlags::empty(),
1524            )
1525    }
1526}
1527
1528#[must_use = "FIDL methods require a response to be sent"]
1529#[derive(Debug)]
1530pub struct DeviceSendShutdownResponder {
1531    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1532    tx_id: u32,
1533}
1534
1535/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1536/// if the responder is dropped without sending a response, so that the client
1537/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1538impl std::ops::Drop for DeviceSendShutdownResponder {
1539    fn drop(&mut self) {
1540        self.control_handle.shutdown();
1541        // Safety: drops once, never accessed again
1542        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1543    }
1544}
1545
1546impl fidl::endpoints::Responder for DeviceSendShutdownResponder {
1547    type ControlHandle = DeviceControlHandle;
1548
1549    fn control_handle(&self) -> &DeviceControlHandle {
1550        &self.control_handle
1551    }
1552
1553    fn drop_without_shutdown(mut self) {
1554        // Safety: drops once, never accessed again due to mem::forget
1555        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1556        // Prevent Drop from running (which would shut down the channel)
1557        std::mem::forget(self);
1558    }
1559}
1560
1561impl DeviceSendShutdownResponder {
1562    /// Sends a response to the FIDL transaction.
1563    ///
1564    /// Sets the channel to shutdown if an error occurs.
1565    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1566        let _result = self.send_raw(result);
1567        if _result.is_err() {
1568            self.control_handle.shutdown();
1569        }
1570        self.drop_without_shutdown();
1571        _result
1572    }
1573
1574    /// Similar to "send" but does not shutdown the channel if an error occurs.
1575    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1576        let _result = self.send_raw(result);
1577        self.drop_without_shutdown();
1578        _result
1579    }
1580
1581    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1582        self.control_handle
1583            .inner
1584            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1585                result,
1586                self.tx_id,
1587                0x57cdc7b234933b44,
1588                fidl::encoding::DynamicFlags::empty(),
1589            )
1590    }
1591}
1592
1593#[must_use = "FIDL methods require a response to be sent"]
1594#[derive(Debug)]
1595pub struct DeviceSendRstResponder {
1596    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1597    tx_id: u32,
1598}
1599
1600/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1601/// if the responder is dropped without sending a response, so that the client
1602/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1603impl std::ops::Drop for DeviceSendRstResponder {
1604    fn drop(&mut self) {
1605        self.control_handle.shutdown();
1606        // Safety: drops once, never accessed again
1607        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1608    }
1609}
1610
1611impl fidl::endpoints::Responder for DeviceSendRstResponder {
1612    type ControlHandle = DeviceControlHandle;
1613
1614    fn control_handle(&self) -> &DeviceControlHandle {
1615        &self.control_handle
1616    }
1617
1618    fn drop_without_shutdown(mut self) {
1619        // Safety: drops once, never accessed again due to mem::forget
1620        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1621        // Prevent Drop from running (which would shut down the channel)
1622        std::mem::forget(self);
1623    }
1624}
1625
1626impl DeviceSendRstResponder {
1627    /// Sends a response to the FIDL transaction.
1628    ///
1629    /// Sets the channel to shutdown if an error occurs.
1630    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1631        let _result = self.send_raw(result);
1632        if _result.is_err() {
1633            self.control_handle.shutdown();
1634        }
1635        self.drop_without_shutdown();
1636        _result
1637    }
1638
1639    /// Similar to "send" but does not shutdown the channel if an error occurs.
1640    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1641        let _result = self.send_raw(result);
1642        self.drop_without_shutdown();
1643        _result
1644    }
1645
1646    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1647        self.control_handle
1648            .inner
1649            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1650                result,
1651                self.tx_id,
1652                0x334e890ef7cd737c,
1653                fidl::encoding::DynamicFlags::empty(),
1654            )
1655    }
1656}
1657
1658#[must_use = "FIDL methods require a response to be sent"]
1659#[derive(Debug)]
1660pub struct DeviceSendResponseResponder {
1661    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1662    tx_id: u32,
1663}
1664
1665/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1666/// if the responder is dropped without sending a response, so that the client
1667/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1668impl std::ops::Drop for DeviceSendResponseResponder {
1669    fn drop(&mut self) {
1670        self.control_handle.shutdown();
1671        // Safety: drops once, never accessed again
1672        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1673    }
1674}
1675
1676impl fidl::endpoints::Responder for DeviceSendResponseResponder {
1677    type ControlHandle = DeviceControlHandle;
1678
1679    fn control_handle(&self) -> &DeviceControlHandle {
1680        &self.control_handle
1681    }
1682
1683    fn drop_without_shutdown(mut self) {
1684        // Safety: drops once, never accessed again due to mem::forget
1685        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1686        // Prevent Drop from running (which would shut down the channel)
1687        std::mem::forget(self);
1688    }
1689}
1690
1691impl DeviceSendResponseResponder {
1692    /// Sends a response to the FIDL transaction.
1693    ///
1694    /// Sets the channel to shutdown if an error occurs.
1695    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1696        let _result = self.send_raw(result);
1697        if _result.is_err() {
1698            self.control_handle.shutdown();
1699        }
1700        self.drop_without_shutdown();
1701        _result
1702    }
1703
1704    /// Similar to "send" but does not shutdown the channel if an error occurs.
1705    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1706        let _result = self.send_raw(result);
1707        self.drop_without_shutdown();
1708        _result
1709    }
1710
1711    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1712        self.control_handle
1713            .inner
1714            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1715                result,
1716                self.tx_id,
1717                0x487a35133ffe0672,
1718                fidl::encoding::DynamicFlags::empty(),
1719            )
1720    }
1721}
1722
1723#[must_use = "FIDL methods require a response to be sent"]
1724#[derive(Debug)]
1725pub struct DeviceGetCidResponder {
1726    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1727    tx_id: u32,
1728}
1729
1730/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1731/// if the responder is dropped without sending a response, so that the client
1732/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1733impl std::ops::Drop for DeviceGetCidResponder {
1734    fn drop(&mut self) {
1735        self.control_handle.shutdown();
1736        // Safety: drops once, never accessed again
1737        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1738    }
1739}
1740
1741impl fidl::endpoints::Responder for DeviceGetCidResponder {
1742    type ControlHandle = DeviceControlHandle;
1743
1744    fn control_handle(&self) -> &DeviceControlHandle {
1745        &self.control_handle
1746    }
1747
1748    fn drop_without_shutdown(mut self) {
1749        // Safety: drops once, never accessed again due to mem::forget
1750        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1751        // Prevent Drop from running (which would shut down the channel)
1752        std::mem::forget(self);
1753    }
1754}
1755
1756impl DeviceGetCidResponder {
1757    /// Sends a response to the FIDL transaction.
1758    ///
1759    /// Sets the channel to shutdown if an error occurs.
1760    pub fn send(self, mut local_cid: u32) -> Result<(), fidl::Error> {
1761        let _result = self.send_raw(local_cid);
1762        if _result.is_err() {
1763            self.control_handle.shutdown();
1764        }
1765        self.drop_without_shutdown();
1766        _result
1767    }
1768
1769    /// Similar to "send" but does not shutdown the channel if an error occurs.
1770    pub fn send_no_shutdown_on_err(self, mut local_cid: u32) -> Result<(), fidl::Error> {
1771        let _result = self.send_raw(local_cid);
1772        self.drop_without_shutdown();
1773        _result
1774    }
1775
1776    fn send_raw(&self, mut local_cid: u32) -> Result<(), fidl::Error> {
1777        self.control_handle.inner.send::<DeviceGetCidResponse>(
1778            (local_cid,),
1779            self.tx_id,
1780            0x7cf0847a452feafe,
1781            fidl::encoding::DynamicFlags::empty(),
1782        )
1783    }
1784}
1785
1786#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1787pub struct ServiceMarker;
1788
1789#[cfg(target_os = "fuchsia")]
1790impl fidl::endpoints::ServiceMarker for ServiceMarker {
1791    type Proxy = ServiceProxy;
1792    type Request = ServiceRequest;
1793    const SERVICE_NAME: &'static str = "fuchsia.hardware.vsock.Service";
1794}
1795
1796/// A request for one of the member protocols of Service.
1797///
1798#[cfg(target_os = "fuchsia")]
1799pub enum ServiceRequest {
1800    Device(DeviceRequestStream),
1801}
1802
1803#[cfg(target_os = "fuchsia")]
1804impl fidl::endpoints::ServiceRequest for ServiceRequest {
1805    type Service = ServiceMarker;
1806
1807    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1808        match name {
1809            "device" => Self::Device(
1810                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1811            ),
1812            _ => panic!("no such member protocol name for service Service"),
1813        }
1814    }
1815
1816    fn member_names() -> &'static [&'static str] {
1817        &["device"]
1818    }
1819}
1820#[cfg(target_os = "fuchsia")]
1821pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1822
1823#[cfg(target_os = "fuchsia")]
1824impl fidl::endpoints::ServiceProxy for ServiceProxy {
1825    type Service = ServiceMarker;
1826
1827    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1828        Self(opener)
1829    }
1830}
1831
1832#[cfg(target_os = "fuchsia")]
1833impl ServiceProxy {
1834    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1835        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1836        self.connect_channel_to_device(server_end)?;
1837        Ok(proxy)
1838    }
1839
1840    /// Like `connect_to_device`, but returns a sync proxy.
1841    /// See [`Self::connect_to_device`] for more details.
1842    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1843        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1844        self.connect_channel_to_device(server_end)?;
1845        Ok(proxy)
1846    }
1847
1848    /// Like `connect_to_device`, but accepts a server end.
1849    /// See [`Self::connect_to_device`] for more details.
1850    pub fn connect_channel_to_device(
1851        &self,
1852        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1853    ) -> Result<(), fidl::Error> {
1854        self.0.open_member("device", server_end.into_channel())
1855    }
1856
1857    pub fn instance_name(&self) -> &str {
1858        self.0.instance_name()
1859    }
1860}
1861
1862mod internal {
1863    use super::*;
1864
1865    impl fidl::encoding::ResourceTypeMarker for DeviceSendRequestRequest {
1866        type Borrowed<'a> = &'a mut Self;
1867        fn take_or_borrow<'a>(
1868            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1869        ) -> Self::Borrowed<'a> {
1870            value
1871        }
1872    }
1873
1874    unsafe impl fidl::encoding::TypeMarker for DeviceSendRequestRequest {
1875        type Owned = Self;
1876
1877        #[inline(always)]
1878        fn inline_align(_context: fidl::encoding::Context) -> usize {
1879            4
1880        }
1881
1882        #[inline(always)]
1883        fn inline_size(_context: fidl::encoding::Context) -> usize {
1884            16
1885        }
1886    }
1887
1888    unsafe impl
1889        fidl::encoding::Encode<
1890            DeviceSendRequestRequest,
1891            fidl::encoding::DefaultFuchsiaResourceDialect,
1892        > for &mut DeviceSendRequestRequest
1893    {
1894        #[inline]
1895        unsafe fn encode(
1896            self,
1897            encoder: &mut fidl::encoding::Encoder<
1898                '_,
1899                fidl::encoding::DefaultFuchsiaResourceDialect,
1900            >,
1901            offset: usize,
1902            _depth: fidl::encoding::Depth,
1903        ) -> fidl::Result<()> {
1904            encoder.debug_check_bounds::<DeviceSendRequestRequest>(offset);
1905            // Delegate to tuple encoding.
1906            fidl::encoding::Encode::<
1907                DeviceSendRequestRequest,
1908                fidl::encoding::DefaultFuchsiaResourceDialect,
1909            >::encode(
1910                (
1911                    <Addr as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
1912                    <fidl::encoding::HandleType<
1913                        fidl::Socket,
1914                        { fidl::ObjectType::SOCKET.into_raw() },
1915                        2147483648,
1916                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1917                        &mut self.data
1918                    ),
1919                ),
1920                encoder,
1921                offset,
1922                _depth,
1923            )
1924        }
1925    }
1926    unsafe impl<
1927            T0: fidl::encoding::Encode<Addr, fidl::encoding::DefaultFuchsiaResourceDialect>,
1928            T1: fidl::encoding::Encode<
1929                fidl::encoding::HandleType<
1930                    fidl::Socket,
1931                    { fidl::ObjectType::SOCKET.into_raw() },
1932                    2147483648,
1933                >,
1934                fidl::encoding::DefaultFuchsiaResourceDialect,
1935            >,
1936        >
1937        fidl::encoding::Encode<
1938            DeviceSendRequestRequest,
1939            fidl::encoding::DefaultFuchsiaResourceDialect,
1940        > for (T0, T1)
1941    {
1942        #[inline]
1943        unsafe fn encode(
1944            self,
1945            encoder: &mut fidl::encoding::Encoder<
1946                '_,
1947                fidl::encoding::DefaultFuchsiaResourceDialect,
1948            >,
1949            offset: usize,
1950            depth: fidl::encoding::Depth,
1951        ) -> fidl::Result<()> {
1952            encoder.debug_check_bounds::<DeviceSendRequestRequest>(offset);
1953            // Zero out padding regions. There's no need to apply masks
1954            // because the unmasked parts will be overwritten by fields.
1955            // Write the fields.
1956            self.0.encode(encoder, offset + 0, depth)?;
1957            self.1.encode(encoder, offset + 12, depth)?;
1958            Ok(())
1959        }
1960    }
1961
1962    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1963        for DeviceSendRequestRequest
1964    {
1965        #[inline(always)]
1966        fn new_empty() -> Self {
1967            Self {
1968                addr: fidl::new_empty!(Addr, fidl::encoding::DefaultFuchsiaResourceDialect),
1969                data: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1970            }
1971        }
1972
1973        #[inline]
1974        unsafe fn decode(
1975            &mut self,
1976            decoder: &mut fidl::encoding::Decoder<
1977                '_,
1978                fidl::encoding::DefaultFuchsiaResourceDialect,
1979            >,
1980            offset: usize,
1981            _depth: fidl::encoding::Depth,
1982        ) -> fidl::Result<()> {
1983            decoder.debug_check_bounds::<Self>(offset);
1984            // Verify that padding bytes are zero.
1985            fidl::decode!(
1986                Addr,
1987                fidl::encoding::DefaultFuchsiaResourceDialect,
1988                &mut self.addr,
1989                decoder,
1990                offset + 0,
1991                _depth
1992            )?;
1993            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.data, decoder, offset + 12, _depth)?;
1994            Ok(())
1995        }
1996    }
1997
1998    impl fidl::encoding::ResourceTypeMarker for DeviceSendResponseRequest {
1999        type Borrowed<'a> = &'a mut Self;
2000        fn take_or_borrow<'a>(
2001            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2002        ) -> Self::Borrowed<'a> {
2003            value
2004        }
2005    }
2006
2007    unsafe impl fidl::encoding::TypeMarker for DeviceSendResponseRequest {
2008        type Owned = Self;
2009
2010        #[inline(always)]
2011        fn inline_align(_context: fidl::encoding::Context) -> usize {
2012            4
2013        }
2014
2015        #[inline(always)]
2016        fn inline_size(_context: fidl::encoding::Context) -> usize {
2017            16
2018        }
2019    }
2020
2021    unsafe impl
2022        fidl::encoding::Encode<
2023            DeviceSendResponseRequest,
2024            fidl::encoding::DefaultFuchsiaResourceDialect,
2025        > for &mut DeviceSendResponseRequest
2026    {
2027        #[inline]
2028        unsafe fn encode(
2029            self,
2030            encoder: &mut fidl::encoding::Encoder<
2031                '_,
2032                fidl::encoding::DefaultFuchsiaResourceDialect,
2033            >,
2034            offset: usize,
2035            _depth: fidl::encoding::Depth,
2036        ) -> fidl::Result<()> {
2037            encoder.debug_check_bounds::<DeviceSendResponseRequest>(offset);
2038            // Delegate to tuple encoding.
2039            fidl::encoding::Encode::<
2040                DeviceSendResponseRequest,
2041                fidl::encoding::DefaultFuchsiaResourceDialect,
2042            >::encode(
2043                (
2044                    <Addr as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
2045                    <fidl::encoding::HandleType<
2046                        fidl::Socket,
2047                        { fidl::ObjectType::SOCKET.into_raw() },
2048                        2147483648,
2049                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2050                        &mut self.data
2051                    ),
2052                ),
2053                encoder,
2054                offset,
2055                _depth,
2056            )
2057        }
2058    }
2059    unsafe impl<
2060            T0: fidl::encoding::Encode<Addr, fidl::encoding::DefaultFuchsiaResourceDialect>,
2061            T1: fidl::encoding::Encode<
2062                fidl::encoding::HandleType<
2063                    fidl::Socket,
2064                    { fidl::ObjectType::SOCKET.into_raw() },
2065                    2147483648,
2066                >,
2067                fidl::encoding::DefaultFuchsiaResourceDialect,
2068            >,
2069        >
2070        fidl::encoding::Encode<
2071            DeviceSendResponseRequest,
2072            fidl::encoding::DefaultFuchsiaResourceDialect,
2073        > for (T0, T1)
2074    {
2075        #[inline]
2076        unsafe fn encode(
2077            self,
2078            encoder: &mut fidl::encoding::Encoder<
2079                '_,
2080                fidl::encoding::DefaultFuchsiaResourceDialect,
2081            >,
2082            offset: usize,
2083            depth: fidl::encoding::Depth,
2084        ) -> fidl::Result<()> {
2085            encoder.debug_check_bounds::<DeviceSendResponseRequest>(offset);
2086            // Zero out padding regions. There's no need to apply masks
2087            // because the unmasked parts will be overwritten by fields.
2088            // Write the fields.
2089            self.0.encode(encoder, offset + 0, depth)?;
2090            self.1.encode(encoder, offset + 12, depth)?;
2091            Ok(())
2092        }
2093    }
2094
2095    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2096        for DeviceSendResponseRequest
2097    {
2098        #[inline(always)]
2099        fn new_empty() -> Self {
2100            Self {
2101                addr: fidl::new_empty!(Addr, fidl::encoding::DefaultFuchsiaResourceDialect),
2102                data: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2103            }
2104        }
2105
2106        #[inline]
2107        unsafe fn decode(
2108            &mut self,
2109            decoder: &mut fidl::encoding::Decoder<
2110                '_,
2111                fidl::encoding::DefaultFuchsiaResourceDialect,
2112            >,
2113            offset: usize,
2114            _depth: fidl::encoding::Depth,
2115        ) -> fidl::Result<()> {
2116            decoder.debug_check_bounds::<Self>(offset);
2117            // Verify that padding bytes are zero.
2118            fidl::decode!(
2119                Addr,
2120                fidl::encoding::DefaultFuchsiaResourceDialect,
2121                &mut self.addr,
2122                decoder,
2123                offset + 0,
2124                _depth
2125            )?;
2126            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.data, decoder, offset + 12, _depth)?;
2127            Ok(())
2128        }
2129    }
2130
2131    impl fidl::encoding::ResourceTypeMarker for DeviceStartRequest {
2132        type Borrowed<'a> = &'a mut Self;
2133        fn take_or_borrow<'a>(
2134            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2135        ) -> Self::Borrowed<'a> {
2136            value
2137        }
2138    }
2139
2140    unsafe impl fidl::encoding::TypeMarker for DeviceStartRequest {
2141        type Owned = Self;
2142
2143        #[inline(always)]
2144        fn inline_align(_context: fidl::encoding::Context) -> usize {
2145            4
2146        }
2147
2148        #[inline(always)]
2149        fn inline_size(_context: fidl::encoding::Context) -> usize {
2150            4
2151        }
2152    }
2153
2154    unsafe impl
2155        fidl::encoding::Encode<DeviceStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2156        for &mut DeviceStartRequest
2157    {
2158        #[inline]
2159        unsafe fn encode(
2160            self,
2161            encoder: &mut fidl::encoding::Encoder<
2162                '_,
2163                fidl::encoding::DefaultFuchsiaResourceDialect,
2164            >,
2165            offset: usize,
2166            _depth: fidl::encoding::Depth,
2167        ) -> fidl::Result<()> {
2168            encoder.debug_check_bounds::<DeviceStartRequest>(offset);
2169            // Delegate to tuple encoding.
2170            fidl::encoding::Encode::<DeviceStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2171                (
2172                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbacksMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.cb),
2173                ),
2174                encoder, offset, _depth
2175            )
2176        }
2177    }
2178    unsafe impl<
2179            T0: fidl::encoding::Encode<
2180                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbacksMarker>>,
2181                fidl::encoding::DefaultFuchsiaResourceDialect,
2182            >,
2183        >
2184        fidl::encoding::Encode<DeviceStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2185        for (T0,)
2186    {
2187        #[inline]
2188        unsafe fn encode(
2189            self,
2190            encoder: &mut fidl::encoding::Encoder<
2191                '_,
2192                fidl::encoding::DefaultFuchsiaResourceDialect,
2193            >,
2194            offset: usize,
2195            depth: fidl::encoding::Depth,
2196        ) -> fidl::Result<()> {
2197            encoder.debug_check_bounds::<DeviceStartRequest>(offset);
2198            // Zero out padding regions. There's no need to apply masks
2199            // because the unmasked parts will be overwritten by fields.
2200            // Write the fields.
2201            self.0.encode(encoder, offset + 0, depth)?;
2202            Ok(())
2203        }
2204    }
2205
2206    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2207        for DeviceStartRequest
2208    {
2209        #[inline(always)]
2210        fn new_empty() -> Self {
2211            Self {
2212                cb: fidl::new_empty!(
2213                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbacksMarker>>,
2214                    fidl::encoding::DefaultFuchsiaResourceDialect
2215                ),
2216            }
2217        }
2218
2219        #[inline]
2220        unsafe fn decode(
2221            &mut self,
2222            decoder: &mut fidl::encoding::Decoder<
2223                '_,
2224                fidl::encoding::DefaultFuchsiaResourceDialect,
2225            >,
2226            offset: usize,
2227            _depth: fidl::encoding::Depth,
2228        ) -> fidl::Result<()> {
2229            decoder.debug_check_bounds::<Self>(offset);
2230            // Verify that padding bytes are zero.
2231            fidl::decode!(
2232                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbacksMarker>>,
2233                fidl::encoding::DefaultFuchsiaResourceDialect,
2234                &mut self.cb,
2235                decoder,
2236                offset + 0,
2237                _depth
2238            )?;
2239            Ok(())
2240        }
2241    }
2242}