Skip to main content

fidl_fuchsia_developer_remotecontrol_connector/
fidl_fuchsia_developer_remotecontrol_connector.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_developer_remotecontrol_connector_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ConnectorEstablishCircuitRequest {
16    pub id: u64,
17    pub socket: fidl::Socket,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for ConnectorEstablishCircuitRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct ConnectorFdomainToolboxSocketRequest {
27    pub socket: fidl::Socket,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for ConnectorFdomainToolboxSocketRequest
32{
33}
34
35#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
36pub struct ConnectorMarker;
37
38impl fidl::endpoints::ProtocolMarker for ConnectorMarker {
39    type Proxy = ConnectorProxy;
40    type RequestStream = ConnectorRequestStream;
41    #[cfg(target_os = "fuchsia")]
42    type SynchronousProxy = ConnectorSynchronousProxy;
43
44    const DEBUG_NAME: &'static str = "fuchsia.developer.remotecontrol.connector.Connector";
45}
46impl fidl::endpoints::DiscoverableProtocolMarker for ConnectorMarker {}
47
48pub trait ConnectorProxyInterface: Send + Sync {
49    type EstablishCircuitResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
50    fn r#establish_circuit(
51        &self,
52        id: u64,
53        socket: fidl::Socket,
54    ) -> Self::EstablishCircuitResponseFut;
55    type FdomainToolboxSocketResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
56        + Send;
57    fn r#fdomain_toolbox_socket(
58        &self,
59        socket: fidl::Socket,
60    ) -> Self::FdomainToolboxSocketResponseFut;
61}
62#[derive(Debug)]
63#[cfg(target_os = "fuchsia")]
64pub struct ConnectorSynchronousProxy {
65    client: fidl::client::sync::Client,
66}
67
68#[cfg(target_os = "fuchsia")]
69impl fidl::endpoints::SynchronousProxy for ConnectorSynchronousProxy {
70    type Proxy = ConnectorProxy;
71    type Protocol = ConnectorMarker;
72
73    fn from_channel(inner: fidl::Channel) -> Self {
74        Self::new(inner)
75    }
76
77    fn into_channel(self) -> fidl::Channel {
78        self.client.into_channel()
79    }
80
81    fn as_channel(&self) -> &fidl::Channel {
82        self.client.as_channel()
83    }
84}
85
86#[cfg(target_os = "fuchsia")]
87impl ConnectorSynchronousProxy {
88    pub fn new(channel: fidl::Channel) -> Self {
89        Self { client: fidl::client::sync::Client::new(channel) }
90    }
91
92    pub fn into_channel(self) -> fidl::Channel {
93        self.client.into_channel()
94    }
95
96    /// Waits until an event arrives and returns it. It is safe for other
97    /// threads to make concurrent requests while waiting for an event.
98    pub fn wait_for_event(
99        &self,
100        deadline: zx::MonotonicInstant,
101    ) -> Result<ConnectorEvent, fidl::Error> {
102        ConnectorEvent::decode(self.client.wait_for_event::<ConnectorMarker>(deadline)?)
103    }
104
105    pub fn r#establish_circuit(
106        &self,
107        mut id: u64,
108        mut socket: fidl::Socket,
109        ___deadline: zx::MonotonicInstant,
110    ) -> Result<u64, fidl::Error> {
111        let _response = self.client.send_query::<
112            ConnectorEstablishCircuitRequest,
113            ConnectorEstablishCircuitResponse,
114            ConnectorMarker,
115        >(
116            (id, socket,),
117            0x34f64270f6eb7feb,
118            fidl::encoding::DynamicFlags::empty(),
119            ___deadline,
120        )?;
121        Ok(_response.overnet_id)
122    }
123
124    pub fn r#fdomain_toolbox_socket(
125        &self,
126        mut socket: fidl::Socket,
127        ___deadline: zx::MonotonicInstant,
128    ) -> Result<(), fidl::Error> {
129        let _response = self.client.send_query::<
130            ConnectorFdomainToolboxSocketRequest,
131            fidl::encoding::EmptyPayload,
132            ConnectorMarker,
133        >(
134            (socket,),
135            0x6fec63852eec8566,
136            fidl::encoding::DynamicFlags::empty(),
137            ___deadline,
138        )?;
139        Ok(_response)
140    }
141}
142
143#[cfg(target_os = "fuchsia")]
144impl From<ConnectorSynchronousProxy> for zx::NullableHandle {
145    fn from(value: ConnectorSynchronousProxy) -> Self {
146        value.into_channel().into()
147    }
148}
149
150#[cfg(target_os = "fuchsia")]
151impl From<fidl::Channel> for ConnectorSynchronousProxy {
152    fn from(value: fidl::Channel) -> Self {
153        Self::new(value)
154    }
155}
156
157#[cfg(target_os = "fuchsia")]
158impl fidl::endpoints::FromClient for ConnectorSynchronousProxy {
159    type Protocol = ConnectorMarker;
160
161    fn from_client(value: fidl::endpoints::ClientEnd<ConnectorMarker>) -> Self {
162        Self::new(value.into_channel())
163    }
164}
165
166#[derive(Debug, Clone)]
167pub struct ConnectorProxy {
168    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
169}
170
171impl fidl::endpoints::Proxy for ConnectorProxy {
172    type Protocol = ConnectorMarker;
173
174    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
175        Self::new(inner)
176    }
177
178    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
179        self.client.into_channel().map_err(|client| Self { client })
180    }
181
182    fn as_channel(&self) -> &::fidl::AsyncChannel {
183        self.client.as_channel()
184    }
185}
186
187impl ConnectorProxy {
188    /// Create a new Proxy for fuchsia.developer.remotecontrol.connector/Connector.
189    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
190        let protocol_name = <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
191        Self { client: fidl::client::Client::new(channel, protocol_name) }
192    }
193
194    /// Get a Stream of events from the remote end of the protocol.
195    ///
196    /// # Panics
197    ///
198    /// Panics if the event stream was already taken.
199    pub fn take_event_stream(&self) -> ConnectorEventStream {
200        ConnectorEventStream { event_receiver: self.client.take_event_receiver() }
201    }
202
203    pub fn r#establish_circuit(
204        &self,
205        mut id: u64,
206        mut socket: fidl::Socket,
207    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
208        ConnectorProxyInterface::r#establish_circuit(self, id, socket)
209    }
210
211    pub fn r#fdomain_toolbox_socket(
212        &self,
213        mut socket: fidl::Socket,
214    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
215        ConnectorProxyInterface::r#fdomain_toolbox_socket(self, socket)
216    }
217}
218
219impl ConnectorProxyInterface for ConnectorProxy {
220    type EstablishCircuitResponseFut =
221        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
222    fn r#establish_circuit(
223        &self,
224        mut id: u64,
225        mut socket: fidl::Socket,
226    ) -> Self::EstablishCircuitResponseFut {
227        fn _decode(
228            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
229        ) -> Result<u64, fidl::Error> {
230            let _response = fidl::client::decode_transaction_body::<
231                ConnectorEstablishCircuitResponse,
232                fidl::encoding::DefaultFuchsiaResourceDialect,
233                0x34f64270f6eb7feb,
234            >(_buf?)?;
235            Ok(_response.overnet_id)
236        }
237        self.client.send_query_and_decode::<ConnectorEstablishCircuitRequest, u64>(
238            (id, socket),
239            0x34f64270f6eb7feb,
240            fidl::encoding::DynamicFlags::empty(),
241            _decode,
242        )
243    }
244
245    type FdomainToolboxSocketResponseFut =
246        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
247    fn r#fdomain_toolbox_socket(
248        &self,
249        mut socket: fidl::Socket,
250    ) -> Self::FdomainToolboxSocketResponseFut {
251        fn _decode(
252            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
253        ) -> Result<(), fidl::Error> {
254            let _response = fidl::client::decode_transaction_body::<
255                fidl::encoding::EmptyPayload,
256                fidl::encoding::DefaultFuchsiaResourceDialect,
257                0x6fec63852eec8566,
258            >(_buf?)?;
259            Ok(_response)
260        }
261        self.client.send_query_and_decode::<ConnectorFdomainToolboxSocketRequest, ()>(
262            (socket,),
263            0x6fec63852eec8566,
264            fidl::encoding::DynamicFlags::empty(),
265            _decode,
266        )
267    }
268}
269
270pub struct ConnectorEventStream {
271    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
272}
273
274impl std::marker::Unpin for ConnectorEventStream {}
275
276impl futures::stream::FusedStream for ConnectorEventStream {
277    fn is_terminated(&self) -> bool {
278        self.event_receiver.is_terminated()
279    }
280}
281
282impl futures::Stream for ConnectorEventStream {
283    type Item = Result<ConnectorEvent, fidl::Error>;
284
285    fn poll_next(
286        mut self: std::pin::Pin<&mut Self>,
287        cx: &mut std::task::Context<'_>,
288    ) -> std::task::Poll<Option<Self::Item>> {
289        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
290            &mut self.event_receiver,
291            cx
292        )?) {
293            Some(buf) => std::task::Poll::Ready(Some(ConnectorEvent::decode(buf))),
294            None => std::task::Poll::Ready(None),
295        }
296    }
297}
298
299#[derive(Debug)]
300pub enum ConnectorEvent {}
301
302impl ConnectorEvent {
303    /// Decodes a message buffer as a [`ConnectorEvent`].
304    fn decode(
305        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
306    ) -> Result<ConnectorEvent, fidl::Error> {
307        let (bytes, _handles) = buf.split_mut();
308        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
309        debug_assert_eq!(tx_header.tx_id, 0);
310        match tx_header.ordinal {
311            _ => Err(fidl::Error::UnknownOrdinal {
312                ordinal: tx_header.ordinal,
313                protocol_name: <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
314            }),
315        }
316    }
317}
318
319/// A Stream of incoming requests for fuchsia.developer.remotecontrol.connector/Connector.
320pub struct ConnectorRequestStream {
321    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
322    is_terminated: bool,
323}
324
325impl std::marker::Unpin for ConnectorRequestStream {}
326
327impl futures::stream::FusedStream for ConnectorRequestStream {
328    fn is_terminated(&self) -> bool {
329        self.is_terminated
330    }
331}
332
333impl fidl::endpoints::RequestStream for ConnectorRequestStream {
334    type Protocol = ConnectorMarker;
335    type ControlHandle = ConnectorControlHandle;
336
337    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
338        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
339    }
340
341    fn control_handle(&self) -> Self::ControlHandle {
342        ConnectorControlHandle { inner: self.inner.clone() }
343    }
344
345    fn into_inner(
346        self,
347    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
348    {
349        (self.inner, self.is_terminated)
350    }
351
352    fn from_inner(
353        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
354        is_terminated: bool,
355    ) -> Self {
356        Self { inner, is_terminated }
357    }
358}
359
360impl futures::Stream for ConnectorRequestStream {
361    type Item = Result<ConnectorRequest, fidl::Error>;
362
363    fn poll_next(
364        mut self: std::pin::Pin<&mut Self>,
365        cx: &mut std::task::Context<'_>,
366    ) -> std::task::Poll<Option<Self::Item>> {
367        let this = &mut *self;
368        if this.inner.check_shutdown(cx) {
369            this.is_terminated = true;
370            return std::task::Poll::Ready(None);
371        }
372        if this.is_terminated {
373            panic!("polled ConnectorRequestStream after completion");
374        }
375        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
376            |bytes, handles| {
377                match this.inner.channel().read_etc(cx, bytes, handles) {
378                    std::task::Poll::Ready(Ok(())) => {}
379                    std::task::Poll::Pending => return std::task::Poll::Pending,
380                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
381                        this.is_terminated = true;
382                        return std::task::Poll::Ready(None);
383                    }
384                    std::task::Poll::Ready(Err(e)) => {
385                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
386                            e.into(),
387                        ))));
388                    }
389                }
390
391                // A message has been received from the channel
392                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
393
394                std::task::Poll::Ready(Some(match header.ordinal {
395                    0x34f64270f6eb7feb => {
396                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
397                        let mut req = fidl::new_empty!(
398                            ConnectorEstablishCircuitRequest,
399                            fidl::encoding::DefaultFuchsiaResourceDialect
400                        );
401                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectorEstablishCircuitRequest>(&header, _body_bytes, handles, &mut req)?;
402                        let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
403                        Ok(ConnectorRequest::EstablishCircuit {
404                            id: req.id,
405                            socket: req.socket,
406
407                            responder: ConnectorEstablishCircuitResponder {
408                                control_handle: std::mem::ManuallyDrop::new(control_handle),
409                                tx_id: header.tx_id,
410                            },
411                        })
412                    }
413                    0x6fec63852eec8566 => {
414                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
415                        let mut req = fidl::new_empty!(
416                            ConnectorFdomainToolboxSocketRequest,
417                            fidl::encoding::DefaultFuchsiaResourceDialect
418                        );
419                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectorFdomainToolboxSocketRequest>(&header, _body_bytes, handles, &mut req)?;
420                        let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
421                        Ok(ConnectorRequest::FdomainToolboxSocket {
422                            socket: req.socket,
423
424                            responder: ConnectorFdomainToolboxSocketResponder {
425                                control_handle: std::mem::ManuallyDrop::new(control_handle),
426                                tx_id: header.tx_id,
427                            },
428                        })
429                    }
430                    _ => Err(fidl::Error::UnknownOrdinal {
431                        ordinal: header.ordinal,
432                        protocol_name:
433                            <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
434                    }),
435                }))
436            },
437        )
438    }
439}
440
441#[derive(Debug)]
442pub enum ConnectorRequest {
443    EstablishCircuit {
444        id: u64,
445        socket: fidl::Socket,
446        responder: ConnectorEstablishCircuitResponder,
447    },
448    FdomainToolboxSocket {
449        socket: fidl::Socket,
450        responder: ConnectorFdomainToolboxSocketResponder,
451    },
452}
453
454impl ConnectorRequest {
455    #[allow(irrefutable_let_patterns)]
456    pub fn into_establish_circuit(
457        self,
458    ) -> Option<(u64, fidl::Socket, ConnectorEstablishCircuitResponder)> {
459        if let ConnectorRequest::EstablishCircuit { id, socket, responder } = self {
460            Some((id, socket, responder))
461        } else {
462            None
463        }
464    }
465
466    #[allow(irrefutable_let_patterns)]
467    pub fn into_fdomain_toolbox_socket(
468        self,
469    ) -> Option<(fidl::Socket, ConnectorFdomainToolboxSocketResponder)> {
470        if let ConnectorRequest::FdomainToolboxSocket { socket, responder } = self {
471            Some((socket, responder))
472        } else {
473            None
474        }
475    }
476
477    /// Name of the method defined in FIDL
478    pub fn method_name(&self) -> &'static str {
479        match *self {
480            ConnectorRequest::EstablishCircuit { .. } => "establish_circuit",
481            ConnectorRequest::FdomainToolboxSocket { .. } => "fdomain_toolbox_socket",
482        }
483    }
484}
485
486#[derive(Debug, Clone)]
487pub struct ConnectorControlHandle {
488    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
489}
490
491impl ConnectorControlHandle {
492    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
493        self.inner.shutdown_with_epitaph(status.into())
494    }
495}
496
497impl fidl::endpoints::ControlHandle for ConnectorControlHandle {
498    fn shutdown(&self) {
499        self.inner.shutdown()
500    }
501
502    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
503        self.inner.shutdown_with_epitaph(status)
504    }
505
506    fn is_closed(&self) -> bool {
507        self.inner.channel().is_closed()
508    }
509    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
510        self.inner.channel().on_closed()
511    }
512
513    #[cfg(target_os = "fuchsia")]
514    fn signal_peer(
515        &self,
516        clear_mask: zx::Signals,
517        set_mask: zx::Signals,
518    ) -> Result<(), zx_status::Status> {
519        use fidl::Peered;
520        self.inner.channel().signal_peer(clear_mask, set_mask)
521    }
522}
523
524impl ConnectorControlHandle {}
525
526#[must_use = "FIDL methods require a response to be sent"]
527#[derive(Debug)]
528pub struct ConnectorEstablishCircuitResponder {
529    control_handle: std::mem::ManuallyDrop<ConnectorControlHandle>,
530    tx_id: u32,
531}
532
533/// Set the the channel to be shutdown (see [`ConnectorControlHandle::shutdown`])
534/// if the responder is dropped without sending a response, so that the client
535/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
536impl std::ops::Drop for ConnectorEstablishCircuitResponder {
537    fn drop(&mut self) {
538        self.control_handle.shutdown();
539        // Safety: drops once, never accessed again
540        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
541    }
542}
543
544impl fidl::endpoints::Responder for ConnectorEstablishCircuitResponder {
545    type ControlHandle = ConnectorControlHandle;
546
547    fn control_handle(&self) -> &ConnectorControlHandle {
548        &self.control_handle
549    }
550
551    fn drop_without_shutdown(mut self) {
552        // Safety: drops once, never accessed again due to mem::forget
553        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
554        // Prevent Drop from running (which would shut down the channel)
555        std::mem::forget(self);
556    }
557}
558
559impl ConnectorEstablishCircuitResponder {
560    /// Sends a response to the FIDL transaction.
561    ///
562    /// Sets the channel to shutdown if an error occurs.
563    pub fn send(self, mut overnet_id: u64) -> Result<(), fidl::Error> {
564        let _result = self.send_raw(overnet_id);
565        if _result.is_err() {
566            self.control_handle.shutdown();
567        }
568        self.drop_without_shutdown();
569        _result
570    }
571
572    /// Similar to "send" but does not shutdown the channel if an error occurs.
573    pub fn send_no_shutdown_on_err(self, mut overnet_id: u64) -> Result<(), fidl::Error> {
574        let _result = self.send_raw(overnet_id);
575        self.drop_without_shutdown();
576        _result
577    }
578
579    fn send_raw(&self, mut overnet_id: u64) -> Result<(), fidl::Error> {
580        self.control_handle.inner.send::<ConnectorEstablishCircuitResponse>(
581            (overnet_id,),
582            self.tx_id,
583            0x34f64270f6eb7feb,
584            fidl::encoding::DynamicFlags::empty(),
585        )
586    }
587}
588
589#[must_use = "FIDL methods require a response to be sent"]
590#[derive(Debug)]
591pub struct ConnectorFdomainToolboxSocketResponder {
592    control_handle: std::mem::ManuallyDrop<ConnectorControlHandle>,
593    tx_id: u32,
594}
595
596/// Set the the channel to be shutdown (see [`ConnectorControlHandle::shutdown`])
597/// if the responder is dropped without sending a response, so that the client
598/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
599impl std::ops::Drop for ConnectorFdomainToolboxSocketResponder {
600    fn drop(&mut self) {
601        self.control_handle.shutdown();
602        // Safety: drops once, never accessed again
603        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
604    }
605}
606
607impl fidl::endpoints::Responder for ConnectorFdomainToolboxSocketResponder {
608    type ControlHandle = ConnectorControlHandle;
609
610    fn control_handle(&self) -> &ConnectorControlHandle {
611        &self.control_handle
612    }
613
614    fn drop_without_shutdown(mut self) {
615        // Safety: drops once, never accessed again due to mem::forget
616        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
617        // Prevent Drop from running (which would shut down the channel)
618        std::mem::forget(self);
619    }
620}
621
622impl ConnectorFdomainToolboxSocketResponder {
623    /// Sends a response to the FIDL transaction.
624    ///
625    /// Sets the channel to shutdown if an error occurs.
626    pub fn send(self) -> Result<(), fidl::Error> {
627        let _result = self.send_raw();
628        if _result.is_err() {
629            self.control_handle.shutdown();
630        }
631        self.drop_without_shutdown();
632        _result
633    }
634
635    /// Similar to "send" but does not shutdown the channel if an error occurs.
636    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
637        let _result = self.send_raw();
638        self.drop_without_shutdown();
639        _result
640    }
641
642    fn send_raw(&self) -> Result<(), fidl::Error> {
643        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
644            (),
645            self.tx_id,
646            0x6fec63852eec8566,
647            fidl::encoding::DynamicFlags::empty(),
648        )
649    }
650}
651
652mod internal {
653    use super::*;
654
655    impl fidl::encoding::ResourceTypeMarker for ConnectorEstablishCircuitRequest {
656        type Borrowed<'a> = &'a mut Self;
657        fn take_or_borrow<'a>(
658            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
659        ) -> Self::Borrowed<'a> {
660            value
661        }
662    }
663
664    unsafe impl fidl::encoding::TypeMarker for ConnectorEstablishCircuitRequest {
665        type Owned = Self;
666
667        #[inline(always)]
668        fn inline_align(_context: fidl::encoding::Context) -> usize {
669            8
670        }
671
672        #[inline(always)]
673        fn inline_size(_context: fidl::encoding::Context) -> usize {
674            16
675        }
676    }
677
678    unsafe impl
679        fidl::encoding::Encode<
680            ConnectorEstablishCircuitRequest,
681            fidl::encoding::DefaultFuchsiaResourceDialect,
682        > for &mut ConnectorEstablishCircuitRequest
683    {
684        #[inline]
685        unsafe fn encode(
686            self,
687            encoder: &mut fidl::encoding::Encoder<
688                '_,
689                fidl::encoding::DefaultFuchsiaResourceDialect,
690            >,
691            offset: usize,
692            _depth: fidl::encoding::Depth,
693        ) -> fidl::Result<()> {
694            encoder.debug_check_bounds::<ConnectorEstablishCircuitRequest>(offset);
695            // Delegate to tuple encoding.
696            fidl::encoding::Encode::<
697                ConnectorEstablishCircuitRequest,
698                fidl::encoding::DefaultFuchsiaResourceDialect,
699            >::encode(
700                (
701                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
702                    <fidl::encoding::HandleType<
703                        fidl::Socket,
704                        { fidl::ObjectType::SOCKET.into_raw() },
705                        2147483648,
706                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
707                        &mut self.socket
708                    ),
709                ),
710                encoder,
711                offset,
712                _depth,
713            )
714        }
715    }
716    unsafe impl<
717        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
718        T1: fidl::encoding::Encode<
719                fidl::encoding::HandleType<
720                    fidl::Socket,
721                    { fidl::ObjectType::SOCKET.into_raw() },
722                    2147483648,
723                >,
724                fidl::encoding::DefaultFuchsiaResourceDialect,
725            >,
726    >
727        fidl::encoding::Encode<
728            ConnectorEstablishCircuitRequest,
729            fidl::encoding::DefaultFuchsiaResourceDialect,
730        > for (T0, T1)
731    {
732        #[inline]
733        unsafe fn encode(
734            self,
735            encoder: &mut fidl::encoding::Encoder<
736                '_,
737                fidl::encoding::DefaultFuchsiaResourceDialect,
738            >,
739            offset: usize,
740            depth: fidl::encoding::Depth,
741        ) -> fidl::Result<()> {
742            encoder.debug_check_bounds::<ConnectorEstablishCircuitRequest>(offset);
743            // Zero out padding regions. There's no need to apply masks
744            // because the unmasked parts will be overwritten by fields.
745            unsafe {
746                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
747                (ptr as *mut u64).write_unaligned(0);
748            }
749            // Write the fields.
750            self.0.encode(encoder, offset + 0, depth)?;
751            self.1.encode(encoder, offset + 8, depth)?;
752            Ok(())
753        }
754    }
755
756    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
757        for ConnectorEstablishCircuitRequest
758    {
759        #[inline(always)]
760        fn new_empty() -> Self {
761            Self {
762                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
763                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
764            }
765        }
766
767        #[inline]
768        unsafe fn decode(
769            &mut self,
770            decoder: &mut fidl::encoding::Decoder<
771                '_,
772                fidl::encoding::DefaultFuchsiaResourceDialect,
773            >,
774            offset: usize,
775            _depth: fidl::encoding::Depth,
776        ) -> fidl::Result<()> {
777            decoder.debug_check_bounds::<Self>(offset);
778            // Verify that padding bytes are zero.
779            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
780            let padval = unsafe { (ptr as *const u64).read_unaligned() };
781            let mask = 0xffffffff00000000u64;
782            let maskedval = padval & mask;
783            if maskedval != 0 {
784                return Err(fidl::Error::NonZeroPadding {
785                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
786                });
787            }
788            fidl::decode!(
789                u64,
790                fidl::encoding::DefaultFuchsiaResourceDialect,
791                &mut self.id,
792                decoder,
793                offset + 0,
794                _depth
795            )?;
796            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 8, _depth)?;
797            Ok(())
798        }
799    }
800
801    impl fidl::encoding::ResourceTypeMarker for ConnectorFdomainToolboxSocketRequest {
802        type Borrowed<'a> = &'a mut Self;
803        fn take_or_borrow<'a>(
804            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
805        ) -> Self::Borrowed<'a> {
806            value
807        }
808    }
809
810    unsafe impl fidl::encoding::TypeMarker for ConnectorFdomainToolboxSocketRequest {
811        type Owned = Self;
812
813        #[inline(always)]
814        fn inline_align(_context: fidl::encoding::Context) -> usize {
815            4
816        }
817
818        #[inline(always)]
819        fn inline_size(_context: fidl::encoding::Context) -> usize {
820            4
821        }
822    }
823
824    unsafe impl
825        fidl::encoding::Encode<
826            ConnectorFdomainToolboxSocketRequest,
827            fidl::encoding::DefaultFuchsiaResourceDialect,
828        > for &mut ConnectorFdomainToolboxSocketRequest
829    {
830        #[inline]
831        unsafe fn encode(
832            self,
833            encoder: &mut fidl::encoding::Encoder<
834                '_,
835                fidl::encoding::DefaultFuchsiaResourceDialect,
836            >,
837            offset: usize,
838            _depth: fidl::encoding::Depth,
839        ) -> fidl::Result<()> {
840            encoder.debug_check_bounds::<ConnectorFdomainToolboxSocketRequest>(offset);
841            // Delegate to tuple encoding.
842            fidl::encoding::Encode::<
843                ConnectorFdomainToolboxSocketRequest,
844                fidl::encoding::DefaultFuchsiaResourceDialect,
845            >::encode(
846                (<fidl::encoding::HandleType<
847                    fidl::Socket,
848                    { fidl::ObjectType::SOCKET.into_raw() },
849                    2147483648,
850                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
851                    &mut self.socket
852                ),),
853                encoder,
854                offset,
855                _depth,
856            )
857        }
858    }
859    unsafe impl<
860        T0: fidl::encoding::Encode<
861                fidl::encoding::HandleType<
862                    fidl::Socket,
863                    { fidl::ObjectType::SOCKET.into_raw() },
864                    2147483648,
865                >,
866                fidl::encoding::DefaultFuchsiaResourceDialect,
867            >,
868    >
869        fidl::encoding::Encode<
870            ConnectorFdomainToolboxSocketRequest,
871            fidl::encoding::DefaultFuchsiaResourceDialect,
872        > for (T0,)
873    {
874        #[inline]
875        unsafe fn encode(
876            self,
877            encoder: &mut fidl::encoding::Encoder<
878                '_,
879                fidl::encoding::DefaultFuchsiaResourceDialect,
880            >,
881            offset: usize,
882            depth: fidl::encoding::Depth,
883        ) -> fidl::Result<()> {
884            encoder.debug_check_bounds::<ConnectorFdomainToolboxSocketRequest>(offset);
885            // Zero out padding regions. There's no need to apply masks
886            // because the unmasked parts will be overwritten by fields.
887            // Write the fields.
888            self.0.encode(encoder, offset + 0, depth)?;
889            Ok(())
890        }
891    }
892
893    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
894        for ConnectorFdomainToolboxSocketRequest
895    {
896        #[inline(always)]
897        fn new_empty() -> Self {
898            Self {
899                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
900            }
901        }
902
903        #[inline]
904        unsafe fn decode(
905            &mut self,
906            decoder: &mut fidl::encoding::Decoder<
907                '_,
908                fidl::encoding::DefaultFuchsiaResourceDialect,
909            >,
910            offset: usize,
911            _depth: fidl::encoding::Depth,
912        ) -> fidl::Result<()> {
913            decoder.debug_check_bounds::<Self>(offset);
914            // Verify that padding bytes are zero.
915            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
916            Ok(())
917        }
918    }
919}