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::Handle {
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    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
493        self.inner.shutdown_with_epitaph(status)
494    }
495
496    fn is_closed(&self) -> bool {
497        self.inner.channel().is_closed()
498    }
499    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
500        self.inner.channel().on_closed()
501    }
502
503    #[cfg(target_os = "fuchsia")]
504    fn signal_peer(
505        &self,
506        clear_mask: zx::Signals,
507        set_mask: zx::Signals,
508    ) -> Result<(), zx_status::Status> {
509        use fidl::Peered;
510        self.inner.channel().signal_peer(clear_mask, set_mask)
511    }
512}
513
514impl ConnectorControlHandle {}
515
516#[must_use = "FIDL methods require a response to be sent"]
517#[derive(Debug)]
518pub struct ConnectorEstablishCircuitResponder {
519    control_handle: std::mem::ManuallyDrop<ConnectorControlHandle>,
520    tx_id: u32,
521}
522
523/// Set the the channel to be shutdown (see [`ConnectorControlHandle::shutdown`])
524/// if the responder is dropped without sending a response, so that the client
525/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
526impl std::ops::Drop for ConnectorEstablishCircuitResponder {
527    fn drop(&mut self) {
528        self.control_handle.shutdown();
529        // Safety: drops once, never accessed again
530        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
531    }
532}
533
534impl fidl::endpoints::Responder for ConnectorEstablishCircuitResponder {
535    type ControlHandle = ConnectorControlHandle;
536
537    fn control_handle(&self) -> &ConnectorControlHandle {
538        &self.control_handle
539    }
540
541    fn drop_without_shutdown(mut self) {
542        // Safety: drops once, never accessed again due to mem::forget
543        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
544        // Prevent Drop from running (which would shut down the channel)
545        std::mem::forget(self);
546    }
547}
548
549impl ConnectorEstablishCircuitResponder {
550    /// Sends a response to the FIDL transaction.
551    ///
552    /// Sets the channel to shutdown if an error occurs.
553    pub fn send(self, mut overnet_id: u64) -> Result<(), fidl::Error> {
554        let _result = self.send_raw(overnet_id);
555        if _result.is_err() {
556            self.control_handle.shutdown();
557        }
558        self.drop_without_shutdown();
559        _result
560    }
561
562    /// Similar to "send" but does not shutdown the channel if an error occurs.
563    pub fn send_no_shutdown_on_err(self, mut overnet_id: u64) -> Result<(), fidl::Error> {
564        let _result = self.send_raw(overnet_id);
565        self.drop_without_shutdown();
566        _result
567    }
568
569    fn send_raw(&self, mut overnet_id: u64) -> Result<(), fidl::Error> {
570        self.control_handle.inner.send::<ConnectorEstablishCircuitResponse>(
571            (overnet_id,),
572            self.tx_id,
573            0x34f64270f6eb7feb,
574            fidl::encoding::DynamicFlags::empty(),
575        )
576    }
577}
578
579#[must_use = "FIDL methods require a response to be sent"]
580#[derive(Debug)]
581pub struct ConnectorFdomainToolboxSocketResponder {
582    control_handle: std::mem::ManuallyDrop<ConnectorControlHandle>,
583    tx_id: u32,
584}
585
586/// Set the the channel to be shutdown (see [`ConnectorControlHandle::shutdown`])
587/// if the responder is dropped without sending a response, so that the client
588/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
589impl std::ops::Drop for ConnectorFdomainToolboxSocketResponder {
590    fn drop(&mut self) {
591        self.control_handle.shutdown();
592        // Safety: drops once, never accessed again
593        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
594    }
595}
596
597impl fidl::endpoints::Responder for ConnectorFdomainToolboxSocketResponder {
598    type ControlHandle = ConnectorControlHandle;
599
600    fn control_handle(&self) -> &ConnectorControlHandle {
601        &self.control_handle
602    }
603
604    fn drop_without_shutdown(mut self) {
605        // Safety: drops once, never accessed again due to mem::forget
606        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
607        // Prevent Drop from running (which would shut down the channel)
608        std::mem::forget(self);
609    }
610}
611
612impl ConnectorFdomainToolboxSocketResponder {
613    /// Sends a response to the FIDL transaction.
614    ///
615    /// Sets the channel to shutdown if an error occurs.
616    pub fn send(self) -> Result<(), fidl::Error> {
617        let _result = self.send_raw();
618        if _result.is_err() {
619            self.control_handle.shutdown();
620        }
621        self.drop_without_shutdown();
622        _result
623    }
624
625    /// Similar to "send" but does not shutdown the channel if an error occurs.
626    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
627        let _result = self.send_raw();
628        self.drop_without_shutdown();
629        _result
630    }
631
632    fn send_raw(&self) -> Result<(), fidl::Error> {
633        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
634            (),
635            self.tx_id,
636            0x6fec63852eec8566,
637            fidl::encoding::DynamicFlags::empty(),
638        )
639    }
640}
641
642mod internal {
643    use super::*;
644
645    impl fidl::encoding::ResourceTypeMarker for ConnectorEstablishCircuitRequest {
646        type Borrowed<'a> = &'a mut Self;
647        fn take_or_borrow<'a>(
648            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
649        ) -> Self::Borrowed<'a> {
650            value
651        }
652    }
653
654    unsafe impl fidl::encoding::TypeMarker for ConnectorEstablishCircuitRequest {
655        type Owned = Self;
656
657        #[inline(always)]
658        fn inline_align(_context: fidl::encoding::Context) -> usize {
659            8
660        }
661
662        #[inline(always)]
663        fn inline_size(_context: fidl::encoding::Context) -> usize {
664            16
665        }
666    }
667
668    unsafe impl
669        fidl::encoding::Encode<
670            ConnectorEstablishCircuitRequest,
671            fidl::encoding::DefaultFuchsiaResourceDialect,
672        > for &mut ConnectorEstablishCircuitRequest
673    {
674        #[inline]
675        unsafe fn encode(
676            self,
677            encoder: &mut fidl::encoding::Encoder<
678                '_,
679                fidl::encoding::DefaultFuchsiaResourceDialect,
680            >,
681            offset: usize,
682            _depth: fidl::encoding::Depth,
683        ) -> fidl::Result<()> {
684            encoder.debug_check_bounds::<ConnectorEstablishCircuitRequest>(offset);
685            // Delegate to tuple encoding.
686            fidl::encoding::Encode::<
687                ConnectorEstablishCircuitRequest,
688                fidl::encoding::DefaultFuchsiaResourceDialect,
689            >::encode(
690                (
691                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
692                    <fidl::encoding::HandleType<
693                        fidl::Socket,
694                        { fidl::ObjectType::SOCKET.into_raw() },
695                        2147483648,
696                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
697                        &mut self.socket
698                    ),
699                ),
700                encoder,
701                offset,
702                _depth,
703            )
704        }
705    }
706    unsafe impl<
707            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
708            T1: fidl::encoding::Encode<
709                fidl::encoding::HandleType<
710                    fidl::Socket,
711                    { fidl::ObjectType::SOCKET.into_raw() },
712                    2147483648,
713                >,
714                fidl::encoding::DefaultFuchsiaResourceDialect,
715            >,
716        >
717        fidl::encoding::Encode<
718            ConnectorEstablishCircuitRequest,
719            fidl::encoding::DefaultFuchsiaResourceDialect,
720        > for (T0, T1)
721    {
722        #[inline]
723        unsafe fn encode(
724            self,
725            encoder: &mut fidl::encoding::Encoder<
726                '_,
727                fidl::encoding::DefaultFuchsiaResourceDialect,
728            >,
729            offset: usize,
730            depth: fidl::encoding::Depth,
731        ) -> fidl::Result<()> {
732            encoder.debug_check_bounds::<ConnectorEstablishCircuitRequest>(offset);
733            // Zero out padding regions. There's no need to apply masks
734            // because the unmasked parts will be overwritten by fields.
735            unsafe {
736                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
737                (ptr as *mut u64).write_unaligned(0);
738            }
739            // Write the fields.
740            self.0.encode(encoder, offset + 0, depth)?;
741            self.1.encode(encoder, offset + 8, depth)?;
742            Ok(())
743        }
744    }
745
746    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
747        for ConnectorEstablishCircuitRequest
748    {
749        #[inline(always)]
750        fn new_empty() -> Self {
751            Self {
752                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
753                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
754            }
755        }
756
757        #[inline]
758        unsafe fn decode(
759            &mut self,
760            decoder: &mut fidl::encoding::Decoder<
761                '_,
762                fidl::encoding::DefaultFuchsiaResourceDialect,
763            >,
764            offset: usize,
765            _depth: fidl::encoding::Depth,
766        ) -> fidl::Result<()> {
767            decoder.debug_check_bounds::<Self>(offset);
768            // Verify that padding bytes are zero.
769            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
770            let padval = unsafe { (ptr as *const u64).read_unaligned() };
771            let mask = 0xffffffff00000000u64;
772            let maskedval = padval & mask;
773            if maskedval != 0 {
774                return Err(fidl::Error::NonZeroPadding {
775                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
776                });
777            }
778            fidl::decode!(
779                u64,
780                fidl::encoding::DefaultFuchsiaResourceDialect,
781                &mut self.id,
782                decoder,
783                offset + 0,
784                _depth
785            )?;
786            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 8, _depth)?;
787            Ok(())
788        }
789    }
790
791    impl fidl::encoding::ResourceTypeMarker for ConnectorFdomainToolboxSocketRequest {
792        type Borrowed<'a> = &'a mut Self;
793        fn take_or_borrow<'a>(
794            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
795        ) -> Self::Borrowed<'a> {
796            value
797        }
798    }
799
800    unsafe impl fidl::encoding::TypeMarker for ConnectorFdomainToolboxSocketRequest {
801        type Owned = Self;
802
803        #[inline(always)]
804        fn inline_align(_context: fidl::encoding::Context) -> usize {
805            4
806        }
807
808        #[inline(always)]
809        fn inline_size(_context: fidl::encoding::Context) -> usize {
810            4
811        }
812    }
813
814    unsafe impl
815        fidl::encoding::Encode<
816            ConnectorFdomainToolboxSocketRequest,
817            fidl::encoding::DefaultFuchsiaResourceDialect,
818        > for &mut ConnectorFdomainToolboxSocketRequest
819    {
820        #[inline]
821        unsafe fn encode(
822            self,
823            encoder: &mut fidl::encoding::Encoder<
824                '_,
825                fidl::encoding::DefaultFuchsiaResourceDialect,
826            >,
827            offset: usize,
828            _depth: fidl::encoding::Depth,
829        ) -> fidl::Result<()> {
830            encoder.debug_check_bounds::<ConnectorFdomainToolboxSocketRequest>(offset);
831            // Delegate to tuple encoding.
832            fidl::encoding::Encode::<
833                ConnectorFdomainToolboxSocketRequest,
834                fidl::encoding::DefaultFuchsiaResourceDialect,
835            >::encode(
836                (<fidl::encoding::HandleType<
837                    fidl::Socket,
838                    { fidl::ObjectType::SOCKET.into_raw() },
839                    2147483648,
840                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
841                    &mut self.socket
842                ),),
843                encoder,
844                offset,
845                _depth,
846            )
847        }
848    }
849    unsafe impl<
850            T0: fidl::encoding::Encode<
851                fidl::encoding::HandleType<
852                    fidl::Socket,
853                    { fidl::ObjectType::SOCKET.into_raw() },
854                    2147483648,
855                >,
856                fidl::encoding::DefaultFuchsiaResourceDialect,
857            >,
858        >
859        fidl::encoding::Encode<
860            ConnectorFdomainToolboxSocketRequest,
861            fidl::encoding::DefaultFuchsiaResourceDialect,
862        > for (T0,)
863    {
864        #[inline]
865        unsafe fn encode(
866            self,
867            encoder: &mut fidl::encoding::Encoder<
868                '_,
869                fidl::encoding::DefaultFuchsiaResourceDialect,
870            >,
871            offset: usize,
872            depth: fidl::encoding::Depth,
873        ) -> fidl::Result<()> {
874            encoder.debug_check_bounds::<ConnectorFdomainToolboxSocketRequest>(offset);
875            // Zero out padding regions. There's no need to apply masks
876            // because the unmasked parts will be overwritten by fields.
877            // Write the fields.
878            self.0.encode(encoder, offset + 0, depth)?;
879            Ok(())
880        }
881    }
882
883    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
884        for ConnectorFdomainToolboxSocketRequest
885    {
886        #[inline(always)]
887        fn new_empty() -> Self {
888            Self {
889                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
890            }
891        }
892
893        #[inline]
894        unsafe fn decode(
895            &mut self,
896            decoder: &mut fidl::encoding::Decoder<
897                '_,
898                fidl::encoding::DefaultFuchsiaResourceDialect,
899            >,
900            offset: usize,
901            _depth: fidl::encoding::Depth,
902        ) -> fidl::Result<()> {
903            decoder.debug_check_bounds::<Self>(offset);
904            // Verify that padding bytes are zero.
905            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
906            Ok(())
907        }
908    }
909}