1#![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_vsock_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct AcceptorAcceptResponse {
16 pub con: Option<Box<ConnectionTransport>>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for AcceptorAcceptResponse {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23pub struct ConnectionTransport {
24 pub data: fidl::Socket,
27 pub con: fidl::endpoints::ServerEnd<ConnectionMarker>,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ConnectionTransport {}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct ConnectorBindRequest {
37 pub remote_cid: u32,
38 pub local_port: u32,
39 pub listener: fidl::endpoints::ServerEnd<ListenerMarker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ConnectorBindRequest {}
43
44#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
45pub struct ConnectorConnectRequest {
46 pub remote_cid: u32,
47 pub remote_port: u32,
48 pub con: ConnectionTransport,
49}
50
51impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ConnectorConnectRequest {}
52
53#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
54pub struct ConnectorListenRequest {
55 pub local_port: u32,
56 pub acceptor: fidl::endpoints::ClientEnd<AcceptorMarker>,
57}
58
59impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ConnectorListenRequest {}
60
61#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
62pub struct ListenerAcceptRequest {
63 pub con: ConnectionTransport,
64}
65
66impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ListenerAcceptRequest {}
67
68#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
69pub struct AcceptorMarker;
70
71impl fidl::endpoints::ProtocolMarker for AcceptorMarker {
72 type Proxy = AcceptorProxy;
73 type RequestStream = AcceptorRequestStream;
74 #[cfg(target_os = "fuchsia")]
75 type SynchronousProxy = AcceptorSynchronousProxy;
76
77 const DEBUG_NAME: &'static str = "(anonymous) Acceptor";
78}
79
80pub trait AcceptorProxyInterface: Send + Sync {
81 type AcceptResponseFut: std::future::Future<Output = Result<Option<Box<ConnectionTransport>>, fidl::Error>>
82 + Send;
83 fn r#accept(&self, addr: &fidl_fuchsia_hardware_vsock::Addr) -> Self::AcceptResponseFut;
84}
85#[derive(Debug)]
86#[cfg(target_os = "fuchsia")]
87pub struct AcceptorSynchronousProxy {
88 client: fidl::client::sync::Client,
89}
90
91#[cfg(target_os = "fuchsia")]
92impl fidl::endpoints::SynchronousProxy for AcceptorSynchronousProxy {
93 type Proxy = AcceptorProxy;
94 type Protocol = AcceptorMarker;
95
96 fn from_channel(inner: fidl::Channel) -> Self {
97 Self::new(inner)
98 }
99
100 fn into_channel(self) -> fidl::Channel {
101 self.client.into_channel()
102 }
103
104 fn as_channel(&self) -> &fidl::Channel {
105 self.client.as_channel()
106 }
107}
108
109#[cfg(target_os = "fuchsia")]
110impl AcceptorSynchronousProxy {
111 pub fn new(channel: fidl::Channel) -> Self {
112 let protocol_name = <AcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
113 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
114 }
115
116 pub fn into_channel(self) -> fidl::Channel {
117 self.client.into_channel()
118 }
119
120 pub fn wait_for_event(
123 &self,
124 deadline: zx::MonotonicInstant,
125 ) -> Result<AcceptorEvent, fidl::Error> {
126 AcceptorEvent::decode(self.client.wait_for_event(deadline)?)
127 }
128
129 pub fn r#accept(
132 &self,
133 mut addr: &fidl_fuchsia_hardware_vsock::Addr,
134 ___deadline: zx::MonotonicInstant,
135 ) -> Result<Option<Box<ConnectionTransport>>, fidl::Error> {
136 let _response = self.client.send_query::<AcceptorAcceptRequest, AcceptorAcceptResponse>(
137 (addr,),
138 0x21fd057ad9c9f443,
139 fidl::encoding::DynamicFlags::empty(),
140 ___deadline,
141 )?;
142 Ok(_response.con)
143 }
144}
145
146#[cfg(target_os = "fuchsia")]
147impl From<AcceptorSynchronousProxy> for zx::Handle {
148 fn from(value: AcceptorSynchronousProxy) -> Self {
149 value.into_channel().into()
150 }
151}
152
153#[cfg(target_os = "fuchsia")]
154impl From<fidl::Channel> for AcceptorSynchronousProxy {
155 fn from(value: fidl::Channel) -> Self {
156 Self::new(value)
157 }
158}
159
160#[derive(Debug, Clone)]
161pub struct AcceptorProxy {
162 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
163}
164
165impl fidl::endpoints::Proxy for AcceptorProxy {
166 type Protocol = AcceptorMarker;
167
168 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
169 Self::new(inner)
170 }
171
172 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
173 self.client.into_channel().map_err(|client| Self { client })
174 }
175
176 fn as_channel(&self) -> &::fidl::AsyncChannel {
177 self.client.as_channel()
178 }
179}
180
181impl AcceptorProxy {
182 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
184 let protocol_name = <AcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
185 Self { client: fidl::client::Client::new(channel, protocol_name) }
186 }
187
188 pub fn take_event_stream(&self) -> AcceptorEventStream {
194 AcceptorEventStream { event_receiver: self.client.take_event_receiver() }
195 }
196
197 pub fn r#accept(
200 &self,
201 mut addr: &fidl_fuchsia_hardware_vsock::Addr,
202 ) -> fidl::client::QueryResponseFut<
203 Option<Box<ConnectionTransport>>,
204 fidl::encoding::DefaultFuchsiaResourceDialect,
205 > {
206 AcceptorProxyInterface::r#accept(self, addr)
207 }
208}
209
210impl AcceptorProxyInterface for AcceptorProxy {
211 type AcceptResponseFut = fidl::client::QueryResponseFut<
212 Option<Box<ConnectionTransport>>,
213 fidl::encoding::DefaultFuchsiaResourceDialect,
214 >;
215 fn r#accept(&self, mut addr: &fidl_fuchsia_hardware_vsock::Addr) -> Self::AcceptResponseFut {
216 fn _decode(
217 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
218 ) -> Result<Option<Box<ConnectionTransport>>, fidl::Error> {
219 let _response = fidl::client::decode_transaction_body::<
220 AcceptorAcceptResponse,
221 fidl::encoding::DefaultFuchsiaResourceDialect,
222 0x21fd057ad9c9f443,
223 >(_buf?)?;
224 Ok(_response.con)
225 }
226 self.client
227 .send_query_and_decode::<AcceptorAcceptRequest, Option<Box<ConnectionTransport>>>(
228 (addr,),
229 0x21fd057ad9c9f443,
230 fidl::encoding::DynamicFlags::empty(),
231 _decode,
232 )
233 }
234}
235
236pub struct AcceptorEventStream {
237 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
238}
239
240impl std::marker::Unpin for AcceptorEventStream {}
241
242impl futures::stream::FusedStream for AcceptorEventStream {
243 fn is_terminated(&self) -> bool {
244 self.event_receiver.is_terminated()
245 }
246}
247
248impl futures::Stream for AcceptorEventStream {
249 type Item = Result<AcceptorEvent, fidl::Error>;
250
251 fn poll_next(
252 mut self: std::pin::Pin<&mut Self>,
253 cx: &mut std::task::Context<'_>,
254 ) -> std::task::Poll<Option<Self::Item>> {
255 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
256 &mut self.event_receiver,
257 cx
258 )?) {
259 Some(buf) => std::task::Poll::Ready(Some(AcceptorEvent::decode(buf))),
260 None => std::task::Poll::Ready(None),
261 }
262 }
263}
264
265#[derive(Debug)]
266pub enum AcceptorEvent {}
267
268impl AcceptorEvent {
269 fn decode(
271 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
272 ) -> Result<AcceptorEvent, fidl::Error> {
273 let (bytes, _handles) = buf.split_mut();
274 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
275 debug_assert_eq!(tx_header.tx_id, 0);
276 match tx_header.ordinal {
277 _ => Err(fidl::Error::UnknownOrdinal {
278 ordinal: tx_header.ordinal,
279 protocol_name: <AcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
280 }),
281 }
282 }
283}
284
285pub struct AcceptorRequestStream {
287 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
288 is_terminated: bool,
289}
290
291impl std::marker::Unpin for AcceptorRequestStream {}
292
293impl futures::stream::FusedStream for AcceptorRequestStream {
294 fn is_terminated(&self) -> bool {
295 self.is_terminated
296 }
297}
298
299impl fidl::endpoints::RequestStream for AcceptorRequestStream {
300 type Protocol = AcceptorMarker;
301 type ControlHandle = AcceptorControlHandle;
302
303 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
304 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
305 }
306
307 fn control_handle(&self) -> Self::ControlHandle {
308 AcceptorControlHandle { inner: self.inner.clone() }
309 }
310
311 fn into_inner(
312 self,
313 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
314 {
315 (self.inner, self.is_terminated)
316 }
317
318 fn from_inner(
319 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
320 is_terminated: bool,
321 ) -> Self {
322 Self { inner, is_terminated }
323 }
324}
325
326impl futures::Stream for AcceptorRequestStream {
327 type Item = Result<AcceptorRequest, fidl::Error>;
328
329 fn poll_next(
330 mut self: std::pin::Pin<&mut Self>,
331 cx: &mut std::task::Context<'_>,
332 ) -> std::task::Poll<Option<Self::Item>> {
333 let this = &mut *self;
334 if this.inner.check_shutdown(cx) {
335 this.is_terminated = true;
336 return std::task::Poll::Ready(None);
337 }
338 if this.is_terminated {
339 panic!("polled AcceptorRequestStream after completion");
340 }
341 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
342 |bytes, handles| {
343 match this.inner.channel().read_etc(cx, bytes, handles) {
344 std::task::Poll::Ready(Ok(())) => {}
345 std::task::Poll::Pending => return std::task::Poll::Pending,
346 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
347 this.is_terminated = true;
348 return std::task::Poll::Ready(None);
349 }
350 std::task::Poll::Ready(Err(e)) => {
351 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
352 e.into(),
353 ))))
354 }
355 }
356
357 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
359
360 std::task::Poll::Ready(Some(match header.ordinal {
361 0x21fd057ad9c9f443 => {
362 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
363 let mut req = fidl::new_empty!(
364 AcceptorAcceptRequest,
365 fidl::encoding::DefaultFuchsiaResourceDialect
366 );
367 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AcceptorAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
368 let control_handle = AcceptorControlHandle { inner: this.inner.clone() };
369 Ok(AcceptorRequest::Accept {
370 addr: req.addr,
371
372 responder: AcceptorAcceptResponder {
373 control_handle: std::mem::ManuallyDrop::new(control_handle),
374 tx_id: header.tx_id,
375 },
376 })
377 }
378 _ => Err(fidl::Error::UnknownOrdinal {
379 ordinal: header.ordinal,
380 protocol_name:
381 <AcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
382 }),
383 }))
384 },
385 )
386 }
387}
388
389#[derive(Debug)]
391pub enum AcceptorRequest {
392 Accept { addr: fidl_fuchsia_hardware_vsock::Addr, responder: AcceptorAcceptResponder },
395}
396
397impl AcceptorRequest {
398 #[allow(irrefutable_let_patterns)]
399 pub fn into_accept(
400 self,
401 ) -> Option<(fidl_fuchsia_hardware_vsock::Addr, AcceptorAcceptResponder)> {
402 if let AcceptorRequest::Accept { addr, responder } = self {
403 Some((addr, responder))
404 } else {
405 None
406 }
407 }
408
409 pub fn method_name(&self) -> &'static str {
411 match *self {
412 AcceptorRequest::Accept { .. } => "accept",
413 }
414 }
415}
416
417#[derive(Debug, Clone)]
418pub struct AcceptorControlHandle {
419 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
420}
421
422impl fidl::endpoints::ControlHandle for AcceptorControlHandle {
423 fn shutdown(&self) {
424 self.inner.shutdown()
425 }
426 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
427 self.inner.shutdown_with_epitaph(status)
428 }
429
430 fn is_closed(&self) -> bool {
431 self.inner.channel().is_closed()
432 }
433 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
434 self.inner.channel().on_closed()
435 }
436
437 #[cfg(target_os = "fuchsia")]
438 fn signal_peer(
439 &self,
440 clear_mask: zx::Signals,
441 set_mask: zx::Signals,
442 ) -> Result<(), zx_status::Status> {
443 use fidl::Peered;
444 self.inner.channel().signal_peer(clear_mask, set_mask)
445 }
446}
447
448impl AcceptorControlHandle {}
449
450#[must_use = "FIDL methods require a response to be sent"]
451#[derive(Debug)]
452pub struct AcceptorAcceptResponder {
453 control_handle: std::mem::ManuallyDrop<AcceptorControlHandle>,
454 tx_id: u32,
455}
456
457impl std::ops::Drop for AcceptorAcceptResponder {
461 fn drop(&mut self) {
462 self.control_handle.shutdown();
463 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
465 }
466}
467
468impl fidl::endpoints::Responder for AcceptorAcceptResponder {
469 type ControlHandle = AcceptorControlHandle;
470
471 fn control_handle(&self) -> &AcceptorControlHandle {
472 &self.control_handle
473 }
474
475 fn drop_without_shutdown(mut self) {
476 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
478 std::mem::forget(self);
480 }
481}
482
483impl AcceptorAcceptResponder {
484 pub fn send(self, mut con: Option<ConnectionTransport>) -> Result<(), fidl::Error> {
488 let _result = self.send_raw(con);
489 if _result.is_err() {
490 self.control_handle.shutdown();
491 }
492 self.drop_without_shutdown();
493 _result
494 }
495
496 pub fn send_no_shutdown_on_err(
498 self,
499 mut con: Option<ConnectionTransport>,
500 ) -> Result<(), fidl::Error> {
501 let _result = self.send_raw(con);
502 self.drop_without_shutdown();
503 _result
504 }
505
506 fn send_raw(&self, mut con: Option<ConnectionTransport>) -> Result<(), fidl::Error> {
507 self.control_handle.inner.send::<AcceptorAcceptResponse>(
508 (con.as_mut(),),
509 self.tx_id,
510 0x21fd057ad9c9f443,
511 fidl::encoding::DynamicFlags::empty(),
512 )
513 }
514}
515
516#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
517pub struct ConnectionMarker;
518
519impl fidl::endpoints::ProtocolMarker for ConnectionMarker {
520 type Proxy = ConnectionProxy;
521 type RequestStream = ConnectionRequestStream;
522 #[cfg(target_os = "fuchsia")]
523 type SynchronousProxy = ConnectionSynchronousProxy;
524
525 const DEBUG_NAME: &'static str = "(anonymous) Connection";
526}
527
528pub trait ConnectionProxyInterface: Send + Sync {
529 fn r#shutdown(&self) -> Result<(), fidl::Error>;
530}
531#[derive(Debug)]
532#[cfg(target_os = "fuchsia")]
533pub struct ConnectionSynchronousProxy {
534 client: fidl::client::sync::Client,
535}
536
537#[cfg(target_os = "fuchsia")]
538impl fidl::endpoints::SynchronousProxy for ConnectionSynchronousProxy {
539 type Proxy = ConnectionProxy;
540 type Protocol = ConnectionMarker;
541
542 fn from_channel(inner: fidl::Channel) -> Self {
543 Self::new(inner)
544 }
545
546 fn into_channel(self) -> fidl::Channel {
547 self.client.into_channel()
548 }
549
550 fn as_channel(&self) -> &fidl::Channel {
551 self.client.as_channel()
552 }
553}
554
555#[cfg(target_os = "fuchsia")]
556impl ConnectionSynchronousProxy {
557 pub fn new(channel: fidl::Channel) -> Self {
558 let protocol_name = <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
559 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
560 }
561
562 pub fn into_channel(self) -> fidl::Channel {
563 self.client.into_channel()
564 }
565
566 pub fn wait_for_event(
569 &self,
570 deadline: zx::MonotonicInstant,
571 ) -> Result<ConnectionEvent, fidl::Error> {
572 ConnectionEvent::decode(self.client.wait_for_event(deadline)?)
573 }
574
575 pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
579 self.client.send::<fidl::encoding::EmptyPayload>(
580 (),
581 0x40da7ca487466971,
582 fidl::encoding::DynamicFlags::empty(),
583 )
584 }
585}
586
587#[cfg(target_os = "fuchsia")]
588impl From<ConnectionSynchronousProxy> for zx::Handle {
589 fn from(value: ConnectionSynchronousProxy) -> Self {
590 value.into_channel().into()
591 }
592}
593
594#[cfg(target_os = "fuchsia")]
595impl From<fidl::Channel> for ConnectionSynchronousProxy {
596 fn from(value: fidl::Channel) -> Self {
597 Self::new(value)
598 }
599}
600
601#[derive(Debug, Clone)]
602pub struct ConnectionProxy {
603 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
604}
605
606impl fidl::endpoints::Proxy for ConnectionProxy {
607 type Protocol = ConnectionMarker;
608
609 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
610 Self::new(inner)
611 }
612
613 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
614 self.client.into_channel().map_err(|client| Self { client })
615 }
616
617 fn as_channel(&self) -> &::fidl::AsyncChannel {
618 self.client.as_channel()
619 }
620}
621
622impl ConnectionProxy {
623 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
625 let protocol_name = <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
626 Self { client: fidl::client::Client::new(channel, protocol_name) }
627 }
628
629 pub fn take_event_stream(&self) -> ConnectionEventStream {
635 ConnectionEventStream { event_receiver: self.client.take_event_receiver() }
636 }
637
638 pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
642 ConnectionProxyInterface::r#shutdown(self)
643 }
644}
645
646impl ConnectionProxyInterface for ConnectionProxy {
647 fn r#shutdown(&self) -> Result<(), fidl::Error> {
648 self.client.send::<fidl::encoding::EmptyPayload>(
649 (),
650 0x40da7ca487466971,
651 fidl::encoding::DynamicFlags::empty(),
652 )
653 }
654}
655
656pub struct ConnectionEventStream {
657 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
658}
659
660impl std::marker::Unpin for ConnectionEventStream {}
661
662impl futures::stream::FusedStream for ConnectionEventStream {
663 fn is_terminated(&self) -> bool {
664 self.event_receiver.is_terminated()
665 }
666}
667
668impl futures::Stream for ConnectionEventStream {
669 type Item = Result<ConnectionEvent, fidl::Error>;
670
671 fn poll_next(
672 mut self: std::pin::Pin<&mut Self>,
673 cx: &mut std::task::Context<'_>,
674 ) -> std::task::Poll<Option<Self::Item>> {
675 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
676 &mut self.event_receiver,
677 cx
678 )?) {
679 Some(buf) => std::task::Poll::Ready(Some(ConnectionEvent::decode(buf))),
680 None => std::task::Poll::Ready(None),
681 }
682 }
683}
684
685#[derive(Debug)]
686pub enum ConnectionEvent {}
687
688impl ConnectionEvent {
689 fn decode(
691 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
692 ) -> Result<ConnectionEvent, fidl::Error> {
693 let (bytes, _handles) = buf.split_mut();
694 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
695 debug_assert_eq!(tx_header.tx_id, 0);
696 match tx_header.ordinal {
697 _ => Err(fidl::Error::UnknownOrdinal {
698 ordinal: tx_header.ordinal,
699 protocol_name: <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
700 }),
701 }
702 }
703}
704
705pub struct ConnectionRequestStream {
707 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
708 is_terminated: bool,
709}
710
711impl std::marker::Unpin for ConnectionRequestStream {}
712
713impl futures::stream::FusedStream for ConnectionRequestStream {
714 fn is_terminated(&self) -> bool {
715 self.is_terminated
716 }
717}
718
719impl fidl::endpoints::RequestStream for ConnectionRequestStream {
720 type Protocol = ConnectionMarker;
721 type ControlHandle = ConnectionControlHandle;
722
723 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
724 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
725 }
726
727 fn control_handle(&self) -> Self::ControlHandle {
728 ConnectionControlHandle { inner: self.inner.clone() }
729 }
730
731 fn into_inner(
732 self,
733 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
734 {
735 (self.inner, self.is_terminated)
736 }
737
738 fn from_inner(
739 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
740 is_terminated: bool,
741 ) -> Self {
742 Self { inner, is_terminated }
743 }
744}
745
746impl futures::Stream for ConnectionRequestStream {
747 type Item = Result<ConnectionRequest, fidl::Error>;
748
749 fn poll_next(
750 mut self: std::pin::Pin<&mut Self>,
751 cx: &mut std::task::Context<'_>,
752 ) -> std::task::Poll<Option<Self::Item>> {
753 let this = &mut *self;
754 if this.inner.check_shutdown(cx) {
755 this.is_terminated = true;
756 return std::task::Poll::Ready(None);
757 }
758 if this.is_terminated {
759 panic!("polled ConnectionRequestStream after completion");
760 }
761 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
762 |bytes, handles| {
763 match this.inner.channel().read_etc(cx, bytes, handles) {
764 std::task::Poll::Ready(Ok(())) => {}
765 std::task::Poll::Pending => return std::task::Poll::Pending,
766 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
767 this.is_terminated = true;
768 return std::task::Poll::Ready(None);
769 }
770 std::task::Poll::Ready(Err(e)) => {
771 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
772 e.into(),
773 ))))
774 }
775 }
776
777 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
779
780 std::task::Poll::Ready(Some(match header.ordinal {
781 0x40da7ca487466971 => {
782 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
783 let mut req = fidl::new_empty!(
784 fidl::encoding::EmptyPayload,
785 fidl::encoding::DefaultFuchsiaResourceDialect
786 );
787 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
788 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
789 Ok(ConnectionRequest::Shutdown { control_handle })
790 }
791 _ => Err(fidl::Error::UnknownOrdinal {
792 ordinal: header.ordinal,
793 protocol_name:
794 <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
795 }),
796 }))
797 },
798 )
799 }
800}
801
802#[derive(Debug)]
804pub enum ConnectionRequest {
805 Shutdown { control_handle: ConnectionControlHandle },
809}
810
811impl ConnectionRequest {
812 #[allow(irrefutable_let_patterns)]
813 pub fn into_shutdown(self) -> Option<(ConnectionControlHandle)> {
814 if let ConnectionRequest::Shutdown { control_handle } = self {
815 Some((control_handle))
816 } else {
817 None
818 }
819 }
820
821 pub fn method_name(&self) -> &'static str {
823 match *self {
824 ConnectionRequest::Shutdown { .. } => "shutdown",
825 }
826 }
827}
828
829#[derive(Debug, Clone)]
830pub struct ConnectionControlHandle {
831 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
832}
833
834impl fidl::endpoints::ControlHandle for ConnectionControlHandle {
835 fn shutdown(&self) {
836 self.inner.shutdown()
837 }
838 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
839 self.inner.shutdown_with_epitaph(status)
840 }
841
842 fn is_closed(&self) -> bool {
843 self.inner.channel().is_closed()
844 }
845 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
846 self.inner.channel().on_closed()
847 }
848
849 #[cfg(target_os = "fuchsia")]
850 fn signal_peer(
851 &self,
852 clear_mask: zx::Signals,
853 set_mask: zx::Signals,
854 ) -> Result<(), zx_status::Status> {
855 use fidl::Peered;
856 self.inner.channel().signal_peer(clear_mask, set_mask)
857 }
858}
859
860impl ConnectionControlHandle {}
861
862#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
863pub struct ConnectorMarker;
864
865impl fidl::endpoints::ProtocolMarker for ConnectorMarker {
866 type Proxy = ConnectorProxy;
867 type RequestStream = ConnectorRequestStream;
868 #[cfg(target_os = "fuchsia")]
869 type SynchronousProxy = ConnectorSynchronousProxy;
870
871 const DEBUG_NAME: &'static str = "fuchsia.vsock.Connector";
872}
873impl fidl::endpoints::DiscoverableProtocolMarker for ConnectorMarker {}
874pub type ConnectorConnectResult = Result<u32, i32>;
875pub type ConnectorListenResult = Result<(), i32>;
876pub type ConnectorBindResult = Result<(), i32>;
877
878pub trait ConnectorProxyInterface: Send + Sync {
879 type ConnectResponseFut: std::future::Future<Output = Result<ConnectorConnectResult, fidl::Error>>
880 + Send;
881 fn r#connect(
882 &self,
883 remote_cid: u32,
884 remote_port: u32,
885 con: ConnectionTransport,
886 ) -> Self::ConnectResponseFut;
887 type ListenResponseFut: std::future::Future<Output = Result<ConnectorListenResult, fidl::Error>>
888 + Send;
889 fn r#listen(
890 &self,
891 local_port: u32,
892 acceptor: fidl::endpoints::ClientEnd<AcceptorMarker>,
893 ) -> Self::ListenResponseFut;
894 type BindResponseFut: std::future::Future<Output = Result<ConnectorBindResult, fidl::Error>>
895 + Send;
896 fn r#bind(
897 &self,
898 remote_cid: u32,
899 local_port: u32,
900 listener: fidl::endpoints::ServerEnd<ListenerMarker>,
901 ) -> Self::BindResponseFut;
902}
903#[derive(Debug)]
904#[cfg(target_os = "fuchsia")]
905pub struct ConnectorSynchronousProxy {
906 client: fidl::client::sync::Client,
907}
908
909#[cfg(target_os = "fuchsia")]
910impl fidl::endpoints::SynchronousProxy for ConnectorSynchronousProxy {
911 type Proxy = ConnectorProxy;
912 type Protocol = ConnectorMarker;
913
914 fn from_channel(inner: fidl::Channel) -> Self {
915 Self::new(inner)
916 }
917
918 fn into_channel(self) -> fidl::Channel {
919 self.client.into_channel()
920 }
921
922 fn as_channel(&self) -> &fidl::Channel {
923 self.client.as_channel()
924 }
925}
926
927#[cfg(target_os = "fuchsia")]
928impl ConnectorSynchronousProxy {
929 pub fn new(channel: fidl::Channel) -> Self {
930 let protocol_name = <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
931 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
932 }
933
934 pub fn into_channel(self) -> fidl::Channel {
935 self.client.into_channel()
936 }
937
938 pub fn wait_for_event(
941 &self,
942 deadline: zx::MonotonicInstant,
943 ) -> Result<ConnectorEvent, fidl::Error> {
944 ConnectorEvent::decode(self.client.wait_for_event(deadline)?)
945 }
946
947 pub fn r#connect(
950 &self,
951 mut remote_cid: u32,
952 mut remote_port: u32,
953 mut con: ConnectionTransport,
954 ___deadline: zx::MonotonicInstant,
955 ) -> Result<ConnectorConnectResult, fidl::Error> {
956 let _response = self.client.send_query::<
957 ConnectorConnectRequest,
958 fidl::encoding::ResultType<ConnectorConnectResponse, i32>,
959 >(
960 (remote_cid, remote_port, &mut con,),
961 0xdf55c5e6a6a4117,
962 fidl::encoding::DynamicFlags::empty(),
963 ___deadline,
964 )?;
965 Ok(_response.map(|x| x.local_port))
966 }
967
968 pub fn r#listen(
971 &self,
972 mut local_port: u32,
973 mut acceptor: fidl::endpoints::ClientEnd<AcceptorMarker>,
974 ___deadline: zx::MonotonicInstant,
975 ) -> Result<ConnectorListenResult, fidl::Error> {
976 let _response = self.client.send_query::<
977 ConnectorListenRequest,
978 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
979 >(
980 (local_port, acceptor,),
981 0x17c1371908bacf73,
982 fidl::encoding::DynamicFlags::empty(),
983 ___deadline,
984 )?;
985 Ok(_response.map(|x| x))
986 }
987
988 pub fn r#bind(
991 &self,
992 mut remote_cid: u32,
993 mut local_port: u32,
994 mut listener: fidl::endpoints::ServerEnd<ListenerMarker>,
995 ___deadline: zx::MonotonicInstant,
996 ) -> Result<ConnectorBindResult, fidl::Error> {
997 let _response = self.client.send_query::<
998 ConnectorBindRequest,
999 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1000 >(
1001 (remote_cid, local_port, listener,),
1002 0x6e50cd8c895f2e0,
1003 fidl::encoding::DynamicFlags::empty(),
1004 ___deadline,
1005 )?;
1006 Ok(_response.map(|x| x))
1007 }
1008}
1009
1010#[cfg(target_os = "fuchsia")]
1011impl From<ConnectorSynchronousProxy> for zx::Handle {
1012 fn from(value: ConnectorSynchronousProxy) -> Self {
1013 value.into_channel().into()
1014 }
1015}
1016
1017#[cfg(target_os = "fuchsia")]
1018impl From<fidl::Channel> for ConnectorSynchronousProxy {
1019 fn from(value: fidl::Channel) -> Self {
1020 Self::new(value)
1021 }
1022}
1023
1024#[derive(Debug, Clone)]
1025pub struct ConnectorProxy {
1026 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1027}
1028
1029impl fidl::endpoints::Proxy for ConnectorProxy {
1030 type Protocol = ConnectorMarker;
1031
1032 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1033 Self::new(inner)
1034 }
1035
1036 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1037 self.client.into_channel().map_err(|client| Self { client })
1038 }
1039
1040 fn as_channel(&self) -> &::fidl::AsyncChannel {
1041 self.client.as_channel()
1042 }
1043}
1044
1045impl ConnectorProxy {
1046 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1048 let protocol_name = <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1049 Self { client: fidl::client::Client::new(channel, protocol_name) }
1050 }
1051
1052 pub fn take_event_stream(&self) -> ConnectorEventStream {
1058 ConnectorEventStream { event_receiver: self.client.take_event_receiver() }
1059 }
1060
1061 pub fn r#connect(
1064 &self,
1065 mut remote_cid: u32,
1066 mut remote_port: u32,
1067 mut con: ConnectionTransport,
1068 ) -> fidl::client::QueryResponseFut<
1069 ConnectorConnectResult,
1070 fidl::encoding::DefaultFuchsiaResourceDialect,
1071 > {
1072 ConnectorProxyInterface::r#connect(self, remote_cid, remote_port, con)
1073 }
1074
1075 pub fn r#listen(
1078 &self,
1079 mut local_port: u32,
1080 mut acceptor: fidl::endpoints::ClientEnd<AcceptorMarker>,
1081 ) -> fidl::client::QueryResponseFut<
1082 ConnectorListenResult,
1083 fidl::encoding::DefaultFuchsiaResourceDialect,
1084 > {
1085 ConnectorProxyInterface::r#listen(self, local_port, acceptor)
1086 }
1087
1088 pub fn r#bind(
1091 &self,
1092 mut remote_cid: u32,
1093 mut local_port: u32,
1094 mut listener: fidl::endpoints::ServerEnd<ListenerMarker>,
1095 ) -> fidl::client::QueryResponseFut<
1096 ConnectorBindResult,
1097 fidl::encoding::DefaultFuchsiaResourceDialect,
1098 > {
1099 ConnectorProxyInterface::r#bind(self, remote_cid, local_port, listener)
1100 }
1101}
1102
1103impl ConnectorProxyInterface for ConnectorProxy {
1104 type ConnectResponseFut = fidl::client::QueryResponseFut<
1105 ConnectorConnectResult,
1106 fidl::encoding::DefaultFuchsiaResourceDialect,
1107 >;
1108 fn r#connect(
1109 &self,
1110 mut remote_cid: u32,
1111 mut remote_port: u32,
1112 mut con: ConnectionTransport,
1113 ) -> Self::ConnectResponseFut {
1114 fn _decode(
1115 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1116 ) -> Result<ConnectorConnectResult, fidl::Error> {
1117 let _response = fidl::client::decode_transaction_body::<
1118 fidl::encoding::ResultType<ConnectorConnectResponse, i32>,
1119 fidl::encoding::DefaultFuchsiaResourceDialect,
1120 0xdf55c5e6a6a4117,
1121 >(_buf?)?;
1122 Ok(_response.map(|x| x.local_port))
1123 }
1124 self.client.send_query_and_decode::<ConnectorConnectRequest, ConnectorConnectResult>(
1125 (remote_cid, remote_port, &mut con),
1126 0xdf55c5e6a6a4117,
1127 fidl::encoding::DynamicFlags::empty(),
1128 _decode,
1129 )
1130 }
1131
1132 type ListenResponseFut = fidl::client::QueryResponseFut<
1133 ConnectorListenResult,
1134 fidl::encoding::DefaultFuchsiaResourceDialect,
1135 >;
1136 fn r#listen(
1137 &self,
1138 mut local_port: u32,
1139 mut acceptor: fidl::endpoints::ClientEnd<AcceptorMarker>,
1140 ) -> Self::ListenResponseFut {
1141 fn _decode(
1142 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1143 ) -> Result<ConnectorListenResult, fidl::Error> {
1144 let _response = fidl::client::decode_transaction_body::<
1145 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1146 fidl::encoding::DefaultFuchsiaResourceDialect,
1147 0x17c1371908bacf73,
1148 >(_buf?)?;
1149 Ok(_response.map(|x| x))
1150 }
1151 self.client.send_query_and_decode::<ConnectorListenRequest, ConnectorListenResult>(
1152 (local_port, acceptor),
1153 0x17c1371908bacf73,
1154 fidl::encoding::DynamicFlags::empty(),
1155 _decode,
1156 )
1157 }
1158
1159 type BindResponseFut = fidl::client::QueryResponseFut<
1160 ConnectorBindResult,
1161 fidl::encoding::DefaultFuchsiaResourceDialect,
1162 >;
1163 fn r#bind(
1164 &self,
1165 mut remote_cid: u32,
1166 mut local_port: u32,
1167 mut listener: fidl::endpoints::ServerEnd<ListenerMarker>,
1168 ) -> Self::BindResponseFut {
1169 fn _decode(
1170 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1171 ) -> Result<ConnectorBindResult, fidl::Error> {
1172 let _response = fidl::client::decode_transaction_body::<
1173 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1174 fidl::encoding::DefaultFuchsiaResourceDialect,
1175 0x6e50cd8c895f2e0,
1176 >(_buf?)?;
1177 Ok(_response.map(|x| x))
1178 }
1179 self.client.send_query_and_decode::<ConnectorBindRequest, ConnectorBindResult>(
1180 (remote_cid, local_port, listener),
1181 0x6e50cd8c895f2e0,
1182 fidl::encoding::DynamicFlags::empty(),
1183 _decode,
1184 )
1185 }
1186}
1187
1188pub struct ConnectorEventStream {
1189 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1190}
1191
1192impl std::marker::Unpin for ConnectorEventStream {}
1193
1194impl futures::stream::FusedStream for ConnectorEventStream {
1195 fn is_terminated(&self) -> bool {
1196 self.event_receiver.is_terminated()
1197 }
1198}
1199
1200impl futures::Stream for ConnectorEventStream {
1201 type Item = Result<ConnectorEvent, fidl::Error>;
1202
1203 fn poll_next(
1204 mut self: std::pin::Pin<&mut Self>,
1205 cx: &mut std::task::Context<'_>,
1206 ) -> std::task::Poll<Option<Self::Item>> {
1207 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1208 &mut self.event_receiver,
1209 cx
1210 )?) {
1211 Some(buf) => std::task::Poll::Ready(Some(ConnectorEvent::decode(buf))),
1212 None => std::task::Poll::Ready(None),
1213 }
1214 }
1215}
1216
1217#[derive(Debug)]
1218pub enum ConnectorEvent {}
1219
1220impl ConnectorEvent {
1221 fn decode(
1223 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1224 ) -> Result<ConnectorEvent, fidl::Error> {
1225 let (bytes, _handles) = buf.split_mut();
1226 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1227 debug_assert_eq!(tx_header.tx_id, 0);
1228 match tx_header.ordinal {
1229 _ => Err(fidl::Error::UnknownOrdinal {
1230 ordinal: tx_header.ordinal,
1231 protocol_name: <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1232 }),
1233 }
1234 }
1235}
1236
1237pub struct ConnectorRequestStream {
1239 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1240 is_terminated: bool,
1241}
1242
1243impl std::marker::Unpin for ConnectorRequestStream {}
1244
1245impl futures::stream::FusedStream for ConnectorRequestStream {
1246 fn is_terminated(&self) -> bool {
1247 self.is_terminated
1248 }
1249}
1250
1251impl fidl::endpoints::RequestStream for ConnectorRequestStream {
1252 type Protocol = ConnectorMarker;
1253 type ControlHandle = ConnectorControlHandle;
1254
1255 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1256 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1257 }
1258
1259 fn control_handle(&self) -> Self::ControlHandle {
1260 ConnectorControlHandle { inner: self.inner.clone() }
1261 }
1262
1263 fn into_inner(
1264 self,
1265 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1266 {
1267 (self.inner, self.is_terminated)
1268 }
1269
1270 fn from_inner(
1271 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1272 is_terminated: bool,
1273 ) -> Self {
1274 Self { inner, is_terminated }
1275 }
1276}
1277
1278impl futures::Stream for ConnectorRequestStream {
1279 type Item = Result<ConnectorRequest, fidl::Error>;
1280
1281 fn poll_next(
1282 mut self: std::pin::Pin<&mut Self>,
1283 cx: &mut std::task::Context<'_>,
1284 ) -> std::task::Poll<Option<Self::Item>> {
1285 let this = &mut *self;
1286 if this.inner.check_shutdown(cx) {
1287 this.is_terminated = true;
1288 return std::task::Poll::Ready(None);
1289 }
1290 if this.is_terminated {
1291 panic!("polled ConnectorRequestStream after completion");
1292 }
1293 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1294 |bytes, handles| {
1295 match this.inner.channel().read_etc(cx, bytes, handles) {
1296 std::task::Poll::Ready(Ok(())) => {}
1297 std::task::Poll::Pending => return std::task::Poll::Pending,
1298 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1299 this.is_terminated = true;
1300 return std::task::Poll::Ready(None);
1301 }
1302 std::task::Poll::Ready(Err(e)) => {
1303 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1304 e.into(),
1305 ))))
1306 }
1307 }
1308
1309 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1311
1312 std::task::Poll::Ready(Some(match header.ordinal {
1313 0xdf55c5e6a6a4117 => {
1314 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1315 let mut req = fidl::new_empty!(
1316 ConnectorConnectRequest,
1317 fidl::encoding::DefaultFuchsiaResourceDialect
1318 );
1319 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1320 let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
1321 Ok(ConnectorRequest::Connect {
1322 remote_cid: req.remote_cid,
1323 remote_port: req.remote_port,
1324 con: req.con,
1325
1326 responder: ConnectorConnectResponder {
1327 control_handle: std::mem::ManuallyDrop::new(control_handle),
1328 tx_id: header.tx_id,
1329 },
1330 })
1331 }
1332 0x17c1371908bacf73 => {
1333 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1334 let mut req = fidl::new_empty!(
1335 ConnectorListenRequest,
1336 fidl::encoding::DefaultFuchsiaResourceDialect
1337 );
1338 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectorListenRequest>(&header, _body_bytes, handles, &mut req)?;
1339 let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
1340 Ok(ConnectorRequest::Listen {
1341 local_port: req.local_port,
1342 acceptor: req.acceptor,
1343
1344 responder: ConnectorListenResponder {
1345 control_handle: std::mem::ManuallyDrop::new(control_handle),
1346 tx_id: header.tx_id,
1347 },
1348 })
1349 }
1350 0x6e50cd8c895f2e0 => {
1351 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1352 let mut req = fidl::new_empty!(
1353 ConnectorBindRequest,
1354 fidl::encoding::DefaultFuchsiaResourceDialect
1355 );
1356 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectorBindRequest>(&header, _body_bytes, handles, &mut req)?;
1357 let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
1358 Ok(ConnectorRequest::Bind {
1359 remote_cid: req.remote_cid,
1360 local_port: req.local_port,
1361 listener: req.listener,
1362
1363 responder: ConnectorBindResponder {
1364 control_handle: std::mem::ManuallyDrop::new(control_handle),
1365 tx_id: header.tx_id,
1366 },
1367 })
1368 }
1369 _ => Err(fidl::Error::UnknownOrdinal {
1370 ordinal: header.ordinal,
1371 protocol_name:
1372 <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1373 }),
1374 }))
1375 },
1376 )
1377 }
1378}
1379
1380#[derive(Debug)]
1384pub enum ConnectorRequest {
1385 Connect {
1388 remote_cid: u32,
1389 remote_port: u32,
1390 con: ConnectionTransport,
1391 responder: ConnectorConnectResponder,
1392 },
1393 Listen {
1396 local_port: u32,
1397 acceptor: fidl::endpoints::ClientEnd<AcceptorMarker>,
1398 responder: ConnectorListenResponder,
1399 },
1400 Bind {
1403 remote_cid: u32,
1404 local_port: u32,
1405 listener: fidl::endpoints::ServerEnd<ListenerMarker>,
1406 responder: ConnectorBindResponder,
1407 },
1408}
1409
1410impl ConnectorRequest {
1411 #[allow(irrefutable_let_patterns)]
1412 pub fn into_connect(
1413 self,
1414 ) -> Option<(u32, u32, ConnectionTransport, ConnectorConnectResponder)> {
1415 if let ConnectorRequest::Connect { remote_cid, remote_port, con, responder } = self {
1416 Some((remote_cid, remote_port, con, responder))
1417 } else {
1418 None
1419 }
1420 }
1421
1422 #[allow(irrefutable_let_patterns)]
1423 pub fn into_listen(
1424 self,
1425 ) -> Option<(u32, fidl::endpoints::ClientEnd<AcceptorMarker>, ConnectorListenResponder)> {
1426 if let ConnectorRequest::Listen { local_port, acceptor, responder } = self {
1427 Some((local_port, acceptor, responder))
1428 } else {
1429 None
1430 }
1431 }
1432
1433 #[allow(irrefutable_let_patterns)]
1434 pub fn into_bind(
1435 self,
1436 ) -> Option<(u32, u32, fidl::endpoints::ServerEnd<ListenerMarker>, ConnectorBindResponder)>
1437 {
1438 if let ConnectorRequest::Bind { remote_cid, local_port, listener, responder } = self {
1439 Some((remote_cid, local_port, listener, responder))
1440 } else {
1441 None
1442 }
1443 }
1444
1445 pub fn method_name(&self) -> &'static str {
1447 match *self {
1448 ConnectorRequest::Connect { .. } => "connect",
1449 ConnectorRequest::Listen { .. } => "listen",
1450 ConnectorRequest::Bind { .. } => "bind",
1451 }
1452 }
1453}
1454
1455#[derive(Debug, Clone)]
1456pub struct ConnectorControlHandle {
1457 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1458}
1459
1460impl fidl::endpoints::ControlHandle for ConnectorControlHandle {
1461 fn shutdown(&self) {
1462 self.inner.shutdown()
1463 }
1464 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1465 self.inner.shutdown_with_epitaph(status)
1466 }
1467
1468 fn is_closed(&self) -> bool {
1469 self.inner.channel().is_closed()
1470 }
1471 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1472 self.inner.channel().on_closed()
1473 }
1474
1475 #[cfg(target_os = "fuchsia")]
1476 fn signal_peer(
1477 &self,
1478 clear_mask: zx::Signals,
1479 set_mask: zx::Signals,
1480 ) -> Result<(), zx_status::Status> {
1481 use fidl::Peered;
1482 self.inner.channel().signal_peer(clear_mask, set_mask)
1483 }
1484}
1485
1486impl ConnectorControlHandle {}
1487
1488#[must_use = "FIDL methods require a response to be sent"]
1489#[derive(Debug)]
1490pub struct ConnectorConnectResponder {
1491 control_handle: std::mem::ManuallyDrop<ConnectorControlHandle>,
1492 tx_id: u32,
1493}
1494
1495impl std::ops::Drop for ConnectorConnectResponder {
1499 fn drop(&mut self) {
1500 self.control_handle.shutdown();
1501 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1503 }
1504}
1505
1506impl fidl::endpoints::Responder for ConnectorConnectResponder {
1507 type ControlHandle = ConnectorControlHandle;
1508
1509 fn control_handle(&self) -> &ConnectorControlHandle {
1510 &self.control_handle
1511 }
1512
1513 fn drop_without_shutdown(mut self) {
1514 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1516 std::mem::forget(self);
1518 }
1519}
1520
1521impl ConnectorConnectResponder {
1522 pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1526 let _result = self.send_raw(result);
1527 if _result.is_err() {
1528 self.control_handle.shutdown();
1529 }
1530 self.drop_without_shutdown();
1531 _result
1532 }
1533
1534 pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1536 let _result = self.send_raw(result);
1537 self.drop_without_shutdown();
1538 _result
1539 }
1540
1541 fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1542 self.control_handle.inner.send::<fidl::encoding::ResultType<ConnectorConnectResponse, i32>>(
1543 result.map(|local_port| (local_port,)),
1544 self.tx_id,
1545 0xdf55c5e6a6a4117,
1546 fidl::encoding::DynamicFlags::empty(),
1547 )
1548 }
1549}
1550
1551#[must_use = "FIDL methods require a response to be sent"]
1552#[derive(Debug)]
1553pub struct ConnectorListenResponder {
1554 control_handle: std::mem::ManuallyDrop<ConnectorControlHandle>,
1555 tx_id: u32,
1556}
1557
1558impl std::ops::Drop for ConnectorListenResponder {
1562 fn drop(&mut self) {
1563 self.control_handle.shutdown();
1564 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1566 }
1567}
1568
1569impl fidl::endpoints::Responder for ConnectorListenResponder {
1570 type ControlHandle = ConnectorControlHandle;
1571
1572 fn control_handle(&self) -> &ConnectorControlHandle {
1573 &self.control_handle
1574 }
1575
1576 fn drop_without_shutdown(mut self) {
1577 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1579 std::mem::forget(self);
1581 }
1582}
1583
1584impl ConnectorListenResponder {
1585 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1589 let _result = self.send_raw(result);
1590 if _result.is_err() {
1591 self.control_handle.shutdown();
1592 }
1593 self.drop_without_shutdown();
1594 _result
1595 }
1596
1597 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1599 let _result = self.send_raw(result);
1600 self.drop_without_shutdown();
1601 _result
1602 }
1603
1604 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1605 self.control_handle
1606 .inner
1607 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1608 result,
1609 self.tx_id,
1610 0x17c1371908bacf73,
1611 fidl::encoding::DynamicFlags::empty(),
1612 )
1613 }
1614}
1615
1616#[must_use = "FIDL methods require a response to be sent"]
1617#[derive(Debug)]
1618pub struct ConnectorBindResponder {
1619 control_handle: std::mem::ManuallyDrop<ConnectorControlHandle>,
1620 tx_id: u32,
1621}
1622
1623impl std::ops::Drop for ConnectorBindResponder {
1627 fn drop(&mut self) {
1628 self.control_handle.shutdown();
1629 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1631 }
1632}
1633
1634impl fidl::endpoints::Responder for ConnectorBindResponder {
1635 type ControlHandle = ConnectorControlHandle;
1636
1637 fn control_handle(&self) -> &ConnectorControlHandle {
1638 &self.control_handle
1639 }
1640
1641 fn drop_without_shutdown(mut self) {
1642 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1644 std::mem::forget(self);
1646 }
1647}
1648
1649impl ConnectorBindResponder {
1650 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1654 let _result = self.send_raw(result);
1655 if _result.is_err() {
1656 self.control_handle.shutdown();
1657 }
1658 self.drop_without_shutdown();
1659 _result
1660 }
1661
1662 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1664 let _result = self.send_raw(result);
1665 self.drop_without_shutdown();
1666 _result
1667 }
1668
1669 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1670 self.control_handle
1671 .inner
1672 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1673 result,
1674 self.tx_id,
1675 0x6e50cd8c895f2e0,
1676 fidl::encoding::DynamicFlags::empty(),
1677 )
1678 }
1679}
1680
1681#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1682pub struct ListenerMarker;
1683
1684impl fidl::endpoints::ProtocolMarker for ListenerMarker {
1685 type Proxy = ListenerProxy;
1686 type RequestStream = ListenerRequestStream;
1687 #[cfg(target_os = "fuchsia")]
1688 type SynchronousProxy = ListenerSynchronousProxy;
1689
1690 const DEBUG_NAME: &'static str = "(anonymous) Listener";
1691}
1692pub type ListenerListenResult = Result<(), i32>;
1693pub type ListenerAcceptResult = Result<fidl_fuchsia_hardware_vsock::Addr, i32>;
1694
1695pub trait ListenerProxyInterface: Send + Sync {
1696 type ListenResponseFut: std::future::Future<Output = Result<ListenerListenResult, fidl::Error>>
1697 + Send;
1698 fn r#listen(&self, backlog: u32) -> Self::ListenResponseFut;
1699 type AcceptResponseFut: std::future::Future<Output = Result<ListenerAcceptResult, fidl::Error>>
1700 + Send;
1701 fn r#accept(&self, con: ConnectionTransport) -> Self::AcceptResponseFut;
1702}
1703#[derive(Debug)]
1704#[cfg(target_os = "fuchsia")]
1705pub struct ListenerSynchronousProxy {
1706 client: fidl::client::sync::Client,
1707}
1708
1709#[cfg(target_os = "fuchsia")]
1710impl fidl::endpoints::SynchronousProxy for ListenerSynchronousProxy {
1711 type Proxy = ListenerProxy;
1712 type Protocol = ListenerMarker;
1713
1714 fn from_channel(inner: fidl::Channel) -> Self {
1715 Self::new(inner)
1716 }
1717
1718 fn into_channel(self) -> fidl::Channel {
1719 self.client.into_channel()
1720 }
1721
1722 fn as_channel(&self) -> &fidl::Channel {
1723 self.client.as_channel()
1724 }
1725}
1726
1727#[cfg(target_os = "fuchsia")]
1728impl ListenerSynchronousProxy {
1729 pub fn new(channel: fidl::Channel) -> Self {
1730 let protocol_name = <ListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1731 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1732 }
1733
1734 pub fn into_channel(self) -> fidl::Channel {
1735 self.client.into_channel()
1736 }
1737
1738 pub fn wait_for_event(
1741 &self,
1742 deadline: zx::MonotonicInstant,
1743 ) -> Result<ListenerEvent, fidl::Error> {
1744 ListenerEvent::decode(self.client.wait_for_event(deadline)?)
1745 }
1746
1747 pub fn r#listen(
1751 &self,
1752 mut backlog: u32,
1753 ___deadline: zx::MonotonicInstant,
1754 ) -> Result<ListenerListenResult, fidl::Error> {
1755 let _response = self.client.send_query::<
1756 ListenerListenRequest,
1757 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1758 >(
1759 (backlog,),
1760 0x53042f6a15d94464,
1761 fidl::encoding::DynamicFlags::empty(),
1762 ___deadline,
1763 )?;
1764 Ok(_response.map(|x| x))
1765 }
1766
1767 pub fn r#accept(
1770 &self,
1771 mut con: ConnectionTransport,
1772 ___deadline: zx::MonotonicInstant,
1773 ) -> Result<ListenerAcceptResult, fidl::Error> {
1774 let _response = self.client.send_query::<
1775 ListenerAcceptRequest,
1776 fidl::encoding::ResultType<ListenerAcceptResponse, i32>,
1777 >(
1778 (&mut con,),
1779 0x4b71e6389d92d322,
1780 fidl::encoding::DynamicFlags::empty(),
1781 ___deadline,
1782 )?;
1783 Ok(_response.map(|x| x.addr))
1784 }
1785}
1786
1787#[cfg(target_os = "fuchsia")]
1788impl From<ListenerSynchronousProxy> for zx::Handle {
1789 fn from(value: ListenerSynchronousProxy) -> Self {
1790 value.into_channel().into()
1791 }
1792}
1793
1794#[cfg(target_os = "fuchsia")]
1795impl From<fidl::Channel> for ListenerSynchronousProxy {
1796 fn from(value: fidl::Channel) -> Self {
1797 Self::new(value)
1798 }
1799}
1800
1801#[derive(Debug, Clone)]
1802pub struct ListenerProxy {
1803 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1804}
1805
1806impl fidl::endpoints::Proxy for ListenerProxy {
1807 type Protocol = ListenerMarker;
1808
1809 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1810 Self::new(inner)
1811 }
1812
1813 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1814 self.client.into_channel().map_err(|client| Self { client })
1815 }
1816
1817 fn as_channel(&self) -> &::fidl::AsyncChannel {
1818 self.client.as_channel()
1819 }
1820}
1821
1822impl ListenerProxy {
1823 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1825 let protocol_name = <ListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1826 Self { client: fidl::client::Client::new(channel, protocol_name) }
1827 }
1828
1829 pub fn take_event_stream(&self) -> ListenerEventStream {
1835 ListenerEventStream { event_receiver: self.client.take_event_receiver() }
1836 }
1837
1838 pub fn r#listen(
1842 &self,
1843 mut backlog: u32,
1844 ) -> fidl::client::QueryResponseFut<
1845 ListenerListenResult,
1846 fidl::encoding::DefaultFuchsiaResourceDialect,
1847 > {
1848 ListenerProxyInterface::r#listen(self, backlog)
1849 }
1850
1851 pub fn r#accept(
1854 &self,
1855 mut con: ConnectionTransport,
1856 ) -> fidl::client::QueryResponseFut<
1857 ListenerAcceptResult,
1858 fidl::encoding::DefaultFuchsiaResourceDialect,
1859 > {
1860 ListenerProxyInterface::r#accept(self, con)
1861 }
1862}
1863
1864impl ListenerProxyInterface for ListenerProxy {
1865 type ListenResponseFut = fidl::client::QueryResponseFut<
1866 ListenerListenResult,
1867 fidl::encoding::DefaultFuchsiaResourceDialect,
1868 >;
1869 fn r#listen(&self, mut backlog: u32) -> Self::ListenResponseFut {
1870 fn _decode(
1871 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1872 ) -> Result<ListenerListenResult, fidl::Error> {
1873 let _response = fidl::client::decode_transaction_body::<
1874 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1875 fidl::encoding::DefaultFuchsiaResourceDialect,
1876 0x53042f6a15d94464,
1877 >(_buf?)?;
1878 Ok(_response.map(|x| x))
1879 }
1880 self.client.send_query_and_decode::<ListenerListenRequest, ListenerListenResult>(
1881 (backlog,),
1882 0x53042f6a15d94464,
1883 fidl::encoding::DynamicFlags::empty(),
1884 _decode,
1885 )
1886 }
1887
1888 type AcceptResponseFut = fidl::client::QueryResponseFut<
1889 ListenerAcceptResult,
1890 fidl::encoding::DefaultFuchsiaResourceDialect,
1891 >;
1892 fn r#accept(&self, mut con: ConnectionTransport) -> Self::AcceptResponseFut {
1893 fn _decode(
1894 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1895 ) -> Result<ListenerAcceptResult, fidl::Error> {
1896 let _response = fidl::client::decode_transaction_body::<
1897 fidl::encoding::ResultType<ListenerAcceptResponse, i32>,
1898 fidl::encoding::DefaultFuchsiaResourceDialect,
1899 0x4b71e6389d92d322,
1900 >(_buf?)?;
1901 Ok(_response.map(|x| x.addr))
1902 }
1903 self.client.send_query_and_decode::<ListenerAcceptRequest, ListenerAcceptResult>(
1904 (&mut con,),
1905 0x4b71e6389d92d322,
1906 fidl::encoding::DynamicFlags::empty(),
1907 _decode,
1908 )
1909 }
1910}
1911
1912pub struct ListenerEventStream {
1913 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1914}
1915
1916impl std::marker::Unpin for ListenerEventStream {}
1917
1918impl futures::stream::FusedStream for ListenerEventStream {
1919 fn is_terminated(&self) -> bool {
1920 self.event_receiver.is_terminated()
1921 }
1922}
1923
1924impl futures::Stream for ListenerEventStream {
1925 type Item = Result<ListenerEvent, fidl::Error>;
1926
1927 fn poll_next(
1928 mut self: std::pin::Pin<&mut Self>,
1929 cx: &mut std::task::Context<'_>,
1930 ) -> std::task::Poll<Option<Self::Item>> {
1931 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1932 &mut self.event_receiver,
1933 cx
1934 )?) {
1935 Some(buf) => std::task::Poll::Ready(Some(ListenerEvent::decode(buf))),
1936 None => std::task::Poll::Ready(None),
1937 }
1938 }
1939}
1940
1941#[derive(Debug)]
1942pub enum ListenerEvent {}
1943
1944impl ListenerEvent {
1945 fn decode(
1947 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1948 ) -> Result<ListenerEvent, fidl::Error> {
1949 let (bytes, _handles) = buf.split_mut();
1950 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1951 debug_assert_eq!(tx_header.tx_id, 0);
1952 match tx_header.ordinal {
1953 _ => Err(fidl::Error::UnknownOrdinal {
1954 ordinal: tx_header.ordinal,
1955 protocol_name: <ListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1956 }),
1957 }
1958 }
1959}
1960
1961pub struct ListenerRequestStream {
1963 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1964 is_terminated: bool,
1965}
1966
1967impl std::marker::Unpin for ListenerRequestStream {}
1968
1969impl futures::stream::FusedStream for ListenerRequestStream {
1970 fn is_terminated(&self) -> bool {
1971 self.is_terminated
1972 }
1973}
1974
1975impl fidl::endpoints::RequestStream for ListenerRequestStream {
1976 type Protocol = ListenerMarker;
1977 type ControlHandle = ListenerControlHandle;
1978
1979 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1980 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1981 }
1982
1983 fn control_handle(&self) -> Self::ControlHandle {
1984 ListenerControlHandle { inner: self.inner.clone() }
1985 }
1986
1987 fn into_inner(
1988 self,
1989 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1990 {
1991 (self.inner, self.is_terminated)
1992 }
1993
1994 fn from_inner(
1995 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1996 is_terminated: bool,
1997 ) -> Self {
1998 Self { inner, is_terminated }
1999 }
2000}
2001
2002impl futures::Stream for ListenerRequestStream {
2003 type Item = Result<ListenerRequest, fidl::Error>;
2004
2005 fn poll_next(
2006 mut self: std::pin::Pin<&mut Self>,
2007 cx: &mut std::task::Context<'_>,
2008 ) -> std::task::Poll<Option<Self::Item>> {
2009 let this = &mut *self;
2010 if this.inner.check_shutdown(cx) {
2011 this.is_terminated = true;
2012 return std::task::Poll::Ready(None);
2013 }
2014 if this.is_terminated {
2015 panic!("polled ListenerRequestStream after completion");
2016 }
2017 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2018 |bytes, handles| {
2019 match this.inner.channel().read_etc(cx, bytes, handles) {
2020 std::task::Poll::Ready(Ok(())) => {}
2021 std::task::Poll::Pending => return std::task::Poll::Pending,
2022 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2023 this.is_terminated = true;
2024 return std::task::Poll::Ready(None);
2025 }
2026 std::task::Poll::Ready(Err(e)) => {
2027 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2028 e.into(),
2029 ))))
2030 }
2031 }
2032
2033 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2035
2036 std::task::Poll::Ready(Some(match header.ordinal {
2037 0x53042f6a15d94464 => {
2038 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2039 let mut req = fidl::new_empty!(
2040 ListenerListenRequest,
2041 fidl::encoding::DefaultFuchsiaResourceDialect
2042 );
2043 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ListenerListenRequest>(&header, _body_bytes, handles, &mut req)?;
2044 let control_handle = ListenerControlHandle { inner: this.inner.clone() };
2045 Ok(ListenerRequest::Listen {
2046 backlog: req.backlog,
2047
2048 responder: ListenerListenResponder {
2049 control_handle: std::mem::ManuallyDrop::new(control_handle),
2050 tx_id: header.tx_id,
2051 },
2052 })
2053 }
2054 0x4b71e6389d92d322 => {
2055 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2056 let mut req = fidl::new_empty!(
2057 ListenerAcceptRequest,
2058 fidl::encoding::DefaultFuchsiaResourceDialect
2059 );
2060 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ListenerAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
2061 let control_handle = ListenerControlHandle { inner: this.inner.clone() };
2062 Ok(ListenerRequest::Accept {
2063 con: req.con,
2064
2065 responder: ListenerAcceptResponder {
2066 control_handle: std::mem::ManuallyDrop::new(control_handle),
2067 tx_id: header.tx_id,
2068 },
2069 })
2070 }
2071 _ => Err(fidl::Error::UnknownOrdinal {
2072 ordinal: header.ordinal,
2073 protocol_name:
2074 <ListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2075 }),
2076 }))
2077 },
2078 )
2079 }
2080}
2081
2082#[derive(Debug)]
2084pub enum ListenerRequest {
2085 Listen { backlog: u32, responder: ListenerListenResponder },
2089 Accept { con: ConnectionTransport, responder: ListenerAcceptResponder },
2092}
2093
2094impl ListenerRequest {
2095 #[allow(irrefutable_let_patterns)]
2096 pub fn into_listen(self) -> Option<(u32, ListenerListenResponder)> {
2097 if let ListenerRequest::Listen { backlog, responder } = self {
2098 Some((backlog, responder))
2099 } else {
2100 None
2101 }
2102 }
2103
2104 #[allow(irrefutable_let_patterns)]
2105 pub fn into_accept(self) -> Option<(ConnectionTransport, ListenerAcceptResponder)> {
2106 if let ListenerRequest::Accept { con, responder } = self {
2107 Some((con, responder))
2108 } else {
2109 None
2110 }
2111 }
2112
2113 pub fn method_name(&self) -> &'static str {
2115 match *self {
2116 ListenerRequest::Listen { .. } => "listen",
2117 ListenerRequest::Accept { .. } => "accept",
2118 }
2119 }
2120}
2121
2122#[derive(Debug, Clone)]
2123pub struct ListenerControlHandle {
2124 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2125}
2126
2127impl fidl::endpoints::ControlHandle for ListenerControlHandle {
2128 fn shutdown(&self) {
2129 self.inner.shutdown()
2130 }
2131 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2132 self.inner.shutdown_with_epitaph(status)
2133 }
2134
2135 fn is_closed(&self) -> bool {
2136 self.inner.channel().is_closed()
2137 }
2138 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2139 self.inner.channel().on_closed()
2140 }
2141
2142 #[cfg(target_os = "fuchsia")]
2143 fn signal_peer(
2144 &self,
2145 clear_mask: zx::Signals,
2146 set_mask: zx::Signals,
2147 ) -> Result<(), zx_status::Status> {
2148 use fidl::Peered;
2149 self.inner.channel().signal_peer(clear_mask, set_mask)
2150 }
2151}
2152
2153impl ListenerControlHandle {}
2154
2155#[must_use = "FIDL methods require a response to be sent"]
2156#[derive(Debug)]
2157pub struct ListenerListenResponder {
2158 control_handle: std::mem::ManuallyDrop<ListenerControlHandle>,
2159 tx_id: u32,
2160}
2161
2162impl std::ops::Drop for ListenerListenResponder {
2166 fn drop(&mut self) {
2167 self.control_handle.shutdown();
2168 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2170 }
2171}
2172
2173impl fidl::endpoints::Responder for ListenerListenResponder {
2174 type ControlHandle = ListenerControlHandle;
2175
2176 fn control_handle(&self) -> &ListenerControlHandle {
2177 &self.control_handle
2178 }
2179
2180 fn drop_without_shutdown(mut self) {
2181 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2183 std::mem::forget(self);
2185 }
2186}
2187
2188impl ListenerListenResponder {
2189 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2193 let _result = self.send_raw(result);
2194 if _result.is_err() {
2195 self.control_handle.shutdown();
2196 }
2197 self.drop_without_shutdown();
2198 _result
2199 }
2200
2201 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2203 let _result = self.send_raw(result);
2204 self.drop_without_shutdown();
2205 _result
2206 }
2207
2208 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2209 self.control_handle
2210 .inner
2211 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2212 result,
2213 self.tx_id,
2214 0x53042f6a15d94464,
2215 fidl::encoding::DynamicFlags::empty(),
2216 )
2217 }
2218}
2219
2220#[must_use = "FIDL methods require a response to be sent"]
2221#[derive(Debug)]
2222pub struct ListenerAcceptResponder {
2223 control_handle: std::mem::ManuallyDrop<ListenerControlHandle>,
2224 tx_id: u32,
2225}
2226
2227impl std::ops::Drop for ListenerAcceptResponder {
2231 fn drop(&mut self) {
2232 self.control_handle.shutdown();
2233 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2235 }
2236}
2237
2238impl fidl::endpoints::Responder for ListenerAcceptResponder {
2239 type ControlHandle = ListenerControlHandle;
2240
2241 fn control_handle(&self) -> &ListenerControlHandle {
2242 &self.control_handle
2243 }
2244
2245 fn drop_without_shutdown(mut self) {
2246 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2248 std::mem::forget(self);
2250 }
2251}
2252
2253impl ListenerAcceptResponder {
2254 pub fn send(
2258 self,
2259 mut result: Result<&fidl_fuchsia_hardware_vsock::Addr, i32>,
2260 ) -> Result<(), fidl::Error> {
2261 let _result = self.send_raw(result);
2262 if _result.is_err() {
2263 self.control_handle.shutdown();
2264 }
2265 self.drop_without_shutdown();
2266 _result
2267 }
2268
2269 pub fn send_no_shutdown_on_err(
2271 self,
2272 mut result: Result<&fidl_fuchsia_hardware_vsock::Addr, i32>,
2273 ) -> Result<(), fidl::Error> {
2274 let _result = self.send_raw(result);
2275 self.drop_without_shutdown();
2276 _result
2277 }
2278
2279 fn send_raw(
2280 &self,
2281 mut result: Result<&fidl_fuchsia_hardware_vsock::Addr, i32>,
2282 ) -> Result<(), fidl::Error> {
2283 self.control_handle.inner.send::<fidl::encoding::ResultType<ListenerAcceptResponse, i32>>(
2284 result.map(|addr| (addr,)),
2285 self.tx_id,
2286 0x4b71e6389d92d322,
2287 fidl::encoding::DynamicFlags::empty(),
2288 )
2289 }
2290}
2291
2292mod internal {
2293 use super::*;
2294
2295 impl fidl::encoding::ResourceTypeMarker for AcceptorAcceptResponse {
2296 type Borrowed<'a> = &'a mut Self;
2297 fn take_or_borrow<'a>(
2298 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2299 ) -> Self::Borrowed<'a> {
2300 value
2301 }
2302 }
2303
2304 unsafe impl fidl::encoding::TypeMarker for AcceptorAcceptResponse {
2305 type Owned = Self;
2306
2307 #[inline(always)]
2308 fn inline_align(_context: fidl::encoding::Context) -> usize {
2309 8
2310 }
2311
2312 #[inline(always)]
2313 fn inline_size(_context: fidl::encoding::Context) -> usize {
2314 8
2315 }
2316 }
2317
2318 unsafe impl
2319 fidl::encoding::Encode<
2320 AcceptorAcceptResponse,
2321 fidl::encoding::DefaultFuchsiaResourceDialect,
2322 > for &mut AcceptorAcceptResponse
2323 {
2324 #[inline]
2325 unsafe fn encode(
2326 self,
2327 encoder: &mut fidl::encoding::Encoder<
2328 '_,
2329 fidl::encoding::DefaultFuchsiaResourceDialect,
2330 >,
2331 offset: usize,
2332 _depth: fidl::encoding::Depth,
2333 ) -> fidl::Result<()> {
2334 encoder.debug_check_bounds::<AcceptorAcceptResponse>(offset);
2335 fidl::encoding::Encode::<AcceptorAcceptResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2337 (
2338 <fidl::encoding::Boxed<ConnectionTransport> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.con),
2339 ),
2340 encoder, offset, _depth
2341 )
2342 }
2343 }
2344 unsafe impl<
2345 T0: fidl::encoding::Encode<
2346 fidl::encoding::Boxed<ConnectionTransport>,
2347 fidl::encoding::DefaultFuchsiaResourceDialect,
2348 >,
2349 >
2350 fidl::encoding::Encode<
2351 AcceptorAcceptResponse,
2352 fidl::encoding::DefaultFuchsiaResourceDialect,
2353 > for (T0,)
2354 {
2355 #[inline]
2356 unsafe fn encode(
2357 self,
2358 encoder: &mut fidl::encoding::Encoder<
2359 '_,
2360 fidl::encoding::DefaultFuchsiaResourceDialect,
2361 >,
2362 offset: usize,
2363 depth: fidl::encoding::Depth,
2364 ) -> fidl::Result<()> {
2365 encoder.debug_check_bounds::<AcceptorAcceptResponse>(offset);
2366 self.0.encode(encoder, offset + 0, depth)?;
2370 Ok(())
2371 }
2372 }
2373
2374 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2375 for AcceptorAcceptResponse
2376 {
2377 #[inline(always)]
2378 fn new_empty() -> Self {
2379 Self {
2380 con: fidl::new_empty!(
2381 fidl::encoding::Boxed<ConnectionTransport>,
2382 fidl::encoding::DefaultFuchsiaResourceDialect
2383 ),
2384 }
2385 }
2386
2387 #[inline]
2388 unsafe fn decode(
2389 &mut self,
2390 decoder: &mut fidl::encoding::Decoder<
2391 '_,
2392 fidl::encoding::DefaultFuchsiaResourceDialect,
2393 >,
2394 offset: usize,
2395 _depth: fidl::encoding::Depth,
2396 ) -> fidl::Result<()> {
2397 decoder.debug_check_bounds::<Self>(offset);
2398 fidl::decode!(
2400 fidl::encoding::Boxed<ConnectionTransport>,
2401 fidl::encoding::DefaultFuchsiaResourceDialect,
2402 &mut self.con,
2403 decoder,
2404 offset + 0,
2405 _depth
2406 )?;
2407 Ok(())
2408 }
2409 }
2410
2411 impl fidl::encoding::ResourceTypeMarker for ConnectionTransport {
2412 type Borrowed<'a> = &'a mut Self;
2413 fn take_or_borrow<'a>(
2414 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2415 ) -> Self::Borrowed<'a> {
2416 value
2417 }
2418 }
2419
2420 unsafe impl fidl::encoding::TypeMarker for ConnectionTransport {
2421 type Owned = Self;
2422
2423 #[inline(always)]
2424 fn inline_align(_context: fidl::encoding::Context) -> usize {
2425 4
2426 }
2427
2428 #[inline(always)]
2429 fn inline_size(_context: fidl::encoding::Context) -> usize {
2430 8
2431 }
2432 }
2433
2434 unsafe impl
2435 fidl::encoding::Encode<ConnectionTransport, fidl::encoding::DefaultFuchsiaResourceDialect>
2436 for &mut ConnectionTransport
2437 {
2438 #[inline]
2439 unsafe fn encode(
2440 self,
2441 encoder: &mut fidl::encoding::Encoder<
2442 '_,
2443 fidl::encoding::DefaultFuchsiaResourceDialect,
2444 >,
2445 offset: usize,
2446 _depth: fidl::encoding::Depth,
2447 ) -> fidl::Result<()> {
2448 encoder.debug_check_bounds::<ConnectionTransport>(offset);
2449 fidl::encoding::Encode::<ConnectionTransport, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2451 (
2452 <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data),
2453 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.con),
2454 ),
2455 encoder, offset, _depth
2456 )
2457 }
2458 }
2459 unsafe impl<
2460 T0: fidl::encoding::Encode<
2461 fidl::encoding::HandleType<
2462 fidl::Socket,
2463 { fidl::ObjectType::SOCKET.into_raw() },
2464 2147483648,
2465 >,
2466 fidl::encoding::DefaultFuchsiaResourceDialect,
2467 >,
2468 T1: fidl::encoding::Encode<
2469 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
2470 fidl::encoding::DefaultFuchsiaResourceDialect,
2471 >,
2472 >
2473 fidl::encoding::Encode<ConnectionTransport, fidl::encoding::DefaultFuchsiaResourceDialect>
2474 for (T0, T1)
2475 {
2476 #[inline]
2477 unsafe fn encode(
2478 self,
2479 encoder: &mut fidl::encoding::Encoder<
2480 '_,
2481 fidl::encoding::DefaultFuchsiaResourceDialect,
2482 >,
2483 offset: usize,
2484 depth: fidl::encoding::Depth,
2485 ) -> fidl::Result<()> {
2486 encoder.debug_check_bounds::<ConnectionTransport>(offset);
2487 self.0.encode(encoder, offset + 0, depth)?;
2491 self.1.encode(encoder, offset + 4, depth)?;
2492 Ok(())
2493 }
2494 }
2495
2496 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2497 for ConnectionTransport
2498 {
2499 #[inline(always)]
2500 fn new_empty() -> Self {
2501 Self {
2502 data: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2503 con: fidl::new_empty!(
2504 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
2505 fidl::encoding::DefaultFuchsiaResourceDialect
2506 ),
2507 }
2508 }
2509
2510 #[inline]
2511 unsafe fn decode(
2512 &mut self,
2513 decoder: &mut fidl::encoding::Decoder<
2514 '_,
2515 fidl::encoding::DefaultFuchsiaResourceDialect,
2516 >,
2517 offset: usize,
2518 _depth: fidl::encoding::Depth,
2519 ) -> fidl::Result<()> {
2520 decoder.debug_check_bounds::<Self>(offset);
2521 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.data, decoder, offset + 0, _depth)?;
2523 fidl::decode!(
2524 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
2525 fidl::encoding::DefaultFuchsiaResourceDialect,
2526 &mut self.con,
2527 decoder,
2528 offset + 4,
2529 _depth
2530 )?;
2531 Ok(())
2532 }
2533 }
2534
2535 impl fidl::encoding::ResourceTypeMarker for ConnectorBindRequest {
2536 type Borrowed<'a> = &'a mut Self;
2537 fn take_or_borrow<'a>(
2538 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2539 ) -> Self::Borrowed<'a> {
2540 value
2541 }
2542 }
2543
2544 unsafe impl fidl::encoding::TypeMarker for ConnectorBindRequest {
2545 type Owned = Self;
2546
2547 #[inline(always)]
2548 fn inline_align(_context: fidl::encoding::Context) -> usize {
2549 4
2550 }
2551
2552 #[inline(always)]
2553 fn inline_size(_context: fidl::encoding::Context) -> usize {
2554 12
2555 }
2556 }
2557
2558 unsafe impl
2559 fidl::encoding::Encode<ConnectorBindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2560 for &mut ConnectorBindRequest
2561 {
2562 #[inline]
2563 unsafe fn encode(
2564 self,
2565 encoder: &mut fidl::encoding::Encoder<
2566 '_,
2567 fidl::encoding::DefaultFuchsiaResourceDialect,
2568 >,
2569 offset: usize,
2570 _depth: fidl::encoding::Depth,
2571 ) -> fidl::Result<()> {
2572 encoder.debug_check_bounds::<ConnectorBindRequest>(offset);
2573 fidl::encoding::Encode::<ConnectorBindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2575 (
2576 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_cid),
2577 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.local_port),
2578 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listener),
2579 ),
2580 encoder, offset, _depth
2581 )
2582 }
2583 }
2584 unsafe impl<
2585 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2586 T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2587 T2: fidl::encoding::Encode<
2588 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListenerMarker>>,
2589 fidl::encoding::DefaultFuchsiaResourceDialect,
2590 >,
2591 >
2592 fidl::encoding::Encode<ConnectorBindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2593 for (T0, T1, T2)
2594 {
2595 #[inline]
2596 unsafe fn encode(
2597 self,
2598 encoder: &mut fidl::encoding::Encoder<
2599 '_,
2600 fidl::encoding::DefaultFuchsiaResourceDialect,
2601 >,
2602 offset: usize,
2603 depth: fidl::encoding::Depth,
2604 ) -> fidl::Result<()> {
2605 encoder.debug_check_bounds::<ConnectorBindRequest>(offset);
2606 self.0.encode(encoder, offset + 0, depth)?;
2610 self.1.encode(encoder, offset + 4, depth)?;
2611 self.2.encode(encoder, offset + 8, depth)?;
2612 Ok(())
2613 }
2614 }
2615
2616 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2617 for ConnectorBindRequest
2618 {
2619 #[inline(always)]
2620 fn new_empty() -> Self {
2621 Self {
2622 remote_cid: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
2623 local_port: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
2624 listener: fidl::new_empty!(
2625 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListenerMarker>>,
2626 fidl::encoding::DefaultFuchsiaResourceDialect
2627 ),
2628 }
2629 }
2630
2631 #[inline]
2632 unsafe fn decode(
2633 &mut self,
2634 decoder: &mut fidl::encoding::Decoder<
2635 '_,
2636 fidl::encoding::DefaultFuchsiaResourceDialect,
2637 >,
2638 offset: usize,
2639 _depth: fidl::encoding::Depth,
2640 ) -> fidl::Result<()> {
2641 decoder.debug_check_bounds::<Self>(offset);
2642 fidl::decode!(
2644 u32,
2645 fidl::encoding::DefaultFuchsiaResourceDialect,
2646 &mut self.remote_cid,
2647 decoder,
2648 offset + 0,
2649 _depth
2650 )?;
2651 fidl::decode!(
2652 u32,
2653 fidl::encoding::DefaultFuchsiaResourceDialect,
2654 &mut self.local_port,
2655 decoder,
2656 offset + 4,
2657 _depth
2658 )?;
2659 fidl::decode!(
2660 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListenerMarker>>,
2661 fidl::encoding::DefaultFuchsiaResourceDialect,
2662 &mut self.listener,
2663 decoder,
2664 offset + 8,
2665 _depth
2666 )?;
2667 Ok(())
2668 }
2669 }
2670
2671 impl fidl::encoding::ResourceTypeMarker for ConnectorConnectRequest {
2672 type Borrowed<'a> = &'a mut Self;
2673 fn take_or_borrow<'a>(
2674 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2675 ) -> Self::Borrowed<'a> {
2676 value
2677 }
2678 }
2679
2680 unsafe impl fidl::encoding::TypeMarker for ConnectorConnectRequest {
2681 type Owned = Self;
2682
2683 #[inline(always)]
2684 fn inline_align(_context: fidl::encoding::Context) -> usize {
2685 4
2686 }
2687
2688 #[inline(always)]
2689 fn inline_size(_context: fidl::encoding::Context) -> usize {
2690 16
2691 }
2692 }
2693
2694 unsafe impl
2695 fidl::encoding::Encode<
2696 ConnectorConnectRequest,
2697 fidl::encoding::DefaultFuchsiaResourceDialect,
2698 > for &mut ConnectorConnectRequest
2699 {
2700 #[inline]
2701 unsafe fn encode(
2702 self,
2703 encoder: &mut fidl::encoding::Encoder<
2704 '_,
2705 fidl::encoding::DefaultFuchsiaResourceDialect,
2706 >,
2707 offset: usize,
2708 _depth: fidl::encoding::Depth,
2709 ) -> fidl::Result<()> {
2710 encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
2711 fidl::encoding::Encode::<
2713 ConnectorConnectRequest,
2714 fidl::encoding::DefaultFuchsiaResourceDialect,
2715 >::encode(
2716 (
2717 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_cid),
2718 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_port),
2719 <ConnectionTransport as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2720 &mut self.con,
2721 ),
2722 ),
2723 encoder,
2724 offset,
2725 _depth,
2726 )
2727 }
2728 }
2729 unsafe impl<
2730 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2731 T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2732 T2: fidl::encoding::Encode<
2733 ConnectionTransport,
2734 fidl::encoding::DefaultFuchsiaResourceDialect,
2735 >,
2736 >
2737 fidl::encoding::Encode<
2738 ConnectorConnectRequest,
2739 fidl::encoding::DefaultFuchsiaResourceDialect,
2740 > for (T0, T1, T2)
2741 {
2742 #[inline]
2743 unsafe fn encode(
2744 self,
2745 encoder: &mut fidl::encoding::Encoder<
2746 '_,
2747 fidl::encoding::DefaultFuchsiaResourceDialect,
2748 >,
2749 offset: usize,
2750 depth: fidl::encoding::Depth,
2751 ) -> fidl::Result<()> {
2752 encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
2753 self.0.encode(encoder, offset + 0, depth)?;
2757 self.1.encode(encoder, offset + 4, depth)?;
2758 self.2.encode(encoder, offset + 8, depth)?;
2759 Ok(())
2760 }
2761 }
2762
2763 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2764 for ConnectorConnectRequest
2765 {
2766 #[inline(always)]
2767 fn new_empty() -> Self {
2768 Self {
2769 remote_cid: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
2770 remote_port: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
2771 con: fidl::new_empty!(
2772 ConnectionTransport,
2773 fidl::encoding::DefaultFuchsiaResourceDialect
2774 ),
2775 }
2776 }
2777
2778 #[inline]
2779 unsafe fn decode(
2780 &mut self,
2781 decoder: &mut fidl::encoding::Decoder<
2782 '_,
2783 fidl::encoding::DefaultFuchsiaResourceDialect,
2784 >,
2785 offset: usize,
2786 _depth: fidl::encoding::Depth,
2787 ) -> fidl::Result<()> {
2788 decoder.debug_check_bounds::<Self>(offset);
2789 fidl::decode!(
2791 u32,
2792 fidl::encoding::DefaultFuchsiaResourceDialect,
2793 &mut self.remote_cid,
2794 decoder,
2795 offset + 0,
2796 _depth
2797 )?;
2798 fidl::decode!(
2799 u32,
2800 fidl::encoding::DefaultFuchsiaResourceDialect,
2801 &mut self.remote_port,
2802 decoder,
2803 offset + 4,
2804 _depth
2805 )?;
2806 fidl::decode!(
2807 ConnectionTransport,
2808 fidl::encoding::DefaultFuchsiaResourceDialect,
2809 &mut self.con,
2810 decoder,
2811 offset + 8,
2812 _depth
2813 )?;
2814 Ok(())
2815 }
2816 }
2817
2818 impl fidl::encoding::ResourceTypeMarker for ConnectorListenRequest {
2819 type Borrowed<'a> = &'a mut Self;
2820 fn take_or_borrow<'a>(
2821 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2822 ) -> Self::Borrowed<'a> {
2823 value
2824 }
2825 }
2826
2827 unsafe impl fidl::encoding::TypeMarker for ConnectorListenRequest {
2828 type Owned = Self;
2829
2830 #[inline(always)]
2831 fn inline_align(_context: fidl::encoding::Context) -> usize {
2832 4
2833 }
2834
2835 #[inline(always)]
2836 fn inline_size(_context: fidl::encoding::Context) -> usize {
2837 8
2838 }
2839 }
2840
2841 unsafe impl
2842 fidl::encoding::Encode<
2843 ConnectorListenRequest,
2844 fidl::encoding::DefaultFuchsiaResourceDialect,
2845 > for &mut ConnectorListenRequest
2846 {
2847 #[inline]
2848 unsafe fn encode(
2849 self,
2850 encoder: &mut fidl::encoding::Encoder<
2851 '_,
2852 fidl::encoding::DefaultFuchsiaResourceDialect,
2853 >,
2854 offset: usize,
2855 _depth: fidl::encoding::Depth,
2856 ) -> fidl::Result<()> {
2857 encoder.debug_check_bounds::<ConnectorListenRequest>(offset);
2858 fidl::encoding::Encode::<ConnectorListenRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2860 (
2861 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.local_port),
2862 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AcceptorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.acceptor),
2863 ),
2864 encoder, offset, _depth
2865 )
2866 }
2867 }
2868 unsafe impl<
2869 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2870 T1: fidl::encoding::Encode<
2871 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AcceptorMarker>>,
2872 fidl::encoding::DefaultFuchsiaResourceDialect,
2873 >,
2874 >
2875 fidl::encoding::Encode<
2876 ConnectorListenRequest,
2877 fidl::encoding::DefaultFuchsiaResourceDialect,
2878 > for (T0, T1)
2879 {
2880 #[inline]
2881 unsafe fn encode(
2882 self,
2883 encoder: &mut fidl::encoding::Encoder<
2884 '_,
2885 fidl::encoding::DefaultFuchsiaResourceDialect,
2886 >,
2887 offset: usize,
2888 depth: fidl::encoding::Depth,
2889 ) -> fidl::Result<()> {
2890 encoder.debug_check_bounds::<ConnectorListenRequest>(offset);
2891 self.0.encode(encoder, offset + 0, depth)?;
2895 self.1.encode(encoder, offset + 4, depth)?;
2896 Ok(())
2897 }
2898 }
2899
2900 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2901 for ConnectorListenRequest
2902 {
2903 #[inline(always)]
2904 fn new_empty() -> Self {
2905 Self {
2906 local_port: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
2907 acceptor: fidl::new_empty!(
2908 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AcceptorMarker>>,
2909 fidl::encoding::DefaultFuchsiaResourceDialect
2910 ),
2911 }
2912 }
2913
2914 #[inline]
2915 unsafe fn decode(
2916 &mut self,
2917 decoder: &mut fidl::encoding::Decoder<
2918 '_,
2919 fidl::encoding::DefaultFuchsiaResourceDialect,
2920 >,
2921 offset: usize,
2922 _depth: fidl::encoding::Depth,
2923 ) -> fidl::Result<()> {
2924 decoder.debug_check_bounds::<Self>(offset);
2925 fidl::decode!(
2927 u32,
2928 fidl::encoding::DefaultFuchsiaResourceDialect,
2929 &mut self.local_port,
2930 decoder,
2931 offset + 0,
2932 _depth
2933 )?;
2934 fidl::decode!(
2935 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AcceptorMarker>>,
2936 fidl::encoding::DefaultFuchsiaResourceDialect,
2937 &mut self.acceptor,
2938 decoder,
2939 offset + 4,
2940 _depth
2941 )?;
2942 Ok(())
2943 }
2944 }
2945
2946 impl fidl::encoding::ResourceTypeMarker for ListenerAcceptRequest {
2947 type Borrowed<'a> = &'a mut Self;
2948 fn take_or_borrow<'a>(
2949 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2950 ) -> Self::Borrowed<'a> {
2951 value
2952 }
2953 }
2954
2955 unsafe impl fidl::encoding::TypeMarker for ListenerAcceptRequest {
2956 type Owned = Self;
2957
2958 #[inline(always)]
2959 fn inline_align(_context: fidl::encoding::Context) -> usize {
2960 4
2961 }
2962
2963 #[inline(always)]
2964 fn inline_size(_context: fidl::encoding::Context) -> usize {
2965 8
2966 }
2967 }
2968
2969 unsafe impl
2970 fidl::encoding::Encode<ListenerAcceptRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2971 for &mut ListenerAcceptRequest
2972 {
2973 #[inline]
2974 unsafe fn encode(
2975 self,
2976 encoder: &mut fidl::encoding::Encoder<
2977 '_,
2978 fidl::encoding::DefaultFuchsiaResourceDialect,
2979 >,
2980 offset: usize,
2981 _depth: fidl::encoding::Depth,
2982 ) -> fidl::Result<()> {
2983 encoder.debug_check_bounds::<ListenerAcceptRequest>(offset);
2984 fidl::encoding::Encode::<
2986 ListenerAcceptRequest,
2987 fidl::encoding::DefaultFuchsiaResourceDialect,
2988 >::encode(
2989 (<ConnectionTransport as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2990 &mut self.con,
2991 ),),
2992 encoder,
2993 offset,
2994 _depth,
2995 )
2996 }
2997 }
2998 unsafe impl<
2999 T0: fidl::encoding::Encode<
3000 ConnectionTransport,
3001 fidl::encoding::DefaultFuchsiaResourceDialect,
3002 >,
3003 >
3004 fidl::encoding::Encode<ListenerAcceptRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3005 for (T0,)
3006 {
3007 #[inline]
3008 unsafe fn encode(
3009 self,
3010 encoder: &mut fidl::encoding::Encoder<
3011 '_,
3012 fidl::encoding::DefaultFuchsiaResourceDialect,
3013 >,
3014 offset: usize,
3015 depth: fidl::encoding::Depth,
3016 ) -> fidl::Result<()> {
3017 encoder.debug_check_bounds::<ListenerAcceptRequest>(offset);
3018 self.0.encode(encoder, offset + 0, depth)?;
3022 Ok(())
3023 }
3024 }
3025
3026 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3027 for ListenerAcceptRequest
3028 {
3029 #[inline(always)]
3030 fn new_empty() -> Self {
3031 Self {
3032 con: fidl::new_empty!(
3033 ConnectionTransport,
3034 fidl::encoding::DefaultFuchsiaResourceDialect
3035 ),
3036 }
3037 }
3038
3039 #[inline]
3040 unsafe fn decode(
3041 &mut self,
3042 decoder: &mut fidl::encoding::Decoder<
3043 '_,
3044 fidl::encoding::DefaultFuchsiaResourceDialect,
3045 >,
3046 offset: usize,
3047 _depth: fidl::encoding::Depth,
3048 ) -> fidl::Result<()> {
3049 decoder.debug_check_bounds::<Self>(offset);
3050 fidl::decode!(
3052 ConnectionTransport,
3053 fidl::encoding::DefaultFuchsiaResourceDialect,
3054 &mut self.con,
3055 decoder,
3056 offset + 0,
3057 _depth
3058 )?;
3059 Ok(())
3060 }
3061 }
3062}