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