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